Ejemplo n.º 1
0
 public function actionDestroy()
 {
     $id = EnvUtil::getRequest("id");
     $runId = StringUtil::filterStr(StringUtil::filterCleanHtml($id));
     WfHandleUtil::destroy($runId);
     $this->ajaxReturn(array("isSuccess" => true));
 }
Ejemplo n.º 2
0
 public function actionEdit()
 {
     $id = intval(EnvUtil::getRequest("id"));
     if ($id) {
         if (EnvUtil::submitCheck("formhash")) {
             $this->beforeSave();
             unset($_POST["id"]);
             $data = FlowPermission::model()->create();
             $status = FlowPermission::model()->modify($id, $data);
             $this->ajaxReturn(array("isSuccess" => !!$status));
         } else {
             $per = FlowPermission::model()->fetchByPk($id);
             if (!empty($per)) {
                 if ($per["deptid"] == "alldept") {
                     $users = "c_0";
                 } else {
                     $users = StringUtil::wrapId($per["uid"], "u") . "," . StringUtil::wrapId($per["deptid"], "d") . "," . StringUtil::wrapId($per["positionid"], "p");
                 }
                 $isCustom = !in_array($per["scope"], array("selforg", "alldept", "selfdeptall", "selfdept"));
                 $data = array("per" => $per, "lang" => Ibos::getLangSources(), "custom" => $isCustom, "users" => StringUtil::filterStr($users));
                 $this->renderPartial("edit", $data);
             } else {
                 $this->ajaxReturn(Ibos::lang("Parameters error", "error"), "eval");
             }
         }
     }
 }
Ejemplo n.º 3
0
 public static function hasView($feedid, $uid)
 {
     $feed = Feed::model()->get($feedid);
     $feedUser = User::model()->fetchByUid($feed["uid"]);
     $user = User::model()->fetchByUid($uid);
     if ($feed && $feed["view"] !== WbConst::SELF_VIEW_SCOPE) {
         $fuDeptIds = StringUtil::filterStr($feedUser["alldeptid"] . "," . $feedUser["alldowndeptid"]);
         $deptIds = StringUtil::filterStr($user["alldeptid"] . "," . $user["allupdeptid"]);
         if ($feed["view"] == WbConst::ALL_VIEW_SCOPE) {
             return true;
         } elseif ($feed["view"] == WbConst::SELFDEPT_VIEW_SCOPE) {
             if (StringUtil::findIn($fuDeptIds, $deptIds)) {
                 return true;
             }
         } else {
             if (StringUtil::findIn($feed["userid"], $uid)) {
                 return true;
             }
             if (StringUtil::findIn($feed["positionid"], $user["allposid"])) {
                 return true;
             }
             if (StringUtil::findIn($fuDeptIds, $deptIds)) {
                 return true;
             }
         }
     }
     return false;
 }
Ejemplo n.º 4
0
 public function actionSave()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $data =& $_POST;
         if (isset($data["type"])) {
             foreach ($data["type"] as $id => $type) {
                 if (empty($data["uid"][$id]) || empty($data["remindtime"][$id])) {
                     continue;
                 }
                 $type = intval($type);
                 $attr = array("type" => intval($type));
                 if (!in_array($type, array(1, 5))) {
                     $attr["reminddate"] = $data["reminddate"][$id];
                 }
                 $attr["remindtime"] = $data["remindtime"][$id];
                 if (substr($id, 0, 1) == "n") {
                     $uid = StringUtil::getId($data["uid"][$id]);
                     $attr["uid"] = implode(",", $uid);
                     $attr["flowid"] = $this->flowid;
                     FlowTimer::model()->add($attr);
                 } else {
                     FlowTimer::model()->modify($id, $attr);
                 }
             }
         }
         if (!empty($data["delid"])) {
             $id = StringUtil::filterStr($data["delid"]);
             FlowTimer::model()->deleteAll("FIND_IN_SET(tid,'{$id}')");
         }
         $this->ajaxReturn(array("isSuccess" => true));
     }
     exit;
 }
Ejemplo n.º 5
0
 public function fetchRealnamesByUids($uids, $glue = ",")
 {
     $uid = is_array($uids) ? $uids : explode(",", StringUtil::filterStr($uids));
     $names = array();
     foreach ($uid as $id) {
         if (!empty($id)) {
             $names[] = $this->fetchRealnameByUid($id);
         }
     }
     return implode($glue, $names);
 }
