Beispiel #1
0
 public function actionAdd()
 {
     if (EnvUtil::submitCheck("addsubmit")) {
         $this->beforeSave($_POST);
         $uid = Ibos::app()->user->uid;
         $assignment = $this->handlePostData();
         $assignment["designeeuid"] = $uid;
         $assignment["addtime"] = TIMESTAMP;
         $assignmentId = Assignment::model()->add($assignment, true);
         if (!empty($assignment["attachmentid"])) {
             AttachUtil::updateAttach($assignment["attachmentid"]);
         }
         $chargeuid = StringUtil::getId($_POST["chargeuid"]);
         $participantuid = StringUtil::getId($_POST["participantuid"]);
         $uidArr = array_merge($participantuid, $chargeuid);
         $this->sendNotify($assignmentId, $assignment["subject"], $uidArr, "assignment_new_message");
         $wbconf = WbCommonUtil::getSetting(true);
         if (isset($wbconf["wbmovement"]["assignment"]) && $wbconf["wbmovement"]["assignment"] == 1) {
             $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $assignment["subject"], "{url}" => Ibos::app()->urlManager->createUrl("assignment/default/show", array("assignmentId" => $assignmentId)))), "body" => $assignment["subject"], "actdesc" => Ibos::lang("Post assignment"), "userid" => implode(",", $uidArr), "deptid" => "", "positionid" => "");
             WbfeedUtil::pushFeed($uid, "assignment", "assignment", $assignmentId, $data, "post");
         }
         $this->addStepComment($assignmentId, Ibos::lang("Add the assignment"));
         AssignmentLog::model()->addLog($assignmentId, "add", Ibos::lang("Add the assignment"));
         $returnData = array("charge" => User::model()->fetchByUid($assignment["chargeuid"]), "id" => $assignmentId, "subject" => $assignment["subject"], "time" => date("m月d日 H:i", $assignment["starttime"]) . "--" . date("m月d日 H:i", $assignment["endtime"]));
         $this->ajaxReturn(array("isSuccess" => true, "data" => $returnData));
     }
 }
Beispiel #2
0
 private function save()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $postData = $_POST;
         $uid = Ibos::app()->user->uid;
         $postData["uid"] = $uid;
         $postData["subject"] = StringUtil::filterCleanHtml($_POST["subject"]);
         $toidArr = StringUtil::getId($postData["toid"]);
         $postData["toid"] = implode(",", $toidArr);
         $postData["begindate"] = strtotime($postData["begindate"]);
         $postData["enddate"] = strtotime($postData["enddate"]);
         $reportData = ICReport::handleSaveData($postData);
         $repid = Report::model()->add($reportData, true);
         if ($repid) {
             if (!empty($postData["attachmentid"])) {
                 AttachUtil::updateAttach($postData["attachmentid"]);
             }
             $orgPlan = $outSidePlan = array();
             if (array_key_exists("orgPlan", $_POST)) {
                 $orgPlan = $_POST["orgPlan"];
             }
             if (!empty($orgPlan)) {
                 foreach ($orgPlan as $recordid => $val) {
                     $updateData = array("process" => intval($val["process"]), "exedetail" => StringUtil::filterCleanHtml($val["exedetail"]));
                     if ($updateData["process"] == self::COMPLETE_FALG) {
                         $updateData["flag"] = 1;
                     }
                     ReportRecord::model()->modify($recordid, $updateData);
                 }
             }
             if (array_key_exists("outSidePlan", $_POST)) {
                 $outSidePlan = array_filter($_POST["outSidePlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
             }
             if (!empty($outSidePlan)) {
                 ReportRecord::model()->addPlans($outSidePlan, $repid, $postData["begindate"], $postData["enddate"], $uid, 1);
             }
             $nextPlan = array_filter($_POST["nextPlan"], create_function("\$v", "return !empty(\$v[\"content\"]);"));
             ReportRecord::model()->addPlans($nextPlan, $repid, strtotime($_POST["planBegindate"]), strtotime($_POST["planEnddate"]), $uid, 2);
             $wbconf = WbCommonUtil::getSetting(true);
             if (isset($wbconf["wbmovement"]["report"]) && $wbconf["wbmovement"]["report"] == 1) {
                 $userid = $postData["toid"];
                 $supUid = UserUtil::getSupUid($uid);
                 if (0 < intval($supUid) && !in_array($supUid, explode(",", $userid))) {
                     $userid = $userid . "," . $supUid;
                 }
                 $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $postData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid)))), "body" => StringUtil::cutStr($_POST["content"], 140), "actdesc" => Ibos::lang("Post report"), "userid" => trim($userid, ","), "deptid" => "", "positionid" => "");
                 WbfeedUtil::pushFeed($uid, "report", "report", $repid, $data);
             }
             UserUtil::updateCreditByAction("addreport", $uid);
             if (!empty($toidArr)) {
                 $config = array("{sender}" => User::model()->fetchRealnameByUid($uid), "{subject}" => $reportData["subject"], "{url}" => Ibos::app()->urlManager->createUrl("report/review/show", array("repid" => $repid)));
                 Notify::model()->sendNotify($toidArr, "report_message", $config, $uid);
             }
             $this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("default/index"));
         } else {
             $this->error(Ibos::lang("Save faild", "message"), $this->createUrl("default/index"));
         }
     }
 }
