/**
  * Get current items to display on current page
  * @access public 
  * @return object ArrayIterator
  */
 public function getCurrentItems()
 {
     $this->_paginator->setItemCountPerPage($this->_itemCountPerPage);
     $this->_paginator->setCurrentPageNumber($this->_currentPage);
     if ($this->_currentItems === null) {
         $this->_currentItems = $this->_paginator->getCurrentItems();
     }
     return $this->_currentItems;
 }
Exemple #2
0
 protected function _addPaginator($oOperation)
 {
     //dodaj standardowe metody grida
     //        list($sDBSort, $sDBOrder) = $this->_getDatabaseSort();
     //        $oOperation->setSort($sDBSort);
     //        $oOperation->setOrder($sDBOrder);
     //        $oOperation->setSearch($this->_getDatabaseSearch());
     $oOperation->init();
     //grid paginowany
     $page = $this->getRequest()->getParam('page', 1);
     //        $iResultLimit =  $this->_getDatabaseResultLimit();
     if (method_exists($oOperation, 'pageLimit')) {
         $iResultLimit = $oOperation->pageLimit();
     }
     $adapter = new Zend_Paginator_Adapter_DbSelect($oOperation->getSelect());
     $adapter->setRowCount($oOperation->getSelectCount());
     $paginator = new Zend_Paginator($adapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($iResultLimit);
     if ($paginator->count() == 0) {
         Message_Operation_Flash::setMsg('Brak rekordów', Message_Operation_Flash::LEVEL_DANGER);
     }
     $this->view->paginator = $paginator;
     //config
     $this->view->config_url = $this->_oConfig->url;
 }
 public function indexAction()
 {
     /**
      * Form cadastro
      */
     $formPropostaCadastro = new Form_Site_PropostaCadastro();
     $formPropostaCadastro->submit->setLabel("CADASTRAR");
     //$formPropostaCadastro->proposta_numero->setValue($this->getNumeroProposta());
     $this->view->formPropostaCadastro = $formPropostaCadastro;
     /**
      * Busca as propostas
      */
     $page = $this->getRequest()->getParam('page', 1);
     //get curent page param, default 1 if param not available.
     $modelProposta = new Model_DbTable_Proposta();
     $data = $modelProposta->getQuery();
     $adapter = new Zend_Paginator_Adapter_DbSelect($data);
     //adapter
     $paginator = new Zend_Paginator($adapter);
     // setup Pagination
     $paginator->setItemCountPerPage(Zend_Registry::get("config")->resource->rowspage);
     // Items perpage, in this example is 10
     $paginator->setCurrentPageNumber($page);
     // current page
     //Zend_Paginator::setDefaultScrollingStyle('Sliding');
     //Zend_View_Helper_PaginationControl::setDefaultViewPartial('partials/pagination.phtml');
     $this->view->propostas = $paginator;
 }
Exemple #4
0
 public function testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo()
 {
     $this->_paginator->setPageRange(3);
     $this->_paginator->setCurrentPageNumber(19);
     $pages = $this->_paginator->getPages('Elastic');
     $this->assertEquals(5, count($pages->pagesInRange));
 }
Exemple #5
0
 public function getAll($active = false, $lng = 'nl', $paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('n' => 'News'), array('*'))->joinLeft(array('t' => 'NewsTsl', array('lng', 'title', 'summary', 'content', 'url', 'seo_keywords', 'seo_title', 'seo_description', 'active')), 'n.nid = t.nid')->where('t.lng = ?', $lng);
     if ($active) {
         $select->where('t.active = 1')->where('n.date_published <= NOW()')->where('n.date_expired > NOW() OR n.date_expired is NULL')->order('n.date_message DESC')->order('n.date_published DESC');
     } else {
         $select->order('n.date_published DESC')->order('n.date_created DESC');
     }
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
Exemple #6
0
 public function selectAll($pageNumber = 1, $filter = array())
 {
     $db = $this->siteDbAdapter->select()->from($this->tablename);
     foreach ($filter as $key => $val) {
         if ($val) {
             if (is_int($val)) {
                 $db->where($key . ' = ?', $val);
             } else {
                 $db->where($key . ' LIKE ?', '%' . $val . '%');
             }
         }
     }
     $db->order('log_date DESC');
     $adapter = new Zend_Paginator_Adapter_DbSelect($db);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setCurrentPageNumber($pageNumber);
     $paginator->setItemCountPerPage($this->countPerPage);
     $paginator->setPageRange($this->pageRange);
     return $paginator;
     /*
     		$select = $this->siteDbAdapter->select();
     		$select->from($this->tablename);
     		$select->order(array('log_id'));
     		$log = $this->siteDbAdapter->fetchAll($select->__toString());
     		return $log;
     */
 }
 public function indexAction()
 {
     $query = trim($this->getRequest()->getQuery('q', ''));
     $this->view->query = $query;
     if (!empty($query)) {
         $count = 10;
         $page = (int) $this->getRequest()->getQuery('p', 1);
         if ($page < 1) {
             $page = 1;
         }
         // Prepare the common options
         $options = array('market' => 'en-GB');
         // We want web and image search results
         $sources = array('web' => array('count' => $count, 'offset' => $count * ($page - 1)));
         // Adjust the query to only search the noginn.com domain
         $query .= ' site:noginn.com';
         // Perform the search!
         $bing = new Noginn_Service_Bing('__APP_ID__');
         $result = $bing->search($query, $sources, $options);
         $webResults = $result->getSource('web');
         $this->view->webResults = $webResults;
         // Paginate the results
         $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null($webResults->getTotal()));
         $paginator->setCurrentPageNumber($page);
         $paginator->setItemCountPerPage($count);
         $this->view->paginator = $paginator;
     }
 }
Exemple #8
0
 public function getAll($paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('a' => 'Sheets'), array('*'))->join(array('t' => 'SheetsTsl'), 'a.id = t.s_id', array('lng', 'name', 't_desc', 't_file'))->join(array('ty' => 'SheetsSubtype'), 'a.subtype = ty.subtype_id', array())->join(array('tyt' => 'SheetsSubtypeTsl'), 'ty.subtype_id = tyt.subtype_id', array('name as subtypename'))->join(array('st' => 'SheetsType'), 'a.type = st.type_id', array())->join(array('stt' => 'SheetsTypeTsl'), 'st.type_id = stt.type_id', array('name as typename'))->where('t.lng = ?', $_SESSION['System']['lng'])->where('tyt.lng = ?', $_SESSION['System']['lng'])->where('stt.lng = ?', $_SESSION['System']['lng'])->order('st.position ASC')->order('ty.position ASC')->order('a.place ASC');
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
 /**
  * Consulta notas para exportar RPS
  */
 public function rpsConsultarAction()
 {
     parent::noTemplate();
     $aParametros = $this->getRequest()->getParams();
     /**
      * Verifica se foi informado mês e ano da competência
      */
     if (!empty($aParametros['mes_competencia']) && !empty($aParametros['ano_competencia'])) {
         $oContribuinte = $this->_session->contribuinte;
         $sCodigosContribuintes = implode(',', $oContribuinte->getContribuintes());
         $oPaginatorAdapter = new DBSeller_Controller_Paginator(Contribuinte_Model_Nota::getQuery(), 'Contribuinte_Model_Nota', 'Contribuinte\\Nota');
         /**
          * Monta a query de consulta
          */
         $oPaginatorAdapter->where("e.id_contribuinte in ({$sCodigosContribuintes})");
         $oPaginatorAdapter->andWhere("e.mes_comp = {$aParametros['mes_competencia']}");
         $oPaginatorAdapter->andWhere("e.ano_comp = {$aParametros['ano_competencia']}");
         if (!empty($aParametros['numero_rps'])) {
             $oPaginatorAdapter->andWhere("e.nota = {$aParametros['numero_rps']}");
         }
         $oPaginatorAdapter->orderBy('e.nota', 'DESC');
         /**
          * Monta a paginação do GridPanel
          */
         $oResultado = new Zend_Paginator($oPaginatorAdapter);
         $oResultado->setItemCountPerPage(10);
         $oResultado->setCurrentPageNumber($this->_request->getParam('page'));
         foreach ($oResultado as $oNota) {
             $oNota->oContribuinte = $oContribuinte;
             $oNota->lNaoGeraGuia = !$oNota->getEmite_guia();
             $oNota->lGuiaEmitida = Contribuinte_Model_Guia::existeGuia($oContribuinte, $oNota->getMes_comp(), $oNota->getAno_comp(), Contribuinte_Model_Guia::$DOCUMENTO_ORIGEM_NFSE);
             /**
              * Informações da nota substituta
              */
             $oNota->oNotaSubstituida = NULL;
             if ($oNota->getIdNotaSubstituida()) {
                 $oNota->oNotaSubstituida = Contribuinte_Model_Nota::getById($oNota->getIdNotaSubstituida());
             }
             /**
              * Informações da nota substituta
              */
             $oNota->oNotaSubstituta = NULL;
             if ($oNota->getIdNotaSubstituta()) {
                 $oNota->oNotaSubstituta = Contribuinte_Model_Nota::getById($oNota->getIdNotaSubstituta());
             }
         }
         /**
          * Valores da pesquisa para montar a paginação
          */
         if (is_array($aParametros)) {
             foreach ($aParametros as $sParametro => $sParametroValor) {
                 if ($sParametroValor) {
                     $sParametroValor = str_replace('/', '-', $sParametroValor);
                     $this->view->sBusca .= "{$sParametro}/{$sParametroValor}/";
                 }
             }
         }
         $this->view->oDadosNota = $oResultado;
     }
 }
 function adminlistAction()
 {
     $this->rowsPerPage = 4;
     if ($this->_request->getParam('page')) {
         $this->curPage = $this->_request->getParam('page');
     } else {
         $this->curPage = 1;
     }
     $messages = $this->_mail->getUniqueId();
     //print_r($curPage);die;
     $content = array();
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($messages));
     if (count($messages)) {
         for ($i = ($this->curPage - 1) * $this->rowsPerPage + 1; $i <= $this->curPage * $this->rowsPerPage; $i++) {
             $message[$i] = $this->_mail->getMessage($i);
             $content[$i] = $message[$i]->getContent();
         }
     }
     $this->view->paginator = $paginator;
     $paginator->setCurrentPageNumber($this->curPage)->setItemCountPerPage($this->rowsPerPage);
     $this->view->controller = $this->_request->getControllerName();
     $this->view->action = $this->_request->getActionName();
     $this->view->content = $content;
     $this->view->message = $message;
     $this->view->inbox = $this->_inbox;
     //print_r ( $this->_inbox );
     //die ();
 }
Exemple #11
0
 /**
  * List all Queues
  */
 public function indexAction()
 {
     $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Queues")));
     $this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName();
     $db = Zend_Registry::get('db');
     $select = $db->select()->from("queue");
     if ($this->_request->getPost('filtro')) {
         $field = mysql_escape_string($this->_request->getPost('campo'));
         $query = mysql_escape_string($this->_request->getPost('filtro'));
         $select->where("{$field} LIKE '%{$query}%'");
     }
     $page = $this->_request->getParam('page');
     $this->view->page = isset($page) && is_numeric($page) ? $page : 1;
     $this->view->filtro = $this->_request->getParam('filtro');
     $paginatorAdapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($this->view->page);
     $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit);
     $this->view->queues = $paginator;
     $this->view->pages = $paginator->getPages();
     $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/";
     $opcoes = array("name" => $this->view->translate("Name"), "musiconhold" => $this->view->translate("Audio Class"), "strategy" => $this->view->translate("Strategy"), "servicelevel" => $this->view->translate("SLA"), "timeout" => $this->view->translate("Timeout"));
     $filter = new Snep_Form_Filter();
     $filter->setAction($this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName() . '/index');
     $filter->setValue($this->_request->getPost('campo'));
     $filter->setFieldOptions($opcoes);
     $filter->setFieldValue($this->_request->getPost('filtro'));
     $filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/page/{$page}");
     $this->view->form_filter = $filter;
     $this->view->filter = array(array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/add/", "display" => $this->view->translate("Add Queue"), "css" => "include"));
 }
 /**
  * The default action - show the guestbook entries
  */
 public function indexAction()
 {
     $method = __METHOD__;
     $cacheid = str_replace("::", "_", $method) . intval($this->getRequest()->getParam('page', 1));
     $can_edit = false;
     if (Zoo::getService('acl')->checkAccess('edit')) {
         $cacheid .= "_edit";
         $can_edit = true;
     }
     $content = $this->checkCache($cacheid);
     if (!$content) {
         $limit = 20;
         // Offset = items per page multiplied by the page number minus 1
         $offset = ($this->getRequest()->getParam('page', 1) - 1) * $limit;
         $options = array('active' => true, 'nodetype' => 'guestbook_entry', 'order' => 'created DESC', 'render' => true);
         $select = Zoo::getService('content')->getContentSelect($options, $offset, $limit);
         $this->view->items = Zoo::getService('content')->getContent($options, $offset, $limit);
         // Pagination
         Zend_Paginator::setDefaultScrollingStyle('Elastic');
         Zend_View_Helper_PaginationControl::setDefaultViewPartial(array('pagination_control.phtml', 'zoo'));
         $adapter = new Zend_Paginator_Adapter_DbSelect($select);
         $paginator = new Zend_Paginator($adapter);
         $paginator->setItemCountPerPage($limit);
         $paginator->setCurrentPageNumber($this->getRequest()->getParam('page', 1));
         $paginator->setView($this->view);
         $this->view->assign('paginator', $paginator);
         $this->view->can_edit = $can_edit;
         $content = $this->getContent();
         $this->cache($content, $cacheid, array('nodelist', 'guestbook_list'));
     }
     $this->view->pagetitle = Zoo::_('Guestbook');
     $this->renderContent($content);
 }
Exemple #13
0
 public function listAction()
 {
     // get the filter form
     $listToolsForm = new Form_BugReportListToolsForm();
     $listToolsForm->setAction('/bug/list');
     $listToolsForm->setMethod('post');
     $this->view->listToolsForm = $listToolsForm;
     // set the sort and filter criteria. you need to update this to use the request,
     // as these values can come in from the form post or a url parameter
     $sort = $this->_request->getParam('sort', null);
     $filterField = $this->_request->getParam('filter_field', null);
     $filterValue = $this->_request->getParam('filter');
     if (!empty($filterField)) {
         $filter[$filterField] = $filterValue;
     } else {
         $filter = null;
     }
     // now you need to manually set these controls values
     $listToolsForm->getElement('sort')->setValue($sort);
     $listToolsForm->getElement('filter_field')->setValue($filterField);
     $listToolsForm->getElement('filter')->setValue($filterValue);
     // fetch the bug paginator adapter
     $bugModels = new Model_Bug();
     $adapter = $bugModels->fetchPaginatorAdapter($filter, $sort);
     $paginator = new Zend_Paginator($adapter);
     // show 10 bugs per page
     $paginator->setItemCountPerPage(10);
     // get the page number that is passed in the request.
     //if none is set then default to page 1.
     $page = $this->_request->getParam('page', 1);
     $paginator->setCurrentPageNumber($page);
     // pass the paginator to the view to render
     $this->view->paginator = $paginator;
 }
 public function CusFevRestauarants(User_Model_FevRestById $userid, $offset)
 {
     try {
         $id = $userid->getUserId();
         $query = $this->getDbTable()->select();
         $query->setIntegrityCheck(false);
         $query->from(array('crc' => 'rd.customer_restaurant_choice'), array('crcfk_user', 'crcrestaurant_id'));
         $query->join(array('res' => 'rd.restaurant_details'), 'res.resid = crc.crcrestaurant_id', array('resid', 'resname', 'resaddress', 'resdescription', 'resimage'));
         $query->join(array('nbh' => 'rd.neighborhood_bd'), 'nbh.id = res.resneighborhood_id', array('description as neighbor'));
         $query->join(array('rgn' => 'rd.region_bd'), 'rgn.id = res.resregion_id', array('description as region'));
         $query->join(array('cty' => 'rd.city_bd'), 'cty.id = res.rescity_id', array('description as city'));
         $query->join(array('sbd' => 'rd.state_bd'), 'sbd.id = res.resstate_id', array('description as state'));
         $query->where('crc.crcstatus =? ', 'TRUE');
         $query->where('crc.crcfk_user = ?', $id);
         $query->where('rescategory_id = 2');
         $query->order('crcid DESC');
         //$Result = $this->getDbTable()->fetchAll($query);
         $Result = new Zend_Paginator(new Zend_Paginator_Adapter_DbTableSelect($query));
         $Result->setItemCountPerPage(10);
         $Result->setCurrentPageNumber($offset);
         $resultList = array();
         foreach ($Result as $value) {
             $resdesc = $value->resdescription;
             if (strlen($resdesc) > 1000) {
                 $resdesc = substr($resdesc, 0, 1000) . "...";
             }
             $obj = new User_Model_CustomerRestChoice();
             $obj->setRestId($value->resid)->setRestaurantname($value->resname)->setRestneighboorhood($value->neighbor)->setRestRegion($value->city)->setRestCity($value->city)->setRestState($value->state)->setResAddress($value->resaddress)->setResDesc($resdesc)->setRestImage($value->resimage);
             $resultList[] = $obj;
         }
         return $Result;
     } catch (Exception $ex) {
         throw new Exception($ex->getMessage());
     }
 }
Exemple #15
0
 /**
  * Get all reviews
  *
  */
 public function getReviews($paged = null, $order = array(), $filter = null)
 {
     $grid = array();
     $grid['cols'] = $this->getGridColumns();
     $grid['primary'] = $this->_primary;
     $select = $this->select();
     if (!empty($order[0])) {
         $order = $order[0] . ' ' . $order[1];
     } else {
         $order = 'inserted ASC';
     }
     $select->order($order);
     $select->from('reviews', array_keys($this->getGridColumns()));
     if ($filter) {
         $select->where('submission_id = ?', (int) $filter);
     }
     if ($paged) {
         $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
         $paginator = new Zend_Paginator($adapter);
         $paginator->setCurrentPageNumber((int) $paged)->setItemCountPerPage(20);
         $grid['rows'] = $paginator;
         return $grid;
     }
     $grid['rows'] = $this->fetchAll($select);
     return $grid;
 }
Exemple #16
0
 public function getAll($lng, $paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('a' => 'ContentBlocks'), array('a.*'))->join(array('t' => 'ContentBlocksTsl'), 'a.id = t.b_id', array('t.*'))->where('t.lng = ?', $lng);
     $results = $db->fetchAll($select);
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
Exemple #17
0
 public function getUsers($paged = null, $order = array(), $filter = null)
 {
     $grid = array();
     $grid['cols'] = $this->getGridColumns();
     $grid['primary'] = $this->_primary;
     $select = $this->select();
     if (!empty($order[0])) {
         $order = 'lower(' . $order[0] . ') ' . $order[1];
     } else {
         $order = 'lower(lname) ASC';
     }
     $select->order($order)->from('vw_users', array_keys($this->getGridColumns()));
     if ($filter) {
         // apply filters to grid
         if ($filter->filters) {
             foreach ($filter->filters as $field => $value) {
                 if (is_array($value)) {
                     $select->where($field . ' IN (?)', $value);
                 } else {
                     $select->where($field . ' = ?', $value);
                 }
             }
         }
     }
     if ($paged) {
         $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
         $paginator = new Zend_Paginator($adapter);
         $paginator->setCurrentPageNumber((int) $paged)->setItemCountPerPage(20);
         $grid['rows'] = $paginator;
         return $grid;
     }
     $grid['rows'] = $this->fetchAll($select);
     return $grid;
 }
Exemple #18
0
 /**
  * List all Contacts
  */
 public function indexAction()
 {
     $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Contacts")));
     $this->view->url = $this->getFrontController()->getBaseUrl() . "/" . $this->getRequest()->getControllerName();
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array("n" => "contact"), array("n.id_contact as id", "n.ds_name as name", "n.ds_city as city", "n.ds_state as state", "n.ds_cep as cep", "n.ds_phone as phone", "n.ds_cell_phone as cellphone", "g.ds_name as group"))->join(array("g" => "contact_group"), 'n.id_contact_group = g.id_contact_group', array())->order('n.id_contact');
     if ($this->_request->getPost('filtro')) {
         $field = pg_escape_string($this->_request->getPost('campo'));
         $query = pg_escape_string($this->_request->getPost('filtro'));
         $select->where("{$field} like '%{$query}%'");
     }
     $page = $this->_request->getParam('page');
     $this->view->page = isset($page) && is_numeric($page) ? $page : 1;
     $this->view->filtro = $this->_request->getParam('filtro');
     $paginatorAdapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($this->view->page);
     $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit);
     $this->view->contacts = $paginator;
     $this->view->pages = $paginator->getPages();
     $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/";
     /*Opcoes do Filtro*/
     $opcoes = array("n.ds_name" => $this->view->translate("Name"), "n.ds_city" => $this->view->translate("City"), "n.ds_state" => $this->view->translate("State"), "n.ds_cep" => $this->view->translate("ZIP Code"), "n.ds_phone" => $this->view->translate("Phone"), "n.ds_cell_phone" => $this->view->translate("Cellphone"));
     $filter = new Snep_Form_Filter();
     $filter->setAction($this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName() . '/index');
     $filter->setValue($this->_request->getPost('campo'));
     $filter->setFieldOptions($opcoes);
     $filter->setFieldValue($this->_request->getPost('filtro'));
     $filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/page/{$page}");
     $this->view->form_filter = $filter;
     $this->view->filter = array(array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/add/", "display" => $this->view->translate("Add Contact"), "css" => "include"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/multi-remove/", "display" => $this->view->translate("Remove Multiple"), "css" => "exclude"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/import/", "display" => $this->view->translate("Import CSV"), "css" => "import"), array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/export/", "display" => $this->view->translate("Export CSV"), "css" => "export"));
 }
Exemple #19
0
 public function getAll($paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = 'SxModule_Pageform_Subscription_Meta_getAll_' . sha1(var_export($paginator, true) . '_' . var_export($pindex, true) . '_' . var_export($perpage, true));
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('i' => $this->_tablename()), array('*'));
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     if ($cache == true) {
         $cacheTags = array('SxModule_Pageform_Subscription_Meta', 'SxModule_Pageform_Subscription_Meta_getAll', 'SxModule_Pageform_Subscription', 'SxModule_Pageform');
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
 public function indexAction()
 {
     $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Pickup Groups")));
     $db = Zend_Registry::get('db');
     $select = $db->select()->from("pickup_group");
     if ($this->_request->getPost('filtro')) {
         $field = mysql_escape_string($this->_request->getPost('campo'));
         $query = mysql_escape_string($this->_request->getPost('filtro'));
         $select->where("`{$field}` like '%{$query}%'");
     }
     $page = $this->_request->getParam('page');
     $this->view->page = isset($page) && is_numeric($page) ? $page : 1;
     $this->view->filtro = $this->_request->getParam('filtro');
     $paginatorAdapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($this->view->page);
     $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit);
     $this->view->pickupgroups = $paginator;
     $this->view->pages = $paginator->getPages();
     $this->view->URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/";
     $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/";
     $opcoes = array("ds_name" => $this->view->translate("Name"));
     // Formulário de filtro.
     $filter = new Snep_Form_Filter();
     $filter->setAction($this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName() . '/index');
     $filter->setValue($this->_request->getPost('campo'));
     $filter->setFieldOptions($opcoes);
     $filter->setFieldValue($this->_request->getPost('filtro'));
     $filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/page/{$page}");
     $this->view->form_filter = $filter;
     $this->view->filter = array(array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/add", "display" => $this->view->translate("Add Pickup Group"), "css" => "include"));
 }
Exemple #21
0
 public function testToJson()
 {
     $this->_paginator->setCurrentPageNumber(1);
     $json = $this->_paginator->toJson();
     $expected = '"0":1,"1":2,"2":3,"3":4,"4":5,"5":6,"6":7,"7":8,"8":9,"9":10';
     $this->assertContains($expected, $json);
 }
Exemple #22
0
 public function listAction()
 {
     // create search form
     $searchForm = new Admin_Form_RouteSearch();
     $searchForm->setAction('/admin/route/list')->setMethod('post');
     $this->view->searchForm = $searchForm;
     // get params from request
     $sorter = $this->_request->getParam('sorter', null);
     $filter = $this->_request->getParam('filter', null);
     $filterText = $this->_request->getParam('filterText', null);
     // populate them to form
     $searchForm->getElement('sorter')->setValue($sorter);
     $searchForm->getElement('filter')->setValue($filter);
     $searchForm->getElement('filterText')->setValue($filterText);
     // list route
     $routeModel = new Admin_Model_Route();
     $routeAdapter = $routeModel->getRoutePaginatorAdapter($filter, $filterText, $sorter);
     if ($routeAdapter) {
         $paginator = new Zend_Paginator($routeAdapter);
         $page = $this->_request->getParam('page', 1);
         $paginator->setItemCountPerPage(5);
         $paginator->setCurrentPageNumber($page);
         $paginator->setPageRange(8);
         $this->view->paginator = $paginator;
     }
 }
Exemple #23
0
 /**
  * @param string $modelName
  * @param array $options
  * @param Doctrine_Query_Abstract $query
  * @return string
  */
 public function modelList($modelName, array $options = array(), Doctrine_Query_Abstract $query = null)
 {
     $options = array_merge(self::$_defaultOptions, $options);
     if (!$options['paginationScript']) {
         $options['paginationScript'] = 'partials/pagination.phtml';
     }
     $table = Doctrine_Core::getTable($modelName);
     if (!$query) {
         $query = $table->createQuery();
     }
     $adapter = new FansubCMS_Paginator_Adapter_Doctrine($query);
     $paginator = new Zend_Paginator($adapter);
     $front = Zend_Controller_Front::getInstance();
     $request = $front->getRequest();
     $currentPage = $request->getParam('page', 1);
     $paginator->setCurrentPageNumber($currentPage);
     $paginator->setItemCountPerPage($options['itemsPerPage']);
     if (!isset($options['listScript'])) {
         $options['listScript'] = 'partials/table.phtml';
     }
     if (!isset($options['showFieldNames'])) {
         $fieldNames = $this->getAutoFieldNames($table);
     } else {
         $fieldNames = $options['showFieldNames'];
     }
     return $this->view->partial($options['listScript'], array('modelName' => $modelName, 'paginator' => $paginator, 'currentPage' => $currentPage, 'options' => $options, 'fieldNames' => $fieldNames));
 }
 function adminimagereportAction()
 {
     $this->view->title = 'Reports';
     $this->view->activeTab = 'Reports';
     $this->_helper->layout->setLayout("layout_admin");
     $this->view->campaign_id = $this->_request->getParam('id');
     $curPage = 1;
     $rowsPerPage = 50;
     if ($this->_request->getParam('page')) {
         $curPage = $this->_request->getParam('page');
     }
     $db = Zend_Registry::get('db');
     $select = $db->select();
     $select->from('image_report', array('id', 'image', 'state', 'create_date', 'consumer_id', 'thumb_width', 'thumb_height'))->join('consumer', 'consumer.id = image_report.consumer_id', array('email', 'name', 'recipients_name', 'language_pref'))->joinLeft('image_report_reply', 'image_report_reply.image_report_id = image_report.id', 'content')->joinLeft('reward_point_transaction_record', 'reward_point_transaction_record.id = image_report.reward_point_transaction_record_id', 'point_amount')->where('campaign_id = ?', $this->view->campaign_id)->where('consumer.pest is null')->order('create_date desc');
     $this->view->imageReports = $db->fetchAll($select);
     //paging
     $this->view->controller = $this->_request->getControllerName();
     $this->view->action = $this->_request->getActionName();
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($this->view->imageReports));
     $paginator->setCurrentPageNumber($curPage)->setItemCountPerPage($rowsPerPage);
     $this->view->paginator = $paginator;
     //		Zend_Debug::dump($this->view->duplicatedUrlArray);
     Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination/pagelist.phtml');
     $this->view->NoInitValue = ($curPage - 1) * $rowsPerPage + 1;
 }
 /**
  * Display a list of all users in the system.
  *
  */
 public function indexAction()
 {
     $filterStatus = $this->_getParam('status', 'any');
     $filterTrigger = $this->_getParam('trigger', 'any');
     $filterSort = $this->_getParam('sort', 'queueDt');
     $filterDirection = $this->_getParam('direction', 'asc');
     $form = new Ot_Form_EmailqueueSearch();
     $form->populate($_GET);
     $eq = new Ot_Model_DbTable_EmailQueue();
     $select = new Zend_Db_Table_Select($eq);
     if ($filterStatus != '' && $filterStatus != 'any') {
         $select->where('status = ?', $filterStatus);
     }
     if ($filterTrigger != '' && $filterTrigger != 'any') {
         $select->where('attributeName = ?', 'triggerActionId');
         $select->where('attributeId = ?', $filterTrigger);
     }
     $select->order($filterSort . ' ' . $filterDirection);
     $adapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setCurrentPageNumber($this->_getParam('page', 1));
     $ta = new Ot_Model_DbTable_TriggerAction();
     $actions = $ta->fetchAll();
     $triggers = array();
     foreach ($actions as $a) {
         $triggers[$a->triggerActionId] = $a;
     }
     $this->_helper->pageTitle('ot-emailqueue-index:title');
     $this->view->assign(array('paginator' => $paginator, 'form' => $form, 'interface' => true, 'sort' => $filterSort, 'direction' => $filterDirection, 'triggers' => $triggers));
 }
