/** * */ public function __construct() { // set file for getDocs $this->setFile(__FILE__); // init dao class $this->dao = new Ihush_Dao(); // get from uri or global vars $this->reqId = Hush_Util::param('reqId') ? Hush_Util::param('reqId') : $GLOBALS['reqId']; }
/** * used by RequestPage::sendListAction */ public function getSendByPage($uid) { $eachPageNum = 10; $condition = $this->select()->join($this->t3, "{$this->t1}.{$this->k3} = {$this->t3}.{$this->k3}", null)->join($this->t4, "{$this->t1}.{$this->k4} = {$this->t4}.{$this->k4}", null)->where("{$this->t1}.author_id = ?", $uid)->order("{$this->t1}.{$this->k1} desc"); $condition2 = clone $condition; // used to buid $sql_list $sql_count = $condition->from($this->t1, array("count(1) as total")); $sql_list = $condition2->from($this->t1, array("{$this->t1}.*", "{$this->t3}.bpm_node_name", "{$this->t4}.bpm_flow_name"))->limitPage(Hush_Util::param('p'), $eachPageNum); $total = $this->dbr()->fetchOne($sql_count); $pager = new Ihush_Paging($total, $eachPageNum, null, array('Href' => '/request/sendList/p/{page}', 'Mode' => 2)); return array('list' => $this->dbr()->fetchAll($sql_list), 'page' => $pager->toArray()); }
/** * Paging Product List */ public function getListByPage($each = 5) { $sql_count = $this->select(); $sql_list = clone $sql_count; // used to build $sql_list $sql_count = $sql_count->from($this->t1, array("count(1) as total")); $sql_list = $sql_list->from($this->t1, array("{$this->t1}.*"))->limitPage(Hush_Util::param('p'), $each); $res_total = $this->dbr()->fetchOne($sql_count); $res_list = $this->dbr()->fetchAll($sql_list); require_once 'Hush/Paging.php'; $paging = new Hush_Paging($res_total, $each, null, array('Mode' => 2)); return array('page' => $paging->toArray(), 'list' => $res_list); }
/** * Check debug can be showed * Judge by url parameter named 'debug' * @param string $level * @return unknown */ public static function showDebug($str) { $debug_str = Hush_Util::param('debug'); if ($debug_str) { $debug_arr = explode(',', $debug_str); return in_array($str, $debug_arr); } return false; }
/** * Used by subpages for fetching all request * @access protected * @param string $key * @param mixed $value * @return mixed */ protected function param($key = '', $value = null) { return Hush_Util::param($key, $value); }