/**
  * @Title: index 
  * @Description: todo(index页面的前置函数)   
  * @author xiafengqin 
  * @date 2013-9-24 下午5:20:34 
  * @throws
  */
 public function _before_index()
 {
     $moamModel = D("MisOaArchivesManageMas");
     //档案表
     $yearList = $moamModel->where('status = 1')->DISTINCT(true)->field('year')->select();
     //所有不一样的年
     $typeList = $moamModel->where('status = 1')->DISTINCT(true)->field('typenum')->select();
     $newv = array();
     foreach ($yearList as $k => $v) {
         $k1 = $k + 1;
         $newvYear = array('id' => -$k1, 'pId' => 0, 'title' => '年份', 'name' => missubstr($v['year'], 18, true) . '年', 'url' => "__URL__/index/jump/jump/year/" . $v['year'], 'rel' => "misoaarchivesmanagesub", 'target' => 'ajax', 'open' => true);
         $newv[] = $newvYear;
         foreach ($typeList as $ke => $va) {
             $newvType = array('id' => $k1 . $ke, 'pId' => -$k1, 'title' => '类别号', 'name' => $va['typenum'], 'url' => "__URL__/index/jump/jump/year/" . $v['year'] . "/typenum/" . $va['typenum'], 'rel' => "misoaarchivesmanagesub", 'target' => 'ajax', 'open' => true);
             $map = array();
             $map['year'] = $v['year'];
             $map['typenum'] = $va['typenum'];
             $fondsnumList = $moamModel->where($map)->DISTINCT(true)->field('fondsnum')->select();
             if ($fondsnumList) {
                 $newv[] = $newvType;
             }
             foreach ($fondsnumList as $key => $val) {
                 $newvFondsnum = array('id' => $k1 . $ke . $key, 'pId' => $k1 . $ke, 'title' => '全宗号', 'name' => $val['fondsnum'], 'url' => "__URL__/index/jump/jump/year/" . $v['year'] . "/typenum/" . $va['typenum'] . "/fondsnum/" . $val['fondsnum'], 'rel' => "misoaarchivesmanagesub", 'target' => 'ajax', 'open' => true);
                 $newv[] = $newvFondsnum;
             }
         }
     }
     $this->assign('year', $_REQUEST['year']);
     $this->assign('typenum', $_REQUEST['typenum']);
     $this->assign('fondsnum', $_REQUEST['fondsnum']);
     $this->assign('tree', json_encode($newv));
 }
