コード例 #1
0
ファイル: DefaultController.php プロジェクト: AxelPanda/ibos
 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));
     }
 }
コード例 #2
0
ファイル: DefaultController.php プロジェクト: AxelPanda/ibos
 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"));
         }
     }
 }
コード例 #3
0
ファイル: PersonalController.php プロジェクト: AxelPanda/ibos
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     $where = "isdel = 0 AND uid = " . $this->getUid() . ($this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid));
     switch ($type) {
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchAll($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchMovement($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid = %d", WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->count($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 %s AND feedid > %d AND uid = %d", $this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->getUid());
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->countFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     $count = isset($count) ? $count : WbConst::MAX_VIEW_FEED_NUMS;
     $pages = PageUtil::create($count, WbConst::DEF_LIST_FEED_NUMS);
     if (!isset($var["new"])) {
         $pages->route = "personal/index";
         $currentUrl = (string) Ibos::app()->getRequest()->getUrl();
         $replaceUrl = str_replace("weibo/personal/loadmore", "weibo/personal/index", $currentUrl);
         $data["pageData"] = $this->widget("IWPage", array("pages" => $pages, "currentUrl" => $replaceUrl), true);
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->getUid());
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
         }
         $data["html"] = $this->renderPartial("application.modules.message.views.feed.feedlist", array("list" => $list, "diggArr" => $diggArr), true);
     } else {
         $data["html"] = "";
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
コード例 #4
0
ファイル: WeiboController.php プロジェクト: AxelPanda/ibos
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     switch ($type) {
         case "following":
             $pages = PageUtil::create(1000, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "following", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND a.feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND a.type = '" . $var["feedtype"] . "'";
                 }
                 $list = Feed::model()->getFollowingFeed($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         case "newfollowing":
             $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
             if (0 < $var["maxId"]) {
                 $where .= " AND a.feedid > '" . intval($var["maxId"]) . "'";
                 $list = Feed::model()->getFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid <> %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     if (!isset($var["new"])) {
         $pages->route = "home/index";
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->uid);
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
             if (isset($v["attach_id"][0])) {
                 $_tmp = AttachUtil::getAttachData($v["attach_id"][0]);
                 $v["attach_url"] = FileUtil::getAttachUrl() . "/" . $_tmp[$v["attach_id"][0]]["attachment"];
             }
             if (isset($v["api_source"]["attach"][0]["attach_url"])) {
                 $v["api_source"]["attach_url"] = $v["api_source"]["attach"][0]["attach_url"];
                 unset($v["api_source"]["attach"]);
                 unset($v["api_source"]["source_body"]);
             }
             unset($v["user_info"]);
             unset($v["body"]);
             unset($v["sourceInfo"]);
             unset($v["api_source"]["source_user_info"]);
             unset($v["api_source"]["avatar_big"]);
             unset($v["api_source"]["avatar_middle"]);
             unset($v["api_source"]["avatar_small"]);
             unset($v["api_source"]["source_url"]);
             unset($v["feeddata"]);
         }
         $data["list"] = $list;
         $data["diggArr"] = $diggArr;
     } else {
         $data["list"] = array();
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
コード例 #5
0
ファイル: DefaultController.php プロジェクト: AxelPanda/ibos
 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"]);
     }
 }
コード例 #6
0
ファイル: DefaultController.php プロジェクト: AxelPanda/ibos
 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"));
 }
コード例 #7
0
 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"]);
     }
 }
コード例 #8
0
ファイル: Feed.php プロジェクト: AxelPanda/ibos
 private function mergeSearchMovementCondition($key, $loadId, $feedtype = "", $uid = 0)
 {
     $me = intval(Ibos::app()->user->uid);
     $map = array("and");
     if (!$uid) {
         $map[] = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($me);
     } else {
         $map[] = "a.isdel = 0 AND uid = " . $uid . ($me == $uid ? "" : " AND " . WbfeedUtil::getViewCondition($me));
     }
     !empty($loadId) && ($map[] = "a.feedid < " . intval($loadId));
     $map[] = array("LIKE", "b.feedcontent", "%" . StringUtil::filterCleanHtml($key) . "%");
     if ($feedtype) {
         $map[] = "a.module = " . $feedtype;
     } else {
         $map[] = "a.module != 'weibo'";
     }
     return $map;
 }