[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/include/bd/sqlite/ -> articlelistdata_sqlite.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  // SQLite implementation for ArticleListData
  20  //
  21  
  22  if (defined("_BD_ARTICLELISTDATASQLITE"))
  23      return;
  24  
  25  define("_BD_ARTICLELISTDATASQLITE", "1");
  26  
  27  require_once dirname(__FILE__). "/../articlelistdata.php";
  28  require_once dirname(__FILE__). "/../inc_listdata_querytypes_constants.php";
  29  /**
  30   * BD_article_sqlite is an implementation for sqlite of BD_article business class.
  31   * @package    BD_sqlite
  32   * @author     Olivier Mansour
  33   * @access    public
  34   */
  35  class BD_articleListData_sqlite extends BD_articleListData {
  36  
  37      // {{{ _getArticleAuthors($articleId)
  38  
  39      /**
  40       * returns a formatted HTML String representing the article authors
  41       * This method should be overloaded whenever the SQL request would not
  42       * be compatible with de DB engine used.
  43       * this method is "protected"
  44       * @return String
  45       * @param int $articleId representing the article id
  46       * @access private
  47       */
  48  
  49  	function _getArticleAuthors ($articleId) {
  50          global $connect_id_auteur, $connect_statut;
  51  
  52          $returnValue = "";
  53  
  54          $db = &$this->_getDB();
  55  
  56          if (DB::isError($db)) {
  57              die($db->getMessage());
  58          }
  59  
  60          $query
  61              = "SELECT auteurs.id_auteur AS id_auteur, nom, messagerie, login, en_ligne " . "FROM " . $GLOBALS['table_prefix']. "_auteurs auteurs, " . $GLOBALS['table_prefix']. "_auteurs_articles lien " . "WHERE lien.id_article=$articleId AND auteurs.id_auteur=lien.id_auteur";
  62  
  63          $result = $db->query($query);
  64  
  65          if (DB::isError($result)) {
  66              die($result->getMessage());
  67          }
  68  
  69          while ($row = $result->fetchRow()) {
  70              $id_auteur = $row['id_auteur'];
  71              $nom_auteur = typo($row['nom']);
  72              $auteur_messagerie = $row['messagerie'];
  73  
  74              $returnValue .= ", $nom_auteur";
  75              if ($id_auteur != $connect_id_auteur AND $auteur_messagerie != "non" AND $activer_messagerie != "non") {
  76                  $returnValue .= "&nbsp;" . bouton_imessage($id_auteur, $row);
  77              }
  78          }
  79  
  80          $returnValue = substr($returnValue, 2);
  81          $result->free();
  82          return $returnValue;
  83      }
  84  
  85      // }}}
  86  
  87      // {{{ _fillQueries()
  88  
  89      /**
  90       * This methods fill the query associative arrays with SQL 92 compliant
  91       * queries. Each driver that requires specific SQL querying must implement
  92       * the _adaptQueriesToDriver() method.
  93       * @access  private
  94       * @see     _adaptQueriesToDriver()
  95       */
  96  	function _fillQueries () {
  97          $this->_queries[ARTICLES_ALL_BY_STATE]
  98              = "SELECT id_article, titre, id_rubrique, statut, date_heure " . "FROM spip_articles WHERE id_rubrique=? AND " . "statut IN (!) ORDER BY date_heure DESC";
  99          $this->_queriesCount[ARTICLES_ALL_BY_STATE]
 100              = "SELECT COUNT(id_article) " . "FROM spip_articles WHERE id_rubrique=? AND " . "statut IN (!)";
 101  
 102          $this->_queries[ARTICLES_BY_STATE]
 103              = "SELECT articles.id_article AS id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles articles, spip_auteurs_articles lien " . "WHERE articles.id_article=lien.id_article AND lien.id_auteur=? AND articles.statut=? ORDER BY articles.date_heure DESC";
 104          $this->_queriesCount[ARTICLES_BY_STATE]
 105              = "SELECT count(articles.id_article) " . "FROM spip_articles articles, spip_auteurs_articles lien " . "WHERE articles.id_article=lien.id_article AND lien.id_auteur=? AND articles.statut=?";
 106  
 107          $this->_queries[ARTICLES_BY_AUTHOR]
 108              = "SELECT article.id_article AS id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles article, spip_auteurs_articles lien WHERE lien.id_auteur=? " . "AND lien.id_article=article.id_article AND article.statut IN (!) ORDER BY article.date_heure DESC";
 109          $this->_queriesCount[ARTICLES_BY_AUTHOR]
 110              = "SELECT COUNT(article.id_article) " . "FROM spip_articles article, spip_auteurs_articles lien WHERE lien.id_auteur=? " . "AND lien.id_article=article.id_article AND article.statut IN (!)";
 111  
 112          $this->_queries[ARTICLES_TOCOME]
 113              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut='publie' AND date_heure><!spipNOW_DATE_FORMAT_ISOspip!> ORDER BY date_heure";
 114          $this->_queriesCount[ARTICLES_TOCOME]
 115              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut='publie' AND date_heure><!spipNOW_DATE_FORMAT_ISOspip!>";
 116  
 117          $this->_queries[ARTICLES_PROPOSED]
 118              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut LIKE 'prop' ORDER BY date_heure DESC";
 119          $this->_queriesCount[ARTICLES_PROPOSED]
 120              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut LIKE 'prop'";
 121  
 122          $this->_queries[ARTICLES_PROPOSED_FILTERED]
 123              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut LIKE 'prop' AND id_article NOT IN (!) ORDER BY date_heure DESC";
 124          $this->_queriesCount[ARTICLES_PROPOSED_FILTERED]
 125              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut LIKE 'prop' AND id_article NOT IN (!)";
 126  
 127          $this->_queries[ARTICLES_BY_KEYWORD]
 128              = "SELECT article.* FROM spip_articles article, spip_mots_articles lien WHERE lien.id_mot=? " . "AND lien.id_article=article.id_article AND article.statut IN (!) ORDER BY article.date_heure DESC";
 129          $this->_queriesCount[ARTICLES_BY_KEYWORD]
 130              = "SELECT count(article.id_article) FROM spip_articles article, spip_mots_articles lien WHERE lien.id_mot=? " . "AND lien.id_article=article.id_article AND article.statut IN (!)";
 131  
 132          $this->_queries[ARTICLES_BY_AUTHOR_STATE_AND_RUBRIQUE]
 133              = "SELECT articles.id_article AS id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles articles, spip_auteurs_articles lien " . "WHERE articles.id_article=lien.id_article AND id_rubrique=? " . "AND lien.id_auteur=? AND articles.statut=? ORDER BY articles.date_heure DESC";
 134          $this->_queriesCount[ARTICLES_BY_AUTHOR_STATE_AND_RUBRIQUE]
 135              = "SELECT count(articles.id_article) " . "FROM spip_articles articles, spip_auteurs_articles lien " . "WHERE articles.id_article=lien.id_article AND id_rubrique=? " . "AND lien.id_auteur=? AND articles.statut=?";
 136          $this->_queries[ARTICLES_BY_STATE_AND_RUBRIQUE]
 137              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut=? AND id_rubrique=? ORDER BY date_heure DESC";
 138          $this->_queriesCount[ARTICLES_BY_STATE_AND_RUBRIQUE]
 139              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut=? AND id_rubrique=?";
 140  
 141          $this->_queries[ARTICLES_RECHERCHE]
 142              = "SELECT spip_articles.id_article AS id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE <!spipARTICLE_CONSTRUCTION_RECHERCHEspip!> ORDER BY maj DESC";
 143          $this->_queriesCount[ARTICLES_RECHERCHE]
 144              = "SELECT count(id_article) " . "FROM spip_articles WHERE  <!spipARTICLE_CONSTRUCTION_RECHERCHEspip!>";
 145  
 146          /*
 147          $this->_queries[ARTICLES_RECHERCHE_INT] = "SELECT objet.*, SUM(idx.points) AS points ".
 148                                                      "FROM spip_articles objet, spip_index_articles idx ".
 149                                                      "WHERE objet.id_article = idx.id_article AND idx.hash IN (!) AND objet.id_article NOT IN (!) GROUP BY objet.id_article ORDER BY points DESC ";
 150          */
 151          $this->_queries[ARTICLES_RECHERCHE_INT]
 152              = "SELECT objet.id_article AS id_article, objet.titre AS titre, objet.date_heure AS date_heure, objet.statut AS status, SUM(idx.points) AS points " . "FROM spip_articles objet, spip_index_articles idx " . "WHERE objet.id_article = idx.id_article AND idx.hash IN (!) AND objet.id_article NOT IN (!) GROUP BY objet.id_article, objet.titre, objet.date_heure, objet.statut ORDER BY points DESC ";
 153  
 154          $this->_queriesCount[ARTICLES_RECHERCHE_INT]
 155              = "SELECT COUNT(*) " . "FROM spip_articles objet, spip_index_articles idx " . "WHERE objet.id_article = idx.id_article AND idx.hash IN (!) AND objet.id_article NOT IN (!)";
 156          $this->_queries[ARTICLES_ALL_BY_STATE_NOT_SELECTED]
 157              = "SELECT id_article, titre, id_rubrique, statut, date_heure " . "FROM spip_articles WHERE id_rubrique=? AND " . "statut IN (!) AND id_article NOT IN(!) ORDER BY date_heure DESC";
 158  
 159          $this->_queriesCount[ARTICLES_ALL_BY_STATE_NOT_SELECTED]
 160              = "SELECT COUNT(id_article) " . "FROM spip_articles WHERE id_rubrique=? AND " . "statut IN (!) AND id_article NOT IN(!)";
 161  
 162          $this->_queries[ARTICLES_FORUM_MESSAGE]
 163              = "SELECT DISTINCT spip_articles.id_article AS id_article, spip_articles.surtitre AS surtitre, spip_articles.titre AS titre, spip_articles.id_rubrique AS id_rubrique, spip_articles.date_heure AS date_heure, spip_articles.statut AS status FROM spip_articles, spip_forum WHERE ( (spip_articles.id_article = spip_forum.id_article) ) ORDER BY spip_articles.date_heure";
 164  
 165          //$this->_queriesCount[ARTICLES_FORUM_MESSAGE] = "SELECT count(DISTINCT(spip_forum.id_article)) FROM spip_articles, spip_forum WHERE spip_forum.id_article=spip_articles.id_article GROUP BY spip_forum.id_article";
 166          $this->_queriesCount[ARTICLES_FORUM_MESSAGE]
 167              = "SELECT count(id_article) FROM (SELECT DISTINCT spip_forum.id_article AS id_article FROM spip_articles, spip_forum WHERE spip_forum.id_article=spip_articles.id_article GROUP BY spip_forum.id_article)";
 168  
 169          $this->_queries[ARTICLES_VALIDED]
 170              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut='valid' ORDER BY date_heure DESC";
 171          $this->_queriesCount[ARTICLES_VALIDED]
 172              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut='valid'";
 173  
 174          $this->_queries[ARTICLES_VALIDED_FILTERED]
 175              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles WHERE statut='valid' AND id_article NOT IN (!) ORDER BY date_heure DESC";
 176          $this->_queriesCount[ARTICLES_VALIDED_FILTERED]
 177              = "SELECT count(id_article) " . "FROM spip_articles WHERE statut='valid' AND id_article NOT IN (!)";
 178  
 179          $this->_queries[ARTICLES_IN_NL]
 180              = "SELECT id_article, surtitre, titre, soustitre, descriptif, chapo, date_heure, visites, id_rubrique, statut " . "FROM spip_articles, spip_cm_posts_articles WHERE spip_cm_posts_articles.article_id = spip_articles.id_article AND id_article IN (!) AND pst_id =? ORDER BY art_order ASC";
 181  
 182          $this->_queriesCount[ARTICLES_IN_NL]
 183              = "SELECT count(id_article) " . "FROM spip_articles, spip_cm_posts_articles WHERE spip_cm_posts_articles.article_id = spip_articles.id_article AND id_article IN (!) AND pst_id =?";
 184      }
 185  
 186  // }}}
 187  }
 188  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7