コード例 #1
0
 public function indexAction()
 {
     //$this->_forward('index', 'index', 'default');
     // set filters and validators for GET input
     $filters = array('page' => array('HtmlEntities', 'StripTags', 'StringTrim'));
     $validators = array('page' => array('Int'));
     $input = new Zend_Filter_Input($filters, $validators);
     $input->setData($this->getRequest()->getParams());
     if ($input->isValid()) {
         $q = Doctrine_Query::create()->from('Webteam_Model_Video i')->where('i.UserName = ?', $this->identity['UserName']);
         //$result = $q->fetchArray();
         //$this->view->records = $result;
         // configure pager
         $perPage = 10;
         $numPageLinks = 9;
         // initialize pager
         $pager = new Doctrine_Pager($q, $input->page, $perPage);
         // execute paged query
         $result = $pager->execute(array(), Doctrine::HYDRATE_ARRAY);
         // initialize pager layout
         $pagerRange = new Doctrine_Pager_Range_Sliding(array('chunk' => $numPageLinks), $pager);
         $pagerUrlBase = $this->view->url(array(), 'user-catalog-index', 1) . "/{%page}";
         $pagerLayout = new Doctrine_Pager_Layout($pager, $pagerRange, $pagerUrlBase);
         // set page link display template
         $pagerLayout->setTemplate('<a href="{%url}">{%page}</a>');
         $pagerLayout->setSelectedTemplate('<span class="current">{%page}</span>');
         $pagerLayout->setSeparatorTemplate('&nbsp;');
         // set view variables
         $this->view->records = $result;
         $this->view->pages = $pagerLayout->display(null, true);
     } else {
         throw new Zend_Controller_Action_Exception('Invalid input');
     }
 }
コード例 #2
0
 public function display($options = array(), $return = false)
 {
     $pager = $this->getPager();
     $str = '';
     // First page
     $this->addMaskReplacement('page', '<span class="nav_arrow">&laquo;</span>', true);
     $options['page_number'] = $pager->getFirstPage();
     $str .= $this->processPage($options);
     // Previous page
     $this->addMaskReplacement('page', '<span class="nav_arrow">&lsaquo;</span>', true);
     $options['page_number'] = $pager->getPreviousPage();
     $str .= $this->processPage($options);
     // Pages listing
     $this->removeMaskReplacement('page');
     $this->setSelectedTemplate('<li class="page_selected">[{%page}]</li>');
     $str .= parent::display($options, true);
     $this->setSelectedTemplate('<li>{%page}</li>');
     // Next page
     $this->addMaskReplacement('page', '<span class="nav_arrow">&rsaquo;</span>', true);
     $options['page_number'] = $pager->getNextPage();
     $str .= $this->processPage($options);
     // Last page
     $this->addMaskReplacement('page', '<span class="nav_arrow">&raquo;</span>', true);
     $options['page_number'] = $pager->getLastPage();
     $str .= $this->processPage($options);
     // Possible wish to return value instead of print it on screen
     if ($return) {
         return $str;
     }
     echo $str;
 }
コード例 #3
0
ファイル: PaginationFront.php プロジェクト: hoaitn/base-zend
 /**
  * 
  */
 public function PaginationFront($pager, $text = '', $Condition = array())
 {
     unset($Condition['page']);
     unset($Condition['msg']);
     $_t = '';
     if ($Condition) {
         foreach ($Condition as $key => $item) {
             if (is_array($item)) {
                 foreach ($item as $a => $b) {
                     $_t .= '&' . $key . '[' . $a . ']=' . $b;
                 }
             } else {
                 $_t .= '&' . $key . '=' . $item;
             }
         }
         $text = str_replace('{%Condition}', $_t, $text);
     }
     $pager_layout = new Doctrine_Pager_Layout($pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), $text);
     $pager_layout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pager_layout->setSelectedTemplate('<li class="active">{%page}</li>');
     $str .= '<li><a href="' . str_replace('{%page}', $pager->getFirstPage(), $text) . '">First</a></li>';
     $str .= '<li class="previous-off"><a href="' . str_replace('{%page}', $pager->getPreviousPage(), $text) . '">« Previous</a></li>';
     $str .= $pager_layout->display(array(), true);
     $str .= '<li class="next"><a href="' . str_replace('{%page}', $pager->getNextPage(), $text) . '" class="arr_right">Next »</a></li>';
     $str .= '<li><a href="' . str_replace('{%page}', $pager->getLastPage(), $text) . '">Last</a></li>';
     //$str .= '<div class="pages">Total of pages '.$pager->getNumResults() / $pager->_maxPerPage.'</div>';
     return $str;
 }
コード例 #4
0
ファイル: Pagination.php プロジェクト: hoaitn/base-zend
 /**
 * preDispatch function.
 * 
 * Define the layout path based on what module is being used.
 *
 * @author Aaron (bachya1208[at]googlemail.com)
 * @access public
 * @param Zend_Controller_Request_Abstract $request
 * @return void
 * <ul>
                 	<li class="Activities"><a href="#">1</a></li>
                     <li><a href="#">2</a></li>
                     <li><a href="#">3</a></li>
                     <li><a href="#">Next >></a></li>
                 </ul>
 */
 public function Pagination($pager, $text = '', $Condition = array(), $style = '')
 {
     unset($Condition['page']);
     unset($Condition['msg']);
     $_t = '';
     foreach ($Condition as $key => $item) {
         if (is_array($item)) {
             foreach ($item as $a => $b) {
                 $_t .= '&' . $key . '[' . $a . ']=' . $b;
             }
         } else {
             $_t .= '&' . $key . '=' . $item;
         }
     }
     $text = str_replace('{%Condition}', $_t, $text);
     $pager_layout = new Doctrine_Pager_Layout($pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), $text);
     $pager_layout->setTemplate('<li><a class="normal" href="{%url}">{%page}</a></li>');
     $pager_layout->setSelectedTemplate('<li class="active">{%page}</li>');
     $str = '<ul class="pagination">';
     if ($pager->getPage() > 1) {
         $str .= '<li><a href="' . str_replace('{%page}', $pager->getPreviousPage(), $text) . '" class="prev">Previous</a></li>';
     }
     $str .= $pager_layout->display(array(), true);
     if ($pager->getPage() < $pager->getLastPage()) {
         $str .= '<li><a href="' . str_replace('{%page}', $pager->getNextPage(), $text) . '" class="arr_right">Next</a></li>';
     }
     $str .= '</ul>';
     if ($style == 'advanced') {
         $str = '<b>Trang:</b> ' . ($str .= '<br>' . 'Hiển thị ' . $pager->getFirstIndice() . ' - ' . $pager->getLastIndice() . ' của ' . $pager->getNumResults() . '/ ' . $pager->getLastPage() . ' trang');
     }
     return $str;
 }
コード例 #5
0
ファイル: PagerLayout.php プロジェクト: baowzh/renfangbaosong
 public function display($options = array(), $return = false)
 {
     $pager = $this->getPager();
     $str = '';
     // First page
     $this->addMaskReplacement('page', '&laquo;', true);
     $options['page_number'] = $pager->getFirstPage();
     $str .= $this->processPage($options);
     // Previous page
     $this->addMaskReplacement('page', '&lsaquo;', true);
     $options['page_number'] = $pager->getPreviousPage();
     $str .= $this->processPage($options);
     // Pages listing
     $this->removeMaskReplacement('page');
     $str .= parent::display($options, true);
     // Next page
     $this->addMaskReplacement('page', '&rsaquo;', true);
     $options['page_number'] = $pager->getNextPage();
     $str .= $this->processPage($options);
     // Last page
     $this->addMaskReplacement('page', '&raquo;', true);
     $options['page_number'] = $pager->getLastPage();
     $str .= $this->processPage($options);
     // Possible wish to return value instead of print it on screen
     if ($return) {
         return $str;
     }
     echo $str;
 }
