Changeset 1108 for plugins/apostropheBlogPlugin/trunk/data/generator/sfDoctrineModule/aBlogAdmin/parts/batchAction.php
- Timestamp:
- 04/30/10 15:13:53 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostropheBlogPlugin/trunk/data/generator/sfDoctrineModule/aBlogAdmin/parts/batchAction.php
r501 r1108 44 44 } 45 45 46 protected function executeBatchDelete(sfWebRequest $request)46 protected function batchAction($action, sfWebRequest $request) 47 47 { 48 // TBB: use collection delete rather than a delete query. This ensures49 // that the object's delete() method is called, which provides50 // for checking userHasPrivileges()51 52 48 $ids = $request->getParameter('ids'); 53 49 … … 60 56 try 61 57 { 62 $items-> delete();58 $items->$action(); 63 59 } catch (Exception $e) 64 60 { 65 61 $error = true; 66 62 } 63 return $error; 64 } 65 66 protected function executeBatchDelete(sfWebRequest $request) 67 { 68 $error = $this->batchAction('delete', $request); 67 69 68 if (($count == count($ ids)) && (!$error))70 if (($count == count($request->getParameter('ids'))) && (!$error)) 69 71 { 70 72 $this->getUser()->setFlash('notice', 'The selected items have been deleted successfully.'); … … 77 79 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 78 80 } 81 82 83 protected function executeBatchPublish(sfWebRequest $request) 84 { 85 $error = $this->batchAction('publish', $request); 86 87 if (($count == count($request->getParameter('ids'))) && (!$error)) 88 { 89 $this->getUser()->setFlash('notice', 'The selected items have been published successfully.'); 90 } 91 else 92 { 93 $this->getUser()->setFlash('error', 'An error occurred while publishing the selected items.'); 94 } 95 96 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 97 } 98 99 protected function executeBatchUnpublish(sfWebRequest $request) 100 { 101 $error = $this->batchAction('unpublish', $request); 102 103 if (($count == count($request->getParameter('ids'))) && (!$error)) 104 { 105 $this->getUser()->setFlash('notice', 'The selected items have been unpublished successfully.'); 106 } 107 else 108 { 109 $this->getUser()->setFlash('error', 'An error occurred while unpublishing the selected items.'); 110 } 111 112 $this->redirect('@<?php echo $this->getUrlForAction('list') ?>'); 113 }

