public function update() { $data = array(); $data['qlink'] = getSelectByName('linkprefix', $_POST['qlink']); $data['userid'] = $_SESSION[C('USER_AUTH_KEY')]; $data['name'] = $_POST['name']; $data['logo'] = $_POST['logo']; $data['link'] = $_POST['link']; $data['height'] = $_POST['height']; $data['id'] = $_POST['id']; $MisSystemFunctionalBoxModel = D('MisSystemFunctionalBox'); $MisSystemFunctionalBoxResult = $MisSystemFunctionalBoxModel->save($data); $MisSystemFunctionalBoxModel->commit(); if ($MisSystemFunctionalBoxResult !== false) { //保存成功 $this->success(L('_SUCCESS_')); } else { $this->error(L('_ERROR_')); } exit; }
public function _after_list(&$voList) { foreach ($voList as $k => $v) { $name = getSelectByName("isinjob", $v['isinjob']); if ($v['isinjob'] == 0) { $voList[$k]['isinjob'] = "<span style='color:red;'>" . $name . "</span>"; } else { if ($v['isinjob'] == 1) { $voList[$k]['isinjob'] = $name; } } } }
/** * @Title: getRuleInfo * @Description: 根据当前规则条件和表单数据进行对比,返回boolean * @param 规则数组 $rulesinfo 规则数组 * @param 单据数据 $data 表单数据或者项目数据 * @return boolean 验证当前规则是否满足,满足返回ture,不满足返回false * @author 黎明刚 * @date 2014年10月28日 上午10:57:40 * @throws */ public function getRuleInfo($rulesinfo, $data) { // 定义一个标志。表示是否有满足条件批次 $bool = true; // 循环批次信息 foreach ($rulesinfo as $rkey => $rval) { $field = $rval[0]['name']; // 判断控件属于什么类型 switch ($rval[0]['control']) { case 'text': $symbol = $rval[0]['symbol']; // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $rval[0]['symbol']); // 获取目标值 $goalVal = $rval[0]['val']; // 获取对比值 $fieldVal = $data[$field]; // 将对比值,目标值,和运算符组合成PHP可执行的判断语句 if ($symbol == 3) { // 包含(in) // 在字符串中查找,是否包含对比值 if (!stripos($goalVal, $fieldVal)) { $bool = false; continue; } } elseif ($symbol == 4) { // "not in" if (stripos($goalVal, $fieldVal)) { $bool = false; continue; } } else { $goalVal = $goalVal ? $goalVal : 0; $fieldVal = $fieldVal ? $fieldVal : 0; // 字符串链接 $str = $goalVal . $operator . $fieldVal; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } break; case 'select': $symbol = $rval[0]['symbol']; // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $rval[0]['symbol']); // 获取目标值 $goalVal = $rval[0]['val']; // 获取对比值 $fieldVal = $data[$field]; // 将对比值,目标值,和运算符组合成PHP可执行的判断语句 if ($symbol == 3) { // "in" // 在字符串中查找,是否包含对比值 if (!in_array($fieldVal, $goalVal)) { $bool = false; continue; } } elseif ($symbol == 4) { // "not in" if (in_array($fieldVal, $goalVal)) { $bool = false; continue; } } else { $goalVal = $goalVal ? $goalVal : 0; $fieldVal = $fieldVal ? $fieldVal : 0; // 字符串链接 $str = $goalVal . $operator . $fieldVal; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } break; case 'number': // 获取对比值 $fieldVal = $data[$field] ? $data[$field] : 0; // 获取区间值 区间开始值 $goalVals = $rval[0]['vals']; $symbols = $rval[0]['symbols']; // 区间结束值 $goalVale = $rval[0]['vale']; $symbole = $rval[0]['symbole']; if ($goalVals) { // 表示有值 if ($symbols == 1) { // = if ($fieldVal !== $goalVals) { $bool = false; continue; } } else { // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $symbols); // 字符串链接 $str = $fieldVal . $operator . $goalVals; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } } if ($goalVale) { // 表示有值 if ($symbole == 1) { // = if ($fieldVal !== $goalVals) { $bool = false; continue; } } else { // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $symbole); // 字符串链接 $str = $fieldVal . $operator . $goalVale; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); //$str = str_replace ( "'", "'", html_entity_decode ( $str ) ); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } } break; case 'time': // 获取对比值 $fieldVal = $data[$field] ? $data[$field] : 0; // 获取区间值 $begintime = strtotime($rval[0]['vals']); $symbols = $rval[0]['symbols']; $endtime = strtotime($rval[0]['vale']); $symbole = $rval[0]['symbole']; if ($begintime) { // 表示有值 if ($symbols == 1) { // = if ($fieldVal !== $begintime) { $bool = false; continue; } } else { // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $symbols); // 字符串链接 $str = $fieldVal . $operator . $begintime; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } } if ($endtime) { // 表示有值 if ($symbole == 1) { // = if ($fieldVal !== $endtime) { $bool = false; continue; } } else { // 获取运算符 $operator = getSelectByName($rval[0]['widget'], $symbole); // 字符串链接 $str = $fieldVal . $operator . $endtime; $str = str_replace(array('"', ''', '<', '>'), array('"', "'", '<', '>'), $str); $boolean = eval(" return {$str};"); if (!$boolean) { // '!=','<','<=','>','>=', $bool = false; continue; } } } break; default: break; } } return $bool; }
/** * * @Title: financeBusinessInvoice * @Description: todo(财务报表 应收实收) * @author renling * @date 2014-3-31 上午11:36:10 * @throws */ public function financeBusinessInvoice() { $time = transTime(time(), 'Y-m'); $time = str_replace('-', '年', $time); $time = $time . "月"; $this->assign("title", $time . "应收实收账款对比"); //发票表 $MisFinanceBusinessInvoiceModel = D('MisFinanceBusinessInvoice'); // $time="2014年01月"; $time = $time . '-1'; //月开始时间 例如 2013-10-1 0:00:00 $time = str_replace('年', '-', $time); $time = str_replace('月', '', $time); $time = str_replace(' ', '', $time); $begindate = strtotime($time); $endtime = strtotime('next month', $begindate) - 1; //月结束时间 例如 2013-10-31 23:59:59 //查询部门应收实收账款 $MisFinanceBusinessInvoiceList = $MisFinanceBusinessInvoiceModel->query("SELECT SUM(amount) AS 'amount',SUM(financeamount) AS 'financeamount' ,depttype FROM mis_finance_business_invoice WHERE financestatus=1 and createtime>=" . $begindate . " and createtime<=" . $endtime . " GROUP BY (depttype)"); //查询数据不存在 默认为0 if (!$MisFinanceBusinessInvoiceList) { $MisFinanceBusinessInvoiceList[0]['amount'] = 0; $MisFinanceBusinessInvoiceList[0]['financeamount'] = 0; $MisFinanceBusinessInvoiceList[0]['depttype'] = 1; $MisFinanceBusinessInvoiceList[1]['amount'] = 0; $MisFinanceBusinessInvoiceList[1]['financeamount'] = 0; $MisFinanceBusinessInvoiceList[1]['depttype'] = 2; $MisFinanceBusinessInvoiceList[2]['amount'] = 0; $MisFinanceBusinessInvoiceList[2]['financeamount'] = 0; $MisFinanceBusinessInvoiceList[2]['depttype'] = 3; } $FinanceArray[0] = array("name" => "amount", "title" => "应收款"); $FinanceArray[1] = array("name" => "financeamount", "title" => "实收款"); $xAxis = array("categories" => array()); $series = array(); // 系列创建完成 开始创建数据 foreach ($FinanceArray as $fkey => $fval) { $seriesdata = array(); foreach ($MisFinanceBusinessInvoiceList as $key => $val) { if (!in_array($val['depttype'], array_keys($depttype))) { $depttype[$val['depttype']] = 1; $xAxis["categories"][] = getSelectByName('customertype', $val['depttype']); } $seriesdata[] = floatval(str_replace(",", "", getDigits($val[$fval['name']]))); } $series[] = array('name' => $fval['title'], 'data' => $seriesdata); } $this->assign("headerFormat", "<span>{point.key}</span><table>"); $this->assign("pointFormat", "<tr><td >{series.name}: </td><td ><b>{point.y}元</b></td></tr>"); $this->assign("text", "金额(元)"); $this->assign("distype", "column"); $this->assign("xAxis", json_encode($xAxis)); $this->assign("series", json_encode($series)); }
/** * * @Title: lookupAssemble * @Description: todo(组装条件 返回list) * @return multitype:string Ambigous <multitype:, multitype:unknown , multitype:unknown NULL > * @author renling * @date 2014-9-17 下午6:33:52 * @throws */ private function lookupAssemble() { /* 黎明刚 加,为了满足流程管理,在一个页面同时出现多个条件选择器*/ $order = $_POST['order']; $roleexp = $_POST['tiprole'] ? $_POST['tiprole'] : $_POST['roleexp']; $roleexptype = $_POST['roleexptype']; $roleexptitle = $_POST['roleexptitle']; $modelname = $_POST['modelname']; if (substr($modelname, -4) == 'View') { $modelname = getFieldBy($modelname, 'name', 'modelname', 'mis_system_dataview_mas'); } //获取配置文件 $scdmodel = D('SystemConfigDetail'); //读取列名称数据(按照规则,应该在index方法里面) $detailList = $scdmodel->getDetail($modelname, '', '', '', 'rules'); //查询该模型是否有视图 $MisSystemDataviewMasView = D('MisSystemDataviewMasView'); $MisSystemDataviewMasMap = array(); $MisSystemDataviewMasMap['modelname'] = $modelname; $MisSystemDataviewMasMap['mstatus'] = 1; $MisSystemDataviewMasList = $MisSystemDataviewMasView->where($MisSystemDataviewMasMap)->getField("field,tablename"); $listarr = array(); $typearr = array(); $orspan = "<span style='color:red'> 或者 </span>"; $andspan = "<span style='color:blue'> 并且 </span>"; if ($order == "processcondition_batch") { /* 黎明刚 加,为了满足流程管理,在一个页面同时出现多个条件选择器*/ $orspan = "或者"; $andspan = "并且"; } if ($_POST['avgsql']) { //高级sql模式 $showmap = $_POST['avgsql']; } foreach ($roleexp as $key => $val) { //查询当前条件是否是视图字段 if ($MisSystemDataviewMasList[$val]) { //组装视图条件 $mapval = $MisSystemDataviewMasList[$val] . "." . $val; } else { if ($detailList[$val]['searchField']) { $mapval = $detailList[$val]['searchField']; } else { $mapval = $val; } } $leftipt = ""; $rightipt = ""; $centertip = ""; $centertip = $_POST['centertip'][$val]; $leftipt = $_POST['leftipt'][$key]; $rightipt = $_POST['rightipt'][$key]; if ($roleexptype[$val] == 'text') { $showval = $_POST[$val . 'text']; if ($val == "auditState") { $showval = getSelectByName('auditStateVal', $_POST[$val . 'text']); } if ($val == "operateid") { $showval = getSelectByName('operateidVal', $_POST[$val . 'text']); } $showmap .= "(" . $roleexptitle[$val] . ' ' . getSelectByName('roletextinexp', $_POST[$val . 'f']) . " '" . $showval . "') "; $map .= $leftipt . " " . $mapval . getSelectByName('roletextinset', $_POST[$val . 'f']) . "'" . $_POST[$val . 'text'] . "' " . $rightipt . " "; $typearr[$val][] = array('name' => $val, 'title' => $_POST['roleexptitle'][$val], 'symbol' => $_POST[$val . 'f'], 'val' => $_POST[$val . 'text'], 'control' => 'text', 'widget' => 'roletextinset', 'leftipt' => $leftipt, 'rightipt' => $rightipt, 'sort' => $key, 'centertip' => $centertip); } else { if ($roleexptype[$val] == 'select') { $showmap .= "(" . $roleexptitle[$val] . ' ' . getSelectByName('roletextinexp', $_POST[$val . 'f']) . " '" . implode(',', $_POST[$val . 'stitle']) . "')"; $tempData = $_POST[$val . 's']; if ($tempData) { $ret = "'"; if (is_array($tempData)) { $ret .= join("','", $tempData); } $ret .= "'"; } $map .= $leftipt . ' ' . $mapval . ' ' . getSelectByName('roletextinset', $_POST[$val . 'f']) . "(" . $ret . ")" . $rightipt . " "; $typearr[$val][] = array('name' => $val, 'symbol' => $_POST[$val . 'f'], 'title' => $_POST['roleexptitle'][$val], 'showval' => implode(',', $_POST[$val . 'stitle']), 'val' => $_POST[$val . 's'], 'control' => 'select', 'widget' => 'roletextinset', 'sort' => $key, 'leftipt' => $leftipt, 'rightipt' => $rightipt, 'centertip' => $centertip); } else { if ($roleexptype[$val] == 'number') { //带入单位存值 $showunit = getFieldBy($_POST[$val . "unitshow"], "danweidaima", "danweimingchen", "mis_system_unit"); //map转换单位 $mapunitsval = $_POST[$val . 'snum']; $mapuniteval = $_POST[$val . 'enum']; if ($showunit) { //转换为存储单位 $mapunitsval = unitExchange($_POST[$val . 'snum'], $_POST[$val . 'unitchange'], $_POST[$val . 'unitshow']); $mapuniteval = unitExchange($_POST[$val . 'enum'], $_POST[$val . 'unitchange'], $_POST[$val . 'unitshow']); } if ($_POST[$val . 'enum']) { $showmap .= "(" . $roleexptitle[$val] . ' ' . getSelectByName('roleinexp', $_POST[$val . 'sf']) . " '" . $_POST[$val . 'snum'] . $showunit . "' {$andspan} " . $roleexptitle[$val] . ' ' . getSelectByName('roleinexp', $_POST[$val . 'ef']) . " '" . $_POST[$val . 'enum'] . $showunit . "')"; $map .= $leftipt . " " . "(" . $mapval . ' ' . getSelectByName('roleexp', $_POST[$val . 'sf']) . $mapunitsval . " and " . $mapval . ' ' . getSelectByName('roleexp', $_POST[$val . 'ef']) . $mapuniteval . ")" . $rightipt . " "; } else { $showmap .= "(" . $roleexptitle[$val] . ' ' . getSelectByName('roleinexp', $_POST[$val . 'sf']) . " '" . $_POST[$val . 'snum'] . $showunit . ")"; $map .= $leftipt . " " . "(" . $mapval . ' ' . getSelectByName('roleexp', $_POST[$val . 'sf']) . "'" . $mapunitsval . "')"; } $typearr[$val][] = array('name' => $val, 'symbols' => $_POST[$val . 'sf'], 'symbole' => $_POST[$val . 'ef'], 'title' => $_POST['roleexptitle'][$val], 'vals' => $mapunitsval, 'vale' => $mapuniteval, 'sort' => $key, 'control' => 'number', 'widget' => 'roleexp', 'leftipt' => $leftipt, 'rightipt' => $rightipt, 'centertip' => $centertip); } else { if ($roleexptype[$val] == 'time') { if (!$_POST[$val . 'etime']) { $_POST[$val . 'etime'] = "\$" . "time"; $showtime = "当前时间"; $showetime = "\$" . "time"; } else { $showtime = $_POST[$val . 'etime']; $showetime = $showtime; $_POST[$val . 'etime'] = strtotime($_POST[$val . 'etime']); } $showmap .= "(" . $roleexptitle[$val] . ' ' . getSelectByName('roleinexp', $_POST[$val . 'sf']) . " '" . $_POST[$val . 'stime'] . "' {$andspan} " . $roleexptitle[$val] . ' ' . getSelectByName('roleinexp', $_POST[$val . 'ef']) . " '" . $showtime . "') "; $map .= $leftipt . " " . "(" . $mapval . getSelectByName('roleexp', $_POST[$val . 'sf']) . strtotime($_POST[$val . 'stime']) . " and " . $mapval . getSelectByName('roleexp', $_POST[$val . 'ef']) . $_POST[$val . 'etime'] . ")" . $rightipt . " "; $typearr[$val][] = array('name' => $val, 'symbols' => $_POST[$val . 'sf'], 'symbole' => $_POST[$val . 'ef'], 'title' => $_POST['roleexptitle'][$val], 'vals' => $_POST[$val . 'stime'], 'sort' => $key, 'vale' => $showetime, 'control' => 'time', 'widget' => 'roleexp', 'leftipt' => $leftipt, 'rightipt' => $rightipt, 'centertip' => $centertip); } } } } if ($roleexp[$key + 1]) { if (!$leftipt && !$rightipt) { $map .= " and "; $showmap .= $andspan; } else { if ($_POST['leftipt'][$key + 1] == "and" || $_POST['rightipt'][$key + 1] == "and") { if (!$centertip[$val]) { $showmap .= $andspan; } } else { if (!$centertip[$val]) { $showmap .= $orspan; } } } } if ($centertip[$val]) { $map .= " " . $centertip . " "; $showmap .= $centertip == "or" ? $orspan : $andspan; } } if ($_POST['mapsql']) { $typearr['mapsql'][] = array('name' => 'sql', 'sql' => $_POST['mapsql']); $map .= $_POST['mapsql']; } if ($_POST['avgsql']) { //高级sql模式 if ($map) { $endsql = $_POST['avgsql'] . " and " . $map; } else { $endsql = $_POST['avgsql']; } $typearr['avgsql'][] = array('name' => 'avgsql', 'avgsql' => $_POST['avgsql']); $avgmap = $_POST['avgsql']; } if ($typearr) { $typearr = base64_encode(base64_encode(serialize($typearr))); } else { $typearr = ""; } if (!$map) { $map = ""; } $listarr = array('list' => $typearr, 'map' => $map, 'endsql' => $endsql, 'jsshowmap' => $showmap . " " . $_POST['mapsql'], 'showmap' => $showmap . $_POST['mapsql']); return $listarr; }
/** * @Title: role * @Description: todo(面板禁权) * @author 谢友志 * @date 2015-11-3 下午3:33:41 * @throws */ public function role() { //面板记录 $model = D($this->getActionName()); $map['id'] = $_REQUEST['id']; $rs = $model->where($map)->find(); $rs['paneltype'] = getSelectByName('panelDesignType', $rs['type']); $this->assign("rs", $rs); //授权对象 if (empty($_GET['jump'])) { $accessObjModel = D("MisSystemDataAccessCarrier"); $treeList = $model->userAndRolegroupToTree("MisSystemPanelDesingMasRoleBOX", __URL__ . "/role", $rs['id']); $this->assign("treeList", json_encode($treeList)); } else { $this->assign("objid", $_REQUEST['id']); $this->assign("objtype", $_REQUEST['type']); } //面板记录禁权情况 if ($_REQUEST['jump']) { $this->display("MisSystemPanelDesingMas:roleview"); } else { $this->display(); } }
/** +---------------------------------------------------------- * 数据漫游检查 +---------------------------------------------------------- * @access dataRoamCheck +---------------------------------------------------------- * @param string $do 1是点击触发 2是数据自动穿透(钩子) +---------------------------------------------------------- * @param string $type 执行范围 (‘update,insert,delete’) +---------------------------------------------------------- * @param string $do 当即执行标示 +---------------------------------------------------------- * @return false|integer +---------------------------------------------------------- */ private static function dataRoamTargetModelNotice($roamid, $tablename, $where) { //查询此数据漫游所有需要比较的字段 $MisSystemDataRoamCompareDao = M("mis_system_data_roam_compare"); $compareMap = array(); $compareMap['targettable'] = $tablename; $compareMap['roamtype'] = 1; $compareMap['masid'] = $roamid; $MisSystemDataRoamCompareList = $MisSystemDataRoamCompareDao->where($compareMap)->select(); //$MisSystemDataRoamMasAction=A("MisSystemDataRoamMas"); // echo $MisSystemDataRoamCompareDao->getLastSql(); // print_R($MisSystemDataRoamCompareList); //获取selectlist foreach ($MisSystemDataRoamCompareList as $key => $val) { //targettable 目标 $targettableModel = D($val['targettable']); $targetMap = array(); $targetMap['_string'] = $where; //查询字段 $targetList = M($tablename)->query('select * from ' . $tablename . ' ' . $where . ''); //$targetList=$targettableModel->where($targetMap)->find(); // print_R($targettableModel->getLastSql()); $roleexp = getSelectByName('roleexp', $val['roleinexp']); $compare = 0; if ($val['operatetype'] == 1) { //目标表额定字段 $compare = $targetList[$val['compare']]; } else { //定值 $compare = $val['compareval']; } $result = self::autoCaculate($targetList[$val['tfield']], html_entity_decode($roleexp), $compare); if ($result) { if ($val['msginfo']) { return $val['msginfo']; } else { //查询表字段信息 $fieldsAll = $this->changesourcefield($val['targettable'], '1'); return $fieldsAll[$val['tfield']]['showname'] . "(" . getDigits($targetList[$val['tfield']]) . ")【" . getSelectByName('roleinexp', $val['roleinexp']) . "】" . $fieldsAll[$val['compare']]['showname'] . "(" . getDigits($targetList[$val['compare']]) . ")" . "判断不成立,请查证后再提交!"; } } } }