Source for file CLI_STATE.phpclass

Documentation is available at CLI_STATE.phpclass

  1. <?php
  2. /**
  3.   * Class file CLI_STATE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    client
  7.   *
  8.   * @author     Peter Krebs <opencsp@amicas.at>
  9.   * @copyright  (c) 2007 by Peter Krebs
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-07-01-04
  13.   * @version $Id: CLI_STATE.phpclass,v 1.2 2008/07/31 18:06:07 pitlinz Exp $
  14.   *
  15.   */
  16.  
  17.     // ---------------------------------------------------------
  18.     // requirements
  19.     // ---------------------------------------------------------
  20.     
  21.     require_once __OCSP_DEFAULTCONFPATH__."client.conf.phpinc";
  22.     pcf_require_class('DBMS_TABLEOBJ',"db/");
  23.     pcf_require_class('CLI_STAFF_TYPE',dirname(__FILE__)."/");
  24.     pcf_require_class('CLI_FORM',dirname(__FILE__)."/");
  25.  
  26. /**
  27.   * Class file CLI_STATE.phpclass
  28.   *
  29.   * @project    Open CSP-Management
  30.   * @package    client
  31.   *
  32.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  33.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  34.   *
  35.   * @since pk-07-01-04
  36.   * @version $Id: CLI_STATE.phpclass,v 1.2 2008/07/31 18:06:07 pitlinz Exp $
  37.   */
  38. class CLI_STATE extends DBMS_TABLEOBJ {
  39.     
  40.     // ---------------------------------------------------------------------------
  41.     // constants
  42.     // ---------------------------------------------------------------------------
  43.     
  44.     /**
  45.       * @constant string CLASS_SRC_FILE
  46.       * @since pk-08-02-03
  47.       */
  48.     const CLASS_SRC_FILE = __FILE__;    
  49.     
  50.     // ---------------------------------------------------------------------------
  51.     // class (static)
  52.     // ---------------------------------------------------------------------------
  53.     
  54.     /*** class vars ------------------------------------------------------ */
  55.     
  56.     /**
  57.      * unit of work loaded groups
  58.      *
  59.      * @var array $loadedStates 
  60.      */
  61.     static protected $loadedStates = array();
  62.     
  63.     // ---------------------------------------------------------------------------
  64.     // object vars
  65.     // ---------------------------------------------------------------------------
  66.     
  67.     /*** compostion --------------------------------------------------- */
  68.     
  69.     /*** attributes  -------------------------------------------------- */
  70.     
  71.     
  72.     /**
  73.       * source file of the class
  74.       *
  75.       * @staticvar string $classSrcFile 
  76.       * @since pk-07-09-19
  77.       * @deprecated
  78.       */
  79.     protected $classSrcFile=__FILE__;
  80.  
  81.     /**
  82.       * @var string $myTable name of the db table
  83.       */
  84.     protected $myTable="T_CLI_STATES";
  85.  
  86.     
  87.     // ---------------------------------------------------------------------------
  88.     // factory / construct
  89.     // ---------------------------------------------------------------------------
  90.     
  91.     /**
  92.      * returns a type out of self::$loadedTypes
  93.      *
  94.      * @param int $aId 
  95.      * @param boolean $debug 
  96.      * 
  97.      * @return CLI_STAFF_TYPE 
  98.      */
  99.     public static function &getInstance($aId,$debug=False)
  100.     {
  101.         $aId intval($aId);
  102.         
  103.         if ($debugechoDebugMethod(__FILE__,"static","CLI_STATE::getInstance({$aId}");
  104.         
  105.         if (isset(self::$loadedStates[$aId]&& pcf_is_instance_of(self::$loadedStates[$aId],'CLI_STATE'))
  106.         {
  107.             return self::$loadedStates[$aId];
  108.         }
  109.  
  110.         self::$loadedStates[$aIdself::factoryFromId($aId,$debug);
  111.         return self::$loadedStates[$aId];        
  112.     }
  113.     
  114.     /**
  115.      * factories a type object from the id
  116.      *
  117.      * @param int $aId 
  118.      * @param boolean $debug 
  119.      * 
  120.      * @return CLI_STAFF_TYPE 
  121.      */
  122.     public static function factoryFromId($aId,$debug=False)
  123.     {
  124.         if ($debugechoDebugMethod(__FILE__,"static","CLI_STATE::factoryFromId({$aId}");
  125.         
  126.         $obj_ret new CLI_STATE();
  127.         $obj_ret->setId(intval($aId));
  128.         $obj_ret->dbPopulate();
  129.         
  130.         return $obj_ret;
  131.     }    
  132.     
  133.     /**
  134.       * init the object and populate if an id is submitted
  135.       *
  136.       * @param int $clsId 
  137.       * @param string $gDBIdx 
  138.       * @param bool $debug 
  139.       *
  140.       ***/
  141.     function CLI_STATE($clsId=0,$debug=FALSE{
  142.         if ($debugechoDebugMethod(__FILE__,get_class($this),"CLI_STATE::CLI_STATE($clsId,$debug)");
  143.         $this->init($gDBIdx,$debug);
  144.         if ($clsId{
  145.             $this->setId($clsId);
  146.             $this->dbPopulate($debug);
  147.         else {
  148.             $this->setDefaults();
  149.         }
  150.     }
  151.  
  152.  
  153.     /**
  154.       * returns the id
  155.       * @return int 
  156.       ***/
  157.     function getId({
  158.         return intval($this->getDBField('CLS_ID'));
  159.     }
  160.  
  161.     /**
  162.       * sets the id
  163.       * @param int $aId 
  164.       ***/
  165.     function setId($aId{
  166.         $this->setDBField('CLS_ID',intval($aId));
  167.     }
  168.  
  169.     /**
  170.       * returns the name of the staff
  171.       * @return string 
  172.       ***/
  173.     function getName({
  174.         return $this->getDBField('CLS_NAME');
  175.     }
  176.  
  177. }
  178. ?>

Documentation generated on Thu, 08 Jan 2009 17:38:25 +0100 by phpDocumentor 1.4.0a2