예제 #1
0
 public function getCount()
 {
     static $return = array();
     if (empty($return)) {
         $time = $this->getTimeScope();
         $typeid = $this->getTypeid();
         foreach ($this->getUid() as $uid) {
             $list = ReportStats::model()->fetchAllStatisticsByUid($uid, $time["start"], $time["end"], $typeid);
             $return[$uid]["list"] = $this->ReplenishingScore($list);
             $return[$uid]["name"] = User::model()->fetchRealnameByUid($uid);
         }
     }
     return $return;
 }
예제 #2
0
 public function getCount()
 {
     static $return = array();
     if (empty($return)) {
         $return = array();
         $time = $this->getTimeScope();
         $typeid = $this->getTypeid();
         foreach ($this->getUid() as $uid) {
             $user = User::model()->fetchByUid($uid);
             $list = ReportStats::model()->fetchAllStampByUid($uid, $time["start"], $time["end"], $typeid);
             $list = $this->handleStamp($list);
             $return[$uid]["name"] = $user["realname"];
             $return[$uid]["list"] = $list;
         }
     }
     return $return;
 }
예제 #3
0
 protected function afterAdd($data, $sourceInfo)
 {
     if (isset($data["type"])) {
         if ($data["type"] == "reply") {
             $this->setParseView("comment", self::REPLY_PARSE_VIEW, "parse");
         } else {
             $this->setParseView("comment", self::COMMENT_PARSE_VIEW, "parse");
         }
     }
     if (isset($data["stamp"])) {
         $repid = $sourceInfo["repid"];
         $allStamp = Stamp::model()->fetchAll(array("select" => "id"));
         $stampArr = ConvertUtil::getSubByKey($allStamp, "id");
         $stamp = in_array($data["stamp"], $stampArr) ? intval($data["stamp"]) : 0;
         if ($stamp == 0) {
             Report::model()->modify($repid, array("isreview" => 1));
         } else {
             Report::model()->modify($repid, array("isreview" => 1, "stamp" => $stamp));
             $uid = Report::model()->fetchUidByRepId($repid);
             ReportStats::model()->scoreReport($repid, $uid, $stamp);
         }
     }
 }
예제 #4
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $repids = EnvUtil::getRequest("repids");
         $uid = Ibos::app()->user->uid;
         if (empty($repids)) {
             $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
         }
         $pk = "";
         if (strpos($repids, ",")) {
             $repids = trim($repids, ",");
             $pk = explode(",", $repids);
         } else {
             $pk = array($repids);
         }
         $reports = Report::model()->fetchAllByPk($pk);
         foreach ($reports as $report) {
             if ($report["uid"] != $uid) {
                 $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to delete the report")));
             }
         }
         $aids = Report::model()->fetchAllAidByRepids($pk);
         if ($aids) {
             AttachUtil::delAttach($aids);
         }
         $isInstallCalendar = ModuleUtil::getIsEnabled("calendar");
         if ($isInstallCalendar) {
             Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_rep_record}} where FIND_IN_SET(`repid`, '{$repids}')) ");
             CalendarRepRecord::model()->deleteAll("repid IN ({$repids})");
         }
         $delSuccess = Report::model()->deleteByPk($pk);
         if ($delSuccess) {
             ReportRecord::model()->deleteAll("repid IN('{$repids}')");
             ReportStats::model()->deleteAll("repid IN ({$repids})");
             $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Del succeed", "message")));
         } else {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Del failed", "message")));
         }
     }
 }
예제 #5
0
 /**
  * Enable the statistics reporting
  */
 public function useStatReporting()
 {
     self::$report_flag = true;
 }
예제 #6
0
 protected function renderPersonal($time, $typeid)
 {
     $uid = Ibos::app()->user->uid;
     $data = array("title" => $this->handleTitleByTypeid($typeid), "total" => Report::model()->countReportTotalByUid($uid, $time["start"], $time["end"], $typeid), "beingreviews" => Report::model()->countReviewTotalByUid($uid, $time["start"], $time["end"], $typeid), "score" => ReportStats::model()->countScoreByUid($uid, $time["start"], $time["end"], $typeid));
     $this->render(self::PERSONAL, $data);
 }
예제 #7
0
 private function changeIsreview($repid)
 {
     $report = Report::model()->fetchByPk($repid);
     if (!empty($report) && UserUtil::checkIsUpUid($report["uid"], Ibos::app()->user->uid)) {
         if ($report["stamp"] == 0) {
             $stamp = $this->getAutoReviewStamp();
             Report::model()->modify($repid, array("isreview" => 1, "stamp" => $stamp));
             ReportStats::model()->scoreReport($report["repid"], $report["uid"], $stamp);
         } else {
             Report::model()->modify($repid, array("isreview" => 1));
         }
     }
 }