public function increase($uids, $creditArr) { $uids = StringUtil::iIntval((array) $uids, true); $sql = array(); $allowKey = array("extcredits1", "extcredits2", "extcredits3", "extcredits4", "extcredits5", "oltime", "attachsize"); foreach ($creditArr as $key => $value) { if (($value = intval($value)) && $value && in_array($key, $allowKey)) { $sql[] = "`{$key}`=`{$key}`+'{$value}'"; } } if (!empty($sql)) { $sqlText = "UPDATE %s SET %s WHERE uid IN (%s)"; return Yii::app()->db->createCommand()->setText(sprintf($sqlText, $this->tableName(), implode(",", $sql), StringUtil::iImplode($uids)))->execute(); } }
public function fetchAllByRealnames($realnames) { $usersData = array(); if (!empty($realnames)) { $users = UserUtil::loadUser(); $criteria = array("select" => "*", "condition" => sprintf("realname IN (%s)", StringUtil::iImplode($realnames))); $list = $this->fetchAll($criteria); foreach ($list as $user) { if (isset($users[$user["uid"]])) { $usersData[$user["uid"]] = $users[$user["uid"]]; } else { $usersData[$user["uid"]] = UserUtil::wrapUserInfo($user); } } } return $usersData; }
public function actionIndex() { $op = EnvUtil::getRequest("op"); $id = intval(EnvUtil::getRequest("id")); if (EnvUtil::submitCheck("formhash")) { if ($op == "edit") { $dayNew = $_POST["weekdaynew"] != -1 ? -1 : $_POST["daynew"]; if (strpos($_POST["minutenew"], ",") !== false) { $minuteNew = explode(",", $_POST["minutenew"]); foreach ($minuteNew as $key => $val) { $minuteNew[$key] = $val = intval($val); if ($val < 0 || 59 < $val) { unset($minuteNew[$key]); } } $minuteNew = array_slice(array_unique($minuteNew), 0, 12); $minuteNew = implode("\t", $minuteNew); } else { $minuteNew = intval($_POST["minutenew"]); $minuteNew = 0 <= $minuteNew && $minuteNew < 60 ? $minuteNew : ""; } $cronfile = $this->getRealCronFile($_POST["type"], $_POST["filenamenew"], $_POST["module"]); if (preg_match("/[\\\\\\/\\:\\*\\?\"\\<\\>\\|]+/", $_POST["filenamenew"])) { $this->error(Ibos::lang("Crons filename illegal")); } elseif (!is_readable($cronfile)) { $this->error(Ibos::lang("Crons filename invalid", "", array("{cronfile}" => $cronfile))); } else { if ($_POST["weekdaynew"] == -1 && $dayNew == -1 && $_POST["hournew"] == -1 && $minuteNew === "") { $this->error(Ibos::lang("Crons time invalid")); } } $data = array("weekday" => $_POST["weekdaynew"], "day" => $dayNew, "hour" => $_POST["hournew"], "minute" => $minuteNew, "filename" => trim($_POST["filenamenew"])); $id && Cron::model()->modify($id, $data); Ibos::app()->cron->run($id); } elseif ($op == "delete") { if (!empty($_POST["delete"])) { $ids = StringUtil::iImplode($_POST["delete"]); Cron::model()->deleteAll(sprintf("cronid IN (%s) AND type='user'", $ids)); } } else { if (isset($_POST["namenew"]) && !empty($_POST["namenew"])) { foreach ($_POST["namenew"] as $id => $name) { $newCron = array("name" => StringUtil::filterCleanHtml($_POST["namenew"][$id]), "available" => isset($_POST["availablenew"][$id]) ? 1 : 0); if (isset($_POST["availablenew"][$id]) && empty($_POST["availablenew"][$id])) { $newCron["nextrun"] = "0"; } Cron::model()->modify($id, $newCron); } } if (!empty($_POST["newname"])) { $data = array("name" => StringUtil::ihtmlSpecialChars($_POST["newname"]), "type" => "user", "available" => "0", "weekday" => "-1", "day" => "-1", "hour" => "-1", "minute" => "", "nextrun" => TIMESTAMP); Cron::model()->add($data); } $list = Cron::model()->fetchAll(array("select" => "cronid,filename,type,module")); foreach ($list as $cron) { $cronFile = $this->getRealCronFile($cron["type"], $cron["filename"], $cron["module"]); if (!file_exists($cronFile)) { Cron::model()->modify($cron["cronid"], array("available" => 0, "nextrun" => 0)); } } CacheUtil::update("setting"); } $this->success(Ibos::lang("Crons succeed"), $this->createUrl("cron/index")); } else { if ($op && in_array($op, array("edit", "run"))) { $cron = Cron::model()->fetchByPk($id); if (!$cron) { $this->error("Cron not found"); } $cron["filename"] = str_replace(array("..", "/", "\\"), array("", "", ""), $cron["filename"]); if ($op == "edit") { $this->render("edit", array("cron" => $cron)); } elseif ($op == "run") { $file = $this->getRealCronFile($cron["type"], $cron["filename"], $cron["module"]); if (!file_exists($file)) { $this->error(Ibos::lang("Crons run invalid", "", array("{cronfile}" => $file))); } else { Ibos::app()->cron->run($cron["cronid"]); $this->success(Ibos::lang("Crons run succeed"), $this->createUrl("cron/index")); } } } else { $list = Cron::model()->fetchAll(array("order" => "type desc")); $this->handleCronList($list); $this->render("index", array("list" => $list)); } } }
public function actionConfirm() { $key = EnvUtil::getRequest("key"); if ($key) { $param = WfCommonUtil::param($key, "DECODE"); $runId = intval($param["runid"]); $processId = intval($param["processid"]); $flowId = intval($param["flowid"]); $flowProcess = intval($param["flowprocess"]); $manager = EnvUtil::getRequest("manager"); $this->checkRunPermission($runId); !$manager && $this->checkAgentInTodo($runId, $processId); $this->checkEntrustType($flowId); $this->checkRunDel($runId); $nextId = $this->getNextProcessID($flowId, $processId); if ($manager) { $rp = FlowRunProcess::model()->fetchOpUserByUniqueID($runId, $processId, $flowProcess); } else { $rp = FlowRunProcess::model()->fetchRunProcess($runId, $processId, $flowProcess, $this->uid); } $prcsUser = WfHandleUtil::getEntrustUser($flowId, $runId, $processId, $nextId); $data = array("runName" => FlowRun::model()->fetchNameByRunID($runId), "opflag" => $rp["opflag"], "processID" => $processId, "flowProcess" => $flowProcess, "oldUid" => $rp["uid"], "runID" => $runId, "key" => $key, "lang" => Ibos::getLangSources(), "prcsUser" => sprintf("[%s]", !empty($prcsUser) ? StringUtil::iImplode($prcsUser) : "")); $data = array_merge($data, $this->handleList($flowId, $runId, $processId)); $this->renderPartial("confirm", $data); } else { exit(Ibos::lang("Parameters error", "error")); } }
<?php foreach ($stamp->getSeries() as $series) { ?> <?php $count = explode(",", trim($series["count"], ",")); ?> { name:'<?php echo $series["name"]; ?> ', type:'bar', stack: '总量', itemStyle : dataStyle, data:[<?php echo StringUtil::iImplode($count); ?> ] }, { name:'<?php echo $series["name"]; ?> ', type:'bar', stack: '总量', itemStyle: placeHoledStyle, data:[ <?php foreach ($count as $number) { ?>
protected function makeUserSelect($runId, $index, $process, $name, $flowId, $processId) { $lang = Ibos::getLangSource("workflow.default"); $tablestr = ""; if ($index) { $display = "none;"; } else { $display = ""; } if ($process["childflow"] != 0) { $flow = FlowType::model()->fetchByPk($process["childflow"]); if ($flow) { $type = $flow["type"]; } if ($type == 2) { $process["prcs_id_next"] = ""; } $subfp = FlowProcess::model()->fetchProcess($process["childflow"], 1); if ($subfp) { $prcsuser = WfHandleUtil::getPrcsUser($process["childflow"], $processId); } else { $prcsuser = ""; } $prcsuser = sprintf("[%s]", !empty($prcsuser) ? StringUtil::iImplode($prcsuser) : ""); if (empty($subfp["uid"]) && empty($subfp["deptid"]) && empty($subfp["positionid"])) { $nopriv = $lang["Not set step permissions"]; } $tablestr = " <div style='display:{$display};' id='user_select_{$index}'>\r\n <div class=\"control-group first-group\">\r\n <label class=\"control-label\">{$lang["Host"]}</label>\r\n <div class=\"controls\">\r\n <strong>{$name} {$nopriv}</strong>\r\n <input type=\"hidden\" name=\"topflag{$index}\" value=\"0\">\r\n <input id=\"prcs_user_op{$index}\" name=\"prcs_user_op{$index}\" type=\"text\" />\r\n </div>\r\n </div>\r\n <div class=\"control-group\">\r\n <label class=\"control-label\">{$lang["Agent"]}</label>\r\n <div class=\"controls\">\r\n <input id=\"prcs_user{$index}\" name=\"prcs_user{$index}\" type=\"text\" />\r\n </div>\r\n </div>\r\n </div>\r\n <script>\r\n\t\t\t\t\$(function(){\r\n\t\t\t\t\tvar prcsData{$index} = {$prcsuser};\r\n\t\t\t\t\t\$('#prcs_user_op{$index}').userSelect({\r\n\t\t\t\t\t\tbox:\$('<div id=\"prcs_user_op_box{$index}\"></div>').appendTo(document.body),\r\n\t\t\t\t\t\tdata:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\t\ttype:'user',\r\n\t\t\t\t\t\tmaximumSelectionSize:'1'\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\$('#prcs_user{$index}').userSelect({\r\n\t\t\t\t\t\tbox:\$('<div id=\"prcs_user_box{$index}\"></div>').appendTo(document.body),\r\n\t\t\t\t\t\tdata:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\t\ttype:'user'\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t</script>"; } else { if (empty($process["uid"]) && empty($process["deptid"]) && empty($process["positionid"])) { $nopriv = $lang["Not set step permissions"]; } $prcsOpUser = $prcsUserAuto = ""; $deptArr = DepartmentUtil::loadDepartment(); if ($process["autotype"] == 1) { $uid = FlowRun::model()->fetchBeginUserByRunID($runId); $prcsuser = User::model()->fetchByUid($uid); if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $prcsuser["uid"]) || StringUtil::findIn($process["deptid"], $prcsuser["alldeptid"]) || StringUtil::findIn($process["positionid"], $prcsuser["allposid"])) { $prcsOpUser = $prcsuser["uid"]; $prcsUserAuto = $prcsuser["uid"] . ","; } } elseif (in_array($process["autotype"], array(2, 4, 5, 6))) { if ($process["autobaseuser"] != 0) { $baseUid = FlowRunProcess::model()->fetchBaseUid($runId, $process["autobaseuser"]); $baseuser = User::model()->fetchByUid($baseUid); $autodept = $baseuser["deptid"]; } else { $autodept = Ibos::app()->user->deptid; } if (0 < intval($autodept)) { if ($process["autotype"] == 2) { $tmpdept = $autodept; } else { if ($process["autotype"] == 4 || $process["autotype"] == 6) { $tmpdept = $deptArr[$autodept]["pid"] == 0 ? $autodept : $deptArr[$autodept]["pid"]; } elseif ($process["autotype"] == 5) { $deptStr = Department::model()->queryDept($autodept, true); $temp = explode(",", $deptStr); $count = count($temp); $dept = isset($temp[$count - 2]) ? $temp[$count - 2] : $autodept; if ($deptArr[$dept]["pid"] != 0) { $tmpdept = $deptArr[$dept]["deptid"]; } else { $tmpdept = $autodept; } } } $manager = $deptArr[$tmpdept]["manager"]; if ($process["autotype"] == 4 || $process["autotype"] == 6) { $leader = $deptArr[$autodept]["leader"]; $subleader = $deptArr[$autodept]["subleader"]; if ($leader != "0" && $process["autotype"] == 4) { $manager = $leader; } if ($subleader != "0" && $process["autotype"] == 6) { $manager = $subleader; } } if (!empty($manager)) { $muser = User::model()->fetchByUid($manager); if (!empty($muser)) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $muser["uid"]) || StringUtil::findIn($process["deptid"], $muser["alldeptid"]) || StringUtil::findIn($process["positionid"], $muser["allposid"])) { $prcsUserAuto = $muser["uid"] . ","; } if ($prcsUserAuto != "") { $prcsOpUser = strtok($prcsUserAuto, ","); } } } else { $userPerMax = ""; foreach (User::model()->fetchAllOtherManager($tmpdept) as $user) { $user = User::model()->fetchByUid($user["uid"]); $uid = $user["uid"]; $position = $user["allposid"]; if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $uid) || StringUtil::findIn($process["deptid"], $user["alldeptid"]) || StringUtil::findIn($process["positionid"], $position)) { if ($userPerMax == "") { $prcsOpUser = $uid; $prcsUserAuto .= $uid . ","; $userPerMax = $position; } elseif ($position == $userPerMax) { $prcsUserAuto .= $uid . ","; } } } } } } elseif ($process["autotype"] == 3) { $autouserop = User::model()->fetchByUid($process["autouserop"]); if (!empty($autouserop)) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $autouserop["uid"]) || StringUtil::findIn($process["deptid"], $autouserop["alldeptid"]) || StringUtil::findIn($process["positionid"], $autouserop["allposid"])) { $prcsOpUser = $autouserop["uid"]; } } if (!empty($process["autouser"])) { foreach (User::model()->fetchAllByUids(explode(",", trim($process["autouser"], ","))) as $user) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $user["uid"]) || StringUtil::findIn($process["deptid"], $user["alldeptid"]) || StringUtil::findIn($process["positionid"], $user["allposid"])) { $prcsUserAuto .= $user["uid"] . ","; } } } } elseif ($process["autotype"] == 7) { if (is_numeric($process["autouser"])) { $itemData = FlowDataN::model()->fetchItem($process["autouser"], $process["flowid"], $runId); $tmp = strtok($itemData, ","); $userarr = array(); while ($tmp) { $userarr[$tmp] = array(); $tmp = strtok(","); } $tempArray = explode(",", trim($itemData, ",")); foreach ($tempArray as $key => $value) { if (is_numeric($value)) { $value = User::model()->fetchRealnameByUid($value, ""); $tempArray[$key] = $value; } } foreach (User::model()->fetchAllByRealnames($tempArray) as $k => $v) { $dept = Department::model()->queryDept($v["alldeptid"]); if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $dept) || StringUtil::findIn($process["positionid"], $v["allposid"])) { $prcsUserAuto .= $v["uid"] . ","; } } if ($prcsUserAuto != "") { $prcsOpUser = strtok($prcsUserAuto, ","); } } } else { if ($process["autotype"] == 8 && is_numeric($process["autouser"])) { $uid = FlowRunProcess::model()->fetchBaseUid($runId, $process["autouser"]); if ($uid) { $temp = User::model()->fetchByUid($uid); if ($temp) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $temp["uid"]) || StringUtil::findIn($process["deptid"], $temp["alldeptid"]) || StringUtil::findIn($process["positionid"], $temp["allposid"])) { $prcsOpUser = $prcsUserAuto = $temp["uid"]; $prcsUserAuto .= ","; } } } } elseif ($process["autotype"] == 9) { $main = Ibos::app()->user->deptid; foreach (User::model()->fetchAllFitDeptUser($main) as $k => $v) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $v["alldeptid"]) || StringUtil::findIn($process["positionid"], $v["allposid"])) { $prcsUserAuto .= $v["uid"] . ","; } } if (!empty($prcsUserAuto)) { $prcsOpUser = strtok($prcsUserAuto, ","); } } elseif ($process["autotype"] == 10) { $main = Ibos::app()->user->deptid; $deptStr = Department::model()->queryDept($main, true); $temp = explode(",", $deptStr); $count = count($temp); $dept = isset($temp[$count - 2]) ? $temp[$count - 2] : $main; if ($deptArr[$dept]["pid"] != 0) { $tmpdept = $deptArr[$dept]["deptid"]; } else { $tmpdept = $main; } foreach (User::model()->fetchAllFitDeptUser($tmpdept) as $k => $v) { if ($process["deptid"] == "alldept" || StringUtil::findIn($process["uid"], $v["uid"]) || StringUtil::findIn($process["deptid"], $v["alldeptid"]) || StringUtil::findIn($process["positionid"], $v["allposid"])) { $prcsUserAuto .= $v["uid"] . ","; } } if (!empty($prcsUserAuto)) { $prcsOpUser = strtok($prcsUserAuto, ","); } } else { if ($process["uid"] != "" && $process["deptid"] == "" && $process["positionid"] == "") { $prcsUserArr = explode(",", $process["uid"]); $prcsUserCount = count($prcsUserArr) - 1; if ($prcsUserCount == 1) { $prcsUserAuto = $process["uid"]; $prcsOpUser = $prcsUserAuto; } } } } $prcsuser = WfHandleUtil::getPrcsUser($flowId, $process["processid"]); $prcsuser = sprintf("[%s]", !empty($prcsuser) ? StringUtil::iImplode($prcsuser) : ""); if ($process["userlock"] != 1) { $attr = 'islock="1"'; } else { $attr = ''; } if (!empty($prcsOpUser)) { $prcsOpUser = StringUtil::wrapId($prcsOpUser); } if (!empty($prcsUserAuto)) { $prcsUserAuto = StringUtil::wrapId(StringUtil::filterStr($prcsUserAuto)); } $tablestr = " <div class=\"control-group\" style=\"display:{$display};\" id='user_select_{$index}'>\r\n <div class=\"control-group first-group\">\r\n <label class=\"control-label\">{$lang["Host"]}</label>\r\n <div class=\"controls\">\r\n\t\t\t\t\t<input type=\"hidden\" name=\"topflag{$index}\" value=\"{$process["topdefault"]}\">\r\n\t\t\t\t\t<input id=\"prcs_user_op{$index}\" {$attr} name=\"prcs_user_op{$index}\" value=\"{$prcsOpUser}\" type=\"text\" />\r\n\t\t\t\t</div>\r\n </div>\r\n <div class=\"control-group\">\r\n <label class=\"control-label\">{$lang["Agent"]}</label>\r\n <div class=\"controls\">\r\n\t\t\t\t\t<input id=\"prcs_user{$index}\" {$attr} name=\"prcs_user{$index}\" value=\"{$prcsUserAuto}\" type=\"text\" />\r\n\t\t\t\t</div>\r\n </div>\r\n </div>\r\n <script>\r\n \$(function(){\r\n\t\t\t\tvar prcsData{$index} = {$prcsuser};\r\n var puo = \$('#prcs_user_op{$index}');\r\n var pu = \$('#prcs_user{$index}');\r\n\t\t\t\tvar topdef = '{$process["topdefault"]}';\r\n puo.userSelect({\r\n box:\$('<div id=\"prcs_user_op_box{$index}\"></div>').appendTo(document.body),\r\n data:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\ttype:'user',\r\n maximumSelectionSize:'1'\r\n });\r\n if(puo.attr('islock')==1 || topdef != 0){\r\n puo.userSelect('setReadOnly');\r\n } \r\n pu.userSelect({\r\n\t\t\t\t\tbox:\$('<div id=\"prcs_user_box{$index}\"></div>').appendTo(document.body),\r\n data:Ibos.data.includes(prcsData{$index}),\r\n\t\t\t\t\ttype:'user'\r\n });\r\n if(pu.attr('islock')==1){\r\n pu.userSelect('setReadOnly');\r\n }\r\n });\r\n </script>"; } return $tablestr; }
public function getStampName() { $name = StringUtil::iImplode($this->getCounter()->getStampName()); return $name; }