public function editAclAction()
 {
     $acl_id = $this->getRequest()->getParam('id');
     if (!$acl_id) {
         $acl_id = 0;
     }
     $form = new RsvAcl_Form_FrmAcl();
     $db = new RsvAcl_Model_DbTable_DbAcl();
     $rs = $db->getUserInfo('SELECT * FROM rsv_acl_acl where acl_id=' . $acl_id);
     Application_Model_Decorator::setForm($form, $rs);
     $this->view->form = $form;
     $this->view->acl_id = $acl_id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($rs[0]['action'] == $post['action']) {
             $db->updateAcl($post, $rs[0]['acl_id']);
             $tr = Application_Form_FrmLanguages::getCurrentlanguage();
             Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED'));
             Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
         } else {
             if (!$db->isActionExist($post['action'])) {
                 $db->updateAcl($post, $rs[0]['acl_id']);
                 $tr = Application_Form_FrmLanguages::getCurrentlanguage();
                 Application_Form_FrmMessage::message($tr->translate('ROW_AFFECTED'));
                 Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
             } else {
                 Application_Form_FrmMessage::message('Action had existed already');
             }
         }
     }
 }
示例#2
0
 public function getAclInfo($sql)
 {
     $db = RsvAcl_Model_DbTable_DbAcl::getAdapter();
     $stm = $db->query($sql);
     $row = $stm->fetchAll();
     if (!$row) {
         return NULL;
     }
     return $row;
 }
 public function editAction()
 {
     $acl_id = $this->getRequest()->getParam('id');
     if (!$acl_id) {
         $acl_id = 0;
     }
     $form = new RsvAcl_Form_FrmAcl();
     $db = new RsvAcl_Model_DbTable_DbAcl();
     $rs = $db->getUserInfo('SELECT * FROM rms_acl_acl where acl_id=' . $acl_id);
     $this->view->acl_data = $rs[0];
     $this->view->acl_id = $acl_id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($rs[0]['action'] == $post['action']) {
             $db->updateAcl($post, $rs[0]['acl_id']);
             //write log file
             $userLog = new Application_Model_Log();
             $userLog->writeUserLog($acl_id);
             //End write log file
             //Application_Form_FrmMessage::message('One row affected!');
             Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
         } else {
             if (!$db->isActionExist($post['action'])) {
                 $db->updateAcl($post, $rs[0]['acl_id']);
                 //write log file
                 $userLog = new Application_Model_Log();
                 $userLog->writeUserLog($acl_id);
                 //End write log file
                 //Application_Form_FrmMessage::message('One row affected!');
                 Application_Form_FrmMessage::redirector('/rsvAcl/acl/index');
             } else {
                 Application_Form_FrmMessage::message('Action had existed already');
             }
         }
     }
 }
示例#4
0
 public function isActionExists($module, $controller, $action)
 {
     $db = RsvAcl_Model_DbTable_DbAcl::getAdapter();
     $sql = 'SELECT * FROM rsv_acl_acl WHERE module="' . $module . '" && controller="' . $controller . '" && action="' . $action . '"';
     echo $sql;
     exit;
     $stm = $db->query($sql);
     $row = $stm->fetchAll();
     if (!$row) {
         return NULL;
     }
     return $row;
 }