Ejemplo n.º 1
0
 public function init()
 {
     $attach = $this->getAttach();
     $var = array("assetUrl" => $this->getController()->getAssetUrl(), "lang" => Ibos::getLangSources(), "attach" => $attach, "param" => $this->getParam(), "isNew" => empty($attach));
     $var = array_merge($this->getDocFile($var), $var);
     $this->_var = $var;
 }
Ejemplo n.º 2
0
 public function run()
 {
     $module = $this->getController()->getModule()->getId();
     $timeRoute = $this->getTimeRoute($module);
     $data = array("module" => $module, "timeRoute" => $timeRoute, "lang" => Ibos::getLangSources(array("diary.default")), "time" => StatCommonUtil::getCommonTimeScope());
     $this->render(self::VIEW, $data);
 }
Ejemplo n.º 3
0
 public function init()
 {
     $key = $this->getKey();
     $flow = new ICFlowType(intval($key["flowid"]), true);
     $this->_var = array_merge($key, array("lang" => Ibos::getLangSources(), "flow" => $flow, "key" => $this->makeKey($key), "flowName" => $flow->name, "freePreset" => $flow->freepreset, "runName" => FlowRun::model()->fetchNameByRunID($key["runid"])));
     parent::init();
 }
Ejemplo n.º 4
0
 public function run()
 {
     $attr = $this->getAttributes();
     $map = array("module" => $this->getModule(), "table" => $this->getTable(), "rowid" => $attr["rowid"], "isdel" => 0);
     $attr["count"] = Comment::model()->countByAttributes($map);
     $list = $this->getCommentList();
     $isAdministrator = Ibos::app()->user->isadministrator;
     $uid = Ibos::app()->user->uid;
     foreach ($list as &$cm) {
         $cm["isCommentDel"] = $isAdministrator || $uid === $cm["uid"];
         $cm["replys"] = intval(Comment::model()->countByAttributes(array("module" => "message", "table" => "comment", "rowid" => $cm["cid"], "isdel" => 0)));
     }
     $attr["comments"] = $list;
     $attr["lang"] = Ibos::getLangSources(array("message.default"));
     $content = $this->render($this->getParseView("comment"), $attr, true);
     $ajax = $attr["inAjax"];
     $count = $attr["count"];
     unset($attr);
     $return = array("isSuccess" => true, "data" => $content, "count" => $count);
     if ($ajax == 1) {
         $this->getOwner()->ajaxReturn($return);
     } else {
         echo $return["data"];
     }
 }
Ejemplo n.º 5
0
 public function actionAdd()
 {
     $flowId = intval(EnvUtil::getRequest("flowid"));
     $flow = new ICFlowType($flowId);
     if (EnvUtil::submitCheck("formhash")) {
         $this->checkFlowAccess($flowId, 1, $this->createUrl("new/add"));
         $this->beforeAdd($_POST, $flow);
         $run = array("name" => $_POST["name"], "flowid" => $flowId, "beginuser" => $this->uid, "begintime" => TIMESTAMP);
         $runId = FlowRun::model()->add($run, true);
         $runProcess = array("runid" => $runId, "processid" => 1, "uid" => $this->uid, "flag" => FlowConst::PRCS_UN_RECEIVE, "flowprocess" => 1, "createtime" => TIMESTAMP);
         FlowRunProcess::model()->add($runProcess);
         if (strstr($flow->autoname, "{N}")) {
             FlowType::model()->updateCounters(array("autonum" => 1), sprintf("flowid = %d", $flowId));
             CacheUtil::rm("flowtype_" . $flowId);
         }
         $runData = array("runid" => $runId, "name" => $_POST["name"], "beginuser" => $this->uid, "begin" => TIMESTAMP);
         $this->handleRunData($flow, $runData);
         $param = array("flowid" => $flowId, "runid" => $runId, "processid" => 1, "flowprocess" => 1, "fromnew" => 1);
         $jumpUrl = $this->createUrl("form/index", array("key" => WfCommonUtil::param($param)));
         $this->ajaxReturn(array("isSuccess" => true, "jumpUrl" => $jumpUrl));
     } else {
         $this->checkFlowAccess($flowId, 1);
         if (!empty($flow->autoname)) {
             $runName = WfNewUtil::replaceAutoName($flow, $this->uid);
         } else {
             $runName = sprintf("%s (%s)", $flow->name, date("Y-m-d H:i:s"));
         }
         $data = array("flow" => $flow->toArray(), "runName" => $runName, "lang" => Ibos::getLangSources());
         $this->renderPartial("add", $data);
     }
 }
