Source for file DBMS_FIELD_STRINGIDENTIFIER.phpclass

Documentation is available at DBMS_FIELD_STRINGIDENTIFIER.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_STRINGIDENTIFIER.phpclass
  4.   *
  5.   * @package    dbms_field
  6.   * @category   string
  7.   *
  8.   * @author     Peter Krebs (pk)<pitlinz@users.sourceforge.net>
  9.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @version $Id:$
  12.   */
  13.  
  14.     pcf_require_class('DBMS_FIELD',"db/frmClasses/");
  15.  
  16. /**
  17.   * Class DBMS_FIELD_STRINGIDENTIFIER
  18.   *
  19.   * @package    dbms_field
  20.   * @category   string
  21.   *
  22.   * @author     Peter Krebs (pk)<p.krebs@lvus.at>
  23.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  24.   *
  25.   * @version $Id:$
  26.   */
  27.     var $className     = "String Identifier";
  28.     var $replaceChar   = "_";
  29.     var $invalidChars  = " ";
  30.  
  31.     /**
  32.         * source file of the class
  33.         *
  34.         * @var string $classSrcFile 
  35.         * @since pk-05-02-19
  36.         ***/
  37.     var $classSrcFile=__FILE__;
  38.       
  39.     
  40.     /**
  41.       * returns an array of field to bie shown in the edit form
  42.       * by using editTbl_echoForm
  43.       *
  44.       * the array is in the form:
  45.       *
  46.       * <code>
  47.       * [_sectionName_]
  48.       *      [TITLE] -> string
  49.       *      [_rowName_]
  50.       *         [FLDLAB]  (complete html code with <td></td>)
  51.       *         [FLDVAL] (complete html code with <td></td>)
  52.       * </code>
  53.       *
  54.       * @param boolean $debug 
  55.       *
  56.       * @returns array
  57.       *
  58.       * @since pk-06-04-26
  59.       * @version pk-06-04-29
  60.       *
  61.       ***/
  62.     function editTbl_getFieldEditArr($debug=False)
  63.     {
  64.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_STRINGIDENTIFIER::editTbl_getFieldEditArr()");
  65.            $arr_ret parent::editTbl_getFieldEditArr($debug);
  66.            
  67.            $arr_ret['VALCHECKS']['INVALIDCHARS'array(
  68.                    'FLDLAB' => t_admin('Ungültige Zeichen'),
  69.                    'FLDVAL' => "<input name=\"INVALIDCHARS\" size=\"30\" value=\"".htmlspecialchars($this->invalidChars)."\">" 
  70.                );
  71.            $arr_ret['VALCHECKS']['REPLACECHAR'array(
  72.                    'FLDLAB' => t_admin('Ersetzungszeichen'),
  73.                    'FLDVAL' => "<input name=\"REPLACECHAR\" size=\"1\" maxlength=\"1\" value=\"".$this->replaceChar."\">" 
  74.                );
  75.  
  76.            return $arr_ret;
  77.     }
  78.  
  79.     function save({
  80.         $this->replaceChar = (!empty($_POST['REPLACECHAR']$_POST['REPLACECHAR'"_");
  81.         $this->invalidChars$_POST['INVALIDCHARS'];
  82.         return parent::save();
  83.     }
  84.  
  85.     // #############################################
  86.     
  87.     /**
  88.       * returns the field value
  89.       * after replacing invalid chars
  90.       *
  91.       * @param  string  $aValue     the value
  92.       * @param  array   $err        error array
  93.       * @param  string  $arrName    name of the array to access fieldsarray  gloabl ${$arrName}
  94.       * @param  bool    $debug 
  95.       *
  96.       * @return string 
  97.       *
  98.       * @since   pk-03-12-13
  99.       * @version pk-03-12-13
  100.       *
  101.       ***/
  102.     function getValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE{
  103.         if ($debugecho "<hr><p><b>DBMS_FIELD_STRINGIDENTIFIER::getValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)." | ".$this->myName.")</p>";
  104.  
  105.         $i=0;
  106.         while($i strlen($this->invalidChars)) {
  107.             $aValue=str_replace(substr($this->invalidChars,$i++,1),$this->replaceChar,$aValue);
  108.         }
  109.         return parent::getValue($aValue,$err,$debug);
  110.     }
  111.  
  112.     /**
  113.       * add slashes to the value from getValue to add it to a sql command
  114.       *
  115.       * @param  string  $aValue     the value
  116.       * @param  array   $err        error array
  117.       * @param  string  $arrName    name of the global array to access field gloabl ${$arrName}
  118.       * @param  bool    $debug 
  119.       *
  120.       * @return string 
  121.       *
  122.       * @version pk-03-12-13
  123.       *
  124.       ***/
  125.     function slashedValue($aValue,&$err,$arrName="DBVAL",$debug=FALSE{
  126.         if ($debugecho "<hr><p><b>DBMS_FIELD_STRINGIDENTIFIER::slashedValue($aValue,$err,$arrName,$debug)</b> (".get_class($this)."/".$this->myName.")</p>";
  127.         return parent::slashedValue($this->getValue($aValue,$err,$arrName,$debug),$err,$arrName,$debug);
  128.     }
  129.  
  130. // end class DBMS_FIELD_SELECTLIST
  131. ?>

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