예제 #1
0
 /**
  * The modules\defaultModule\controllers\indexController::IndexAction()
  * @by Zinux Generator <*****@*****.**>
  */
 public function IndexAction()
 {
     $limit = 20;
     $offset = (!isset($this->request->params["page"]) ? 0 : $this->request->params["page"] - 1) * $limit;
     $ds = new \modules\defaultModule\models\disqus();
     $this->view->query = $ds->get_latest_toptics($offset, $limit, @$this->request->params["tag"]);
     $this->view->current_page = floor($offset / $limit) + 1;
     $this->view->total_pages = ceil($ds->count(array('conditions' => 'parentid IS NULL')) / $limit);
 }
예제 #2
0
 /**
  * The \modules\defaultModule\controllers\disqusController::viewAction()
  * @by Zinux Generator <*****@*****.**>
  */
 public function viewAction()
 {
     $disqus_id = @$this->request->indexed_param[0];
     $limit = 10;
     $offset = (!isset($this->request->params["page"]) ? 0 : $this->request->params["page"] - 1) * $limit;
     $ds = new \modules\defaultModule\models\disqus();
     $qb = new \ActiveRecord\SQLBuilder($ds->connection(), $ds->table_name());
     $qb->select("*")->where("parentid = ? OR disqusid = ?", $disqus_id, $disqus_id)->offset($offset)->limit($limit)->order("created_at desc");
     $this->view->current_page = floor($offset / $limit) + 1;
     $this->view->total_pages = ceil($ds->count(array('conditions' => 'parentid IS NULL')) / $limit);
     $this->view->query = $ds->find_by_sql($qb->to_s(), $qb->bind_values());
     $this->view->disqus = \modules\defaultModule\models\disqus::first($disqus_id);
     $this->layout->AddTitle($this->view->disqus->title . " | iDisqus");
 }