You've already forked joomla_test
first commit
This commit is contained in:
106
libraries/cms/toolbar/button/confirm.php
Normal file
106
libraries/cms/toolbar/button/confirm.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a standard button with a confirm dialog
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonConfirm extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Confirm';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string.
|
||||
* @param string $msg Message to render
|
||||
* @param string $name Name to be used as apart of the id
|
||||
* @param string $text Button text
|
||||
* @param string $task The task associated with the button
|
||||
* @param boolean $list True to allow use of lists
|
||||
* @param boolean $hideMenu True to hide the menu on click
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Confirm', $msg = '', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
|
||||
{
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['text'] = JText::_($text);
|
||||
$options['msg'] = JText::_($msg, true);
|
||||
$options['class'] = $this->fetchIconClass($name);
|
||||
$options['doTask'] = $this->_getCommand($options['msg'], $name, $task, $list);
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.confirm');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button CSS Id
|
||||
*
|
||||
* @param string $type Button type
|
||||
* @param string $name Name to be used as apart of the id
|
||||
* @param string $text Button text
|
||||
* @param string $task The task associated with the button
|
||||
* @param boolean $list True to allow use of lists
|
||||
* @param boolean $hideMenu True to hide the menu on click
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type = 'Confirm', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
|
||||
{
|
||||
return $this->_parent->getName() . '-' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param object $msg The message to display.
|
||||
* @param string $name Not used.
|
||||
* @param string $task The task used by the application
|
||||
* @param boolean $list True is requires a list confirmation.
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function _getCommand($msg, $name, $task, $list)
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
|
||||
$message = addslashes($message);
|
||||
|
||||
if ($list)
|
||||
{
|
||||
$cmd = "if (document.adminForm.boxchecked.value==0){alert('$message');}else{if (confirm('$msg')){Joomla.submitbutton('$task');}}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "if (confirm('$msg')){Joomla.submitbutton('$task');}";
|
||||
}
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
}
|
59
libraries/cms/toolbar/button/custom.php
Normal file
59
libraries/cms/toolbar/button/custom.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a custom button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonCustom extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Custom';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Button type, unused string.
|
||||
* @param string $html HTML strng for the button
|
||||
* @param string $id CSS id for the button
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Custom', $html = '', $id = 'custom')
|
||||
{
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button CSS Id
|
||||
*
|
||||
* @param string $type Not used.
|
||||
* @param string $html Not used.
|
||||
* @param string $id The id prefix for the button.
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type = 'Custom', $html = '', $id = 'custom')
|
||||
{
|
||||
return $this->_parent->getName() . '-' . $id;
|
||||
}
|
||||
}
|
89
libraries/cms/toolbar/button/help.php
Normal file
89
libraries/cms/toolbar/button/help.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a help popup window button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonHelp extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* @var string Button type
|
||||
*/
|
||||
protected $_name = 'Help';
|
||||
|
||||
/**
|
||||
* Fetches the button HTML code.
|
||||
*
|
||||
* @param string $type Unused string.
|
||||
* @param string $ref The name of the help screen (its key reference).
|
||||
* @param boolean $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)
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Help', $ref = '', $com = false, $override = null, $component = null)
|
||||
{
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['text'] = JText::_('JTOOLBAR_HELP');
|
||||
$options['doTask'] = $this->_getCommand($ref, $com, $override, $component);
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.help');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button id
|
||||
*
|
||||
* Redefined from JButton class
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId()
|
||||
{
|
||||
return $this->_parent->getName() . '-help';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param string $ref The name of the help screen (its key reference).
|
||||
* @param boolean $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)
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function _getCommand($ref, $com, $override, $component)
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
|
||||
// Get Help URL
|
||||
$url = JHelp::createURL($ref, $com, $override, $component);
|
||||
$url = htmlspecialchars($url, ENT_QUOTES);
|
||||
$cmd = "Joomla.popupWindow('$url', '" . JText::_('JHELP', true) . "', 700, 500, 1)";
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
}
|
1
libraries/cms/toolbar/button/index.html
Normal file
1
libraries/cms/toolbar/button/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
81
libraries/cms/toolbar/button/link.php
Normal file
81
libraries/cms/toolbar/button/link.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a link button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonLink extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Link';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string.
|
||||
* @param string $name Name to be used as apart of the id
|
||||
* @param string $text Button text
|
||||
* @param string $url The link url
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Link', $name = 'back', $text = '', $url = null)
|
||||
{
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['text'] = JText::_($text);
|
||||
$options['class'] = $this->fetchIconClass($name);
|
||||
$options['doTask'] = $this->_getCommand($url);
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.link');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button CSS Id
|
||||
*
|
||||
* @param string $type The button type.
|
||||
* @param string $name The name of the button.
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type = 'Link', $name = '')
|
||||
{
|
||||
return $this->_parent->getName() . '-' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param object $url Button definition
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function _getCommand($url)
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
}
|
124
libraries/cms/toolbar/button/popup.php
Normal file
124
libraries/cms/toolbar/button/popup.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a modal window button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonPopup extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Popup';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string, formerly button type.
|
||||
* @param string $name Modal name, used to generate element ID
|
||||
* @param string $text The link text
|
||||
* @param string $url URL for popup
|
||||
* @param integer $width Width of popup
|
||||
* @param integer $height Height of popup
|
||||
* @param integer $top Top attribute. [@deprecated Unused, will be removed in 4.0]
|
||||
* @param integer $left Left attribute. [@deprecated Unused, will be removed in 4.0]
|
||||
* @param string $onClose JavaScript for the onClose event.
|
||||
* @param string $title The title text
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Modal', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0,
|
||||
$onClose = '', $title = '')
|
||||
{
|
||||
// If no $title is set, use the $text element
|
||||
if (strlen($title) == 0)
|
||||
{
|
||||
$title = $text;
|
||||
}
|
||||
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['name'] = JText::_($name);
|
||||
$options['text'] = JText::_($text);
|
||||
$options['title'] = JText::_($title);
|
||||
$options['class'] = $this->fetchIconClass($name);
|
||||
$options['doTask'] = $this->_getCommand($url);
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.popup');
|
||||
|
||||
$html = array();
|
||||
$html[] = $layout->render($options);
|
||||
|
||||
// Place modal div and scripts in a new div
|
||||
$html[] = '</div><div class="btn-group" style="width: 0; margin: 0">';
|
||||
|
||||
// Build the options array for the modal
|
||||
$params = array();
|
||||
$params['title'] = $options['title'];
|
||||
$params['url'] = $options['doTask'];
|
||||
$params['height'] = $height;
|
||||
$params['width'] = $width;
|
||||
$html[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params);
|
||||
|
||||
// If an $onClose event is passed, add it to the modal JS object
|
||||
if (strlen($onClose) >= 1)
|
||||
{
|
||||
$html[] = '<script>'
|
||||
. 'jQuery(\'#modal-' . $name . '\').on(\'hide\', function () {' . $onClose . ';});'
|
||||
. '</script>';
|
||||
}
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button id
|
||||
*
|
||||
* @param string $type Button type
|
||||
* @param string $name Button name
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type, $name)
|
||||
{
|
||||
return $this->_parent->getName() . '-popup-' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param string $url URL for popup
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private function _getCommand($url)
|
||||
{
|
||||
if (substr($url, 0, 4) !== 'http')
|
||||
{
|
||||
$url = JUri::base() . $url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
65
libraries/cms/toolbar/button/separator.php
Normal file
65
libraries/cms/toolbar/button/separator.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a button separator
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonSeparator extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Separator';
|
||||
|
||||
/**
|
||||
* Get the HTML for a separator in the toolbar
|
||||
*
|
||||
* @param array &$definition Class name and custom width
|
||||
*
|
||||
* @return string The HTML for the separator
|
||||
*
|
||||
* @see JButton::render()
|
||||
* @since 3.0
|
||||
*/
|
||||
public function render(&$definition)
|
||||
{
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
|
||||
// Separator class name
|
||||
$options['class'] = (empty($definition[1])) ? '' : $definition[1];
|
||||
|
||||
// Custom width
|
||||
$options['style'] = (empty($definition[2])) ? '' : ' style="width:' . (int) $definition[2] . 'px;"';
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.separator');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty implementation (not required for separator)
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton()
|
||||
{
|
||||
}
|
||||
}
|
101
libraries/cms/toolbar/button/slider.php
Normal file
101
libraries/cms/toolbar/button/slider.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a button to render an HTML element in a slider container
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonSlider extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Slider';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string, formerly button type.
|
||||
* @param string $name Button name
|
||||
* @param string $text The link text
|
||||
* @param string $url URL for popup
|
||||
* @param integer $width Width of popup
|
||||
* @param integer $height Height of popup
|
||||
* @param string $onClose JavaScript for the onClose event.
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Slider', $name = '', $text = '', $url = '', $width = 640, $height = 480, $onClose = '')
|
||||
{
|
||||
JHtml::_('script', 'jui/cms.js', false, true);
|
||||
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['text'] = JText::_($text);
|
||||
$options['name'] = $name;
|
||||
$options['class'] = $this->fetchIconClass($name);
|
||||
$options['onClose'] = '';
|
||||
|
||||
$doTask = $this->_getCommand($url);
|
||||
$options['doTask'] = 'Joomla.setcollapse(\'' . $doTask . '\', \'' . $name . '\', \'' . $height . '\');';
|
||||
|
||||
if ($onClose)
|
||||
{
|
||||
$options['onClose'] = ' rel="{onClose: function() {' . $onClose . '}}"';
|
||||
}
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.slider');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button id
|
||||
*
|
||||
* @param string $type Button type
|
||||
* @param string $name Button name
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type, $name)
|
||||
{
|
||||
return $this->_parent->getName() . '-slider-' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param string $url URL for popup
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private function _getCommand($url)
|
||||
{
|
||||
if (substr($url, 0, 4) !== 'http')
|
||||
{
|
||||
$url = JUri::base() . $url;
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
112
libraries/cms/toolbar/button/standard.php
Normal file
112
libraries/cms/toolbar/button/standard.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Renders a standard button
|
||||
*
|
||||
* @package Joomla.Libraries
|
||||
* @subpackage Toolbar
|
||||
* @since 3.0
|
||||
*/
|
||||
class JToolbarButtonStandard extends JToolbarButton
|
||||
{
|
||||
/**
|
||||
* Button type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_name = 'Standard';
|
||||
|
||||
/**
|
||||
* Fetch the HTML for the button
|
||||
*
|
||||
* @param string $type Unused string.
|
||||
* @param string $name The name of the button icon class.
|
||||
* @param string $text Button text.
|
||||
* @param string $task Task associated with the button.
|
||||
* @param boolean $list True to allow lists
|
||||
*
|
||||
* @return string HTML string for the button
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchButton($type = 'Standard', $name = '', $text = '', $task = '', $list = true)
|
||||
{
|
||||
// Store all data to the options array for use with JLayout
|
||||
$options = array();
|
||||
$options['text'] = JText::_($text);
|
||||
$options['class'] = $this->fetchIconClass($name);
|
||||
$options['doTask'] = $this->_getCommand($options['text'], $task, $list);
|
||||
|
||||
if ($name == 'apply' || $name == 'new')
|
||||
{
|
||||
$options['btnClass'] = 'btn btn-small btn-success';
|
||||
$options['class'] .= ' icon-white';
|
||||
}
|
||||
else
|
||||
{
|
||||
$options['btnClass'] = 'btn btn-small';
|
||||
}
|
||||
|
||||
// Instantiate a new JLayoutFile instance and render the layout
|
||||
$layout = new JLayoutFile('joomla.toolbar.standard');
|
||||
|
||||
return $layout->render($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the button CSS Id
|
||||
*
|
||||
* @param string $type Unused string.
|
||||
* @param string $name Name to be used as apart of the id
|
||||
* @param string $text Button text
|
||||
* @param string $task The task associated with the button
|
||||
* @param boolean $list True to allow use of lists
|
||||
* @param boolean $hideMenu True to hide the menu on click
|
||||
*
|
||||
* @return string Button CSS Id
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public function fetchId($type = 'Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false)
|
||||
{
|
||||
return $this->_parent->getName() . '-' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaScript command for the button
|
||||
*
|
||||
* @param string $name The task name as seen by the user
|
||||
* @param string $task The task used by the application
|
||||
* @param boolean $list True is requires a list confirmation.
|
||||
*
|
||||
* @return string JavaScript command string
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
protected function _getCommand($name, $task, $list)
|
||||
{
|
||||
JHtml::_('behavior.framework');
|
||||
$message = JText::_('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
|
||||
$message = addslashes($message);
|
||||
|
||||
if ($list)
|
||||
{
|
||||
$cmd = "if (document.adminForm.boxchecked.value==0){alert('$message');}else{ Joomla.submitbutton('$task')}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "Joomla.submitbutton('$task')";
|
||||
}
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user