function index() { $userid = $_GET['userid']; $name = getFieldBy($userid, 'id', 'name', 'user'); $this->assign('name', $name); $this->assign('userid', $userid); $this->display(); }
public function render($data) { //必需传入当前任务id array('id'=>???) if ($data['id']) { $model = M("mis_project_flow_form"); $projectid = getFieldBy($data['id'], 'id', 'projectid', "mis_project_flow_form"); $list = $model->where('status=1 AND outlinelevel = 4 AND projectid=' . $projectid)->order('id asc')->select(); foreach ($list as $k => $v) { if ($v['id'] == $data['id']) { break; } } $prev = $list[$k - 1]; //上一个任务 $next = $list[$k + 1]; //下一个任务 $html = '<div class="tml_search_tips">'; $html .= '<div class="search_tips_title">上一个任务:</div>'; if ($prev) { if ($prev['complete'] == 1) { $html .= '<p class="search_tips_center">' . $prev['name'] . '--' . $prev['orderno'] . ' <span style="color:grey">【已完成】</span> 任务开启时间:' . date('Y-m-d', $prev['begintime']); if ($prev['notes']) { $html .= " 任务描述:" . $prev['notes']; } $html .= '</p>'; } else { $html .= '<p class="search_tips_center">' . $prev['name'] . '--' . $prev['orderno'] . ' <span style="color:blue">【未完成】</span> 任务开启时间:' . date('Y-m-d', $prev['begintime']); if ($prev['notes']) { $html .= " 任务描述:" . $prev['notes']; } $html .= '</p>'; } } else { $html .= '<p class="search_tips_center"><span style="color:grey">任务不存在</span></p>'; } $html .= '<div class="search_tips_title">下一个任务:</div>'; if ($next) { if ($next['complete'] == 1) { $html .= '<p class="search_tips_center">' . $next['name'] . '--' . $next['orderno'] . ' <span style="color:grey">【已完成】</span> 任务开启时间:' . date('Y-m-d', $next['begintime']); if ($next['notes']) { $html .= " 任务描述:" . $next['notes']; } $html .= '</p>'; } else { $html .= '<p class="search_tips_center">' . $next['name'] . '--' . $next['orderno'] . ' <span style="color:blue">【未完成】</span> 任务开启时间:' . date('Y-m-d', $next['begintime']); if ($next['notes']) { $html .= " 任务描述:" . $next['notes']; } $html .= '</p>'; } } else { $html .= '<p class="search_tips_center"><span style="color:grey">任务不存在</span></p>'; } $html .= '</div>'; return $html; } }
/** * * @Title: wfDistributeChart * @Description: todo(设备分布) * @author renling * @date 2014-7-31 下午2:33:20 * @throws */ public function wfDistributeChart() { $this->createwfDistributeTree(); $typeModel = D('MisWorkFacilityType'); $typelist = $typeModel->where('status=1 and pid !=0')->getField("id,name"); $this->assign("MisWorkFacilityTypeList", $typelist); //查询第一个类型 $MisWorkFacilityDistributeModel = D('MisWorkFacilityDistribute'); $MisWorkFacilityDistributeVO = $MisWorkFacilityDistributeModel->where("status=1")->find(); $map = array(); $map['status'] = 1; if ($_REQUEST['equipmenttype']) { $map['equipmenttype'] = $_REQUEST['equipmenttype']; } else { $map['equipmenttype'] = $MisWorkFacilityDistributeVO['equipmenttype']; } if ($_REQUEST['manageid']) { $map['manageid'] = $_REQUEST['manageid']; } $this->assign("equipmenttype", $map['equipmenttype']); $this->assign("title", getFieldBy($map['equipmenttype'], "id", "name", "mis_work_facility_type") . "分布图"); $map['appqty'] = array("neq", 0); $MisWorkFacilityDistributeList = $MisWorkFacilityDistributeModel->where($map)->select(); $xAxis = array("categories" => array()); $deptlist = array(); $manageidList = array(); $series = array(); foreach ($MisWorkFacilityDistributeList as $key => $val) { if (!in_array($val['applydepartmentid'], array_keys($deptlist))) { $deptlist[$val['applydepartmentid']] = 1; $xAxis["categories"][] = getFieldBy($val['applydepartmentid'], 'id', "name", "mis_system_department"); } if (!in_array($val['manageid'], array_keys($manageidList))) { $manageidList[$val['manageid']] = 1; $newseries = array("name" => $val['managename'], "data" => array()); $series[] = $newseries; } } $i = 0; foreach ($manageidList as $mkey => $mval) { $alist = array(); foreach ($deptlist as $key => $val) { $manageMap = array(); $manageMap['manageid'] = $mkey; $manageMap['applydepartmentid'] = $key; $manageMap['equipmenttype'] = $map['equipmenttype']; //查询该部门下设备数量 $MisWorkFacilityDistributeVo = $MisWorkFacilityDistributeModel->where($manageMap)->find(); $alist[] = intval($MisWorkFacilityDistributeVo['appqty']); } $series[$i]["data"] = $alist; $i++; } $this->assign("xAxis", json_encode($xAxis)); $this->assign("series", json_encode($series)); $this->display("wfDistributeChart"); }
public function getViewConf($name) { $modelname = getFieldBy($name, 'name', 'modelname', 'mis_system_dataview_mas'); $file = Dynamicconf . "/Models/" . $modelname . "/" . $name . ".inc.php"; if (is_file($file)) { return require $file; } else { return array(); } }
public function lookupdistribute() { $map = $this->_search(); //实例化办公设备类型表 $dptmodel = D("MisWorkFacilityType"); //查name和id $deptlist = $dptmodel->where("status=1")->order("id asc")->field('id,name,pid as parentid')->select(); $treemiso[] = array('id' => 0, 'pId' => -1, 'name' => '设备类型', 'rel' => 'misworkfacilitydistributeli', 'target' => 'ajax', 'url' => '__URL__/lookupdistribute/jump/1', 'open' => true); $param['rel'] = "misworkfacilitydistributeli"; $param['url'] = "__URL__/lookupdistribute/jump/1/equipmenttype/#id#"; $typeTree = $this->getTree($deptlist, $param, $treemiso); $this->assign('tree', $typeTree); $equipmenttype = $_REQUEST['equipmenttype']; $id = $_REQUEST['id']; if ($id) { $map['manageid'] = $id; $equipmenttype = getFieldBy($id, 'id', 'equipmenttype', 'mis_work_facility_manage'); } $map['appqty'] = array("neq", 0); if ($equipmenttype) { //加入递归 $deptlist = array_unique(array_filter(explode(",", $this->findAlldept($deptlist, $equipmenttype)))); $map['equipmenttype'] = array("in", $deptlist); $this->assign("equipmenttype", $equipmenttype); } //动态配置显示字段 $name = $this->getActionName(); if (!empty($name)) { $qx_name = $name; if (substr($name, -4) == "View") { $qx_name = substr($name, 0, -4); } //验证浏览及权限 if (!isset($_SESSION['a'])) { $map = D('User')->getAccessfilter($qx_name, $map); } $this->_list($name, $map); } $scdmodel = D('SystemConfigDetail'); //扩展工具栏操作 $toolbarextension = $scdmodel->getDetail($name, true, 'toolbar'); if ($toolbarextension) { $this->assign('toolbarextension', $toolbarextension); } $detailList = $scdmodel->getDetail($name); if ($detailList) { $this->assign('detailList', $detailList); } if ($_REQUEST['jump']) { $this->display("lookupdistributeview"); } else { $this->display(); } }
public function index() { $name = $this->getActionName(); if (isset($_SESSION[C('USER_AUTH_KEY')])) { //初始化生成左边树,默认打开节点,跳转不再刷新树 $model = D('SystemConfigDetail'); if ($_REQUEST['jump']) { $modelName = $_REQUEST['model']; } else { $models = D('SystemConfigNumber'); $returnarr = $models->getRoleTree('ToolBarConfigBox'); //左边树 $firstDetail = $models->firstDetail; $this->assign('returnarr', $returnarr); if ($_REQUEST['model']) { $check = getFieldBy($_REQUEST['model'], 'name', 'id', 'node'); $this->assign('check', $check); $modelName = $_REQUEST['model']; } else { $this->assign('check', $firstDetail['check']); $modelName = $firstDetail['name']; } } //赋值给toolbar调用 $_REQUEST['modelname'] = $modelName; $this->assign('modelname', $modelName); $scdmodel = D('SystemConfigDetail'); //读取列名称数据(按照规则,应该在index方法里面) $detailList = $scdmodel->getDetail($name); if ($detailList) { $this->assign('detailList', $detailList); } // //扩展工具栏操作 $toolbarextension = $scdmodel->getDetail($name, true, 'toolbar'); if ($toolbarextension) { $this->assign('toolbarextension', $toolbarextension); } // 选中模型的toolbar配置集 $scdmodel = D('SystemConfigDetail'); $toollist = $scdmodel->getDetail($modelName, false, 'toolbar'); $list = $this->htmlaspilt($toollist); //dump($toollist); $this->assign('list', $list); if ($_REQUEST['jump']) { $this->display("indexview"); } else { $this->display(); } } }
/** * @Title: _before_add * @Description: todo(打开页面前置函数) * @author * @throws */ public function _before_add() { $this->assign("time", time()); //得到当前登录的用户绑定的员工 $userid = $_SESSION[C('USER_AUTH_KEY')]; $deptid = getFieldBy($userid, 'id', 'dept_id', 'user'); //获取部门 //$model=D("MisHrPersonnelPersonInfo"); //$deptid = $model->where("id=".$employeid)->getField("deptid"); //查询职位 $DutyModel = D('Duty'); $DutyList = $DutyModel->where(" status=1")->getField('id,name'); $this->assign("DutyList", $DutyList); //根据当前用户的部门选择select下拉框的部门 $this->_before_everymethor($deptid); }
public function render($data) { $tablename = MODULE_NAME; // 当前类名 $where = array(); $where['tablename'] = $tablename; //查询当前tablename是否存在编码方案 $MisSystemOrdernoModel = D("MisSystemOrderno"); $vo = $MisSystemOrdernoModel->where($where)->find(); $nodetitle = getFieldBy($tablename, "name", "title", "node"); if ($data) { $title = $nodetitle . "编码方案!"; } else { $title = "暂无" . $nodetitle . ",请新增" . $nodetitle . "!"; } $html = ""; if ($vo) { $xstr = "*********"; $newstr = ""; for ($i = 1; $i <= $vo['maxlevels']; $i++) { $num = $vo[$MisSystemOrdernoModel->arr[$i]]; $result = substr($xstr, 0, $num); $newstr .= $result . " "; } $html .= '<div class="tips_add_info">'; $html .= ' <p><span><span class="icon-comments"></span><span> 提示:</span></span>' . $title . '</p>'; $html .= ' <p>编码方案:<span>' . $newstr . '</span></p>'; $html .= ' <p>最大级数:<span>' . $vo['maxlevels'] . '</span></p>'; $html .= ' <p>最大长度:<span>' . $vo['maxlenght'] . '</span></p>'; $html .= ' <p>单级最大长度:<span>' . $vo['singlelenght'] . '</span></p>'; $html .= '</div>'; } else { $html .= '<div class="tips_add_info">'; $html .= ' <p><span><span class="icon-comments"></span><span> 提示:</span></span>' . $title . '</p>'; $html .= ' <p>编码方案:<span>无</span></p>'; $html .= ' <p>最大级数:<span>0</span></p>'; $html .= ' <p>最大长度:<span>0</span></p>'; $html .= ' <p>单级最大长度:<span>0</span></p>'; $html .= '</div>'; } return $html; }
public function _before_insert() { //获得部门 $deptid = $_POST['deptid']; //获得职级 $dutyid = $_POST['dutyid']; //判断当前添加的部门职级是否已经存在了。 $name = $this->getActionName(); $model = D($name); $where = array(); $where['deptid'] = $deptid; $where['dutyid'] = $dutyid; $where['userid'] = $_POST['userid']; $list = $model->where($where)->find(); $username = getFieldBy($_POST['userid'], 'id', 'name', 'user'); $dutyname = getFieldBy($dutyid, 'id', 'name', 'duty'); $deptname = getFieldBy($deptid, 'id', 'name', 'mis_system_department'); if ($list) { $this->error($username . "已经是" . $deptname . "的" . $dutyname . "! 请勿重复添加"); } }
/** * 获取套表的所有子项,只获取直属关系,套表 调用 套表 不考虑、 * @Title: getNestedForm * @Description: todo(这里用一句话描述这个方法的作用) * @param string $mainAction 主入口action名称 * @param boolean $isContentSelf 是否包含自己,默认false 不包含 * @author quqiang * @date 2015年3月4日 下午1:55:23 * @throws */ protected function getNestedForm($mainAction, $isContentSelf = false) { $MisAutoBindModel = D("MisAutoBind"); //获取主表formid $formid = getFieldBy($mainAction, "actionname", "id", "mis_dynamic_form_manage"); //是否为套表主表 if (getFieldBy($mainAction, "bindaname", "pid", "mis_auto_bind", "typeid", 2) == 0) { $map = array(); $map['level'] = $formid; $map['typeid'] = 2; // 是否包换自己 if (!$isContentSelf) { //$map['pid'] = array('neq' , '0'); } $list = $MisAutoBindModel->where($map)->getField("id,inbindaname"); if ($isContentSelf) { echo $MisAutoBindModel->getLastSql(); } return $list; } else { return false; } }
public function getNodeTree($map) { if ($map) { $map = " status=1 and " . $map; } else { $map = "status=1"; } //查询全部三级数据 $NodeTreeList = $this->where($map)->select(); $nodeTree = array(); $pname = array(); foreach ($NodeTreeList as $key => $val) { $nodeTree[] = array('id' => $val['id'], 'name' => $val['title'], 'title' => $val['title'], 'ename' => $val['name'], 'pId' => "-" . $val['pid'], 'url' => "__URL__/index/jump/1/nodename/" . $val['name'], 'target' => 'ajax', 'rel' => 'ProcessManageBox', 'open' => false); $pid[] = $val['pid']; } $pid = array_unique($pid); foreach ($pid as $k => $v) { if (getFieldBy($v, "id", "name", "node")) { $nodeTree[] = array('id' => "-" . $v, 'name' => getFieldBy($v, "id", "title", "node"), 'title' => getFieldBy($v, "id", "title", "node"), 'pId' => 0); } } return $nodeTree; }
/** * (non-PHPdoc) * @see Widget::render(系统三级页面左树与导航切换) */ public function render($data) { return; //获取改模型所在分组的菜单 $name = MODULE_NAME; $groupid = getFieldBy($name, 'name', 'group_id', 'node'); //实例化缓存 有就读缓存的内容 $mrdmodel = D('MisRuntimeData'); $html = $mrdmodel->getRuntimeCache($name, $groupid . 'ShowToLevelMenu'); if (empty($html)) { $model = D('Public'); $accessNode = $model->menuLeftTree($groupid); //组合html $html .= '<script src="__PUBLIC__/Js/showtolevelmemu.js" type="text/javascript"></script>'; $html .= '<a class="menu_tag" href="#"><span class="icon-reorder"></span></a>'; $html .= '<div class="nbmaccordionFloat">'; $html .= '<div class="nbmaccordion" data-option="close:icon-double-angle-down;open:icon-double-angle-up" layouth="85">'; foreach ($accessNode as $k => $vo) { $html .= '<div title="' . $vo["title"] . '">'; $html .= '<ul>'; foreach ($vo['levelthree'] as $k1 => $vv) { $html .= '<li>'; $html .= '<a title="' . $vv["title"] . '" href="__APP__/' . $vv["name"] . '/index" target="navTab">'; $html .= '<span class="icon icon-tags mr10"></span>'; $html .= '<span>' . $vv["title"] . '</span>'; $html .= '</a>'; $html .= '</li>'; } $html .= '</ul>'; $html .= '</div>'; } $html .= '</div>'; $html .= '</div>'; $mrdmodel->setRuntimeCache($html, $name, $groupid . 'ShowToLevelMenu'); } return $html; }
public function insertsub() { $model = M("mis_system_intercalate_sub"); if ($_POST['modelid']) { $_POST['modelname'] = getFieldBy($_POST['modelid'], "id", "name", "node"); } $data = $model->create(); if (false === $data) { $this->error($model->getError()); } //保存当前数据对象 try { $list = $model->add($data); //echo $model->getlastsql(); } catch (Exception $e) { $this->error($e->__toString()); } $msg = $model->getlastsql() . arr2string($data); if (false === $list) { $this->error($msg); } else { $this->success("操作成功!"); } }
public function _before_add() { //查询所有部门信息 $deptmodel = D("MisSystemDepartment"); $deptlist = $deptmodel->where("status=1")->select(); $deptlists = $this->selectTree($deptlist, 0, 0, $_REQUEST['departmentid']); $this->assign("deptlist", $deptlists); //echo $_REQUEST['departmentid'].">>>".getFieldBy($_REQUEST['departmentid'], "id", "companyid", "mis_system_department");exit; //查询当前部门是否有下级部门 $deptVo = $deptmodel->where("status=1 and parentid=" . $_REQUEST['departmentid'])->field("id")->find(); $departmentid = ""; if ($deptVo) { $departmentid = $deptVo['id']; } else { $departmentid = $_REQUEST['departmentid']; } $this->assign("departmentid", $departmentid); $this->assign("companyid", getFieldBy($departmentid, "id", "companyid", "mis_system_department")); //公司信息进入新增 if ($_REQUEST['com']) { $this->assign("com", $_REQUEST['com']); } $this->assign('depdata', $this->getCompanyDept()); }
/** * 原始数据格式化为组件属性数据。 * @Title: format * @Description: todo(将原始数据格式化为以组件为主的属性数据) * * @param array $data * 原始数据 * @author quqiang * @date 2015年1月29日 上午11:02:37 * @example $data = array('ActionName','nodeName|nodeID','tplName' * array( * array('name',true,false),// $arr[0]:字段名 $arr[1]:写入权限 $arr[2]:读取权限 * array('age',true,true), * array('sex',false,false), * ) * ); * $fmtData = format($data); * 权限值 为 true时 表示不做过滤操作,没有读取权限包含没有写入权限 * tplName:可为空,表示使用index模板。做后续可能的扩展用。 * @throws Exception 需要异常处理 */ private function format($data) { if (!is_array($data)) { throw new Exception("没有可用数据用于解析!"); exit; } $actionName = $data[0]; $nodeName = $data[1]; $tplName = $data[2] ? $data[2] : 'index'; if (!$actionName) { throw new Exception('传入Action名称为空'); exit; } $this->actionName = $actionName; if (!$nodeName) { throw new Exception('传入节点标识为空'); exit; } $this->nodeName = $nodeName; if (!is_dir(TMPL_PATH . C('DEFAULT_THEME') . '/' . $actionName)) { throw new Exception("文件路径 " . TMPL_PATH . C('DEFAULT_THEME') . '/' . $actionName . " 不存在!"); exit; } $formid = getFieldBy($actionName, "actionname", "id", "mis_dynamic_form_manage"); if (!$formid) { throw new Exception("传入表单Action[{$actionName}]不存在于表单记录表中,请查证!"); exit; } $this->formid = $formid; $dataSouce = $data[3]; // if (! is_array ( $dataSouce )) { // throw new Exception ( "过滤条件为空!" ); // return false; // } $this->dataSouce = $dataSouce; }
/** * @Title: createView * @Description: todo(生成查询视图代码) * @param string $actionName Action名称 * @author renling * @date 2014-10-? * @throws * @modify * 屈强@2014-10-08 16:21 视图查询字段添加主表的ID * */ protected function createView($actionName) { // 通过action名称称获取所有表信息 if (!$this->nodeName) { $this->error('Action名称丢失!!'); } $mis_dynamic_form_manageObj = M('mis_dynamic_form_manage'); $forminfo = $mis_dynamic_form_manageObj->where("`actionname`='{$this->nodeName}'")->find(); if (!is_array($forminfo)) { $this->error('没有获取到表单记录信息'); } // 得到字段记录。 $MisDynamicDatabaseMasViewModel = D("MisDynamicDatabaseMasView"); $allTableFiledArr = $MisDynamicDatabaseMasViewModel->where('mis_dynamic_database_mas.status=1 and mis_dynamic_database_sub.status and mis_dynamic_database_mas.formid=' . $forminfo['id'])->select(); // 将字段信息按所属表分组 $tablelist = array(); $newAllTableFieldArr = array(); foreach ($allTableFiledArr as $key => $val) { if ($val['category'] != "datatable") { $tablearr = array('tablename' => $val['tablename'], 'tabletitle' => $val['tabletitle'], 'isprimary' => $val['isprimary'], 'ischoise' => $val['isprimary']); $tablelist[$val['masid']][] = $val; } } logs("=============endview ===" . __LINE__ . "-----》》》》==========" . $this->nodeName); //$dir = ROOT . "/Dynamicconf/autoformconfig/MisAutoAnameList.inc.php"; //$tablelist=require $dir; $modelPath = LIB_PATH . "Model/" . $this->nodeName . "ViewModel.class.php"; logs("=============endview ===" . __LINE__ . "-----》》》》==========" . $this->nodeName); $listArr = ""; $primaryname = ""; foreach ($tablelist as $stkey => $stval) { if (getFieldBy($stkey, "id", "isprimary", "mis_dynamic_database_mas")) { $listArr .= "\t'" . getFieldBy($stkey, "id", "tablename", "mis_dynamic_database_mas") . "'=>array('id',"; foreach ($stval as $sctkey => $sctval) { $listArr .= "'" . $sctval['field'] . "',"; } /** * 系统默认字段 */ foreach ($this->systemUserField as $bkey => $bval) { if ($bval != id) { $listArr .= "'" . $bval . "',"; } } $listArr .= "'_type'=>'LEFT'),\r\n"; $primaryname = $sctval['tablename']; } } logs($tablelist, 'view', '', __CLASS__, __FUNCTION__, __METHOD__); foreach ($tablelist as $tkey => $tval) { if (!getFieldBy($tkey, "id", "isprimary", "mis_dynamic_database_mas")) { $listArr .= "\t'" . getFieldBy($tkey, "id", "tablename", "mis_dynamic_database_mas") . "'=>array("; foreach ($tval as $ctkey => $ctval) { if (trim($ctval['field'])) { $listArr .= "'" . $ctval['field'] . "',"; } } $listArr .= "'_on'=>'" . $primaryname . ".id=" . getFieldBy($tkey, "id", "tablename", "mis_dynamic_database_mas") . ".masid'),\r\n"; } } $phpcode .= "<?php\r\n/**"; $phpcode .= "\r\n * @Title: " . $this->nodeName . "ModelView"; $phpcode .= "\r\n * @Package package_name"; $phpcode .= "\r\n * @Description: todo(动态表单_自动生成-" . $this->nodeTitle . ")"; $phpcode .= "\r\n * @author " . $_SESSION['loginUserName']; $phpcode .= "\r\n * @company Aqo5Re65bSr5zG755m45t92YuQnZvNHbtRnL3d3d"; $phpcode .= "\r\n * @copyright 本文件归属于Aqo5Re65bSr5zG755m45t92YuQnZvNHbtRnL3d3d"; $phpcode .= "\r\n * @date " . date('Y-m-d H:i:s'); $phpcode .= "\r\n * @version V1.0"; $phpcode .= "\r\n*/"; $phpcode .= "\r\nclass "; $phpcode .= $this->nodeName . "ViewModel extends ViewModel {\r\n\t"; $phpcode .= <<<EOF \t\t \tfunction __construct(){ \t\tparent::__construct(); \t\t\$arr = getModelFilterByNodeSetting(); \t\tif(is_array(\$arr)){ \t\t\t\$this->_filter = \$arr; \t\t} \t} \t// 字段权限过滤 \tprotected \$_filter = array(); \t\t EOF; $phpcode .= "public \$viewFields = array(\r\n" . $listArr . ");"; $phpcode .= "\r\n}\r\n?>"; if (!is_dir(dirname($modelPath))) { mk_dir(dirname($modelPath), 0777); } if (false === file_put_contents($modelPath, $phpcode)) { $this->error("视图文件生成失败!"); } }
/** * @Title: openRulesPage * @Description: todo(打开规则条件编辑页面) * @author 谢友志 * @date 2015-3-12 下午2:47:13 * @throws */ function openRulesPage() { $modelname = $_POST['sourcemodel']; $tablename = D($modelname)->getTableName(); $datatableModel = M("mis_dynamic_form_datatable"); $formid = $datatableModel->where("tablename='{$tablename}'")->getField("formid"); if ($formid) { $modelname = getFieldBy($formid, 'id', "actionname", "mis_dynamic_form_manage"); $inlinetable = $tablename; } $this->assign("modelname", $modelname); $this->assign("inlinetable", $inlinetable); $this->assign("multitype", $_POST['multitype']); $rulespageinfo = json_decode(base64_decode($_POST['rulespageinfo']), true); $rulespageinfo['sourcetype'] = explode(',', $rulespageinfo); foreach ($rulespageinfo as $k => $v) { if (empty($v)) { unset($rulespageinfo[$k]); } } $this->assign("rulespageinfo", $rulespageinfo); $this->display(); }
/** * @Title: getNoticeDetail * @Description: todo(获得系统公告详细信息,返回的是json) * @param unknown_type $id 公告id * @author xiafengqin * @date 2014-4-3 下午3:45:52 * @throws */ public function getNoticeDetail() { //获取系统公告ID $id = $_REQUEST['id']; //判断当前用户是否已查看 未查看则添加记录 $mSAUmodel = M("mis_system_announcement_user"); $readStatus = $mSAUmodel->where("userid=" . $this->userid . " and announceid=" . $id)->getField("status"); $readData = array(); $readData['userid'] = $this->userid; $readData['announceid'] = $id; $readData['status'] = 1; if ($readStatus == NULL) { //新增 $mSAUmodel->data($readData)->add(); } else { if ($readStatus == 0) { //状态为未读时 $mSAUmodel->where("userid=" . $this->userid . " and announceid=" . $_REQUEST['id'])->setField('status', 1); } } $MisSystemAnnouncementModel = D('MisSystemAnnouncement'); $map = array(); $map['status'] = 1; $map['commit'] = 1; $map['id'] = $id; $returnData = $MisSystemAnnouncementModel->where($map)->field('id,title,createid,createtime,content')->find(); if ($returnData) { //声明相关附件表 $modelMAR = M('MisAttachedRecord'); //获取附件信息 $num = 0; $map = array(); $map["status"] = 1; $map["orderid"] = $returnData['id']; $map["type"] = 78; $attarry = $modelMAR->field("upname,attached")->where($map)->select(); if ($attarry) { $returnData['attach'] = array(); foreach ($attarry as $attkey => $attval) { $returnData['attach'][$num]['attachname'] = $attval['upname']; //注意这里的路径,必须是__APP__."/MisSystemAnnouncement/misFileManageDownload/:对应模型名称,不能是__URL__."/misFileManageDownload/;将取不到数据 $returnData['attach'][$num]['attachurl'] = __APP__ . "/MisSystemAnnouncement/misFileManageDownload/path/" . base64_encode($attval['attached']) . "/rename/" . $attval['upname']; $num++; } } else { //你存在数据是赋予空值 $returnData['attach'] = null; } } //将id转化成人名,将时间戳转换成日期格式,将部门取出 $returnData['username'] = getFieldBy($returnData['createid'], 'id', 'name', 'user'); $deptid = getFieldBy($returnData['createid'], 'id', 'dept_id', 'user'); $returnData['deptname'] = getFieldBy($deptid, 'id', 'name', 'mis_system_department'); $returnData['createtime'] = transTime($returnData['createtime']); $returnData['content'] = strip_tags($returnData['content']); unset($returnData['createid']); if ($returnData) { //echo '[{"error":"没有找到数据"}]'; echo json_encode($returnData); } else { echo '{"error":"没有找到数据"}'; } }
/** * * @Title: upDanju * @Description: todo(上传单据时修改上传单据状态 并加入推送 让货主确认) * @param unknown $tableid * @return unknown * @author 刘智宏 * @date 2016年3月23日 下午3:38:39 * @throws */ function upDanju($tableid, $orderno, $huozhu) { //加入自动确认 $MisAutoGhk = D("MisAutoGhk"); $map = array(); $map["moxing"] = "MisAutoCpl"; //主城配送模型 $peizhi = $MisAutoGhk->where($map)->field("peizhitianshu")->find(); //获取配置 $tianshu = $peizhi["peizhitianshu"]; //获取配置天数 $huodanid = getFieldBy($tableid, "id", "peisongdanhao", "MisAutoHbz"); //获取货单id $MisAutoQgl = D("MisAutoQgl"); $data = array(); $data["suoshumoxing"] = "mis_auto_evuyl"; $data["dengdaitianshu"] = time() + $tianshu * 86400; //自动完成时间 $data["shifuqueren"] = 0; $data["danhao"] = $huodanid; $data["wanchengziduan"] = "zuizhongqueren"; $data["wanchengziduanzhuang"] = "1"; $data["createtime"] = time(); //加入时间 $result = $this->CURD("MisAutoQgl", 'add', $data); //加入推送 $MobileApicloudBase = D("MobileApicloudBase"); $MobileApicloudBase->getTuisong("您的订单" . $orderno . "已送达并上传单据请确认", $huozhu, "1", "type=1&winname=frame2/hyxq_window&huodanid=" . $tableid); // 内容 货主ID 推送端1货主0司机 $map = array(); $map['id'] = $tableid; $data = array(); $data['danjushifushangchuan'] = 1; $result = $this->CURD('MisAutoHbz', 'save', $data, $map); return $result; }
/** * @Title: setZhuanShouCurAuditUser * @Description: todo(流程转授,替换当前审核人) * @param 当前审核人 $curAuditUser * @param 当前模型名称 $tablename * @return string * @author liminggang * @date 2015-7-24 下午5:19:37 * @throws */ private function setZhuanShouCurAuditUser($curAuditUser, $tablename) { $newarr['curAuditUser'] = $curAuditUser; $newarr['zhuanmiaoshu'] = ""; $curArr = array_unique(explode(",", $curAuditUser)); $bool = false; if ($curArr) { //实例化流程转授模型 $mis_auto_guikcDao = M("mis_auto_guikc"); $miaoshu = ""; foreach ($curArr as $key => $val) { $where = array(); $where['operateid'] = 1; $where['zhuanshouren'] = $val; $where['shengxiaoriqi'] = array('elt', time()); $where['shixiaoriqi'] = array('egt', time()); $where['zhuanshoufanwei'] = "全部"; $zlist = $mis_auto_guikcDao->where($where)->field("id,zhuanshoufanwei,zhuanshougei")->order("id desc")->find(); if ($zlist) { $bool = true; //存在转授人员标记 $curArr[$key] = $zlist['zhuanshougei']; $miaoshu = getFieldBy($val, "id", "name", "user") . "转授给" . getFieldBy($zlist['zhuanshougei'], "id", "name", "user"); } else { $where['zhuanshoufanwei'] = "部分"; $zvolist = $mis_auto_guikcDao->where($where)->field("id,zhuanshoufanwei,zhuanshougei")->select(); if ($zvolist) { $bool = true; //存在转授人员标记 //存在定向制定流程转授模块 $mis_auto_guikc_sub_datatable6Dao = M("mis_auto_guikc_sub_datatable6"); foreach ($zvolist as $k => $v) { $where = array(); $where['masid'] = $v['id']; $where['zhuanshoumoxing'] = $tablename; $count = $mis_auto_guikc_sub_datatable6Dao->where($where)->count(); if ($count) { $curArr[$key] = $v['zhuanshougei']; $miaoshu = getFieldBy($val, "id", "name", "user") . "转授给" . getFieldBy($v['zhuanshougei'], "id", "name", "user"); break; } } } } } $curArr = array_unique(array_filter($curArr)); $curAuditUser = implode(",", $curArr); $newarr['curAuditUser'] = $curAuditUser; $newarr['zhuanmiaoshu'] = $miaoshu; $newarr['zhuanshou'] = $bool; } return $newarr; }
/** * @Title: lookupGetFlowWork * @Description: todo(项目查看的方法。必须存放在此处,因为MODULE_NAME问题) * @author 黎明刚 * @date 2015年1月6日 下午4:31:06 * @throws */ public function lookupGetFlowWork() { //获取是列表还是单据 $datatype = $_REQUEST['datatype']; //获取任务ID $workid = $_REQUEST['workid']; //获取项目ID $projectid = $_REQUEST['projectid']; //项目任务数据 $mis_project_flow_formDao = M("mis_project_flow_form"); $where['id'] = $workid; $where['projectid'] = $projectid; //查询任务数据信息 $fieldVal = $mis_project_flow_formDao->where($where)->find(); switch ($fieldVal['formtype']) { case 1: //附件类型 $name = "MisProjectAttachedTemplate"; break; case 2: //清单类型 $name = $fieldVal['formobj']; break; default: break; } $where = array(); //查询数据 $where['projectid'] = $projectid; $where['projectworkid'] = $workid; $model = D($name); $vo = $model->where($where)->find(); if ($fieldVal['formtype'] == 1) { //附件类型 $type_list = array(); //获取上传格式限制 $allexts = C("allexts"); $type_list[] = array("value" => -1, "name" => "全部"); foreach ($allexts as $k => $v) { $type_list[] = array("value" => $k, "name" => $v); } $this->assign('allexts', $type_list); if ($vo) { //查询附件单头信息 $this->assign('mas_vo', $vo); //附件明细信息 //第一步,sub数据查询 $submodel = M("mis_project_attached_template_sub"); $where = array(); $where['masid'] = $vo['id']; $sublist = $submodel->where($where)->select(); //附件信息查询 foreach ($sublist as $key => $val) { //获取上传附件信息 $recolist = $this->getAttachedRecordList($vo['id'], true, true, "MisProjectAttachedTemplate", $val['id'], false); $sublist[$key]['record'] = $recolist; //获取参照附件信息 $czrecolist = $this->getAttachedRecordList($mas_vo['systemmasid'], true, true, "MisAttachedTemplate", $val['systemsubid'], false); $sublist[$key]['czrecord'] = $czrecolist; } $this->assign("sublist", $sublist); $content = $this->fetch("MisProjectAttachedTemplate:additemviewedit"); $this->assign("content", $content); } else { //查询附件单头信息 $model = D("MisAttachedTemplate"); $map["id"] = $fieldVal['formobj']; $mas_vo = $model->where($map)->find(); $this->assign('mas_vo', $mas_vo); //附件明细信息 //第一步,sub数据查询 $submodel = M("mis_system_attached_template_sub"); $where = array(); $where['masid'] = $fieldVal['formobj']; $sublist = $submodel->where($where)->select(); //附件信息查询 foreach ($sublist as $key => $val) { //获取附件信息 $recolist = $this->getAttachedRecordList($mas_vo['id'], true, true, "MisAttachedTemplate", $val['id'], false); $sublist[$key]['record'] = $recolist; } $this->assign("sublist", $sublist); $content = $this->fetch("MisAttachedTemplate:additemviewedit"); $this->assign("content", $content); } $this->display("MisAutoEbm:lookupGetFormobjHtmlContent"); } else { //单据 if ($datatype == 0) { $name = $fieldVal['formobj']; //根据模型名称,查询节点node表title $nodetitle = getFieldBy($name, "name", "title", "node"); $this->assign("nodetitle", $nodetitle); $workname = getFieldBy($workid, "id", "name", "mis_project_flow_form"); $this->assign("workname", $workname); $this->assign("name", $name); $_REQUEST['eid'] = 1; //主从表单用 if (!$vo) { $vo['id'] = 999999999; } $_REQUEST['eid'] = $vo['id']; //主从表单用 $_REQUEST['id'] = $vo['id']; //主从表单用 $newmodel = A($name); //在此方法中,有直接调用了_before_edit 和 _after_edit $newmodel->view(0); $content = $this->fetch($name . ":contenthtml"); $this->assign("content", $content); $this->display("MisAutoEbm:lookupGetFlowWork"); } else { //列表 $name = $fieldVal['formobj']; //列表行数据 $list = $model->where($where)->select(); //获取配置list.inc.php配置文件 $scdmodel = D('SystemConfigDetail'); //读取列名称数据(按照规则,应该在index方法里面) $detailList = $scdmodel->getDetail($name); $this->assign("detailList", $detailList); $this->assign("list", $list); $this->display("MisAutoEbm:lookupGetFlowWorkList"); } } }
public function _before_update() { //修改相应的rolegroup数据 $RolegroupDao = M("rolegroup"); //获取相应的数据 $deptid = $_POST['deptid']; $name = getFieldBy($deptid, 'id', 'name', 'mis_system_department') . $_POST['name']; $data['name'] = $name; $data['remark'] = $_POST['remark']; $data['companyid'] = $_POST['companyid']; $data['catgory'] = 3; $data['sort'] = $_POST['sort']; $data['status'] = $_POST['status']; $data['id'] = $_POST['rolegroup_id']; $rolegroupId = $RolegroupDao->save($data); $data = array(); if (!$rolegroupId) { $this->error("岗位信息修改失败,请联系管理员"); } }
/** * @Title: getBindVo * @Description: todo(获取组合表单绑定值) * @param unknown $rel * @return multitype:multitype:string NULL boolean multitype:string number boolean multitype:string boolean unknown multitype:string number boolean unknown * @author renling * @date 2014年12月9日 下午5:46:36 * @throws */ public function getBindVo($actionname, $id) { $orderno = getFieldBy($id, "id", "orderno", $actionname); $bindList = array(); if ($orderno) { $MisAutoBindModel = D("MisAutoBind"); // 查询符合条件的表单 $MisAutoBindVo = $MisAutoBindModel->where("status=1 and bindaname='{$actionname}' and bindresult<>'' and typeid=0")->field("bindresult")->find(); // 过滤掉可能的错误。 $bindCondition = getFieldBy($orderno, "orderno", $MisAutoBindVo['bindresult'], $actionname); if (isset($bindCondition)) { $bindMap['_string'] = "bindval={$bindCondition}"; } $bindMap['status'] = 1; $bindMap['bindaname'] = $actionname; $MisAutoBindSettableVo = $MisAutoBindModel->where($bindMap)->order("inbindsort asc")->find(); if ($MisAutoBindSettableVo) { $map = array(); $map['status'] = 1; $map['bindid'] = $orderno; $map['relationmodelname'] = $actionname; $model = D($MisAutoBindSettableVo['inbindaname']); $bindVo = $model->where($map)->find(); $bindList['modelname'] = $MisAutoBindSettableVo['inbindaname']; $bindList['tableid'] = $bindVo['id']; } } return $bindList; }
function _after_update($list) { //查询工作报告 创建人 $WorkPlanModel = D("MisWorkPlan"); $list = $WorkPlanModel->where("id=" . $_REQUEST['planid'])->find(); //邮件发送人 $sendidArr = array('1' => $list['createid']); //点评人 $commentusername = getFieldBy($_POST['userid'], "id", "name", "user"); //发送的系统日志的标题 $messageTitle = "工作计划:" . $list['title'] . '已经被【' . $commentusername . '】评论,请关注!'; //单据系统 $modelNameChineseUrl = '<a class="" style="text-decoration:underline" title="工作计划" target="navTab" rel="MisWorkPlan" href="__APP__/MisWorkPlan/index">工作计划</a>'; $noticeUrl = '<a class="edit" style="text-decoration:underline" title="工作计划_查看" target="navTab" rel="MisWorkplanedit" href="__APP__/MisWorkPlan/view/id/' . $_REQUEST['planid'] . '">' . $list['title'] . '</a>'; //message信息拼装 $messageContent = ""; $messageContent .= ' <p></p> <span></span> <div style="width:98%;"> <p class="font_darkblue">您好!</p> <p> 工作计划:' . $list['title'] . '已评论 </p> <p> 评论内容:</p> <ul> <li> <strong>单据系统:</strong>' . $modelNameChineseUrl . ' </li> <li> <strong>工作计划:</strong>' . $noticeUrl . ' </ul> <p> 如果您有任何问题,请联系评论人:' . $commentusername . '。</p> </div>'; $this->pushMessage($sendidArr, $messageTitle, $messageContent); }
/** * @Title: _before_update * @Description: todo(修改前置函数) * @author renling * @date 2013-12-7 下午5:34:11 * @throws */ public function _before_update() { //查询此离职申请人是否已提交过相同单据 $MisHrLeaveEmployeeModel = D('MisHrLeaveEmployee'); $MisHrLeaveEmployeeResult = $MisHrLeaveEmployeeModel->where("status=1 and employeeid=" . $_POST['employeeid'])->count(); if ($MisHrLeaveEmployeeResult > 1) { $this->error("请不要重复提交离职申请单!"); } if ($_POST['oldleavetype']) { if ($_POST['oldleavetype'] == 3 || $_POST['oldleavetype'] == 4) { if ($_POST['leavetype'] == 1) { $_POST['oldleavetype'] == 3; } else { $_POST['oldleavetype'] == 4; } } } //人事模型 $MisHrBasicEmployeeModel = D('MisHrBasicEmployee'); $MisHrBasicEmployeeVo = $MisHrBasicEmployeeModel->where("status=1 and id=" . $_POST['employeeid'])->find(); //查询职级ID level id $_POST['dutylevelid'] = $MisHrBasicEmployeeVo['dutylevelid']; $_POST['level'] = getFieldBy($_POST['dutylevelid'], 'id', 'level', 'duty'); }
public function lookupsavesend() { $id = $_POST['id']; $model = D("mis_system_data_remind_sub"); $data['isread'] = 1; $data['readtime'] = time(); // $result=$model->where("id=".$id)->save($data); //添加邮件已读状态 $map['masid'] = getFieldBy($id, 'id', 'masid', 'mis_system_data_remind_sub'); $map['userid'] = $_SESSION[C("USER_AUTH_KEY")]; $map['isread'] = array("neq", 1); $emodel = M("mis_system_data_eamilremind_sub"); $model = D("mis_system_data_remind_sub"); $result = $model->where($map)->save($data); $elist = $emodel->where($map)->select(); if ($elist) { $emodel->where($map)->save($data); } $model->commit(); if ($_POST['linkstatus']) { echo $result; } else { exit; } }
/** * @Title: lookupemployeeInfo * @Description: todo(AJAX 请求获得试用员工信息) * @author renling * @date 2013-7-31 下午4:23:25 * @throws */ public function lookupemployeeInfo() { $id = $_POST['id']; $MisHrBasicEmployeeModel = D('MisHrBasicEmployee'); $MisHrBasicEmployeeList = $MisHrBasicEmployeeModel->where(" status=1 and id=" . $id)->find(); //计算试用天数 $pedate = $MisHrBasicEmployeeList['transferdate'] - $MisHrBasicEmployeeList['indate']; $pedate = round($pedate / 3600 / 24); //计算已经试用天数 $date = time() - $MisHrBasicEmployeeList['indate']; $date = round($date / 3600 / 24); $this->assign("date", $date); //以下if判断为排除空null显示 if ($MisHrBasicEmployeeList['phone']) { $voInfo['phone'] = $MisHrBasicEmployeeList['phone']; } else { $voInfo['phone'] = ""; } if (getFieldBy($MisHrBasicEmployeeList['deptid'], 'id', 'name', 'mis_system_department')) { $voInfo['deptname'] = getFieldBy($MisHrBasicEmployeeList['deptid'], 'id', 'name', 'mis_system_department'); } else { $voInfo['deptname'] = ""; } if ($MisHrBasicEmployeeList['dutyname']) { $voInfo['dutyname'] = $MisHrBasicEmployeeList['dutyname']; } else { $voInfo['dutyname'] = ""; } if (getFieldBy($MisHrBasicEmployeeList['dutylevelid'], 'id', 'name', 'duty')) { $voInfo['dutylevelid'] = getFieldBy($MisHrBasicEmployeeList['dutylevelid'], 'id', 'name', 'duty'); } else { $voInfo['dutylevelid'] = ""; } if (transTime($MisHrBasicEmployeeList['indate'])) { $voInfo['indate'] = transTime($MisHrBasicEmployeeList['indate']); } else { $voInfo['indate'] = ""; } $voInfo['chinaid'] = $MisHrBasicEmployeeList['chinaid']; $voInfo['name'] = $MisHrBasicEmployeeList['name']; $voInfo['sex'] = $MisHrBasicEmployeeList['sex']; $voInfo['age'] = $MisHrBasicEmployeeList['age']; $voInfo['worktype'] = $MisHrBasicEmployeeList['worktype']; $voInfo['pedate'] = $pedate; $voInfo['date'] = $date; echo json_encode($voInfo); }
} /** * @Title: _extend_after_insert * @Description: todo(扩展后置insert函数) * @author 管理员 * @date 2015-03-06 21:44:06 * @throws */ function _extend_after_insert($id) { // 默认往关联表中插入空数据 // 获取传送的id及主体id $name = $this->getActionName(); $MisAutoBindModel = M("mis_auto_bind"); $bindMap['status'] = 1; $bindMap['bindaname'] = $name; $bindMap['bindtype'] = 0; $MisAutoBindList = $MisAutoBindModel->where($bindMap)->getField("id,inbindaname"); if ($MisAutoBindList) { $date = array(); //获取数据漫游date $MisSystemDataRoamingModel = D('MisSystemDataRoaming'); $bindid = getFieldBy($id, "id", "orderno", $name); $bindList = array(); foreach ($MisAutoBindList as $key => $val) { if (in_array($val, array_keys($bindList))) { } else { $bindList[$val] = 1; $model = D($val); $data = $MisSystemDataRoamingModel->dataRoamOrderno($name, $id, $val); foreach ($data as $k => $v) { $date[key($v)] = reset($v); } $date['bindid'] = $bindid; $result = $model->add($date); if (!$result) { $this->error("数据插入失败,请联系管理员!"); } } } } $this->success(L('_SUCCESS_'), '', array('bindid' => $id));
/** * $data[0] $controllType 组件类型 lookup , lookupsuper * $data[1] $vo 页面vo数据 * $data[2] $controllProperty 当前组件的属性ID或属性数组 * $data[3] $isedit 是否为修改操作页面 * $data[4] $isreturnvalue 是否为view操作页面 * $data[5] $ganshe 干涉页面 状态归0 * @see Widget::render() */ public function render($data) { /** 数据收集 */ unset($vo); $controllType = $data[0]; //组件类型 lookup , lookupsuper $vo = $data[1]; //页面vo数据 $controllProperty = $data[2]; //当前组件的属性ID或属性数组 $isedit = $data[3]; //是否为修改操作页面 $isreturnvalue = $data[4]; //是否为view操作页面 $ganshe = $data[5]; //干涉页面 状态归0 $ismuchchoice = $data[6]; //是否多选 1是0否 /** 数据处理 */ $dir = CONF_PATH; $controlls = (require $dir . 'controlls.php'); require $dir . 'property.php'; $privateProperty = array(); foreach ($controlls as $key => $val) { if ($val['property']) { $privateProperty[$key] = array_merge($NBM_COMMON_PROPERTY, $val['property']); } else { $privateProperty[$key] = $NBM_COMMON_PROPERTY; } } $property = $privateProperty['lookup']; switch ($controllType) { case 1: $controllType = 'lookup'; break; case 2: $controllType = 'lookupsuper'; default: $controllType = 'lookup'; break; } if (!is_array($controllProperty)) { $obj = M('mis_dynamic_form_propery'); $controllProperty = $obj->where('id=' . $controllProperty)->find(); if ($ganshe == '1') { $controllProperty[$property['islock']['dbfield']] = 1; $controllProperty[$property['requiredfield']['dbfield']] = 1; $controllProperty[$property['isshow']['dbfield']] = 0; } } if (!is_array($controllProperty)) { return '<error>Lookup组件配置错误/没有属性<error>'; } /** 开始lookup属性解析 */ if (!$isreturnvalue) { $chtml = ''; if ($controllProperty[$property['checkfunc']['dbfield']]) { $chtml = $controllProperty[$property['checkfunc']['dbfield']]; } $required = ''; // 必填验证 if ($controllProperty[$property['requiredfield']['dbfield']] && $ganshe != '1') { $required = 'required'; } $chtml = $required . 'nbm ' . $chtml; //获取lookup key值 动态加载lookup配置 $lookupchoice = $controllProperty[$property['lookupchoice']['dbfield']]; $lookupObj = D('LookupObj'); $lookupDetail = $lookupObj->GetLookupDetail($lookupchoice); //var_dump($lookupDetail['condition']); $defaultLookupCondition = $lookupDetail['condition']; // lookup配置时生成的过滤条件。 $model = $lookupDetail['mode']; $urls = $lookupDetail['url']; $lookupgroup = $controllProperty[$property['lookupgroup']['dbfield']]; //视图特殊处理 if ($lookupDetail["viewname"]) { $viewname = $lookupDetail["viewname"]; //视图名称 $viewsavefield = $lookupDetail["val"]; //视图显示字段 $viewshowfield = $lookupDetail["filed"]; //视图存储字段 $dataViewModel = M("mis_system_dataview_mas"); $viewsql = "SELECT s.field FROM mis_system_dataview_mas AS m LEFT JOIN mis_system_dataview_sub AS s ON m.id=s.masid WHERE m.status=1 and s.status=1 and m.`name`='{$viewname}' AND s.otherfield="; //存储字段 $savefieldviewsql = $viewsql . "'{$viewsavefield}' limit 1"; $savefieldviewfieldarr = $dataViewModel->query($savefieldviewsql); $savefieldviewfieldexplode = explode(".", $savefieldviewfieldarr[0]['field']); $savefieldviewtable = $savefieldviewfieldexplode[0]; //存储字段所在的真实表名 $orgval = $savefieldviewfieldexplode[1]; //存储字段真实字段名 //显示字段 $showfieldviewsql = $viewsql . "'{$viewshowfield}' limit 1"; $showfieldviewfieldarr = $dataViewModel->query($showfieldviewsql); $showfieldviewfieldexplode = explode(".", $showfieldviewfieldarr[0]['field']); $showfieldviewtable = $showfieldviewfieldexplode[0]; //显示字段所在的真实表名 $orgchar = $showfieldviewfieldexplode[1]; //显示字段真实字段名 } else { $orgval = $lookupDetail['val'] ? $lookupDetail['val'] : 'id'; $orgchar = $lookupDetail['filed'] ? $lookupDetail['filed'] : 'name'; } $orgLookuoVal = $controllProperty[$property['org']['dbfield']]; // 值 value $orgLookupText = $controllProperty[$property['org1']['dbfield']]; // 显示内容 text $readonly = $controllProperty[$property['islock']['dbfield']] == 1 ? false : true; $view = ''; if ($lookupDetail['viewname']) { $view = '&viewname=' . $lookupDetail['viewname']; } if ($lookupDetail['dt']) { $dtcon = '&lookuptodatatable=2'; } $muchchoice = ''; if ($ismuchchoice == 1) { $muchchoice = '&ismuchchoice=' . $ismuchchoice; } // lookup的值反写 $textCounterCheck = ''; // 显示文本的反写 text $valCounterCheck = ''; // 值的反写 value // lporder 从外部lookup中取值字段 // lpkey 当前lookup的key // lpfor 往哪个东西里写值 // lpself 当前项的字段名称 if ($orgLookuoVal) { unset($temp); $temp = explode('.', $orgLookuoVal); $valCounterCheck = "callback=\"lookup_counter_check\" lpkey=\"{$lookupchoice}\" lpfor=\"{$lookupgroup}.{$orgchar}\" lpself=\"{$orgval}\" lporder=\"{$temp[1]}\""; } if ($orgLookupText) { unset($temp); $temp = explode('.', $orgLookupText); $textCounterCheck = "callback=\"lookup_counter_check\" lpkey=\"{$lookupchoice}\" lpfor=\"{$lookupgroup}.{$orgval}\" lpself=\"{$orgchar}\" lporder=\"{$temp[1]}\""; } // lookup附加条件处理 $appendCondtionArr = array(); $appendCondtion = $controllProperty[$property['additionalconditions']['name']]; // 附加条件设置信息 if ($appendCondtion) { $appendCondtion = unserialize(base64_decode($appendCondtion)); // proexp 表单字段列表 // sysexp 系统字段列表 $formFiledList = $appendCondtion['proexp']; $sysFieldList = $appendCondtion['sysexp']; // $formFiledFmt=array(); // $sysFieldFmt = array(); $sysFieldFmt = unserialize($sysFieldList) or array(); // 获取真实的表单字段名。 if ($formFiledList) { $formFiledListArr = unserialize($formFiledList) or array(); if (is_array($formFiledListArr) && count($formFiledListArr)) { $formFiledKey = array_keys($formFiledListArr); $properModel = M('mis_dynamic_form_propery'); $properMap['id'] = array('in', $formFiledKey); $fd = $properModel->where($properMap)->field('fieldname,id')->select(); if ($fd) { foreach ($fd as $k => $v) { // $fieldArr[] = $v['fieldname']; if ($formFiledListArr[$v['id']] == -1) { $formFiledFmt[$v['fieldname']] = $v['fieldname']; } else { $formFiledFmt[$v['fieldname']] = $formFiledListArr[$v['id']]; //$formFiledFmt[$formFiledListArr[$v['id']]] = $v['fieldname']; } } } } } if (is_array($sysFieldFmt) && is_array($formFiledFmt)) { $appendCondtionArr = array_merge($sysFieldFmt, $formFiledFmt); } elseif (is_array($sysFieldFmt) && !is_array($formFiledFmt)) { $appendCondtionArr = $sysFieldFmt; } elseif (!is_array($sysFieldFmt) && is_array($formFiledFmt)) { $appendCondtionArr = $formFiledFmt; } else { $appendCondtionArr = array(); } $conditions = getAppendCondition($vo, $formFiledFmt); $systemconditionsTemp = getAppendCondition($vo, $sysFieldFmt); // if($defaultLookupCondition){ // $systemconditions = $defaultLookupCondition; // if($systemconditionsTemp){ // $systemconditions .= ' and '.$systemconditionsTemp; // } // }else{ // $systemconditions = $systemconditionsTemp; // } $systemconditions = $systemconditionsTemp; } $val = ''; $tempModel = D($model); $temptable = ''; //视图时取字段对应的真实字段所在真实表名 if ($lookupDetail["viewname"]) { $temptable = $savefieldviewtable; } else { $temptable = $tempModel->getTableName(); } $map = ''; $value = $vo[$controllProperty[$property['fields']['dbfield']]]; if ($value) { if (strpos($value, ',')) { $valueStr = explode(',', $value); $map = $orgval . " in ('" . join("','", $valueStr) . "')"; } else { $map = $orgval . "='" . $value . "'"; } } //$viewval = $isedit ?(getFieldBy($value , $orgval , $orgchar , $tempModel->getTableName())):''; // if(!$map){ // $viewval=''; // }else{ // $viewval = $isedit ?(getFieldData($orgchar , $temptable , $map , true , 1000)):''; // } //多做了个分支,主要是应付视图里储存字段不唯一的情况 /** *当储存字段(以orderno=06为例)查询结果有n条记录,显示字段(以type为例)可以和储存字段保证一致性(当orderno=06时,查出的type全部都是“请假”) */ if (!$map) { $viewval = ''; } else { if (strpos($value, ',')) { $viewval = $isedit ? getFieldData($orgchar, $temptable, $map, true, 1000) : ''; } else { $viewval = $isedit ? getFieldBy($value, $orgval, $orgchar, $temptable) : ''; // } } $html = "<div class=\"tml-input-lookup\">"; $paramsEcho = arr2string($map); $controllPropertyEcho = '字段名:' . $controllProperty[$property['fields']['dbfield']] . '__表名:' . $tempModel->getTableName(); // $html.=<<<EOF // <script> // console.log("lookup查询条件:{$controllPropertyEcho}--{$orgchar}--查询条件:{$paramsEcho} 修改状态:{$isedit}"); // </script> // EOF; $readonlyCls = 'active_lookup'; if ($readonly) { $readonlyCls = ''; } $html .= "<input type=\"text\" {$textCounterCheck} class=\"{$lookupgroup}.{$orgchar} {$chtml} input_new half_angle_input {$orgLookupText} {$readonlyCls} \" autocomplete=\"off\" readonly=\"readonly\" value=\"" . $viewval . "\" />"; $html .= "<input type=\"hidden\" {$valCounterCheck} class=\"{$required} {$lookupgroup}.{$orgval} {$orgLookuoVal}\" name=\"" . $controllProperty[$property['fields']['dbfield']] . "\" value=\"" . $vo[$controllProperty[$property['fields']['dbfield']]] . "\" />"; if ($readonly) { // 只读情况 // lookup 触发按钮 $html .= "<a class=\"icon_elm mid_icon_elm icon-plus\"></a>"; // $title // 清空 lookup 按钮 $html .= "<a title=\"清空信息-只读\" class=\"icon_elm icon-trash\" href=\"javascript:void(0);\"></a>"; } else { $formFiledFmt = array_flip($formFiledFmt); $conditionOprateString = "condition=\"\""; if (is_array($formFiledFmt)) { $conditionOprateString = "condition=" . json_encode($formFiledFmt); } // lookup 触发按钮 $html .= "<a class=\"icon_elm mid_icon_elm icon-plus\" syscondition=\"{$systemconditions}\" newconditions=\"{$conditions}\" ismuchchoice=\"{$ismuchchoice}\" {$conditionOprateString} param=\"lookupchoice={$lookupchoice}{$muchchoice}&newconditions={$view}{$dtcon}\" href=\"__URL__/{$urls}\" lookupGroup=\"{$lookupgroup}\" ></a>"; //$title // 清空 lookup 按钮 $html .= "<a title=\"清空信息-可读写\" class=\"icon_elm icon-trash\" href=\"javascript:void(0);\" onclick=\"clearOrg('{$lookupgroup}');\"></a>"; } $html .= "</div>"; } else { $func = ""; $parmFunc = array(); // 处理子表及主表的lookup值转换 , modify by nbmxkj at 20150127 20 // *****注意:func 与 funcdata 数组项一定要个数对应。**** $scdmodel = D('SystemConfigDetail'); $detailList = $scdmodel->getDetail(MODULE_NAME, '', '', '', 'status'); $dval = $detailList[$controllProperty[$property['fields']['dbfield']]]; if (is_array($dval)) { if (count($dval['func']) > 0) { $varchar = ""; foreach ($dval['func'] as $k3 => $v3) { //开始html字符 if (isset($dval['extention_html_start'][$k3])) { $varchar = $dval['extention_html_start'][$k3]; } //中间内容 $varchar .= getConfigFunction($vo[$dval['name']], $v3, $dval['funcdata'][$k3], $vo); if (isset($dval['extention_html_end'][$k3])) { $varchar .= $dval['extention_html_end'][$k3]; } //结束html字符 } $html = $varchar; } else { $viewval = $vo[$controllProperty[$property['fields']['dbfield']]]; $html = $viewval; } } } return $html; }
/** * * @Title: lookupdeleteremind * @Description: todo(ajax请求删除提醒条件) * @author renling * @date 2014-8-13 下午3:04:00 * @throws */ public function lookupdeleteremind() { $MisSystemRemindModel = D('MisSystemRemind'); $id = $_POST['id']; $uid = $_SESSION[C('USER_AUTH_KEY')]; $keyid = $_POST['keyv']; $type = $_POST['type']; $date = array(); $date['id'] = $_POST['id']; if ($type == "all") { //排除此用户常用 $date['deluserid'] = getFieldBy($id, "id", "deluserid", "mis_system_remind") . $uid . ","; } else { //去掉数组中的提醒 $RemindVo = $MisSystemRemindModel->where("id=" . $id)->find(); $addlist = unserialize($RemindVo['reminddetail']); $mapoldList = unserialize($RemindVo['map']); unset($addlist['list'][$keyid]); unset($mapoldList[$keyid]); $date['createid'] = $uid; $date['createtime'] = time(); $date['map'] = serialize($mapoldList); $date['reminddetail'] = serialize($addlist); if (!$addlist['list']) { $date['status'] = -1; } } $result = $MisSystemRemindModel->save($date); $MisSystemRemindModel->commit(); echo $result; }