protected function showDetail()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $isShowTitle = EnvUtil::getRequest("isShowTitle");
     $fromController = EnvUtil::getRequest("fromController");
     $report = Report::model()->fetchByPk($repid);
     $uid = Ibos::app()->user->uid;
     Report::model()->addReaderuid($report, $uid);
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = array();
     if (!empty($report["attachmentid"])) {
         $attachs = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
     }
     $readers = array();
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if ($report["stamp"] != 0) {
         $stamp = Stamp::model()->fetchStampById($report["stamp"]);
         $stampUrl = FileUtil::fileName(Stamp::STAMP_PATH) . $stamp;
     }
     $report["addtime"] = ConvertUtil::formatDate($report["addtime"], "u");
     $params = array("lang" => Ibos::getLangSource("report.default"), "repid" => $repid, "report" => $report, "uid" => $uid, "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "fromController" => $fromController, "isShowTitle" => $isShowTitle, "allowComment" => $this->getIsAllowComment($fromController));
     $detailAlias = "application.modules.report.views.detail";
     $detailView = $this->renderPartial($detailAlias, $params, true);
     $this->ajaxReturn(array("data" => $detailView, "isSuccess" => true));
 }
Beispiel #2
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $typeid = intval(EnvUtil::getRequest("typeid"));
         if (empty($typeid)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error")));
         }
         $removeSuccess = ReportType::model()->remove($typeid);
         if ($removeSuccess) {
             $reports = Report::model()->fetchRepidAndAidByTypeids($typeid);
             if (!empty($reports)) {
                 if ($reports["aids"]) {
                     AttachUtil::delAttach($reports["aids"]);
                 }
                 ReportRecord::model()->deleteAll("repid IN('{$reports["repids"]}')");
                 Report::model()->deleteAll("repid IN('{$reports["repids"]}')");
             }
             $return["isSuccess"] = true;
             $return["msg"] = Ibos::lang("Del succeed", "message");
         } else {
             $return["isSuccess"] = false;
             $return["msg"] = Ibos::lang("Del failed", "message");
         }
         $this->ajaxReturn($return);
     }
 }
Beispiel #3
0
 public function actionShow()
 {
     $repid = EnvUtil::getRequest("repid");
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("File does not exists", "error"), $this->createUrl("default/index"));
     }
     if ($report["uid"] != $uid) {
         $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("default/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]), "isInstallCalendar" => ModuleUtil::getIsEnabled("calendar"));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $this->setPageTitle(Ibos::lang("Show 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("Show report"))));
     $this->render("show", $params);
 }
Beispiel #4
0
 public function actionShow()
 {
     $repid = intval(EnvUtil::getRequest("repid"));
     $uid = Ibos::app()->user->uid;
     if (empty($repid)) {
         $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("review/index"));
     }
     $report = Report::model()->fetchByPk($repid);
     if (empty($report)) {
         $this->error(Ibos::lang("No data found", "error"), $this->createUrl("review/index"));
     }
     if ($report["uid"] == $uid) {
         $this->redirect($this->createUrl("default/show", array("repid" => $repid)));
     }
     $permission = ICReport::checkPermission($report, $uid);
     if (!$permission) {
         $this->error(Ibos::lang("You do not have permission to view the report"), $this->createUrl("review/index"));
     }
     $record = ReportRecord::model()->fetchAllRecordByRep($report);
     $attachs = $readers = array();
     if (!empty($report["attachmentid"])) {
         $attachments = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
         $attachs = array_values($attachments);
     }
     if (!empty($report["readeruid"])) {
         $readerArr = explode(",", $report["readeruid"]);
         $readers = User::model()->fetchAllByPk($readerArr);
     }
     $stampUrl = "";
     if (!empty($report["stamp"])) {
         $stampUrl = Stamp::model()->fetchStampById($report["stamp"]);
     }
     $params = array("report" => $report, "preAndNextRep" => Report::model()->fetchPreAndNextRep($report), "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "realname" => User::model()->fetchRealnameByUid($report["uid"]), "departmentName" => Department::model()->fetchDeptNameByUid($report["uid"]));
     if (!empty($params["nextPlanList"])) {
         $reportType = ReportType::model()->fetchByPk($report["typeid"]);
         $firstPlan = $params["nextPlanList"][0];
         $params["nextSubject"] = ICReport::handleShowSubject($reportType, $firstPlan["begindate"], $firstPlan["enddate"], 1);
     }
     $dashboardConfig = $this->getReportConfig();
     if ($dashboardConfig["stampenable"] && $dashboardConfig["autoreview"]) {
         $this->changeIsreview($repid);
     }
     $this->setPageTitle(Ibos::lang("Show 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("Show subordinate report"))));
     $this->render("show", $params);
 }