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); } }
protected function checkAddPermission() { if (!$this->checkIsMe() && (!UserUtil::checkIsSub(Ibos::app()->user->uid, $this->uid) || !CalendarUtil::getIsAllowAdd())) { return false; } else { return true; } }