Пример #1
0
 /**
  * Display the view
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::root() . '/administrator/components/com_b2jcontact/css/component.css');
     require_once JPATH_COMPONENT . '/helpers/contact.php';
     require_once JPATH_COMPONENT . '/helpers/b2jlanghandler.php';
     $lang_handler = new B2JLangHandler();
     if ($lang_handler->HasMessages()) {
         $langErrors = $lang_handler->GetMessages();
         $message = 'Thank you for using B2J Contact!<br/>';
         foreach ($langErrors as $langErorr) {
             $message .= $langErorr;
         }
         $message .= "Join B2J Contact Translation group on <a target='_blank' href='http://www.transifex.com/projects/p/b2j-contact/'>Transifex</a>.";
         JFactory::getApplication()->enqueueMessage($message, "warning");
     }
     ContactHelper::addSubmenu('contacts');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Preprocess the list of items to find ordering divisions.
     // TODO: Complete the ordering stuff with nested sets
     foreach ($this->items as &$item) {
         $item->order_up = true;
         $item->order_dn = true;
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Пример #2
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/contact.php';
     // Load the submenu.
     ContactHelper::addSubmenu(JRequest::getCmd('view', 'contacts'));
     $view = JRequest::getCmd('view', 'contacts');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     // Check for edit form.
     if ($view == 'contact' && $layout == 'edit' && !$this->checkEditId('com_contact.edit.contact', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_contact&view=contacts', false));
         return false;
     }
     parent::display();
     return $this;
 }
Пример #3
0
 /**
  * Display the view.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise an Error object.
  */
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     ContactHelper::addSubmenu('contacts');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Preprocess the list of items to find ordering divisions.
     // TODO: Complete the ordering stuff with nested sets
     foreach ($this->items as &$item) {
         $item->order_up = true;
         $item->order_dn = true;
     }
     $this->addToolbar();
     $this->sidebar = JHtmlSidebar::render();
     parent::display($tpl);
 }
Пример #4
0
 /**
  * Display the view.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise an Error object.
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         ContactHelper::addSubmenu('contacts');
     }
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Preprocess the list of items to find ordering divisions.
     // TODO: Complete the ordering stuff with nested sets
     foreach ($this->items as &$item) {
         $item->order_up = true;
         $item->order_dn = true;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         $this->addToolbar();
         $this->sidebar = JHtmlSidebar::render();
     } else {
         // In article associations modal we need to remove language filter if forcing a language.
         // We also need to change the category filter to show show categories with All or the forced language.
         if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD')) {
             // If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
             $languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
             $this->filterForm->setField($languageXml, 'filter', true);
             // Also, unset the active language filter so the search tools is not open by default with this filter.
             unset($this->activeFilters['language']);
             // One last changes needed is to change the category filter to just show categories with All language or with the forced language.
             $this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter');
         }
     }
     return parent::display($tpl);
 }
Пример #5
0
 /**
  * Display the view
  */
 function display()
 {
     // Get the document object.
     $document =& JFactory::getDocument();
     // Set the default view name and format from the Request.
     $vName = JRequest::getWord('view', 'contacts');
     $vFormat = $document->getType();
     $lName = JRequest::getWord('layout', 'default');
     // Get and render the view.
     if ($view =& $this->getView($vName, $vFormat)) {
         // Get the model for the view.
         $model =& $this->getModel($vName);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         $view->display();
         // Load the submenu.
         require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'contact.php';
         ContactHelper::addSubmenu($vName);
     }
 }