예제 #2
0
 /**
  * 构造树形节点  @changeby wangcheng
  * @param array  $alldata  构造树的数据
  * @param array  $param    传入数组参数,包含rel,url【url中参数传递用#name#形式,name 为字段名字】
  * @param array  $returnarr  初始化s树形节点,可以传入数字,默认选中哪一行数据
  * @return string
  */
 function getTree($alldata = array(), $param = array(), $returnarr = array())
 {
     $selected = $_REQUEST["pid"] ? $_REQUEST["pid"] : 1;
     foreach ($alldata as $k => $v) {
         $newv = array();
         $matches = array();
         preg_match_all("|#+(.*)#|U", $param["url"], $matches);
         foreach ($matches[1] as $k2 => $v2) {
             if (isset($v[$v2])) {
                 $matches[1][$k2] = $v[$v2];
             }
         }
         $url = str_replace($matches[0], $matches[1], $param['url']);
         $newv['id'] = $v['id'];
         $newv['realid'] = $v['realid'];
         $newv['pId'] = $v['parentid'] ? $v['parentid'] : 0;
         $newv['type'] = 'post';
         $newv['url'] = $url;
         $newv['shareeduserid'] = $v['shareeduserid'];
         $newv['target'] = 'ajax';
         $newv['rel'] = $param['rel'];
         $newv['title'] = $v['name'];
         //光标提示信息
         $newv['name'] = missubstr($v['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         $newv['open'] = $v["id"] ? false : true;
         $newv['isParent'] = true;
         if ($v['realid'] == $selected) {
             $this->assign("selectedid", $v["id"]);
         }
         array_push($returnarr, $newv);
     }
     return $returnarr;
 }
예제 #3
0
 public function mistaskinfo()
 {
     //判断权限 任务
     $mistaskModel = D("MisTaskInformationView");
     $map = array();
     $map['executingstatus'] = array('NEQ', 7);
     $map['status'] = 1;
     $mistaskinfo = array();
     if ($_REQUEST['mistasktype'] == 2) {
         $map['executeuser'] = $_SESSION[C('USER_AUTH_KEY')];
         if ($_SESSION['a'] || $_SESSION['mistaskadscription_edit']) {
             $mistaskinfo = $mistaskModel->where($map)->field('id,title,createtime')->order('taskid DESC')->limit(7)->select();
         }
     } else {
         $map['createid'] = $_SESSION[C('USER_AUTH_KEY')];
         if ($_SESSION['a'] || $_SESSION['mistaskinformation_edit']) {
             $mistaskinfo = $mistaskModel->where($map)->field('id,title,createtime')->order('taskid DESC')->limit(7)->select();
         }
     }
     foreach ($mistaskinfo as $key => $val) {
         $mistaskinfo[$key]['title'] = missubstr($val['title'], 60, true);
     }
     $this->assign('mistaskinfo', $mistaskinfo);
     $this->assign('mistasktype', $_REQUEST['mistasktype']);
     if ($_REQUEST['mistasktype']) {
         $this->display();
     }
 }
 private function getType()
 {
     // 获取流程类型 组合成树结构
     $MisSystemFlowTypeDao = M("mis_system_flow_type");
     $where['status'] = 1;
     $typelist = $MisSystemFlowTypeDao->order("sort asc")->where($where)->select();
     // 任务节点
     $MisSystemFlowFormDao = M("mis_system_flow_form");
     $where['outlinelevel'] = 3;
     $formlist = $MisSystemFlowFormDao->order("sort asc")->where($where)->select();
     $supcategory = 0;
     $jsonArr = array();
     foreach ($typelist as $key => $val) {
         // 递归获取最小一层类型
         $supcategory = $this->abc($typelist, $val['id']);
         $typelist[$key]['default'] = $supcategory;
         $array = array();
         $array['id'] = $val['id'];
         $array['name'] = missubstr($val['name'], 18, true);
         $array['title'] = $val['name'];
         $array['pId'] = $val['parentid'];
         $array['open'] = true;
         $array['url'] = "__URL__/index/jump/jump/supcategory/" . $supcategory . "/category/0/pid/0";
         $array['rel'] = "MisSystemFlowWork_left";
         $array['type'] = 'post';
         $array['target'] = 'ajax';
         // 阶段
         if ($val['outlinelevel'] == 2) {
             $array['url'] = "__URL__/index/jump/jump/supcategory/" . $val['parentid'] . "/category/" . $val['id'] . "/pid/0";
             $array['rel'] = "MisSystemFlowWork_left";
             $array['type'] = 'post';
             $array['target'] = 'ajax';
             $jsonArr[] = $array;
             foreach ($formlist as $k => $v) {
                 if ($val['id'] == $v['category']) {
                     $array = array();
                     $array['id'] = "999999" . $v['id'];
                     $array['name'] = missubstr($v['name'], 18, true);
                     $array['title'] = $v['name'];
                     $array['pId'] = $val['id'];
                     $array['url'] = "__URL__/index/jump/jump/supcategory/" . $val['parentid'] . "/category/" . $val['id'] . "/pid/" . $v['id'];
                     $array['rel'] = "MisSystemFlowWork_left";
                     $array['type'] = 'post';
                     $array['target'] = 'ajax';
                     $jsonArr[] = $array;
                 }
             }
         } else {
             $jsonArr[] = $array;
         }
     }
     $this->assign('json_arr', json_encode($jsonArr));
     return $typelist;
 }
예제 #5
0
 /**
  * @Title: _after_list 
  * @Description: todo(处理内容显示) 
  * @param unknown_type $voList  
  * @author libo 
  * @date 2014-7-16 上午9:36:52 
  * @throws
  */
 function _after_list(&$voList)
 {
     foreach ($voList as $k => $v) {
         $str = htmlspecialchars_decode($v['content'], ENT_QUOTES);
         //转码
         $str = trim(strip_tags(str_replace(" ", ' ', $str)));
         //过滤html
         $voList[$k]['content'] = missubstr($str, 35, true);
         $voList[$k]['readpeople'] = $voList[$k]['readpeople'] ? "<span style='color:green;'>已阅</span>" : "<span style='color:red;'>未阅</span>";
         $voList[$k]['commentpeople'] = $voList[$k]['commentpeople'] ? "<span style='color:green;'>已评</span>" : "<span style='color:red;'>未评</span>";
     }
 }
예제 #6
0
 /**
  * @Title: onlineManager
  * @Description: todo(文档在线查看方法)
  * @author liminggang
  * @num 数据条数
  * @userid 用户ID;如果为0则为当前用户
  * @myself true查询我的文档;false查询共享文档
  * @date 2013-12-30 下午3:18:36
  * @throws
  */
 private function onlineManager($num = 4, $userid = 0, $myself = false)
 {
     //最新文档前10条
     $filemanagerlist = A("MisFileManager")->lookupgetNewestFile($num, $userid, $myself);
     // 		dump($filemanagerlist);
     //可查看的类型
     $typeext = C("TRANSFORM_SWF");
     $typeext1 = C("IMG_file");
     $typeext[] = 'pdf';
     $typeext = array_merge($typeext, $typeext1);
     foreach ($filemanagerlist as $key => $val) {
         $file = "MisFileManager/" . $val['filepath'];
         $filemanagerlist[$key]['codeurl'] = base64_encode($file);
         //获取文件后缀
         $exten = strtolower(pathinfo($file, PATHINFO_EXTENSION));
         if ($exten) {
             $filemanagerlist[$key]['name'] = missubstr(str_replace("." . $exten, "", $val['name']), 25, true) . '.' . $exten;
         } else {
             $filemanagerlist[$key]['name'] = missubstr($val['name'], 25, true);
         }
         $filemanagerlist[$key]['online'] = false;
         //规定的文件才能在线查看
         if (in_array($exten, $typeext)) {
             $filemanagerlist[$key]['online'] = true;
         }
     }
     $this->assign('snlist', $filemanagerlist);
 }
예제 #7
0
 public function getGroupNodeList()
 {
     //查询系统分组信息
     $model = M("Group");
     $list = $model->where("status=1")->order("sorts asc")->select();
     //获取顶级节点ID
     $initpid = $this->where('pid=0')->getField('id');
     // 查询菜单节点
     $map['status'] = 1;
     $map['type'] = array('lt', 4);
     $nodelist = $this->where($map)->order('sort asc')->select();
     //存储所有分组下面的所有节点
     $returnarr = array();
     // 第一个循环构造分组节点
     foreach ($list as $k2 => $v2) {
         $newv1 = array();
         $newv1['id'] = -$v2['id'];
         $newv1['pId'] = 0;
         $newv1['title'] = $v2['name'];
         //光标提示信息
         $newv1['name'] = missubstr($v2['name'], 20, true);
         //结点名字,太多会被截取
         $newv1['url'] = "__URL__/index/frame/1/group_id/" . $v2['id'] . "/pid/" . $initpid;
         $newv1['target'] = 'ajax';
         $newv1['rel'] = "jbsxNodeBox";
         $newv1['open'] = 'false';
         $returnarr[] = $newv1;
         // 第二个循环构造组分类节点
         foreach ($nodelist as $k => $v) {
             $newv2 = array();
             if ($v['type'] == 1 && $v['group_id'] == $v2['id']) {
                 //面板级
                 unset($nodelist[$k]);
                 $newv2['id'] = $v['id'];
                 $newv2['pId'] = -$v2['id'];
                 $newv2['title'] = $v['title'];
                 //光标提示信息
                 $newv2['name'] = missubstr($v['title'], 20, true);
                 //结点名字,太多会被截取
                 $newv2['url'] = "__URL__/index/frame/1/group_id/" . $v['group_id'] . "/pid/" . $v['id'];
                 $newv2['target'] = 'ajax';
                 $newv2['rel'] = "jbsxNodeBox";
                 $newv2['open'] = 'false';
                 $returnarr[] = $newv2;
                 // 第三个循环判断模块节点
                 foreach ($nodelist as $k3 => $v3) {
                     $newv3 = array();
                     if ($v3['type'] == 3 && $v3['pid'] == $v['id']) {
                         //模块级
                         $newv3['id'] = $v3['id'];
                         $newv3['pId'] = $v['id'];
                         $newv3['title'] = $v3['title'];
                         //光标提示信息
                         $newv3['name'] = missubstr($v3['title'], 20, true);
                         //结点名字,太多会被截取
                         $newv3['url'] = "__URL__/index/frame/1/group_id/" . $v['group_id'] . "/pid/" . $v3['id'];
                         $newv3['target'] = 'ajax';
                         $newv3['rel'] = "jbsxNodeBox";
                         $newv3['false'] = 'true';
                         $returnarr[] = $newv3;
                     }
                 }
             }
         }
     }
     return $returnarr;
 }
예제 #8
0
 /**
  * @Title: lookuproleView 
  * @Description: todo(查看个人权限)   
  * @author liminggang 
  * @date 2013-11-26 上午9:47:38 
  * @throws
  */
 public function lookuproleView()
 {
     $nodeModel = D("Node");
     $groupModel = D("Group");
     $accessModel = D("Access");
     $roleuserModel = D("role_user");
     $userid = $_REQUEST['userid'];
     $this->assign('userid', $userid);
     $roleModel = D("Role");
     // <-- 组授权获取 获取role_id  开始 -->
     //获取用户 组授权 权限 id
     $rolegroup_userModel = D("RolegroupUser");
     $rolegroupidlist = $rolegroup_userModel->where('user_id = ' . $_REQUEST['userid'])->getField('rolegroup_id', true);
     //获取权限组id
     $role_rolegroupModel = D("RoleRolegroup");
     $map = array();
     $map['rolegroup_id'] = array('in', $rolegroupidlist);
     $role_roleidlist = $role_rolegroupModel->where($map)->getField('role_id', true);
     // <-- 组授权获取 获取role_id  结束 -->
     //一般授权获取权限 id
     $alreadyrole = $roleuserModel->where('user_id = ' . $_REQUEST['userid'])->getField("role_id", true);
     foreach ($alreadyrole as $val) {
         $role_roleidlist[] = $val;
     }
     //获取nodeid 即页面左边选中节点id
     $map = array();
     $map["role_id"] = array('in', $role_roleidlist);
     $alreadynode = $accessModel->where($map)->getField("node_id", true);
     $noderolelist = array_unique($alreadynode);
     // <-- 组织右边数据 开始 -->
     if ($_GET['id']) {
         //查询该模块下 用户权限
         $UserModel = D('User');
         $data = $UserModel->getNodeIdRole($_GET['id'], $role_roleidlist);
         $vo = $nodeModel->find($_GET['id']);
         $this->assign("vo", $vo);
         $this->assign("list", $data);
         $this->assign("nodeid", $_GET["id"]);
         $this->assign("userid", $_GET['userid']);
         if ($_GET['jump']) {
             $this->display("userroleAccessRight");
             exit;
         }
     }
     //<-- 组织右边数据 结束 -->
     //<-- 组织页面左边树数据 开始 -->
     $list = $groupModel->where("status=1")->order("sorts asc")->select();
     $map = array();
     $map['status'] = 1;
     $map['level'] = array("neq", 4);
     $map['pid'] = array("gt", 0);
     $nodedata = $nodeModel->where($map)->order("sort asc")->select();
     $start_groupid = 100000;
     //获取最顶级公司
     $returnarr[] = array('id' => 0, 'pId' => -1, 'title' => getFieldBy('0', 'parentid', 'name', 'mis_system_company'), 'name' => getFieldBy('0', 'parentid', 'name', 'mis_system_company'), 'open' => true, 'nocheck' => 'true');
     foreach ($list as $k => $v) {
         $parendchecked = false;
         $newv['id'] = $v['id'] + 100000;
         $newv['pId'] = 0;
         $newv['title'] = $v['name'];
         //光标提示信息
         $newv['name'] = missubstr($v['name'], 20, true);
         //结点名字,太多会被截取
         $newv['open'] = $v['open'] ? $v['open'] : 'false';
         $newv['checked'] = "false";
         $newv['type'] = 0;
         $returnarr1 = D('User')->getUserGroupModuleTree($v['id'], $nodedata, 0, $noderolelist, $parendchecked, 'lookuproleView');
         if ($parendchecked) {
             $newv['checked'] = "true";
         }
         array_push($returnarr, $newv);
         $returnarr = array_merge($returnarr, $returnarr1);
     }
     $valid = $_REQUEST['selectednodeid'] ? $_REQUEST['selectednodeid'] : 0;
     $this->assign("valid", $valid);
     $this->assign("userroleaccesstree", json_encode($returnarr));
     //<-- 组织页面左边树数据 结束 -->
     $this->display();
 }
예제 #9
0
 public function getDTAttachedRecordList($tableid, $tablename = '', $subid = 0, $fieldname, $online = true, $archived = true)
 {
     $armodel = D('MisAttachedRecord');
     $armap['tableid'] = $tableid;
     $armap['subid'] = $subid;
     $armap['status'] = 1;
     $armap['fieldname'] = $fieldname;
     $armap['tablename'] = $tablename;
     $attarry = $armodel->where($armap)->select();
     $filesArr = array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'jpg', 'jpeg', 'gif', 'png', 'apk');
     foreach ($attarry as $key => $val) {
         $pathinfo = pathinfo($val['attached']);
         //获取除后缀的文件名称
         $upname = missubstr($val['upname'], 18, true) . "." . $pathinfo['extension'];
         if (in_array(strtolower($pathinfo['extension']), $filesArr)) {
             //在线查看,必须是指定的文件类型,才能在线查看。
             $attarry[$key]['online'] = $online;
             //在线查看按钮。
         }
         //URL传参。一定要将base64加密后生成的  ‘=’ 号替换掉
         $attarry[$key]['name'] = str_replace("=", '', base64_encode($val['attached']));
         //文件显示名称
         $attarry[$key]['filename'] = $upname;
         //文件下载名称
         $attarry[$key]['lookname'] = $val['upname'];
         //任何文件都可以归档
         $attarry[$key]['archived'] = $archived;
         //归档按钮
     }
     $uploadarry = array();
     foreach ($attarry as $akey => $aval) {
         $uploadarry[$aval['fieldname']][] = $aval;
     }
     return $attarry;
 }
예제 #10
0
 /**
  * @Title: getRoleTree
  * @Description: todo(菜单树)
  * @param rel str 连接(html标签里的id值)
  * @param url str 显示的页面
  * @param map2 array 额外条件
  * @author 杨东
  * @date 2013-5-28 上午10:41:15
  * @throws
  */
 public function getRoleTree($rel, $url = '__URL__/index', $map2 = array(), $modelname = false, $target = 'ajax', $title = '')
 {
     if (empty($url)) {
         $url = '__URL__/index';
     }
     // 组
     $model = M("group");
     $list = $model->where("status=1")->order("sorts asc")->select();
     //获取系统授权
     $model_syspwd = D('SerialNumber');
     $modules_sys = $model_syspwd->checkModule();
     $m_list = explode(",", $modules_sys);
     // 查询菜单节点
     $map['status'] = 1;
     $map['showmenu'] = 1;
     $map['type'] = array('lt', 4);
     $node = M("Node");
     //$map['name'] = array('not in',$filter);
     $data = $node->where($map)->order('sort asc')->field("id,pid,name,level,isprojectwork,type,group_id,title,toolshow")->select();
     if ($map2) {
         $map['level'] = array('eq', 3);
         $map = array_merge($map, $map2);
         $data2 = $node->where($map)->field("id,pid,name,level,isprojectwork,type,group_id,title,toolshow")->select();
         $cond = $data2;
         $top = array();
         foreach ($data as $k => $v) {
             foreach ($data2 as $k1 => $v1) {
                 if ($v['id'] == $v1['pid']) {
                     $top[] = $v['id'];
                 }
             }
         }
         $top = array_unique($top);
         foreach ($data as $k => $v) {
             if (in_array($v['id'], $top)) {
                 $data2[] = $v;
             }
         }
         $data = $data2;
     }
     // 获取授权节点
     $access = getAuthAccess();
     $returnarr = array();
     // 第一个循环构造分组节点
     foreach ($list as $k2 => $v2) {
         $newv1 = array();
         $newv1['id'] = -$v2['id'];
         $newv1['pId'] = 0;
         $newv1['title'] = $v2['name'];
         //光标提示信息
         $newv1['name'] = missubstr($v2['name'], 20, true);
         //结点名字,太多会被截取
         $newv1['open'] = 'false';
         $returnarr2 = array();
         // 第二个循环构造组分类节点
         foreach ($data as $k => $v) {
             //if($v['isproject']==1) unset($data[$k]);
             $newv2 = array();
             // 过来权限
             if (substr($v['name'], 0, 10) != "MisDynamic") {
                 if (!in_array($v['name'], $m_list)) {
                     continue;
                 }
             }
             //     			if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
             //     				continue;
             //     			}
             if ($v['name'] != 'Public' && $v['name'] != 'Index') {
                 if ($v['type'] == 1 && $v['group_id'] == $v2['id']) {
                     $newv2['id'] = $v['id'];
                     $newv2['pId'] = -$v2['id'];
                     $newv2['title'] = $v['title'];
                     //光标提示信息
                     $newv2['name'] = missubstr($v['title'], 20, true);
                     //结点名字,太多会被截取
                     $newv2['open'] = 'false';
                     $returnarr3 = array();
                     // 判断当前节点是否显示1显示0不显示
                     if ($v["toolshow"] == 1) {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             // 过来权限
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             //     							if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v3 ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
                             //     								continue;
                             //     							}
                             $newv3 = array();
                             if ($v3['level'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = $v['id'];
                                 $newv3['title'] = $target == 'ajax' ? $v3['title'] : $title;
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = $target == 'ajax' ? $url . "/jump/jump/model/" . $v3['name'] : $url . "/model/" . $v3['name'];
                                 //"__URL__/index/jump/1/model/".$v3[name];
                                 $newv3['target'] = $target == 'ajax' ? 'ajax' : 'navTab';
                                 $newv3['rel'] = $rel;
                                 //"SystemConfigNumberBox";
                                 $newv3['open'] = 'false';
                                 $returnarr3[] = $newv3;
                             }
                         }
                         if ($returnarr3) {
                             $returnarr3[] = $newv2;
                         }
                     } else {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             //     							if (!isset ($access[strtoupper( APP_NAME )][strtoupper ($v3 ['name'])]) && !$_SESSION [C('ADMIN_AUTH_KEY')]) {
                             //     								continue;
                             //     							}
                             $newv3 = array();
                             if ($v3['name'] === $modelname) {
                                 $this->firstDetail['name'] = $v3['name'];
                                 $this->firstDetail['title'] = $v3['title'];
                                 $this->firstDetail['check'] = $v3['id'];
                             }
                             if ($v3['level'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = -$v2['id'];
                                 $newv3['title'] = $target == 'ajax' ? $v3['title'] : $title;
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = $target == 'ajax' ? $url . "/jump/jump/model/" . $v3['name'] : $url . "/model/" . $v3['name'];
                                 //"__URL__/index/jump/1/model/".$v3[name];
                                 $newv3['target'] = $target == 'ajax' ? 'ajax' : 'navTab';
                                 $newv3['rel'] = $rel;
                                 //"SystemConfigNumberBox";
                                 $newv3['open'] = 'false';
                                 $returnarr3[] = $newv3;
                             }
                         }
                     }
                     if ($returnarr3) {
                         $returnarr2 = array_merge($returnarr2, $returnarr3);
                     }
                 }
             }
         }
         if ($returnarr2) {
             $returnarr[] = $newv1;
             $returnarr = array_merge($returnarr, $returnarr2);
         }
     }
     return json_encode($returnarr);
 }
 /**
  * @Title: mistaskinfo
  * @Description: todo(任务)
  * @author liminggang
  * @date 2013-7-4 上午9:17:21
  * @throws
  */
 public function mistaskinfo($name = "", $sort, $color)
 {
     $this->assign('sort', $sort);
     if (!$name) {
         $name = "任务信息";
     }
     $this->assign('name', $name);
     $this->assign('color', $color);
     //判断权限 任务
     $mistaskModel = D("MisTaskInformationView");
     $map = array();
     $map['executingstatus'] = array('NEQ', 7);
     $map['status'] = 1;
     $mistaskinfo = array();
     if ($_REQUEST['mistasktype'] == 2) {
         $map['executeuser'] = $_SESSION[C('USER_AUTH_KEY')];
         if ($_SESSION['a'] || $_SESSION['mistaskadscription_edit']) {
             $mistaskinfo = $mistaskModel->where($map)->field('id,title,createtime')->order('taskid DESC')->limit(7)->select();
         }
     } else {
         $map['createid'] = $_SESSION[C('USER_AUTH_KEY')];
         if ($_SESSION['a'] || $_SESSION['mistaskinformation_edit']) {
             $mistaskinfo = $mistaskModel->where($map)->field('id,title,createtime')->order('taskid DESC')->limit(7)->select();
         }
     }
     foreach ($mistaskinfo as $key => $val) {
         $mistaskinfo[$key]['title'] = missubstr($val['title'], 60, true);
     }
     $this->assign('mistaskinfo', $mistaskinfo);
     $this->assign('mistasktype', $_REQUEST['mistasktype']);
     if ($_REQUEST['mistasktype']) {
         $this->display("mistaskinfoindex");
         exit;
     }
     return $this->fetch("MisSystemPanelMethod:mistaskinfo");
 }
예제 #12
0
 /**
  * @Title: getGroupModuleTree
  * @Description: todo(构造属性结果 by)
  * @param unknown_type $group_id
  * @param unknown_type $nodedata
  * @param unknown_type $pid
  * @param unknown_type $alreadyaccess
  * @param unknown_type $parendchecked
  * $param 数RUL跳转的方法 $func
  * @return multitype:
  * @author laicaixia
  * @date 2013-5-31 下午6:28:54
  * @throws
  */
 public function getUserGroupModuleTree($group_id, $nodedata, $pid, $alreadyaccess, &$parendchecked = false, $func = 'roleAccess')
 {
     $returnarr = array();
     foreach ($nodedata as $k => $v) {
         if ($v['group_id'] != $group_id) {
             continue;
         }
         if ($pid) {
             if ($pid != $v['pid']) {
                 continue;
             }
         }
         $newv = array();
         $newv['id'] = $v['id'];
         $newv['title'] = $v['title'];
         //光标提示信息
         $newv['name'] = missubstr($v['title'], 12);
         //结点名字,太多会被截取
         $newv['open'] = false;
         if ($v['type'] == 3) {
             if ($v['pid'] == $pid) {
                 $newv['pId'] = $pid;
                 unset($nodedata[$k]);
                 $newv['url'] = "__URL__/" . $func . "/jump/1/id/" . $v['id'] . "/md/" . $v['name'] . "/userid/" . $_GET['userid'];
                 $newv['type'] = 'post';
                 $newv['target'] = 'ajax';
                 if ($func == 'roleAccess') {
                     $newv['rel'] = "userroleaccessright";
                 } else {
                     $newv['rel'] = $func . "userroleaccessright";
                 }
                 $newv['type'] = 3;
                 if (in_array($v['id'], $alreadyaccess)) {
                     $newv['checked'] = true;
                     if (!$parendchecked) {
                         $parendchecked = $v['id'];
                     }
                     $newv['open'] = true;
                 }
                 array_push($returnarr, $newv);
             }
         } else {
             if ($v['type'] == 1) {
                 $newv['pId'] = 100000 + $group_id;
                 unset($nodedata[$k]);
                 $newv['type'] = 1;
                 $s1_2 = $this->getUserGroupModuleTree($group_id, $nodedata, $v['id'], $alreadyaccess, $parendchecked, $func);
                 if (in_array($v['id'], $alreadyaccess)) {
                     $newv['checked'] = true;
                     if (!$parendchecked) {
                         $parendchecked = $v['id'];
                     }
                     $newv['open'] = true;
                 }
                 array_push($returnarr, $newv);
                 if ($s1_2) {
                     $returnarr = array_merge($returnarr, $s1_2);
                 }
             } else {
                 if ($v['type'] == 2) {
                     if ($v['pid'] == $pid) {
                         $newv['pId'] = $pid;
                         unset($nodedata[$k]);
                         $newv['type'] = 2;
                         $s2_2 = $this->getUserGroupModuleTree($group_id, $nodedata, $v['id'], $alreadyaccess, $parendchecked, $func);
                         if (in_array($v['id'], $alreadyaccess)) {
                             $newv['checked'] = true;
                             if (!$parendchecked) {
                                 $parendchecked = $v['id'];
                             }
                             $newv['open'] = true;
                         }
                         array_push($returnarr, $newv);
                         if ($s2_2) {
                             $returnarr = array_merge($returnarr, $s2_2);
                         }
                     }
                 }
             }
         }
     }
     return $returnarr;
 }
 private function getType()
 {
     // 获取流程类型 组合成树结构
     $MisSystemFlowTypeDao = M("mis_system_flow_type");
     $where['status'] = 1;
     $typelist = $MisSystemFlowTypeDao->order("sort asc")->where($where)->select();
     // 任务节点
     $MisSystemFlowFormDao = M("mis_system_flow_form");
     $where['outlinelevel'] = 3;
     $formlist = $MisSystemFlowFormDao->order("sort asc")->where($where)->select();
     //任务
     $renmap['status'] = 1;
     $renmap['outlinelevel'] = 4;
     $renList = $MisSystemFlowFormDao->order("sort asc")->where($renmap)->select();
     $NodeModel = D('Node');
     foreach ($renList as $rek => $rev) {
         $nmap['status'] = 1;
         $nmap['name'] = $rev['formobj'];
         $nmap['isprocess'] = 1;
         $nodeList = $NodeModel->where($nmap)->select();
         if (empty($nodeList)) {
             unset($renList[$rek]);
         }
     }
     $supcategory = 0;
     $jsonArr = array();
     foreach ($typelist as $key => $val) {
         // 递归获取最小一层类型
         $supcategory = $this->abc($typelist, $val['id']);
         $typelist[$key]['default'] = $supcategory;
         $array = array();
         $array['id'] = $val['id'];
         $array['name'] = missubstr($val['name'], 18, true);
         $array['title'] = $val['name'];
         $array['pId'] = $val['parentid'];
         $array['open'] = true;
         $array['url'] = "__URL__/index/jump/jump/supcategory/" . $supcategory . "/category/0/pid/0";
         $array['rel'] = "MisSystemFlowFormNodeindexview";
         $array['type'] = 'post';
         $array['target'] = 'ajax';
         // 阶段
         if ($val['outlinelevel'] == 2) {
             $array['url'] = "__URL__/index/jump/jump/supcategory/" . $val['parentid'] . "/category/" . $val['id'] . "/pid/0";
             $array['rel'] = "MisSystemFlowFormNodeindexview";
             $array['type'] = 'post';
             $array['target'] = 'ajax';
             $jsonArr[] = $array;
             foreach ($formlist as $k => $v) {
                 if ($val['id'] == $v['category']) {
                     $array = array();
                     $array['id'] = $v['id'];
                     $array['name'] = missubstr($v['name'], 18, true);
                     $array['title'] = $v['name'];
                     $array['pId'] = $val['id'];
                     $array['url'] = "__URL__/index/jump/jump/supcategory/" . $val['parentid'] . "/category/" . $val['id'] . "/pid/" . $v['id'];
                     $array['rel'] = "MisSystemFlowFormNodeindexview";
                     $array['type'] = 'post';
                     $array['target'] = 'ajax';
                     $jsonArr[] = $array;
                     //任务
                     foreach ($renList as $renk => $renval) {
                         if ($v['id'] == $renval['parentid']) {
                             $array = array();
                             $array['id'] = $renval['id'];
                             $array['name'] = missubstr($renval['name'], 18, true);
                             $array['title'] = $renval['name'];
                             $array['pId'] = $renval['parentid'];
                             $array['url'] = "__URL__/index/jump/jump/supcategory/" . $val['parentid'] . "/category/" . $val['id'] . "/pid/" . $renval['parentid'] . "/id/" . $renval['id'];
                             $array['rel'] = "lookupisfile";
                             $array['type'] = 'post';
                             $array['target'] = 'ajax';
                             $jsonArr[] = $array;
                         }
                     }
                 }
             }
         } else {
             $jsonArr[] = $array;
         }
     }
     $this->assign('json_arr', json_encode($jsonArr));
     return $typelist;
 }
예제 #14
0
 /**
  * @Title: getRoleTree
  * @Description: todo(菜单树)
  * @author 杨东
  * @date 2013-5-28 上午10:41:15
  * @throws
  */
 public function getRoleTree()
 {
     // 组
     $model = M("group");
     $list = $model->where("status=1")->order("sorts asc")->select();
     //获取系统授权
     $model_syspwd = D('SerialNumber');
     $modules_sys = $model_syspwd->checkModule();
     $m_list = explode(",", $modules_sys);
     //需过滤的model
     $model = D('SystemConfigDetail');
     $filter = $model->getDCFilter();
     // 查询菜单节点
     $node = M("Node");
     $map['status'] = 1;
     //$map['showmenu'] = 1;
     $map['name'] = array('not in', $filter);
     $map['type'] = array('lt', 4);
     $data = $node->where($map)->order('sort asc')->select();
     // 获取授权节点
     $accessList = getAuthAccess();
     $returnarr = array();
     // 第一个循环构造分组节点
     foreach ($list as $k2 => $v2) {
         $newv1 = array();
         $newv1['id'] = -$v2['id'];
         $newv1['pId'] = 0;
         $newv1['title'] = $v2['name'];
         //光标提示信息
         $newv1['name'] = missubstr($v2['name'], 20, true);
         //结点名字,太多会被截取
         $newv1['open'] = 'true';
         $returnarr2 = array();
         // 第二个循环构造组分类节点
         foreach ($data as $k => $v) {
             $newv2 = array();
             // 过来权限
             if (substr($v['name'], 0, 10) != "MisDynamic") {
                 if (!in_array($v['name'], $m_list)) {
                     continue;
                 }
             }
             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                 continue;
             }
             if ($v['name'] != 'Public' && $v['name'] != 'Index') {
                 if ($v['type'] == 1 && $v['group_id'] == $v2['id']) {
                     $newv2['id'] = $v['id'];
                     $newv2['pId'] = -$v2['id'];
                     $newv2['title'] = $v['title'];
                     //光标提示信息
                     $newv2['name'] = missubstr($v['title'], 20, true);
                     //结点名字,太多会被截取
                     $newv2['open'] = 'true';
                     $returnarr3 = array();
                     // 判断当前节点是否显示1显示0不显示
                     if ($v["toolshow"] == 1) {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             // 过来权限
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v3['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                                 continue;
                             }
                             $newv3 = array();
                             if ($v3['type'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = $v['id'];
                                 $newv3['title'] = $v3['title'];
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = "__URL__/index/jump/1/type/" . $v3['id'];
                                 $newv3['target'] = 'ajax';
                                 $newv3['rel'] = "nodeactionconfig";
                                 $newv3['open'] = 'true';
                                 $returnarr3[] = $newv3;
                             }
                         }
                         if ($returnarr3) {
                             $returnarr3[] = $newv2;
                         }
                     } else {
                         // 第三个循环判断模块节点
                         foreach ($data as $k3 => $v3) {
                             if (substr($v3['name'], 0, 10) != "MisDynamic") {
                                 if (!in_array($v3['name'], $m_list)) {
                                     continue;
                                 }
                             }
                             if (!isset($access[strtoupper(APP_NAME)][strtoupper($v3['name'])]) && !$_SESSION[C('ADMIN_AUTH_KEY')]) {
                                 continue;
                             }
                             $newv3 = array();
                             if ($v3['type'] == 3 && $v3['pid'] == $v['id']) {
                                 if (!$this->firstDetail) {
                                     $this->firstDetail['name'] = $v3['name'];
                                     $this->firstDetail['title'] = $v3['title'];
                                     $this->firstDetail['check'] = $v3['id'];
                                 }
                                 $newv3['id'] = $v3['id'];
                                 $newv3['pId'] = -$v2['id'];
                                 $newv3['title'] = $v3['title'];
                                 //光标提示信息
                                 $newv3['name'] = missubstr($v3['title'], 20, true);
                                 //结点名字,太多会被截取
                                 $newv3['url'] = "__URL__/index/jump/1/type/" . $v3['id'];
                                 $newv3['target'] = 'ajax';
                                 $newv3['rel'] = "nodeactionconfig";
                                 $newv3['open'] = 'true';
                                 $returnarr3[] = $newv3;
                             }
                         }
                     }
                     if ($returnarr3) {
                         $returnarr2 = array_merge($returnarr2, $returnarr3);
                     }
                 }
             }
         }
         if ($returnarr2) {
             $returnarr[] = $newv1;
             $returnarr = array_merge($returnarr, $returnarr2);
         }
     }
     $this->assign('typeTree', json_encode($returnarr));
 }
