Source for file CMS_PAGE_FORM.phpclass

Documentation is available at CMS_PAGE_FORM.phpclass

  1. <?php
  2. /**
  3.   * Class file CMS_PAGE_FORM.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    client
  7.   *
  8.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  9.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @since pk-08-01-08
  12.   * @version $Id: CMS_PAGE_FORM.phpclass,v 1.5 2008/11/26 00:46:37 pitlinz Exp $
  13.   * 
  14.   */
  15.  
  16. if (!defined('__OCSP_CMS_PHPINCPATH__')) require_once __OCSP_DEFAULTCONFPATH__."cms.conf.phpinc";
  17.  
  18. pcf_require_interface('INFA_CMS_PAGE_FORM',dirname(__FILE__"/INFA_CMS_PAGE_FORM.phpclass");
  19. pcf_require_class('OCSP_FORM'__OCSP_PHPINCPATH__."db/forms/OCSP_FORM.phpclass");
  20.  
  21.  
  22. /**
  23.   * Class file CMS_PAGE_FORM
  24.   *
  25.   * extends DBMS_FORM to handle different page classes
  26.   *
  27.   * @project    Open CSP-Management
  28.   * @package    client
  29.   *
  30.   * @author     Peter Krebs <pitlinz@users.sourceforge.net>
  31.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  32.   *
  33.   * @since pk-08-01-08
  34.   * @version $Id: CMS_PAGE_FORM.phpclass,v 1.5 2008/11/26 00:46:37 pitlinz Exp $
  35.   */
  36. class CMS_PAGE_FORM extends OCSP_FORM implements INFA_CMS_PAGE_FORM 
  37. {
  38.  
  39.     /*** class constants  --------------------------------------------- */
  40.  
  41.     /**
  42.       * @constant string CLASS_SRC_FILE
  43.       */
  44.     const CLASS_SRC_FILE = __FILE__;
  45.  
  46.     // ----------------------------------------------------------------------------------------
  47.     // construct, load methods
  48.     // ----------------------------------------------------------------------------------------
  49.  
  50.     /**
  51.      * sets the tableobject class and include from $dataArr and
  52.      * tries to instantiate by calling $this->getMyTblObj
  53.      * 
  54.      * if class is set in $dataArr and it could not be instantiated FALSE is returned
  55.      * else TRUE is returned
  56.      * 
  57.      * @param array $dataArr (normaly $_POST)
  58.      * @param boolean $debug 
  59.      * 
  60.      * @return boolean 
  61.      * 
  62.      */
  63.     function setTblObjFromSubmitData(&$dataArr,$debug=FALSE)
  64.     {      
  65.         if ($debugechoDebugMethod(__FILE__,get_class($this),"CMS_PAGE_FORM::setTblObjFromSubmitData()");
  66.         global $OCSP_CONF;
  67.         
  68.         if (isset($dataArr['FRMARRAYNAME']&& isset($dataArr[$dataArr['FRMARRAYNAME']]['PAG_OBJCLASS']))
  69.         {
  70.             $str_postClass=$dataArr[$dataArr['FRMARRAYNAME']]['PAG_OBJCLASS']
  71.             if (isset($OCSP_CONF['CMS']['PAGETYPE'][$str_postClass]))
  72.             {
  73.                 $this->setTblObjClass($OCSP_CONF['CMS']['PAGETYPE'][$str_postClass]['CLASS']);
  74.                 $this->setTblObjInc($OCSP_CONF['CMS']['PAGETYPE'][$str_postClass]['OBJINC']);
  75.                 if ($debugechoDebugLine(__FILE__,__LINE__,"<p>table object <strong>".$this->tblObj_class."</strongset in \$$dataArr</p>");
  76.     
  77.                 if ($this->getMyTblObj(TRUE,$debug))
  78.                 {
  79.                     return TRUE;
  80.                 else {
  81.                     $this->setError($this->getLangTxt('COULD_NOT_INSTANTIATE')." ".$this->tblObj_class);
  82.                     return FALSE;
  83.                 }                 
  84.             }      
  85.         }
  86.                 
  87.         return parent::setTblObjFromSubmitData($dataArr,$debug=FALSE);
  88.     }
  89.  
  90.     // ------------------------------------------------------------------------------------------- 
  91.     // field methods
  92.     // ------------------------------------------------------------------------------------------- 
  93.     
  94.     /**
  95.       * returns a field object
  96.       *
  97.       * @param string $aFldName 
  98.       * @param string $aTable (empty to search in all tables)
  99.       * @param int $aBlockId (-1 to search in all blocks)
  100.       * @param boolean $debug 
  101.       *
  102.       * @return DBMS_FIELD 
  103.       *
  104.       * @version pk-08-07-12 (OBJVALS_)
  105.       */
  106.     function &getField($aFldName,$aTable="",$aBlockId=-1,$debug=False)
  107.     {
  108.         if ($debugechoDebugMethod(__FILE__,get_class($this),"CMS_PAGE_FORM::getField($aFldName,$aTable,$aBlockId)");
  109.  
  110.         if ($obj_ret parent::getField($aFldName,$aTable,$aBlockId))
  111.         {
  112.             return $obj_ret;
  113.         }
  114.         
  115.         if (empty($aTable&& strstr($aFldName,"."))
  116.         {
  117.             list($aTable,$aFldName)=explode(".",$aFldName,2);
  118.         }
  119.         
  120.  
  121.         if ("T_CMS_PAGE" == $aTable)
  122.         {
  123.             return parent::getField($aFldName,"PAGEOBJVAL",$aBlockId,$debug);       
  124.         
  125.         
  126.         return $obj_ret;
  127.         
  128.         
  129.         
  130.     }
  131.         
  132.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  133.     // rights
  134.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135.  
  136.     /**
  137.       * returns if the current user can save the form in the current mode
  138.       *
  139.       * @param boolean $debug 
  140.       * 
  141.       * @global array $OCSP_OBJ 
  142.       *
  143.       * @return boolean 
  144.       */
  145.     function curUserCanSave($debug=FALSE)
  146.     {        
  147.         if ($debugechoDebugMethod(__FILE__,get_class($this),"CMS_PAGE_FORM::curUserCanSave()");
  148.  
  149.         {
  150.             return False;
  151.         else {
  152.             return parent::curUserCanSave($debug);
  153.         }
  154.     }
  155.  
  156.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  157.     // ajax
  158.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  159.     
  160.     
  161.     /**
  162.      * return true to check the form on reload
  163.      * 
  164.      * @return boolean 
  165.      * 
  166.      * @since pk-08-11-25
  167.      */    
  168.     public function ajax_canChangeForm()
  169.     {
  170.         return True;
  171.     }
  172.     
  173.     
  174.     
  175.     
  176. }
  177. ?>

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