コード例 #6
0
ファイル: Pagination.php プロジェクト: hoaitn/base-zend
 /**
 * preDispatch function.
 * 
 * Define the layout path based on what module is being used.
 *
 * @author Aaron (bachya1208[at]googlemail.com)
 * @access public
 * @param Zend_Controller_Request_Abstract $request
 * @return void
 * <ul>
                 	<li class="Activities"><a href="#">1</a></li>
                     <li><a href="#">2</a></li>
                     <li><a href="#">3</a></li>
                     <li><a href="#">Next >></a></li>
                 </ul>
 */
 public function Pagination($pager, $text = '', $Condition = array(), $style = '')
 {
     unset($Condition['page']);
     unset($Condition['msg']);
     $_t = '';
     foreach ($Condition as $key => $item) {
         if (is_array($item)) {
             foreach ($item as $a => $b) {
                 $_t .= '&' . $key . '[' . $a . ']=' . $b;
             }
         } else {
             $_t .= '&' . $key . '=' . $item;
         }
     }
     $text = str_replace('{%Condition}', $_t, $text);
     $pager_layout = new Doctrine_Pager_Layout($pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), $text);
     $pager_layout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pager_layout->setSelectedTemplate('<li><a class="current" title="{%page}" href="#">{%page}</a></li>');
     $str = '<ul class="controls-buttons">';
     if ($pager->getPage() > 1) {
         $str .= '<li><a title="Previous" href="' . str_replace('{%page}', $pager->getPreviousPage(), $text) . '"><img height="16" width="16" src="http://' . $_SERVER['HTTP_HOST'] . '/images/icons/fugue/navigation-180.png">Previous</a></li>';
     }
     $str .= $pager_layout->display(array(), true);
     if ($pager->getPage() < $pager->getLastPage()) {
         $str .= '<li><a title="Next" href="' . str_replace('{%page}', $pager->getNextPage(), $text) . '">Next<img height="16" width="16" src="http://' . $_SERVER['HTTP_HOST'] . '/images/icons/fugue/navigation.png"></a></li>';
     }
     $str .= '</ul>';
     // 		if ($style == 'advanced')
     // 			$str = '<b>Trang:</b> ' . $str .= '<br>' . 'Hiển thị ' . $pager->getFirstIndice () . ' - ' . $pager->getLastIndice () . ' của ' . $pager->getNumResults () . '/ ' . $pager->getLastPage () . ' trang';
     return $str;
 }
コード例 #7
0
ファイル: htPagerLayout.php プロジェクト: limitium/uberlov
 public function display($options = array(), $return = false)
 {
     $pager = $this->getPager();
     $str = '<div class="pager">';
     $str .= '<div class="prevnext">';
     // Previous page
     if ($pager->getPage() != 1) {
         $this->addMaskReplacement('page', '← туда', true);
         $options['page_number'] = $pager->getPreviousPage();
         $str .= $this->processPage($options);
     }
     // Next page
     if ($pager->getPage() != $pager->getLastPage()) {
         $this->addMaskReplacement('page', 'сюда →', true);
         $options['page_number'] = $pager->getNextPage();
         $str .= $this->processPage($options);
     }
     $str .= '</div>';
     $str .= '<ul>';
     // First page
     if ($pager->getPage() > $this->getPagerRange()->getOption('chunk') - floor($this->getPagerRange()->getOption('chunk') / 2)) {
         $str .= '<li>';
         $options['page_number'] = $pager->getFirstPage();
         $this->removeMaskReplacement('page');
         $str .= $this->processPage($options) . '...';
         $str .= '</li>';
     }
     // Pages listing
     if ($this->getPager()->haveToPaginate()) {
         $str .= '<li>';
         $this->removeMaskReplacement('page');
         $this->setSeparatorTemplate('</li><li>');
         $str .= parent::display($options, true);
         $this->setSeparatorTemplate('');
         $str .= '</li>';
     }
     // Last page
     if ($pager->getPage() < $pager->getLastPage() - floor($this->getPagerRange()->getOption('chunk') / 2)) {
         $str .= '<li>';
         $options['page_number'] = $pager->getLastPage();
         $str .= '...' . $this->processPage($options);
         $str .= '</li>';
     }
     $str .= '</ul>';
     $str .= '</div>';
     // Possible wish to return value instead of print it on screen
     if ($return) {
         return $str;
     }
     echo $str;
 }
