コード例 #1
0
ファイル: initphp.php プロジェクト: lampguru/dake
 /**
  * 【静态】命令行模式运行php
  * 1. 例如:/usr/lib/php /usr/local/web/www/index.php index test sql
  * 2. index 控制器名称 test Action名称 sql controller/文件夹下的文件名称
  * 3. 全局使用方法:InitPHP::cli_init(); 
  * @return object
  */
 public static function cli_init($argv)
 {
     try {
         $InitPHP_conf = InitPHP::getConfig();
         $argv[1] = $argv[1] == '' ? '' : trim($argv[1]) . $InitPHP_conf['controller']['controller_postfix'];
         $argv[2] = $argv[2] == '' ? '' : trim($argv[2]) . $InitPHP_conf['controller']['action_postfix'];
         $argv[3] = $argv[3] == '' ? '' : trim($argv[3]);
         InitPHP::getController($argv[1], $argv[2], $params = array(), $argv[3]);
     } catch (exceptionInit $e) {
         $e->errorMessage();
     }
 }
コード例 #2
0
ファイル: initphp.php プロジェクト: peterlevel1/haha-9
 /**
  * 命令行模式运行php
  * 1. 例如:/usr/lib/php /usr/local/web/www/index.php index test sq
  * 2. index 控制器名称 test Action名称 sql controller/文件夹下的文件名称
  * 3. 全局使用方法:InitPHP::cli_init(); 
  * @return object
  */
 public static function cli_init($argv)
 {
     self::isDebug();
     try {
         $InitPHP_conf = InitPHP::getConfig();
         $argv[1] = $argv[1] == '' ? '' : trim($argv[1]) . $InitPHP_conf['controller']['controller_postfix'];
         $argv[2] = $argv[2] == '' ? '' : trim($argv[2]) . $InitPHP_conf['controller']['action_postfix'];
         $argv[3] = $argv[3] == '' ? '' : trim($argv[3]);
         InitPHP::getController($argv[1], $argv[2], $params = array(), $argv[3]);
     } catch (exceptionInit $e) {
         exceptionInit::cliErrorTpl($e);
     } catch (Exception $e) {
         exceptionInit::cliErrorTpl($e);
     }
 }
コード例 #3
0
ファイル: systemController.php プロジェクト: pwstrick/grape
 /**
  * 模块功能添加
  * @author pwstrick
  */
 public function moduleactionadd()
 {
     $id = (int) $this->p('id');
     //获取到模块的ID
     $aid = (int) $this->p('aid');
     //获取到功能的ID
     $moduleModel = InitPHP::getMysqlDao('module', 'mysql/sys');
     $actionModel = InitPHP::getMysqlDao('action', 'mysql/sys');
     $module = $moduleModel->getRowById($id);
     //获取到模块信息
     $action = $actionModel->getRowById($aid);
     //获取到功能信息
     $operate = $this->operateTitle($aid);
     $url = base_url('system/module');
     if (empty($module)) {
         $this->controller->redirect($url);
     }
     /**
      * post提交
      */
     if ($this->controller->is_post()) {
         $row = array('action_name' => $this->p('action_name'), 'sort' => (int) $this->p('sort'), 'action_menu' => (int) $this->p('action_menu'));
         if ($aid > 0) {
             //修改操作
             $affected = $actionModel->updateById($row, $id);
         } else {
             $row['module_key'] = $module['module_key'];
             $row['action_key'] = $this->p('action_key');
             $affected = $actionModel->insert($row);
         }
         if ($affected > 0) {
             $msg = '功能' . $operate . '成功';
             $this->ajaxSuccessOutput($msg);
         } else {
             $msg = '功能' . $operate . '失败';
             $this->ajaxFailureOutput($msg);
         }
     }
     $title = $operate . '功能';
     $breadcrumbs = array(array($url, '模块列表'), array(base_url('system/moduleactionadd'), $title));
     InitPHP::getHelper('view/system');
     //初始化controller 获取到相关的action数组
     $controller = $module['module_key'];
     $actions = InitPHP::getController($module['module_key'] . 'Controller', 'getActionList');
     //获取已有的action列表
     $exist_actions = $actionModel->getListByStatus($module['module_key']);
     $exist_actions = array_column($exist_actions, 'action_key');
     //过滤 将已有的action去除掉
     $actions = array_filter($actions, function ($a) use($exist_actions) {
         return !in_array($a, $exist_actions);
     });
     //将key设置成value
     foreach ($actions as $key => $value) {
         $actions[$value] = $value;
         unset($actions[$key]);
     }
     $form = moduleactionadd_view($module, $action, $actions, $aid);
     $form_attrs = array('data-href' => $url);
     $form = $this->form_token_view($form, $form_attrs);
     //包裹form
     $this->view->assign('form', $form);
     $this->mainFormTemplate($title, $breadcrumbs);
 }