Source for file OCSP_AJAX_FLDEVENT.phpclass

Documentation is available at OCSP_AJAX_FLDEVENT.phpclass

  1. <?php
  2. /**
  3.   * Class file OCSP_AJAX_FLDEVENT.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    cms
  7.   * @category   chapter
  8.   *
  9.   * @author     Peter Krebs (pk) <pitlinz@users.sourceforge.net>
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-07-02-21
  13.   *
  14.   ***/
  15.  
  16. require_once __OCSP_PHPINCPATH__."common" _OCSP_DIRSEP_ "pcf_directory.phpinc";
  17. require_once dirname(__FILE__)_OCSP_DIRSEP_ "OCSP_AJAX_FUNCTION.phpclass";
  18.  
  19. /**
  20.   * Class OCSP_AJAX_FLDEVENT
  21.   *
  22.   * this class is designed to handle ajex functions
  23.   *
  24.   * @project    Open CSP-Management
  25.   * @package    cms
  26.   * @category   chapter
  27.   *
  28.   * @author     Peter Krebs (pk) <pitlinz@users.sourceforge.net>
  29.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  30.   *
  31.   * @since pk-07-02-21
  32.   *
  33.   ***/
  34.  
  35.     /** Aggregations: */
  36.  
  37.     /** Compositions: */
  38.  
  39.     /**
  40.       * @var DBMS_FLD $myField 
  41.       * @access protected
  42.       ***/
  43.     protected $myField=NULL;
  44.  
  45.  
  46.     /** Attributes: **/
  47.  
  48.     /**
  49.       * @var string $myEventMethode 
  50.       * @access protected
  51.       ***/
  52.     protected $myEventMethode=NULL;
  53.  
  54.     /**
  55.       * @var string $myFieldName 
  56.       * @access protected
  57.       ***/
  58.     protected $myFieldName=NULL;
  59.  
  60.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61.     // init methods
  62.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63.     /**
  64.       * cunstruct
  65.       *
  66.       * @param string $funcName 
  67.       * @param string $funcInc the include file containing the php function
  68.       * @param string $funcMethode the methode of the ajax request
  69.       * @param array $funcArgs 
  70.       * @param string $funcMethode 
  71.       *
  72.       * @access public
  73.       *
  74.       ***/
  75.     function OCSP_AJAX_FLDEVENT(&$ajaxObj,&$aFldObj,$aEventMethode,$funcArgs=NULL,$funcMethode=AJAX_RQMODE_GET{
  76.         $this->setFuncName("fldEventFunc");
  77.  
  78.         $this->myAjaxObj        =$ajaxObj;
  79.         $this->myField          =$aFldObj;
  80.         $this->myEventMethode   =$aEventMethode;
  81.         $this->myFuncInc        =NULL;
  82.         $this->myFuncMethod     =$funcMethode;
  83.         $this->myFuncArgs       =$funcArgs;
  84.     }
  85.  
  86.  
  87.     /**
  88.       * @returns string
  89.       * @access public
  90.       ***/
  91.     function getFuncName({
  92.         return "fldEventFunc";
  93.     }
  94.  
  95.     /**
  96.       * @retruns string
  97.       * @access public
  98.       ***/
  99.     function getTargetId({
  100.         return "";
  101.     }
  102.  
  103.     /**
  104.       * @param string $targetId 
  105.       * @access public
  106.       ***/
  107.     function setTargetId($targetId{
  108.         // do nothing
  109.     }
  110.  
  111.     /**
  112.       * @param DBMS_FLD $aField 
  113.       * @access public
  114.       ***/
  115.     function setFldObj(&$aField{
  116.         $this->myField=$aField;
  117.     }
  118.  
  119.     /**
  120.       * @param string $aEventMethode 
  121.       * @access public
  122.       ***/
  123.     function setEventMethode($aEventMethode{
  124.         $this->myEventMethode=$aEventMethode;
  125.     }
  126.  
  127.     /**
  128.       * @param string $aFieldName 
  129.       * @access public
  130.       ***/
  131.     function setFieldName($aFieldName{
  132.         $this->myFieldName=$aFieldName;
  133.     }
  134.  
  135.     /**
  136.       * if $this->myFieldName is empty "$dataArrname[$fld->name]" is returned
  137.       * @return string 
  138.       * @access public
  139.       ***/
  140.     function getFieldName({
  141.         if (empty($this->myFieldName)) {
  142.             if (pcf_is_instance_of($this->myField,'DBMS_FIELD')) {
  143.                 return $this->myField->getDataArrName()."[".$this->myField->getName()."]";
  144.             else {
  145.                 return "";
  146.             }
  147.         else {
  148.             return $this->myFieldName;
  149.         }
  150.     }
  151.  
  152.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  153.     // function methods
  154.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  155.  
  156.  
  157.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158.     // js methods
  159.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  160.  
  161.     /**
  162.       * returns the javascript function name
  163.       *
  164.       * @returns string
  165.       *
  166.       * @access public
  167.       *
  168.       ***/
  169.     function js_getFuncName({
  170.         return "oax_fld_".preg_replace("/[^a-zA-Z0-9]/","_",$this->myField->getFrmId()."_".$this->myField->getKey().'_'.$this->myEventMethode);
  171.     }
  172.  
  173.  
  174.     /**
  175.       * returns the javascript representation of the function
  176.       *
  177.       * @param boolean $debug 
  178.       *
  179.       * @returns string
  180.       *
  181.       * @access public
  182.       *
  183.       ***/
  184.     function js_getFunction($debug=FALSE{
  185.         if ($debugechoDebugMethod(__FILE__." L:".__LINE__,get_class($this),__CLASS__."::".__METHODE__."()");
  186.  
  187.         $s_ret="
  188.             /**
  189.               * wrapper for field ".$this->myField->getKey()."
  190.               **/
  191.             if (!ocspAjax_get_funcObj('".$this->getFuncName()."')) {
  192.                ".$this->js_getRegisterFunction()."
  193.             }
  194.             function ".$this->js_getFuncName()."(fldValue) {
  195.                 args = new Array();
  196.                 args[args.length]=new ocspAjax_funcArg('axFRM',".$this->myField->getFrmId().");
  197.                 args[args.length]=new ocspAjax_funcArg('axFLD','".$this->myField->getKey()."');
  198.                 args[args.length]=new ocspAjax_funcArg('axFLDNAME','".$this->getFieldName()."');
  199.                 args[args.length]=new ocspAjax_funcArg('axMETH','".$this->myEventMethode."');
  200.                 args[args.length]=new ocspAjax_funcArg('axARRNAME','".$this->myField->getDataArrName()."');
  201.                 args[args.length]=new ocspAjax_funcArg('axCURVAL',fldValue);
  202.                 ocspAjax_debug(\"Value: \" + fldValue);
  203.                 ocspAjax_do_call('".$this->getFuncName()."', args);
  204.             }
  205.  
  206.             ";
  207.         return $s_ret;
  208.     }
  209.  
  210.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  211.     // cache methods
  212.     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213.  
  214.     /**
  215.       * returns the cache values
  216.       *
  217.       * @param boolean $debug 
  218.       *
  219.       * @returns array
  220.       *
  221.       * @access protected
  222.       *
  223.       ***/
  224.  
  225. }

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