コード例 #1
0
ファイル: params.php プロジェクト: site4com/prometheus
 /**
  * Edit the component parameters
  */
 public function edit($key = null, $urlVar = null)
 {
     // Access check.
     if (!JFactory::getUser()->authorise('core.admin', 'com_attachments')) {
         return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 117)');
     }
     // Get the component parameters
     jimport('joomla.application.component.helper');
     $params = JComponentHelper::getParams('com_attachments');
     // Get the component model/table
     $model = new ConfigModelComponent();
     $state = $model->getState();
     $state->set('component.option', 'com_attachments');
     $state->set('component.path', JPATH_ADMINISTRATOR . '/components/com_attachments');
     $model->setState($state);
     $form = $model->getForm();
     $component = JComponentHelper::getComponent('com_attachments');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors) . ' (ERR 118)');
         return false;
     }
     // Bind the form to the data.
     if ($form && $component->params) {
         $form->bind($component->params);
     }
     // Set up the view
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/views/params/view.html.php';
     $view = new AttachmentsViewParams();
     $view->setModel($model);
     $view->params = $params;
     $view->form = $form;
     $view->component = $component;
     $view->display();
 }