Source for file DBMS_FIELD_CLISELECT.phpclass

Documentation is available at DBMS_FIELD_CLISELECT.phpclass

  1. <?php
  2. /**
  3.   * Class file DBMS_FIELD_CLISELECT.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.   * @since pk-06-01-17
  13.   * @version $Id: DBMS_FIELD_CLISELECT.phpclass,v 1.6 2008/06/13 15:30:16 pitlinz Exp $
  14.   */
  15.  
  16. pcf_require_class('DBMS_FIELD_FOREIGNKEY',dirname(__FILE___OCSP_DIRSEP_ "DBMS_FIELD_FOREIGNKEY.phpclass");
  17.  
  18.  
  19. /**
  20.   * Class file DBMS_FIELD_CLISELECT.phpclass
  21.   *
  22.   * @project    Open CSP-Management
  23.   * @package    dbms_field
  24.   * @category   int
  25.   *
  26.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  27.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  28.   *
  29.   * @since pk-06-01-17
  30.   * @version $Id: DBMS_FIELD_CLISELECT.phpclass,v 1.6 2008/06/13 15:30:16 pitlinz Exp $
  31.   */
  32.     /**
  33.       * source file of the class
  34.       *
  35.       * @var string $classSrcFile 
  36.       * @since pk-05-01-20
  37.       ***/
  38.     protected $classSrcFile=__FILE__;
  39.     
  40.     protected $className      = "Kunden Select List";
  41.     
  42.     /**
  43.      * lookup table
  44.      *
  45.      * @var string $lookupTable 
  46.      */
  47.     protected $lookupTable     = "T_CLI_CLIENT";
  48.     
  49.     
  50.     protected $lookupShowField = "CONCAT(CLI_NAME1,IFNULL(CONCAT(' ',CLI_NAME2),''),' (',IFNULL(CLI_NUMBER,CONCAT('ID :',CLI_ID)),')')";
  51.     protected $lookupField     = "CLI_ID";
  52.     protected $lookupSort      = "CLI_NAME1,CLI_NAME2";
  53.     protected $showNullOption  = FALSE;
  54.  
  55.     /**
  56.      * type of client (CTY_ID)
  57.      *
  58.      * @var int $ctyId 
  59.      */
  60.     protected $ctyId           = 0;
  61.  
  62.  
  63.     /**
  64.       * returns an array of field to bie shown in the edit form
  65.       * by using editTbl_echoForm
  66.       *
  67.       * the array is in the form:
  68.       *
  69.       * <code>
  70.       * [_sectionName_]
  71.       *      [TITLE] -> string
  72.       *      [_rowName_]
  73.       *         [FLDLAB]  (complete html code with <td></td>)
  74.       *         [FLDVAL] (complete html code with <td></td>)
  75.       * </code>
  76.       *
  77.       * @param boolean $debug 
  78.       *
  79.       * @returns array
  80.       *
  81.       * @since pk-06-04-26
  82.       * @version pk-06-04-29
  83.       *
  84.       */
  85.     function editTbl_getFieldEditArr($debug=FALSE{
  86.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_FOREIGNKEY::editTbl_getFieldEditArr","",0);
  87.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  88.  
  89.         $a_ret['LAYOUT']['FLD_SIZE']=NULL;      // unset parent field
  90.         $a_ret['LAYOUT']['FLD_INPUTADD']=NULL;  // unset parent field
  91.  
  92.         $a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL']="T_CLI_CLIENT";
  93.         $a_ret['DBLOOKUP']['FLD_VALFLD']['FLDVAL']="CLI_ID";
  94.             
  95.         unset($a_ret['DBLOOKUP']['FLD_VALFLD']);
  96.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']=array(
  97.                 'FLDLAB'=>"Kundenart",
  98.                 'FLDVAL'=>"#SELECT see below#"
  99.             );
  100.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL']="
  101.                 <select name=\"ctyId\" size=\"1\">\n
  102.                     <option value=\"0\">--- ALLE ---</option>
  103.                     ";
  104.  
  105.         $s_query="SELECT * FROM T_CLI_TYPE ORDER BY CTY_SORTORDER,CTY_NAME";
  106.         if ($o_cursor=$GLOBALS['USRDB']->query($s_query)) {
  107.             while($a_cty=$o_cursor->fetchArrayFld()) {
  108.                 $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].="<option value=\"".$a_cty['CTY_ID']."\"";
  109.                 if ($this->ctyId==$a_cty['CTY_ID']$a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].=" selected";
  110.                 $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].=">".$a_cty['CTY_NAME']."</option>\n";
  111.             }
  112.         }
  113.         $a_ret['DBLOOKUP']['FLD_WHEREFLD']['FLDVAL'].="
  114.                 </select>";
  115.         return $a_ret;
  116.     }
  117.  
  118.  
  119.     function save({
  120.         $ret=parent::save();
  121.  
  122.         $this->lookupTable      = "T_CLI_CLIENT";
  123.         $this->lookupField      = "CLI_ID";
  124.         $this->lookupSort       = "CLI_NAME1,CLI_NAME2";
  125.         $this->nullLabel        = "--- ??? ---";
  126.         $this->allowNullSelect  FALSE;
  127.         $this->nullValue        0;
  128.         $this->ctyId            = (isset($_POST['ctyId']intval($_POST['ctyId']0);
  129.  
  130.         if (intval($this->ctyId)) {
  131.             $this->lookupWhere=" CTY_ID=".$this->ctyId;
  132.         }
  133.  
  134.         return $ret;
  135.     }
  136. }
  137. ?>

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