Ejemplo n.º 6
0
 protected function beforeSave()
 {
     $viewExtFields = StringUtil::filterStr($_POST["viewextfields"]);
     $sumFields = StringUtil::filterStr($_POST["sumfields"]);
     $flowConditions = array("flowquerytype" => $_POST["flow_query_type"], "beginuser" => StringUtil::getId($_POST["begin_user"]), "runname" => StringUtil::filterCleanHtml($_POST["run_name"]), "flowstatus" => $_POST["flow_status"], "time1" => $_POST["time1"], "time2" => $_POST["time2"], "time3" => $_POST["time3"], "time4" => $_POST["time4"], "attachname" => StringUtil::filterCleanHtml($_POST["attach_name"]));
     $groupbyFields = array("field" => $_POST["group_field"], "order" => $_POST["group_sort"]);
     $name = StringUtil::filterCleanHtml($_POST["tplname"]);
     $sid = intval(EnvUtil::getRequest("sid"));
     $data = array("flowid" => $this->flowid, "uid" => $this->uid, "tplname" => $this->tplNameExists($name, $sid) ? $name . StringUtil::random(3) : $name, "viewextfields" => $viewExtFields, "sumfields" => $sumFields, "flowconditions" => serialize($flowConditions), "groupbyfields" => serialize($groupbyFields), "condformula" => $_POST["condformula"]);
     return $data;
 }
Ejemplo n.º 7
0
 public function send($bodyId, $bodyData, $inboxId = EmailBaseController::INBOX_ID)
 {
     $toids = $bodyData["toids"] . "," . $bodyData["copytoids"] . "," . $bodyData["secrettoids"];
     $toid = StringUtil::filterStr($toids);
     foreach (explode(",", $toid) as $uid) {
         $email = array("toid" => $uid, "fid" => $inboxId, "bodyid" => $bodyId);
         $newId = $this->add($email, true);
         $config = array("{sender}" => Ibos::app()->user->realname, "{subject}" => $bodyData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("email/content/show", array("id" => $newId)), "{content}" => Ibos::app()->getController()->renderPartial("application.modules.email.views.remindcontent", array("body" => $bodyData), true));
         Notify::model()->sendNotify($uid, "email_message", $config);
     }
 }
Ejemplo n.º 8
0
 public function actionDel()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $id = EnvUtil::getRequest("id");
         $ruleId = StringUtil::filterStr($id);
         if (!empty($ruleId)) {
             $res = FlowRule::model()->deleteAll(sprintf("FIND_IN_SET(ruleid,'%s') AND uid = %d", $ruleId, $this->uid));
             $this->ajaxReturn(array("isSuccess" => !!$res));
         }
     }
 }
Ejemplo n.º 9
0
 public function actionMark()
 {
     $op = EnvUtil::getRequest("op");
     $opList = array("todo", "read", "unread", "sendreceipt", "cancelreceipt", "del", "restore", "batchdel", "move");
     if (!in_array($op, $opList)) {
         exit;
     }
     $ids = EnvUtil::getRequest("emailids");
     $id = StringUtil::filterStr($ids);
     $extends = array();
     $condition = "toid = " . $this->uid . " AND FIND_IN_SET(emailid,\"" . $id . "\")";
     $valueDriver = array("read" => array("isread", 1), "unread" => array("isread", 0), "sendreceipt" => array("isreceipt", 1), "cancelreceipt" => array("isreceipt", 2), "restore" => array("isdel", 0));
     switch ($op) {
         case "del":
         case "batchdel":
             if ($op == "del") {
                 $next = Email::model()->fetchNext($id, $this->uid, $this->fid, $this->archiveId);
                 if (!empty($next)) {
                     $extends["url"] = $this->createUrl("content/show", array("id" => $next["emailid"], "archiveid" => $this->archiveId));
                 } else {
                     $extends["url"] = $this->createUrl("list/index");
                 }
             }
             $status = Email::model()->setField("isdel", 3, $condition);
             break;
         case "move":
             $fid = intval(EnvUtil::getRequest("fid"));
             $status = Email::model()->updateAll(array("fid" => $fid, "isdel" => 0), $condition);
             break;
         case "todo":
             $markFlag = EnvUtil::getRequest("ismark");
             $ismark = strcasecmp($markFlag, "true") == 0 ? 1 : 0;
             $status = Email::model()->setField("ismark", $ismark, $condition);
             break;
         case "sendreceipt":
             $fromInfo = Ibos::app()->db->createCommand()->select("eb.bodyid,eb.subject,eb.fromid")->from("{{email_body}} eb")->leftJoin("{{email}} e", "e.bodyid = eb.bodyid")->where("e.emailid = " . intval($id))->queryRow();
             if ($fromInfo) {
                 $config = array("{reader}" => Ibos::app()->user->realname, "{url}" => Ibos::app()->urlManager->createUrl("email/content/show", array("id" => $fromInfo["bodyid"])), "{title}" => $fromInfo["subject"]);
                 Notify::model()->sendNotify($fromInfo["fromid"], "email_receive_message", $config);
             }
         default:
             if (isset($valueDriver[$op])) {
                 $value = $valueDriver[$op][1][0];
                 $valueDriver;
                 $status = Email::model()->setField($key, $value, $condition);
             } else {
                 $status = false;
             }
             break;
     }
     $errorMsg = !$status ? Ibos::lang("Operation failure", "message") : "";
     $this->ajaxReturn(array_merge(array("isSuccess" => !!$status, "errorMsg" => $errorMsg), $extends));
 }
