Ejemplo n.º 1
0
 /**
  * 添加/编辑分类
  */
 public function action()
 {
     $categoryId = $this->g('id');
     if (empty($categoryId)) {
         $this->assign('method', 'POST');
         if ($parent = $this->g('parent')) {
             $this->assign('category_parent', $parent);
             $this->assign('title', '添加子分类');
         } else {
             $this->assign('title', '添加分类');
         }
         $tree = \Model\Category::getSelectCate(array($parent));
     } else {
         $category = \Model\Category::listCategory($categoryId);
         if (empty($category)) {
             $this->error('分类不存在');
         }
         $tree = \Model\Category::getSelectCate(array($category['category_parent']));
         $this->assign('method', 'PUT');
         $this->assign($category);
         $this->assign('title', '编辑分类');
     }
     $this->assign('model', \Model\Content::listContent(['table' => 'model', 'condition' => 'model_attr = 1']));
     $this->assign('tree', $tree);
     $this->layout();
 }
Ejemplo n.º 2
0
 /**
  * 更新路由规则
  * @description 在非操作路由规则新增/更新,程序将仅判断文件是否存在,不存在则创建。反之则更新路由规则
  */
 public function after()
 {
     //路由规则文件
     $routeFileName = md5(\Core\Func\CoreFunc::loadConfig('PRIVATE_KEY')) . '_route.php';
     $routePath = PES_PATH . "/Config/Route/{$routeFileName}";
     $routeUrl = PES_PATH . "/Config/RouteUrl/{$routeFileName}";
     //检查路由规则文件是否存在。文件不存在则创建。只有在路由规则编辑中才会触发更新
     if (is_file($routeUrl) && is_file($routeUrl) && (GROUP != self::MATCH_GROUP || MODULE != 'Route' || ACTION != 'action')) {
         return true;
     }
     $route = \Model\Content::listContent(['table' => 'route', 'condition' => 'route_status = 1', 'order' => 'route_listsort ASC, route_id DESC']);
     if (empty($route)) {
         unlink($routePath);
         unlink($routeUrl);
     } else {
         $routeStr['route'] = $routeStr['url'] = "<?php\r\n return array(\r\n";
         foreach ($route as $key => $value) {
             $routeStr['route'] .= " '{$value['route_rule']}' => '{$value['route_controller']}',  \r\n";
             $routeStr['url'] .= " '{$value['route_hash']}' => '{$value['route_rule']}', \r\n";
         }
         $routeStr['route'] .= ");\r\n";
         $routeStr['url'] .= ");\r\n";
         //写入自定义路由规则
         $routeFopen = fopen($routePath, 'w+');
         fwrite($routeFopen, $routeStr['route']);
         fclose($routeFopen);
         //写入\Core\Func\Core::url()方法使用的匹配路由规则
         $urlFopen = fopen($routeUrl, 'w+');
         fwrite($urlFopen, $routeStr['url']);
         fclose($urlFopen);
     }
 }
Ejemplo n.º 3
0
 /**
  * 更新模型字段中,绑定了用户组ID的字段选项
  */
 public function after()
 {
     $userGroupList = \Model\Content::listContent(['table' => 'user_group']);
     $userGroup = [];
     foreach ($userGroupList as $value) {
         $userGroup[$value['user_group_name']] = $value['user_group_id'];
     }
     $this->db('field')->where('field_name = :field_name')->update(['field_option' => json_encode($userGroup), 'noset' => ['field_name' => 'group_id']]);
 }
Ejemplo n.º 4
0
 /**
  * 系统基础设置
  */
 public function action()
 {
     $list = \Model\Content::listContent('option');
     foreach ($list as $key => $value) {
         $setting[$value['option_name']] = $value;
     }
     $this->assign('setting', $setting);
     $this->assign('title', \Model\Menu::getTitleWithMenu());
     $this->layout();
 }