Ejemplo n.º 6
0
 protected function handleTplData($flowId)
 {
     $data = array();
     $lang = Ibos::getLangSources();
     $flow = new ICFlowType($flowId);
     $flowArr = $flow->toArray();
     if (!empty($flowArr)) {
         $data["flow"] = $flowArr;
         $data["form"] = $flow->form->toArray();
         $formStructure = $flow->form->parser->getStructure();
         $defTitleArr = array(array("key" => "runid", "title" => $lang["Flow no"]), array("key" => "runname", "title" => $lang["Flow subject/num"]), array("key" => "runstatus", "title" => $lang["Flow status"]), array("key" => "rundate", "title" => $lang["Flow begin date"]), array("key" => "runtime", "title" => $lang["Flow begin time"]));
         $titleArr = array();
         $table = "flow_data_" . $flowId;
         foreach ($formStructure as $structure) {
             if ($structure["data-type"] == "sign" || $structure["data-type"] == "label") {
                 continue;
             }
             $titleIdentifier = sprintf("%s.%s", $table, "data_" . $structure["itemid"]);
             $structure["data-title"] = stripslashes(str_replace(array("<", ">"), array("&lt", "&gt"), $structure["data-title"]));
             $titleArr[] = array("key" => $titleIdentifier, "title" => $structure["data-title"]);
         }
         $data["deftitle"] = $defTitleArr;
         $data["title"] = $titleArr;
     }
     $data["lang"] = $lang;
     return $data;
 }
Ejemplo n.º 7
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.º 8
0
 public function run()
 {
     $var["control"] = $this->getController()->getId();
     $var["lang"] = Ibos::getLangSources();
     $var["category"] = $this->getCategory();
     $var["catId"] = $this->getCatId();
     $this->render(self::VIEW, $var);
 }
Ejemplo n.º 9
0
 public function run()
 {
     $var["lang"] = Ibos::getLangSources();
     $var["type"] = $this->getType();
     $var["sort"] = $this->getSort();
     $var["op"] = $this->getOp();
     $this->render("wfwidget.categoryview", array_merge($this->_var, $var, $this->handleList($this->getRunProcess())));
 }
Ejemplo n.º 10
0
 public function actionIndex()
 {
     if (EnvUtil::getRequest("inajax") == 1) {
         $list = FlowTimer::model()->fetchAllByFlowId($this->flowid);
         $count = count($list);
         $this->ajaxReturn(array("count" => $count, "list" => $list));
     } else {
         $this->renderPartial("index", array("lang" => Ibos::getLangSources()));
     }
 }
Ejemplo n.º 11
0
 public function fetchCommentList()
 {
     $count = $this->getCommentCount();
     $limit = $this->getAttributes("limit");
     $pages = PageUtil::create($count, $limit);
     $this->setAttributes(array("offset" => $pages->getOffset(), "limit" => $pages->getLimit()));
     $var = array("list" => $this->getCommentList(), "lang" => Ibos::getLangSources(array("message.default")), "count" => $count, "limit" => $limit, "rowid" => $this->getAttributes("rowid"), "moduleuid" => $this->getAttributes("moduleuid"), "showlist" => $this->getAttributes("showlist"), "pages" => $pages);
     $content = $this->render("application.modules.weibo.views.comment.loadreply", $var, true);
     return $content;
 }
Ejemplo n.º 12
0
 public function run()
 {
     $this->setPages();
     $var["lang"] = Ibos::getLangSources();
     $var["list"] = $this->handleList($this->getRunProcess());
     $var["type"] = $this->getType();
     $var["sort"] = $this->getSort();
     $var["op"] = $this->getOp();
     $view = "wfwidget.list" . $this->getType();
     $this->render($view, array_merge($this->_var, $var));
 }
Ejemplo n.º 13
0
 public function render($view, $data = null, $return = false, $langSources = array())
 {
     if (is_null($data)) {
         $data = array();
     }
     Ibos::app()->setting->set("pageTitle", $this->getPageTitle());
     Ibos::app()->setting->set("breadCrumbs", $this->getPageState("breadCrumbs", array()));
     $this->setPageState("breadCrumbs", null);
     !isset($data["assetUrl"]) && ($data["assetUrl"] = $this->getAssetUrl());
     $data["lang"] = Ibos::getLangSources($langSources);
     return parent::render($view, $data, $return);
 }
Ejemplo n.º 14
0
 public function run()
 {
     $module = $this->getController()->getModule()->getId();
     $timeRoute = $this->getTimeRoute($module);
     $type = $this->getType();
     $timestr = $this->getTimestr();
     if (empty($type)) {
         $type = "day";
     }
     if (empty($timestr)) {
         $timestr = "thisweek";
     }
     $data = array("module" => $module, "timeRoute" => $timeRoute, "lang" => Ibos::getLangSources(array("recruit.default")), "time" => StatCommonUtil::getCommonTimeScope(), "type" => $type, "timestr" => $timestr);
     $this->render(self::VIEW, $data);
 }