Ejemplo n.º 10
0
 public function actionDel()
 {
     $ids = EnvUtil::getRequest("emailid");
     $id = StringUtil::filterStr($ids);
     $status = false;
     if (!empty($id)) {
         $condition = "toid = " . intval(Yii::app()->user->uid) . " AND FIND_IN_SET(emailid,\"" . $id . "\")";
         $status = Email::model()->setField("isdel", 1, $condition);
     }
     $errorMsg = !$status ? Ibos::lang("Operation failure", "message") : "";
     $this->ajaxReturn(array("isSuccess" => !!$status, "errorMsg" => $errorMsg), "JSONP");
 }
Ejemplo n.º 11
0
 public function actionDel()
 {
     $id = EnvUtil::getRequest("webids");
     if ($id) {
         $id = StringUtil::filterStr($id);
         $delStatus = EmailWeb::model()->delClear($id, $this->uid);
         if ($delStatus) {
             if (Yii::app()->request->getIsAjaxRequest()) {
                 $this->ajaxReturn(array("isSuccess" => true));
             } else {
                 $this->success(Ibos::lang("Del succeed", "message"), $this->createUrl("web/index"));
             }
         }
     }
 }
Ejemplo n.º 12
0
 public function fetchDeptNameByDeptId($id, $glue = ",", $returnFirst = false)
 {
     $deptArr = DepartmentUtil::loadDepartment();
     $deptIds = is_array($id) ? $id : explode(",", StringUtil::filterStr($id));
     $name = array();
     if ($returnFirst) {
         if (isset($deptArr[$deptIds[0]])) {
             $name[] = $deptArr[$deptIds[0]]["deptname"];
         }
     } else {
         foreach ($deptIds as $deptId) {
             $name[] = isset($deptArr[$deptId]) ? $deptArr[$deptId]["deptname"] : null;
         }
     }
     return implode($glue, $name);
 }
Ejemplo n.º 13
0
 public function fetchPosNameByPosId($id, $glue = ",", $returnFirst = false)
 {
     $posArr = PositionUtil::loadPosition();
     $posIds = is_array($id) ? $id : explode(",", StringUtil::filterStr($id));
     $name = array();
     if ($returnFirst) {
         if (isset($posArr[$posIds[0]])) {
             $name[] = $posArr[$posIds[0]]["posname"];
         }
     } else {
         foreach ($posIds as $posId) {
             $name[] = isset($posArr[$posId]) ? $posArr[$posId]["posname"] : null;
         }
     }
     return implode($glue, $name);
 }
Ejemplo n.º 14
0
 protected function getUid()
 {
     if ($this->inPersonal()) {
         $uid = array(Ibos::app()->user->uid);
     } else {
         $id = EnvUtil::getRequest("uid");
         $uids = StringUtil::filterCleanHtml(StringUtil::filterStr($id));
         if (empty($uids)) {
             $uid = User::model()->fetchSubUidByUid(Ibos::app()->user->uid);
             if (empty($uid)) {
                 return array();
             }
         } else {
             $uid = explode(",", $uids);
         }
     }
     return $uid;
 }
