Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Source code for file /joomla/html/toolbar/button.php

Documentation is available at button.php

  1. <?php
  2. /**
  3. @version        $Id: button.php 9764 2007-12-30 07:48:11Z ircmaxell $
  4. @package        Joomla.Framework
  5. @subpackage    HTML
  6. @copyright    Copyright (C) 2005 - 2008 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.  * Button base class
  20.  *
  21.  * The JButton is the base class for all JButton types
  22.  *
  23.  * @abstract
  24.  * @author         Louis Landry <louis.landry@joomla.org
  25.  * @package     Joomla.Framework
  26.  * @subpackage        HTML
  27.  * @since        1.5
  28.  */
  29. class JButton extends JObject
  30. {
  31.     /**
  32.      * element name
  33.      *
  34.      * This has to be set in the final renderer classes.
  35.      *
  36.      * @access    protected
  37.      * @var        string 
  38.      */
  39.     var $_name = null;
  40.  
  41.     /**
  42.      * reference to the object that instantiated the element
  43.      *
  44.      * @access    protected
  45.      * @var        object 
  46.      */
  47.     var $_parent = null;
  48.  
  49.     /**
  50.      * Constructor
  51.      *
  52.      * @access protected
  53.      */
  54.     function __construct($parent null)
  55.     {
  56.         $this->_parent = $parent;
  57.     }
  58.  
  59.     /**
  60.      * get the element name
  61.      *
  62.      * @access    public
  63.      * @return    string    type of the parameter
  64.      */
  65.     function getName()
  66.     {
  67.         return $this->_name;
  68.     }
  69.  
  70.     function render&$definition )
  71.     {
  72.         /*
  73.          * Initialize some variables
  74.          */
  75.         $html    null;
  76.         $id        call_user_func_array(array(&$this'fetchId')$definition);
  77.         $action    call_user_func_array(array(&$this'fetchButton')$definition);
  78.  
  79.         // Build id attribute
  80.         if ($id{
  81.             $id "id=\"$id\"";
  82.         }
  83.  
  84.         // Build the HTML Button
  85.         $html    .= "<td class=\"button\" $id>\n";
  86.         $html    .= $action;
  87.         $html    .= "</td>\n";
  88.  
  89.         return $html;
  90.     }
  91.  
  92.     /**
  93.      * Method to get the CSS class name for an icon identifier
  94.      *
  95.      * Can be redefined in the final class
  96.      *
  97.      * @access    public
  98.      * @param    string    $identifier    Icon identification string
  99.      * @return    string    CSS class name
  100.      * @since    1.5
  101.      */
  102.     function fetchIconClass($identifier)
  103.     {
  104.         return "icon-32-$identifier";
  105.     }
  106.  
  107.     /**
  108.      * Get the button id
  109.      *
  110.      * Can be redefined in the final button class
  111.      *
  112.      * @access        public
  113.      * @since        1.5
  114.      */
  115.     function fetchId()
  116.     {
  117.         return;
  118.     }
  119.  
  120.     /**
  121.      * Get the button
  122.      *
  123.      * Defined in the final button class
  124.      *
  125.      * @abstract
  126.      * @access        public
  127.      * @since        1.5
  128.      */
  129.     function fetchButton()
  130.     {
  131.         return;
  132.     }
  133. }

Documentation generated on Tue, 29 Jan 2008 18:44:45 +0000 by phpDocumentor 1.3.1