linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file mysql.inc.php

Documentation is available at mysql.inc.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage public
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. function SQLget_WorkshopList($nb) {
  12.   $query =     "SELECT W.* FROM ".T_WORK. " W WHERE workshop_statut='P';";
  13.   return $query;
  14. }
  15.  
  16. function SQLget_pastEvents($nb) {
  17.   $query =     "SELECT DATE_FORMAT(workcal_task_date, '".toStringSqlDate()."') AS task_date, workcal_id, workcal_task, workcal_workshop_id,
  18.                 workshop_denomination
  19.                 FROM ".T_WORK_CAL ."
  20.                 LEFT OUTER JOIN  ".T_WORK. " on workcal_workshop_id=workshop_id
  21.                 WHERE workcal_task_date < NOW() ORDER BY workcal_task_date DESC";
  22.  
  23.   return $query;
  24. }
  25.  
  26. function SQLget_incomingEvents($nb) {
  27.   $query =     "SELECT DATE_FORMAT(workcal_task_date, '".toStringSqlDate()."') AS task_date, workcal_id, workcal_task, workcal_workshop_id,
  28.                 workshop_denomination
  29.                 FROM ".T_WORK_CAL ."
  30.                 LEFT OUTER JOIN  ".T_WORK. " on workcal_workshop_id=workshop_id
  31.                 WHERE workcal_task_date >= NOW() ORDER BY workcal_task_date ASC";
  32.  
  33.   return $query;
  34. }
  35.  
  36. function SQL_Get_UserWorkshop($login, $pass) {
  37.   $query = "SELECT user_id ,  jwu_workshop_id FROM " . T_USER . " As U LEFT OUTER JOIN " . J_WORK_USERS . " As W ON U.user_id=W.jwu_user_id WHERE lower(user_login) = '".strtolower($login)."' AND user_password='".$pass."' AND user_validity='Y';";
  38.   return $query;
  39. }
  40.  
  41. function SQL_Get_WorkshopsNames($array = array()) {
  42.  
  43.   $str='';
  44.   $sep='';
  45.   if(empty($array)) $str = '1 = 1';
  46.   else {
  47.     foreach($array as $v) {
  48.       $str .= $sep. 'workshop_id='.$v;
  49.       $sep = ' OR ';
  50.     }
  51.   }
  52.   $query = "SELECT workshop_denomination, workshop_id FROM ". T_WORK ." WHERE (". $str .") AND workshop_statut='P' ORDER BY workshop_denomination ASC";
  53.  
  54.   return $query;
  55. }
  56.  
  57. function SQL_Get_NewsBoard($nb) {
  58.   $query= "SELECT news_id, news_title, DATE_FORMAT(news_published_date, '".toStringSqlDate('long')."') AS news_published_date_display FROM " . T_NEWS . " WHERE news_statut = 'P' ORDER BY news_published_date DESC LIMIT 0, ".$nb.";";
  59.  
  60.   return $query;
  61. }
  62. function SQL_Get_SdiBoard() {
  63.  
  64.   $query= "SELECT DISTINCT I.sdii_name, sdiv_id, sdii_id, sdiv_scale, sdiv_date_crea, MAX(sdiv_date_crea) AS date_c_max
  65.             FROM " . T_SDI_INFO . " as I LEFT OUTER JOIN " . T_SDI_VALUE . " as V ON I.sdii_id=V.sdiv_sdi_info
  66.             WHERE sdiv_statut='P' AND sdii_statut='P' GROUP BY I.sdii_name, sdiv_scale ORDER BY date_c_max DESC;";
  67.   //sdiv_sdi_info,,  sdiv_scale
  68.   return $query;
  69. }
  70. function SQL_Get_FilterTheme() {
  71.   $query = "SELECT * FROM " . T_SD_THEME . " ORDER BY sdtheme_range, sdtheme_id;";
  72.   return $query;
  73. }
  74.  
  75. function SQL_Get_FilterPriority() {
  76.   $query = "SELECT * FROM " . T_PRIORITY . " ORDER BY priority_id;";
  77.   return $query;
  78. }
  79.  
  80. function SQL_Get_FilterScale($mask=-1) {
  81.   if ($mask<>-1) $mask="OR scale_statut='I'";
  82.   else $mask="";
  83.   $query= "SELECT * FROM " . T_SCALE . " WHERE scale_statut='P' ".$mask." ORDER BY scale_dependencies ASC, scale_denomination ASC;";
  84.   return $query;
  85. }
  86. function SQL_Get_FilterLevel() {
  87.   $query = "SELECT * FROM " . T_LEVEL . " WHERE level_statut='P' ORDER BY level_range DESC;";
  88.   return $query;
  89. }
  90.  
  91. function SQL_Get_LastPublications($nb) {
  92.   $query = "SELECT publi_id, publi_title, publi_resume  FROM  " . T_PUBLI . " WHERE publi_statut = 'P' ORDER BY publi_published_date DESC LIMIT 0, ".$nb.";";
  93.   return $query;
  94. }
  95.  
  96. function SQL_getRSSformatedNews() {
  97.   $query =     "SELECT news_id, news_title, CONCAT(LEFT(CONCAT(news_header, ' ', news_body),247), '...') AS news_description, theme_name, ".
  98.                 "DATE_FORMAT(news_published_date, '%Y-%m-%d\\T%H:%i:%s+00:00') AS news_published_date_display, ".
  99.                 "DATE_FORMAT(news_date_crea, '".toStringSqlDate()."') AS news_date_crea_display, user_login ".
  100.                 "FROM " . T_NEWS . " ".
  101.                 "LEFT OUTER JOIN " . T_THEME. " ON news_theme=theme_id ".
  102.                 "LEFT OUTER JOIN " . T_USER. " ON news_posted_by=user_id ".
  103.                 " WHERE news_statut='P' ".
  104.                 "ORDER BY news_published_date DESC LIMIT 0 , 15;";
  105.   return $query;
  106. }
  107.  
  108.   $query =     "SELECT news_id, news_title, news_header, news_body, ".
  109.                 "DATE_FORMAT(news_published_date, '%Y-%m-%d\\T%H:%i:%s+00:00') AS news_published_date_display,".
  110.                 "DATE_FORMAT(news_date_crea, '".toStringSqlDate()."') AS news_date_crea_display, user_login, theme_name ".
  111.                 "FROM " . T_NEWS . " ".
  112.                 "LEFT OUTER JOIN " . T_THEME. " ON news_theme=theme_id ".
  113.                 "LEFT OUTER JOIN " . T_USER. " ON news_posted_by=user_id ".
  114.                 "WHERE news_statut <> 'E' ".
  115.                 "AND news_published_date <> '0001-01-01' ".
  116.                 "ORDER BY news_published_date DESC LIMIT 0 , 15;";
  117.  
  118.   return $query;
  119. }
  120.  
  121.  
  122. ?>

Documentation generated on Fri, 01 Apr 2011 09:33:26 +0200 by phpDocumentor 1.4.1