From 4123c100e127baa70da62990daa88bde3071fe5e Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Wed, 11 Jan 2012 19:22:47 +0100 Subject: make notifier call static --- application/models/SessionMapper.php | 8 ++++---- .../modules/fbgui/controllers/IndexController.php | 24 +++++++++++----------- .../modules/user/controllers/AuthController.php | 16 +++++++-------- .../modules/user/controllers/BootisoController.php | 16 +++++++-------- .../user/controllers/BootmenuController.php | 16 +++++++-------- .../modules/user/controllers/BootosController.php | 16 +++++++-------- .../modules/user/controllers/ClientController.php | 16 +++++++-------- .../modules/user/controllers/ConfigController.php | 24 +++++++++++----------- .../modules/user/controllers/FilterController.php | 16 +++++++-------- .../modules/user/controllers/GroupController.php | 24 +++++++++++----------- .../modules/user/controllers/PersonController.php | 24 +++++++++++----------- .../modules/user/controllers/PoolController.php | 24 +++++++++++----------- .../modules/user/controllers/PrebootController.php | 12 +++++------ .../modules/user/controllers/RoleController.php | 24 +++++++++++----------- .../modules/user/controllers/SessionController.php | 23 ++++++++++----------- application/modules/user/forms/BootosUser.php | 4 ++-- library/Pbs/Notifier.php | 2 +- 17 files changed, 144 insertions(+), 145 deletions(-) diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php index 6ad5554..212d7d9 100644 --- a/application/models/SessionMapper.php +++ b/application/models/SessionMapper.php @@ -97,15 +97,15 @@ class Application_Model_SessionMapper { } } - public function delete(Application_Model_Session $sesion) { - if (null === ($id = $sesion->getID()) ) { + public function delete(Application_Model_Session $session) { + if (null === ($id = $session->getID()) ) { return; } else { $this->getDbTable()->delete(array('sessionID = ?' => $id)); } } - public function find($id, Application_Model_Session $sesion) { + public function find($id, Application_Model_Session $session) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return; @@ -113,7 +113,7 @@ class Application_Model_SessionMapper { $row = $result->current(); - $sesion->setID($row->sessionID) + $session->setID($row->sessionID) ->setAlphasessionID($row->alphasessionID) ->setClientID($row->clientID) ->setBootmenuentryID($row->bootmenuentryID) diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index fb4d4dc..5f09ee0 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -25,8 +25,8 @@ class Fbgui_IndexController extends Zend_Controller_Action { public function errorAction() { $result = $this->_request->getParam('serialresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('serial', $result); + + $this->view->notification = Pbs_Notifier::notify('serial', $result); } } @@ -41,8 +41,8 @@ class Fbgui_IndexController extends Zend_Controller_Action { $result = $this->_request->getParam('notify'); if($result == 'nomember') { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification[] = $pbsNotifier->notify('You have no membership, therefore you have no own BootMenu', 'info'); + + $this->view->notification[] = Pbs_Notifier::notify('You have no membership, therefore you have no own BootMenu', 'info'); } $d = new Pbs_Debug(); @@ -128,14 +128,14 @@ class Fbgui_IndexController extends Zend_Controller_Action { if(Zend_Auth::getInstance()->hasIdentity()) { if($bm->MembershipID != '' && $bm->MembershipID == $this->membership->getID()) { } else { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification[] = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.", 'info'); + + $this->view->notification[] = Pbs_Notifier::notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.", 'info'); } } if(count($res) == 0) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification[] = $pbsNotifier->notify("There are no entries in the bootmenu.", 'info'); + + $this->view->notification[] = Pbs_Notifier::notify("There are no entries in the bootmenu.", 'info'); $this->view->nobootmenu = true; unset($this->view->entries); } @@ -150,11 +150,11 @@ class Fbgui_IndexController extends Zend_Controller_Action { // 'there is no bootmenu for you'); if (!Zend_Auth::getInstance()->hasIdentity()) { $this->view->loginmenu = true; - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification[] = $pbsNotifier->notify("There is no default BootMenu, please Login to get your BootMenu.", 'info'); + + $this->view->notification[] = Pbs_Notifier::notify("There is no default BootMenu, please Login to get your BootMenu.", 'info'); } else { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification[] = $pbsNotifier->notify("You have no BootMenu.", 'info'); + + $this->view->notification[] = Pbs_Notifier::notify("You have no BootMenu.", 'info'); } $this->view->nobootmenu = true; } diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 7ef56aa..8adea4c 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -53,16 +53,16 @@ class User_AuthController extends Zend_Controller_Action { $date = new DateTime(); $person->setLogindate($date->getTimestamp()); if($person->getSuspend()) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Your Account is suspended', 'error'); } else { $this->personmapper->save($person); $this->_helper->redirector('selectmembership', 'person'); return; } } else { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Wrong Email or Password', 'error'); } } } @@ -82,8 +82,8 @@ class User_AuthController extends Zend_Controller_Action { public function registerAction() { if (Zend_Auth::getInstance()->hasIdentity()) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Already logged in.', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Already logged in.', 'error'); } else { if (!isset($_POST["register"])) { $registerForm = new user_Form_Register(); @@ -106,8 +106,8 @@ class User_AuthController extends Zend_Controller_Action { try { $this->personmapper->save($person); } catch(Zend_Exception $e) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Email already registered', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Email already registered', 'error'); $this->view->registerForm = $registerForm; return; } diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index da68b29..fd6419a 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -40,23 +40,23 @@ class user_BootisoController extends Zend_Controller_Action { public function indexAction() { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('downloadresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('download', $result); + + $this->view->notification = Pbs_Notifier::notify('download', $result); } diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index 6dd26dc..04f5b0b 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -47,23 +47,23 @@ class user_BootmenuController extends Zend_Controller_Action { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('json'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('json', $result); + + $this->view->notification = Pbs_Notifier::notify('json', $result); } diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index bb4fe1c..899ff59 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -39,23 +39,23 @@ class user_BootosController extends Zend_Controller_Action { public function indexAction() { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('updateresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('update', $result); + + $this->view->notification = Pbs_Notifier::notify('update', $result); } $groupID = $this->membership->getGroupID(); diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index bf73f19..a97aefe 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -18,8 +18,8 @@ class User_ClientController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if($userIDsNamespace['membershipID'] == '') { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No membershipID set', 'forbidden'); + + echo Pbs_Notifier::notify('No membershipID set', 'forbidden'); } /* Initialize action controller here */ $membershipMapper = new Application_Model_MembershipMapper(); @@ -39,18 +39,18 @@ class User_ClientController extends Zend_Controller_Action { // Get the Clients which booted with a bootiso of this group $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $clientMapper = new Application_Model_ClientMapper(); diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 59e6fd2..2881cd8 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -48,18 +48,18 @@ class user_ConfigController extends Zend_Controller_Action { public function indexAction() { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $groupID = $this->membership->getGroupID(); @@ -234,18 +234,18 @@ class user_ConfigController extends Zend_Controller_Action { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $configID = $this->_request->getParam('configID'); diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index f5e6fa2..0b407ae 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -18,8 +18,8 @@ class User_FilterController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if($userIDsNamespace['membershipID'] == '') { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No membershipID set', 'forbidden'); + + echo Pbs_Notifier::notify('No membershipID set', 'forbidden'); } $this->filterMapper = new Application_Model_FilterMapper(); @@ -41,18 +41,18 @@ class User_FilterController extends Zend_Controller_Action { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $filters = $this->filterMapper->findBy(array('groupID' => $this->membership->getGroupID(), 'membershipID' => null), true, array('priority' => 'DESC')); diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index bf7e1b2..db87308 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -51,18 +51,18 @@ class User_GroupController extends Zend_Controller_Action { $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $this->view->groupList = $this->groupList; @@ -462,8 +462,8 @@ class User_GroupController extends Zend_Controller_Action { if(isset($grouprequestID)) { $groupRequest = $this->groupRequestMapper->find($grouprequestID); if($groupRequest->getGroupID() != $this->userIDsNamespace['groupID']) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Not allowed to decline this grouprequest', 'forbidden'); + + $this->view->notification = Pbs_Notifier::notify('Not allowed to decline this grouprequest', 'forbidden'); return; } try { @@ -488,8 +488,8 @@ class User_GroupController extends Zend_Controller_Action { $membership->setSuspend(1); if(isset($membership)) { if($membership->getGroupID() != $this->userIDsNamespace['groupID']) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Not allowed to suspend this membership', 'forbidden'); + + $this->view->notification = Pbs_Notifier::notify('Not allowed to suspend this membership', 'forbidden'); return; } try { @@ -515,8 +515,8 @@ class User_GroupController extends Zend_Controller_Action { $membership->setSuspend(0); if(isset($membership)) { if($membership->getGroupID() != $this->userIDsNamespace['groupID']) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Not allowed to resume this membership', 'forbidden'); + + $this->view->notification = Pbs_Notifier::notify('Not allowed to resume this membership', 'forbidden'); return; } try { diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php index fc34e15..367d20c 100644 --- a/application/modules/user/controllers/PersonController.php +++ b/application/modules/user/controllers/PersonController.php @@ -82,18 +82,18 @@ class user_PersonController extends Zend_Controller_Action { $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } @@ -193,8 +193,8 @@ class user_PersonController extends Zend_Controller_Action { try { $this->personmapper->save($person); } catch(Zend_Exception $e) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Email already registered', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Email already registered', 'error'); $this->view->registerForm = $registerForm; return; } @@ -211,8 +211,8 @@ class user_PersonController extends Zend_Controller_Action { try { $this->personmapper->save($this->person); } catch(Zend_Exception $e) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('Email already registered', 'error'); + + $this->view->notification = Pbs_Notifier::notify('Email already registered', 'error'); $this->view->registerForm = $registerForm; return; } @@ -363,8 +363,8 @@ class user_PersonController extends Zend_Controller_Action { } if(count($suspendlist) >= 1) { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' ); + + $this->view->notification = Pbs_Notifier::notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' ); } } $membershipSelectForm = new user_Form_MembershipSelect(array('membershiplist' => $membershipList)); diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 62a2819..43df180 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -18,8 +18,8 @@ class User_PoolController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if($userIDsNamespace['membershipID'] == '') { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No membershipID set', 'forbidden'); + + echo Pbs_Notifier::notify('No membershipID set', 'forbidden'); } $membershipMapper = new Application_Model_MembershipMapper(); @@ -38,28 +38,28 @@ class User_PoolController extends Zend_Controller_Action { $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('linkresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('link', $result); + + $this->view->notification = Pbs_Notifier::notify('link', $result); } $result = $this->_request->getParam('unlinkresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('unlink', $result); + + $this->view->notification = Pbs_Notifier::notify('unlink', $result); } // get all pools from this group diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index c9c1699..746cab7 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -41,18 +41,18 @@ class User_PrebootController extends Zend_Controller_Action { public function indexAction() { $result = $this->_request->getParam('addresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('create', $result); + + $this->view->notification = Pbs_Notifier::notify('create', $result); } $result = $this->_request->getParam('deleteresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('delete', $result); + + $this->view->notification = Pbs_Notifier::notify('delete', $result); } $result = $this->_request->getParam('modifyresult'); if($result != "") { - $pbsNotifier = new Pbs_Notifier(); - $this->view->notification = $pbsNotifier->notify('modify', $result); + + $this->view->notification = Pbs_Notifier::notify('modify', $result); } $groupID = $this->membership->getGroupID(); diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index 7634657..b913b6b 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -19,8 +19,8 @@ class User_RoleController extends Zend_Controller_Action { if (Zend_Auth::getInstance()->hasIdentity()) { $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if($this->userIDsNamespace['roleID'] == '') { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No roleID set', 'forbidden'); + + echo Pbs_Notifier::notify('No roleID set', 'forbidden'); } $this->roleMapper = new Application_Model_RoleMapper(); $this->rightMapper = new Application_Model_RightMapper(); @@ -201,8 +201,8 @@ class User_RoleController extends Zend_Controller_Action { } $this->view->editForm = $editForm; } else { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('modify', 'forbidden'); + + echo Pbs_Notifier::notify('modify', 'forbidden'); $this->_helper-> viewRenderer-> setNoRender(); return; } @@ -256,8 +256,8 @@ class User_RoleController extends Zend_Controller_Action { $this->view->roleID = $roleID; $this->view->userIDsNamespace = $this->userIDsNamespace; } else { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('view', 'forbidden'); + + echo Pbs_Notifier::notify('view', 'forbidden'); $this->_helper-> viewRenderer-> setNoRender(); return; } @@ -302,8 +302,8 @@ class User_RoleController extends Zend_Controller_Action { } return; } else { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('delete', 'forbidden'); + + echo Pbs_Notifier::notify('delete', 'forbidden'); $this->_helper-> viewRenderer-> setNoRender(); return; } @@ -386,8 +386,8 @@ class User_RoleController extends Zend_Controller_Action { } } else { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('link', 'forbidden'); + + echo Pbs_Notifier::notify('link', 'forbidden'); $this->_helper-> viewRenderer-> setNoRender(); return; } @@ -441,8 +441,8 @@ class User_RoleController extends Zend_Controller_Action { $this->_redirect('/user/role/show/roleID/' . $roleID); return; } else { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('unlink', 'forbidden'); + + echo Pbs_Notifier::notify('unlink', 'forbidden'); $this->_helper-> viewRenderer-> setNoRender(); return; } diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php index f90845a..cd0b27f 100644 --- a/application/modules/user/controllers/SessionController.php +++ b/application/modules/user/controllers/SessionController.php @@ -1,23 +1,23 @@ hasIdentity()) { $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if($userIDsNamespace['membershipID'] == '') { - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No membershipID set', 'forbidden'); + echo Pbs_Notifier::notify('No membershipID set', 'forbidden'); } $membershipMapper = new Application_Model_MembershipMapper(); @@ -107,9 +107,8 @@ class User_SessionController extends Zend_Controller_Action { public function searchAction() { $this->_redirect('/user/session/index/search/'.($_GET['search'])); } - - } + function sortFunc($func_a, $func_b) { if($func_a->getID() == $func_b->getID()) { return 0; } return ($func_a->getID() < $func_b->getID()) ? 1 : -1; diff --git a/application/modules/user/forms/BootosUser.php b/application/modules/user/forms/BootosUser.php index 66555ce..a9fa79f 100644 --- a/application/modules/user/forms/BootosUser.php +++ b/application/modules/user/forms/BootosUser.php @@ -145,8 +145,8 @@ class user_Form_BootosUser extends Zend_Form { )); - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('Use %username% and %password% as Wildcards for Login and Password.', 'info'); + + echo Pbs_Notifier::notify('Use %username% and %password% as Wildcards for Login and Password.', 'info'); } public function isValid($data) { diff --git a/library/Pbs/Notifier.php b/library/Pbs/Notifier.php index 8d38786..46dfd48 100644 --- a/library/Pbs/Notifier.php +++ b/library/Pbs/Notifier.php @@ -13,7 +13,7 @@ class Pbs_Notifier { - public function notify($action, $result) { + public static function notify($action, $result) { switch($action) { default: -- cgit v1.2.3-55-g7522