Esempio n. 1
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $id = $this->getPk();
     if ($id <= 0) {
         $this->err404();
     }
     $ret = array();
     $req = Ap::getRequest();
     $mod = Model::getInstance('Groups');
     $submitType = new SubmitType();
     if ($submitType->isPost()) {
         $ret = $mod->modifyPermissionByPk($id, $req->getPost('amcas', array()));
         if ($ret['err_no'] === ErrorNo::SUCCESS_NUM) {
             if ($submitType->isTypeSave()) {
                 $this->forward('permissionmodify', Mvc::$controller, Mvc::$module, $ret);
             } elseif ($submitType->isTypeSaveClose()) {
                 $url = $this->applyParams($mod->getLLU(), $ret);
                 $this->redirect($url);
             }
         } else {
             $amcas = $mod->getAmcas($id);
             $ret['data'] = $amcas['data'];
         }
     } else {
         $ret = $mod->getAmcas($id);
     }
     $this->assign('id', $id);
     $this->assign('breadcrumbs', $mod->getBreadcrumbs($id));
     $this->assign('elements', $mod);
     $this->render($ret);
 }
Esempio n. 2
0
 /**
  * 执行操作:编辑数据
  * @param string $className
  * @param string $moduleName
  * @return void
  */
 public function execute($className, $moduleName = '')
 {
     $id = $this->getPk();
     if ($id <= 0) {
         $this->err404();
     }
     $ret = array();
     $req = Ap::getRequest();
     $mod = Model::getInstance($className, $moduleName);
     $submitType = new SubmitType();
     if ($submitType->isPost()) {
         $ret = $mod->modifyByPk($id, $req->getPost());
         if ($ret['err_no'] === ErrorNo::SUCCESS_NUM) {
             if ($submitType->isTypeSave()) {
                 $this->forward($mod->actNameModify, Mvc::$controller, Mvc::$module, $ret);
             } elseif ($submitType->isTypeSaveNew()) {
                 $this->forward($mod->actNameCreate, Mvc::$controller, Mvc::$module, $ret);
             } elseif ($submitType->isTypeSaveClose()) {
                 $url = $this->applyParams($mod->getLLU(), $ret);
                 $this->redirect($url);
             }
         }
         $ret['data'] = $req->getPost();
     } else {
         $ret = $mod->findByPk($id);
     }
     $this->assign('id', $id);
     $this->assign('elements', $mod);
     $this->render($ret);
 }
Esempio n. 3
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $ret = array();
     $req = Ap::getRequest();
     $mod = Model::getInstance('Options');
     $submitType = new SubmitType();
     if ($submitType->isPost()) {
         $ret = $mod->batchReplace($req->getPost());
         if ($ret['err_no'] === ErrorNo::SUCCESS_NUM) {
             $this->forward($mod->actNameModify, Mvc::$controller, Mvc::$module, $ret);
         }
         $ret['data'] = $req->getPost();
     } else {
         $ret = $mod->findPairs();
     }
     $this->assign('elements', $mod);
     $this->render($ret);
 }