protected function _returnToForm()
 {
     $this->load->helper('form');
     $modules = new ModuleColl();
     $modules->setAll();
     # get module names and id
     $drpdown_module = array();
     $drpdown_module[''] = '--Select a Module--';
     foreach ($modules->getDetails() as $key => $module) {
         $drpdown_module[$module['id']] = $module['name'];
     }
     $this->_viewData['dropdown']['module'] = $drpdown_module;
     $usergroup = new UsergroupColl();
     $usergroup->set();
     # get usergroup names and id
     $drpdown_usergroup = array();
     $drpdown_usergroup[''] = '--Select a Usergroup--';
     foreach ($usergroup->getDetails() as $key => $usrgrp_dtl) {
         $drpdown_usergroup[$usrgrp_dtl['id']] = $usrgrp_dtl['name'];
     }
     $this->_viewData['dropdown']['usergroup'] = $drpdown_usergroup;
     $this->_viewData['showmsg'] = true;
     $this->_viewData['status'] = 'error';
     $this->load->view('useraccess_add', $this->_viewData);
 }
 public function setByModule()
 {
     $this->_CI->load->model('Do_userright');
     $modules = new ModuleColl();
     $modules->setAll();
     $modulesDtl = $modules->getDetails();
     $policyByModule = array();
     foreach ($modulesDtl as $moduleDtl) {
         $modulePolicies = $this->_CI->Do_userright->getByModule($moduleDtl['id']);
         foreach ($modulePolicies as $modulePolicy) {
             $policyByModule[$moduleDtl['id']][] = $modulePolicy;
         }
     }
     $policyByUsrGrp = array();
     foreach ($policyByModule as $moduleId => $modulePolicies) {
         # group per usergroup
         foreach ($modulePolicies as $modulePolicy) {
             $policyByUsrGrp[$moduleId][$modulePolicy->userright_usergroup_id][] = $modulePolicy;
         }
     }
     foreach ($policyByUsrGrp as $moduleId => $usrgrpPolicies) {
         foreach ($usrgrpPolicies as $usrgrpId => $usrgrpPolicy) {
             $ids = array();
             //var_dump('111');die();
             foreach ($usrgrpPolicy as $policy) {
                 //var_dump($policy->userright_right);
                 $creator = $policy->userright_created_by;
                 $date = $policy->userright_date_created;
                 ${$policy->userright_right} = $policy->userright_access;
                 //var_dump($policy->userright_right);var_dump($policy->userright_access);var_dump('<br><br>');
                 $ids[] = $policy->userright_id;
             }
             $accessrights = new Accessright($creator, $date, $add, $delete, $read, $write, $ids);
             $this->_items[] = new Userright($usrgrpId, $moduleId, $accessrights);
         }
     }
 }
 protected function _buildModuleDrpdwnInfo()
 {
     $modules = new ModuleColl();
     $modules->setAll();
     # get module names and id
     $drpdown_module = array();
     $drpdown_module[''] = '--Select a Module--';
     foreach ($modules->getDetails() as $key => $module) {
         $drpdown_module[$module['id']] = $module['name'];
     }
     $this->_viewData['dropdown']['module'] = $drpdown_module;
 }