예제 #15
0
 /**
  * 构造树形节点  @changeby wangcheng
  * @param array  $alldata  构造树的数据
  * @param array  $param    传入数组参数,包含rel,url【url中参数传递用#name#形式,name 为字段名字】
  * @param array  $returnarr  初始化s树形节点,可以传入数字,默认选中哪一行数据
  * @return string
  */
 function getTree($alldata = array(), $param = array(), $returnarr = array())
 {
     foreach ($alldata as $k => $v) {
         $newv = array();
         $matches = array();
         preg_match_all('|#+(.*)#|U', $param['url'], $matches);
         foreach ($matches[1] as $k2 => $v2) {
             if (isset($v[$v2])) {
                 $matches[1][$k2] = $v[$v2];
             }
         }
         $url = str_replace($matches[0], $matches[1], $param['url']);
         $newv['id'] = $v['id'];
         $newv['pId'] = $v['parentid'] ? $v['parentid'] : 0;
         $newv['type'] = 'post';
         if ($v['carbelong'] == 2) {
             $newv['url'] = "__URL__/index/jump/1/carbelong/2";
         } else {
             $newv['url'] = $url;
         }
         $newv['target'] = 'ajax';
         $newv['rel'] = $param['rel'];
         $newv['title'] = $v['name'];
         //光标提示信息
         $newv['name'] = missubstr($v['name'], 18, true) . "(" . $v['count'] . ")";
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         if ($v['parentid'] == 0) {
             $newv['open'] = $v['open'] ? $v['open'] : 'true';
         }
         array_push($returnarr, $newv);
     }
     return json_encode($returnarr);
 }
 /**
  * @Title: lookupGetdate 
  * @Description: todo(获得存在数据库中的任务名,显示在日历上)   
  * @author xiafengqin 
  * @date 2013-7-23 下午1:48:00 
  * @throws
  */
 public function lookupGetdate()
 {
     $executelist = array();
     //执行的任务
     $tracklist = array();
     //跟踪的任务
     $viewModel = D("MisTaskInformationView");
     $map['status'] = 1;
     //判断是否有执行权限
     if ($_SESSION['a'] || $_SESSION['mistaskadscription_edit']) {
         $map['_string'] = 'mis_task_information.executeuser = '******'USER_AUTH_KEY')];
         $executelist = $viewModel->where($map)->select();
     }
     if ($_SESSION['a'] || $_SESSION['mistaskinformation_trace']) {
         $map['_string'] = 'mis_task_information.trackuser = '******'USER_AUTH_KEY')];
         $tracklist = $viewModel->where($map)->select();
     }
     $arr = array();
     foreach ($executelist as $key => $value) {
         $datas['id'] = $value['id'];
         $datas['taskid'] = $value['taskid'];
         $datas['title'] = missubstr($value['title'], 20, true);
         $datas['start'] = transTime($value['begindate'], 'Y-m-d H:i:s');
         $datas['end'] = transTime($value['enddate'], 'Y-m-d H:i:s');
         $datas['urgentstatus'] = $value['urgentstatus'];
         $datas['className'] = $value['urgentstatus'] == 1 ? 'myblue' : ($value['urgentstatus'] == 2 ? 'myorange' : 'myred');
         //这里可以设置此action的样式
         $datas['type'] = 'execute';
         $arr[] = $datas;
     }
     foreach ($tracklist as $key => $value) {
         $datas['id'] = $value['id'];
         $datas['taskid'] = $value['taskid'];
         $datas['title'] = missubstr($value['title'], 20, true);
         $datas['start'] = transTime($value['begindate'], 'Y-m-d H:i:s');
         $datas['end'] = transTime($value['enddate'], 'Y-m-d H:i:s');
         $datas['urgentstatus'] = $value['urgentstatus'];
         $datas['className'] = $value['urgentstatus'] == 1 ? 'myblue' : ($value['urgentstatus'] == 2 ? 'myorange' : 'myred');
         //这里可以设置此action的样式
         $datas['type'] = 'track';
         $arr[] = $datas;
     }
     echo json_encode($arr);
 }