コード例 #8
0
ファイル: PaginationFront.php プロジェクト: hoaitn/base-zend
 /**
  * 
  */
 public function PaginationFront($pager, $text = '', $Condition = array())
 {
     unset($Condition['page']);
     unset($Condition['msg']);
     $_t = '';
     if ($Condition) {
         foreach ($Condition as $key => $item) {
             if (is_array($item)) {
                 foreach ($item as $a => $b) {
                     $_t .= '&' . $key . '[' . $a . ']=' . $b;
                 }
             } else {
                 $_t .= '&' . $key . '=' . $item;
             }
         }
         $text = str_replace('{%Condition}', $_t, $text);
     }
     $pager_layout = new Doctrine_Pager_Layout($pager, new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), $text);
     $pager_layout->setTemplate('<a href="{%url}">{%page}</a>');
     $pager_layout->setSelectedTemplate('<span class="current">{%page}</span>');
     $str .= '<a href="' . str_replace('{%page}', $pager->getFirstPage(), $text) . '">First</a>';
     $str .= '<a href="' . str_replace('{%page}', $pager->getPreviousPage(), $text) . '"><<</a>';
     $str .= $pager_layout->display(array(), true);
     $str .= '<a href="' . str_replace('{%page}', $pager->getNextPage(), $text) . '" class="arr_right">>></a>';
     $str .= '<a href="' . str_replace('{%page}', $pager->getLastPage(), $text) . '">Last</a>';
     //$str .= '<div class="pages">Total of pages '.$pager->getNumResults() / $pager->_maxPerPage.'</div>';
     return $str;
     //
     //<a href="/state/1/new-south-wales">First</a> ...
     //
     //<a href="/state/1/new-south-wales/50/100">«</a>
     //
     //
     //<a href="/state/1/new-south-wales/50/0">1</a>
     //
     //
     //
     //<a href="/state/1/new-south-wales/50/200">»</a>
     //
     //... <a href="/state/1/new-south-wales/50/1000">Last</a>
     //<div class="pages">Total of pages</div>
 }
コード例 #9
0
 public function display($options = array(), $return = false)
 {
     $pager = $this->getPager();
     $str = '';
     $this->addMaskReplacement('page', '<<', true);
     $options['page_number'] = $pager->getFirstPage();
     $str .= $this->processPage($options);
     $this->addMaskReplacement('page', '<', true);
     $options['page_number'] = $pager->getPreviousPage();
     $str .= $this->processPage($options);
     $this->removeMaskReplacement('page');
     $str .= parent::display($options, true);
     $this->addMaskReplacement('page', '>', true);
     $options['page_number'] = $pager->getNextPage();
     $str .= $this->processPage($options);
     $this->addMaskReplacement('page', '>>', true);
     $options['page_number'] = $pager->getLastPage();
     $str .= $this->processPage($options);
     if ($return) {
         return $str;
     }
     echo $str;
 }
