コード例 #1
0
ファイル: controller.php プロジェクト: andresmaeso/neno
 /**
  * {@inheritdoc}
  *
  * @param   boolean $cachable  If Joomla should cache the response
  * @param   array   $urlParams URL parameters
  *
  * @return JController
  */
 public function display($cachable = false, $urlParams = array())
 {
     $input = $this->input;
     $view = $input->getCmd('view', 'dashboard');
     $app = JFactory::getApplication();
     if (NenoSettings::get('installation_completed') != 1 && $view != 'installation' && $view != 'debug' && $app->isAdmin()) {
         if ($view != 'dashboard') {
             $app->enqueueMessage(JText::_('COM_NENO_INSTALLATION_ERROR'), 'error');
         }
         $app->redirect('index.php?option=com_neno&view=installation');
     }
     $input->set('view', $view);
     // Ensure that a working language is set for some views
     $viewsThatRequireWorkingLanguage = array('groupselements', 'editor', 'strings');
     $showLanguagesDropDown = false;
     if (in_array($view, $viewsThatRequireWorkingLanguage)) {
         // Get working language
         $workingLanguage = NenoHelper::getWorkingLanguage();
         $languages = JFactory::getLanguage()->getKnownLanguages();
         $showLanguagesDropDown = true;
         if (empty($workingLanguage) || !in_array($workingLanguage, array_keys($languages))) {
             $url = JRoute::_('index.php?option=com_neno&view=setworkinglang&next=' . $view, false);
             $this->setRedirect($url);
             $this->redirect();
         }
     }
     NenoHelperBackend::setAdminTitle($showLanguagesDropDown);
     parent::display($cachable, $urlParams);
     return $this;
 }