/** * Executes the widget. */ public function run() { if ($this->pagination->getPageCount() == $this->pagination->getCurrentPage() + 1) { return; } $showMoreUrl = CHtml::normalizeUrl(Yii::app()->createUrl('comment/comment/show', array('contentModel' => get_class($this->object), 'contentId' => $this->object->getPrimaryKey(), 'page' => $this->pagination->getCurrentPage() + 2))); $moreCount = $this->pagination->getPageSize(); if ($this->pagination->getPageCount() == $this->pagination->getCurrentPage() + 2) { $moreCount = $this->pagination->getItemCount() - $this->pagination->getPageSize() - $this->pagination->getOffset(); } $this->render('showMore', array('object' => $this->object, 'pagination' => $this->pagination, 'id' => get_class($this->object) . "_" . $this->object->getPrimaryKey(), 'showMoreUrl' => $showMoreUrl, 'moreCount' => $moreCount)); }
public function actionShow() { $uid = Ibos::app()->user->uid; $docid = EnvUtil::getRequest("id"); $version = EnvUtil::getRequest("version"); if (empty($docid)) { $this->ajaxReturn("", "JSONP"); } $officialDocEntity = new ICOfficialdoc($docid); $officialDoc = $officialDocEntity->getAttributes(); if ($version) { $versionData = OfficialdocVersion::model()->fetchByAttributes(array("docid" => $docid, "version" => $version)); $officialDoc = array_merge($officialDoc, $versionData); } if (!empty($officialDoc)) { if (!OfficialdocUtil::checkReadScope($uid, $officialDoc)) { $this->error(Ibos::lang("You do not have permission to read the officialdoc"), $this->createUrl("default/index")); } $data = ICOfficialdoc::getShowData($officialDoc); OfficialdocReader::model()->addReader($docid, $uid); Officialdoc::model()->updateClickCount($docid, $data["clickcount"]); $page = EnvUtil::getRequest("page"); $criteria = new CDbCriteria(); $pages = new CPagination(OfficialdocUtil::getCharacterLength($data["content"])); $pages->pageSize = 2000; $pages->applyLimit($criteria); $tmpContent = OfficialdocUtil::subHtml($data["content"], $pages->getCurrentPage() * $pages->getPageSize(), ($pages->getCurrentPage() + 1) * $pages->getPageSize()); $data["content"] = $tmpContent; if (!empty($page) && $page != 1) { $data["content"] = "<div><div style=\"border-bottom:4px solid #e26f50;margin-top:60px;\"></div><div style=\"border-top:1px solid #e26f50;margin-top:4px;\"><div><p style=\"text-align:center;\"></p><div id=\"original-content\" style=\"min-height:400px;font:16px/2 fangsong,simsun;color:#666;\"><table cellspacing=\"0\" cellpadding=\"0\" width=\"95%\" align=\"center\"><tbody><tr><td class=\"p1\"><span><p>" . $tmpContent . "</p>"; $data["content"] = OfficialdocUtil::subHtml($data["content"], 0, $pages->pageSize * 2); } $params = array("data" => $data, "pages" => $pages, "dashboardConfig" => Yii::app()->setting->get("setting/docconfig")); if ($data["rcid"]) { $params["rcType"] = RcType::model()->fetchByPk($data["rcid"]); } } else { $params = ""; } $this->ajaxReturn($params, "JSONP"); }
/** * 部门列表 */ public function actionList($page = 1) { $count = IMDepartment::model()->count(); $pager = new CPagination($count); $pager->pageSize = Yii::app()->params['perPage']; if (empty($page)) { $pager->currentPage = 1; } $list = IMDepartment::model()->findAll(array('order' => 'id DESC', 'offset' => $pager->getCurrentPage() * $pager->getPageSize(), 'limit' => $pager->pageSize)); foreach ($list as $v) { $data[] = $v->attributes; } $this->render('list', array('list' => $data, 'pager' => $pager)); }
/** * 群组列表 */ public function actionList($page = 1) { $count = IMGroup::model()->count(array('condition' => 'status = 0')); $pager = new CPagination($count); $pager->pageSize = Yii::app()->params['perPage']; if (empty($page)) { $pager->currentPage = 1; } $list = IMGroup::model()->findAll(array('condition' => 'status = 0', 'order' => 'groupId DESC', 'offset' => $pager->getCurrentPage() * $pager->getPageSize(), 'limit' => $pager->pageSize)); $data = array(); if (!empty($list)) { foreach ($list as $v) { $data[] = $v->attributes; } } $this->render('list', array('list' => $data, 'pager' => $pager)); }
/** * * 员工营业额统计 * */ public function actionTurnOver() { $str = Yii::app()->request->getParam('str', $this->companyId); $download = Yii::app()->request->getParam('d', 0); $beginTime = Yii::app()->request->getParam('begin_time', date('Y-m-d', time())); $endTime = Yii::app()->request->getParam('end_time', date('Y-m-d', time())); $db = Yii::app()->db; $sql = 'select t.* from (select username,sum(reality_total) as total from nb_order where order_status in (3,4,8) and dpid in (' . $str . ') and create_at >="' . $beginTime . ' 00:00:00" and create_at <="' . $endTime . ' 23:59:59" group by username order by lid desc)t'; if ($download) { $models = $db->createCommand($sql)->queryAll(); $this->exportTurnOver($models); exit; } $count = $db->createCommand(str_replace('t.*', 'count(*)', $sql))->queryScalar(); $pages = new CPagination($count); $pdata = $db->createCommand($sql . " LIMIT :offset,:limit"); $pdata->bindValue(':offset', $pages->getCurrentPage() * $pages->getPageSize()); $pdata->bindValue(':limit', $pages->getPageSize()); //$pages->getLimit(); $models = $pdata->queryAll(); $comName = $this->getComName(); $this->render('turnover', array('models' => $models, 'pages' => $pages, 'begin_time' => $beginTime, 'end_time' => $endTime, 'comName' => $comName, 'str' => $str)); }