Source for file DBMS_FIELD_SUBFRM.phpclass

Documentation is available at DBMS_FIELD_SUBFRM.phpclass

  1. <?php
  2. /**
  3.   * Abstract Class file DBMS_FIELD_SUBFRM_LIST.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    dbms_field
  7.   * @category   layout
  8.   *
  9.   * @author     Peter Krebs <p.krebs@amicas.at>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @version pk-07-01-16
  13.   *
  14.   ***/
  15.  
  16. if (!class_exists("DBMS_FIELD")) {
  17.     if (!file_exists($GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD.phpclass")) {
  18.         if (file_exists(dirname(__FILE__)."/DBMS_FIELD.phpclass")) {
  19.             $GLOBALS['OCSP']['DBMSFLD_PATH']=dirname(__FILE__)."/";
  20.         }
  21.     }
  22.     require_once $GLOBALS['OCSP']['DBMSFLD_PATH']."DBMS_FIELD.phpclass";
  23. }
  24.  
  25. /**
  26.   * Abstract Class DBMS_FIELD_SUBFRM_LIST
  27.   *
  28.   * @project    Open CSP-Management
  29.   * @package    dbms_field
  30.   * @category   layout
  31.   *
  32.   * @author     Peter Krebs <p.krebs@amicas.at>
  33.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  34.   *
  35.   * @version pk-07-01-16
  36.   *
  37.   ***/
  38. class DBMS_FIELD_SUBFRM extends DBMS_FIELD {
  39.  
  40.     // ###########################################################
  41.     // OBJECT (CONST) VAR DECLARATION
  42.     // ###########################################################
  43.  
  44.     var $className       = "Subform";
  45.  
  46.     /**
  47.       * source file of the class
  48.       *
  49.       * @var string $classSrcFile 
  50.       ***/
  51.     var $classSrcFile=__FILE__;
  52.  
  53.     /**
  54.       * @var string $colType 
  55.       ***/
  56.     var $colType="th";
  57.     
  58.     /**
  59.       * @var int $subfrmId 
  60.       ***/
  61.     var $subfrmId=0;
  62.     
  63.     /**
  64.       * @var string $subfrmJoinCond 
  65.       ***/
  66.     var $subfrmJoinCond="";
  67.     
  68.     /**
  69.       * @var int $subfrmMode 
  70.       ***/
  71.     var $subfrmMode=0;
  72.     
  73.     // ###########################################################
  74.     // OBJECT SETTINGS METHODS
  75.     // ###########################################################
  76.  
  77.     /**
  78.       * returns an array of field to bie shown in the edit form
  79.       * by using editTbl_echoForm
  80.       *
  81.       * the array is in the form:
  82.       *
  83.       * <code>
  84.       * [_sectionName_]
  85.       *      [TITLE] -> string
  86.       *      [_rowName_]
  87.       *         [FLDLAB]  (complete html code with <td></td>)
  88.       *         [FLDVAL] (complete html code with <td></td>)
  89.       *         [FLDTIT] (title of the label column)
  90.       * </code>
  91.       *
  92.       * NOTE as this is not implemented in the whole classTree at the moment ensure all parents use
  93.       * editTbl_echoForm() in theire editTblForm otherwise you'll get a mismatch of field order
  94.       *
  95.       * @param boolean $debug 
  96.       *
  97.       * @returns array
  98.       *
  99.       * @since pk-06-04-26
  100.       * @version pk-06-07-17 HIDDEN added to array
  101.       * @version pk-06-08-15 FLDTIT added
  102.       * @version pk-06-09-12 Tabs & Link showQuery added
  103.       *
  104.       ***/
  105.     function editTbl_getFieldEditArr($debug=FALSE{
  106.         if ($debugechoDebugMethod(__FILE__,get_class($this),"DBMS_FIELD_SUBFRM_LIST::editTbl_getFieldEditArr","",0);
  107.         
  108.         $a_ret=parent::editTbl_getFieldEditArr($debug);
  109.         
  110.         unset($a_ret['COMMON']['FRM_DEFVAL']);
  111.         unset($a_ret['VALCHECKS']);
  112.         
  113.         unset($a_ret['SHOW']['FLD_ALLOW']);
  114.         
  115.         $a_ret['LAYOUT']['FLD_LABTDADD']=array(
  116.             'FLDLAB'=>"Labelstyle",
  117.             'FLDVAL'=>"
  118.                     <select name=\"colType\" size=\"1\">
  119.                         <option value=\"th\">th</option>
  120.                         <option value=\"td class='fldName'\" ".($this->colType=="td class='fldName'" "selected " "").">td class='fldName'</option>
  121.                         <option value=\"td\" ".($this->colType=="td" "selected " "").">td</option>
  122.                     </select>\n"
  123.  
  124.         );
  125.         unset($a_ret['LAYOUT']['FLD_TABIDX']);
  126.         unset($a_ret['LAYOUT']['FLD_VALTDADD']);
  127.         unset($a_ret['LAYOUT']['FLD_SIZE']);
  128.         unset($a_ret['LAYOUT']['FLD_INPUTADD']);
  129.         unset($a_ret['LAYOUT']['FLD_ADDTAG']);
  130.         unset($a_ret['LIST']);
  131.         
  132.         $a_ret['SUBFORM']=array(
  133.             'TITLE'=>"Unterformular",
  134.             'HIDDENFIELD'   =>""
  135.             'ISHIDDEN'      =>FALSE,
  136.             'FLD_FRMID'     =>array('FLDLAB'=>"Unterformular"),
  137.             'FLD_FRMJOIN'   =>array(
  138.                 'FLDLAB'    =>"Formular Join Template",
  139.                 'FLDVAL'    =>"<textarea name=\"subfrmJoinCond\" rows=\"2\" cols=\"60\">".htmlspecialchars($this->subfrmJoinCond)."</textarea>"
  140.             ),
  141.             'FLD_FRMMODE'   =>array(
  142.                 'FLDLAB'    =>"Formular Modus",
  143.                 'FLDVAL'    =>"
  144.                                 <select name=\"subfrmMode\" size=\"1\">
  145.                                     <option value=\"".FRM_MODE_READONLY."\" ".(($this->subfrmMode==FRM_MODE_READONLY"selected" "").">Nur lesen</option>
  146.                                     <option value=\"".FRM_MODE_LIST."\" ".(($this->subfrmMode==FRM_MODE_LIST"selected" "").">Liste</option>
  147.                                 </select>
  148.                               ",
  149.             ),
  150.         );
  151.         
  152.         $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL']="<select name=\"subfrmId\" size=\"1\">\n";
  153.         $s_query ="SELECT DISTINCT FRM_ID,FRM_NAME,FRM_TABLES FROM T_DBMS_FORM WHERE FRM_ID <> ".intval($this->myFrmId);
  154.         $s_query.=" ORDER BY FRM_TABLES,FRM_NAME";
  155.         echo "<p>".$s_query."</p>";
  156.         if ($o_cursor=$GLOBALS['USRDB']->query($s_query)) {
  157.             $s_aktTbl="~INIT~";
  158.             while($a_row=$o_cursor->fetchArrayFld()) {
  159.                 if ($s_aktTbl != $a_row['FRM_TABLES']{
  160.                     if ($s_aktTbl!="~INIT~"{
  161.                         $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL'].="</optgroup>\n";
  162.                     }
  163.                     $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL'].="<optgroup label=\"".$a_row['FRM_TABLES']."\">\n";
  164.                     $s_aktTbl $a_row['FRM_TABLES'];
  165.                 }
  166.                 $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL'].="<option value=\"".$a_row['FRM_ID']."\" ".(($this->myFrmId==$a_row['FRM_ID']"selected""").">".$a_row['FRM_NAME']."</option>\n";
  167.             }
  168.             if ($s_aktTbl!="~INIT~"{
  169.                 $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL'].="</optgroup>\n";
  170.             }
  171.         }
  172.         $a_ret['SUBFORM']['FLD_FRMID']['FLDVAL'].="</select>\n";
  173.         return $a_ret;
  174.     }
  175.  
  176.  
  177.     /**
  178.       * save the filed definition form
  179.       *
  180.       * @returns boolean
  181.       *
  182.       ***/
  183.     function save({
  184.         if (parent::save()) {
  185.             $this->subfrmId         =$_POST['subfrmId'];
  186.             $this->subfrmJoinCond   =$_POST['subfrmJoinCond'];
  187.             $this->showInList       =FALSE;
  188.             $this->subfrmMode       =intval($_POST['subfrmMode']);
  189.  
  190.             return TRUE;
  191.         }
  192.     }
  193.  
  194.     // ###########################################################
  195.     // OBJECT DATA METHODS
  196.     // ###########################################################
  197.  
  198.  
  199.     // ###########################################################
  200.     // OBJECT HTML FORM METHODS
  201.     // ###########################################################
  202.  
  203.  
  204.     // ###########################################################
  205.     // SEARCH FORM METHODS
  206.     // ###########################################################
  207.  
  208.  
  209.     // ###########################################################
  210.     // OBJECT HTML FORM METHODS
  211.     // ###########################################################
  212.  
  213.  
  214.     // ###########################################################
  215.     // OBJECT VALUE CHECK METHODS
  216.     // ###########################################################
  217.  
  218.  
  219. // end class DBMS_FIELD_SUBFRM_LIST
  220. ?>

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