public static function getShowData($data) { $data["subject"] = stripslashes($data["subject"]); if (!empty($data["author"])) { $data["authorDeptName"] = Department::model()->fetchDeptNameByUid($data["author"]); } if ($data["approver"] != 0) { $data["approver"] = User::model()->fetchRealNameByUid($data["approver"]); } else { $data["approver"] = Ibos::lang("None"); } $data["addtime"] = ConvertUtil::formatDate($data["addtime"], "u"); $data["uptime"] = empty($data["uptime"]) ? "" : ConvertUtil::formatDate($data["uptime"], "u"); $data["categoryName"] = ArticleCategory::model()->fetchCateNameByCatid($data["catid"]); if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) { $data["departmentNames"] = Ibos::lang("All"); $data["positionNames"] = $data["uidNames"] = ""; } elseif ($data["deptid"] == "alldept") { $data["departmentNames"] = Ibos::lang("All"); $data["positionNames"] = $data["uidNames"] = ""; } else { $department = DepartmentUtil::loadDepartment(); $data["departmentNames"] = ArticleUtil::joinStringByArray($data["deptid"], $department, "deptname", "、"); $position = PositionUtil::loadPosition(); $data["positionNames"] = ArticleUtil::joinStringByArray($data["positionid"], $position, "posname", "、"); if (!empty($data["uid"])) { $users = User::model()->fetchAllByUids(explode(",", $data["uid"])); $data["uidNames"] = ArticleUtil::joinStringByArray($data["uid"], $users, "realname", "、"); } else { $data["uidNames"] = ""; } } return $data; }
public function getList($type = 1, $catid = 0, $search = "") { $gUid = Ibos::app()->user->uid; $childCatIds = ""; if (!empty($catid)) { $this->catid = $catid; $childCatIds = ArticleCategory::model()->fetchCatidByPid($this->catid, true); } if (!empty($search)) { $this->condition = "subject like '%{$search}%'"; } $articleidArr = ArticleReader::model()->fetchArticleidsByUid(Ibos::app()->user->uid); $this->condition = ArticleUtil::joinListCondition($type, $articleidArr, $childCatIds, $this->condition); $datas = Article::model()->fetchAllAndPage($this->condition); $listData = $datas["datas"]; foreach ($listData as $key => $value) { $value["content"] = StringUtil::cutStr(strip_tags($value["content"]), 30); $listData[$key] = array_filter($value); $listData[$key]["readstatus"] = ArticleReader::model()->checkIsRead($value["articleid"], $gUid); } $return["datas"] = $listData; $return["pages"] = array("pageCount" => $datas["pages"]->getPageCount(), "page" => $datas["pages"]->getCurrentPage(), "pageSize" => $datas["pages"]->getPageSize()); return $return; }
private function highLight() { if (Yii::app()->request->isAjaxRequest) { $articleids = trim(EnvUtil::getRequest("articleids"), ","); $highLight = array(); $highLight["endTime"] = EnvUtil::getRequest("highlightEndTime"); $highLight["bold"] = EnvUtil::getRequest("highlight_bold"); $highLight["color"] = EnvUtil::getRequest("highlight_color"); $highLight["italic"] = EnvUtil::getRequest("highlight_italic"); $highLight["underline"] = EnvUtil::getRequest("highlight_underline"); $data = ArticleUtil::processHighLightRequestData($highLight); if (empty($data["highlightendtime"])) { Article::model()->updateHighlightStatus($articleids, 0, "", ""); $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Unhighlighting success"))); } else { Article::model()->updateHighlightStatus($articleids, 1, $data["highlightstyle"], $data["highlightendtime"]); $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Highlight succeed"))); } } }