예제 #17
0
 /**
  * @Title: lookupGetdate
  * @Description: todo(获得存在数据库中的日程安排)
  * @author xiafengqin
  * @date 2013-7-11 上午11:23:50
  * @throws
  */
 public function lookupGetdate()
 {
     $start = strtotime($_POST['start']);
     $end = strtotime($_POST['end']);
     $model = D('MisUserEvents');
     $map = array();
     $map['status'] = 1;
     $map['_string'] = ' (FIND_IN_SET( ' . $_SESSION[C('USER_AUTH_KEY')] . ' , personid ) OR userid = ' . $_SESSION[C('USER_AUTH_KEY')] . ') and ( startdate <' . $end . ' and enddate >=' . $start . ')';
     $list = $model->where($map)->select();
     $arr = array();
     $bgcolor = $this->bgcolor;
     foreach ($list as $key => $value) {
         $start = transTime($value['startdate'], 'Y-m-d H:i:s');
         $end = transTime($value['enddate'], 'Y-m-d H:i:s');
         //86400秒=1天
         $allDay = true;
         if ($value['enddate'] - $value['startdate'] < 86400) {
             $allDay = false;
         }
         if (!$value['importancedegree']) {
             $value['importancedegree'] = 1;
         }
         $scheduletype = $value['scheduletype'] == 2 ? '[工作]' : '[个人]';
         $arr[] = array('id' => $value['id'], 'createid' => $value['createid'], 'title' => $scheduletype . missubstr($value['text'], 18, true), 'start' => $start, 'end' => $end, 'allDay' => $allDay, 'importancedegree' => $value['importancedegree'], 'className' => $bgcolor[$value['importancedegree']]['color']);
     }
     echo json_encode($arr);
 }
 /**
  * @Title: lookupIdea
  * @Description: todo(获取缺陷)
  * @author xiafengqin
  * @date 2013-6-29 下午2:14:48
  * @throws
  */
 private function lookupIdea($taskid, $identifying)
 {
     $InformationModel = D("MisTaskInformation");
     $trackuser = $InformationModel->where('taskid=' . $taskid)->getField('trackuser');
     $this->assign('trackuser', $trackuser);
     $feedbackModel = D('MisTaskFeedbackInformation');
     //缺陷
     $voList = $feedbackModel->where('isdefect = 1 AND pid = 0 AND type = 3 AND taskid=' . $taskid)->select();
     foreach ($voList as $key => $val) {
         $voList[$key]['remark'] = missubstr($val['remark'], 180);
     }
     $this->assign('voList', $voList);
     $this->assign('identifying', $identifying);
     $this->display('lookupIdea');
 }
