/** * 删除文件夹 * * @param string $aimDir * @return boolean */ function unlinkDir($aimDir) { $aimDir = str_replace('', '/', $aimDir); $aimDir = substr($aimDir, -1) == '/' ? $aimDir : $aimDir . '/'; if (!is_dir($aimDir)) { return false; } $dirHandle = opendir($aimDir); while (false !== ($file = readdir($dirHandle))) { if ($file == '.' || $file == '..') { continue; } if (!is_dir($aimDir . $file)) { FileUtil::unlinkFile($aimDir . $file); } else { FileUtil::unlinkDir($aimDir . $file); } } closedir($dirHandle); return rmdir($aimDir); }
function lookupRowAccess() { $step = intval($_REQUEST['step']); if ($step == 2) { $listLimitModel = D('MisSystemListLimit'); $model = D('SystemConfigDetail'); $modelName = $_POST['setmodule']; $issub = $_POST['issub']; if ($issub) { $detailList = $model->getSubDetail($modelName, false); } else { $detailList = $model->getDetail($modelName, false); } if ($detailList) { $allowarr = $_POST["allow"]; //传回来的键值是key $clearallow = $_POST["clearallow"]; //传回来的是key $cleardeny = $_POST["cleardeny"]; //传回来的是key $userid = $_POST["userid"]; $roleid = $_POST["roleid"]; $expertid = $_POST["expertid"]; $globalrow = $_POST["globalrow"]; //传回来的是key foreach ($detailList as $k => $v) { if (!empty($v["row_access"])) { $arr = $v["row_access"]; } else { $arr = array(); } if (in_array($k, $clearallow)) { $arr["allow"] = array(); //删除数据库中允许字段 $allowwhere['modelname'] = $modelName; $listallowLimitInfo = $listLimitModel->where($allowwhere)->select(); foreach ($listallowLimitInfo as $listkey => $listval) { $denyfields = json_decode($listdval['denyfields'], true); $allowfields = json_decode($listval['allowfields'], true); foreach ($allowfields as $afk => $afv) { if ($v['name'] == $afv[0]) { unset($allowfields[$afk]); } } sort($allowfields); if (!empty($allowfields)) { $allowdata['allowfields'] = json_encode($allowfields); $allowdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $allowdata['updatetime'] = time(); } elseif (empty($allowfields) && empty($denyfields)) { $allowlist = $listLimitModel->where('id=' . $listval['id'])->delete(); } else { $allowdata['allowfields'] = null; $allowdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $allowdata['updatetime'] = time(); } $allowlist = $listLimitModel->where('id=' . $listval['id'])->save($allowdata); } } if (in_array($k, $cleardeny)) { $arr["deny"] = array(); //删除数据库中禁止字段 $denywhere['modelname'] = $modelName; $listdenyLimitInfo = $listLimitModel->where($denywhere)->select(); foreach ($listdenyLimitInfo as $listdkey => $listdval) { $denyfields = json_decode($listdval['denyfields'], true); $allowfields = json_decode($listval['allowfields'], true); foreach ($denyfields as $dfk => $dfv) { if ($v['name'] == $dfv[0]) { unset($denyfields[$dfk]); } } sort($denyfields); if (!empty($denyfields)) { $denydata['denyfields'] = json_encode($denyfields); $denydata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $denydata['updatetime'] = time(); } elseif (empty($allowfields) && empty($denyfields)) { $allowlist = $listLimitModel->where('id=' . $listval['id'])->delete(); } else { $denydata['denyfields'] = null; $denydata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $denydata['updatetime'] = time(); } $denylist = $listLimitModel->where('id=' . $listdval['id'])->save($denydata); } } if ($allowarr[$k] == 1) { //允许 if (isset($arr["allow"])) { //用户 if ($userid) { if (isset($arr["allow"]["userid"]) && $arr["allow"]["userid"] != "") { $arr1 = explode(",", $arr["allow"]["userid"]); $arr2 = explode(",", $userid); $arr3 = array_merge($arr1, $arr2); $arr["allow"]["userid"] = implode(",", array_unique($arr3)); //取得当前用户允许字段 $Data['allow'][] = array($v['name'], $v['showname']); } else { $arr["allow"]["userid"] = $userid; //取得当前用户允许字段 $Data['allow'][] = array($v['name'], $v['showname']); } } //角色 if ($roleid) { if (isset($arr["allow"]["roleid"]) && $arr["allow"]["roleid"] != "") { $arr1 = explode(",", $arr["allow"]["roleid"]); $arr2 = explode(",", $roleid); $arr3 = array_merge($arr1, $arr2); $arr["allow"]["roleid"] = implode(",", array_unique($arr3)); //取得当前角色允许字段 $roleData['allow'][] = array($v['name'], $v['showname']); } else { $arr["allow"]["roleid"] = $roleid; //取得当前角色允许字段 $roleData['allow'][] = array($v['name'], $v['showname']); } } //专家 if ($expertid) { if (isset($arr["allow"]["expertid"]) && $arr["allow"]["expertid"] != "") { $arr1 = explode(",", $arr["allow"]["expertid"]); $arr2 = explode(",", $expertid); $arr3 = array_merge($arr1, $arr2); $arr["allow"]["expertid"] = implode(",", array_unique($arr3)); //取得当前专家允许字段 $expertData['allow'][] = array($v['name'], $v['showname']); } else { $arr["allow"]["expertid"] = $expertid; //取得当前角色专家字段 $expertData['allow'][] = array($v['name'], $v['showname']); } } } else { $arr["allow"] = array(); if ($userid) { $arr["allow"]["userid"] = $userid; } if ($roleid) { $arr["allow"]["roleid"] = $roleid; } if ($expertid) { $arr["allow"]["expertid"] = $expertid; } //取得当前用户允许字段 $Data['allow'][] = array($v['name'], $v['showname']); //取得当前角色允许字段 $roleData['allow'][] = array($v['name'], $v['showname']); //取得当前角色专家字段 $expertData['allow'][] = array($v['name'], $v['showname']); } if (in_array($k, $globalrow)) { if ($userid != null) { $arr["deny"] = isset($arr["deny"]) ? $arr["deny"] : array(); $arr["deny"]["userid"] = $arr["deny"]["userid"] != "" ? $arr["deny"]["userid"] . ",0" : 0; //取得除当前用户以外的其他用户禁止字段 $allData[] = array($v['name'], $v['showname']); } if ($roleid != null) { $arr["deny"] = isset($arr["deny"]) ? $arr["deny"] : array(); $arr["deny"]["roleid"] = $arr["deny"]["roleid"] != "" ? $arr["deny"]["roleid"] . ",0" : 0; //取得除当前角色以外的其他角色禁止字段 $roleallData[] = array($v['name'], $v['showname']); } if ($expertid != null) { $arr["deny"] = isset($arr["deny"]) ? $arr["deny"] : array(); $arr["deny"]["expertid"] = $arr["deny"]["expertid"] != "" ? $arr["deny"]["expertid"] . ",0" : 0; //取得除当前专家以外的其他专家禁止字段 $expertallData[] = array($v['name'], $v['showname']); } } $detailList[$k]["row_access"] = $arr; } else { //禁止 if (isset($arr["deny"])) { //用户 if ($userid) { if (isset($arr["deny"]["userid"]) && $arr["deny"]["userid"] != "") { $arr1 = explode(",", $arr["deny"]["userid"]); $arr2 = explode(",", $userid); $arr3 = array_merge($arr1, $arr2); $arr["deny"]["userid"] = implode(",", array_unique($arr3)); //取得当前用户禁止字段 $Data['deny'][] = array($v['name'], $v['showname']); } else { $arr["deny"]["userid"] = $userid; //取得当前用户禁止字段 $Data['deny'][] = array($v['name'], $v['showname']); } } //角色 if ($roleid) { if (isset($arr["deny"]["roleid"]) && $arr["deny"]["roleid"]) { $arr1 = explode(",", $arr["deny"]["roleid"]); $arr2 = explode(",", $roleid); $arr3 = array_merge($arr1, $arr2); $arr["deny"]["roleid"] = implode(",", array_unique($arr3)); //取得当前角色禁止字段 $roleData['deny'][] = array($v['name'], $v['showname']); } else { $arr["deny"]["roleid"] = $roleid; //取得当前角色禁止字段 $roleData['deny'][] = array($v['name'], $v['showname']); } } //专家 if ($expertid) { if (isset($arr["deny"]["expertid"]) && $arr["deny"]["expertid"]) { $arr1 = explode(",", $arr["deny"]["expertid"]); $arr2 = explode(",", $expertid); $arr3 = array_merge($arr1, $arr2); $arr["deny"]["expertid"] = implode(",", array_unique($arr3)); //取得当前专家禁止字段 $expertData['deny'][] = array($v['name'], $v['showname']); } else { $arr["deny"]["expertid"] = $expertid; //取得当前专家禁止字段 $expertData['deny'][] = array($v['name'], $v['showname']); } } } else { $arr["deny"] = array(); if ($userid) { $arr["deny"]["userid"] = $userid; } if ($roleid) { $arr["deny"]["roleid"] = $roleid; } if ($expertid) { $arr["deny"]["expertid"] = $expertid; } //取得当前用户禁止字段 $Data['deny'][] = array($v['name'], $v['showname']); //取得当前角色禁止字段 $roleData['deny'][] = array($v['name'], $v['showname']); //取得当前专家禁止字段 $expertData['deny'][] = array($v['name'], $v['showname']); } $detailList[$k]["row_access"] = $arr; } } //对除当前用户以外的所有用户禁止 if (!empty($allData) && $userid != null) { $allwhere['modelname'] = $modelName; $allwhere['tableid'] = 0; $allwhere['tablename'] = 'user'; $allInfo = $listLimitModel->where($allwhere)->find(); if ($allInfo != null) { //对已有数据进行修改 $alluserdata['modelname'] = $modelName; $alluserdata['denyfields'] = json_encode($allData); $alluserdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $alluserdata['updatetime'] = time(); $alluserList = $listLimitModel->where('id=' . $allInfo['id'])->save($alluserdata); } else { $alluserdata['modelname'] = $modelName; $alluserdata['tablename'] = 'user'; $alluserdata['denyfields'] = json_encode($allData); $alluserdata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $alluserdata['createtime'] = time(); $alluserdata['tableid'] = '0'; $alluserList = $listLimitModel->add($alluserdata); } } //角色 if (!empty($roleallData) && $roleid != null) { $roleallwhere['modelname'] = $modelName; $roleallwhere['tableid'] = 0; $roleallwhere['tablename'] = 'rolegroup'; $roleallInfo = $listLimitModel->where($roleallwhere)->find(); if ($roleallInfo != null) { //对已有数据进行修改 $rolealluserdata['modelname'] = $modelName; $rolealluserdata['denyfields'] = json_encode($roleallData); $rolealluserdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $rolealluserdata['updatetime'] = time(); $rolealluserList = $listLimitModel->where('id=' . $roleallInfo['id'])->save($rolealluserdata); } else { $rolealluserdata['modelname'] = $modelName; $rolealluserdata['tablename'] = 'rolegroup'; $rolealluserdata['denyfields'] = json_encode($roleallData); $rolealluserdata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $rolealluserdata['createtime'] = time(); $rolealluserdata['tableid'] = '0'; $rolealluserList = $listLimitModel->add($rolealluserdata); } } //专家 if (!empty($expertallData) && $expertid != null) { $expertallwhere['modelname'] = $modelName; $expertallwhere['tableid'] = 0; $expertallwhere['tablename'] = 'mis_expert_list'; $expertallInfo = $listLimitModel->where($expertallwhere)->find(); if ($expertallInfo != null) { //对已有数据进行修改 $expertalluserdata['modelname'] = $modelName; $expertalluserdata['denyfields'] = json_encode($expertallData); $expertalluserdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $expertalluserdata['updatetime'] = time(); $expertalluserList = $listLimitModel->where('id=' . $expertallInfo['id'])->save($expertalluserdata); } else { $expertalluserdata['modelname'] = $modelName; $expertalluserdata['tablename'] = 'mis_expert_list'; $expertalluserdata['denyfields'] = json_encode($expertallData); $expertalluserdata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $expertalluserdata['createtime'] = time(); $expertalluserdata['tableid'] = '0'; $expertalluserList = $listLimitModel->add($expertalluserdata); } } //对当前用户允许或禁止 $userarr = explode(",", $userid); if ($userid != null) { foreach ($userarr as $uk => $uval) { $userdata['tableid'] = $uval; $userwhere['modelname'] = $modelName; $userwhere['tableid'] = $uval; $userwhere['tablename'] = 'user'; $userInfo = $listLimitModel->where($userwhere)->find(); if ($userInfo != null) { //对已有数据进行修改 $userdata['modelname'] = $modelName; $userdata['allowfields'] = json_encode($Data['allow']); $userdata['denyfields'] = json_encode($Data['deny']); $userdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $userdata['updatetime'] = time(); $userList = $listLimitModel->where('id=' . $userInfo['id'])->save($userdata); } else { $userdata['modelname'] = $modelName; $userdata['tablename'] = 'user'; $userdata['allowfields'] = json_encode($Data['allow']); $userdata['denyfields'] = json_encode($Data['deny']); $userdata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $userdata['createtime'] = time(); $userList = $listLimitModel->add($userdata); } } } //对当前角色允许或禁止 $rolearr = explode(",", $roleid); if ($roleid != null) { foreach ($rolearr as $rk => $rval) { $roledata['tableid'] = $rval; $rolewhere['modelname'] = $modelName; $rolewhere['tableid'] = $rval; $rolewhere['tablename'] = 'rolegroup'; $roleInfo = $listLimitModel->where($rolewhere)->find(); if ($roleInfo != null) { //对已有数据进行修改 $roledata['modelname'] = $modelName; $roledata['allowfields'] = json_encode($roleData['allow']); $roledata['denyfields'] = json_encode($roleData['deny']); $roledata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $roledata['updatetime'] = time(); $roleList = $listLimitModel->where('id=' . $roleInfo['id'])->save($roledata); } else { $roledata['modelname'] = $modelName; $roledata['tablename'] = 'rolegroup'; $roledata['allowfields'] = json_encode($roleData['allow']); $roledata['denyfields'] = json_encode($roleData['deny']); $roledata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $roledata['createtime'] = time(); $roleList = $listLimitModel->add($roledata); } } } //对当前专家允许或禁止 $expertarr = explode(",", $expertid); if ($expertid != null) { foreach ($expertarr as $ek => $eval) { $expertdata['tableid'] = $eval; $expertwhere['modelname'] = $modelName; $expertwhere['tableid'] = $eval; $expertwhere['tablename'] = 'mis_expert_list'; $expertInfo = $listLimitModel->where($expertwhere)->find(); if ($expertInfo != null) { //对已有数据进行修改 $expertdata['modelname'] = $modelName; $expertdata['allowfields'] = json_encode($expertData['allow']); $expertdata['denyfields'] = json_encode($expertData['deny']); $expertdata['updateid'] = $_SESSION[C('USER_AUTH_KEY')]; $expertdata['updatetime'] = time(); $expertList = $listLimitModel->where('id=' . $expertInfo['id'])->save($expertdata); } else { $expertdata['modelname'] = $modelName; $expertdata['tablename'] = 'mis_expert_list'; $expertdata['allowfields'] = json_encode($expertData['allow']); $expertdata['denyfields'] = json_encode($expertData['deny']); $expertdata['createid'] = $_SESSION[C('USER_AUTH_KEY')]; $expertdata['createtime'] = time(); $expertList = $listLimitModel->add($expertdata); } } } if ($issub) { $model->setSubDetail($modelName, $detailList); } else { $model->setDetail($modelName, $detailList); } //删除缓存文件 $p = C("DATA_CACHE_PATH") . "Dynamicconf/Models/" . $modelName; if (file_exists($p)) { $FileUtil = new FileUtil(); $boolean = $FileUtil->unlinkDir($p); if (!$boolean) { $this->error("更新缓存文件失败"); } } $this->success(L('_SUCCESS_')); exit; } else { $this->error("模块不存在!"); } } else { $model = D('SystemConfigDetail'); $modelName = $_GET['setmodule']; $issub = $_GET['issub']; if ($issub) { $list = $model->getSubDetail($modelName, false); } else { $list = $model->getDetail($modelName, false); } if ($list) { $modeluser = M("user"); foreach ($list as $k => $v) { if (isset($v["row_access"])) { $access = $v["row_access"]; if ($access["deny"]) { $map["id"] = array("in", $access["deny"]['userid']); $list[$k]["row_access"]["deny_username"] = implode(",", $modeluser->where($map)->getField("name", true)); } if ($access["allow"]) { $map["id"] = array("in", $access["allow"]['userid']); $list[$k]["row_access"]["allow_username"] = implode(",", $modeluser->where($map)->getField("name", true)); } } } } $this->assign('list', $list); $this->assign("module", $modelName); $this->assign("issub", $issub); $this->display(); } }
/** * 删除专题 * @param int .管理员id * @param int .专题Id * @return int */ public function delArticleBanner($man_id, $top_id) { //检查专题是否存在 $sql = 'select top_unique,top_thumb from topic where top_id=? limit 1'; $result = $this->getReadConnection()->fetchOne($sql, Phalcon\Db::FETCH_ASSOC, [$top_id]); if (!$result) { return 404; } //删除数据 $sql = 'delete from topic where top_id=?'; $this->getReadConnection()->execute($sql, [$top_id]); if (!$this->getReadConnection()->affectedRows()) { return 500; } //删除专题缩略图 if (is_file(UPLOAD_PATH . $result['top_thumb'])) { unlink(UPLOAD_PATH . $result['top_thumb']); } //删除专题html $phtml = TOPIC_HTML_PATH . '/' . $result['top_unique'] . '.phtml'; if (is_file($phtml)) { unlink($phtml); } //删除专题资源 $extract = TOPIC_ROOT_PATH . '/' . $result['top_unique']; $util = new FileUtil(); $util->unlinkDir($extract); //管理员操作记录 $this->log($man_id, 'del_topic', '删除专题:', $top_id); return 200; }
public function initializeLookupObj() { $model = D($this->getActionName()); // 删除原有的文件夹 if (is_dir(Dynamicconf . "/LookupObj")) { import('@.ORG.xhprof.FileUtil'); $fileUtil = new FileUtil(); $fileUtil->unlinkDir(Dynamicconf . "/LookupObj"); } $lookupobjlist = $model->where('status=1')->select(); // print_r(count($lookupobjlist)); // echo 99; // exit; $conlist = array(); $path = $model->GetDetailsPath(); if (!file_exists($path)) { createFolder($path); } foreach ($lookupobjlist as $k => $v) { if ($v['viewtype'] == 1) { $viewmasid = getFieldBy($v['viewname'], "name", "id", "mis_system_dataview_mas"); $chinaarr = array(); if ($viewmasid) { $viewsub = M("mis_system_dataview_sub")->field("otherfield,title")->where("masid=" . $viewmasid)->select(); $fieldsarr = explode(',', $v['fields']); foreach ($fieldsarr as $key2 => $val2) { foreach ($viewsub as $key1 => $val1) { if ($val2 == $val1['otherfield']) { $chinaarr[$val1['otherfield']] = $val1['title'] ? $val1['title'] : $val1['otherfield']; } } } } $conlist[$v['id']] = array('title' => $v['title'], 'fields' => $v['fields'], 'fields_china' => $chinaarr, 'checkforfields' => $v['checkforfields'], 'fieldcom' => $v['fieldcom'], 'listshowfields' => $v['listshowfields'], 'listshowfields_china' => $this->getDeatilshowname($v['mode'], $v['listshowfields'], '', 'china'), 'funccheck' => $v['funccheck'], 'funccheck_china' => $this->getDeatilshowname($v['mode'], $v['funccheck'], '', 'china'), 'funcinfo' => unserialize(base64_decode($v['funcinfo'])), 'url' => $v['url'], 'mode' => $v['mode'], 'checkformodel' => $v['checkformodel'], 'filed' => $v['filed'], 'filed1' => $v['filed1'], 'val' => $v['val'], 'showrules' => $v['showrules'], 'rulesinfo' => $v['rulesinfo'], 'rules' => $v['rules'], 'viewname' => $v['viewname'], 'viewtype' => $v['viewtype'], 'condition' => $v['rules'], 'dialogwidth' => $v['dialogwidth'], 'dialogheight' => $v['dialogheight'], 'status' => $v['status'], 'level' => $v['level'], 'datasort' => $v['datasort'], 'conftype' => $v['conftype'] ? $v['conftype'] : 0); } else { $conlist[$v['id']] = array('title' => $v['title'], 'fields' => $v['fields'], 'fields_china' => $this->getDeatilshowname($v['mode'], $v['fields'], '', 'china'), 'checkforfields' => $v['checkforfields'], 'fieldcom' => $v['fieldcom'], 'listshowfields' => $v['listshowfields'], 'listshowfields_china' => $this->getDeatilshowname($v['mode'], $v['listshowfields'], '', 'china'), 'funccheck' => $v['funccheck'], 'funccheck_china' => $this->getDeatilshowname($v['mode'], $v['funccheck'], '', 'china'), 'funcinfo' => unserialize(base64_decode($v['funcinfo'])), 'url' => $v['url'], 'mode' => $v['mode'], 'checkformodel' => $v['checkformodel'], 'filed' => $v['filed'], 'filed1' => $v['filed1'], 'val' => $v['val'], 'showrules' => $v['showrules'], 'rulesinfo' => $v['rulesinfo'], 'rules' => $v['rules'], 'viewname' => $v['viewname'], 'viewtype' => $v['viewtype'], 'condition' => $v['rules'], 'dialogwidth' => $v['dialogwidth'], 'dialogheight' => $v['dialogheight'], 'status' => $v['status'], 'level' => $v['level'], 'datasort' => $v['datasort'], 'conftype' => $v['conftype'] ? $v['conftype'] : 0); } if ($v['dtinfo']) { $conlist[$v['id']]['dt'] = unserialize(base64_decode($v['dtinfo'])); $conlist['versions'] = '1.0'; } else { if ($v['datetable']) { $conlist[$v['id']]['proid'] = $v['proid']; $conlist[$v['id']]['fieldback'] = $v['fieldback']; if ($v['orderfield']) { $conlist[$v['id']]['orderfield'] = $v['orderfield']; $conlist[$v['id']]['ordersort'] = $v['ordersort']; } // $conlist[$v['id']]['fieldcom']=$v['fieldcom']; $conlist[$v['id']]['dt'] = unserialize(base64_decode($v['datetable'])); if ($v['dtfuncfields']) { $conlist['dtfuncfields'] = $v['dtfuncfields']; $conlist['dtfuncinfo'] = $v['dtfuncinfo']; } } } $filename = $path . "/" . $v['id'] . ".php"; $model->SetSongleRule($filename, $conlist[$v['id']]); $fileindex[$v['id']] = $v['title']; } $pathconf = DConfig_PATH . '/LookupObj/Index'; if (!file_exists($pathconf)) { createFolder($pathconf); } $num = $model->SetSongleRule($pathconf . '/list.inc.php', $fileindex); $model->commit(); if ($num) { $json = '{"status":1,"statusCode":1,"navTabId":null,"message":"\\u64cd\\u4f5c\\u6210\\u529f","forward":null,"forwardUrl":null,"callbackType":null,"data":"","checkfield":null,"refreshtabs":null,"rel":null,"redalert":0}'; echo '<script>reloadindexview(' . $json . ')</script>'; exit; } else { $this->error('转换失败'); } // $this->success('操作成功'); }
/** * @Title: pJAccesslist * @Description: todo(任务节点权限初始化) * @author 谢友志 * @date 2015-4-7 下午2:54:02 * @throws */ public function pJAccesslist() { // 删除原有的文件夹 if (is_dir(Dynamicconf . "/PJAccessList")) { import('@.ORG.xhprof.FileUtil'); $fileUtil = new FileUtil(); $fileUtil->unlinkDir(Dynamicconf . "/PJAccessList"); } //查找带模板的任务节点 $map['formobj'] = array('neq', ''); $tasklist = M("mis_system_flow_form")->where($map)->select(); //任务节点权限文件夹 $pathconf = DConfig_PATH . '/PJAccessList'; if (!file_exists($pathconf)) { createFolder($pathconf); } foreach ($tasklist as $k => $v) { $Action = $val['formobj']; if ((int) $Action > 0) { continue; } $new[$v['formobj']] = $v; } //调用lookupobj模型的写入文件方法 $lookupmodel = D("LookupObj"); foreach ($new as $key => $val) { $Action = $val['formobj']; if ((int) $Action > 0) { continue; } $nodedetails = M("node")->where("name='" . $Action . "'")->find(); if (!$nodedetails) { logs("模板" . $Action . "没有对应模板节点", "taskNodeRole"); } else { //$nodeid = getFieldBy($action,"name","id","node"); //查找该模板的操作节点 $nodemodel = M("node"); $list = $nodemodel->where("pid=" . $nodedetails['id'])->select(); /** 索引文件以“paaccess_”+任务节点id为key值 已对应模板名称为value值组成数组 */ if ($list) { //组合一个索引文件的元素 $name = "pjaccess_" . $Action; $title = $nodedetails['title']; $arr[$name] = $title; //array($name=>$title); //对操作节点数据进行重组$detailes $temp = array('GROUPID' => $nodedetails['group_id']); foreach ($list as $k => $v) { $optionname = strtoupper($v['name']); if ($optionname == "CHANGEEDIT" || $optionname == "EDIT") { $temp1 = array($optionname => $v['id'] . "-4"); } else { $temp1 = array($optionname => $v['id'] . "-1"); } $temp = array_merge($temp, $temp1); } $detailes = array($Action => $temp); //套表 组合表情况下 添加权限详情元素 $model = D($this->getActionName()); $isbinddetailes = $model->pjAccessisbind($Action); $detailes = array_merge($detailes, $isbinddetailes); //暂时生成文件 其操作节点权限全部为1 //任务节点详情文件 每个任务节点生成单独的文件 $detailesfile = $pathconf . '/' . $name . '.php'; //$roledetailsdir.'/'.$name.'.inc.php'; $detailesnum = $lookupmodel->SetSongleRule($detailesfile, $detailes); } else { logs("节点" . $Action . "没有对应下级操作", "taskNodeRole"); } } } echo "初始化完成!"; // //任务节点进入索引文件 // $indexnum = $lookupmodel->SetSongleRule($roleindexdir.'/indexlist.inc.php',$arr); }