/** * Execute the controller. * * @return boolean True if controller finished execution, false if the controller did not * finish execution. A controller might return false if some precondition for * the controller to run has not been satisfied. * * @since 12.1 * @throws LogicException * @throws RuntimeException */ public function execute() { $model = new MonitorModelClassification(); $model->setProjectId($this->input->getInt('project_id')); $view = new MonitorViewClassificationsList($model); echo $view->render(); }
/** * Execute the controller. * * @return boolean True if controller finished execution, false if the controller did not * finish execution. A controller might return false if some precondition for * the controller to run has not been satisfied. * * @since 12.1 * @throws LogicException * @throws RuntimeException */ public function execute() { $app = JFactory::getApplication(); $id = $this->input->getInt('id'); $model = new MonitorModelClassification($app); if (!JFactory::getUser()->authorise('classification.edit', 'com_monitor')) { throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); } $classification_id = $model->save($this->input); if ($classification_id === false) { $url = 'index.php?option=com_monitor&task=classification.edit'; if ($id) { $url .= '&id=' . $id; } $app->redirect(JRoute::_($url, false)); return false; } $app->enqueueMessage(\JText::_('COM_MONITOR_CLASSIFICATION_SAVED')); if ($app->isAdmin()) { $app->redirect(JRoute::_('index.php?option=com_monitor&view=classifications', false)); } else { $app->redirect(JRoute::_('index.php?option=com_monitor&view=classification&id=' . $classification_id, false)); } return true; }
/** * Method to render the view. * * @return string The rendered view. * * @since 12.1 * @throws RuntimeException */ public function render() { $this->prefix = 'classification'; $classifications = $this->model->getClassifications(); $this->items = $classifications; $this->setLayout('default'); $this->addToolbar(); return parent::render(); }
/** * Method to render the view. * * @return string The rendered view. * * @throws RuntimeException */ public function render() { $this->item = $this->model->getClassification(); if ($this->getLayout() == null) { $this->setLayout('edit'); } $this->form = $this->model->getForm(); $this->addToolbar(); return parent::render(); }
/** * Execute the controller. * * @return boolean True if controller finished execution, false if the controller did not * finish execution. A controller might return false if some precondition for * the controller to run has not been satisfied. * * @since 12.1 * @throws LogicException * @throws RuntimeException */ public function execute() { if (!JFactory::getUser()->authorise('classification.delete', 'com_monitor')) { throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); } $app = JFactory::getApplication(); $model = new MonitorModelClassification($app); $model->delete($app->input->get('cid', array(), 'array')); $app->enqueueMessage(JText::_('COM_MONITOR_CLASSIFICATION_DELETED')); $app->redirect(JRoute::_('index.php?option=com_monitor&view=classifications', false)); return true; }
/** * Execute the controller. * * @return boolean True if controller finished execution, false if the controller did not * finish execution. A controller might return false if some precondition for * the controller to run has not been satisfied. * * @since 12.1 * @throws LogicException * @throws RuntimeException */ public function execute() { if (!JFactory::getUser()->authorise('classification.edit', 'com_monitor')) { throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); } $model = new MonitorModelClassification(); $cid = $this->input->get('cid', array(), 'array'); $id = $cid ? $cid[0] : $this->input->getInt('id'); $model->setClassificationId($id); $model->loadForm(); $view = new MonitorViewClassificationHtml($model); $view->setLayout('edit'); echo $view->render(); return true; }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getOptions() { $options = array(); JLoader::register('MonitorModelAbstract', JPATH_ROOT . '/administrator/components/com_monitor/model/abstract.php'); JLoader::register('MonitorModelClassification', JPATH_ROOT . '/administrator/components/com_monitor/model/classification.php'); $model = new MonitorModelClassification(null, false); $classifications = $model->getClassifications(); $user = JFactory::getUser(); foreach ($classifications as $classification) { if (in_array($classification->access, $user->getAuthorisedViewLevels())) { $options[] = JHtml::_('select.option', $classification->id, $classification->title); } } $options = array_merge(parent::getOptions(), $options); return $options; }