Ejemplo n.º 1
0
 /**
  * Execute and display a template script.
  *
  * @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 Error object.
  *
  * @since   1.5
  */
 public function display($tpl = null)
 {
     $form = $this->get('Form');
     $component = $this->get('Component');
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Bind the form to the data.
     if ($form && $component->params) {
         $form->bind($component->params);
     }
     $this->form =& $form;
     $this->component =& $component;
     $this->components = ConfigHelperComponent::getComponentsWithConfig();
     ConfigHelperComponent::loadLanguageForComponents($this->components);
     $this->userIsSuperAdmin = $user->authorise('core.admin');
     $this->currentComponent = JFactory::getApplication()->input->get('component');
     $this->return = $app->input->get('return', '', 'base64');
     $this->addToolbar();
     parent::display($tpl);
     $app->input->set('hidemainmenu', true);
 }
Ejemplo n.º 2
0
 /**
  * Method to display the view.
  */
 public function display($tpl = null)
 {
     $form = $this->get('Form');
     $data = $this->get('Data');
     $user = JFactory::getUser();
     // Check for model errors.
     if ($errors = $this->get('Errors')) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Bind the form to the data.
     if ($form && $data) {
         $form->bind($data);
     }
     // Get the params for com_users.
     $usersParams = JComponentHelper::getParams('com_users');
     // Get the params for com_media.
     $mediaParams = JComponentHelper::getParams('com_media');
     // Load settings for the FTP layer.
     $ftp = JClientHelper::setCredentialsFromRequest('ftp');
     $this->form =& $form;
     $this->data =& $data;
     $this->ftp =& $ftp;
     $this->usersParams =& $usersParams;
     $this->mediaParams =& $mediaParams;
     $this->components = ConfigHelperComponent::getComponentsWithConfig();
     ConfigHelperComponent::loadLanguageForComponents($this->components);
     $this->userIsSuperAdmin = $user->authorise('core.admin');
     $this->addToolbar();
     parent::display($tpl);
 }