/** * Execute and display a template : Printer * * @access protected * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. * * @since 11.1 */ protected function displayPrinter($tpl = null) { $document = JFactory::getDocument(); $this->title = JText::_("RTIPRINT_LAYOUT_PRINTER"); $document->title = $document->titlePrefix . $this->title . $document->titleSuffix; // Initialiase variables. $this->model = $model = $this->getModel(); $this->state = $state = $this->get('State'); $state->set('context', 'printer.printer'); $this->item = $item = $this->get('Item'); $this->form = $form = $this->get('Form'); $this->canDo = $canDo = RtiprintHelper::getActions($model->getId()); $lists = array(); $this->lists =& $lists; $user = JFactory::getUser(); $isNew = $model->getId() == 0; //Check ACL before opening the form (prevent from direct access) if (!$model->canEdit($item, true)) { $model->setError(JText::_('JERROR_ALERTNOAUTHOR')); } // Check for errors. if (count($errors = $model->getErrors())) { JError::raiseError(500, implode(BR, array_unique($errors))); return false; } $jinput = JFactory::getApplication()->input; //Hide the component menu in item layout $jinput->set('hidemainmenu', true); //Toolbar initialization JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_PRINTER'), 'rtiprint_printers'); // Save if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::apply('printer.apply', "RTIPRINT_JTOOLBAR_SAVE"); } // Save & Close if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save('printer.save', "RTIPRINT_JTOOLBAR_SAVE_CLOSE"); } // Save & New if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save2new('printer.save2new', "RTIPRINT_JTOOLBAR_SAVE_NEW"); } // Save to Copy if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save2copy('printer.save2copy', "RTIPRINT_JTOOLBAR_SAVE_TO_COPY"); } // Cancel CkJToolBarHelper::cancel('printer.cancel', "RTIPRINT_JTOOLBAR_CANCEL"); // Delete if (!$isNew && $item->params->get('access-delete')) { JToolbar::getInstance('toolbar')->appendButton('Confirm', JText::_('RTIPRINT_JTOOLBAR_ARE_YOU_SURE_TO_DELETE'), 'delete', "RTIPRINT_JTOOLBAR_DELETE", 'printer.delete', false); } $model_printer_model = CkJModel::getInstance('Printermdls', 'RtiprintModel'); $model_printer_model->addGroupOrder("a.name"); $lists['fk']['printer_model'] = $model_printer_model->getItems(); $model_server = CkJModel::getInstance('Servers', 'RtiprintModel'); $model_server->addGroupOrder("a.name"); $lists['fk']['server'] = $model_server->getItems(); }
/** * Execute and display a template : Manufacturer * * @access protected * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. * * @since 11.1 */ protected function displayManufacturer($tpl = null) { $document = JFactory::getDocument(); $this->title = JText::_("RTIPRINT_LAYOUT_MANUFACTURER"); $document->title = $document->titlePrefix . $this->title . $document->titleSuffix; // Initialiase variables. $this->model = $model = $this->getModel(); $this->state = $state = $this->get('State'); $state->set('context', 'manufacturer.manufacturer'); $this->item = $item = $this->get('Item'); $this->form = $form = $this->get('Form'); $this->canDo = $canDo = RtiprintHelper::getActions($model->getId()); $lists = array(); $this->lists =& $lists; $user = JFactory::getUser(); $isNew = $model->getId() == 0; //Check ACL before opening the form (prevent from direct access) if (!$model->canEdit($item, true)) { $model->setError(JText::_('JERROR_ALERTNOAUTHOR')); } // Check for errors. if (count($errors = $model->getErrors())) { JError::raiseError(500, implode(BR, array_unique($errors))); return false; } $jinput = JFactory::getApplication()->input; //Hide the component menu in item layout $jinput->set('hidemainmenu', true); //Toolbar initialization JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_MANUFACTURER'), 'rtiprint_manufacturers'); // Save if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::apply('manufacturer.apply', "RTIPRINT_JTOOLBAR_SAVE"); } // Save & Close if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save('manufacturer.save', "RTIPRINT_JTOOLBAR_SAVE_CLOSE"); } // Save & New if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save2new('manufacturer.save2new', "RTIPRINT_JTOOLBAR_SAVE_NEW"); } // Save to Copy if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) { CkJToolBarHelper::save2copy('manufacturer.save2copy', "RTIPRINT_JTOOLBAR_SAVE_TO_COPY"); } // Cancel CkJToolBarHelper::cancel('manufacturer.cancel', "RTIPRINT_JTOOLBAR_CANCEL"); }