Ejemplo n.º 5
0
 /**
  * 部门添加/编辑
  */
 public function action()
 {
     $userList = \Model\Content::listContent('user');
     $this->assign('user', $userList);
     foreach ($userList as $key => $value) {
         $findUser[$value['user_id']] = $value['user_name'];
     }
     $this->assign('findUser', $findUser);
     parent::action();
 }
Ejemplo n.º 6
0
 /**
  * 查找某一表信息的语法糖
  * @param type $table 查询内容的表名称
  * @param type $field 用于快捷获取内容的组合字段名称
  * @param type $id 需要查找的ID
  * @return type 返回处理好的数组
  */
 public function findContent($table, $field, $id)
 {
     static $array = array();
     if (empty($array[$table])) {
         $list = \Model\Content::listContent(['table' => $table]);
         foreach ($list as $value) {
             $array[$table][$value[$field]] = $value;
         }
     }
     return $array[$table][$id];
 }
Ejemplo n.º 7
0
 public function before()
 {
     if ($_SESSION['admin']['user_id'] == '1') {
         return true;
     }
     $findNode = \Model\Content::findContent('node', GROUP . METHOD . MODULE . ACTION, 'node_check_value');
     if (empty($findNode)) {
         return true;
     }
     $list = \Model\Content::listContent(['table' => 'node_group', 'condition' => 'user_group_id = :user_group_id AND node_id = :node_id', 'param' => ['user_group_id' => $_SESSION['ticket']['user_group_id'], 'node_id' => $findNode['node_id']]]);
     if (empty($list)) {
         $this->error(empty($findNode['node_msg']) ? '您的权限不足' : $findNode['node_msg']);
     }
 }
Ejemplo n.º 8
0
 /**
  * 提取报表
  */
 public function extract()
 {
     $head = explode(',', \Model\Content::findContent('department', $_SESSION['team']['user_department_id'], 'department_id')['department_header']);
     if (!in_array($_SESSION['team']['user_id'], $head) && ACTION == 'extract') {
         $this->error('您不是部门负责人,无权访问');
     }
     $condition = "r.report_date BETWEEN :begin AND :end ";
     $param = array();
     //allExtract将移除此限制
     if (ACTION == 'extract') {
         $condition .= " AND r.department_id = :department_id";
         $param['department_id'] = $_SESSION['team']['user_department_id'];
     }
     if (!empty($_GET['begin']) && !empty($_GET['end'])) {
         $param['begin'] = $_GET['begin'];
         $param['end'] = $_GET['end'];
     } else {
         $param['begin'] = date('Y-m-d');
         $param['end'] = date('Y-m-d');
     }
     if (!empty($_GET['user'])) {
         $condition .= " AND r.user_id = :user_id";
         $param['user_id'] = $this->g('user');
     }
     $result = $this->db('report AS r ')->join("{$this->prefix}report_content AS rc ON rc.report_id = r.report_id")->where($condition)->order('report_date DESC')->select($param);
     //是否导出excel
     if (!empty($_GET['excel'])) {
         $label = new \Expand\Label();
         $excelTitle = array('日期/用户', '报表内容');
         foreach ($result as $key => $value) {
             $list[$value['report_date']][$value['report_date']] = $value['report_date'];
             $list[$value['report_date'] . $value['user_id']][$value['user_id']] = $label->findUser('user', 'user_id', $value['user_id'])['user_name'];
             $list[$value['report_date'] . $value['user_id']][] = strip_tags(htmlspecialchars_decode($value['report_content']));
         }
         $excel = new \Expand\Excel\Excel();
         $excel->export(date('YmdHis') . '提取报表', $excelTitle, $list);
     } else {
         foreach ($result as $key => $value) {
             $list[$value['report_date']][$value['user_id']][] = $value;
         }
     }
     $this->assign('list', $list);
     $userList = \Model\Content::listContent('user');
     $this->assign('user', $userList);
     $this->assign('begin', $param['begin']);
     $this->assign('end', $param['end']);
     $this->assign('title', '提取报表');
     $this->layout('Report_extract');
 }