Ejemplo n.º 15
0
 protected function getSidebar($op = "")
 {
     $archiveTable = array();
     $settings = Yii::app()->setting->get("setting");
     $archiveTable["ids"] = $settings["emailtableids"] ? $settings["emailtableids"] : array();
     $archiveTable["info"] = $settings["emailtable_info"] ? $settings["emailtable_info"] : array();
     foreach ($archiveTable["ids"] as $tableId) {
         if ($tableId != 0 && empty($archiveTable["info"][$tableId]["displayname"])) {
             $archiveTable["info"][$tableId]["displayname"] = Ibos::lang("Unnamed archive") . "(" . $tableId . ")";
         }
     }
     $data = array("op" => $op, "uid" => $this->uid, "lang" => Ibos::getLangSources(), "folders" => $this->folders, "allowWebMail" => $this->allowWebMail, "webEmails" => $this->webMails, "fid" => $this->fid, "webId" => $this->webId, "archiveId" => $this->archiveId, "hasArchive" => 1 < count($archiveTable["ids"]), "archiveTable" => $archiveTable);
     $sidebarAlias = "application.modules.email.views.sidebar";
     $sidebarView = $this->renderPartial($sidebarAlias, $data, true);
     return $sidebarView;
 }
Ejemplo n.º 16
0
 public function actionUserCard()
 {
     $uid = EnvUtil::getRequest("uid");
     $user = User::model()->fetchByUid($uid);
     $onlineStatus = UserUtil::getOnlineStatus($uid);
     $styleMap = array(-1 => "o-pm-offline", 1 => "o-pm-online");
     if (empty($user)) {
         $this->error(Ibos::lang("Request tainting", "error"));
     } else {
         $weiboExists = ModuleUtil::getIsEnabled("weibo");
         $data = array("user" => $user, "status" => $styleMap[$onlineStatus], "lang" => Ibos::getLangSources(), "weibo" => $weiboExists);
         if ($weiboExists) {
             $data["userData"] = UserData::model()->getUserData($user["uid"]);
             $data["states"] = Follow::model()->getFollowState(Ibos::app()->user->uid, $user["uid"]);
         }
         $content = $this->renderPartial("userCard", $data, true);
         echo $content;
         exit;
     }
 }
Ejemplo n.º 17
0
 protected function ajaxAdd()
 {
     if (Yii::app()->request->getIsPostRequest()) {
         $newId = $this->processAddWebMail(true);
         $this->success(Ibos::lang("Save succeed", "message"), "", array(), array("webId" => $newId));
     } else {
         $data = array("lang" => Ibos::getLangSources(), "more" => false);
         $this->renderPartial("ajaxAdd", $data);
     }
 }
Ejemplo n.º 18
0
 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"));
     }
 }
Ejemplo n.º 19
0
 protected function handleTimeOut($model)
 {
     $lang = Ibos::getLangSources("workflow.default");
     $label = "macro_timeout";
     $exp = "/#\\[" . $label . "(\\d*)(\\*?)\\]/i";
     preg_match_all($exp, $model, $matches);
     foreach ($matches[1] as $k => $v) {
         if (!empty($v)) {
             $data = FlowRunProcess::model()->fetchTimeoutRecord($this->run->runid, $v);
             if ($data) {
                 $flowPrcs = $data["flowprocess"];
                 $processTime = $data["processtime"];
                 $createTime = $data["createtime"];
                 $deliverTime = $data["delivertime"];
             } else {
                 $flowPrcs = "";
             }
             if ($flowPrcs) {
                 $info = FlowProcess::model()->fetchTimeoutInfo($this->run->flowid, $flowPrcs);
                 if ($info) {
                     $processName = $lang["The"] . $v . $lang["Steps"] . ":" . $info["name"];
                     if (!isset($timeout) && $timeout == "") {
                         $timeout = $info["timeout"];
                     }
                     $timeOutType = $info["timeouttype"];
                 }
                 if (isset($timeOutType) && $timeOutType == 0) {
                     $prcsBeginTime = $processTime;
                     if (!$processTime) {
                         $prcsBeginTime = $createTime;
                     }
                 } else {
                     $prcsBeginTime = $createTime;
                 }
                 $prcsEndTime = $deliverTime;
                 $prcsBeginTime = strtotime($prcsBeginTime);
                 $prcsEndTime = strtotime($prcsEndTime);
                 if (!$prcsBeginTime) {
                     $prcsBeginTime = TIMESTAMP;
                 }
                 if (!$prcsEndTime) {
                     $prcsEndTime = TIMESTAMP;
                 }
                 $timeUsedDesc = WfCommonUtil::getTime($prcsEndTime - $prcsBeginTime);
                 $str = $processName . $lang["Timeout"] . ":" . $timeUsedDesc;
                 $model = str_replace($matches[0][$k], $str, $model);
             } else {
                 $model = str_replace($matches[0][$k], "", $model);
             }
         }
     }
 }