Ejemplo n.º 15
0
 public function handleEmailBody($data)
 {
     $data["toids"] = implode(",", StringUtil::getId($data["toids"]));
     $data["sendtime"] = TIMESTAMP;
     $data["isneedreceipt"] = isset($data["isneedreceipt"]) ? 1 : 0;
     if (empty($data["isOtherRec"])) {
         $data["copytoids"] = $data["secrettoids"] = "";
     } else {
         $data["copytoids"] = implode(",", StringUtil::getId($data["copytoids"]));
         $data["secrettoids"] = implode(",", StringUtil::getId($data["secrettoids"]));
     }
     if (empty($data["isWebRec"])) {
         $data["towebmail"] = "";
     }
     if (!isset($data["fromwebmail"])) {
         $data["fromwebmail"] = "";
     }
     !empty($data["attachmentid"]) && ($data["attachmentid"] = StringUtil::filterStr($data["attachmentid"]));
     $data["size"] = EmailUtil::getEmailSize($data["content"], $data["attachmentid"]);
     return $data;
 }
Ejemplo n.º 16
0
 public function actionSyncUser()
 {
     $type = EnvUtil::getRequest("type");
     $uid = StringUtil::filterStr(EnvUtil::getRequest("uid"));
     $flag = intval(EnvUtil::getRequest("flag"));
     $pwd = EnvUtil::getRequest("pwd");
     if (MessageUtil::getIsImOpen($type)) {
         $im = Ibos::app()->setting->get("setting/im");
         $imCfg = $im[$type];
         $className = "ICIM" . ucfirst($type);
         $factory = new ICIMFactory();
         $properties = array("uid" => explode(",", $uid), "syncFlag" => $flag);
         if ($type == "rtx") {
             $properties["pwd"] = $pwd;
         }
         $adapter = $factory->createAdapter($className, $imCfg, $properties);
         return $adapter !== false ? $adapter->syncUser() : EnvUtil::iExit("初始化IM组件失败");
     } else {
         EnvUtil::iExit("未开启IM绑定");
     }
 }
Ejemplo n.º 17
0
 public function actionCategory()
 {
     if (EnvUtil::submitCheck("formhash")) {
         if (isset($_POST["name"])) {
             foreach ($_POST["name"] as $id => $val) {
                 if (!empty($val)) {
                     $data = array("name" => StringUtil::filterCleanHtml($val), "sort" => intval($_POST["sort"][$id]), "deptid" => !empty($_POST["deptid"][$id]) ? implode(",", StringUtil::getId($_POST["deptid"][$id])) : "");
                     FlowCategory::model()->modify(intval($id), $data);
                 }
             }
         }
         if (isset($_POST["newname"])) {
             foreach ($_POST["newname"] as $id => $val) {
                 if (!empty($val)) {
                     $data = array("name" => StringUtil::filterCleanHtml($val), "sort" => intval($_POST["newsort"][$id]), "deptid" => !empty($_POST["newdeptid"][$id]) ? implode(",", StringUtil::getId($_POST["newdeptid"][$id])) : "");
                     FlowCategory::model()->add($data);
                 }
             }
         }
         if (!empty($_POST["delid"])) {
             $id = StringUtil::filterStr($_POST["delid"]);
             if (!FlowCategory::model()->del($id)) {
                 $this->error(Ibos::lang("Category delete require"));
             }
         }
         $this->success(Ibos::lang("Operation succeed", "message"));
     } else {
         $categorys = FlowCategory::model()->fetchAll(array("order" => "sort ASC"));
         foreach ($categorys as $key => &$cat) {
             if ($cat["deptid"] !== "") {
                 $cat["deptid"] = StringUtil::wrapId($cat["deptid"], "d");
             }
             $cat["flownums"] = FlowType::model()->countByAttributes(array("catid" => $cat["catid"]));
             $cat["formnums"] = FlowFormType::model()->countByAttributes(array("catid" => $cat["catid"]));
         }
         $this->render("category", array("list" => $categorys));
     }
 }
