[ 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/mysql/ -> rubrique_mysql.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  
  22  if (defined("_BD_RUBRIQUEMYSQL"))
  23      return;
  24  
  25  define("_BD_RUBRIQUEMYSQL", "1");
  26  
  27  require_once dirname(__FILE__). "/../rubrique.php";
  28  
  29  /**
  30   * BD_rubrique_mysql is an implementation for MySQL of BD_rubrique business class.
  31   * @package    BD_mysql
  32   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  33   * @access    public
  34   */
  35  class BD_rubrique_mysql extends BD_rubrique {
  36  
  37      // {{{ getParentAndGrandParentForRubriqueId($id_rubrique)
  38  
  39      /**
  40       * Returns an array with Parent and Grand Parent
  41       *
  42       * @return Array of Rubrique_id
  43       * @param $auteurId
  44       * @access public
  45       */
  46  
  47      function &getParentAndGrandParentForRubriqueId ($id_rubrique) {
  48          $result = array();
  49          $db = &$this->_getDB();
  50  
  51          if (DB::isError($db)) {
  52              return PEAR::raiseError(
  53                         "[" . get_class(
  54                                   $this). " DB_rubrique : getParentAndGrandParentForRubriqueId()] " . $db->getMessage(). "",
  55                         null,
  56                         null,
  57                         null,
  58                         null,
  59                         null,
  60                         false);
  61          }
  62  
  63          $query
  64              = "SELECT a.id_parent AS ida, b.id_parent AS idb " . "FROM " . $GLOBALS['table_prefix']. "_rubriques a LEFT JOIN " . $GLOBALS['table_prefix']. "_rubriques b ON (b.id_rubrique = a.id_parent) " . "WHERE a.id_rubrique = $id_rubrique";
  65  
  66          //echo $query;
  67  
  68          $queryResult = $db->query($query);
  69  
  70          if (DB::isError($queryResult)) {
  71              return PEAR::raiseError(
  72                         "[" . get_class(
  73                                   $this). " DB_rubrique : getParentAndGrandParentForRubriqueId()] " . $queryResult->getMessage(). "",
  74                         null,
  75                         null,
  76                         null,
  77                         null,
  78                         null,
  79                         false);
  80          }
  81  
  82          while ($row = $queryResult->fetchRow()) {
  83              $result = $row;
  84          }
  85  
  86          $queryResult->free();
  87          return $result;
  88      }
  89  
  90  // }}}
  91  
  92  }
  93  ?>


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