Source for file DBMS_FIELD_ARRSELECTLIST.phpclass

Documentation is available at DBMS_FIELD_ARRSELECTLIST.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_ARRSELECTLIST.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   any
  8.   *
  9.   * @author     Peter Krebs <p.krebs@lvus.at>
  10.   * @copyright  (c) 2002-2005 by Peter Krebs and Landesverlag Unternehmensservice
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14. require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD_SELECTLIST.phpclass";
  15.  
  16. /**
  17.   * Class DBMS_FIELD_ARRSELECTLIST
  18.   *
  19.   * @project    Open CSP-Management
  20.   * @package    dbms_field
  21.   * @category   any
  22.   *
  23.   * @author     Peter Krebs <p.krebs@lvus.at>
  24.   * @copyright  (c) 2002-2005 by Peter Krebs and Landesverlag Unternehmensservice
  25.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  26.   *
  27.   ***/
  28.     var $className       = "SelectArray";
  29.     var $allowNullSelect = FALSE;
  30.     var $arrName         = "";
  31.     var $subKey          = "";
  32.  
  33.     /**
  34.       * source file of the class
  35.       * (without $GLOBALS['PROJECT']['PATH']
  36.       *
  37.       * @var string $classSrcFile 
  38.       * @since pk-05-01-11
  39.       ***/
  40.     var $classSrcFile=__FILE__;
  41.  
  42.  
  43.     /**
  44.       * echos the definition form for the field
  45.       */
  46.     function editTblForm({
  47.         parent::editTblForm(FALSE,TRUE);
  48.         ?>
  49.         <tr>
  50.             <td class="fldName">PHP Array Name:</td>
  51.             <td class="fldValue">
  52.                 <input name="PHPARRAY" value="<?php echo $this->arrName?>" size=30>
  53.             </td>
  54.         </tr>
  55.         <tr>
  56.             <td class="fldName">Key: (bei Arrays)</td>
  57.             <td class="fldValue">
  58.                 <input name="subKey" value="<?php $this->subKey?>" size="40">
  59.             </td>
  60.         </tr>
  61.         <?php
  62.     }
  63.  
  64.     /**
  65.       * saves the definition form for the field
  66.       */
  67.     function save({
  68.         $ret parent::save();
  69.         $this->arrName          =$_POST['PHPARRAY'];
  70.         $this->allowNullSelect  =$this->allowNull();
  71.         $this->subKey           =$_POST['subKey'];
  72.         $this->myValues         =NULL;  // make sure that is has no entries from historical class changes
  73.         return $ret;
  74.     }
  75.  
  76.  
  77.     /**
  78.       * sets populates $this->myValues array from the database
  79.       *
  80.       * @param string $arrName 
  81.       * @param bool $debug 
  82.       *
  83.       * @version pk-03-12-18
  84.       *
  85.       ***/
  86.     function setMyValues($arrName="DBVAL",$debug=FALSE{
  87.         global ${$this->arrName};
  88.  
  89.         if (is_array(${$this->arrName})) {
  90.             $valArr=${$this->arrName};
  91.         }else{
  92.             $valArr=array();
  93.         }
  94.  
  95.         if ($debug{echo "<pre>".$this->arrName."\n";print_r($valArr);"</pre>";}
  96.  
  97.         reset($valArr);
  98.         while(list($key,$val)=each($valArr)) {
  99.             if (is_array($val)) {
  100.                 if (!empty($this->subKey)) {
  101.                     $this->myValues[$key]=$val[$this->subKey];
  102.                 }else {
  103.                     $this->myValues[$key]=implode("/",$val);
  104.                 }
  105.             else {
  106.                 $this->myValues[$key]=$val;
  107.             }
  108.         }
  109.     }
  110.  
  111.     function writeField($mode,$aValue="",$arrName="DBVAL"{
  112.         $this->setMyValues($arrName,$debug);
  113.         return parent::writeField($mode,$aValue,$arrName);
  114.     }
  115.  
  116.     function getScreenValue($aValue,$arrName="DBVAL",$debug=FALSE{
  117.         $this->setMyValues($arrName,$debug);
  118.         return parent::getScreenValue($aVlaue,$arrName,$debug);
  119.     }
  120.  
  121. // end class DBMS_FIELD_ARRSELECTLIST
  122. ?>

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