Source for file MED_TABLEOBJ.phpclass

Documentation is available at MED_TABLEOBJ.phpclass

  1. <?php
  2. /**
  3.   * Class file MED_TABLEOBJ.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    media
  7.   *
  8.   * @author     Peter Krebs (pk) <p.krebs@lvus.at>
  9.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  10.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  11.   *
  12.   * @since pk-03-12-18
  13.   *
  14.   ***/
  15.  
  16. require_once $GLOBALS['DEFAULTCONFPATH']."media.conf.phpinc";
  17. require_once $GLOBALS['PROJECT']['PHPINCPATH']."db/dbms_tableobj.phpclass";
  18. require_once $GLOBALS['MED']['PHPINCPATH']."MED_CATEGORY_NODE.phpclass";
  19.  
  20. /**
  21.   * Abstract Class MED_TABLEOBJ
  22.   *
  23.   * Extends DBMS_TABLEOBJ with some common media aspects
  24.   *
  25.   * @project    Open CSP-Management
  26.   * @package    cms
  27.   *
  28.   * @author     Peter Krebs (pk) <p.krebs@lvus.at>
  29.   * @copyright  (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
  30.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-03-12-18
  33.   *
  34.   ***/
  35. class MED_TABLEOBJ extends DBMS_TABLEOBJ {
  36.     /**
  37.       * @var myCategory 
  38.       ***/
  39.     var $myCategory = NULL;
  40.  
  41.     // ###################################################################
  42.     // categorie methods
  43.     // ###################################################################
  44.  
  45.     /**
  46.       * if $this->myCategory is not set it will be set
  47.       *
  48.       * @returns MED_CATEGORY
  49.       *
  50.       ***/
  51.     function getCategory($debug=FALSE{
  52.         if ($debugecho "<p><b>MED_TABLEOBJ::getCategory($debug)</b> (".get_class($this).")</p>";
  53.         if (!is_object($this->myCategory)) {
  54.             if (!($this->myCategory=new MED_CATEGORY_NODE($this->getCatId()))) {
  55.                 return NULL;
  56.             }
  57.         }
  58.         if ((!$this->myCategory->getPopulateTs()) && (!$this->myCategory->dbPopulate())) {
  59.             return NULL;
  60.         }
  61.         return $this->myCategory;
  62.     }
  63.  
  64.     /**
  65.       * returns the categories root dir
  66.       *
  67.       * if no category is set or category could not be populated "/tmp" is returned
  68.       *
  69.       * @param bool $debug 
  70.       *
  71.       * @return string 
  72.       *
  73.       * @version pk-05-11-23 ensure dir ends with '/'
  74.       ***/
  75.     function getCatRootDir($debug=FALSE{
  76.         if ($debugecho "<p><b>MED_TABLEOBJ::getCatRootDir($debug)</b> (".get_class($this).")</p>";
  77.         if (!$this->getCategory($debug)) {  // make sure it is populated
  78.             return "/tmp/";                 // avoid placing files to a root dir if server has write rights
  79.         else {
  80.             $s_ret=trim($this->myCategory->getRootDir($debug));
  81.             if (!substr($s_ret,-1)=="/"$s_ret.="/";
  82.             return str_replace("//","/",$s_ret);
  83.         }
  84.     }
  85.  
  86.     // ###################################################################
  87.     // data manipulation
  88.     // ###################################################################
  89.  
  90.     /**
  91.       * sets the name column
  92.       *
  93.       * @param string $aName 
  94.       *
  95.       ***/
  96.     function setName($aName{
  97.         $this->setDBField($this->colPrevix."NAME",$aName);
  98.     }
  99.  
  100.     /**
  101.       * returns MEC_ID
  102.       *
  103.       * @return int 
  104.       *
  105.       ***/
  106.     function getCatId({
  107.         return $this->MEC_ID;
  108.     }
  109.  
  110.     /**
  111.       * sets the MEC_ID
  112.       *
  113.       * @param int $aCatId 
  114.       *
  115.       ***/
  116.     function setCatId($aCatId{
  117.         $this->MEC_ID =intval($aCatId);
  118.     }
  119. }
  120. ?>

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