[ Index ]

PHP Cross Reference of Web Application Component Toolkit

title

Body

[close]

/framework/template/components/html/ -> html_anchor.inc.php (source)

   1  <?php
   2  //--------------------------------------------------------------------------------
   3  // Copyright 2003 Procata, Inc.
   4  // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
   5  //--------------------------------------------------------------------------------
   6  /**
   7  * @package WACT_COMPONENT
   8  * @version $Id: html_anchor.inc.php,v 1.1 2003/11/15 11:44:37 harryf Exp $
   9  */
  10  //--------------------------------------------------------------------------------
  11  /**
  12  * Provides runtime API for HTML Anchor components, with simple event handling
  13  * (EXPERIMENTAL)
  14  * @see http://wact.sourceforge.net/index.php/HtmlAnchorComponent
  15  * @access public
  16  * @package WACT_COMPONENT
  17  */
  18  class HtmlAnchorComponent extends Component {
  19      /**
  20      * Name of call back function to respond to "clicks"
  21      * @var string
  22      * @access private
  23      */
  24      var $clickHandler;
  25      /**
  26      * Name of GET variable to "watch" for "clicks"
  27      * @var string
  28      * @access private
  29      */
  30      var $clickField;
  31  
  32      /**
  33      * Sets the onclick call back function
  34      * @param string function name
  35      * @access protected
  36      * @return void
  37      */
  38  	function setClickHandler($handler) {
  39          $this->clickHandler = $handler;
  40      }
  41      /**
  42      * Sets the GET variable name to watch for clicks
  43      * @param string function name
  44      * @access protected
  45      * @return void
  46      */
  47  	function setClickField($field) {
  48          $this->clickField = $field;
  49      }
  50      /**
  51      * @return void
  52      * @access protected
  53      */
  54  	function prepare() {
  55          if ( isset($this->clickHandler) && isset($this->clickField) ) {
  56              if ( isset ( $_GET[$this->clickField] ) ) {
  57                  $call = $this->clickHandler;
  58                  $args = array(&$this,array('clicked'=>$this->clickField));
  59                  call_user_func_array($call,$args);
  60              }
  61          }
  62      }
  63  }
  64  ?>


Generated: Sun Nov 28 19:36:09 2004 Cross-referenced by PHPXref 0.5