Exemple #26
0
 public function indexAction()
 {
     // @todo localização das datas na listagem da view
     $this->view->breadcrumb = Snep_Breadcrumb::renderPath(array($this->view->translate("Manage"), $this->view->translate("Users")));
     $this->view->url = $this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName();
     $db = Zend_Registry::get('db');
     $select = $db->select()->from("user");
     if ($this->_request->getPost('filtro')) {
         $field = mysql_escape_string($this->_request->getPost('campo'));
         $query = mysql_escape_string($this->_request->getPost('filtro'));
         $select->where("{$field} LIKE '%{$query}%'");
     }
     $page = $this->_request->getParam('page');
     $this->view->page = isset($page) && is_numeric($page) ? $page : 1;
     $this->view->filtro = $this->_request->getParam('filtro');
     $paginatorAdapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($paginatorAdapter);
     $paginator->setCurrentPageNumber($this->view->page);
     $paginator->setItemCountPerPage(Zend_Registry::get('config')->ambiente->linelimit);
     $this->view->users = $paginator;
     $this->view->pages = $paginator->getPages();
     $this->view->PAGE_URL = "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/";
     $opcoes = array('ds_login' => $this->view->translate('Name'), 'ds_mail' => $this->view->translate('E-mail'));
     $this->view->active = array(1 => $this->view->translate('Yes'), 0 => $this->view->translate('No'));
     $filter = new Snep_Form_Filter();
     $filter->setAction($this->getFrontController()->getBaseUrl() . '/' . $this->getRequest()->getControllerName() . '/index');
     $filter->setValue($this->_request->getPost('campo'));
     $filter->setFieldOptions($opcoes);
     $filter->setFieldValue($this->_request->getPost('filtro'));
     $filter->setResetUrl("{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/index/page/{$page}");
     $this->view->form_filter = $filter;
     $this->view->filter = array(array("url" => "{$this->getFrontController()->getBaseUrl()}/{$this->getRequest()->getControllerName()}/add/", "display" => $this->view->translate("Add User"), "css" => "include"));
 }
Exemple #27
0
 public function getAll($lng = 'nl', $active = false, $paginator = true, $pindex = 1, $perpage = 25, $cache = true)
 {
     if ($cache == true) {
         $cacheId = $this->generateCacheId(get_class($this) . '_' . __FUNCTION__, func_get_args());
         $cache = Zend_Registry::get('cache');
         if (true == ($result = $cache->load($cacheId))) {
             return $result;
         }
     }
     $db = Zend_Registry::get('db');
     $select = $db->select()->from(array('a' => 'WebTv'), array('*'))->join(array('t' => 'WebTvTsl'), 'a.id = t.webtv_id', array('url', 'lng', 'title', 'description', 'active'))->where('t.lng = ?', $lng)->order('a.date_published DESC');
     if ($active) {
         $select->where('t.active = 1')->where('a.date_published <= CURDATE()');
     }
     if ($paginator === true) {
         $adapter = new Base_PaginatorAdapter($select);
         $adapter->setMapper($this->_mapper);
         $data = new Zend_Paginator($adapter);
         $data->setCurrentPageNumber((int) $pindex);
         $data->setItemCountPerPage((int) $perpage);
     } else {
         $results = $db->fetchAll($select);
         $data = $this->_mapper->mapAll($results);
     }
     if ($cache == true) {
         $cacheTags = $this->generateCacheTags(get_class($this) . '_' . __FUNCTION__);
         $cache->save($data, $cacheId, $cacheTags);
     }
     return $data;
 }
 /**
  * Consulta as guias dos contribuintes por competência
  */
 public function consultarAction()
 {
     parent::noTemplate();
     $aParametros = $this->getRequest()->getParams();
     /**
      * Verifica se foi informado mês e ano da competência
      */
     if (!empty($aParametros['mes_competencia']) && !empty($aParametros['ano_competencia'])) {
         $iMesCompetencia = str_pad($aParametros['mes_competencia'], 2, '0', STR_PAD_LEFT);
         $iAnoCompetencia = $aParametros['ano_competencia'];
         $aGuiasCompetencia = Contribuinte_Model_Competencia::getByGuiasContribuinteAndCompetencia($iMesCompetencia, $iAnoCompetencia);
         $oPaginatorAdapter = new DBSeller_Controller_PaginatorArray($aGuiasCompetencia);
         $oPaginator = new Zend_Paginator($oPaginatorAdapter);
         $oPaginator->setItemCountPerPage(10);
         $oPaginator->setCurrentPageNumber($this->_request->getParam('page'));
         /**
          * Valores da pesquisa para montar a paginação
          */
         if (is_array($aParametros)) {
             foreach ($aParametros as $sParametro => $sParametroValor) {
                 if ($sParametroValor) {
                     $sParametroValor = str_replace('/', '-', $sParametroValor);
                     $this->view->sBusca .= "{$sParametro}/{$sParametroValor}/";
                 }
             }
         }
         $this->view->oGuiasCompetencia = $oPaginator;
     }
 }
Exemple #29
0
 public function getPosters($paged = null, $order = array(), $filter = null)
 {
     $grid = array();
     $grid['cols'] = $this->getGridColumns();
     $grid['primary'] = $this->_primary;
     $select = $this->select();
     if (!empty($order[0])) {
         $order = $order[0] . ' ' . $order[1];
     } else {
         $order = 'lower(title) ASC';
     }
     $select->order($order);
     $select->from('posters', array_keys($this->getGridColumns()))->where('conference_id = ?', $this->getConferenceId());
     if ($filter) {
         $select->where('category = ?', (int) $filter);
     }
     if ($paged) {
         $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
         $paginator = new Zend_Paginator($adapter);
         $paginator->setCurrentPageNumber((int) $paged)->setItemCountPerPage(20);
         $grid['rows'] = $paginator;
         return $grid;
     }
     $grid['rows'] = $this->fetchAll($select);
     return $grid;
 }
 /**
  * listAction方法是列出全部的礼品
  * Enter description here ...
  */
 function listAction()
 {
     $this->view->title = $this->view->translate("Wildfire") . " - " . $this->view->translate("GIFT_LIST");
     $this->view->consumer = $this->_currentUser;
     $productModel = new Product();
     $today = date("Y-m-d", time());
     if ($this->_request->getParam('t') != null && $this->_request->getParam('t') == 'mine') {
         $db = Zend_Registry::get('db');
         //			$selectAmountPoint = $db->select();
         //	    	$selectAmountPoint->from('reward_point_transaction_record', 'SUM(point_amount)')
         //			->where("consumer_id = ?", $this->_currentUser->id);
         //			$amountPoints = (int)$db->fetchOne($selectAmountPoint);
         $amountPoints = $db->fetchOne("SELECT sum(point_amount) FROM reward_point_transaction_record WHERE (consumer_id = :temp and date <:temp2) or (consumer_id = :temp and date >=:temp2 and transaction_id=4) ", array('temp' => $this->_currentUser->id, 'temp2' => date("Y-m-d", strtotime("{$today}   -30   day"))));
         $products = $productModel->fetchAll('point <= ' . $amountPoints . ' and state ="STOCK"', 'point desc')->toArray();
     } else {
         if ($this->_request->getParam('p2') != null && (int) $this->_request->getParam('p2') > 0) {
             $products = $productModel->fetchAll('point >= ' . $this->_request->getParam('p1') . ' and point <= ' . $this->_request->getParam('p2') . ' and state ="STOCK"', 'point')->toArray();
         } else {
             if ($this->_request->getParam('t') != null && $this->_request->getParam('t') != 'none') {
                 if ($this->_request->getParam('t') == "NEW") {
                     //添加最新上架 Bruce.Liu
                     $products = $productModel->fetchAll(' state ="STOCK" ', 'id desc', 18, 'point')->toArray();
                     //						Zend_Debug::dump($products);die();
                 } else {
                     $products = $productModel->fetchAll("category = '" . $this->_request->getParam('t') . "'" . ' and state ="STOCK"', 'point')->toArray();
                 }
             } else {
                 $products = $productModel->fetchAll('state ="STOCK"', 'point')->toArray();
             }
         }
     }
     //2011-04-14 ham.bao page links modification
     if ($this->_request->getParams('t') != NULL) {
         $this->view->t = $this->_request->getParam('t');
     }
     if ($this->_request->getParam('p2') != null) {
         $this->view->p1 = $this->_request->getParam('p1');
         $this->view->p2 = $this->_request->getParam('p2');
     }
     // get total points
     $db = Zend_Registry::get('db');
     if ($this->_currentUser != null) {
         //			$selectAmountPoint = $db->select();
         //	    	$selectAmountPoint->from('reward_point_transaction_record', 'SUM(point_amount)')
         //			->where("consumer_id = ?", $this->_currentUser->id);
         $this->view->amountPoints = $db->fetchOne("SELECT sum(point_amount) FROM reward_point_transaction_record WHERE (consumer_id = :temp and date <:temp2) or (consumer_id = :temp and date >=:temp2 and transaction_id=4) ", array('temp' => $this->_currentUser->id, 'temp2' => date("Y-m-d", strtotime("{$today}   -30   day"))));
     }
     if ($this->_request->getParam('page')) {
         $this->_curPage = $this->_request->getParam('page');
     }
     //paging
     $this->view->controller = $this->_request->getControllerName();
     $this->view->action = $this->_request->getActionName();
     //Zend_Debug::dump($products);die;
     $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($products));
     $paginator->setCurrentPageNumber($this->_curPage)->setItemCountPerPage($this->_rowsPerPage);
     $this->view->products = $paginator;
     //set the No. inital value in view page
     $this->view->NoInitValue = ($this->_curPage - 1) * $this->_rowsPerPage + 1;
 }