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

Source for file tangra_module.class.php

Documentation is available at tangra_module.class.php

  1. <?php
  2.  
  3. // $Id$
  4.  
  5. /**
  6.  * Contains class Tangra_Module
  7.  *
  8.  * @package  tangra_lib
  9.  * @subpackage  modules_manager
  10.  */
  11.  
  12.  
  13. /**
  14.  * Tangra Module Class
  15.  *
  16.  * @package  tangra_lib
  17.  * @subpackage  modules_manager
  18.  */
  19. class Tangra_Module extends Tangra_Class {
  20.     /**
  21.      * ID of the module
  22.      *
  23.      * @var integer 
  24.      * @internal
  25.      */
  26.     private $id;
  27.     /**
  28.      * HID (human id) of the module. e.g. admin_panel
  29.      *
  30.      * @var string 
  31.       * @internal
  32.      */
  33.     private $hid;
  34.     /**
  35.      * Short description about module
  36.      *
  37.      * @var string 
  38.      * @internal
  39.      */
  40.     private $description;
  41.     /**
  42.      * Email address of maintainer of the module
  43.      *
  44.      * @var string 
  45.      * @internal
  46.      */
  47.     private $maintainer;
  48.     /**
  49.      * URL address of web page that contain more information about module
  50.      *
  51.      * @var string 
  52.      * @internal
  53.      */
  54.     private $url;
  55.     /**
  56.      * ID of the license under which module is released
  57.      *
  58.      * @var integer 
  59.      * @internal
  60.      */
  61.     private $license;
  62.  
  63.  
  64.     /**
  65.      * Sets module ID
  66.      *
  67.      * @param integer $id 
  68.      */
  69.     public function set_id($id{
  70.         tangra_if_not_int_throw_e($id);
  71.  
  72.         $this->id = $id;
  73.     }
  74.  
  75.  
  76.     /**
  77.      * Gets module id
  78.      *
  79.      * @return integer 
  80.      */
  81.     public function get_id({
  82.         return $this->id;
  83.     }
  84.  
  85.  
  86.     /**
  87.      * Sets module HID
  88.      *
  89.      * @param string $hid Must be alphanumeric, starting with letter, underscore allowed, 100 characters max
  90.      */
  91.     public function set_hid($hid{
  92.         if (ereg("[a-z0-9_]{1,100}"$hid)) {
  93.             $this->hid = $hid;
  94.         else {
  95.             throw TE_TCMS_Exception('Invalid hid: '.$hid.'. Must conform ereg("[a-z0-9_]{1,100}").');
  96.         }
  97.     }
  98.  
  99.  
  100.     /**
  101.      * Gets module HID
  102.      *
  103.      * @return unknown 
  104.      */
  105.     public function get_hid({
  106.         return $this->hid;
  107.     }
  108.  
  109.  
  110.     /**
  111.      * Sets module description
  112.      *
  113.      * @param string $description 
  114.      */
  115.     public function set_description($description{
  116.         $this->description = $description;
  117.     }
  118.  
  119.  
  120.     /**
  121.      * Gets module description
  122.      *
  123.      * @return unknown 
  124.      */
  125.     public function get_description({
  126.         return $this->description;
  127.     }
  128.  
  129.  
  130.     /**
  131.      * Sets module maintainer email
  132.      *
  133.      * @param string $maintainer Valid email address
  134.      */
  135.     public function set_maintainer($maintainer{
  136.         //TODO check if maintainer field comforms RFC822, i.e. name <email address>
  137.         $this->maintainer = $maintainer;
  138.     }
  139.  
  140.  
  141.     /**
  142.      * Gets maintainer
  143.      *
  144.      * @return string 
  145.      */
  146.     public function get_maintainer({
  147.         return $this->maintainer;
  148.     }
  149.  
  150.  
  151.     /**
  152.      * Sets URL address of web page that contain more information about module
  153.      *
  154.      * @param string $url 
  155.      */
  156.     public function set_url($url{
  157.         $this->url = $url;
  158.     }
  159.  
  160.  
  161.     /**
  162.      * Gets URL address of web page that contain more information about module
  163.      *
  164.      * @return string 
  165.      */
  166.     public function get_url({
  167.         return $this->url;
  168.     }
  169.  
  170.  
  171.     /**
  172.      * Sets ID of the license under which module is released
  173.      *
  174.      * @param integer $license 
  175.      */
  176.     public function set_license($license{
  177.         tangra_if_not_int_throw_e($license);
  178.  
  179.         $this->license = $license;
  180.     }
  181.  
  182.  
  183.     /**
  184.      * Gets ID of the license under which module is released
  185.      *
  186.      * @return integer 
  187.      */
  188.     public function get_license({
  189.         return $this->license;
  190.     }
  191. }