Ejemplo n.º 18
0
 private function changeOpenWay()
 {
     $id = intval(EnvUtil::getRequest("id"));
     $type = StringUtil::filterStr(EnvUtil::getRequest("type"));
     if ($type == "disabled") {
         $openway = 1;
     } else {
         $openway = 0;
     }
     MenuCommon::model()->modify($id, array("openway" => $openway));
     $this->ajaxReturn(array("openway" => $openway, "isSuccess" => true, "msg" => Ibos::lang("Operation succeed", "message")));
 }
Ejemplo n.º 19
0
 private function handleUserNames($rows, &$userNamestr, $step, $var)
 {
     foreach ($rows as $row) {
         $userName = User::model()->fetchRealnameByUid($row["uid"]);
         if ($row["opflag"]) {
             $userName .= "[{$var["lang"]["Host user"]}]";
         }
         $isCurStep = $step == $var["processid"];
         $isMe = $row["uid"] == Ibos::app()->user->uid;
         $userNamestr .= $this->handleFlag(intval($row["flag"]), $userName, $var["lang"]);
         if ($isCurStep && $row["flag"] != 4 && !$isMe) {
             $this->_notFinished .= $userName . ",";
         }
         $isDone = $row["flag"] == 3 || $row["flag"] == 4;
         $notInManageMode = $var["op"] != "manage";
         if ($isCurStep && $isDone && $isMe && $notInManageMode) {
             EnvUtil::iExit($var["lang"]["Already trans"]);
         }
         $userNamestr = StringUtil::filterStr($userNamestr);
     }
 }
Ejemplo n.º 20
0
 public function actionExport()
 {
     $id = EnvUtil::getRequest("id");
     $idstr = StringUtil::filterStr(StringUtil::filterCleanHtml($id));
     WfFormUtil::export($idstr);
 }
Ejemplo n.º 21
0
 public function actionExport()
 {
     $id = EnvUtil::getRequest("id");
     $id = StringUtil::filterStr($id);
     MessageUtil::exportSms($id);
 }
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
 public function actionTrans()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $data =& $_POST;
         $conArr = array("begin" => !empty($data["begin"]) ? strtotime($data["begin"]) : "", "end" => !empty($data["end"]) ? strtotime($data["end"]) : "", "runbegin" => !empty($data["runbegin"]) ? intval($data["runbegin"]) : "", "runend" => !empty($data["runend"]) ? intval($data["runend"]) : "");
         $flowStr = StringUtil::filterStr($data["flowid"]);
         $uid = implode(",", StringUtil::getId($data["uid"]));
         $toid = implode(",", StringUtil::getId($data["toid"]));
         $fitRunIds = FlowRun::model()->fetchAllRunIdByFlowIdFeatCondition($flowStr, $conArr);
         if (!empty($fitRunIds)) {
             FlowRunProcess::model()->updateTransRun($uid, $toid, $fitRunIds);
         }
         $this->ajaxReturn(array("isSuccess" => true));
     } else {
         $data = array("flows" => FlowType::model()->fetchAllOnOptlist($this->uid), "lang" => Ibos::getLangSources());
         $this->renderPartial("trans", $data);
     }
 }
Ejemplo n.º 24
0
 public function actionAllowedlist()
 {
     $feedId = intval(EnvUtil::getRequest("feedid"));
     $feed = Feed::model()->getFeedInfo($feedId);
     if (!$feed) {
         exit("该条动态不存在");
     }
     $list = array();
     if ($feed["view"] == "1") {
         $list["users"] = Ibos::lang("My self");
     } elseif (!empty($feed["userid"])) {
         $list["users"] = User::model()->fetchRealnamesByUids($feed["userid"]);
     }
     if (!empty($feed["deptid"])) {
         if ($feed["deptid"] == "alldept" || $feed["view"] == "0") {
             $list["dept"] = Ibos::lang("All dept");
         } else {
             if ($feed["view"] == "2") {
                 $deptIds = StringUtil::filterStr(Ibos::app()->user->alldeptid . "," . Ibos::app()->user->alldowndeptid);
             } else {
                 $deptIds = $feed["deptid"];
             }
             if (!empty($deptIds)) {
                 $list["dept"] = Department::model()->fetchDeptNameByDeptId($deptIds);
             } else {
                 $list["dept"] = "";
             }
         }
     }
     if (!empty($feed["positionid"])) {
         $list["pos"] = Position::model()->fetchPosNameByPosId($feed["positionid"]);
     }
     $this->renderPartial("allowedlist", $list);
 }
