public function getCount() { static $return = array(); if (empty($return)) { $time = $this->getTimeScope(); foreach ($this->getUid() as $uid) { $list = DiaryStats::model()->fetchAllStatisticsByUid($uid, $time["start"], $time["end"]); $return[$uid]["list"] = $this->ReplenishingScore($list); $return[$uid]["name"] = User::model()->fetchRealnameByUid($uid); } } return $return; }
public function getCount() { static $return = array(); if (empty($return)) { $return = array(); $time = $this->getTimeScope(); foreach ($this->getUid() as $uid) { $user = User::model()->fetchByUid($uid); $list = DiaryStats::model()->fetchAllStampByUid($uid, $time["start"], $time["end"]); $list = $this->handleStamp($list); $return[$uid]["name"] = $user["realname"]; $return[$uid]["list"] = $list; } } return $return; }
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"])) { $diaryid = $sourceInfo["diaryid"]; $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) { Diary::model()->modify($diaryid, array("isreview" => 1)); } else { Diary::model()->modify($diaryid, array("isreview" => 1, "stamp" => $stamp)); $uid = Diary::model()->fetchUidByDiaryId($diaryid); DiaryStats::model()->scoreDiary($diaryid, $uid, $stamp); } } }
protected function renderPersonal($time) { $uid = Ibos::app()->user->uid; $data = array("total" => Diary::model()->countDiaryTotalByUid($uid, $time["start"], $time["end"]), "beingreviews" => Diary::model()->countReviewTotalByUid($uid, $time["start"], $time["end"]), "ontimerate" => Diary::model()->countOnTimeRateByUid($uid, $time["start"], $time["end"]), "score" => DiaryStats::model()->countScoreByUid($uid, $time["start"], $time["end"])); $this->render(self::PERSONAL, $data); }
public function actionDel() { if (Ibos::app()->request->isAjaxRequest) { $diaryids = EnvUtil::getRequest("diaryids"); $uid = Ibos::app()->user->uid; if (empty($diaryids)) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Select at least one"))); } $pk = ""; if (strpos($diaryids, ",")) { $diaryids = trim($diaryids, ","); $pk = explode(",", $diaryids); } else { $pk = array($diaryids); } $diarys = Diary::model()->fetchAllByPk($pk); foreach ($diarys as $diary) { if (!ICDiary::checkReadScope($uid, $diary)) { $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to delete the log"))); } } $aids = Diary::model()->fetchAllAidByPks($pk); if ($aids) { AttachUtil::delAttach($aids); } $isInstallCalendar = ModuleUtil::getIsEnabled("calendar"); if ($isInstallCalendar) { Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_record}} where FIND_IN_SET(`did`, '{$diaryids}')) "); CalendarRecord::model()->deleteAll("did IN ({$diaryids})"); } Diary::model()->deleteByPk($pk); DiaryRecord::model()->deleteAll("diaryid IN ({$diaryids})"); DiaryStats::model()->deleteAll("diaryid IN ({$diaryids})"); $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Del succeed", "message"))); } }
private function changeIsreview($diaryid) { $diary = Diary::model()->fetchByPk($diaryid); if (!empty($diary) && UserUtil::checkIsUpUid($diary["uid"], Ibos::app()->user->uid)) { if ($diary["stamp"] == 0) { $stamp = $this->getAutoReviewStamp(); Diary::model()->modify($diaryid, array("isreview" => 1, "stamp" => $stamp)); DiaryStats::model()->scoreDiary($diary["diaryid"], $diary["uid"], $stamp); } else { Diary::model()->modify($diaryid, array("isreview" => 1)); } } }