Ejemplo n.º 9
0
 /**
  * 设置权限
  */
 public function setAuth()
 {
     $id = $this->isG('id', '请提交用户组');
     $record = [];
     $recordList = \Model\Content::listContent(['table' => 'node_group', 'condition' => 'user_group_id = :user_group_id', 'param' => ['user_group_id' => $id]]);
     if (!empty($recordList)) {
         foreach ($recordList as $value) {
             $record[] = $value['node_id'];
         }
     }
     $this->assign('record', json_encode($record));
     $this->assign('list', \Model\Node::nodeList());
     $this->assign('prefix', 'node_');
     $this->display('User_group_setting');
 }
Ejemplo n.º 10
0
 /**
  * 更新节点模型字段中,父类的字段选项值
  */
 public function after()
 {
     $nodeList = \Model\Content::listContent(['table' => 'node', 'order' => 'node_listsort ASC, node_id DESC']);
     $parent = ['请选择' => '', '顶层菜单' => '0'];
     $controller = ['请选择' => '', '顶层节点' => '0', '非权限节点' => '-1'];
     foreach ($nodeList as $value) {
         if ($value['node_parent'] == '0') {
             $parent[$value['node_name']] = $value['node_id'];
         }
         if ($value['node_controller'] == '0') {
             $controller[$value['node_name']] = $value['node_id'];
         }
     }
     $this->db('field')->where(' field_model_id = 13 AND field_name = :parent')->update(['field_option' => json_encode($parent), 'noset' => ['parent' => 'parent']]);
     $this->db('field')->where(' field_model_id = 13 AND field_name = :controller')->update(['field_option' => json_encode($controller), 'noset' => ['controller' => 'controller']]);
 }
Ejemplo n.º 11
0
 public function index()
 {
     $model_id = $this->isG('model_id', '请选择您要查看的模型字段');
     $param = ['field_model_id' => $model_id];
     $condition = 'field_model_id = :field_model_id';
     if (!empty($_GET['keyword'])) {
         $param['field_name'] = $param['field_display_name'] = "%{$_GET['keyword']}%";
         $condition .= ' AND ( field_name LIKE :field_name OR field_display_name LIKE :field_display_name )';
     }
     $list = \Model\Content::listContent(['table' => 'field', 'condition' => $condition, 'order' => 'field_listsort ASC, field_id DESC', 'param' => $param]);
     $this->assign('addUrl', $this->url(GROUP . '-' . MODULE . '-action', array('model_id' => $model_id, 'back_url' => base64_encode($_SERVER['REQUEST_URI']))));
     $this->assign('list', $list);
     $this->assign('title', $this->model['model_title']);
     $this->assign('field', $this->field);
     $this->assign('operate', is_file("{$this->modelThemePrefixPath}_index_operate.php") ? '/' . MODULE . '/' . MODULE . "_index_operate.php" : '');
     $this->assign('listsort', true);
     $this->layout();
 }
Ejemplo n.º 12
0
 /**
  * 添加/编辑会员
  */
 public function action()
 {
     $userId = $this->g('id');
     if (empty($userId)) {
         $this->assign('title', $GLOBALS['_LANG']['USER']['ADD']);
         $this->routeMethod('POST');
     } else {
         if (!($content = \Model\User::findUser($userId))) {
             $this->error($GLOBALS['_LANG']['MENU']['NOT_EXITS_MENU']);
         }
         $this->assign($content);
         $this->assign('title', $GLOBALS['_LANG']['USER']['EDIT']);
         $this->routeMethod('PUT');
     }
     $this->assign('groupList', \Model\User::userGroupList());
     $this->assign('department', \Model\Content::listContent('department'));
     $this->assign('user_id', $userId);
     $this->assign('url', $this->url('Team-User-action'));
     $this->layout();
 }
Ejemplo n.º 13
0
            </ul>

            <div class="am-tabs-bd">
                <div class="am-tab-panel am-fade am-in am-active">
                    <?php 
