/** * Display method * * @access public */ public function display() { /** * Initialize the template object */ $template = Template::Get(); /** * Get the pager object */ $pager = $this->get_pager(); if (isset($_POST['search'])) { $pager->set_search($_POST['search']); } $pager->page(); $template->assign('pager', $pager); /** * Find the deletables */ $deletables = []; foreach ($pager->items as $item) { if ($this->is_deletable($item)) { $deletables[] = $item->id; } } $template->assign('deletables', $deletables); /** * Find the editables */ $editables = []; foreach ($pager->items as $item) { if ($this->is_editable($item)) { $editables[] = $item->id; } } $template->assign('editables', $editables); /** * Get default fields for pager */ $classname = $pager->get_classname(); $fields = $classname::get_object_fields(); foreach ($fields as $key => $definition) { if (substr($definition['field'], -3) == '_id') { unset($fields[$key]); } } /** * Creatable */ $template->assign('creatable', $this->is_creatable()); $template->assign('default_fields', $fields); }
/** * Print label * * @access public */ public function display_label() { $this->template = false; $shipment = Shipment::get_by_id($_GET['id']); $template = Template::Get(); $file = $shipment->get_courier()->get_label($shipment); $file->client_download(); }
/** * Handle the request * * @access public */ public function handle_request() { $template = \Skeleton\Core\Web\Template::Get(); // Find out which method to call, fall back to calling displa() if (isset($_REQUEST['action']) and method_exists($this, 'display_' . $_REQUEST['action'])) { $template->assign('action', $_REQUEST['action']); call_user_func([$this, 'display_' . $_REQUEST['action']]); } else { $this->display(); } // If the module has defined a template, render it if ($this->template !== null and $this->template !== false) { $template->display($this->template); } }