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

Source for file tangra_module_release.class.php

Documentation is available at tangra_module_release.class.php

  1. <?php
  2.  
  3. // $Id$
  4.  
  5.  
  6. /**
  7.  * Contains class Tangra_Module_Release
  8.  *
  9.  * @package  tangra_lib
  10.  * @subpackage  modules_manager
  11.  */
  12.  
  13. /**
  14.  *
  15.  */
  16. require_once(TANGRA_MAIN_DIR.'nls/date.inc.php');
  17.  
  18.  
  19. /**
  20.  * Tangra module release
  21.  *
  22.  * @package  tangra_lib
  23.  * @subpackage  modules_manager
  24.  */
  25.     /**
  26.      * ID
  27.      *
  28.      * @var integer 
  29.      * @internal
  30.      */
  31.     private $id;
  32.     /**
  33.      * Module ID
  34.      *
  35.      * @var integer 
  36.      * @internal
  37.      */
  38.     private $module;
  39.     /**
  40.      * Release version
  41.      *
  42.      * @var string 
  43.      * @internal
  44.      */
  45.     private $version;
  46.     /**
  47.      * Description
  48.      *
  49.      * @var string 
  50.      * @internal
  51.      */
  52.     private $description;
  53.     /**
  54.      * Maintainer's email
  55.      *
  56.      * @var string 
  57.      * @internal
  58.      */
  59.     private $maintainer;
  60.     /**
  61.      * URL of module info page
  62.      *
  63.      * @var string 
  64.      * @internal
  65.      */
  66.     private $url;
  67.     /**
  68.      * Minimal requirement for tangra_lib version
  69.      *
  70.      * @var string 
  71.      * @internal
  72.      */
  73.     private $requires_tangra_lib_version = '2.0.0alpha1';
  74.     /**
  75.      * Minimal requirement for PHP version
  76.      *
  77.      * @var string 
  78.      * @internal
  79.      */
  80.     private $requires_php_version = '5.1.0';
  81.     /**
  82.      * Is release online?
  83.      *
  84.      * @var booelan 
  85.      * @internal
  86.      */
  87.     private $online = false;
  88.     /**
  89.      * Datetime of release
  90.      *
  91.      * @var string 
  92.      * @internal
  93.      */
  94.     private $release_date = '0000-00-00';
  95.     /**
  96.      * Change notes
  97.      *
  98.      * @var string 
  99.      * @internal
  100.      */
  101.     private $changes;
  102.  
  103.  
  104.     /**
  105.      * Sets ID
  106.      *
  107.      * @param integer $id 
  108.      */
  109.     public function set_id($id{
  110.         tangra_if_not_int_throw_e($id);
  111.  
  112.         $this->id = $id;
  113.     }
  114.  
  115.  
  116.     /**
  117.      * Gets ID
  118.      *
  119.      * @return integer 
  120.      */
  121.     public function get_id({
  122.         return $this->id;
  123.     }
  124.  
  125.  
  126.     /**
  127.      * Sets module ID
  128.      *
  129.      * @param integer $module 
  130.      */
  131.     public function set_module($module{
  132.         tangra_if_not_int_throw_e($module);
  133.  
  134.         $this->module = $module;
  135.     }
  136.  
  137.  
  138.     /**
  139.      * Gets module ID
  140.      *
  141.      * @return integer 
  142.      */
  143.     public function get_module({
  144.         return $this->module;
  145.     }
  146.  
  147.  
  148.     /**
  149.      * Sets release version
  150.      *
  151.      * @param string $version 
  152.      */
  153.     public function set_version($version{
  154.         if (ereg("^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$"trim($version))) {
  155.             $this->version = $version;
  156.         else {
  157.             throw new Tangra_Exception("Invalid version literal: $version. Must conform: ^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$");
  158.         }
  159.     }
  160.  
  161.  
  162.     /**
  163.      * Gets version
  164.      *
  165.      * @return string 
  166.      */
  167.     public function get_version({
  168.         return $this->version;
  169.     }
  170.  
  171.  
  172.     /**
  173.      * Sets description
  174.      *
  175.      * @param string $description 
  176.      */
  177.     public function set_description($description{
  178.         $this->description = $description;
  179.     }
  180.  
  181.  
  182.     /**
  183.      * Gets description
  184.      *
  185.      * @return string 
  186.      */
  187.     public function get_description({
  188.         return $this->description;
  189.     }
  190.  
  191.  
  192.     /**
  193.      * Sets maintainer's email
  194.      *
  195.      * @param string $maintainer 
  196.      */
  197.     public function set_maintainer($maintainer{
  198.         //TODO check if maintainer field comforms RFC822, i.e. name <email address>
  199.         $this->maintainer = $maintainer;
  200.     }
  201.  
  202.  
  203.     /**
  204.      * Gets maintainer's email
  205.      *
  206.      * @return string 
  207.      */
  208.     public function get_maintainer({
  209.         return $this->maintainer;
  210.     }
  211.  
  212.  
  213.     /**
  214.      * Sets URL for info page
  215.      *
  216.      * @param string $url 
  217.      */
  218.     public function set_url($url{
  219.         $this->url = $url;
  220.     }
  221.  
  222.  
  223.     /**
  224.      * Gets URL for info page
  225.      *
  226.      * @return unknown 
  227.      */
  228.     public function get_url({
  229.         return $this->url;
  230.     }
  231.  
  232.  
  233.     /**
  234.      * Sets required minimal version of tangra_lib
  235.      *
  236.      * @param string $requires_tangra_lib_version 
  237.      */
  238.     public function set_requires_tangra_lib_version($requires_tangra_lib_version{
  239.         if (ereg("^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$"trim($requires_tangra_lib_version))) {
  240.             $this->requires_tangra_lib_version = $requires_tangra_lib_version;
  241.         else {
  242.             throw new Tangra_Exception("Invalid requires_tangra_lib_version literal: $requires_tangra_lib_version. Must conform: ^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$");
  243.         }
  244.     }
  245.  
  246.  
  247.     /**
  248.      * Gets required minimal version of tangra_lib
  249.      *
  250.      * @return string 
  251.      */
  252.     public function get_requires_tangra_lib_version({
  253.         return $this->requires_tangra_lib_version;
  254.     }
  255.  
  256.  
  257.     /**
  258.      * Sets required minimal version of PHP
  259.      *
  260.      * @param string $requires_php_version 
  261.      */
  262.     public function set_requires_php_version($requires_php_version{
  263.         if (ereg("^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$"trim($requires_php_version))) {
  264.             $this->requires_php_version = $requires_php_version;
  265.         else {
  266.             throw new Tangra_Exception("Invalid requires_php_version literal: $requires_php_version. Must conform: ^([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2})([A-Za-z]{1,5}[0-9]{0,2})?$");
  267.         }
  268.     }
  269.  
  270.  
  271.     /**
  272.      * Gets required minimal version of PHP
  273.      *
  274.      * @return string 
  275.      */
  276.     public function get_requires_php_version({
  277.         return $this->requires_php_version;
  278.     }
  279.  
  280.  
  281.     /**
  282.      * Sets is online? flag
  283.      *
  284.      * @param booleand $online 
  285.      */
  286.     public function set_online($online{
  287.         $this->online = $online true false;
  288.     }
  289.  
  290.  
  291.     /**
  292.      * Gets is online? flag
  293.      *
  294.      * @return boolean 
  295.      */
  296.     public function get_online({
  297.         return $this->online;
  298.     }
  299.  
  300.  
  301.     /**
  302.      * Sets release date
  303.      *
  304.      * @param string $release_date Date of the release
  305.      */
  306.     public function set_release_date($release_date{
  307.         if ($release_date != '0000-00-00'{
  308.             if (is_valid_date($release_date)) {
  309.                 $this->release_date = $release_date;
  310.             else {
  311.                 throw new Tangra_Exception('Invalid release date.');
  312.             }
  313.         else {
  314.             $this->release_date = $release_date;
  315.         }
  316.     }
  317.  
  318.  
  319.     /**
  320.      * Gets release date
  321.      *
  322.      * @return string 
  323.      */
  324.     public function get_release_date({
  325.         return $this->release_date;
  326.     }
  327.  
  328.  
  329.     /**
  330.      * Sets change notes
  331.      *
  332.      * @param string $changes 
  333.      */
  334.     public function set_changes($changes{
  335.         $this->changes = $changes;
  336.     }
  337.  
  338.  
  339.     /**
  340.      * Gets change notes
  341.      *
  342.      * @return string 
  343.      */
  344.     public function get_changes({
  345.         return $this->changes;
  346.     }
  347. }