[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/html/toolbar/button/ -> confirm.php (source)

   1  <?php
   2  /**
   3  * @version        $Id:confirm.php 6961 2007-03-15 16:06:53Z tcp $
   4  * @package        Joomla.Framework
   5  * @subpackage    HTML
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * Renders a standard button with a confirm dialog
  20   *
  21   * @package     Joomla.Framework
  22   * @subpackage    HTML
  23   * @since        1.5
  24   */
  25  class JButtonConfirm extends JButton
  26  {
  27      /**
  28       * Button type
  29       *
  30       * @access    protected
  31       * @var        string
  32       */
  33      var $_name = 'Confirm';
  34  
  35  	function fetchButton( $type='Confirm', $msg='', $name = '', $text = '', $task = '', $list = true, $hideMenu = false )
  36      {
  37          $text    = JText::_($text);
  38          $msg    = JText::_($msg, true);
  39          $class    = $this->fetchIconClass($name);
  40          $doTask    = $this->_getCommand($msg, $name, $task, $list, $hideMenu);
  41  
  42          $html    = "<a href=\"#\" onclick=\"$doTask\" class=\"toolbar\">\n";
  43          $html .= "<span class=\"$class\" title=\"$text\">\n";
  44          $html .= "</span>\n";
  45          $html    .= "$text\n";
  46          $html    .= "</a>\n";
  47  
  48          return $html;
  49      }
  50  
  51      /**
  52       * Get the button CSS Id
  53       *
  54       * @access    public
  55       * @return    string    Button CSS Id
  56       * @since    1.5
  57       */
  58  	function fetchId( $type='Confirm', $name = '', $text = '', $task = '', $list = true, $hideMenu = false )
  59      {
  60          return $this->_parent->_name.'-'.$name;
  61      }
  62  
  63      /**
  64       * Get the JavaScript command for the button
  65       *
  66       * @access    private
  67       * @param    object    $definition    Button definition
  68       * @return    string    JavaScript command string
  69       * @since    1.5
  70       */
  71  	function _getCommand($msg, $name, $task, $list, $hide)
  72      {
  73          $todo     = JString::strtolower(JText::_( $name ));
  74          $message = JText::sprintf( 'Please make a selection from the list to', $todo );
  75          $message = addslashes($message);
  76  
  77          if ($hide) {
  78              if ($list) {
  79                  $cmd = "javascript:if(document.adminForm.boxchecked.value==0){alert('$message');}else{hideMainMenu();if(confirm('$msg')){submitbutton('$task');}}";
  80              } else {
  81                  $cmd = "javascript:hideMainMenu();if(confirm('$msg')){submitbutton('$task');}";
  82              }
  83          } else {
  84              if ($list) {
  85                  $cmd = "javascript:if(document.adminForm.boxchecked.value==0){alert('$message');}else{if(confirm('$msg')){submitbutton('$task');}}";
  86              } else {
  87                  $cmd = "javascript:if(confirm('$msg')){submitbutton('$task');}";
  88              }
  89          }
  90  
  91          return $cmd;
  92      }
  93  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1