public function init()
 {
     parent::init();
     zend_session::start();
     $ns = new Zend_Session_Namespace('acteur');
     if (!empty($ns->data)) {
         $this->view->id = $ns->data['id_acteur'];
         $this->view->role = $ns->data['role'];
         $this->view->identifiant = $ns->data['identifiant'];
         $this->view->password = $ns->data['password'];
     }
 }
 public function init()
 {
     parent::init();
     zend_session::start();
     $ns = new Zend_Session_Namespace('user');
     $use = new Application_Model_User();
     $general = new Application_Model_General();
     $statUser = $general->veriStatUser($ns->data);
     if (!empty($ns->data)) {
         $this->view->firstname = $ns->data['firstname_user'];
         $this->view->lastname = $ns->data['lastname_user'];
         $this->view->lvl = $ns->data['id_rank'];
     }
     if ($statUser == 1 or $statUser == 2) {
         $this->view->isadmin = $statUser;
     } else {
         if ($statUser == 3) {
             Zend_Session::namespaceUnset("user");
             Zend_Session::destroy(true);
             $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'acces'), null, true));
         }
     }
     if ($this->_getParam('message') != null) {
         switch ($this->_getParam('message')) {
             case 'deconnection':
                 $this->view->message = "Vous êtes déconnecté";
                 break;
             case 'done':
                 $this->view->message = "Un article à été ajouté";
                 break;
             case 'connecter':
                 $this->view->message = "Vous êtes connecté";
                 break;
             case 'enregistrer':
                 $this->view->message = "Vous êtes inscrit";
                 break;
             case 'erreur':
                 $this->view->message = "Une erreur c'est produite lors de votre inscription.<br/>Veuillez contactez un administrateur";
                 break;
         }
     }
 }
 /**
  * Update action for permission controller
  * @throws Zend_Exception
  * @return NULL
  */
 public function updateAction()
 {
     // action body
     try {
         $translate = Zend_Registry::get('Zend_Translate');
         $roleId = $this->getRequest()->getParam('id', 0);
         $mdlRole = new Acl_Model_Role();
         $role = $mdlRole->find($roleId)->current();
         if (!$role) {
             throw new Exception($translate->translate("LBL_ROW_NOT_FOUND"));
         }
         #Zend_Debug::dump( $this->getRequest()->getParams() );
         $mdlPermission = new Acl_Model_Permission();
         #$resources = $this->getRequest()->getParam( 'hrs');
         $hrs = new Zend_Session_Namespace('resourceDataIds');
         $resources = $hrs->hrs;
         zend_session::namespaceUnset('resourceDataIds');
         $arrResources = explode(',', $resources);
         #$mdlPermission->deleteByRole($role);
         $permissions = $role->findDependentRowset('Acl_Model_Permission', 'Role');
         foreach ($permissions as $perm) {
             #$perm = $mdlPermission->find()->current();
             $perm->delete();
         }
         foreach ($arrResources as $resourceId) {
             #echo $this->getRequest()->getParam('cb_res_'.$resourceId, 'deny')."<br>";
             $permission = $mdlPermission->createRow();
             $permission->role_id = $role->id;
             $permission->resource_id = $resourceId;
             $permission->privilege = $this->getRequest()->getParam('cb_res_' . $resourceId, 'deny');
             $permission->save();
         }
         /* @var $cache Zend_Cache_Backend_File */
         $cache = Zend_Registry::get('cacheACL');
         $mdlRole = new Acl_Model_Role();
         $roles = $mdlRole->getList();
         foreach ($roles as $role) {
             if ($cache->test('cacheACL_' . $role->id)) {
                 $cache->remove('cacheACL_' . $role->id);
             }
         }
         $this->_helper->flashMessenger->addMessage(array('type' => 'info', 'header' => '', 'message' => $translate->translate("LBL_CHANGES_SAVED")));
         //$this->_helper->redirector( "manage", "permission", "acl", array('role'=>$role->id) );
         $this->_helper->redirector("list", "role", "acl");
     } catch (Exception $e) {
         $this->_helper->flashMessenger->addMessage(array('type' => 'error', 'header' => '', 'message' => $e->getMessage()));
         $this->_helper->redirector("list", "role", "acl");
     }
     return null;
 }