Ejemplo n.º 20
0
 public function actionReset()
 {
     if (Ibos::app()->user->isGuest) {
         Ibos::app()->user->loginRequired();
     }
     if (EnvUtil::submitCheck("formhash")) {
         $original = filter_input(INPUT_POST, "originalpass", FILTER_SANITIZE_SPECIAL_CHARS);
         $new = filter_input(INPUT_POST, "newpass", FILTER_SANITIZE_SPECIAL_CHARS);
         $newConfirm = filter_input(INPUT_POST, "newpass_confirm", FILTER_SANITIZE_SPECIAL_CHARS);
         if ($original == "") {
             $this->error(Ibos::lang("Original password require"));
         } elseif (strcasecmp(md5(md5($original) . Ibos::app()->user->salt), Ibos::app()->user->password) !== 0) {
             $this->error(Ibos::lang("Password is not correct"));
         } else {
             if (!empty($new) && strcasecmp($new, $newConfirm) !== 0) {
                 $this->error(Ibos::lang("Confirm password is not correct"));
             } else {
                 $password = md5(md5($new) . Ibos::app()->user->salt);
                 $success = User::model()->updateByUid(Ibos::app()->user->uid, array("password" => $password, "lastchangepass" => TIMESTAMP));
                 $success && Ibos::app()->user->logout();
                 $this->success(Ibos::lang("Reset success"), $this->createUrl("default/login"));
             }
         }
     } else {
         $userName = Ibos::app()->user->realname;
         $data = array("assetUrl" => $this->getAssetUrl("user"), "account" => UserUtil::getAccountSetting(), "lang" => Ibos::getLangSources(), "unit" => Ibos::app()->setting->get("setting/unit"), "user" => $userName);
         $this->renderPartial("reset", $data);
     }
 }
Ejemplo n.º 21
0
 public function actionImport()
 {
     $id = EnvUtil::getRequest("formid");
     $catId = EnvUtil::getRequest("catid");
     if (EnvUtil::submitCheck("formhash")) {
         $fileName = $_FILES["import"]["name"];
         $fileExt = StringUtil::getFileExt($fileName);
         if (!in_array($fileExt, array("txt", "htm", "html"))) {
             echo "<script type='text/javascript'>parent.Ui.alert('" . Ibos::lang("Form import desc") . "');</script>";
         } else {
             $upload = FileUtil::getUpload($_FILES["import"]);
             $upload->save();
             $files = $upload->getAttach();
             $file = $files["target"];
             $inajax = 0;
             if (empty($id)) {
                 $name = strstr($files["name"], ".", true);
                 $inajax = 1;
                 $id = FlowFormType::model()->quickAdd($name, $catId);
             }
             WfFormUtil::import($id, $file);
             $nextOpt = $_POST["nextopt"];
             $exec = "";
             if ($nextOpt == "edit") {
                 $param = sprintf("{'formid':'%d','inajax':%d}", $id, $inajax);
                 $exec = "parent.Wfs.formItem.edit({$param});";
             } elseif ($nextOpt == "design") {
                 $param = sprintf("{'formid':'%d'}", $id);
                 $exec = "parent.Wfs.formItem.design({$param});";
             }
             $this->ajaxReturn("<script type='text/javascript'>parent.Ui.tip('" . Ibos::lang("Import success") . "', 'success');{$exec}parent.Ui.getDialog('d_import_form').close();</script>", "eval");
         }
     }
     $lang = Ibos::getLangSources();
     $this->renderPartial("import", array("lang" => $lang, "id" => $id, "catid" => $catId));
 }
Ejemplo n.º 22
0
 protected function parseComment($data)
 {
     $uid = Ibos::app()->user->uid;
     $isAdministrator = Ibos::app()->user->isadministrator;
     $data["userInfo"] = User::model()->fetchByUid($uid);
     $data["content"] = StringUtil::pregHtml($data["content"]);
     $data["content"] = StringUtil::parseHtml($data["content"]);
     $data["lang"] = Ibos::getLangSources(array("message.default"));
     $data["isCommentDel"] = $isAdministrator || $uid === $data["uid"];
     if (!empty($data["attachmentid"])) {
         $data["attach"] = AttachUtil::getAttach($data["attachmentid"]);
     }
     return $this->render($this->getParseView("comment", "parse"), $data, true);
 }
