/** * Execute /../stock/listItem * * @param type $request */ public function execute($request) { $head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/item_list.yml'); $itemlist_headers = array($head['listItem']['header1'], $head['listItem']['header2'], $head['listItem']['header3'], $head['listItem']['header6']); $columns = 'id,name,sales_unit_price,stock_available'; $recordsLimit = 5; //have to take from lists if (!$request->hasParameter('pageNo')) { $pageNo = 1; } else { $pageNo = $request->getParameter('pageNo', 1); } $pager = new SimplePager('Item', $recordsLimit); $pager->setPage($pageNo); $pager->setNumResults($this->getItemService()->countItems()); $pager->init(); $offset = $pager->getOffset(); $offset = empty($offset) ? 0 : $offset; $paramHolder = new sfParameterHolder(); $paramHolder->set('columns', $columns); $paramHolder->set('offset', $offset); $paramHolder->set('limit', $recordsLimit); $itemlist_data = $this->getItemService()->getItems($paramHolder); $listContainer = new ListContainer(); $listContainer->setListName('ItemList'); $listContainer->setListHeaders($itemlist_headers); $listContainer->setListContent($itemlist_data); $listContainer->setRowLink("stock/showItem?id="); $listContainer->setPager($pager); $this->listcontainer = $listContainer; }
public function execute($request) { $head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/seller_list.yml'); $sellerlist_headers = array($head['listSeller']['header1'], $head['listSeller']['header2'], $head['listSeller']['header3'], $head['listSeller']['header4']); $columns = 'id,name,address,tp_hp'; $recordsLimit = 5; //have to take from lists if (!$request->hasParameter('pageNo')) { $pageNo = 1; } else { $pageNo = $request->getParameter('pageNo', 1); } $pager = new SimplePager('Seller', $recordsLimit); $pager->setPage($pageNo); $pager->setNumResults($this->getSellerService()->countSellers()); $pager->init(); $offset = $pager->getOffset(); $offset = empty($offset) ? 0 : $offset; $paramHolder = new sfParameterHolder(); $paramHolder->set('columns', $columns); $paramHolder->set('offset', $offset); $paramHolder->set('limit', $recordsLimit); $sellerlist_data = $this->getSellerService()->getSellers($paramHolder); $listContainer = new ListContainer(); $listContainer->setListName('SellerList'); $listContainer->setListHeaders($sellerlist_headers); $listContainer->setListContent($sellerlist_data); $listContainer->setRowLink("seller/showSeller?id="); $listContainer->setPager($pager); $this->listcontainer = $listContainer; }