Skip to content

Instantly share code, notes, and snippets.

@AmyStephen
Created April 30, 2011 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmyStephen/949312 to your computer and use it in GitHub Desktop.
Save AmyStephen/949312 to your computer and use it in GitHub Desktop.
Administrator Multiple View: Molajo (Top) comparison to Joomla! 1.6 (Bottom)
<?php
/**
* @version $id: view.html.php
* @package Molajo
* @subpackage Multiple View
* @copyright Copyright (C) 2011 Individual Molajo Contributors. All rights reserved.
* @license GNU General Public License Version 2, or later http://www.gnu.org/licenses/gpl.html
*/
defined('MOLAJO') or die;
/**
* View to list Items
*
* @package Molajo
* @subpackage Multiple View
* @since 1.6
*/
class ThingsViewThings extends MolajoViewMultiple {}
<?php
/**
* @version $Id: view.html.php 20814 2011-02-21 21:10:40Z dextercowley $
* @package Joomla.Administrator
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
/**
* View class for a list of articles.
*
* @package Joomla.Administrator
* @subpackage com_content
* @since 1.6
*/
class ContentViewArticles extends JView
{
protected $items;
protected $pagination;
protected $state;
/**
* 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');
$this->authors = $this->get('Authors');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions($this->state->get('filter.category_id'));
$user = JFactory::getUser();
JToolBarHelper::title(JText::_('COM_CONTENT_ARTICLES_TITLE'), 'article.png');
if ($canDo->get('core.create') || (count($user->getAuthorisedCategories('com_content', 'core.create'))) > 0 ) {
JToolBarHelper::addNew('article.add','JTOOLBAR_NEW');
}
if (($canDo->get('core.edit')) || ($canDo->get('core.edit.own'))) {
JToolBarHelper::editList('article.edit','JTOOLBAR_EDIT');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::divider();
JToolBarHelper::custom('articles.publish', 'publish.png', 'publish_f2.png','JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('articles.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::custom('articles.featured', 'featured.png', 'featured_f2.png', 'JFEATURED', true);
JToolBarHelper::divider();
JToolBarHelper::archiveList('articles.archive','JTOOLBAR_ARCHIVE');
JToolBarHelper::custom('articles.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
}
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'articles.delete','JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
}
else if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('articles.trash','JTOOLBAR_TRASH');
JToolBarHelper::divider();
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_content');
JToolBarHelper::divider();
}
JToolBarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment