예제 #1
0
파일: Modify.php 프로젝트: suyuanen/trotri
 /**
  * 执行操作:编辑数据
  * @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);
 }
예제 #2
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Modules');
     $fields = json_encode($mod->getFields());
     $this->assign('fields', $fields);
     $this->execute('Posts');
 }
예제 #3
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $submitType = $req->getTrim('submit_type');
     $id = $req->getInteger('id');
     $columnName = $req->getTrim('column_name');
     $opType = $req->getTrim('op_type');
     $value = $req->getParam('value');
     if ($submitType === 'save') {
         $mod = Model::getInstance('Members');
         $ret = $mod->opAccount($columnName, $opType, $id, $value);
         $url = $this->applyParams($mod->getLLU(), $ret);
         $this->redirect($url);
         exit;
     }
     $loginName = $req->getTrim('login_name');
     $html = Mvc::getView()->getHtml();
     $title = Text::_('MOD_MEMBER_MEMBERS_OP_' . $columnName . '_' . $opType) . ': ' . $loginName . ' ,  ' . $value;
     $url = Mvc::getView()->getUrlManager()->getUrl('ajaxaccount', Mvc::$controller, Mvc::$module, array('id' => $id, 'column_name' => $columnName, 'op_type' => $opType, 'submit_type' => 'save', 'value' => ''));
     $body = $html->input('hidden', 'url', $url);
     $body .= $html->openTag('div', array('class' => 'form-group'));
     $body .= $html->tag('label', array('class' => 'col-lg-2 control-label'), Text::_('MOD_MEMBER_MEMBERS_OP_' . $opType));
     $body .= $html->tag('div', array('class' => 'col-lg-4'), $html->input('text', 'value', '', array('class' => 'form-control input-sm')));
     if ($opType === 'reduce' || $opType === 'reduce_freeze' || $opType === 'freeze') {
         $body .= $html->tag('span', array('class' => 'control-label'), Text::_('MOD_MEMBER_MEMBERS_OP_REDUCE_HINT'));
     }
     $body .= $html->closeTag('div');
     $this->display(array('title' => $title, 'body' => $body));
 }
예제 #4
0
파일: Social.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $mod = Model::getInstance('Social', 'member');
     $ret = $mod->modifyByPk(Identity::getUserId(), $req->getPost());
     $this->display($ret);
 }
예제 #5
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);
 }
예제 #6
0
 /**
  * 查询数据列表
  * @param array $params
  * @return array
  */
 public function search(array $params = array())
 {
     $stblName = isset($params['stbl_name']) ? trim($params['stbl_name']) : '';
     $alreadyGb = isset($params['already_gb']) ? trim($params['already_gb']) : '';
     if ($stblName === '') {
         $stblName = null;
     }
     $tableNames = $this->_metadata->getTableNames($stblName);
     $alreadyTblNames = Model::getInstance('Builders')->getTblNames();
     $tblPrefix = $this->getDbProxy()->getTblprefix();
     $tblPreLen = strlen($tblPrefix);
     $data = array();
     $p = 0;
     foreach ($tableNames as $tableName) {
         $sTableName = substr($tableName, $tblPreLen);
         $data[$p++] = array('stbl_name' => $sTableName, 'tbl_name' => $tableName, 'already_gb' => in_array($sTableName, $alreadyTblNames) ? 'y' : 'n');
     }
     $enum = $this->getAlreadyGbEnum();
     if (isset($enum[$alreadyGb])) {
         foreach ($data as $key => $rows) {
             if ($rows['already_gb'] !== $alreadyGb) {
                 unset($data[$key]);
             }
         }
     }
     $ret = array('err_no' => ErrorNo::SUCCESS_NUM, 'data' => $data, 'paginator' => array('attributes' => array('stbl_name' => $stblName, 'already_gb' => $alreadyGb)));
     return $ret;
 }
예제 #7
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $mod = Model::getInstance('Amcas');
     $apps = $mod->findAppPrompts();
     if ($apps === array()) {
         $this->err404();
     }
     $appId = $req->getInteger('app_id');
     if ($appId === 0) {
         $row = array_keys(array_slice($apps, 0, 1, true));
         $appId = array_shift($row);
     }
     if (!isset($apps[$appId])) {
         $this->err404();
     }
     $prompt = $apps[$appId];
     unset($apps[$appId]);
     $apps = array($appId => $prompt) + $apps;
     $ret = $mod->findModCtrls($appId);
     if ($ret['err_no'] !== ErrorNo::SUCCESS_NUM) {
         $this->err404();
     }
     $mod->setLLU(array('app_id' => $appId));
     $this->assign('apps', $apps);
     $this->assign('app_id', $appId);
     $this->assign('elements', $mod);
     $this->render($ret);
 }
예제 #8
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $mod = Model::getInstance('Topic', 'topic');
     $paged = PageHelper::getCurrPage();
     $ret = $mod->findRows($paged);
     $this->render($ret);
 }
예제 #9
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $ret = array();
     $mod = Model::getInstance('Ranks');
     $ret = $mod->findAll();
     $this->assign('elements', $mod);
     $this->render($ret);
 }
예제 #10
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $memberMail = $req->getTrim('member_mail');
     $mod = Model::getInstance('Repwd', 'member');
     $ret = $mod->sendMail($memberMail);
     $this->display($ret);
 }
예제 #11
0
파일: Remove.php 프로젝트: suyuanen/trotri
 /**
  * 执行操作:删除数据和批量删除数据
  * @param string $className
  * @param string $moduleName
  * @return void
  */
 public function execute($className, $moduleName = '')
 {
     $mod = Model::getInstance($className, $moduleName);
     $funcName = $this->getFuncName();
     $ret = $mod->{$funcName}($this->getPk());
     $url = $this->applyParams($mod->getLLU(), $ret);
     $this->redirect($url);
 }
예제 #12
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $ret = array();
     $mod = Model::getInstance('Categories');
     $ret = $mod->findLists();
     $this->assign('elements', $mod);
     $this->render($ret);
 }
예제 #13
0
파일: Gb.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $tblName = Ap::getRequest()->getTrim('tbl_name');
     if ($tblName === '') {
         $this->err404();
     }
     $mod = Model::getInstance('Tblnames');
     $mod->gb($tblName);
 }
예제 #14
0
파일: Vote.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $pollKey = $req->getTrim('key');
     $value = $req->getTrim('value');
     $mod = Model::getInstance('Vote', 'poll');
     $ret = $mod->addVote($pollKey, $value);
     $this->display($ret);
 }
예제 #15
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $ciphertext = $req->getTrim('cipher');
     $password = $req->getTrim('password');
     $repassword = $req->getTrim('repassword');
     $mod = Model::getInstance('Repwd', 'member');
     $ret = $mod->repwdByCipher($ciphertext, $password, $repassword);
     $this->display($ret);
 }
예제 #16
0
파일: Login.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $loginName = $req->getTrim('login_name');
     $password = $req->getTrim('password');
     $rememberMe = $req->getInteger('remember_me', 0) === 1 ? true : false;
     $mod = Model::getInstance('Account', 'member');
     $ret = $mod->login($loginName, $password, $rememberMe);
     $this->display($ret);
 }
예제 #17
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Groups');
     $builderId = $mod->getBuilderId();
     if ($builderId <= 0) {
         $this->err404();
     }
     $this->assign('builder_id', $builderId);
     $this->execute('Groups');
 }
예제 #18
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Menus');
     $typeKey = $mod->getTypeKey();
     if ($typeKey === '') {
         $this->err404();
     }
     $this->assign('type_key', $typeKey);
     $this->execute('Menus');
 }
예제 #19
0
파일: Reg.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $loginName = $req->getTrim('login_name');
     $password = $req->getTrim('password');
     $repassword = $req->getTrim('repassword');
     $mod = Model::getInstance('Account', 'member');
     $ret = $mod->register($loginName, $password, $repassword);
     $this->display($ret);
 }
