public function actionAdd() { $op = EnvUtil::getRequest("op"); if (!in_array($op, array("new", "save"))) { $op = "new"; } if ($op == "new") { $typeid = intval(EnvUtil::getRequest("typeid")); if (!$typeid) { $typeid = 1; } $uid = Ibos::app()->user->uid; $upUid = UserUtil::getSupUid($uid); $reportType = ReportType::model()->fetchByPk($typeid); $summaryAndPlanDate = ReportUtil::getDateByIntervalType($reportType["intervaltype"], $reportType["intervals"]); $subject = ICReport::handleShowSubject($reportType, strtotime($summaryAndPlanDate["summaryBegin"]), strtotime($summaryAndPlanDate["summaryEnd"])); $lastRep = Report::model()->fetchLastRepByUidAndTypeid($uid, $typeid); $orgPlanList = array(); if (!empty($lastRep)) { $orgPlanList = ReportRecord::model()->fetchRecordByRepidAndPlanflag($lastRep["repid"], 2); } $params = array("typeid" => $typeid, "summaryAndPlanDate" => $summaryAndPlanDate, "intervals" => $reportType["intervals"], "intervaltype" => $reportType["intervaltype"], "subject" => $subject, "upUid" => StringUtil::wrapId($upUid), "uploadConfig" => AttachUtil::getUploadConfig(), "orgPlanList" => $orgPlanList, "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar")); $this->setPageTitle(Ibos::lang("Add 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("Add report")))); $this->render("add", $params); } else { $this->{$op}(); } }