Source for file DBMS_FIELD_EXTOBJ.phpclass

Documentation is available at DBMS_FIELD_EXTOBJ.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_EXTOBJ.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   any
  8.   *
  9.   * @author     p.krebs@lvus.at
  10.   * @copyright  &copy; 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  11.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  12.   *
  13.   ***/
  14.  
  15. require_once dirname(__FILE__)._OCSP_DIRSEP_."DBMS_FIELD.phpclass";
  16.  
  17. /**
  18.   * Class DBMS_FIELD_EXTOBJ
  19.   *
  20.   * includes external Field Objects into the system
  21.   *
  22.   * @project    Open CSP-Management
  23.   * @package    dbms_field
  24.   * @category   any
  25.   *
  26.   * @author     p.krebs@lvus.at
  27.   * @copyright  &copy; 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  28.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  29.   *
  30.   * @since pk-04-10-05
  31.   *
  32.   ***/
  33. class DBMS_FIELD_EXTOBJ extends DBMS_FIELD {
  34.     var $className     = "External Object";
  35.  
  36.     /**
  37.       * @var $objectFile 
  38.       ***/
  39.     var $objectFile     = NULL;
  40.  
  41.     function require_objectFile($debug=FALSE{
  42.         if ($debugecho "<p><b>DBMS_FIELD_EXTOBJ::require_objectFile(...)</b> (".get_class($this).")</p>";
  43.  
  44.         if (!empty($this->objectFile&& file_exists($GLOBALS['PROJECT']['PATH'].$this->objectFile)) {
  45.             require_once $GLOBALS['PROJECT']['PATH'].$this->objectFile;
  46.         }
  47.     }
  48.  
  49.     function editTblForm($debug=FALSE{
  50.         parent::editTblForm();
  51.         if (!empty($this->objectFile)) $this->require_objectFile($debug);
  52.     }
  53.     ###############################
  54.  
  55.     function save({
  56.         $retparent::save();
  57.         $this->unit=$_POST['UNIT'];
  58.         return $ret;
  59.     }
  60.  
  61.     function writeField($mode,$aValue="",$arrName="DBVAL"{
  62.         $ret=parent::writeField($mode,$aValue,$arrName);
  63.         if ($mode != FRM_MODE_HIDDEN{
  64.             echo " ".$this->unit;
  65.         }
  66.         return $ret;
  67.     }
  68.  
  69.     /**
  70.       * returns the field value
  71.       *
  72.       * @param  string  $aValue     the value
  73.       * @param  array   $err        error array
  74.       * @param  string  $arrName    name of the array to access fieldsarray  gloabl ${$arrName}
  75.       * @param  bool    $debug 
  76.       *
  77.       * @return string 
  78.       *
  79.       * @since   pk-03-12-13
  80.       * @version pk-03-12-13
  81.       *
  82.       ***/
  83.     function getValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE{
  84.         if ($debugecho "<hr><p><b>DBMS_FIELD_EXTOBJ::getValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.")</p>";
  85.  
  86.         if (($aValue == 0|| (doubleval($aValue))) {
  87.             return doubleval($aValue);
  88.         else if (empty($aValue)) {
  89.             if ($this->allowNull()) {
  90.                 return $GLOBALS[$this->getGlobalDBObjIdx()]->qs_getNullStmt();
  91.             else {
  92.                 $err['ERROR']=TRUE;
  93.                 $err[$this->myName]['MSG']="NULL_NOT_ALLOWED";
  94.                 $err[$this->myName]['LABEL']=$this->label;
  95.                 if ($debugprint_r($err);
  96.                 return FALSE;
  97.             }
  98.         else {
  99.             $err['ERROR']=TRUE;
  100.             $err[$this->myName]['MSG']   ="NO_NUMBER";
  101.             $err[$this->myName]['LABEL'=$this->label;
  102.             return NULL;
  103.         }
  104.     }
  105.  
  106.     /**
  107.       * add slashes to the value to add it to a sql command
  108.       *
  109.       * @param  string  $aValue     the value
  110.       * @param  array   $err        error array
  111.       * @param  string  $arrName    name of the global array to access field gloabl ${$arrName}
  112.       * @param  bool    $debug 
  113.       *
  114.       * @return string 
  115.       *
  116.       * @version pk-03-12-13
  117.       *
  118.       ***/
  119.     function slashedValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE{
  120.         if ($debugecho "<hr><p><b>DBMS_FIELD_EXTOBJ::slashedValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.")</p>";
  121.         return $this->getValue($aValue,$err,$arrName,$debug);
  122.     }
  123. }
  124. ?>

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