[ 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/ -> rubrique_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  // Base class for Rubrique business persistence abstraction.
  20  //
  21  require_once dirname(__FILE__). "/../rubrique.php";
  22  
  23  require_once dirname(__FILE__). "/SQLite_functions.php";
  24  
  25  /**
  26   * BD_rubrique_sqlite is an implementation for SQLite of BD_rubrique business class.
  27   * @package    BD_sqlite
  28   * @author     Olivier Mansour
  29   * @access    public
  30   */
  31  class BD_rubrique_sqlite extends BD_rubrique {
  32  
  33      // {{{ getAllForParentId($leparent, $critere)
  34  
  35      /**
  36       * Returns an array of Rubrique depending
  37       * on $leparent order by $order.
  38       *
  39       *
  40       * @return Array of Rubrique
  41       * @param $leparent
  42       * @param $critere
  43       * @access public
  44       */
  45  
  46      function &getAllForParentId ($leparent, $critere = null) {
  47          $result = array();
  48          $db = &$this->_getDB();
  49  
  50          if (DB::isError($db)) {
  51              return PEAR::raiseError("[" . get_class($this). " DB_rubrique : getAllForParentId()] " . $db->getMessage(). "", null, null, null, null, null, false);
  52          }
  53  
  54          $query = "SELECT " . RUBRIQUE_ALL_FIELDS . " FROM spip_rubriques WHERE id_parent=$leparent";
  55  
  56          if ($critere != null)
  57              $query .= " ORDER BY $critere";
  58  
  59          //echo "$query<br>";
  60  
  61          $query = $this->_traiteQuery($query);
  62          $queryResult = $db->query($query);
  63  
  64          if (DB::isError($queryResult)) {
  65              return PEAR::raiseError("[" . get_class($this). " DB_rubrique : getAllForParentId()] " . $queryResult->getMessage(). "", null, null, null, null, null, false);
  66          }
  67  
  68          while ($row = $queryResult->fetchRow()) {
  69              $resultRubrique = &BD_rubrique::factory($this->getDbParameters(), $this->getDbOptions());
  70  
  71              $maDate = new Date($row['maj']);
  72              $row['maj'] = $maDate->getDate(DATE_FORMAT_TIMESTAMP);
  73  
  74              $resultRubrique->_fetchData($row);
  75              $result[] = &$resultRubrique;
  76          }
  77  
  78          $queryResult->free();
  79          return $result;
  80      }
  81  
  82      // }}}
  83  
  84      // {{{ _fetchData()
  85  
  86      /**
  87       * This method is used to fetch result set fields into the object fields
  88       * @access  private
  89       * @param   array $row content of fetched data
  90       */
  91  
  92  	function _fetchData ($row) {
  93          SQLite_CleanName($row);
  94          BD_rubrique::_fetchData($row);
  95      }
  96  
  97  // }}}
  98  }
  99  ?>


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