public function actionSubSchedule() { $op = EnvUtil::getRequest("op"); if ($op == "getsubordinates") { $this->getsubordinates(); } elseif ($op == "list") { $this->getList(); } else { $workTime = Ibos::app()->setting->get("setting/calendarworkingtime"); $workingtime = explode(",", $workTime); $setting = array("worktimestart" => $workingtime[0], "worktimeend" => $workingtime[1], "allowAdd" => CalendarUtil::getIsAllowAdd(), "allowEdit" => CalendarUtil::getIsAllowEdit()); $getUid = EnvUtil::getRequest("uid"); if (!$getUid) { $deptArr = UserUtil::getManagerDeptSubUserByUid($this->uid); if (!empty($deptArr)) { $firstDept = reset($deptArr); $uid = $firstDept["user"][0]["uid"]; } else { $this->error(IBos::lang("You do not subordinate"), $this->createUrl("schedule/index")); } } else { $uid = $getUid; } if (!UserUtil::checkIsSub(Ibos::app()->user->uid, $uid)) { $this->error(Ibos::lang("No permission to view schedule"), $this->createUrl("schedule/index")); } $data = array("setting" => $setting, "user" => User::model()->fetchByUid($uid), "supUid" => UserUtil::getSupUid($this->uid)); $this->setPageTitle(Ibos::lang("Subordinate schedule")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Calendar arrangement"), "url" => $this->createUrl("schedule/index")), array("name" => Ibos::lang("Subordinate schedule")))); $this->render("subschedule", $data); } }
public function actionSubTask() { if (!UserUtil::checkIsSub(Ibos::app()->user->uid, $this->uid)) { $this->error(Ibos::lang("No permission to view task"), $this->createUrl("task/index")); } $postComp = EnvUtil::getRequest("complete"); $this->complete = empty($postComp) ? 0 : $postComp; if (EnvUtil::getRequest("param") == "search") { $this->search(); } $this->_condition = CalendarUtil::joinCondition($this->_condition, "uid = " . $this->uid); $data = Tasks::model()->fetchTaskByComplete($this->_condition, $this->complete); $data["complete"] = $this->complete; $data["user"] = User::model()->fetchByUid($this->uid); $data["supUid"] = UserUtil::getSupUid($this->uid); $data["allowEditTask"] = CalendarUtil::getIsAllowEidtTask(); $this->setPageTitle(Ibos::lang("Subordinate task")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Calendar arrangement"), "url" => $this->createUrl("schedule/index")), array("name" => Ibos::lang("Subordinate task")))); $this->render("subtask", $data); }
private function personal() { $uid = Ibos::app()->user->uid; $typeid = EnvUtil::getRequest("typeid"); $getUid = intval(EnvUtil::getRequest("uid")); $condition = "uid = '{$getUid}'"; if (!UserUtil::checkIsSub($uid, $getUid)) { $condition .= " AND FIND_IN_SET('{$uid}', toid )"; } if (!empty($typeid)) { $condition .= " AND typeid = '{$typeid}'"; } if (EnvUtil::getRequest("param") == "search") { $this->search(); } $this->_condition = ReportUtil::joinCondition($this->_condition, $condition); $paginationData = Report::model()->fetchAllByPage($this->_condition); $params = array("dashboardConfig" => Ibos::app()->setting->get("setting/reportconfig"), "typeid" => $typeid, "pagination" => $paginationData["pagination"], "reportList" => ICReport::handelListData($paginationData["data"]), "reportCount" => Report::model()->count("uid = '{$getUid}'"), "commentCount" => Report::model()->count("uid='{$getUid}' AND isreview=1"), "user" => User::model()->fetchByUid($getUid), "supUid" => UserUtil::getSupUid($getUid)); $this->setPageTitle(Ibos::lang("Review subordinate report")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Subordinate personal report")))); $this->render("personal", $params); }
public function actionEdit() { $op = EnvUtil::getRequest("op"); $repid = intval(EnvUtil::getRequest("repid")); $uid = Ibos::app()->user->uid; if (empty($op) || !in_array($op, array("getEditData", "update"))) { $op = "getEditData"; } if ($op == "getEditData") { if (empty($repid)) { $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index")); } $report = Report::model()->fetchByPk($repid); $reportType = ReportType::model()->fetchByPk($report["typeid"]); if (empty($report)) { $this->error(Ibos::lang("No data found", "error"), $this->createUrl("default/index")); } if ($report["uid"] != $uid) { $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("default/index")); } $upUid = UserUtil::getSupUid($uid); $record = ReportRecord::model()->fetchAllRecordByRep($report); $attachs = array(); if (!empty($report["attachmentid"])) { $attachs = AttachUtil::getAttach($report["attachmentid"]); } $params = array("report" => $report, "reportType" => $reportType, "upUid" => $upUid, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "uploadConfig" => AttachUtil::getUploadConfig(), "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar")); if (!empty($params["nextPlanList"])) { $firstPlan = $params["nextPlanList"][0]; $params["nextPlanDate"] = array("planBegindate" => $firstPlan["begindate"], "planEnddate" => $firstPlan["enddate"]); } else { $params["nextPlanDate"] = array("planBegindate" => 0, "planEnddate" => 0); } $this->setPageTitle(Ibos::lang("Edit report")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work report"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Edit report")))); $this->render("edit", $params); } else { $this->{$op}(); } }
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")); }
public function actionPersonal() { $uid = Ibos::app()->user->uid; $getUid = intval(EnvUtil::getRequest("uid")); if (!UserUtil::checkIsSub($uid, $getUid)) { $this->error(Ibos::lang("Have not permission"), $this->createUrl("review/index")); } if (EnvUtil::getRequest("param") == "search") { $this->search(); } $this->_condition = DiaryUtil::joinCondition($this->_condition, "uid = {$getUid}"); $paginationData = Diary::model()->fetchAllByPage($this->_condition); $supUid = UserUtil::getSupUid($getUid); $attention = DiaryAttention::model()->fetchAllByAttributes(array("uid" => $uid, "auid" => $getUid)); $data = array("pagination" => $paginationData["pagination"], "data" => ICDiary::processDefaultListData($paginationData["data"]), "diaryCount" => Diary::model()->count($this->_condition), "commentCount" => Diary::model()->countCommentByReview($getUid), "user" => User::model()->fetchByUid($getUid), "supUid" => $supUid, "dashboardConfig" => $this->getDiaryConfig(), "isattention" => empty($attention) ? 0 : 1); $this->setPageTitle(Ibos::lang("Review subordinate diary")); $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Work diary"), "url" => $this->createUrl("default/index")), array("name" => Ibos::lang("Subordinate personal diary")))); $this->render("personal", $data); }