示例#1
0
 /**
  * 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 MonitorModelIssue();
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     // Get the params
     // TODO: may be removed when new MVC is implemented completely
     $this->app = JFactory::getApplication();
     if ($this->app instanceof JApplicationSite) {
         $params = $this->app->getParams();
     }
     if (!$model->canEdit($user, $id)) {
         if ($user->guest && isset($params) && $params->get('redirect_login', 1)) {
             $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
             $this->app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode(JUri::getInstance()->toString()), '403'));
         } else {
             throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     if ($id) {
         $model->setIssueId($id);
     }
     $model->loadForm();
     $view = new MonitorViewIssueHtml($model);
     $view->setLayout('edit');
     $view->loadForm();
     echo $view->render();
     return true;
 }
示例#2
0
 /**
  * Get the configuration for the component and (if given) the active menu item.
  *
  * TODO: may be removed when new MVC is implemented completely
  *
  * @return  \Joomla\Registry\Registry  Object containing the parameters.
  */
 public function getParams()
 {
     if ($this->app instanceof JApplicationSite) {
         $params = $this->app->getParams();
         $active = $this->app->getMenu()->getActive();
         if ($active) {
             $params->merge($active->params);
         }
     } else {
         $params = JComponentHelper::getParams('com_monitor');
     }
     return $params;
 }
示例#3
0
文件: list.php 项目: pascal26/fabrik
 /**
  * Set model sate
  *
  * @return  void
  */
 protected function populateState()
 {
     $input = $this->app->input;
     if (!$this->app->isAdmin()) {
         // Load the menu item / component parameters.
         $params = $this->app->getParams();
         $this->setState('params', $params);
         // Load state from the request.
         $pk = $input->getInt('listid', $params->get('listid'));
     } else {
         $pk = $input->getInt('listid');
     }
     $this->setState('list.id', $pk);
     $offset = $input->getInt('limitstart');
     $this->setState('list.offset', $offset);
 }