예제 #20
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $postId = $req->getInteger('postid');
     $order = $req->getTrim('order', 'dt_last_modified DESC');
     $paged = PageHelper::getCurrPage();
     $mod = Model::getInstance('Comments', 'posts');
     $ret = $mod->getRowsByPostId($postId, $order, $paged);
     $this->display($ret);
 }
예제 #21
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $ret = array();
     $req = Ap::getRequest();
     $mod = Model::getInstance('Adverts');
     $param = $req->getParam('sort');
     $ret = $mod->batchModifySort($param);
     $url = $this->applyParams($mod->getLLU(), $ret);
     $this->redirect($url);
 }
예제 #22
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Amcas');
     $amcaPid = $mod->getAmcaPid();
     if ($amcaPid <= 0) {
         $this->err404();
     }
     $this->assign('amca_pid', $amcaPid);
     $this->execute('Amcas');
 }
예제 #23
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $oldPwd = $req->getTrim('old_pwd');
     $password = $req->getTrim('password');
     $repassword = $req->getTrim('repassword');
     $mod = Model::getInstance('Repwd', 'member');
     $ret = $mod->repwdByOldPwd($oldPwd, $password, $repassword);
     $this->display($ret);
 }
예제 #24
0
파일: Modify.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $fields = array();
     $id = $this->getPk();
     if ($id > 0) {
         $fields = Model::getInstance('Posts')->getModuleFieldsByPostId($id);
     }
     $this->assign('profile_fields', array_keys($fields));
     $this->execute('Posts');
 }
예제 #25
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Addresses');
     $memberId = $mod->getMemberId();
     if ($memberId <= 0) {
         $this->err404();
     }
     $this->assign('member_id', $memberId);
     $this->execute('Addresses');
 }
예제 #26
0
파일: View.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Validators');
     $fieldId = $mod->getFieldId();
     if ($fieldId <= 0) {
         $this->err404();
     }
     $this->assign('field_id', $fieldId);
     $this->execute('Validators');
 }
예제 #27
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Groups');
     $builderId = $mod->getBuilderId();
     if ($builderId <= 0) {
         $this->err404();
     }
     $this->assign('builder_id', $builderId);
     Ap::getRequest()->setParam('order', 'sort');
     $this->execute('Groups');
 }
예제 #28
0
파일: Create.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $mod = Model::getInstance('Polloptions');
     $pollId = $mod->getPollId();
     if ($pollId <= 0) {
         $this->err404();
     }
     $this->assign('poll_id', $pollId);
     $this->assign('poll_name', $mod->getPollNameByPollId($pollId));
     $this->assign('poll_key', $mod->getPollKeyByPollId($pollId));
     $this->execute('Polloptions');
 }
예제 #29
0
파일: Index.php 프로젝트: suyuanen/trotri
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $typeKey = Ap::getRequest()->getTrim('type_key');
     if ($typeKey === '') {
         $this->err404();
     }
     $typeName = Model::getInstance('Adverts')->getTypeNameByTypeKey($typeKey);
     $this->assign('type_key', $typeKey);
     $this->assign('type_name', $typeName);
     Ap::getRequest()->setParam('order', 'sort');
     $this->execute('Adverts');
 }
예제 #30
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\interfaces\Action::run()
  */
 public function run()
 {
     $req = Ap::getRequest();
     $authorName = $req->getTrim('author_name');
     $authorMail = $req->getTrim('author_mail');
     $content = $req->getParam('content');
     $postId = $req->getInteger('post_id');
     $commentPid = $req->getInteger('comment_pid');
     $mod = Model::getInstance('Comments', 'posts');
     $ret = $mod->create(array('author_name' => $authorName, 'author_mail' => $authorMail, 'content' => $content, 'post_id' => $postId, 'comment_pid' => $commentPid));
     $this->display($ret);
 }