tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Source for file event.class.php

Documentation is available at event.class.php

  1. <?php
  2. // *** Tangra (Application Framework and Tools for PHP)
  3. //  $Id$
  4. //
  5.  
  6. /**
  7.  * Contains class Event
  8.  * @package  tangra_lib
  9.  * @subpackage  core
  10.  */
  11.  
  12.  
  13. /**
  14.  * Base class for Event classes family.
  15.  * @package  tangra_lib
  16.  * @subpackage  core
  17.  * @see Web_Event, Web_Event_Simple
  18.  */
  19. abstract class Event extends Tangra_Class {
  20.     /**
  21.      * Name of the event
  22.      *
  23.      * @var string 
  24.      * @access  private
  25.      */
  26.     private $name;
  27.  
  28.     /**
  29.      *
  30.      * @param string $name - name of the event
  31.      */
  32.     function __construct($name{
  33.         $this->set_name($name);
  34.     }
  35.  
  36.  
  37.     /**
  38.      * Sets the event name
  39.      *
  40.      * @param string $name 
  41.      */
  42.     public function set_name($name{
  43.         if (ereg("^[a-z]{1}[a-z0-9_]{0,40}$"$name)) {
  44.             $this->name = $name;
  45.         else {
  46.             throw new Tangra_Exception('Invalid event name: '.$name.'. Must be alphanumeric, starting with letter, underscore allowed.');
  47.         }
  48.     }
  49.  
  50.  
  51.     /**
  52.      * Gets the event name
  53.      *
  54.      * @return string 
  55.      */
  56.     public function get_name({
  57.         return $this->name;
  58.     }
  59. }