Source for file DBMS_FIELD_INPUTFIELDS.phpclass

Documentation is available at DBMS_FIELD_INPUTFIELDS.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_INPUTFIELDS.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   blob
  8.   *
  9.   * @author     Peter Krebs (pk)<p.krebs@lvus.at>
  10.   * @copyright  (c) 2002-2005 by LVUS <http://opencsp.lvu.at>
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14.  
  15. if (empty($GLOBALS['OCSP']['PHPFORMPATH'])) $GLOBALS['OCSP']['PHPFORMPATH']=dirname(__FILE__)."/";
  16.   
  17. if (!class_exists("DBMS_FIELD")) {
  18.     require_once dirname(__FILE__)."/DBMS_FIELD.phpclass";
  19. }  
  20.  
  21. /**
  22.   * Class DBMS_FIELD_INPUTFIELDS
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    dbms_field
  26.   * @category   blob
  27.   *
  28.   * @author     Peter Krebs (pk)<p.krebs@lvus.at>
  29.   * @copyright  (c) 2002-2005 by LVUS <http://opencsp.lvu.at>
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-04-06-02
  33.   *
  34.   ***/
  35.  
  36.     var $className       = "INPUTFIELDS";
  37.  
  38.     /**
  39.       * @var array $fldList 
  40.       ***/
  41.     var $fldLst=array();
  42.  
  43.     /**
  44.         * source file of the class
  45.         *
  46.         * @var string $classSrcFile 
  47.         * @since pk-05-02-19
  48.         ***/
  49.     var $classSrcFile=__FILE__;
  50.  
  51.     
  52.     /**
  53.       * echos the definition form for the field
  54.       */
  55.     function editTblForm({
  56.         parent::editTblForm(FALSE,FALSE);
  57.         ?>
  58.         <tr>
  59.             <td class="fldName" colspan="2">Subform:</td>
  60.         </tr>
  61.         <tr>
  62.             <td class="fldValue" colspan="2">
  63.                 <iframe name="frmFldList" src="/admin/dbms/subforms/fieldList.php?FRM_ID=<?php echo $this->myFrmId;?>&FIELD=<?php echo $this->getKey()?>" width="100%" height="300">
  64.                 </iframe>
  65.             </td>
  66.         </tr>
  67.         <?php
  68.     }
  69.  
  70.     /**
  71.       * saves the definition form for the field
  72.       */
  73.     function save({
  74.         $ret parent::save();
  75.         return $ret;
  76.     }
  77.  
  78.  
  79.     /**
  80.       * returns the field list array
  81.       *
  82.       * @return array 
  83.       ***/
  84.     function &getfldLst({
  85.         return $this->fldLst;
  86.     }
  87.  
  88.     /**
  89.       * adds a new field and get the class out of type
  90.       * if the class could not derived from
  91.       * $GLOBALS['DBMS_FIELD_CLASSES'][$type] DBMS_FIELD is used
  92.       *
  93.       * @param string $key      column name
  94.       * @param string $type     column db type
  95.       * @param array $dbDesc 
  96.       * @param string $label 
  97.       * @param string $tbl 
  98.       * @param bool $debug 
  99.       *
  100.       * @return DBMS_FIELD 
  101.       *
  102.       ***/
  103.     function &fldAdd($key,$type="unknown",$dbDesc=NULL,$label="",$tbl=NOTBL,$debug=FALSE{
  104.         if ($this->fldDebug$debug=TRUE;
  105.         if ($debugecho "<p><b>DBMS_FIELD_INPUTFIELDS::fldAdd($key,$type,$dbDesc,$label,$tbl,$debug)</b> (".get_class($this).")</p><blockquote>";
  106.         if (!is_array($dbDesc)) {
  107.             $dbDesc=array();
  108.             $dbDesc['TYPE']=$type;
  109.         }
  110.  
  111.         if (!is_array($dbDesc['FLAGS'])) $dbDesc['FLAGS']=array();
  112.  
  113.         if ($GLOBALS['DBMS_FIELD_CLASSES'][$type]{
  114.             $class=$GLOBALS['DBMS_FIELD_CLASSES'][$type];
  115.         else {
  116.             $class="DBMS_FIELD";
  117.         }
  118.  
  119.         if (!class_exists($class)) {
  120.             $ERR="FIELD_CLASS_NOT_FOUND ".$class;
  121.             include $PROJECT['PHPINCPATH']."io/errors.phpinc";
  122.             exit;
  123.         }
  124.  
  125.         $orderNr=0;$ordLst=array();
  126.         foreach($this->fldLst as $fld{
  127.             if ($debugecho "<p>$orderNr".$fld->sortOrder."</p>";
  128.             $orderNr++;
  129.             $fld->sortOrder=$orderNr;
  130.             $ordLst[$orderNr]=$fld;
  131.         }
  132.         $orderNr++;
  133.         $this->fldLst=$ordLst;
  134.  
  135.         $cmd="\$this->fldLst[\$orderNr]=new ".$class;
  136.         $cmd .="(\$tbl,\$key,\$dbDesc,\$orderNr,\$label);";
  137.         if (($debug)) echo "<pre>$cmd</pre>";
  138.         eval($cmd);
  139.         if ($debug{echo "<pre>";print_r($this->fldLst[$orderNr]);echo "</pre>";}
  140.  
  141.         return $this->fldLst[$orderNr];
  142.     }
  143.  
  144.     /**
  145.       * deletes a field
  146.       *
  147.       * @param int $fldNr 
  148.       *
  149.       ***/
  150.     function fldDelete($fldNr,$debug=FALSE{
  151.         if ($this->fldDebug$debug=TRUE;
  152.         if ($debugecho "<p><b>DBMS_FIELD_INPUTFIELDS::fldDelete($fldNr)</b> (".get_class($this).")</p>";
  153.  
  154.         $orderNr=0;$ordLst=array();
  155.         foreach($this->fldLst as $nr => $fld{
  156.             if ($fldNr != $nr{
  157.                 $orderNr++;
  158.                 $fld->sortOrder=$orderNr;
  159.                 $ordLst[$orderNr]=$fld;
  160.             }
  161.         }
  162.         $orderNr++;
  163.         $this->fldLst=$ordLst;
  164.     }
  165.  
  166.     /**
  167.       * change the data type of a field
  168.       *
  169.       * @param int $fldNr           index of the field
  170.       * @param string $newType      new data type
  171.       *
  172.       * @return bool 
  173.       *
  174.       ***/
  175.     function fldChangeType($fldNr,$newType,$debug=FALSE{
  176.         if ($this->fldDebug$debug=TRUE;
  177.         if ($debugecho "<p><b>DBMS_FIELD_INPUTFIELDS::fldChangeType($fldNr,$newType)</b> (".get_class($this).")</p>";
  178.         if (is_object($this->fldLst[$fldNr]&& in_array($newType,$GLOBALS['DBFLDTYPES'])) {
  179.             $this->fldLst[$fldNr]->dbDesc['TYPE']=$newType;
  180.             return TRUE;
  181.         else {
  182.             if ($debugecho "<blockquote>DBMS_FIELD_INPUTFIELDS returns FALSE</blockquote>";
  183.             return FALSE;
  184.         }
  185.     }
  186.     /**
  187.       * sets populates $this->myValues array from the database
  188.       *
  189.       * @param string $arrName 
  190.       * @param bool $debug 
  191.       *
  192.       * @version pk-03-12-18
  193.       *
  194.       ***/
  195.     function setMyValues($arrName="DBVAL",$debug=FALSE{
  196.     }
  197.  
  198.     function writeField($mode,$aValue="",$arrName="DBVAL"{
  199.     }
  200.  
  201.     function getScreenValue($aValue,$arrName="DBVAL",$debug=FALSE{
  202.     }
  203.  
  204. // end class DBMS_FIELD_INPUTFIELDS
  205. ?>

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