コード例 #10
0
ファイル: OrdersItems.php プロジェクト: moay/shineisp
 /**
  * findAll
  * Get records the orders from the DB
  * @param $currentPage
  * @param $rowNum
  * @param $sort
  * @param $where
  * @return array
  */
 public static function findAll($fields = "*", $currentPage = 1, $rowNum = 2, array $sort = array(), array $where = array(), $locale = 1)
 {
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     try {
         // Defining the url sort
         $uri = isset($sort[1]) ? "/sort/{$sort['1']}" : "";
         $dq = Doctrine_Query::create()->select($fields)->from('OrdersItems d')->leftJoin('d.Orders o')->leftJoin('d.OrdersItemsDomains oid ON d.detail_id = oid.orderitem_id')->leftJoin('d.BillingCycle bc')->leftJoin('oid.Domains dm')->leftJoin('dm.DomainsTlds dt')->leftJoin('dt.WhoisServers ws')->leftJoin('d.Products p')->leftJoin("p.ProductsData pd WITH pd.language_id = {$locale}")->leftJoin('p.Taxes t')->leftJoin('o.Customers c')->leftJoin('d.Statuses s')->where('p.type <> ?', 'domain');
         // Show all the records but not the Expired services // Show only the services and not the domains
         $pagerLayout = new Doctrine_Pager_Layout(new Doctrine_Pager($dq, $currentPage, $rowNum), new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), "/{$module}/{$controller}/list/page/{%page_number}" . $uri);
         // Get the pager object
         $pager = $pagerLayout->getPager();
         // Set the Order criteria
         if (isset($sort[0])) {
             $pager->getQuery()->orderBy($sort[0]);
         }
         if (isset($where) && is_array($where)) {
             foreach ($where as $filters) {
                 if (isset($filters[0]) && is_array($filters[0])) {
                     foreach ($filters as $filter) {
                         $method = $filter['method'];
                         $value = $filter['value'];
                         $criteria = $filter['criteria'];
                         $pager->getQuery()->{$method}($criteria, $value);
                     }
                 } else {
                     $method = $filters['method'];
                     $value = $filters['value'];
                     $criteria = $filters['criteria'];
                     $pager->getQuery()->{$method}($criteria, $value);
                 }
             }
         }
         $pagerLayout->setTemplate('<a href="{%url}">{%page}</a> ');
         $pagerLayout->setSelectedTemplate('<a class="active" href="{%url}">{%page}</a> ');
         $records = $pagerLayout->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
         $pagination = $pagerLayout->display(null, true);
         return array('records' => $records, 'pagination' => $pagination, 'pager' => $pager, 'recordcount' => $dq->count());
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
コード例 #11
0
ファイル: Orders.php プロジェクト: kokkez/shineisp
 /**
  * Get records the orders from the DB
  *
  * @param $currentPage
  * @param $rowNum
  * @param $sort
  * @param $where
  * @return array
  */
 public static function findAll($fields = "*", $currentPage = 1, $rowNum = 2, array $sort = array(), array $where = array())
 {
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     // Defining the url sort
     $uri = isset($sort[1]) ? "/sort/{$sort['1']}" : "";
     $dq = self::getDQL()->select($fields)->orderBy('order_date desc');
     $pagerLayout = new Doctrine_Pager_Layout(new Doctrine_Pager($dq, $currentPage, $rowNum), new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), "/{$module}/{$controller}/list/page/{%page_number}" . $uri);
     // Get the pager object
     $pager = $pagerLayout->getPager();
     // Set the Order criteria
     if (isset($sort[0])) {
         $pager->getQuery()->orderBy($sort[0]);
     }
     if (isset($where) && is_array($where)) {
         foreach ($where as $filters) {
             if (isset($filters[0]) && is_array($filters[0])) {
                 foreach ($filters as $filter) {
                     $method = $filter['method'];
                     $value = $filter['value'];
                     $criteria = $filter['criteria'];
                     $pager->getQuery()->{$method}($criteria, $value);
                 }
             } else {
                 $method = $filters['method'];
                 $value = $filters['value'];
                 $criteria = $filters['criteria'];
                 $pager->getQuery()->{$method}($criteria, $value);
             }
         }
     }
     $pagerLayout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pagerLayout->setSelectedTemplate('<li class="active"><a href="{%url}">{%page}</a></li>');
     $orders = $pagerLayout->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $pagination = $pagerLayout->display(null, true);
     return array('records' => $orders, 'pagination' => $pagination, 'pager' => $pager, 'recordcount' => $dq->count());
 }