if (ACTION == 'action') {
    ?>
                        <div class="am-g am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">
                                用户组
                            </div>
                            <div class="am-u-sm-8 am-u-md-4">
                                <select name="group_id" id="user-group-id" required>
                                    <option value="">请选择</option>
                                    <?php 
    foreach (\Model\Content::listContent('user_group', array(), 'user_group_status = 1') as $key => $value) {
        ?>
                                        <option value="<?php 
        echo $value['user_group_id'];
        ?>
" <?php 
        echo $user_group_id == $value['user_group_id'] ? 'selected="selected"' : '';
        ?>
><?php 
        echo $value['user_group_name'];
        ?>
</option>
                                    <?php 
    }
    ?>
                                </select>
Ejemplo n.º 14
0
 /**
  * 查看任务
  */
 public function view()
 {
     $task_id = $this->isG('id', '请选择您要查看的任务');
     $content = $this->db('task AS t')->field("t.*, group_concat(tc.check_user_id) AS check_user_id ")->join("{$this->prefix}task_check AS tc ON tc.task_id = t.task_id")->where('t.task_id = :task_id AND task_delete = 0 ')->group('t.task_id')->find(array('task_id' => $task_id));
     if (empty($content)) {
         $this->error('任务不存在');
     }
     /**
      * 合并任务所有关于用户的ID
      * task_user_id 不一定存在记录(部门审核)。因此,为空则设置为-1,避免空用户可以查看(尽管不可能有未登录的用户)
      */
     $checkers = explode(',', $content['check_user_id']);
     $eligible = array_unique(array_merge_recursive(array($content['task_create_id'], empty($content['task_user_id']) ? '-1' : $content['task_user_id']), $checkers));
     //开启权限验证,验证发布人,审核人,执行人是否属于本任务
     if ($content['task_read_permission'] == '1' && !in_array($_SESSION['team']['user_id'], $eligible)) {
         $this->error('您没有权限查看本任务');
     }
     //列出所有用户,用于处理外部任务的指派
     $userList = \Model\Content::listContent('user');
     $this->assign('user', $userList);
     //列出任务日志
     $diary = \Model\Content::listContent('task_diary', array('task_id' => $task_id), 'task_id = :task_id', 'diary_id DESC');
     //列出任务补调整充说明
     $supplement = \Model\Content::listContent('task_supplement', array('task_id' => $task_id), 'task_id = :task_id', 'task_supplement_id asc');
     $this->assign('supplement', $supplement);
     $this->assign('diary', $diary);
     $this->assign('checkers', $checkers);
     $this->assign('eligible', $eligible);
     $this->assign($content);
     $this->assign('title', $content['task_title']);
     $this->layout();
 }
Ejemplo n.º 15
0
 /**
  * 页眉菜单
  */
 public function headerMenu()
 {
     $list = \Model\Content::listContent('category', array(), 'category_nav = 1 AND category_parent = 0', 'category_listsort ASC, category_id ASC');
     $this->assign('headerMenu', $list);
 }
Ejemplo n.º 16
0
 /**
  * 列出内容(动态条件)
  * @param type $table 内容表名
  * @param array $param 绑定参数
  * @param type $where 查找条件
  * @param type $order 排序
  * @param type $limit 限制输出
  * @return type
  */
 public function listContent($table, array $param = array(), $where = '', $order = '', $limit = '')
 {
     return \Model\Content::listContent($table, $param, $where, $order, $limit);
 }
Ejemplo n.º 17
0
 /**
  * 页眉菜单
  */
 public function headerMenu()
 {
     $list = \Model\Content::listContent(['table' => 'category', 'condition' => 'category_nav = 1 AND category_parent = 0', 'order' => 'category_listsort ASC, category_id ASC']);
     $this->assign('headerMenu', $list);
 }
Ejemplo n.º 18
0
 public function action()
 {
     $parent = \Model\Content::listContent('node', array('node_parent' => '0'), 'node_parent = :node_parent');
     $this->assign('parent', $parent);
     parent::action();
 }