Ejemplo n.º 1
0
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->params = $this->state->params;
     $this->modules = JFactory::getDocument()->loadRenderer('modules');
     $this->toolbar = $this->getToolbar();
     $dispatcher = JDispatcher::getInstance();
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Process the content plugins.
     if (!empty($this->item)) {
         // Fake content item
         PFObjectHelper::toContentItem($this->item);
         // Import plugins
         JPluginHelper::importPlugin('content');
         $context = 'com_pfprojects.project';
         // Trigger events
         $results = $dispatcher->trigger('onContentPrepare', array($context, &$this->item, &$this->params, 0));
         $this->item->event = new stdClass();
         $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$this->item, &$this->params, 0));
         $this->item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$this->item, &$this->params, 0));
         $this->item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$this->item, &$this->params, 0));
         $this->item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     // Prepare the document
     $this->prepareDocument();
     // Display
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $dispatcher = JDispatcher::getInstance();
     $user = JFactory::getUser();
     $uid = $user->get('id');
     $item = $this->get('Item');
     $state = $this->get('State');
     $print = JRequest::getBool('print');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Check the view access.
     if (!$item->params->get('access-view')) {
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Set active project
     if (!PFApplicationHelper::setActiveProject($item->project_id)) {
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Merge milestone params. If this is single-milestone view, menu params override milestone params
     // Otherwise, milestone params override menu item params
     $params = $state->get('params');
     $active = $app->getMenu()->getActive();
     $temp = clone $params;
     // Check to see which parameters should take priority
     if ($active) {
         $current_link = $active->link;
         if (strpos($current_link, 'view=milestone') && strpos($current_link, '&id=' . (string) $item->id)) {
             $item->params->merge($temp);
             // Load layout from active query (in case it is an alternative menu item)
             if (isset($active->query['layout'])) {
                 $this->setLayout($active->query['layout']);
             }
         } else {
             // Merge the menu item params with the milestone params so that the milestone params take priority
             $temp->merge($item->params);
             $item->params = $temp;
             // Check for alternative layouts (since we are not in a single-milestone menu item)
             if ($layout = $item->params->get('milestone_layout')) {
                 $this->setLayout($layout);
             }
         }
     } else {
         // Merge so that milestone params take priority
         $temp->merge($item->params);
         $item->params = $temp;
         // Check for alternative layouts (since we are not in a single-milestone menu item)
         if ($layout = $item->params->get('milestone_layout')) {
             $this->setLayout($layout);
         }
     }
     $offset = $state->get('list.offset');
     // Fake some content item properties to avoid plugin issues
     PFObjectHelper::toContentItem($item);
     // Process the content plugins.
     JPluginHelper::importPlugin('content');
     $results = $dispatcher->trigger('onContentPrepare', array('com_pfmilestones.milestone', &$item, &$params, $offset));
     $item->event = new stdClass();
     $results = $dispatcher->trigger('onContentAfterTitle', array('com_pfmilestones.milestone', &$item, &$params, $offset));
     $item->event->afterDisplayTitle = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_pfmilestones.milestone', &$item, &$params, $offset));
     $item->event->beforeDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentAfterDisplay', array('com_pfmilestones.milestone', &$item, &$params, $offset));
     $item->event->afterDisplayContent = trim(implode("\n", $results));
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx'));
     // Assign references
     $this->assignRef('params', $params);
     $this->assignRef('state', $state);
     $this->assignRef('user', $user);
     $this->assignRef('item', $item);
     $this->assignRef('print', $print);
     $this->toolbar = $this->getToolbar();
     $this->_prepareDocument();
     parent::display($tpl);
 }
Ejemplo n.º 3
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $dispatcher = JDispatcher::getInstance();
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->user = $user;
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->toolbar = $this->getToolbar();
     if ($this->item->revision) {
         // If we're looking at a specific revision
         $this->revision =& $this->item->revision;
     }
     // Get all revisions
     $this->model_revisions = JModelLegacy::getInstance('Revisions', 'PFdesignsModel');
     // Need to override the revisions state filter if not set
     $rev_state = (int) $this->model_revisions->getState('filter.state');
     $rev_filter = $this->model_revisions->getState('filter.isset');
     if (!$rev_state) {
         $rev_state = 1;
     }
     if ($this->item->state != $rev_state && !$rev_filter) {
         $this->model_revisions->setState('filter.state', $this->item->state);
         $this->model_revisions->setState('filter.isset', true);
     }
     // Get all revisions
     $this->revisions = (array) $this->model_revisions->getItems();
     // Get the revisions toolbar
     $this->toolbar_rev = $this->getRevisionsToolbar();
     // Merge item params.
     $this->params = $this->state->get('params');
     $active = $app->getMenu()->getActive();
     $temp = clone $this->params;
     // Check to see which parameters should take priority
     if ($active) {
         $currentLink = $active->link;
         if (strpos($currentLink, 'view=design') && strpos($currentLink, '&id=' . (string) $this->item->id)) {
             $this->item->params->merge($temp);
             // Load layout from active query (in case it is an alternative menu item)
             if (isset($active->query['layout'])) {
                 $this->setLayout($active->query['layout']);
             }
         } else {
             // Merge the menu item params with the milestone params so that the milestone params take priority
             $temp->merge($this->item->params);
             $this->item->params = $temp;
             // Check for alternative layouts (since we are not in a menu item)
             if ($layout = $this->item->params->get('design_layout')) {
                 $this->setLayout($layout);
             }
         }
     } else {
         // Merge so that item params take priority
         $temp->merge($this->item->params);
         $this->item->params = $temp;
         // Check for alternative layouts (since we are not in a menu item)
         if ($layout = $this->item->params->get('design_layout')) {
             $this->setLayout($layout);
         }
     }
     if ($this->revision) {
         // Check the view access to the item (the model has already computed the values).
         if ($this->revision->params->get('access-view') != true && ($this->revision->params->get('show_noauth') != true && $user->get('guest'))) {
             JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
             return;
         }
         // Fake some article content item
         PFObjectHelper::toContentItem($this->revision);
         $this->revision->event = new stdClass();
         // Process the content plugins.
         JPluginHelper::importPlugin('content');
         $offset = $this->state->get('list.offset');
         $results = $dispatcher->trigger('onContentPrepare', array('com_pfdesigns.revision', &$this->revision, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_pfdesigns.revision', &$this->revision, &$this->params, $offset));
         $this->revision->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_pfdesigns.revision', &$this->revision, &$this->params, $offset));
         $this->revision->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_pfdesigns.revision', &$this->revision, &$this->params, $offset));
         $this->revision->event->afterDisplayContent = trim(implode("\n", $results));
     } else {
         // Check the view access to the item (the model has already computed the values).
         if ($this->item->params->get('access-view') != true && ($this->item->params->get('show_noauth') != true && $user->get('guest'))) {
             JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
             return;
         }
         // Fake some article content item
         PFObjectHelper::toContentItem($this->item);
         $this->item->event = new stdClass();
         // Process the content plugins.
         JPluginHelper::importPlugin('content');
         $offset = $this->state->get('list.offset');
         $results = $dispatcher->trigger('onContentPrepare', array('com_pfdesigns.design', &$this->item, &$this->params, $offset));
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_pfdesigns.design', &$this->item, &$this->params, $offset));
         $this->item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_pfdesigns.design', &$this->item, &$this->params, $offset));
         $this->item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_pfdesigns.design', &$this->item, &$this->params, $offset));
         $this->item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     parent::display($tpl);
 }