function filter(eProfilePermission $filter, &$eRols, &$count)
 {
     $eRols = array();
     $count = 0;
     $queryR = $this->db->query($this->filterQuery($filter));
     if ($queryR === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $queryC = $this->db->query($this->filterQuery($filter, TRUE));
     if ($queryC === FALSE) {
         Helper_Log::write($this->messageError(__FUNCTION__, FALSE), Helper_Log::LOG_DB);
         throw new Exception("Problema ejecución en Base de Datos, ver log de errores. Consulte con Sistemas");
     }
     $row = $queryC->row_array();
     $count = $row['count'];
     $rows = $queryR->result_array();
     if (!empty($rows)) {
         foreach ($rows as $row) {
             $eRol = new eRol();
             $eRol->parseRow($row);
             $eRols[] = $eRol;
         }
     }
 }
Пример #2
0
 public static function saveRolModule(eRol $eRol, $eRolesModules)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mRol Rol_Model */
     $mRol =& $MY->mRol;
     /* @var $mRolModule Rol_Module_Model */
     $mRolModule =& $MY->mRolModule;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         $isEditable = TRUE;
         if (!$eRol->isEmpty()) {
             $eRolT = $mRol->load($eRol->id);
             if (!Helper_App_Session::isSuperAdminProfile()) {
                 if ($eRolT->isEditable == 0) {
                     throw new Exception("Prohibido editar éste Rol");
                 }
             }
             $isEditable = $eRolT->isEditable == 0;
         }
         if ($isEditable) {
             $mRol->save($eRol);
         }
         $mRolModule->deleteByRol($eRol->id);
         if (!empty($eRolesModules)) {
             /* @var $eRolModule eRolModule */
             foreach ($eRolesModules as $eRolModule) {
                 $eRolModule->id_rol = $eRol->id;
                 $mRolModule->save($eRolModule);
             }
         }
         $oTransaction->commit();
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }