Ejemplo n.º 1
0
 /**
  * Browse faqs
  * @return void
  */
 public function index()
 {
     if (!userHasPermission('admin:faq:faq:manage')) {
         unauthorised();
     }
     // --------------------------------------------------------------------------
     //  Set method info
     $this->data['page']->title = lang('faqs_index_title');
     // --------------------------------------------------------------------------
     $tablePrefix = $this->faq_model->getTablePrefix();
     //  Get pagination and search/sort variables
     $page = $this->input->get('page') ? $this->input->get('page') : 0;
     $perPage = $this->input->get('perPage') ? $this->input->get('perPage') : 50;
     $sortOn = $this->input->get('sortOn') ? $this->input->get('sortOn') : $tablePrefix . '.order';
     $sortOrder = $this->input->get('sortOrder') ? $this->input->get('sortOrder') : 'asc';
     $keywords = $this->input->get('keywords') ? $this->input->get('keywords') : '';
     // --------------------------------------------------------------------------
     //  Define the sortable columns
     $sortColumns = array($tablePrefix . '.created' => 'Created Date', $tablePrefix . '.modified' => 'Modified Date', $tablePrefix . '.order' => 'Quotee');
     // --------------------------------------------------------------------------
     //  Define the $data variable for the queries
     $data = array('sort' => array(array($sortOn, $sortOrder)), 'keywords' => $keywords);
     //  Get the items for the page
     $totalRows = $this->faq_model->count_all($data);
     $this->data['faqs'] = $this->faq_model->get_all($page, $perPage, $data);
     //  Set Search and Pagination objects for the view
     $this->data['search'] = \Nails\Admin\Helper::searchObject(true, $sortColumns, $sortOn, $sortOrder, $perPage, $keywords);
     $this->data['pagination'] = \Nails\Admin\Helper::paginationObject($page, $perPage, $totalRows);
     //  Add a header button
     if (userHasPermission('admin:faq:faq:create')) {
         \Nails\Admin\Helper::addHeaderButton('admin/faq/faq/create', lang('faqs_nav_create'));
     }
     // --------------------------------------------------------------------------
     \Nails\Admin\Helper::loadView('index');
 }
Ejemplo n.º 2
0
 /**
  * Browse payments
  * @return void
  */
 public function index()
 {
     if (!userHasPermission('admin:order:payment:manage')) {
         unauthorised();
     }
     // --------------------------------------------------------------------------
     //  Set method info
     $this->data['page']->title = 'Manage Payments';
     // --------------------------------------------------------------------------
     $sTablePrefix = $this->oPaymentModel->getTablePrefix();
     //  Get pagination and search/sort variables
     $page = $this->input->get('page') ? $this->input->get('page') : 0;
     $perPage = $this->input->get('perPage') ? $this->input->get('perPage') : 50;
     $sortOn = $this->input->get('sortOn') ? $this->input->get('sortOn') : $sTablePrefix . '.created';
     $sortOrder = $this->input->get('sortOrder') ? $this->input->get('sortOrder') : 'desc';
     $keywords = $this->input->get('keywords') ? $this->input->get('keywords') : '';
     // --------------------------------------------------------------------------
     //  Define the sortable columns
     $sortColumns = array($sTablePrefix . '.created' => 'Created Date', $sTablePrefix . '.modified' => 'Modified Date');
     // --------------------------------------------------------------------------
     //  Define the $data variable for the queries
     $data = array('sort' => array(array($sortOn, $sortOrder)), 'keywords' => $keywords);
     //  Get the items for the page
     $totalRows = $this->oPaymentModel->count_all($data);
     $this->data['payments'] = $this->oPaymentModel->get_all($page, $perPage, $data);
     //  Set Search and Pagination objects for the view
     $this->data['search'] = Helper::searchObject(true, $sortColumns, $sortOn, $sortOrder, $perPage, $keywords);
     $this->data['pagination'] = Helper::paginationObject($page, $perPage, $totalRows);
     //  Add a header button
     if (userHasPermission('admin:order:payment:create')) {
         Helper::addHeaderButton('admin/order/payment/create', 'Create Payment');
     }
     // --------------------------------------------------------------------------
     Helper::loadView('index');
 }