Ejemplo n.º 25
0
 protected function handleBase(&$data)
 {
     if ($data["prcs"]["deptid"] == "alldept") {
         $data["prcs"]["prcsuser"] = "******";
     } else {
         $uid = StringUtil::wrapId($data["prcs"]["uid"]);
         $deptId = StringUtil::wrapId($data["prcs"]["deptid"], "d");
         $posId = StringUtil::wrapId($data["prcs"]["positionid"], "p");
         $prcsUser = sprintf("%s,%s,%s", $uid, $deptId, $posId);
         $data["prcs"]["prcsuser"] = StringUtil::filterStr($prcsUser);
     }
     $data["prcs"]["autouserop"] = StringUtil::wrapId($data["prcs"]["autouserop"]);
     $data["prcs"]["autouser"] = StringUtil::wrapId($data["prcs"]["autouser"]);
     if (!empty($data["prcs"]["attachpriv"])) {
         $data["prcs"]["attachpriv"] = explode(",", $data["prcs"]["attachpriv"]);
     } else {
         $data["prcs"]["attachpriv"] = array();
     }
 }
Ejemplo n.º 26
0
 protected function getPostData()
 {
     $viewExtFields = StringUtil::filterStr($_POST["viewextfields"]);
     $sumFields = StringUtil::filterStr($_POST["sumfields"]);
     $flowConditions = array("flowquerytype" => $_POST["flow_query_type"], "beginuser" => !empty($_POST["begin_user"]) ? implode(",", StringUtil::getId($_POST["begin_user"])) : "", "runname" => StringUtil::filterCleanHtml($_POST["run_name"]), "flowstatus" => $_POST["flow_status"], "time1" => $_POST["time1"], "time2" => $_POST["time2"], "time3" => $_POST["time3"], "time4" => $_POST["time4"], "attachname" => StringUtil::filterCleanHtml($_POST["attach_name"]));
     $groupbyFields = array("field" => $_POST["group_field"], "order" => $_POST["group_sort"]);
     $data = array("flowid" => intval($_POST["flowid"]), "uid" => $this->uid, "tplname" => StringUtil::filterCleanHtml($_POST["tplname"]), "viewextfields" => $viewExtFields, "sumfields" => $sumFields, "flowconditions" => $flowConditions, "groupbyfields" => $groupbyFields, "condformula" => $_POST["condformula"]);
     return $data;
 }
Ejemplo n.º 27
0
 private function handlePostData()
 {
     $chargeuid = StringUtil::getId($_POST["chargeuid"]);
     $participantuid = StringUtil::getId($_POST["participantuid"]);
     $data = array("subject" => StringUtil::filterStr($_POST["subject"]), "description" => StringUtil::filterStr($_POST["description"]), "chargeuid" => implode(",", $chargeuid), "participantuid" => implode(",", $participantuid), "attachmentid" => trim($_POST["attachmentid"], ","), "starttime" => empty($_POST["starttime"]) ? TIMESTAMP : strtotime($_POST["starttime"]), "endtime" => strtotime($_POST["endtime"]));
     return $data;
 }
Ejemplo n.º 28
0
 private function save($bodyId, $bodyData)
 {
     if (!empty($bodyData["attachmentid"]) && $bodyId) {
         AttachUtil::updateAttach($bodyData["attachmentid"], $bodyId);
     }
     if ($bodyData["issend"]) {
         Email::model()->send($bodyId, $bodyData);
         if (!empty($bodyData["towebmail"])) {
             $toUsers = StringUtil::filterStr($bodyData["towebmail"], ";");
             if (!empty($toUsers)) {
                 $webBox = EmailWeb::model()->fetchByPk($bodyData["fromwebid"]);
                 WebMailUtil::sendWebMail($toUsers, $bodyData, $webBox);
             }
         }
         UserUtil::updateCreditByAction("postmail", $this->uid);
         $message = Ibos::lang("Send succeed");
     } else {
         $message = Ibos::lang("Save succeed", "message");
     }
     if (Yii::app()->request->getIsAjaxRequest()) {
         $this->ajaxReturn(array("isSuccess" => true, "messsage" => $message));
     } else {
         $this->success($message, $this->createUrl("list/index"));
     }
 }