Source for file pgsql.inc.php
Documentation is available at pgsql.inc.php 
 * @package linea21.modules  
 * @subpackage publication  
 * @author linea21 <info@linea21.com>  
 * @license http://opensource.org/licenses/gpl-3.0.html  
//////////// Check Inclusion de pages ////////////  
    include_once("../lib/lib_common.php");  
$req_list_theme =  "SELECT T.theme_id, T.theme_name, T.theme_statut, SDT.sdtheme_name, SDT.sdtheme_id FROM " .  T_THEME .  " AS T LEFT OUTER JOIN ".  T_SD_THEME . " AS SDT ON SDT.sdtheme_id=T.theme_sd_theme WHERE T.theme_statut  <> 'E' ORDER BY sdtheme_name DESC, theme_name ASC;";  
$req_list_level =  "SELECT level_id, level_name FROM " .  T_LEVEL.  " WHERE level_statut<>'E' ORDER BY level_range DESC;";  
$req_list_scale =  "SELECT scale_id, scale_denomination FROM " .  T_SCALE .  " WHERE scale_statut='P' OR scale_statut='D' ORDER BY scale_denomination ASC;";  
$req_quickbox_add =  "SELECT publi_id, substring(publi_title from 0 for 50) as publi_title, to_char(publi_date_crea, '". toStringSqlDate('long'). "') AS publi_date_crea_display FROM " .  T_PUBLI .  " WHERE publi_statut  = 'P' OR publi_statut = 'D'  ORDER BY publi_date_crea DESC LIMIT 10 OFFSET 0;";  
$req_quickbox_sup =  "SELECT publi_id,  substring(publi_title from 0 for 50) as publi_title, to_char(publi_last_modify, '". toStringSqlDate('long'). "') AS publi_last_modify_display, to_char(publi_date_crea, '". toStringSqlDate(). "') AS publi_date_crea_display FROM " .  T_PUBLI .  " WHERE publi_statut = 'E' ORDER BY publi_last_modify DESC LIMIT 10 OFFSET 0;";  
$req_quickbox_mod =  "SELECT publi_id, substring(publi_title from 0 for 50) as publi_title, to_char(publi_last_modify, '". toStringSqlDate('long'). "') AS publi_last_modify_display, to_char(publi_date_crea, '". toStringSqlDate(). "') AS publi_date_crea_display FROM " .  T_PUBLI .  " WHERE publi_statut  <> 'E' ORDER BY publi_last_modify DESC LIMIT 10 OFFSET 0;";  
$req_quickbox_list =  "SELECT publi_id,  substring(publi_title from 0 for 50) as publi_title, to_char(publi_published_date, '". toStringSqlDate('long'). "') AS publi_published_date_display, to_char(publi_date_crea, '". toStringSqlDate(). "') AS publi_date_crea_display FROM " .  T_PUBLI .  " WHERE publi_statut <> 'E' AND  publi_published_date <> '0001-01-01' ORDER BY publi_published_date DESC LIMIT 10 OFFSET 0;";  
            $mask= " WHERE publi_statut = 'P'";  
            $orderby= "publi_published_date DESC";  
            $mask= " WHERE publi_statut = 'D'";  
            $orderby= "publi_date_crea DESC";  
            $mask= " WHERE publi_statut = 'AA'";  
            $orderby= "publi_last_modify DESC";  
            $mask= " WHERE publi_statut = 'PA'";  
            $orderby= "publi_last_modify DESC";  
            $mask= " WHERE publi_statut <> 'E'";  
            $orderby= "publi_date_crea DESC";  
            $mask.= " AND theme_sd_theme = '". $id_filter. "'";  
            $mask.= " AND publi_scale = '". $id_filter. "'";  
            $mask.= " AND publi_level = '". $id_filter. "'";  
    $requete=     "SELECT U.user_login, P.publi_id, substring(P.publi_title from 0 for 60) AS publi_title, ".   
                "P.publi_title AS complete_publi_title, P.publi_statut, ".   
                "publi_resume, publi_level, publi_scale, publi_statut, SDT.sdtheme_id, SDT.sdtheme_name, ".   
                  "scale_denomination, level_name, publi_posted_by, ".   
                "to_char(P.publi_date_crea, '". toStringSqlDate(). "') AS publi_date_crea_display, ".   
                  "to_char(P.publi_published_date, '". toStringSqlDate(). "') AS publi_published_date_display, ".   
                  "to_char(P.publi_last_modify, '". toStringSqlDate(). "') AS publi_last_modify_display ".   
                "FROM " .  T_PUBLI. " AS P ".   
                "LEFT OUTER JOIN ". T_THEME. " AS T on P.publi_theme=T.theme_id ".   
                "LEFT OUTER JOIN ". T_SD_THEME. " AS SDT on T.theme_sd_theme=SDT.sdtheme_id ".   
                "LEFT OUTER JOIN ". T_SCALE. " AS S on publi_scale=S.scale_id ".   
                "LEFT OUTER JOIN ". T_LEVEL. " AS L on publi_level=L.level_id ".   
                 "LEFT OUTER JOIN ". T_USER. " AS U on P.publi_posted_by=U.user_id ".   
                $mask. " ORDER BY ". $orderby. " OFFSET ". $debut. " LIMIT ". $limite. ";";  
            $mask= " WHERE publi_statut = 'P'";  
            $mask= " WHERE publi_statut = 'D'";  
            $mask= " WHERE publi_statut = 'AA'";  
            $mask= " WHERE publi_statut = 'PA'";  
            $mask= " WHERE publi_statut <> 'E'";  
            $mask.= " AND theme_sd_theme = '". $id_filter. "'";  
            $mask.= " AND publi_scale = '". $id_filter. "'";  
            $mask.= " AND publi_level = '". $id_filter. "'";  
    $requete=  "SELECT COUNT(publi_id) AS num_rows FROM " .  T_PUBLI . " ";  
        $requete.=     "LEFT OUTER JOIN ". T_THEME. " AS T on publi_theme=T.theme_id ".   
                    "LEFT OUTER JOIN ". T_SD_THEME. " AS SDT on theme_sd_theme=SDT.sdtheme_id ";  
    $requete =     "SELECT P.publi_title, P.publi_resume, P.publi_theme, P.publi_scale, P.publi_level, P.publi_posted_by, P.publi_comment, P.publi_statut, ".   
                "T.theme_name, S.scale_denomination, L.level_name, U.user_login, T.theme_sd_theme, SDT.sdtheme_name, ".   
                "to_char(P.publi_date_crea, '". toStringSqlDate(). "') AS publi_date_crea_display, ".   
                "to_char(P.publi_last_modify, '". toStringSqlDate('long'). "') AS publi_last_modify_display, ".   
                "to_char(P.publi_published_date, '". toStringSqlDate(). "') AS publi_published_date_display ".   
                "FROM " .  T_PUBLI .  " AS  P ".   
                "LEFT OUTER JOIN ". T_THEME. " AS T on P.publi_theme=T.theme_id ".   
                "LEFT OUTER JOIN ". T_SD_THEME. " AS SDT on T.theme_sd_theme=SDT.sdtheme_id ".   
                "LEFT OUTER JOIN ". T_SCALE. " AS S on P.publi_scale=S.scale_id ".   
                "LEFT OUTER JOIN ". T_LEVEL. " AS L on P.publi_level=L.level_id ".   
                "LEFT OUTER JOIN ". T_USER. " AS U on P.publi_posted_by=U.user_id ".   
                "WHERE publi_id='". $publi_id. "' AND publi_statut<>'E';";  
    $requete =     "SELECT PC.publicon_id, PC.publicon_title FROM " .  J_PARTS . " AS JP ".   
                "LEFT OUTER JOIN ". T_PUBLI_CONT. " AS PC ON  JP.j_parts_id=PC.publicon_id ".   
                "WHERE  JP.j_root_id='". $publi_id. "' AND JP.j_type='P' AND publicon_validity='Y' ORDER BY PC.publicon_date_crea ASC;";  
    $requete =     "SELECT publi_title, publi_posted_by FROM " .  T_PUBLI .  " WHERE publi_id='". $publi_id. "';";  
    $requete = "SELECT theme_name FROM " .  T_THEME .  " WHERE theme_id='". $theme_id. "';";  
    $requete= "SELECT scale_denomination FROM " .  T_SCALE .  " WHERE scale_id='". $scale_id. "';";  
    $requete= "SELECT level_name FROM " .  T_LEVEL .  " WHERE level_id='". $level_id. "';";  
// Copie conforme de celle qui se trouve dans workshoprep  
            $ACTIVE_TABLE =  T_BIBLIO_RES;  
            $join_active= "bibliores";  
            $ACTIVE_TABLE =  T_LINK_RES;  
            $ACTIVE_TABLE =  T_MULTI_RES;  
        $requete =  "SELECT * FROM " .  $ACTIVE_TABLE .  " LEFT OUTER JOIN ". $TDB_LIAISON. " ON ". $champ2. "=". $join_active. "_id WHERE j_root_id='". $ID. "' AND j_type='". substr($type, 0, 1). "' AND ". $join_active. "_validity='Y' ORDER BY ". $join_active. "_date_crea ASC;";  
        $result =  $sql_object -> DBSelect ($requete);  
 
 
        
       |