Exemplo n.º 1
0
 public function actionReview()
 {
     $op = EnvUtil::getRequest("op");
     $option = empty($op) ? "default" : $op;
     $routes = array("default", "show", "showdiary", "getsubordinates", "personal", "getStampIcon");
     if (!in_array($option, $routes)) {
         $this->error(Ibos::lang("Can not find the path"), $this->createUrl("default/index"));
     }
     $date = "today";
     if (array_key_exists("date", $_GET)) {
         $date = $_GET["date"];
     }
     if ($date == "today") {
         $time = strtotime(date("Y-m-d"));
         $date = date("Y-m-d");
     } elseif ($date == "yesterday") {
         $time = strtotime(date("Y-m-d")) - 24 * 60 * 60;
         $date = date("Y-m-d", $time);
     } else {
         $time = strtotime($date);
     }
     $uid = Ibos::app()->user->uid;
     $getSubUidArr = EnvUtil::getRequest("subUidArr");
     $user = EnvUtil::getRequest("user");
     if (!empty($getSubUidArr)) {
         $subUidArr = $getSubUidArr;
     } elseif (!empty($user)) {
         $subUidArr = array();
         foreach ($user as $v) {
             $subUidArr[] = $v["uid"];
         }
     } else {
         $subUidArr = User::model()->fetchSubUidByUid($uid);
     }
     $params = array();
     if (0 < count($subUidArr)) {
         $uids = implode(",", $subUidArr);
         $condition = "uid IN({$uids}) AND diarytime={$time}";
         $paginationData = Diary::model()->fetchAllByPage($condition, 100);
         $recordUidArr = $noRecordUidArr = $noRecordUserList = array();
         foreach ($paginationData["data"] as $diary) {
             $recordUidArr[] = $diary["uid"];
         }
         if (0 < count($recordUidArr)) {
             foreach ($subUidArr as $subUid) {
                 if (!in_array($subUid, $recordUidArr)) {
                     $noRecordUidArr[] = $subUid;
                 }
             }
         } else {
             $noRecordUidArr = $subUidArr;
         }
         if (0 < count($noRecordUidArr)) {
             $noRecordUserList = User::model()->fetchAllByPk($noRecordUidArr);
         }
         $params = array("pagination" => $paginationData["pagination"], "data" => ICDiary::processReviewListData($uid, $paginationData["data"]), "noRecordUserList" => $noRecordUserList);
     } else {
         $params = array("pagination" => new CPagination(0), "data" => array(), "noRecordUserList" => array());
     }
     $params["dateWeekDay"] = DiaryUtil::getDateAndWeekDay($date);
     $params["dashboardConfig"] = Yii::app()->setting->get("setting/diaryconfig");
     $params["subUidArr"] = $subUidArr;
     $params["prevAndNextDate"] = array("prev" => date("Y-m-d", strtotime($date) - 24 * 60 * 60), "next" => date("Y-m-d", strtotime($date) + 24 * 60 * 60), "prevTime" => strtotime($date) - 24 * 60 * 60, "nextTime" => strtotime($date) + 24 * 60 * 60);
     $this->ajaxReturn($params, "JSONP");
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $op = EnvUtil::getRequest("op");
     $option = empty($op) ? "default" : $op;
     $routes = array("default", "show", "showdiary", "getsubordinates", "getStampIcon");
     if (!in_array($option, $routes)) {
         $this->error(Ibos::lang("Can not find the path"), $this->createUrl("default/index"));
     }
     if ($option == "default") {
         $date = "yesterday";
         if (array_key_exists("date", $_GET)) {
             $date = $_GET["date"];
         }
         if ($date == "today") {
             $time = strtotime(date("Y-m-d"));
             $date = date("Y-m-d");
         } elseif ($date == "yesterday") {
             $time = strtotime(date("Y-m-d")) - 24 * 60 * 60;
             $date = date("Y-m-d", $time);
         } else {
             $time = strtotime($date);
         }
         $uid = Ibos::app()->user->uid;
         $getSubUids = EnvUtil::getRequest("uid");
         if (!empty($getSubUids)) {
             $subUidArr = explode(",", $getSubUids);
             foreach ($subUidArr as $subUid) {
                 if (!UserUtil::checkIsSub($uid, $subUid)) {
                     $this->error(Ibos::lang("Have not permission"), $this->createUrl("default/index"));
                 }
             }
         } else {
             $subUidArr = User::model()->fetchSubUidByUid($uid);
         }
         $params = array();
         $subUids = implode(",", $subUidArr);
         if (0 < count($subUidArr)) {
             $condition = "uid IN({$subUids}) AND diarytime={$time}";
             $paginationData = Diary::model()->fetchAllByPage($condition);
             $recordUidArr = $noRecordUidArr = $noRecordUserList = array();
             foreach ($paginationData["data"] as $diary) {
                 $recordUidArr[] = $diary["uid"];
             }
             if (0 < count($recordUidArr)) {
                 foreach ($subUidArr as $subUid) {
                     if (!in_array($subUid, $recordUidArr)) {
                         $noRecordUidArr[] = $subUid;
                     }
                 }
             } else {
                 $noRecordUidArr = $subUidArr;
             }
             if (0 < count($noRecordUidArr)) {
                 $noRecordUserList = User::model()->fetchAllByPk($noRecordUidArr);
             }
             $params = array("pagination" => $paginationData["pagination"], "data" => ICDiary::processReviewListData($uid, $paginationData["data"]), "noRecordUserList" => $noRecordUserList);
         } else {
             $params = array("pagination" => new CPagination(0), "data" => array(), "noRecordUserList" => array());
         }
         $params["date"] = $date;
         $params["dateWeekDay"] = DiaryUtil::getDateAndWeekDay($date);
         $params["dashboardConfig"] = $this->getDiaryConfig();
         $params["subUids"] = $subUids;
         $params["stamp"] = CJSON::encode($this->getStamp());
         $params["prevAndNextDate"] = array("prev" => date("Y-m-d", strtotime($date) - 24 * 60 * 60), "next" => date("Y-m-d", strtotime($date) + 24 * 60 * 60), "prevTime" => strtotime($date) - 24 * 60 * 60, "nextTime" => strtotime($date) + 24 * 60 * 60);
         $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 diary"))));
         $this->render("index", $params);
     } else {
         $this->{$option}();
     }
 }