Ejemplo n.º 23
0
 public static function getExportData($list, $param)
 {
     $lang = Ibos::getLangSources(array("workflow.default"));
     $data = $titles = $sum = array();
     $group = "";
     $flow = new ICFlowType($param["flowid"]);
     $structure = $flow->form->parser->structure;
     foreach ($list as $index => $row) {
         if (!empty($param["condition"])) {
             $formData = WfHandleUtil::getFormData($row["flowid"], $row["runid"]);
             $notPass = WfHandleUtil::checkCondition($formData, $param["condition"], "");
             if ($notPass !== "") {
                 continue;
             }
         }
         $queryHidden = Ibos::app()->db->createCommand()->select("hiddenitem")->from("{{flow_process}} fp")->leftJoin("{{flow_run_process}} frp", "fp.processid = frp.flowprocess")->where(sprintf("fp.flowid = %d AND frp.runid = %d AND frp.uid = %d", $param["flowid"], $row["runid"], $param["uid"]))->queryAll();
         $hidden = ConvertUtil::getSubByKey($queryHidden, "hiddenitem");
         $itemData = FlowDataN::model()->fetch($param["flowid"], $row["runid"]);
         $processor = new ICPrintViewProcessor(array("itemData" => $itemData));
         foreach (explode(",", $param["viewextfields"]) as $key => $field) {
             if (strpos($field, ".") !== false) {
                 list(, $itemID) = explode(".", $field);
                 $item = isset($structure[$itemID]) ? $structure[$itemID] : array();
                 if (empty($item)) {
                     continue;
                 }
                 if ($item["data-type"] == "sign" || $item["data-type"] == "label") {
                     continue;
                 }
                 if (in_array($item["data-title"], $hidden)) {
                     $value = "";
                 } else {
                     $itemValue = $itemData[$itemID];
                     switch ($item["data-type"]) {
                         case "checkbox":
                             if ($itemValue == "on") {
                                 $value = $lang["Yes"];
                             } else {
                                 $value = $lang["No"];
                             }
                             break;
                         case "user":
                         case "auto":
                             $method = $item["data-type"] . "Processor";
                             if (method_exists($processor, $method)) {
                                 $value = $processor->{$method}($item, true);
                             }
                             break;
                         case "listview":
                             $sumflag = 0;
                             $lv_subject = $item["data-lv-title"];
                             $lv_sum = $item["data-lv-sum"];
                             $lv_sum_array = explode("`", $lv_sum);
                             if (strstr($lv_sum, "1")) {
                                 $sumflag = 1;
                             }
                             $lv_value = $itemValue;
                             $item_value = "<table class='commonTable2' ><tr>\n";
                             $my_array = explode("`", $lv_subject);
                             $array_count_title = sizeof($my_array);
                             if ($my_array[$array_count_title - 1] == "") {
                                 $array_count_title--;
                             }
                             for ($i = 0; $i < $array_count_title; $i++) {
                                 $item_value .= "<td>" . $my_array[$i] . "</td>\n";
                             }
                             $item_value .= "</tr>\n";
                             $my_array = explode("\r\n", $lv_value);
                             $array_count = sizeof($my_array);
                             if ($my_array[$array_count - 1] == "") {
                                 $array_count--;
                             }
                             $sum_data = array();
                             for ($i = 0; $i < $array_count; $i++) {
                                 $item_value .= "<tr>\n";
                                 $tr_data = $my_array[$i];
                                 $my_array1 = explode("`", $tr_data);
                                 for ($j = 0; $j < $array_count_title; $j++) {
                                     if ($lv_sum_array[$j] == 1) {
                                         $sum_data[$j] += $my_array1[$j];
                                     }
                                     $td_data = $my_array1[$j];
                                     if ($td_data == "") {
                                         $td_data = "&nbsp;";
                                     }
                                     $item_value .= "<td>" . $td_data . "</td>\n";
                                 }
                                 $item_value .= "</tr>\n";
                             }
                             if ($sumflag == 1 && 0 < $array_count) {
                                 $item_value .= "<tr style='font-weight:bold;'>\n";
                                 for ($j = 0; $j < $array_count_title; $j++) {
                                     if ($sum_data[$j] == "") {
                                         $sumvalue = "&nbsp;";
                                     } else {
                                         $sumvalue = "合计:" . $sum_data[$j];
                                     }
                                     $item_value .= "<td align=right>" . $sumvalue . "</td>\n";
                                 }
                                 $item_value .= "</tr>\n";
                             }
                             $item_value .= "</table>\n";
                             break;
                         default:
                             $value = isset($itemData[$itemID]) ? $itemData[$itemID] : "";
                             break;
                     }
                 }
                 $title = $item["data-title"];
             } else {
                 switch ($field) {
                     case "runid":
                         $value = $row["runid"];
                         $title = $lang["Flow no"];
                         break;
                     case "runname":
                         $value = $row["runName"];
                         $title = $lang["Flow subject/num"];
                         break;
                     case "runstatus":
                         if ($param["flowconditions"]["flowstatus"] == "all") {
                             if ($row["endtime"] == 0) {
                                 $status = "<span class=\"red\">{$lang["Perform"]}</span>";
                             } else {
                                 $status = $lang["Has ended"];
                             }
                         } elseif ($param["flowconditions"]["flowstatus"] == "0") {
                             $status = "<span class=\"red\">{$lang["Perform"]}</span>";
                         } else {
                             $status = $lang["Has ended"];
                         }
                         $value = $status;
                         $title = $lang["Flow status"];
                         break;
                     case "rundate":
                         $value = date("Y-m-d", $row["begintime"]);
                         $title = $lang["Flow begin date"];
                         break;
                     case "runtime":
                         $value = ConvertUtil::formatDate($row["begintime"]);
                         $title = $lang["Flow begin time"];
                         break;
                     default:
                         break;
                 }
             }
             if (StringUtil::findIn($param["sumfields"], $field)) {
                 $sum[] = $key;
             }
             $data[$index][$key] = $value;
             if ($index == 0) {
                 if (strcmp($param["groupbyfields"]["field"], $field) == 0) {
                     $group = $key;
                 }
                 $titles[$key] = $title;
             }
         }
     }
     return array("title" => $titles, "data" => $data, "sum" => $sum, "group" => $group, "sum_data" => isset($sum_data) ? $sum_data : array());
 }