Beispiel #3
0
 private function verifyComplete($artId, $uid)
 {
     Article::model()->updateAllStatusAndApproverByPks($artId, $uid, 1);
     ArticleApproval::model()->deleteAll("articleid={$artId}");
     $article = Article::model()->fetchByPk($artId);
     if (!empty($article)) {
         $wbconf = WbCommonUtil::getSetting(true);
         if (isset($wbconf["wbmovement"]["article"]) && $wbconf["wbmovement"]["article"] == 1) {
             $publishScope = array("deptid" => $article["deptid"], "positionid" => $article["positionid"], "uid" => $article["uid"]);
             $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $article["subject"], "{url}" => Ibos::app()->urlManager->createUrl("article/default/index", array("op" => "show", "articleid" => $article["articleid"])))), "body" => $article["content"], "actdesc" => Ibos::lang("Post news"), "userid" => $publishScope["uid"], "deptid" => $publishScope["deptid"], "positionid" => $publishScope["positionid"]);
             if ($article["type"] == self::ARTICLE_TYPE_PICTURE) {
                 $type = "postimage";
                 $picture = ArticlePicture::model()->fetchByAttributes(array("articleid" => $article["articleid"]));
                 $data["attach_id"] = $picture["aid"];
             } else {
                 $type = "post";
             }
             WbfeedUtil::pushFeed($article["author"], "article", "article", $article["articleid"], $data, $type);
         }
         UserUtil::updateCreditByAction("addarticle", $article["author"]);
     }
 }
Beispiel #4
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"));
 }
 private function verifyComplete($docid, $uid)
 {
     Officialdoc::model()->updateAllStatusByDocids($docid, 1, $uid);
     OfficialdocApproval::model()->deleteAll("docid={$docid}");
     $doc = Officialdoc::model()->fetchByPk($docid);
     if (!empty($doc)) {
         $wbconf = WbCommonUtil::getSetting(true);
         if (isset($wbconf["wbmovement"]["article"]) && $wbconf["wbmovement"]["article"] == 1) {
             $publishScope = array("deptid" => $doc["deptid"], "positionid" => $doc["positionid"], "uid" => $doc["uid"]);
             $data = array("title" => Ibos::lang("Feed title", "", array("{subject}" => $doc["subject"], "{url}" => Ibos::app()->urlManager->createUrl("officialdoc/officialdoc/show", array("docid" => $doc["docid"])))), "body" => $doc["content"], "actdesc" => Ibos::lang("Post officialdoc"), "userid" => $publishScope["uid"], "deptid" => $publishScope["deptid"], "positionid" => $publishScope["positionid"]);
             WbfeedUtil::pushFeed($doc["author"], "officialdoc", "officialdoc", $doc["docid"], $data);
         }
         UserUtil::updateCreditByAction("addofficialdoc", $doc["author"]);
     }
 }