Source for file AUDIENCE.phpclass

Documentation is available at AUDIENCE.phpclass

  1. <?php
  2. /**
  3.   * Class file AUDIENCE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    audience
  7.   *
  8.   * @author     Peter Krebs <p.krebs@lvus.at>
  9.   * @copyright  (c) 2002-2005 by LVUS
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-05-02-11
  13.   *
  14.   ***/
  15.   
  16. if (file_exists($GLOBALS['PROJECT']['CONFIGPATH']."shop.conf")) {
  17.     require_once $GLOBALS['PROJECT']['CONFIGPATH']."shop.conf";
  18. }    
  19.  
  20. require_once $GLOBALS['OCSP']['PHPINCPATH']."db/dbms_tableobj.phpclass";
  21.  
  22. /**
  23.   * Class file AUDIENCE.phpclass
  24.   *
  25.   * @project    Open CSP-Management
  26.   * @package    audience
  27.   *
  28.   * @author     Peter Krebs <p.krebs@wpus.at>
  29.   * @copyright  (c) 2006 by Peter Krebs and WURM & Partner Unternehmensservice GesmbH.
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-06-02-10
  33.   *
  34.   ***/
  35. class AUDIENCE extends DBMS_TABLEOBJ {
  36.  
  37.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  38.     /*  DBMS_TABLEOBJ variables                                               */
  39.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */    
  40.     /**
  41.       * @staticvar string $myTable 
  42.       */
  43.     var $myTable="T_AUDIENCE";
  44.  
  45.     /**
  46.       * @staticvar string $classSrcFile source file of the class
  47.       ***/
  48.     var $myClassSrcFile=__FILE__;
  49.  
  50.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  51.     /*  prototype variables                                                   */
  52.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  53.  
  54.     
  55.         
  56.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  57.     /*  construct / init / objvar methods                                     */
  58.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  59.  
  60.     /**
  61.       * @param int $aId 
  62.       * @param string $gDBIDX (key of the database object in $GLOBALS[])
  63.       * @param boolean $debug 
  64.       *
  65.       * @returns AUDIENCE
  66.       *
  67.       ***/
  68.     function AUDIENCE($aId=0,$gDBIDX="USRDB",$debug=FALSE{
  69.         if ($debugechoDebugMethod(__FILE__,get_class($this),"AUDIENCE::AUDIENCE($aId,...)","",0);
  70.         $this->init();              
  71.         if (intval($aId)) {
  72.             $this->db_SetKey("AUD_ID",$aId);
  73.             $this->dbPopulate();
  74.         }
  75.     }
  76.     
  77.     /**
  78.       * @returns int
  79.       ***/
  80.     function getId({
  81.         return intval($this->AUD_ID);
  82.     }
  83.  
  84.     /**
  85.       * @returns string
  86.       ***/
  87.     function getName({
  88.         return intval($this->AUD_NAME);
  89.     }
  90.         
  91.     
  92.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  93.     /*  DB Methods                                                            */
  94.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  95.  
  96.     /**
  97.       * deletes the row from the database
  98.       * and all rows from T_CLI_AUDIENCE and T_PRO_AUDIENCE
  99.       *
  100.       * if you take use of audience and add some other n:m tables
  101.       * make sure the table is listend in $GLOBALS['OCSP']['AUDIENCE']['LINKTABLES']
  102.       * if so the tables is also cleared here.
  103.       *
  104.       * @param string $gDBIDX 
  105.       * @param boolean $backupData 
  106.       * @param boolean $debug 
  107.       *
  108.       * @returns boolean
  109.       *
  110.       * @todo backup T_CLI_AUDIENCE and T_PRO_AUDIENCE
  111.       *
  112.       ***/
  113.     function dbDelete($gDBIDX="USRDB",$backupData=FALSE,$debug=FALSE{
  114.         if ($debugechoDebugMethod(__FILE__,get_class($this),"AUDIENCE::dbDelete()","",0);
  115.  
  116.         if (parent::dbDelete($gDBIDX,$backupData,$debug)) {
  117.             if (is_array($GLOBALS['OCSP']['AUDIENCE']['LINKTABLES'])) {
  118.                 foreach($GLOBALS['OCSP']['AUDIENCE']['LINKTABLES'as $tbl{
  119.                     $s_cmd="DELETE FROM ".$tbl." WHERE AUD_ID=".$this->getId();
  120.                     $GLOBALS[$gDBIDX]->executeCmd($s_cmd);
  121.                 }
  122.             }
  123.         
  124.             $s_cmd="DELETE FROM T_CLI_AUDIENCE WHERE AUD_ID=".$this->getId();
  125.             $GLOBALS[$gDBIDX]->executeCmd($s_cmd);
  126.             
  127.             $s_cmd="DELETE FROM T_PRO_AUDIENCE WHERE AUD_ID=".$this->getId();
  128.             $GLOBALS[$gDBIDX]->executeCmd($s_cmd);
  129.             
  130.             return TRUE;
  131.         else {
  132.             return FALSE;
  133.         }
  134.     }
  135.                    
  136.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  137.     /*  Form Methods                                                          */
  138.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  139.  
  140.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  141.     /*  Client Methods                                                        */
  142.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  143.     
  144.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  145.     /*  Product Methods                                                       */
  146.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  147.     
  148.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  149.     /*  rights Methods                                                        */
  150.     /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  151.     
  152. }
  153. ?>

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