Ejemplo n.º 24
0
 public function actionShowNext()
 {
     $key = EnvUtil::getRequest("key");
     if ($key) {
         $param = WfCommonUtil::param($key, "DECODE");
         $flowId = $param["flowid"];
         $runId = $param["runid"];
         $processId = $param["processid"];
         $flowProcess = $param["flowprocess"];
         $op = isset($param["op"]) ? $param["op"] : "";
         $topflag = EnvUtil::getRequest("topflag");
         $lang = Ibos::getLangSources();
         $this->nextAccessCheck($topflag, $runId, $processId);
         $run = new ICFlowRun($runId);
         $process = new ICFlowProcess($flowId, $flowProcess);
         $notAllFinished = array();
         $parent = "";
         foreach (FlowRunProcess::model()->fetchAllByRunIDProcessID($runId, $processId) as $rp) {
             if ($rp["flowprocess"] == $flowProcess) {
                 $parent .= $rp["parent"] . ",";
                 if (($rp["flag"] == self::TRANS || $rp["flag"] == self::DONE) && $rp["uid"] == $this->uid) {
                     $turnForbidden = true;
                 } else {
                     $turnForbidden = false;
                 }
                 if ($rp["flag"] != self::DONE && $rp["uid"] != $this->uid) {
                     $notAllFinished[] = $rp["uid"];
                 }
             }
         }
         if ($turnForbidden) {
             EnvUtil::iExit(Ibos::lang("Already trans"));
         }
         if (!empty($notAllFinished)) {
             $notAllFinished = User::model()->fetchRealnamesbyUids($notAllFinished);
         } else {
             $notAllFinished = "";
         }
         if ($process->gathernode == self::FORCE) {
             foreach (FlowProcess::model()->fetchAllGatherNode($flowId, $flowProcess) as $fp) {
                 $isUntrans = FlowRunProcess::model()->getIsUntrans($runId, $fp["processid"]);
                 if (!StringUtil::findIn($fp["processid"], $parent)) {
                     if ($isUntrans) {
                         EnvUtil::iExit(Ibos::lang("Gathernode trans error"));
                     }
                 }
             }
         }
         if ($process->processto == "") {
             $prcsMax = FlowProcess::model()->fetchMaxProcessIDByFlowID($flowId);
             if ($flowProcess !== $prcsMax) {
                 $process->processto = $flowProcess + 1;
             } else {
                 $process->processto = "0";
             }
         }
         $prcsArr = explode(",", trim($process->processto, ","));
         $prcsArrCount = count($prcsArr);
         $prcsEnableCount = 0;
         $prcsStop = "S";
         $prcsback = "";
         $prcsEnableFirst = null;
         $list = array();
         $formData = WfHandleUtil::getFormData($flowId, $runId);
         foreach ($prcsArr as $key => $to) {
             $param = array("checked" => "false");
             if ($to == "0") {
                 $param["isover"] = true;
                 $param["prcsname"] = $run->parentrun !== "0" ? Ibos::lang("End subflow") : Ibos::lang("Form endflow");
                 $prcsStop = $key;
                 $prcsEnableCount++;
                 if ($prcsEnableCount == 1) {
                     $param["checked"] = "true";
                     $prcsEnableFirst = $key;
                 }
                 if ($run->parentrun !== "0") {
                     $parentFlowId = FlowRun::model()->fetchFlowIdByRunId($run->parentrun);
                     $parentProcess = FlowRun::model()->fetchIDByChild($run->parentrun, $runId);
                     $parentFlowProcess = $parentProcess["flowprocess"];
                     if ($parentFlowId && $parentFlowProcess) {
                         $temp = FlowProcess::model()->fetchProcess($parentFlowId, $parentFlowProcess);
                         if ($temp) {
                             $prcsback = $temp["processto"];
                             $backUserOP = $temp["autouserop"];
                             $param["backuser"] = $temp["autouser"];
                         }
                     }
                     if ($prcsback != "") {
                         $param["prcsusers"] = WfHandleUtil::getPrcsUser($flowId, $prcsback);
                         $param["display"] = $prcsEnableFirst !== $prcsStop ? false : true;
                         if (isset($backUserOP)) {
                             $param["prcsopuser"] = $backUserOP;
                         }
                     }
                 }
             } else {
                 $param["isover"] = false;
                 $curProcess = FlowProcess::model()->fetchProcess($flowId, $to);
                 $param["prcsname"] = $curProcess["name"];
                 $processOut = FlowProcessTurn::model()->fetchByUnique($flowId, $processId, $to);
                 if (!$processOut) {
                     $processOut = array("processout" => "", "conditiondesc" => "");
                 }
                 $notpass = WfHandleUtil::checkCondition($formData, $processOut["processout"], $processOut["conditiondesc"]);
                 if ($curProcess["childflow"] !== "0") {
                     $param["prcsname"] .= "(" . $lang["Subflow"] . ")";
                 }
                 if (substr($notpass, 0, 5) == "setok") {
                     $notpass = "";
                 }
                 if ($notpass == "") {
                     $prcsEnableCount++;
                     if ($prcsEnableCount == 1 || 0 < $process->syncdeal && !is_numeric($prcsStop)) {
                         $param["checked"] = "true";
                         if ($prcsEnableCount == 1) {
                             $prcsEnableFirst = $key;
                         }
                     }
                     unset($param["notpass"]);
                     $param["selectstr"] = $this->makeUserSelect($runId, $key, $curProcess, $param["prcsname"], $flowId, $processId);
                 } else {
                     $param["notpass"] = $notpass;
                 }
             }
             $list[$key] = $param;
         }
         if ($prcsEnableCount == 0) {
             if ($notpass == "") {
                 EnvUtil::iExit($lang["Process define error"]);
             } else {
                 EnvUtil::iExit($notpass);
             }
         }
         $data = array("lang" => $lang, "notAllFinished" => $notAllFinished, "enableCount" => $prcsEnableCount, "prcsto" => $prcsArr, "prcsback" => $prcsback, "notpass" => isset($notpass) ? $notpass : "", "process" => $process->toArray(), "run" => $run->toArray(), "runid" => $runId, "flowid" => $flowId, "processid" => $processId, "flowprocess" => $flowProcess, "count" => $prcsArrCount, "prcsStop" => $prcsStop, "topflag" => $topflag, "list" => $list, "op" => $op);
         $this->ajaxReturn($data, "JSONP");
     }
 }
Ejemplo n.º 25
0
 public function actionVerify()
 {
     $flowID = intval(EnvUtil::getRequest("flowid"));
     if ($flowID) {
         $result = FlowType::model()->examFlow($flowID, true);
         $data = array("result" => $result, "lang" => Ibos::getLangSources());
         $this->renderPartial("verify", $data);
     }
 }
Ejemplo n.º 26
0
 public function actionShareFeed()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $post = $_POST;
         foreach ($post as $key => $val) {
             $post[$key] = StringUtil::filterCleanHtml($post[$key]);
         }
         if (empty($post["curid"])) {
             $map["feedid"] = $post["sid"];
         } else {
             $map["feedid"] = $post["curid"];
         }
         $map["isdel"] = 0;
         $isExist = Feed::model()->countByAttributes($map);
         if ($isExist == 0) {
             $return["isSuccess"] = false;
             $return["data"] = "内容已被删除,转发失败";
             $this->ajaxReturn($return);
         }
         $return = Feed::model()->shareFeed($post, "share");
         if ($return["isSuccess"]) {
             $module = $post["module"];
             if ($module == "weibo") {
                 UserUtil::updateCreditByAction("forwardweibo", Ibos::app()->user->uid);
                 $suid = Ibos::app()->db->createCommand()->select("uid")->from("{{feed}}")->where(sprintf("feedid = %d AND isdel = 0", $map["feedid"]))->queryScalar();
                 $suid && UserUtil::updateCreditByAction("forwardedweibo", $suid);
             }
             $lang = Ibos::getLangSources();
             $return["data"] = $this->renderPartial("feedlist", array("list" => array($return["data"]), "lang" => $lang), true);
         }
         $this->ajaxReturn($return);
     }
 }
Ejemplo n.º 27
0
 public function actionBind()
 {
     if (!$this->getIsMe()) {
         exit(Ibos::lang("Parameters error", "error"));
     }
     $op = EnvUtil::getRequest("op");
     if (!in_array($op, array("mobile", "email"))) {
         $op = "email";
     }
     $user = $this->getUser();
     $this->renderPartial("bind" . ucfirst($op), array("user" => $user, "lang" => Ibos::getLangSources()));
 }
Ejemplo n.º 28
0
 private function handleEmailContentData($bodyData)
 {
     $lang = Ibos::getLangSources();
     $contentData = array("lang" => $lang, "body" => $bodyData);
     $toids = !empty($bodyData["toids"]) ? explode(",", $bodyData["toids"]) : array();
     $copyToIds = !empty($bodyData["copytoids"]) ? explode(",", $bodyData["copytoids"]) : array();
     $toid = $copyToId = array();
     if (!empty($toids)) {
         $toUsers = User::model()->fetchAllByUids($toids);
         $toid = ConvertUtil::getSubByKey($toUsers, "realname");
     }
     if (!empty($copyToIds)) {
         $copyToUsers = User::model()->fetchAllByUids($copyToIds);
         $copyToId = ConvertUtil::getSubByKey($copyToUsers, "realname");
     }
     if (!empty($bodyData["towebmail"])) {
         $webMailAddress = explode(";", $bodyData["towebmail"]);
         $toid = array_merge($toid, $webMailAddress);
     }
     $contentData["toid"] = $toid;
     $contentData["copyToId"] = $copyToId;
     $content = $this->renderPartial("content", $contentData, true);
     return $content;
 }
