Source for file class.contents.php
Documentation is available at class.contents.php 
 * @package linea21.modules  
 * @see workshop, publication  
 * @author linea21 <info@linea21.com>  
 * @license http://opensource.org/licenses/gpl-3.0.html  
  var $P_UPLOAD_MAX_MO =  UPLOAD_MAX_MO; // taille maximale d'upload des fichiers en octets  
  var $P_URI_INPUT =  "publication/contents/"; // dossier racine de stockage des elements multimedias  
  var $P_URI_OUTPUT =  "publication/contents/"; // dossier racine de diffusion des elements multimedias  
  * contents::CheckDataIntegrity()  
  * vérifie l'integrité d'un partie avant Insertion  
  * @param array $table contient les composants d'une partie  
  * @param string $type 'P', 'W'  
  * @param string $type_test 'LIGHT', 'ROCK'  
  *  si verifié, sinon string 'message d'erreur'  
    if (strlen($table[0]) <  2) return _t('contents','no_title');  
    if (strlen($table[1]) <  10) return _t('contents','no_body');  
    if ($type ==  'P' &&  $type_test ==  'ROCK') {  
      if ($table[2] !=  3 &&  $table[3] ==  '')return _t('contents','no_visu1');  
   * contents::GetTemplateName()  
   * Retourne la forme textuelle du template  
    if ($num ==  1) return _t('contents','template_1');  
    if ($num ==  2) return _t('contents','template_2');  
    if ($num ==  3) return _t('contents','template_3');  
   * initialisation des tables SQL  
   * @param string $type : type du CONTENU 'WORKSHOP' ou 'PUBLICATION'  
  function _wichType($type)  
   * contents::AddContents()  
   * ajout d'une partie de contenu  
   * @param integer $ID identifiant du père (rattachement)  
   * @param array $contents_table tableau contenant les infos ressources  
   * @param string $type 'WORKSHOP' ou 'PUBLICATION'  
   * @return integer $last_id  
  function AddContents($ID, $contents_table, $type, $sql_object)  
    $contents_table= $sql_object->DBescape($contents_table);  
    if ($this->_wichType($type) ==  "error") exit;  
    if ($type ==  "WORKSHOP") {  
      $requete.=  " (workrepcon_title, workrepcon_body, workrepcon_date_crea, workrepcon_last_modify, workrepcon_validity)";  
      $requete .=  " VALUES('" .  $this->WR_TITLE .  "', '" .  $this->WR_BODY .  "', NOW(),NOW(), 'Y');";  
    if ($type ==  "PUBLICATION") {  
      $requete.=  " (publicon_title, publicon_body, publicon_template, publicon_photos_uri, publicon_date_crea, publicon_last_modify, publicon_validity)";  
    $last_id =  $sql_object->DBInsert ($requete, 1);  
      $requete =  "INSERT INTO " .  $this->TDB_LIAISON .  " VALUES(" .  $ID .  "," .  $last_id .  ", '" .  $this->ACTIVE_TYPE .  "');";  
      $result =  $sql_object->DBInsert ($requete);  
   * contents::ModifyContents()  
   * modification d'une partie de contenu  
   * @param integer $ID : identifiant de la partie à modifier  
   * @param array $contents_table : tableau contenant les infos ressources  
   * @param string $type 'WORKSHOP' ou 'PUBLICATION'  
   * @param object $sql_object   
   * @return boolean $result  
    $contents_table= $sql_object->DBescape($contents_table);  
    if ($this->_wichType($type) ==  "error") exit;  
    if ($type ==  "WORKSHOP") $this->WR_ID =  $ID;  
    if ($type ==  "PUBLICATION") $this->P_ID =  $ID;  
    if ($type ==  "WORKSHOP") {  
      $requete .=  "workrepcon_title='" .  $this->WR_TITLE .  "', workrepcon_body='" .  $this->WR_BODY .  "'workrepcon_last_modify=NOW() WHERE workrepcon_id='" .  $this->WR_ID .  "';";  
    if ($type ==  "PUBLICATION") {  
      $requete .=  "publicon_title='" .  $this->P_TITLE .  "', publicon_body='" .  $this->P_BODY .  "', publicon_template='" .  $this->P_TEMPLATE .  "',  publicon_photos_uri='" .  $this->P_PHOTOS_URI .  "', publicon_last_modify=NOW() WHERE publicon_id='" .  $this->P_ID .  "';";  
    $result =  $sql_object->DBQuery($requete);  
   * contents::DeleteContents()  
   * suppression d'une partie  
   * @param integer $ID : identifiant du contents a supprimer  
   * @param string $type :  'WORKSHOP' ou 'PUBLICATION'  
   * @param object $sql_object   
   * @return boolean $result  
      if ($type ==  "WORKSHOP") {  
        $champ1 =  "workrepcon_id";  
        $champ2 =  "jwp_contents_id";  
        $champ3 =  "workrepcon_validity";  
        $champ4 =  "workrepcon_last_modify";  
      if ($type ==  "PUBLICATION") {  
        $champ2 =  "jpp_contents_id";  
        $champ3 =  "publicon_validity";  
        $champ4 =  "publicon_last_modify";  
    if ($this->_wichType($type) ==  "error") return false;  
    $requete =  "UPDATE " .  $this->ACTIVE_TABLE .  " SET " .  $champ3 .  "='N', ". $champ4. "=NOW()  WHERE " .  $champ1 .  "='" .  $ID .  "';";  
    $result =  $sql_object->DBQuery($requete);  
 
 
        
       |