예제 #19
0
 /**
  * @Title: _after_list
  * @Description: todo(执行了CommonAction类里面的_list方法的后置函数)
  * @param unknown_type $voList
  * @author xiafengqin
  * @date 2013-5-31 下午4:25:44
  * @throws
  */
 function _after_list(&$voList)
 {
     foreach ($voList as $k => $v) {
         $str = htmlspecialchars_decode($v['content'], ENT_QUOTES);
         //转码
         $str = trim(strip_tags(str_replace("&nbsp;", ' ', $str)));
         //过滤html
         $voList[$k]['content'] = missubstr($str, 35, true);
         $voList[$k]['md'] = $_REQUEST['md'] ? $_REQUEST['md'] : 'MisWorkStatement';
     }
 }
 /**
  * @Title: getMessages
  * @Description: todo(查指部门信息出来,在OAHelperAction中有调用)
  * @param int $whidDepart 部门ID
  * @return 返回一个二维数组
  * @author eagle
  * @date 2014-5-15 上午9:37:31
  * @throws
  */
 public function getMessages($whidDepart = '')
 {
     //实例化mis_message_user表
     $model = D('MisSystemDepartment');
     if ($_SESSION[C('USER_AUTH_KEY')]) {
         if ($whidDepart) {
             //定义where条件
             $model = D('MisHrPersonnelPersonInfo');
             $map = array();
             $map['status'] = 1;
             $map['working'] = 1;
             //离职不能显示出来
             $map['deptid'] = $whidDepart;
             $list = $model->where($map)->order('id asc')->select();
             return $list;
         } else {
             $mode1 = D("User");
             $map = array();
             $map['status'] = array('GT', 0);
             //是管理员的不显示出来
             $map['name'] = array('NEQ', '管理员');
             $Userlist = $mode1->field("id,name,dept_id,email,employeid")->where($map)->order('sort ASC')->select();
             $returnarr = array();
             $dptmodel = D("MisSystemDepartment");
             //部门表
             $deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,parentid,iscenter')->select();
             foreach ($deptlist as $k => $v) {
                 $newDept = array();
                 $newDept['id'] = $v['id'];
                 $newDept['parentid'] = $v['parentid'] ? $v['parentid'] : 0;
                 $newDept['title'] = $v['name'];
                 //光标提示信息
                 $newDept['name'] = missubstr($v['name'], 28, true);
                 //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                 $newDept['isParent'] = "true";
                 if ($v['parentid'] == 0) {
                     $newDept['open'] = $v['open'] ? false : true;
                 }
                 //是管理中心的才把,人找出来
                 if ($v['iscenter']) {
                     // 构造用户
                     foreach ($Userlist as $k2 => $v2) {
                         if ($v2['dept_id'] == $v['id']) {
                             $newv2 = array();
                             $newv2['id'] = $v2['employeid'];
                             $newv2['parentid'] = $v['id'];
                             $newv2['title'] = $v2['name'];
                             //光标提示信息
                             $newv2['name'] = missubstr($v2['name'], 28, true);
                             //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                             $newv2['icon'] = "./images/group.png";
                             $newv2['open'] = true;
                             $newv2['isParent'] = "false";
                             array_push($returnarr, $newv2);
                         }
                     }
                 }
                 array_push($returnarr, $newDept);
             }
             return $returnarr;
         }
     } else {
         $this->error('没有获取到当前登陆人!');
     }
 }
 /**
  * @Title: _after_list 
  * @Description: todo(列表处理内容显示) 
  * @param unknown_type $voList  
  * @author libo 
  * @date 2014-7-16 上午11:00:32 
  * @throws
  */
 function _after_list(&$voList)
 {
     foreach ($voList as $k => $v) {
         $str = htmlspecialchars_decode($v['content'], ENT_QUOTES);
         //转码
         $str = trim(strip_tags(str_replace("&nbsp;", ' ', $str)));
         //过滤html
         $voList[$k]['content'] = missubstr($str, 35, true);
         $userid = $_SESSION[C('USER_AUTH_KEY')];
         $voList[$k]['readpeople'] = in_array($userid, explode(",", $v['readpeople'])) ? "<span style='color:green;'>已阅</span>" : "<span style='color:red;'>未阅</span>";
         $voList[$k]['commentpeople'] = in_array($userid, explode(",", $v['commentpeople'])) ? "<span style='color:green;'>已评</span>" : "<span style='color:red;'>未评</span>";
     }
     // 		dump($voList);
 }
 /**
  * @Title: _after_list
  * @Description: todo(执行了CommonAction类里面的_list方法的后置函数)
  * @param unknown_type $voList
  * @author xiafengqin
  * @date 2013-5-31 下午4:25:44
  * @throws
  */
 function _after_list(&$voList)
 {
     foreach ($voList as $k => $v) {
         $str = htmlspecialchars_decode($v['content'], ENT_QUOTES);
         //转码
         $str = trim(strip_tags(str_replace("&nbsp;", ' ', $str)));
         //过滤html
         $voList[$k]['content'] = missubstr($str, 35, true);
         $voList[$k]['md'] = $this->getActionName();
     }
 }
