Skip to content

Instantly share code, notes, and snippets.

@eddieajau
Created January 27, 2013 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eddieajau/4651493 to your computer and use it in GitHub Desktop.
Save eddieajau/4651493 to your computer and use it in GitHub Desktop.
Eclipse snippet category for backend component lists in Joomla 2.5 (all except view layouts are applicable for Joomla 3.0). Includes: Controller Set Default View, Backend List View, Backend List Layout, Backend List Model, Backend List Layout Search Filter, Backend List Model Search Filters (state), Backend List Model Search Filters (query), Bac…
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<snippets>
<category filters="*" id="category_1276571415504" initial_state="1" label="Backend Lists" largeicon="" smallicon="">
<description><![CDATA[Snippets specifically for creating backend list views.]]></description>
<item category="category_1276571415504" class="" editorclass="" id="item_1276485904815" label="Controller Set Default View" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet is intended for the master controller and adds the "default_view" property to class definition. The default view is assumed to be the name of the component (less the com_ prefix). If you want to change the default view then add this snippet.]]></description>
<content><![CDATA[ /**
* @var string The default view.
* @since ${SINCE}
*/
protected $default_view = '${VIEW}';
]]></content>
<variable default="1.0" id="name_1" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
<variable default="" id="name_2" name="VIEW">
<description><![CDATA[The lower case name of the view that is the default view for the component.]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276486128667" label="Backend List View" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds a typical backend list view with typical toolbar support.]]></description>
<content><![CDATA[jimport('joomla.application.component.view');
/**
* ${NAME} view.
*
* @package ${PACKAGE}
* @subpackage ${SUBPACKAGE}
* @since ${SINCE}
*/
class ${NAME}View${VIEW} extends JView
{
/**
* @var array The array of records to display in the list.
* @since ${SINCE}
*/
protected $items;
/**
* @var JPagination The pagination object for the list.
* @since ${SINCE}
*/
protected $pagination;
/**
* @var JObject The model state.
* @since ${SINCE}
*/
protected $state;
/**
* Prepare and display the ${VIEW} view.
*
* @return void
* @since ${SINCE}
*/
public function display()
{
// Initialise variables.
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Add the toolbar and display the view layout.
$this->addToolbar();
parent::display();
}
/**
* Add the page title and toolbar.
*
* @return void
* @since ${SINCE}
*/
protected function addToolbar()
{
// Initialise variables.
$state = $this->get('State');
$canDo = ${NAME}Helper::getActions();
JToolBarHelper::title(JText::_('COM_${NAME}_${VIEW}_TITLE'));
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('${CONTROLLER_ITEM}.add', 'JTOOLBAR_NEW');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editList('${CONTROLLER_ITEM}.edit', 'JTOOLBAR_EDIT');
}
if ($canDo->get('core.edit.state')) {
JToolBarHelper::publishList('${CONTROLLER_LIST}.publish', 'JTOOLBAR_PUBLISH');
JToolBarHelper::unpublishList('${CONTROLLER_LIST}.unpublish', 'JTOOLBAR_UNPUBLISH');
JToolBarHelper::archiveList('${CONTROLLER_LIST}.archive','JTOOLBAR_ARCHIVE');
}
if ($state->get('filter.published') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', '${CONTROLLER_LIST}.delete','JTOOLBAR_EMPTY_TRASH');
}
else if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('${CONTROLLER_LIST}.trash','JTOOLBAR_TRASH');
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('${OPTION}');
}
}
}]]></content>
<variable default="" id="name_1" name="PACKAGE">
<description><![CDATA[The API package.]]></description>
</variable>
<variable default="" id="name_2" name="SUBPACKAGE">
<description><![CDATA[The API subpackage.]]></description>
</variable>
<variable default="1.0" id="name_3" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
<variable default="" id="name_4" name="NAME">
<description><![CDATA[The proper case name of the component (without com_).]]></description>
</variable>
<variable default="" id="name_5" name="VIEW">
<description><![CDATA[The proper case name of the view.]]></description>
</variable>
<variable default="" id="name_6" name="CONTROLLER_ITEM">
<description><![CDATA[The controller prefix to be used for individual items (like add and edit).]]></description>
</variable>
<variable default="" id="name_7" name="CONTROLLER_LIST">
<description><![CDATA[The controller prefix to be used for list-based tasks (like publish and delete).]]></description>
</variable>
<variable default="" id="name_8" name="OPTION">
<description><![CDATA[The lower case option for the component (with com_).]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276488152618" label="Backend List Layout" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds the typical layout table for a backend list view.]]></description>
<content><![CDATA[//JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=${OPTION}&view=${VIEW_LIST}');?>" method="post" name="adminForm">
<table class="adminlist">
<thead>
<tr>
<th width="1%">
<input type="checkbox" name="toggle" value="" onclick="checkAll(this)" />
</th>
<th>
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th width="5%">
<?php echo JHtml::_('grid.sort', 'JPUBLISHED', 'a.state', $listDirn, $listOrder); ?>
</th>
<th width="10%">
<?php echo JHtml::_('grid.sort', 'JCATEGORY', 'a.catid', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ORDERING', 'a.ordering', $listDirn, $listOrder); ?>
<?php echo JHtml::_('grid.order', $this->items, 'filesave.png', '${VIEW_LIST}.saveorder'); ?>
</th>
<th width="10%">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
</th>
<th width="10%">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_CREATED_BY', 'a.created_by', $listDirn, $listOrder); ?>
</th>
<th width="5%">
<?php echo JHtml::_('grid.sort', 'JDATE', 'a.created_time', $listDirn, $listOrder); ?>
</th>
<th width="5%">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.${PK}', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="15">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$item->max_ordering = 0; //??
$ordering = ($listOrder == 'a.ordering');
$canCreate = $user->authorise('core.create', '${OPTION}.category.'.$item->category_id);
$canEdit = $user->authorise('core.edit', '${OPTION}.${VIEW_ITEM}.'.$item->${PK});
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', '${OPTION}.${VIEW_ITEM}.'.$item->${PK}) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i, $item->${PK}); ?>
</td>
<td>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, '${VIEW_LIST}.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canCreate || $canEdit) : ?>
<a href="<?php echo JRoute::_('index.php?option=${OPTION}&task=${VIEW_ITEM}.edit&${PK}='.$item->${PK});?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<p class="smallsub">
<?php if (empty($item->note)) : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
<?php else : ?>
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note));?>
<?php endif; ?></p>
</td>
<td class="center">
<?php echo JHtml::_('jgrid.published', $item->published, $i, '${VIEW_LIST}.', $canChange); ?>
</td>
<td class="center">
<?php echo $this->escape($item->category_title); ?>
</td>
<td class="order">
<?php if ($canChange) : ?>
<span><?php echo $this->pagination->orderUpIcon($i,
($item->category_id == @$this->items[$i-1]->category_id),
'${VIEW_LIST}.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?></span>
<span><?php echo $this->pagination->orderDownIcon($i,
$this->pagination->total,
($item->category_id == @$this->items[$i+1]->category_id),
'${VIEW_LIST}.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?></span>
<?php $disabled = $ordering ? '' : 'disabled="disabled"'; ?>
<input type="text" name="order[]" size="5" value="<?php echo $item->ordering;?>" <?php echo $disabled ?> class="text-area-order" />
<?php else : ?>
<?php echo (int) $item->ordering; ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="center">
<?php echo $this->escape($item->author_name); ?>
</td>
<td class="center">
<?php echo JHTML::_('date',$item->created_time, 'Y-m-d'); ?>
</td>
<td class="center">
<?php if ($item->language == '*'): ?>
<?php echo JText::_('JALL'); ?>
<?php else: ?>
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
<?php endif; ?>
</td>
<td class="center">
<?php echo (int) $item->${PK}; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
]]></content>
<variable default="" id="name_1" name="OPTION">
<description><![CDATA[The lower case option for the component (with com_).]]></description>
</variable>
<variable default="" id="name_2" name="VIEW_LIST">
<description><![CDATA[The lower case name of this view.]]></description>
</variable>
<variable default="" id="name_3" name="VIEW_ITEM">
<description><![CDATA[The lower case name of the edit view for the single item.]]></description>
</variable>
<variable default="id" id="name_4" name="PK">
<description><![CDATA[The name of the primary key field in the database for the data type displayed.]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276487707887" label="Backend List Model" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds the basic model to support a backend list.]]></description>
<content><![CDATA[jimport('joomla.application.component.modellist');
/**
* ${MODEL} model.
*
* @package ${PACKAGE}
* @subpackage ${SUBPACKAGE}
* @since ${SINCE}
*/
class ${NAME}Model${MODEL} extends JModelList
{
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
* @since ${SINCE}
*/
protected function populateState($ordering = '${SORTFIELD}', $direction = 'asc')
{
// Set list state ordering defaults.
parent::populateState($ordering, $direction);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
* @since ${SINCE}
*/
protected function getListQuery()
{
// Initialise variables.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.${PK}, a.title, a.alias, a.checked_out, a.checked_out_time, a.category_id,' .
'a.published, a.access, a.created_time, a.ordering, a.language'
)
);
$query->from('#__${DBTABLE} AS a');
// Join over the language
$query->select('l.title AS language_title');
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
// Join over the users for the checked out user.
$query->select('uc.name AS editor');
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Join over the categories.
$query->select('c.title AS category_title');
$query->join('LEFT', '#__categories AS c ON c.id = a.category_id');
// Join over the users for the author.
$query->select('ua.name AS author_name');
$query->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id');
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering');
$orderDirn = $this->state->get('list.direction');
if ($orderCol == 'a.ordering' || $orderCol == 'category_title') {
$orderCol = 'category_title '.$orderDirn.', a.ordering';
}
$query->order($db->getEscaped($orderCol.' '.$orderDirn));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
}]]></content>
<variable default="" id="name_1" name="PACKAGE">
<description><![CDATA[The API package.]]></description>
</variable>
<variable default="" id="name_2" name="SUBPACKAGE">
<description><![CDATA[The API subpackage.]]></description>
</variable>
<variable default="1.0" id="name_3" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
<variable default="" id="name_4" name="NAME">
<description><![CDATA[The proper case name of the component (without com_).]]></description>
</variable>
<variable default="" id="name_5" name="MODEL">
<description><![CDATA[The proper case name of the model.]]></description>
</variable>
<variable default="a.title" id="name_6" name="SORTFIELD">
<description><![CDATA[The default sort field.]]></description>
</variable>
<variable default="" id="name_7" name="DBTABLE">
<description><![CDATA[The name of the actual database table (without prefix). Usually plural form.]]></description>
</variable>
<variable default="id" id="name_8" name="PK">
<description><![CDATA[The name of the primary key field.]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276489090066" label="Backend List Subcontroller" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds the basic sub-controller to support a backend list view (for example, publishing icons, trashing/deleting, etc).]]></description>
<content><![CDATA[jimport('joomla.application.component.controlleradmin');
/**
* ${VIEW} Subcontroller.
*
* @package ${PACKAGE}
* @subpackage ${SUBPACKAGE}
* @since ${SINCE}
*/
class ${NAME}Controller${VIEW} extends JControllerAdmin
{
/**
* Proxy for getModel.
*
* @param string $name The name of the model.
* @param string $prefix The prefix for the model class name.
* @param string $config The model configuration array.
*
* @return ${NAME}Model${VIEW} The model for the controller set to ignore the request.
* @since 1.6
*/
public function getModel($name = '${MODEL}', $prefix = '${NAME}Model', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
}]]></content>
<variable default="" id="name_1" name="PACKAGE">
<description><![CDATA[The API package.]]></description>
</variable>
<variable default="" id="name_2" name="SUBPACKAGE">
<description><![CDATA[The API subpackage.]]></description>
</variable>
<variable default="1.0" id="name_3" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
<variable default="" id="name_4" name="NAME">
<description><![CDATA[The proper case name of the component (without com_).]]></description>
</variable>
<variable default="" id="name_5" name="VIEW">
<description><![CDATA[The proper case name of the view.]]></description>
</variable>
<variable default="" id="name_6" name="MODEL">
<description><![CDATA[The proper case of the name of the model for this view (usually the singluar form of the view).]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276505443569" label="Backend List Layout Search Filter" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippets adds a typcial search and filter block for a backend list view. Insert it after the opening form tag for the list table.]]></description>
<content><![CDATA[ <fieldset id="filter-bar">
<div class="filter-search fltlft">
<label class="filter-search-lbl" for="filter_search">
<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>:</label>
<input type="text" name="filter_search" id="filter_search"
value="<?php echo $this->escape($this->state->get('filter.search')); ?>"
title="<?php echo JText::_('${OPTION}_${VIEW}_FILTER_SEARCH_DESC'); ?>" />
<button type="submit" class="btn">
<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.id('filter_search').value='';this.form.submit();">
<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<div class="filter-select fltrt">
<select name="filter_published" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'),
'value', 'text', $this->state->get('filter.published'), true);?>
</select>
<select name="filter_category_id" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_CATEGORY');?></option>
<?php echo JHtml::_('select.options', JHtml::_('category.options', '${OPTION_LOWER}'),
'value', 'text', $this->state->get('filter.category_id'));?>
</select>
<select name="filter_access" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_ACCESS');?></option>
<?php echo JHtml::_('select.options', JHtml::_('access.assetgroups'),
'value', 'text', $this->state->get('filter.access'));?>
</select>
<select name="filter_language" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_LANGUAGE');?></option>
<?php echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true),
'value', 'text', $this->state->get('filter.language'));?>
</select>
</div>
</fieldset>
<div class="clr"> </div>
]]></content>
<variable default="" id="name_1" name="VIEW">
<description><![CDATA[The upper case name of this view.]]></description>
</variable>
<variable default="" id="name_2" name="OPTION">
<description><![CDATA[The upper case option for the component (with COM_).]]></description>
</variable>
<variable default="" id="name_3" name="OPTION_LOWER">
<description><![CDATA[The lower case option for the component (with com_).]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276491067224" label="Backend List Model Search Filters (state)" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds code that will remember the search and filter state of a backend list view. Insert it in the populateState method (above the call to parent::populateState) of the list model.]]></description>
<content><![CDATA[ // Initialise variables.
$app = JFactory::getApplication();
$value = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $value);
$value = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $value);
$value = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '');
$this->setState('filter.published', $value);
$value = $app->getUserStateFromRequest($this->context.'.filter.category_id', 'filter_category_id');
$this->setState('filter.category_id', $value);
$value = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
$this->setState('filter.language', $value);
]]></content>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276491092403" label="Backend List Model Search Filters (query)" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds the constraints for any search and filter state selected by the user in the list view UI. Add it to the list model's getListQuery method (above the code block that handles the ordering).]]></description>
<content><![CDATA[ // Filter by search in title
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
} else {
$search = $db->Quote('%'.$db->getEscaped($search, true).'%');
$query->where('(a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$query->where('a.access = ' . (int) $access);
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.published = ' . (int) $published);
} else if ($published === '') {
$query->where('(a.published = 0 OR a.published = 1)');
}
// Filter by a single or group of categories.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$query->where('a.category_id = '.(int) $categoryId);
}
else if (is_array($categoryId)) {
JArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
$query->where('a.category_id IN ('.$categoryId.')');
}
// Filter on the language.
if ($language = $this->getState('filter.language')) {
$query->where('a.language = '.$db->quote($language));
}
]]></content>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276490990251" label="Backend List Model getStoreId" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet adds the unique identifiers for the search and filter state for the list view.]]></description>
<content><![CDATA[ /**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
* @since 1.6
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.category_id');
$id .= ':'.$this->getState('filter.language');
return parent::getStoreId($id);
}
]]></content>
<variable default="1.0" id="name_1" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1276519579554" label="Backend List Published INI Strings" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[Adds language strings for common change of state operations (publishing, etc)]]></description>
<content><![CDATA[COM_${NAME}${STUB}_N_ITEMS_ARCHIVED="%d ${PLURAL} archived"
COM_${NAME}${STUB}_N_ITEMS_ARCHIVED_0="No ${PLURAL} archived"
COM_${NAME}${STUB}_N_ITEMS_ARCHIVED_1="1 ${SINGULAR} archived"
COM_${NAME}${STUB}_N_ITEMS_DELETED="%d ${PLURAL} deleted"
COM_${NAME}${STUB}_N_ITEMS_DELETED_0="No ${PLURAL} deleted"
COM_${NAME}${STUB}_N_ITEMS_DELETED_1="1 ${SINGULAR} deleted"
COM_${NAME}${STUB}_N_ITEMS_PUBLISHED="%d ${PLURAL} published"
COM_${NAME}${STUB}_N_ITEMS_PUBLISHED_0="No ${PLURAL} published"
COM_${NAME}${STUB}_N_ITEMS_PUBLISHED_1="1 ${SINGULAR} published"
COM_${NAME}${STUB}_N_ITEMS_TRASHED="%d ${PLURAL} trashed"
COM_${NAME}${STUB}_N_ITEMS_TRASHED_0="No ${PLURAL} trashed"
COM_${NAME}${STUB}_N_ITEMS_TRASHED_1="1 ${SINGULAR} trashed"
COM_${NAME}${STUB}_N_ITEMS_UNPUBLISHED="%d ${PLURAL} unpublished"
COM_${NAME}${STUB}_N_ITEMS_UNPUBLISHED_0="No ${PLURAL} unpublished"
COM_${NAME}${STUB}_N_ITEMS_UNPUBLISHED_1="1 ${SINGULAR} unpublished"
]]></content>
<variable default="" id="name_1" name="NAME">
<description><![CDATA[The upper case name of the component (without COM_).]]></description>
</variable>
<variable default="" id="name_2" name="SINGULAR">
<description><![CDATA[The singular form of the item being actioned.]]></description>
</variable>
<variable default="" id="name_3" name="PLURAL">
<description><![CDATA[The plural form of the item being actioned.]]></description>
</variable>
<variable default="" id="name_4" name="STUB">
<description><![CDATA[An optional stub to add after the component name (used when you are supporting multiple list views)]]></description>
</variable>
</item>
<item category="category_1276571415504" class="" editorclass="" id="item_1298436596259" label="Backend List Model Constructor" largeicon="" smallicon="" snippetProvider="org.eclipse.wst.common.snippets.ui.TextSnippetProvider">
<description><![CDATA[This snippet overrides the JModelList constructor to add allowed ordering fields. It provides a selection of common fields used in a list view. Alter to suit the data for the list view.]]></description>
<content><![CDATA[ /**
* Constructor override.
*
* @param array $config An optional associative array of configuration settings.
*
* @return ${NAME}Model${MODEL}
* @since ${SINCE}
* @see JModelList
*/
public function __construct($config = array())
{
if (empty($config['filter_fields'])) {
$config['filter_fields'] = array(
'${PK}', 'a.${PK}',
'title', 'a.title',
'alias', 'a.alias',
'checked_out', 'a.checked_out',
'checked_out_time', 'a.checked_out_time',
'catid', 'a.catid', 'category_title',
'published', 'a.published',
'access', 'a.access', 'access_level',
'ordering', 'a.ordering',
'language', 'a.language',
'created_time', 'a.created_time',
'created_user_id', 'a.created_user_id',
'modified_time', 'a.modified_time',
'modified_user_id', 'a.modified_user_id',
);
}
parent::__construct($config);
}
]]></content>
<variable default="1.0" id="name_1" name="SINCE">
<description><![CDATA[The version this feature was added.]]></description>
</variable>
<variable default="" id="name_2" name="NAME">
<description><![CDATA[The proper case name of the component (without com_).]]></description>
</variable>
<variable default="" id="name_3" name="MODEL">
<description><![CDATA[The proper case of the name of the model.]]></description>
</variable>
<variable default="id" id="name_4" name="PK">
<description><![CDATA[The name of the primary key field.]]></description>
</variable>
</item>
</category>
</snippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment