Source for file DBMS_FIELD_CLI_STATESELECT.phpclass

Documentation is available at DBMS_FIELD_CLI_STATESELECT.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_CLI_STATESELECT.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   int
  8.   *
  9.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @version pk-06-01-16
  13.   *
  14.   ***/
  15.  
  16. /**
  17.   * requirements
  18.   */
  19. require_once dirname(__FILE__)._OCSP_DIRSEP_."DBMS_FIELD_FOREIGNKEY.phpclass";
  20.  
  21. /**
  22.   * Class file DBMS_FIELD_CLI_STATESELECT.phpclass
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    dbms_field
  26.   * @category   int
  27.   *
  28.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  29.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  30.   *
  31.   * @version pk-07-10-14
  32.   *
  33.   ***/
  34.     /**
  35.       * source file of the class
  36.       *
  37.       * @var string $classSrcFile 
  38.       ***/
  39.     var $classSrcFile=__FILE__;
  40.  
  41.     /**
  42.       * @var string $lookupTable 
  43.       * @var string $lookupShowField 
  44.       * @var string $lookupField 
  45.       * @var string $lookupSort 
  46.       * @var boolean $showNullOption 
  47.       * @var string $nullLabel 
  48.       */
  49.     var $lookupTable     = "T_CLI_STATES";
  50.     var $lookupShowField = "CLS_NAME";
  51.     var $lookupField     = "CLS_ID";
  52.     var $lookupSort      = "CLS_SORTORDER";
  53.     var $showNullOption  = FALSE;
  54.     var $nullLabel       ="--- ??? ---";
  55.  
  56.  
  57.     /**
  58.       * returns an array of field to bie shown in the edit form
  59.       * by using editTbl_echoForm
  60.       *
  61.       * @param boolean $debug 
  62.       * @returns array
  63.       *
  64.       * @since pk-07-10-14
  65.       *
  66.       ***/
  67.     function editTbl_getFieldEditArr($debug=FALSE{
  68.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FOREIGNKEY::editTbl_getFieldEditArr","",0);
  69.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  70.  
  71.         $a_ret['DBLOOKUP']['FLD_LUTBL']=NULL;
  72.         $a_ret['DBLOOKUP']['FLD_VALFLD']['FLDVAL']="T_CLI_STATES.CLS_ID";
  73.         $a_ret['DBLOOKUP']['FLD_LSTADDVALUES']=NULL;
  74.  
  75.         unset($a_ret['FTBL_POPUPS']);
  76.         return $a_ret;
  77.     }
  78.  
  79.     /**
  80.       * saves the edit form
  81.       *
  82.       * @returns boolean
  83.       *
  84.       ***/
  85.     function save({
  86.         $ret=parent::save();
  87.  
  88.         $this->lookupTable       = "T_CLI_STATES";
  89.         $this->lookupShowField   = "CLS_NAME";
  90.         $this->lookupField       = "CLS_ID";
  91.         $this->lookupSort        = "CLS_SORTORDER";
  92.         return $ret;
  93.     }
  94.  
  95.     /**
  96.       * returns the database query
  97.       *
  98.       * @param boolean $debug 
  99.       *
  100.       * @global ${$this->myDataArrName} 
  101.       *
  102.       * @return string 
  103.       *
  104.       * @requires pcf_templates.phpinc
  105.       *
  106.       * @since pk-07-09-03
  107.       * @version pk-08-04-15
  108.       *
  109.       * @todo DBMS_FIELD_DBLOOKUPSELECTLIST::getMyValueQuery() remove inline SQL
  110.       */
  111.     function getMyValueQuery($debug=FALSE)
  112.     {
  113.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_DBLOOKUPSELECTLIST::getMyValueQuery()");
  114.  
  115.         global ${$this->myDataArrName};
  116.  
  117.         if (empty($this->lookupShowField)) $this->lookupShowField=$this->lookupField;
  118.         $str_query ="SELECT ".$this->lookupField" AS KEYCOL,".$this->lookupShowField" as VALUECOL FROM ".$this->lookupTable;
  119.  
  120.         $str_WhereAnd " WHERE ";
  121.         if (!empty($this->lookupWhere)) // <pk-05-08-10>
  122.             require_once __OCSP_PHPINCPATH__."common/pcf_templates.phpinc";
  123.             $str_query.=  $str_WhereAnd pcf_tmpl_parse($this->lookupWhere,${$this->myDataArrName},$debug);
  124.             $str_WhereAnd " AND ";
  125.         }
  126.         
  127.         switch ($this->myForm->getFrmMode())
  128.         {
  129.             case FRM_MODE_EDIT:
  130.             case FRM_MODE_NEW:
  131.             case FRM_MODE_COPY:
  132.                 if (!class_exists('CLIENT'))
  133.                 {
  134.                     require_once __OCSP_PHPINCPATH__ "client" _OCSP_DIRSEP_ "CLIENT.phpclass";
  135.                 }
  136.                 $obj_client CLIENT::factoryFromId(${$this->myDataArrName}['CLI_ID']);
  137.                 $str_query .= $str_WhereAnd " CTY_ID = " $obj_client->getTypeId();
  138.                 break;
  139.         }
  140.  
  141.         if (empty($this->lookupSort)) {
  142.             $str_query.=" ORDER BY ".$this->lookupField;
  143.         else {
  144.             $str_query.=" ORDER BY ".$this->lookupSort;
  145.         }
  146.         if ($debugechoDebugLine(__FILE__,__LINE__,"value query: <br />$str_query");
  147.         
  148.         if (empty($this->progValueCacheId))
  149.         {
  150.             $this->progValueCacheId md5($str_query);
  151.         }        
  152.         return $str_query;
  153.      }  
  154.  
  155. }
  156. ?>

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