Source for file MED_MIMETYPE.phpclass

Documentation is available at MED_MIMETYPE.phpclass

  1. <?php
  2. /**
  3.   * Class file MED_MIMETYPE.phpclass
  4.   *
  5.   * @project    Open CSP-Management
  6.   * @package    media
  7.   *
  8.   * @author     Peter Krebs (pk) <p.krebs@amicas.at>
  9.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @since pk-03-12-18
  12.   * @version pk-07-04-10
  13.   *
  14.   * @requires $GLOBALS['OCSP']['DEFAULTCONFPATH']."media.conf.phpinc";
  15.   * @requires $GLOBALS['OCSP']['PHPINCPATH']."db/dbms_tableobj.phpclass";
  16.   *
  17.   ***/
  18.  
  19. require_once __OCSP_PHPINCPATH__."default_config/media.conf.phpinc";
  20. require_once __OCSP_PHPINCPATH__."db/DBMS_TABLEOBJ.phpclass";
  21.  
  22. /**
  23.   * Class MED_MIMETYPE
  24.   *
  25.   * @project    Open CSP-Management
  26.   * @package    media
  27.   *
  28.   * @author     Peter Krebs (pk) <p.krebs@lvus.at>
  29.   * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  30.   *
  31.   * @since pk-03-12-18
  32.   *
  33.   ***/
  34. class MED_MIMETYPE extends DBMS_TABLEOBJ {
  35.     /**
  36.       * name of the db table
  37.       * @staticvar string $myTable 
  38.       ***/
  39.     var $myTable="T_MED_MIMETYPES";
  40.     /**
  41.       * fields in $this->myTable starts with
  42.       * @staticvar string $colPrevix 
  43.       ***/
  44.     var $colPrevix      = "MIM_";
  45.  
  46.     /**
  47.       * default only admin can upload any file type
  48.       *
  49.       * @var array $uploadGroups 
  50.       ***/
  51.     var $uploadGroups=array(1);
  52.  
  53.     /**
  54.       * members of this group can download or view the file
  55.       * @var array $openGroups 
  56.       ***/
  57.     var $openGroups=array(1);
  58.  
  59.     /**
  60.       * value array of DBMS_FORM Fields added to the input form
  61.       * @var array $objValues 
  62.       ***/
  63.     var $objValues=array();
  64.  
  65.     /**
  66.       * init the object and populates the object if aId
  67.       *
  68.       * @param int      $aId id of an existing template
  69.       * @param string   $name 
  70.       * @param int      $projId 
  71.       * @param string   $gDBIDX   GLOBALS database Object index
  72.       * @param bool     $debug 
  73.       *
  74.       ***/
  75.     function MED_MIMETYPE($aId=0,$mimeType="",$gDBIDX="USRDB",$debug=FALSE{
  76.         if ($debugecho "<p><b>new MED_MIMETYPE($aId,$mimeType,$gDBIDX,$debug)</b> (".get_class($this).")</p><blockquote>";
  77.         $this->init($gDBIDX,$debug);
  78.         if (intval($aId)) {
  79.             $this->{$this->colPrevix."ID"}=$aId;
  80.             $this->dbPopulate($debug);
  81.         else if (!empty($mimeType)) {
  82.             $query="SELECT * FROM ".$this->myTable." WHERE ".$this->colPrevix."MIMETYPE=";
  83.             $query.=$GLOBALS[$this->get_gDBIDX()]->qs_getSlashedValue($mimeType);
  84.             if ($row=$GLOBALS[$this->get_gDBIDX()]->quickQuery($query)) {
  85.                 $this->setDBRow($row);
  86.             }
  87.         }
  88.     }
  89.  
  90.  
  91.     /**
  92.       * returns parent::getDBRow($withoutNull,$debug) after
  93.       * setting the non database objects to the column values
  94.       *
  95.       * @param bool $withoutNull  null values are not added to the array
  96.       * @param bool $debug        show debug info?
  97.       *
  98.       * @return array 
  99.       *
  100.       ***/
  101.     function getDBRow($withoutNull=TRUE,$debug=FALSE,$withoutOV=False,$fldAutoPopulate=True
  102.     {
  103.         if ($debugecho "<p><b>MED_MIMETYPE::getDBRow($withoutNull,$debug)</b> (".get_class($this).")</p><blockquote>";
  104.         $this->{$this->colPrevix."UPLOADGRPS"implode(",",$this->uploadGroups);
  105.         $this->{$this->colPrevix."OPENGRPS"}   implode(",",$this->openGroups);
  106.         $this->{$this->colPrevix."OBJVALUES"}  serialize($this->objValues);
  107.         return parent::getDBRow($withoutNull,$debug);
  108.     }
  109.  
  110.     /**
  111.       * sets a database row to the object fields
  112.       *
  113.       * sets each key (=columname) value and the non DB object vars
  114.       *
  115.       * @param  array $row            the row form a select * from DBMS_TABLEOBJ::myTable
  116.       * @param  bool $asPopulated    set populateTS as if the object has been populated
  117.       * @param  bool $debug 
  118.       *
  119.       * @return bool 
  120.       *
  121.       ***/
  122.     function setDBRow($row,$asPopulated=TRUE,$debug=FALSE{
  123.         if ($debugecho "<p><b>MED_MIMETYPE::setDBRow($row,$asPopulated,$debug)</b> (".get_class($this).")</p><blockquote>";
  124.         if (parent::setDBRow($row,$asPopulated,$debug)) {
  125.             $this->uploadGroups=explode(",",$this->{$this->colPrevix."UPLOADGRPS"});
  126.             $this->openGroups=explode(",",$this->{$this->colPrevix."OPENGRPS"});
  127.             $this->objValues=unserialize($this->{$this->colPrevix."OBJVALUES"});
  128.             return TRUE;
  129.         else {
  130.             return FALSE;
  131.         }
  132.     }
  133.  
  134.  
  135.  
  136.  
  137. }

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