예제 #23
0
 public function lookupSelectNotifyPerson()
 {
     $model = D("User");
     $map = array();
     $map['status'] = array('GT', 0);
     //是管理员的不显示出来
     //$map['name'] = array('NEQ','管理员');
     if (method_exists($this, '_filterLookupSelectUser')) {
         $this->_filterLookupSelectUser($map);
     }
     $list = $model->field("id,name,dept_id,email,mobile,pinyin")->where($map)->order('sort ASC')->select();
     foreach ($list as $uk => $uval) {
         if ($uval['employeid']) {
             $working = getFieldBy($uval['employeid'], 'id', 'working', 'mis_hr_personnel_person_info');
             if ($working == 0) {
                 unset($list[$uk]);
             }
         }
     }
     $num = count($list);
     $this->assign("num", $num);
     // 总人数
     $returnarr = array();
     $dptmodel = D("MisSystemDepartment");
     //部门表
     $deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,parentid')->select();
     //部门树形
     $returnarr = $dptmodel->getDeptZtree($_SESSION['companyid'], '', '', '', '', 1);
     $this->assign('usertree', $returnarr);
     //用户组的树
     $rolegroup = array();
     $rolegroupModel = D('Rolegroup');
     $rolegroupList = $rolegroupModel->where("status=1")->order("id asc")->field('id,name,pid')->select();
     //所有的组
     $rolegroup_userModel = M('rolegroup_user');
     $rolegroup_userList = $rolegroup_userModel->field("rolegroup_id,user_id")->order('rolegroup_id ASC')->select();
     foreach ($rolegroupList as $k => $v) {
         foreach ($rolegroup_userList as $k2 => $v2) {
             if ($v["id"] == $v2["rolegroup_id"]) {
                 $rolegroupList[$k]["useridarr"][] = $v2["user_id"];
             }
         }
     }
     foreach ($rolegroupList as $ke => $va) {
         $newRole = array();
         $newRole['id'] = -$va['id'];
         $newRole['pId'] = 0;
         $newRole['title'] = $va['name'];
         //光标提示信息
         $newRole['name'] = missubstr($va['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         $newRole['open'] = false;
         $istrue = false;
         $userarr = array();
         $usernamearr = array();
         $emailarr = array();
         foreach ($list as $k2 => $v2) {
             if (in_array($v2['id'], $va["useridarr"])) {
                 $istrue = true;
                 $newv2 = array();
                 $userarr[] = $v2['id'];
                 $usernamearr[] = $v2['name'];
                 $emailarr[] = $v2['email'];
                 $newv2['email'] = $v2['email'];
                 $newv2['id'] = $v2['id'];
                 $newv2['userid'] = $v2['id'];
                 $newv2['pId'] = -$va['id'];
                 $newv2['pinyin'] = $v2['pinyin'];
                 //拼音
                 $newv2['title'] = $v2['name'];
                 //光标提示信息
                 $newv2['username'] = $v2['name'];
                 //光标提示信息
                 $newv2['name'] = missubstr($v2['name'], 18, true);
                 //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                 $newv2['icon'] = "__PUBLIC__/Images/icon/group.png";
                 $newv2['open'] = false;
                 array_push($rolegroup, $newv2);
             }
         }
         if ($istrue) {
             $newRole["userid"] = implode(",", $userarr);
             $newRole["email"] = implode(",", $emailarr);
             $newRole["username"] = implode(",", $usernamearr);
             array_push($rolegroup, $newRole);
         }
     }
     // 		dump($rolegroup);
     $this->assign('rolegrouptree', json_encode($rolegroup));
     //公司的树
     $companytree = $dptmodel->getDeptZtree('', '', '', '', '', 2);
     $this->assign('sysCompanytree', $companytree);
     // 		$this->assign('usertree',$returnarr);
     $this->assign('data', $_POST["data"]);
     $this->assign('ulid', $_POST["ulid"]);
     if ($_POST["ulid"]) {
         $this->display("Common:multiple");
         // 选多个用户
     } else {
         $this->display("Common:singleUser");
         // 选单个用户
     }
 }
예제 #24
0
 public function searchuser()
 {
     $mode1 = D("User");
     $map = array();
     $map['status'] = array('GT', 0);
     //是管理员的不显示出来
     $map['name'] = array('NEQ', '管理员');
     $list = $mode1->field("id,name,dept_id,email")->where($map)->order('sort ASC')->select();
     $returnarr = array();
     $dptmodel = D("MisSystemDepartment");
     //部门表
     $deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,parentid')->select();
     foreach ($deptlist as $k => $v) {
         $newv = array();
         $newv['id'] = -$v['id'];
         $newv['pId'] = -$v['parentid'] ? -$v['parentid'] : 0;
         $newv['title'] = $v['name'];
         //光标提示信息
         $newv['name'] = missubstr($v['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         if ($v['parentid'] == 0) {
             $newv['open'] = $v['open'] ? false : true;
         }
         $istrue = false;
         $userarr = array();
         $usernamearr = array();
         $emailarr = array();
         //邮箱
         // 构造用户
         foreach ($list as $k2 => $v2) {
             if ($v2['dept_id'] == $v['id']) {
                 $newv2 = array();
                 $userarr[] = $v2['id'];
                 //将用户的名字和id分别存在数组中
                 $usernamearr[] = $v2['name'];
                 $emailarr[] = $v2['email'];
                 $newv2['email'] = $v2['email'];
                 $newv2['id'] = $v2['id'];
                 $newv2['pId'] = -$v['id'];
                 $newv2['title'] = $v2['name'];
                 //光标提示信息
                 $newv2['name'] = missubstr($v2['name'], 20, true);
                 //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                 $newv2['icon'] = "__PUBLIC__/Images/icon/group.png";
                 $newv2['open'] = true;
                 array_push($returnarr, $newv2);
             }
         }
         $newv["userid"] = implode(",", $userarr);
         $newv["email"] = implode(",", $emailarr);
         $newv["username"] = implode(",", $usernamearr);
         //把取到名字和id转换成字符串,在传到前台。
         array_push($returnarr, $newv);
     }
     $this->assign('usertree', json_encode($returnarr));
     //用户组的树
     $rolegroup = array();
     $rolegroupModel = D('Rolegroup');
     $rolegroupList = $rolegroupModel->where("status=1")->order("id asc")->field('id,name,pid')->select();
     //所有的组
     $rolegroup_userModel = M('rolegroup_user');
     $rolegroup_userList = $rolegroup_userModel->field("rolegroup_id,user_id")->order('rolegroup_id ASC')->select();
     foreach ($rolegroupList as $k => $v) {
         foreach ($rolegroup_userList as $k2 => $v2) {
             if ($v["id"] == $v2["rolegroup_id"]) {
                 $rolegroupList[$k]["useridarr"][] = $v2["user_id"];
             }
         }
     }
     foreach ($rolegroupList as $ke => $va) {
         $newRole = array();
         $newRole['id'] = -$va['id'];
         $newRole['pId'] = 0;
         $newRole['title'] = $va['name'];
         //光标提示信息
         $newRole['name'] = missubstr($va['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         $newRole['open'] = false;
         $istrue = false;
         $userarr = array();
         $usernamearr = array();
         $emailarr = array();
         foreach ($list as $k2 => $v2) {
             if (in_array($v2['id'], $va["useridarr"])) {
                 $istrue = true;
                 $newv2 = array();
                 $userarr[] = $v2['id'];
                 $usernamearr[] = $v2['name'];
                 $emailarr[] = $v2['email'];
                 $newv2['email'] = $v2['email'];
                 $newv2['id'] = $v2['id'];
                 $newv2['pId'] = -$va['id'];
                 $newv2['title'] = $v2['name'];
                 //光标提示信息
                 $newv2['name'] = missubstr($v2['name'], 18, true);
                 //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                 $newv2['icon'] = "__PUBLIC__/Images/icon/group.png";
                 $newv2['open'] = false;
                 array_push($rolegroup, $newv2);
             }
         }
         if ($istrue) {
             $newRole["userid"] = implode(",", $userarr);
             $newRole["email"] = implode(",", $emailarr);
             $newRole["username"] = implode(",", $usernamearr);
             array_push($rolegroup, $newRole);
         }
     }
     $this->assign('rolegrouptree', json_encode($rolegroup));
     //角色的树
     $ProcessRole = array();
     $ProcessRoleModel = D('ProcessRole');
     $ProcessRoleList = $ProcessRoleModel->where("status=1")->order("sort asc")->field('id,name,deptid,userid')->select();
     //所有的角色组
     foreach ($ProcessRoleList as $ke => $va) {
         $newRole = array();
         $newRole['id'] = -$va['id'];
         $newRole['pId'] = 0;
         $newRole['title'] = $va['name'];
         //光标提示信息
         $newRole['name'] = missubstr($va['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         $newRole['open'] = false;
         $istrue = false;
         $deptid = explode(",", $va['deptid']);
         $userid = explode(",", $va['userid']);
         $userarr = array();
         $usernamearr = array();
         $emailarr = array();
         foreach ($list as $k2 => $v2) {
             $istrue2 = false;
             if (in_array($v2['id'], $userid)) {
                 $istrue2 = true;
             }
             if ($istrue2) {
                 $istrue = true;
                 $newv2 = array();
                 $userarr[] = $v2['id'];
                 $usernamearr[] = $v2['name'];
                 $emailarr[] = $v2['email'];
                 $newv2['email'] = $v2['email'];
                 $newv2['id'] = $v2['id'];
                 $newv2['pId'] = -$va['id'];
                 $newv2['title'] = $v2['name'];
                 //光标提示信息
                 $newv2['name'] = missubstr($v2['name'], 18, true);
                 //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                 $newv2['icon'] = "__PUBLIC__/Images/icon/group.png";
                 $newv2['open'] = false;
                 array_push($ProcessRole, $newv2);
             }
         }
         if ($istrue) {
             $newRole["userid"] = implode(",", $userarr);
             $newRole["email"] = implode(",", $emailarr);
             $newRole["username"] = implode(",", $usernamearr);
             array_push($ProcessRole, $newRole);
         }
     }
     $this->assign('ProcessRoletree', json_encode($ProcessRole));
 }
 /**
  * 构造树形节点  @changeby wangcheng
  * @param array  $alldata  构造树的数据
  * @param array  $param    传入数组参数,包含rel,url【url中参数传递用#name#形式,name 为字段名字】
  * @param array  $returnarr  初始化s树形节点,可以传入数字,默认选中哪一行数据
  * @return string
  */
 function getTree($alldata = array(), $param = array(), $returnarr = array())
 {
     foreach ($alldata as $k => $v) {
         $newv = array();
         $matches = array();
         preg_match_all('|#+(.*)#|U', $param['url'], $matches);
         foreach ($matches[1] as $k2 => $v2) {
             if (isset($v[$v2])) {
                 $matches[1][$k2] = $v[$v2];
             }
         }
         $param['rel'] = "mishrpersonneladdressbookBox";
         //重要的地方,查找带回模板上的ID
         //$param['url']="__URL__/lookupmanage/jump/1/deptid/#id#/parentid/#parentid#";
         $url = str_replace($matches[0], $matches[1], $param['url']);
         $newv['id'] = $v['id'];
         $newv['pId'] = $v['parentid'] ? $v['parentid'] : 0;
         $newv['type'] = 'post';
         if ($v['id'] == 40) {
             $newv['url'] = "__URL__/lookupmanage/jump/1";
             //项级节点,显示所有记录不要传具体行记录ID
         } else {
             $newv['url'] = "__URL__/lookupmanage/jump/1/deptid/" . $v['id'] . "/parentid/" . $v['parentid'];
         }
         //$newv['url']=$url;
         $newv['target'] = 'ajax';
         $newv['rel'] = $param['rel'];
         $newv['title'] = $v['name'];
         //光标提示信息
         $newv['name'] = missubstr($v['name'], 18, true);
         //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
         if ($v['parentid'] == 40) {
             //顶级结点,默认展开它
             $newv['open'] = $v['open'] ? $v['open'] : 'true';
         }
         array_push($returnarr, $newv);
     }
     return json_encode($returnarr);
 }
 /**
  * @Title: openTreeDeptAndUser
  * @Description: todo(设置展开的部门及被考核人) 
  * @param 部门列表 $deptlist
  * @param 被考核人了列表 $list
  * @param 父类ID $pid
  * @param tree对象 $returnarr
  * @return boolean  
  * @author 杨东 
  * @date 2013-8-9 下午6:50:16 
  * @throws 
  */
 protected function openTreeDeptAndUser($deptlist, $list, $pid, &$returnarr)
 {
     $istruep = false;
     foreach ($deptlist as $k => $v) {
         // 循环判断父节点
         if ($v['parentid'] == $pid) {
             $newv = array();
             $newv['id'] = -$v['id'];
             $newv['pId'] = -$v['parentid'] ? -$v['parentid'] : 0;
             $newv['title'] = $v['name'];
             //光标提示信息
             $newv['name'] = missubstr($v['name'], 18, true);
             //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
             if ($v['parentid'] == 0) {
                 $newv['open'] = true;
             }
             // 判断是否有被考核人
             $istrue = false;
             foreach ($list as $k2 => $v2) {
                 if ($v2['deptid'] == $v['id']) {
                     // 有被考核人设置为true
                     $istrue = true;
                     $newv2 = array();
                     $newv2['id'] = $v2['id'];
                     $newv2['pId'] = -$v['id'];
                     $newv2['orderno'] = $v2['orderno'];
                     $newv2['title'] = $v2['name'];
                     //光标提示信息
                     $newv2['name'] = missubstr($v2['name'], 18, true);
                     //结点名字,太多会被截取,针对于现在的ZTREE,宽度不能超过18个字符。
                     $newv2['icon'] = "__PUBLIC__/Images/icon/group.png";
                     $newv2['open'] = true;
                     if ($_POST['rel']) {
                         $newv2['rel'] = $_POST['rel'];
                         $newv2['url'] = $_POST['url'] . $v2['id'];
                         $newv2['target'] = 'ajax';
                     }
                     if ($_POST['check']) {
                         $newv2['checked'] = true;
                     }
                     array_push($returnarr, $newv2);
                 }
             }
             // 获取直接点是否有被考核人
             $istrues = $this->openTreeDeptAndUser($deptlist, $list, $v['id'], $returnarr);
             if ($istrues) {
                 // 如何有被考核人则设置为open 并将返回值设为true
                 $istruep = true;
                 $newv['open'] = true;
             }
             if ($_POST['check']) {
                 $newv['checked'] = true;
             }
             // 有checkbox的树,全选中
             if ($istrue) {
                 // 当前部门如果有被考核人则设置为open 并将返回值设为true
                 $istruep = true;
                 $newv['open'] = true;
             }
             if ($_POST['allopen']) {
                 $newv['open'] = true;
                 // 所有都展开
                 $newv['id'] = $v['id'];
                 $newv['pId'] = $v['parentid'] ? $v['parentid'] : 0;
             }
             array_push($returnarr, $newv);
         }
     }
     return $istruep;
 }