function display($tpl = null) { $this->form = $this->get('Form'); // Get data from the model $this->item = $this->get('Item'); // inturn calls getState in parent class and populateState() in model $this->state = $this->get('State'); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'zones.php'; $model = new J2StoreModelZones(); $countries = $model->getCountries(); //generate country filter list $lists = array(); $country_options = array(); $country_options[] = JHTML::_('select.option', '', JText::_('J2STORE_SELECT_COUNTRY')); foreach ($countries as $row) { $country_options[] = JHTML::_('select.option', $row->country_id, $row->country_name); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } //add toolbar $this->addToolBar(); $toolbar = new J2StoreToolBar(); $toolbar->renderLinkbar(); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
public function getInput() { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'zones.php'; $model = new J2StoreModelZones(); $countries = $model->getCountries(); //generate country filter list $country_options = array(); $country_options[] = JHTML::_('select.option', '', JText::_('J2STORE_SELECT_COUNTRY')); foreach ($countries as $row) { $country_options[] = JHTML::_('select.option', $row->country_id, $row->country_name); } return JHTML::_('select.genericlist', $country_options, $this->name, 'onchange=', 'value', 'text', $this->value); }