Source for file class.theme.php
Documentation is available at class.theme.php 
 * @author linea21 <info@linea21.com>  
 * @license http://opensource.org/licenses/gpl-3.0.html  
   * theme::CheckDataIntegrity()  
   * Vérification des données d'un thème  
   * @param array $table_theme : contient les composants d'un thème  
   * @return boolean si vrai renvoie true sinon message d'erreurs (string)  
    if (strlen($table_theme[0]) <  2) return _t('theme','object_notdenomination');  
      if (!is_numeric($table_theme[2]) ||  $table_theme[2] == - 1) return _t('theme','object_notSDtheme');  
      if (defined('MOD_PROJECT') &&  strlen($table_theme[3]) <  2) return _t('theme','object_notdesc_completed');  
      if (defined('MOD_SDI') &&  strlen($table_theme[4]) <  2) return _t('theme','object_notdesc_completed');  
      if (defined('MOD_PUBLICATION') &&  strlen($table_theme[5]) <  2) return _t('theme','object_notdesc_completed');  
      if (defined('MOD_NEWS') &&  strlen($table_theme[6]) <  2) return _t('theme','object_notdesc_completed');  
      if (defined('MOD_WORKSHOP') &&  strlen($table_theme[7]) <  2) return _t('theme','object_notdesc_completed');  
   * Ajout d'un nouveau theme  
   * @param array $table_theme : contient les composants d'un theme  
   * @param object $sql_object   
   * @return integer $last_id  
  function AddTheme($table_theme, $sql_object)  
    $table_theme= $sql_object->DBescape($table_theme);  
    if ($table_theme[14] ==  1) $this->SetRoot();  
    if ($table_theme[0] !=  '') {  
    if ($table_theme[1] !=  '') {  
    if ($table_theme[13] !=  '') {  
      switch ($table_theme[13]) {  
          $this->STATUT =  $table_theme[13];  
          $this->STATUT =  $table_theme[13];  
                " (sdtheme_name, sdtheme_description, sdtheme_date_crea) " .   
             " (theme_name, theme_visual_uri, theme_sd_theme, theme_desc_project, theme_desc_dashboard, " .    
             "theme_desc_publication, theme_desc_news, theme_desc_workshop, theme_range_project, ".    
             "theme_range_dashboard, theme_range_publication, theme_range_news, theme_range_workshop, " .   
             "theme_statut, theme_date_crea) " .    
    $last_id =  $sql_object->DBInsert ($query, 1);  
   * modification d'un theme  
   * @param int $ID : identifiant du theme  
   * @param array $table_theme : contient les composants d'un theme  
   * @param object $sql_object   
    $table_theme= $sql_object->DBescape($table_theme);  
    if ($table_theme[9] ==  1) $this->SetRoot();  
    if ($table_theme[0] !=  '') {  
    if ($table_theme[1] !=  '') {  
    if ($table_theme[8] !=  '') {  
      switch ($table_theme[8]) {  
          $this->STATUT =  $table_theme[8];  
          $this->STATUT =  $table_theme[8];  
      $query =  "UPDATE  " .  $this->TDB_SDTHEME .  " set sdtheme_name='" .  $this->NAME .  "', sdtheme_description='" .  $this->DESC_PROJECT .  "', sdtheme_last_modify=NOW() WHERE sdtheme_id='" .  $this->ID .  "';";  
      $query =  "UPDATE  " .  $this->TDB_THEME .  " set theme_name='" .  $this->NAME .  "', theme_visual_uri='" .  $this->VISUAL_URI .  "' , theme_sd_theme='" .  $this->SD_THEME .  "', theme_desc_project='" .  $this->DESC_PROJECT .  "', theme_desc_dashboard='" .  $this->DESC_DASHBOARD .  "',theme_desc_publication= '" .  $this->DESC_PUBLICATION .  "', theme_desc_news='" .  $this->DESC_NEWS .  "' , theme_desc_workshop='" .  $this->DESC_WORKSHOP .  "' , theme_statut='" .  $this->STATUT .  "', theme_last_modify=NOW() WHERE theme_id='" .  $this->ID .  "';";  
    $result =  $sql_object->DBQuery($query);  
   * modification du statut d'un theme  
   *     -- NE PREND PAS EN CHARGE l'EFFACEMENT --  
   * @param int $ID identifiant de l'entreprise  
   * @param string $state (facultatif) 'P' Public/'D' Draft  
   * @param object $sql_object   
    $query =  "UPDATE  " .  $this->TDB_THEME .  " set theme_statut='" .  $this->STATUT .  "', theme_last_modify=NOW() WHERE theme_id=" .  $this->ID .  ";";  
    $result =  $sql_object->DBQuery($query);  
   * @param int $ID identifiant du theme  
   * @param string $type 'MASS_DELETE' toutes les ressources associées aus themes sont rendues inactives  
   *  'MASS_MODIFY' remplacement de l'ancien theme par $ID_new  
   * @param int $id_new nouvel id de rattachement  
   * @param object $sql_object   
  function DeleteTheme($ID, $sql_object, $type, $ID_new = - 1)  
      $query =  "UPDATE  " .  $this->TDB_THEME .  " set theme_sd_theme=" .  $ID_new .  " WHERE  theme_sd_theme=" .  $this->ID .  ";";  
      $result =  $sql_object->DBQuery($query);  
      $affected +=  $sql_object->DBaffectedRow();  
      $query =  "DELETE FROM  " .  $this->TDB_SDTHEME .  " where sdtheme_id='". $this->ID . "';";  
      $result =  $sql_object->DBQuery($query);  
    if($this->isRoot() ==  false) {  
      if ($type ==  'MASS_MODIFY') {  
          $query =  "UPDATE  " .  $this->TDB_THEME .  " set theme_statut='E', theme_last_modify=NOW() WHERE theme_id=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query);  
            $query_news =  "UPDATE  " .  T_NEWS .  " set news_theme=" .  $ID_new .  " WHERE  news_theme=" .  $this->ID .  ";";  
            $result =  $sql_object->DBQuery($query_news);  
            $affected +=  $sql_object->DBaffectedRow();  
            $query_publication =  "UPDATE  " .  T_PUBLI .  " set publi_theme=" .  $ID_new .  " WHERE  publi_theme=" .  $this->ID .  ";";  
            $result =  $sql_object->DBQuery($query_publication);  
            $affected +=  $sql_object->DBaffectedRow();  
            $query_workshop =  "UPDATE  " .  T_WORK .  " set workshop_theme=" .  $ID_new .  " WHERE  workshop_theme=" .  $this->ID .  ";";  
            $result =  $sql_object->DBQuery($query_workshop);  
            $affected +=  $sql_object->DBaffectedRow();  
            $query_sdiinfo =  "UPDATE  " .  T_SDI_INFO .  " set sdii_theme=" .  $ID_new .  " WHERE  sdii_theme=" .  $this->ID .  ";";  
            $result =  $sql_object->DBQuery($query_workshop);  
            $affected +=  $sql_object->DBaffectedRow();  
            $query_yellowpages =  "UPDATE  " .  T_YELLOWPAGES .  " set yellowp_theme=" .  $ID_new .  " WHERE  yellowp_theme=" .  $this->ID .  ";";  
            $result =  $sql_object->DBQuery($query_yellowpages);  
            $affected +=  $sql_object->DBaffectedRow();  
      if ($type ==  'MASS_DELETE') {  
        $query =  "UPDATE  " .  $this->TDB_THEME .  " SET theme_statut='E', theme_last_modify=NOW() WHERE theme_id=" .  $this->ID .  ";";  
        $result =  $sql_object->DBQuery($query);  
          $query_news =  "UPDATE  " .  T_NEWS .  " SET news_statut='E' WHERE  news_theme=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_news);  
          $affected +=  $sql_object->DBaffectedRow();  
          $query_publication =  "UPDATE  " .  T_PUBLI .  " SET publi_statut='E' WHERE  publi_theme=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_publication);  
          $affected +=  $sql_object->DBaffectedRow();  
          $query_workshop =  "UPDATE  " .  T_WORK .  " SET workshop_statut='E' WHERE  workshop_theme=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_workshop);  
          $affected +=  $sql_object->DBaffectedRow();  
          $query_sdiinfo =  "UPDATE " .  T_SDI_INFO .  " SET sdii_statut='E' WHERE  sdii_theme=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_sdiinfo);  
          $affected +=  $sql_object->DBaffectedRow();  
          $query_sdivalue =  "UPDATE " .  T_SDI_VALUE .  " SET sdiv_statut='E' WHERE sdiv_sdi_info=".  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_sdivalue);  
          $affected +=  $sql_object->DBaffectedRow();  
          $query_yellowpages =  "UPDATE  " .  T_YELLOWPAGES .  " SET yellowp_statut='AA' WHERE  yellowp_theme=" .  $this->ID .  ";";  
          $result =  $sql_object->DBQuery($query_yellowpages);  
          $affected +=  $sql_object->DBaffectedRow();  
   * Set the ROOT attribute to 1  
   * Is the current theme root?  
   * modification des RANGE des themes  
   *   --- NON IMPLEMENTE/NON TESTE ---  
   * @param string $module spécifie le module concernée : valeur 'DASHBOARD', 'PUBLICATION', 'NEWS', 'WORKSHOP', 'ALL'  
   * @param array $table_range tableau contenant les id des themes  
   * @param object $sql_object   
   * function SetThemeRange($table_range, $sql_object, $module)  
   * if (count($table_range) > 0) {  
   * if (strlen($module) > 2) {  
   * if ($module != 'ALL') {  
   * $champ = 'theme_range_';  
   * if ($module == 'DASHBOARD') $champ .= 'dashboard';  
   * if ($module == 'PUBLICATION') $champ .= 'publication';  
   * if ($module == 'NEWS') $champ .= 'news';  
   * if ($module == 'WORKSHOP') $champ .= 'workshop';  
   * for($i = 0; $i < count($table_range); $i++) {  
   * $query = "UPDATE  " . $this->TDB_THEME . " SET " . $champ . "=" . $range . " WHERE theme_id='" . $table_range[$i] . "';";  
   * $result = $sql_object->DBQuery($query);  
   * } elseif ($module == 'ALL') {  
   * for($i = 0; $i < count($table_range); $i++) {  
   * $to_update = "theme_range_dashboard=" . $range . ", theme_range_publication=" . $range . ", theme_range_news=" . $range . ", theme_range_workshop=" . $range;  
   * $query = "UPDATE  " . $this->TDB_THEME . " SET " . $to_update . " WHERE theme_id=" . $table_range[$i] . ";";  
   * $result = $sql_object->DBQuery($query);  
 
 
        
       |