Exemplo n.º 1
3
 /**
  * Overloaded check function
  *
  * @return	boolean
  * @see		JTable::check
  * @since	1.5
  */
 function check()
 {
     // Require helper
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'je_content.php';
     jimport('joomla.filter.output');
     // Set title
     $this->title = htmlspecialchars_decode($this->title, ENT_QUOTES);
     // Set alias
     $this->alias = JE_ContentHelper::convertAlias($this->title);
     $this->alias = JApplication::stringURLSafe($this->alias);
     // Check the publish down date is not earlier than publish up.
     if (intval($this->publish_down) > 0 && $this->publish_down < $this->publish_up) {
         // Swap the dates.
         $temp = $this->publish_up;
         $this->publish_up = $this->publish_down;
         $this->publish_down = $temp;
     }
     // Set ordering
     if ($this->state < 0) {
         // Set ordering to 0 if state is archived or trashed
         $this->ordering = 0;
     } else {
         if (empty($this->ordering)) {
             // Set ordering to last if ordering was 0
             $this->ordering = self::getNextOrder('`catid`=' . $this->_db->Quote($this->catid) . ' AND state>=0');
         }
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = JE_ContentHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title($isNew ? JText::_('COM_JE_CONTENT_MANAGER_ARTICLE_NEW') : JText::_('COM_JE_CONTENT_MANAGER_ARTICLE_EDIT'), 'article.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_je_content', 'core.create')) > 0)) {
         JToolBarHelper::apply('article.apply');
         JToolBarHelper::save('article.save');
         if ($canDo->get('core.create')) {
             JToolBarHelper::save2new('article.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('article.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('article.cancel');
     } else {
         JToolBarHelper::cancel('article.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemplo n.º 3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = JE_ContentHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('COM_JE_CONTENT_MANAGER_ARTICLES'), 'article.png');
     if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_je_content', 'core.create')) > 0) {
         JToolBarHelper::addNew('article.add');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         JToolBarHelper::editList('article.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('articles.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('articles.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::custom('articles.featured', 'featured.png', 'featured_f2.png', 'JFEATURED', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('articles.archive');
         JToolBarHelper::checkin('articles.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'articles.delete', 'JTOOLBAR_EMPTY_TRASH');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('articles.trash');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_je_content');
     }
 }
Exemplo n.º 4
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/je_content.php';
     // Load the submenu.
     JE_ContentHelper::addSubmenu(JRequest::getCmd('view', 'articles'));
     parent::display();
     return $this;
 }