コード例 #12
0
ファイル: Datagrid.php プロジェクト: kokkez/shineisp
 /**
  * getRecords
  * Get records from the DB
  * @return mixed
  */
 public function getRecords(Doctrine_Query $dq, $currentPage = 1, $rowNum = 2, array $sort = array(), array $where = array())
 {
     $uri = "";
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     // Defining the url sort
     if (!empty($sort)) {
         foreach ($sort as $s) {
             $arrSort[] = "/sort/" . str_replace(" ", ",", $s);
         }
         $arrSort = array_unique($arrSort);
         $uri = implode("", $arrSort);
     }
     $pagerLayout = new Doctrine_Pager_Layout(new Doctrine_Pager($dq, $currentPage, $rowNum), new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), "/{$module}/{$controller}/list/page/{%page_number}" . $uri);
     // Get the pager object
     $pager = $pagerLayout->getPager();
     // Set the Order criteria
     if (!empty($sort)) {
         $pager->getQuery()->orderBy(implode(", ", $sort));
     }
     if (isset($where) && is_array($where)) {
         foreach ($where as $filters) {
             if (isset($filters[0]) && is_array($filters[0])) {
                 foreach ($filters as $filter) {
                     $method = $filter['method'];
                     $value = $filter['value'];
                     $criteria = $filter['criteria'];
                     $pager->getQuery()->{$method}($criteria, $value);
                 }
             } else {
                 $method = $filters['method'];
                 $value = $filters['value'];
                 $criteria = $filters['criteria'];
                 $pager->getQuery()->{$method}($criteria, $value);
             }
         }
     }
     $pagerLayout->setTemplate('<a href="{%url}">{%page}</a> ');
     $pagerLayout->setSelectedTemplate('<a class="active" href="{%url}">{%page}</a> ');
     $this->data = $pagerLayout->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $this->paging = $pagerLayout->display(null, true);
     $this->recordcount = $dq->count();
     #print_r ( $this->data );
     return $this;
 }
コード例 #13
0
ファイル: Domains.php プロジェクト: kokkez/shineisp
 /**
  * findAll
  * Get records the domains from the DB
  * @param $currentPage
  * @param $rowNum
  * @param $sort
  * @param $where
  * @return array
  */
 public static function findAll($fields = "*", $currentPage = 1, $rowNum = 2, array $sort = array(), array $where = array())
 {
     $module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     // Defining the url sort
     $uri = isset($sort[1]) ? "/sort/{$sort['1']}" : "";
     $dq = Doctrine_Query::create()->select($fields)->from('Domains d')->leftJoin('d.DomainsTlds dt')->leftJoin('dt.WhoisServers ws')->leftJoin('d.TagsConnections tc')->leftJoin('d.Customers c')->leftJoin('c.Customers r')->leftJoin('d.OrdersItems oi')->leftJoin('d.Statuses s')->orderBy('d.domain')->addWhere("c.isp_id = ?", Isp::getCurrentId());
     $pagerLayout = new Doctrine_Pager_Layout(new Doctrine_Pager($dq, $currentPage, $rowNum), new Doctrine_Pager_Range_Sliding(array('chunk' => 10)), "/{$module}/{$controller}/list/page/{%page_number}" . $uri);
     // Get the pager object
     $pager = $pagerLayout->getPager();
     // Set the Order criteria
     if (isset($sort[0])) {
         $pager->getQuery()->orderBy($sort[0]);
     }
     if (isset($where) && is_array($where)) {
         foreach ($where as $filters) {
             if (isset($filters[0]) && is_array($filters[0])) {
                 foreach ($filters as $filter) {
                     $method = $filter['method'];
                     $value = $filter['value'];
                     $criteria = $filter['criteria'];
                     $pager->getQuery()->{$method}($criteria, $value);
                 }
             } else {
                 $method = $filters['method'];
                 $value = $filters['value'];
                 $criteria = $filters['criteria'];
                 $pager->getQuery()->{$method}($criteria, $value);
             }
         }
     }
     $pagerLayout->setTemplate('<li><a href="{%url}">{%page}</a></li>');
     $pagerLayout->setSelectedTemplate('<li class="active"><a href="{%url}">{%page}</a></li>');
     $domains = $pagerLayout->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $pagination = $pagerLayout->display(null, true);
     return array('records' => $domains, 'pagination' => $pagination, 'pager' => $pager, 'recordcount' => $dq->count());
 }
