예제 #1
0
 public function indexAction()
 {
     $this->_delete();
     $this->_multi();
     $page = (int) $this->_request->get("page", 1);
     if ($page < 1) {
         $page = 1;
     }
     $perPage = $this->_getPerPage();
     $sq1 = new Daq_Db_Query();
     $sq1->select("count(*) AS `c_all`")->from("Wpjb_Model_Job t2")->where("t2.job_type=t1.id");
     $sq2 = new Daq_Db_Query();
     $sq2->select("count(*) AS `c_active`")->from("Wpjb_Model_Job t3")->where("t3.job_type=t1.id")->where("t3.is_active = 1")->where("t3.is_approved = 1")->where("(t3.job_created_at > DATE_SUB(NOW(), INTERVAL t3.job_visible DAY)")->orWhere("t3.job_visible = 0)");
     $query = new Daq_Db_Query();
     $result = $query->select("t1.*, (" . $sq1->toString() . ") AS `c_all`, (" . $sq2->toString() . ")  AS `c_active`")->from("Wpjb_Model_JobType t1")->limitPage($page, $perPage);
     $result = $query->execute();
     $total = (int) $query->select("COUNT(*) as `total`")->limit(1)->fetchColumn();
     $this->view->current = $page;
     $this->view->total = ceil($total / $perPage);
     $this->view->data = $result;
 }