Source for file toolbar.php
Documentation is available at toolbar.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Utility class for the button bar.
* @package Joomla.Administrator
* For the title and toolbar to be rendered correctly,
* this title fucntion must be called before the starttable function and the toolbars icons
* this is due to the nature of how the css has been used to postion the title in respect to the toolbar.
* @param string $title The title.
* @param string $icon The space-separated names of the image.
public static function title($title, $icon =
'generic.png')
$html =
$layout->render(array('title' =>
$title, 'icon' =>
$icon));
$app->JComponentTitle =
$html;
* @param string $width The width for the cell
public static function spacer($width =
'')
$bar->appendButton('Separator', 'spacer', $width);
* Writes a divider between menu buttons
$bar->appendButton('Separator', 'divider');
* Writes a custom option and task button for the button bar.
* @param string $task The task to perform (picked up by the switch($task) blocks.
* @param string $icon The image to display.
* @param string $iconOver The image to display when moused over.
* @param string $alt The alt text for the icon image.
* @param bool $listSelect True if required to check that a standard list item is checked.
public static function custom($task =
'', $icon =
'', $iconOver =
'', $alt =
'', $listSelect =
true)
// Add a standard button.
$bar->appendButton('Standard', $icon, $alt, $task, $listSelect);
* Writes a preview button for a given option (opens a popup window).
* @param string $url The name of the popup file (excluding the file extension)
* @param bool $updateEditors Unused
public static function preview($url =
'', $updateEditors =
false)
$bar->appendButton('Popup', 'preview', 'Preview', $url .
'&task=preview');
* Writes a preview button for a given option (opens a popup window).
* @param string $ref The name of the popup file (excluding the file extension for an xml file).
* @param bool $com Use the help file in the component directory.
* @param string $override Use this URL instead of any other
* @param string $component Name of component to get Help (null for current component)
public static function help($ref, $com =
false, $override =
null, $component =
null)
$bar->appendButton('Help', $ref, $com, $override, $component);
* Writes a cancel button that will go back to the previous page without doing
* @param string $alt Alternative text.
* @param string $href URL of the href attribute.
public static function back($alt =
'JTOOLBAR_BACK', $href =
'javascript:history.back();')
$bar->appendButton('Link', 'back', $alt, $href);
* Writes a media_manager button.
* @param string $directory The sub-directory to upload the media to.
* @param string $alt An override for the alt text.
public static function media_manager($directory =
'', $alt =
'JTOOLBAR_UPLOAD')
$bar->appendButton('Popup', 'upload', $alt, 'index.php?option=com_media&tmpl=component&task=popupUpload&folder=' .
$directory, 800, 520);
* Writes a common 'default' button for a record.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function makeDefault($task =
'default', $alt =
'JTOOLBAR_DEFAULT')
$bar->appendButton('Standard', 'default', $alt, $task, true);
* Writes a common 'assign' button for a record.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function assign($task =
'assign', $alt =
'JTOOLBAR_ASSIGN')
$bar->appendButton('Standard', 'assign', $alt, $task, true);
* Writes the common 'new' icon for the button bar.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
* @param boolean $check True if required to check that a standard list item is checked.
public static function addNew($task =
'add', $alt =
'JTOOLBAR_NEW', $check =
false)
$bar->appendButton('Standard', 'new', $alt, $task, $check);
* Writes a common 'publish' button.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
* @param boolean $check True if required to check that a standard list item is checked.
public static function publish($task =
'publish', $alt =
'JTOOLBAR_PUBLISH', $check =
false)
$bar->appendButton('Standard', 'publish', $alt, $task, $check);
* Writes a common 'publish' button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function publishList($task =
'publish', $alt =
'JTOOLBAR_PUBLISH')
// Add a publish button (list).
$bar->appendButton('Standard', 'publish', $alt, $task, true);
* Writes a common 'unpublish' button.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
* @param boolean $check True if required to check that a standard list item is checked.
public static function unpublish($task =
'unpublish', $alt =
'JTOOLBAR_UNPUBLISH', $check =
false)
// Add an unpublish button
$bar->appendButton('Standard', 'unpublish', $alt, $task, $check);
* Writes a common 'unpublish' button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function unpublishList($task =
'unpublish', $alt =
'JTOOLBAR_UNPUBLISH')
// Add an unpublish button (list).
$bar->appendButton('Standard', 'unpublish', $alt, $task, true);
* Writes a common 'archive' button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function archiveList($task =
'archive', $alt =
'JTOOLBAR_ARCHIVE')
// Add an archive button.
$bar->appendButton('Standard', 'archive', $alt, $task, true);
* Writes an unarchive button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function unarchiveList($task =
'unarchive', $alt =
'JTOOLBAR_UNARCHIVE')
// Add an unarchive button (list).
$bar->appendButton('Standard', 'unarchive', $alt, $task, true);
* Writes a common 'edit' button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function editList($task =
'edit', $alt =
'JTOOLBAR_EDIT')
$bar->appendButton('Standard', 'edit', $alt, $task, true);
* Writes a common 'edit' button for a template html.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function editHtml($task =
'edit_source', $alt =
'JTOOLBAR_EDIT_HTML')
// Add an edit html button.
$bar->appendButton('Standard', 'edithtml', $alt, $task, true);
* Writes a common 'edit' button for a template css.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function editCss($task =
'edit_css', $alt =
'JTOOLBAR_EDIT_CSS')
// Add an edit css button (hide).
$bar->appendButton('Standard', 'editcss', $alt, $task, true);
* Writes a common 'delete' button for a list of records.
* @param string $msg Postscript for the 'are you sure' message.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function deleteList($msg =
'', $task =
'remove', $alt =
'JTOOLBAR_DELETE')
$bar->appendButton('Confirm', $msg, 'delete', $alt, $task, true);
$bar->appendButton('Standard', 'delete', $alt, $task, true);
* Writes a common 'trash' button for a list of records.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
* @param bool $check True to allow lists.
public static function trash($task =
'remove', $alt =
'JTOOLBAR_TRASH', $check =
true)
$bar->appendButton('Standard', 'trash', $alt, $task, $check, false);
* Writes a save button for a given option.
* Apply operation leads to a save action only (does not leave edit mode).
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function apply($task =
'apply', $alt =
'JTOOLBAR_APPLY')
$bar->appendButton('Standard', 'apply', $alt, $task, false);
* Writes a save button for a given option.
* Save operation leads to a save and then close action.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function save($task =
'save', $alt =
'JTOOLBAR_SAVE')
$bar->appendButton('Standard', 'save', $alt, $task, false);
* Writes a save and create new button for a given option.
* Save and create operation leads to a save and then add action.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function save2new($task =
'save2new', $alt =
'JTOOLBAR_SAVE_AND_NEW')
// Add a save and create new button.
$bar->appendButton('Standard', 'save-new', $alt, $task, false);
* Writes a save as copy button for a given option.
* Save as copy operation leads to a save after clearing the key,
* then returns user to edit mode with new key.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function save2copy($task =
'save2copy', $alt =
'JTOOLBAR_SAVE_AS_COPY')
// Add a save and create new button.
$bar->appendButton('Standard', 'save-copy', $alt, $task, false);
* Writes a checkin button for a given option.
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
* @param boolean $check True if required to check that a standard list item is checked.
public static function checkin($task =
'checkin', $alt =
'JTOOLBAR_CHECKIN', $check =
true)
// Add a save and create new button.
$bar->appendButton('Standard', 'checkin', $alt, $task, $check);
* Writes a cancel button and invokes a cancel operation (eg a checkin).
* @param string $task An override for the task.
* @param string $alt An override for the alt text.
public static function cancel($task =
'cancel', $alt =
'JTOOLBAR_CANCEL')
$bar->appendButton('Standard', 'cancel', $alt, $task, false);
* Writes a configuration button and invokes a cancel operation (eg a checkin).
* @param string $component The name of the component, eg, com_content.
* @param integer $height The height of the popup. [UNUSED]
* @param integer $width The width of the popup. [UNUSED]
* @param string $alt The name of the button.
* @param string $path An alternative path for the configuation xml relative to JPATH_SITE.
public static function preferences($component, $height =
'550', $width =
'875', $alt =
'JToolbar_Options', $path =
'')
$bar =
JToolBar::getInstance('toolbar');
// Add a button linking to config for component.
'index.php?option=com_config&view=component&component=' .
$component .
'&path=' .
$path .
'&return=' .
$return
* Writes a version history
* @param string $typeAlias The component and type, for example 'com_content.article'
* @param integer $itemId The id of the item, for example the article id.
* @param integer $height The height of the popup.
* @param integer $width The width of the popup.
* @param string $alt The name of the button.
public static function versions($typeAlias, $itemId, $height =
800, $width =
500, $alt =
'JTOOLBAR_VERSIONS')
JHtml::_('behavior.modal', 'a.modal_jform_contenthistory');
$typeId =
$contentTypeTable->getTypeId($typeAlias);
// Options array for JLayout
$options['title'] =
JText::_($alt);
$options['height'] =
$height;
$options['width'] =
$width;
$options['itemId'] =
$itemId;
$options['typeId'] =
$typeId;
$options['typeAlias'] =
$typeAlias;
$bar->appendButton('Custom', $layout->render($options), 'versions');
* Displays a modal button
* @param string $targetModalId ID of the target modal box
* @param string $icon Icon class to show on modal button
* @param string $alt Title for the modal button
public static function modal($targetModalId, $icon, $alt)
$dhtml =
"<button data-toggle='modal' data-target='#" .
$targetModalId .
"' class='btn btn-small'>
<i class='" .
$icon .
"' title='" .
$title .
"'></i>" .
$title .
"</button>";
$bar->appendButton('Custom', $dhtml, $alt);
* Utility class for the submenu.
* @package Joomla.Administrator
* @deprecated 4.0 Use JHtmlSidebar instead.
protected static $entries =
array();
protected static $filters =
array();
* Value for the action attribute of the form.
protected static $action =
'';
* Method to add a menu item to submenu.
* @param string $name Name of the menu item.
* @param string $link URL of the menu item.
* @param boolean $active True if the item is active, false otherwise.
* @deprecated 4.0 Use JHtmlSidebar::addEntry() instead.
public static function addEntry($name, $link =
'', $active =
false)
JLog::add('JSubMenuHelper::addEntry() is deprecated. Use JHtmlSidebar::addEntry() instead.', JLog::WARNING, 'deprecated');
array_push(self::$entries, array($name, $link, $active));
* Returns an array of all submenu entries
* @deprecated 4.0 Use JHtmlSidebar::getEntries() instead.
JLog::add('JSubMenuHelper::getEntries() is deprecated. Use JHtmlSidebar::getEntries() instead.', JLog::WARNING, 'deprecated');
* Method to add a filter to the submenu
* @param string $label Label for the menu item.
* @param string $name name for the filter. Also used as id.
* @param string $options options for the select field.
* @param boolean $noDefault Don't the label as the empty option
* @deprecated 4.0 Use JHtmlSidebar::addFilter() instead.
public static function addFilter($label, $name, $options, $noDefault =
false)
JLog::add('JSubMenuHelper::addFilter() is deprecated. Use JHtmlSidebar::addFilter() instead.', JLog::WARNING, 'deprecated');
array_push(self::$filters, array('label' =>
$label, 'name' =>
$name, 'options' =>
$options, 'noDefault' =>
$noDefault));
* Returns an array of all filters
* @deprecated 4.0 Use JHtmlSidebar::getFilters() instead.
JLog::add('JSubMenuHelper::getFilters() is deprecated. Use JHtmlSidebar::getFilters() instead.', JLog::WARNING, 'deprecated');
* Set value for the action attribute of the filter form
* @param string $action Value for the action attribute of the form
* @deprecated 4.0 Use JHtmlSidebar::setAction() instead.
JLog::add('JSubMenuHelper::setAction() is deprecated. Use JHtmlSidebar::setAction() instead.', JLog::WARNING, 'deprecated');
* Get value for the action attribute of the filter form
* @return string Value for the action attribute of the form
* @deprecated 4.0 Use JHtmlSidebar::getAction() instead.
JLog::add('JSubMenuHelper::getAction() is deprecated. Use JHtmlSidebar::getAction() instead.', JLog::WARNING, 'deprecated');
Documentation generated on Tue, 19 Nov 2013 15:15:54 +0100 by phpDocumentor 1.4.3