function view($cachable = false, $urlparams = false) { JLoader::import('com_tienda.library.button', JPATH_ADMINISTRATOR . '/components'); TiendaToolBarHelper::_custom('save', 'save', 'save', 'COM_TIENDA_SAVE', false, 'shippingTask'); TiendaToolBarHelper::_custom('cancel', 'cancel', 'cancel', 'COM_TIENDA_CLOSE', false, 'shippingTask'); $id = JRequest::getInt('id', '0'); $sid = TiendaShippingPlugin::getShippingId(); $this->includeCustomModel('ShippingMethods'); $model = JModel::getInstance('ShippingMethods', 'TiendaModel'); $model->setId((int) $sid); $item = $model->getItem(); // Form $form = array(); $form['action'] = $this->baseLink(); $form['shippingTask'] = 'save'; //We are calling a view from the ShippingMethods we isn't actually the same controller this has, however since all it does is extend the base view it is // all good, and we don't need to remake getView() $view = $this->getView('ShippingMethods', 'html'); $view->hidemenu = true; $view->hidestats = true; $view->setTask(true); $view->setModel($model, true); $view->assign('item', $item); $view->assign('form2', $form); $view->setLayout('view'); $view->display(); }
/** * Validates the data submitted based on the suffix provided * A controller for this plugin, you could say * * @param $task * @return html */ function viewList() { $html = ""; JLoader::import('com_tienda.library.button', JPATH_ADMINISTRATOR . '/components'); TiendaToolBarHelper::_custom('newMethod', 'new', 'new', 'COM_TIENDA_NEW', false, 'shippingTask'); TiendaToolBarHelper::_custom('delete', 'delete', 'delete', 'COM_TIENDA_DELETE', false, 'shippingTask'); TiendaToolBarHelper::cancel('close', 'COM_TIENDA_CLOSE'); $vars = new JObject(); $vars->state = $this->_getState(); $this->includeCustomModel('ShippingMethods'); $model = JModel::getInstance('ShippingMethods', 'TiendaModel'); $list = $model->getList(); $vars->list = $list; $id = JRequest::getInt('id', '0'); $form = array(); $form['action'] = "index.php?option=com_tienda&view=shipping&task=view&id={$id}"; $vars->form = $form; $vars->sid = $id; $html = $this->_getLayout('default', $vars); return $html; }