Ejemplo n.º 29
0
 public function actionEdit()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $newPrcsId = intval(EnvUtil::getRequest("processid"));
         $oldPrcsId = intval(EnvUtil::getRequest("oldprcsid"));
         if ($newPrcsId != $oldPrcsId && FlowProcess::model()->checkProcessIdIsExist($this->flow->getID(), $newPrcsId)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Step number already exists")));
         }
         $this->setGuideProcess($this->flow, 3);
         $data = $this->beforeSave();
         FlowProcess::model()->updateAll($data, sprintf("flowid = %d AND processid = %d", $this->flow->getID(), $oldPrcsId));
         if ($newPrcsId != $oldPrcsId) {
             FlowProcess::model()->updateProcessto($this->flow->getID(), $oldPrcsId, $newPrcsId);
         }
         $process = new ICFlowProcess($this->flow->getID(), $data["processid"]);
         $return = $this->handleListData(array($process->toArray()));
         CacheUtil::rm("flowprocess_" . $this->flow->getID());
         $this->ajaxReturn(array("isSuccess" => true, "data" => array_shift($return)));
     } else {
         $processId = intval(EnvUtil::getRequest("processid"));
         $op = EnvUtil::getRequest("op");
         $opList = array("base", "field", "handle", "condition", "setting");
         if (!in_array($op, $opList)) {
             $op = "base";
         }
         $process = new ICFlowProcess($this->flow->getID(), $processId);
         $prcs = $process->toArray();
         if ($prcs["type"] == "1") {
             $op = "base";
         }
         $structure = $this->flow->form->parser->getStructure();
         $data = array("lang" => Ibos::getLangSources(array("workflow.item")), "prcs" => $prcs, "structure" => $structure, "op" => $op, "flows" => FlowType::model()->fetchAllFlow());
         $this->handleBase($data);
         $this->handleFormItem($data);
         $this->handleProcess($data);
         $this->renderPartial("edit", $data);
     }
 }
Ejemplo n.º 30
0
 private function save()
 {
     $uid = Ibos::app()->user->uid;
     $realname = User::model()->fetchRealnameByUid($uid);
     $originalPlan = $planOutside = array();
     if (array_key_exists("originalPlan", $_POST)) {
         $originalPlan = $_POST["originalPlan"];
     }
     if (array_key_exists("planOutside", $_POST)) {
         $planOutside = array_filter($_POST["planOutside"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
     }
     if (!empty($originalPlan)) {
         foreach ($originalPlan as $key => $value) {
             DiaryRecord::model()->modify($key, array("schedule" => $value));
         }
     }
     $date = $_POST["todayDate"] . " " . Ibos::lang("Weekday", "date") . DateTimeUtil::getWeekDay(strtotime($_POST["todayDate"]));
     $shareUidArr = isset($_POST["shareuid"]) ? StringUtil::getId($_POST["shareuid"]) : array();
     $diary = array("uid" => $uid, "diarytime" => strtotime($_POST["todayDate"]), "nextdiarytime" => strtotime($_POST["plantime"]), "addtime" => TIMESTAMP, "content" => $_POST["diaryContent"], "shareuid" => implode(",", $shareUidArr), "readeruid" => "", "remark" => "", "attention" => "");
     if (!empty($_POST["attachmentid"])) {
         AttachUtil::updateAttach($_POST["attachmentid"]);
     }
     $diary["attachmentid"] = $_POST["attachmentid"];
     $diaryId = Diary::model()->add($diary, true);
     if (!empty($planOutside)) {
         DiaryRecord::model()->addRecord($planOutside, $diaryId, strtotime($_POST["todayDate"]), $uid, "outside");
     }
     $plan = array_filter($_POST["plan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
     DiaryRecord::model()->addRecord($plan, $diaryId, strtotime($_POST["plantime"]), $uid, "new");
     $wbconf = WbCommonUtil::getSetting(true);
     if (isset($wbconf["wbmovement"]["diary"]) && $wbconf["wbmovement"]["diary"] == 1) {
         $supUid = UserUtil::getSupUid($uid);
         if (0 < intval($supUid)) {
             $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $realname . " " . $date . " " . Ibos::lang("Work diary"), "{url}" => Ibos::app()->urlManager->createUrl("diary/review/show", array("diaryid" => $diaryId)))), "body" => StringUtil::cutStr($diary["content"], 140), "actdesc" => Ibos::lang("Post diary"), "userid" => $supUid, "deptid" => "", "positionid" => "");
             WbfeedUtil::pushFeed($uid, "diary", "diary", $diaryId, $data);
         }
     }
     UserUtil::updateCreditByAction("adddiary", $uid);
     $upUid = UserUtil::getSupUid($uid);
     if (!empty($upUid)) {
         $config = array("{sender}" => User::model()->fetchRealnameByUid($uid), "{title}" => Ibos::lang("New diary title", "", array("{sub}" => $realname, "{date}" => $date)), "{content}" => $this->renderPartial("remindcontent", array("realname" => $realname, "date" => $date, "lang" => Ibos::getLangSources(), "originalPlan" => array_values($originalPlan), "planOutside" => array_values($planOutside), "content" => StringUtil::cutStr(strip_tags($_POST["diaryContent"]), 200), "plantime" => $_POST["plantime"] . " " . Ibos::lang("Weekday", "date") . DateTimeUtil::getWeekDay(strtotime($_POST["plantime"])), "plan" => array_values($plan)), true), "{url}" => Ibos::app()->urlManager->createUrl("diary/review/show", array("diaryid" => $diaryId)));
         Notify::model()->sendNotify($upUid, "diary_message", $config, $uid);
     }
     $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("default/index"));
 }