コード例 #14
0
ファイル: paginacao.php プロジェクト: patrix/oraculum
        $pagerlayout->setTemplate('<a href="{%url}">{%page}</a>');
        $pagerlayout->setSelectedTemplate('<span>{%page}</span>');
        $pager = $pagerlayout->getPager();
        $users = $pager->execute();
        if ($pager->haveToPaginate()) {
            $retorno .= "<div>\n";
            if ($pager->getFirstPage() != $pager->getPage()) {
                $retorno .= "<a href=\"" . $urlpager . "page/" . $pager->getFirstPage() . "\" class=\"btnxt\">&lt;&lt;</a>";
            } else {
                $retorno .= "<span class=\"disabled\">&lt;&lt;</span>";
            }
            if ($pager->getPreviousPage() != $pager->getPage()) {
                $retorno .= "<a href=\"" . $urlpager . "page/" . $pager->getPreviousPage() . "\" class=\"btnxt\">&lt;</a>";
            } else {
                $retorno .= "<span class=\"disabled\">&lt;</span>";
            }
            $retorno .= $pagerlayout->display(array(), true);
            if ($pager->getNextPage() != $pager->getPage()) {
                $retorno .= "<a href=\"" . $urlpager . "page/" . $pager->getNextPage() . "\" class=\"btnxt\">&gt;</a>";
            } else {
                $retorno .= "<span class=\"disabled\">&gt;</span>";
            }
            if ($pager->getLastPage() != $pager->getPage()) {
                $retorno .= "<a href=\"" . $urlpager . "page/" . $pager->getLastPage() . "\" class=\"btnxt\">&gt;&gt;</a>";
            } else {
                $retorno .= "<span class=\"disabled\">&gt;&gt;</span>";
            }
            $retorno .= "</div>\n";
        }
    }
}
コード例 #15
0
 public function videoTraceAction()
 {
     // set filters and validators for GET input
     $filters = array('VideoID' => array('HtmlEntities', 'StripTags', 'StringTrim'));
     $validators = array('VideoID' => array('Int'));
     $input = new Zend_Filter_Input($filters, $validators);
     $data = array('VideoID' => $this->getRequest()->getParam('q'));
     $input->setData($data);
     if ($input->isValid()) {
         //check if vidoe id exists
         $q = Doctrine_Query::create()->from('Webteam_Model_Video i')->where('i.VideoID = ?', $input->VideoID);
         $result = $q->fetchArray();
         $count = count($result);
         if ($count >= 1) {
             $q = Doctrine_Query::create()->from('Webteam_Model_Log i')->where('i.VideoID = ?', $input->VideoID);
             $result = $q->fetchArray();
             //$this->view->records = $result;
             //$this->view->VideoID = $input->VideoID;
             $this->view->VideoID = $input->VideoID;
             $filters = array('page' => array('HtmlEntities', 'StripTags', 'StringTrim'));
             $validators = array('page' => array('Int'));
             $input = new Zend_Filter_Input($filters, $validators);
             $page = $this->getRequest()->getParam('page');
             if (!isset($page)) {
                 $data = array('page' => 1);
             } else {
                 $data = array('page' => $this->getRequest()->getParam('page'));
             }
             $input->setData($data);
             if ($input->isValid()) {
                 $perPage = 10;
                 $numPageLinks = 9;
                 // initialize pager
                 $pager = new Doctrine_Pager($q, $input->page, $perPage);
                 // execute paged query
                 $result = $pager->execute(array(), Doctrine::HYDRATE_ARRAY);
                 // initialize pager layout
                 $pagerRange = new Doctrine_Pager_Range_Sliding(array('chunk' => $numPageLinks), $pager);
                 $pagerUrlBase = $this->view->url(array(), 'report-video-trace', 1) . '?q=' . $this->view->VideoID . '&page=' . "{%page}";
                 $pagerLayout = new Doctrine_Pager_Layout($pager, $pagerRange, $pagerUrlBase);
                 // set page link display template
                 $pagerLayout->setTemplate('<a href="{%url}">{%page}</a>');
                 $pagerLayout->setSelectedTemplate('<span class="current">{%page}</span>');
                 $pagerLayout->setSeparatorTemplate('&nbsp;');
                 // set view variables
                 $this->view->records = $result;
                 $this->view->pages = $pagerLayout->display(null, true);
             } else {
                 //invalid page
             }
         } else {
             //die('VideoID does not exits');
             $this->_helper->getHelper('FlashMessenger')->addMessage('Vidoe ID does not exists.');
             $this->_redirect('/report');
         }
     } else {
         //die('invalid user');
         $this->_helper->getHelper('FlashMessenger')->addMessage('Invalid Video ID.');
         $this->_redirect('/report');
     }
 }