[ 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/indexer/common/ -> Indexer_Auteur_common.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 Indexer_Auteur.
  20  //
  21  
  22  require_once dirname(__FILE__). "/../Indexer.php";
  23  
  24  require_once dirname(__FILE__). "/../../bd/inc_auteur_factory.php";
  25  require_once dirname(__FILE__). "/../../bd/inc_index_auteurs_factory.php";
  26  
  27  /**
  28   * Indexer_Auteur_common is an implementation for Common of auteur indexer.
  29   * @package    indexer/common
  30   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  31   * @access    public
  32   */
  33  class Indexer_Auteur_common extends Indexer {
  34  
  35      // {{{ constructor
  36  
  37      /**
  38       * ListeAction constructor.
  39       *
  40       * @access public
  41       */
  42  
  43  	function Indexer_Auteur_common () {
  44          $poids = array();
  45          include (dirname(__FILE__). "/configurationAuteurPoids_common.php");
  46  
  47          if (file_exists(dirname(__FILE__). "/configurationAuteurPoids_" . $GLOBALS['type_indexer']. ".php")) {
  48              include (dirname(__FILE__). "/configurationAuteurPoids_" . $GLOBALS['type_indexer']. ".php");
  49          }
  50  
  51          $this->_poids = $poids;
  52  
  53          $this->_full = false;
  54  
  55          $this->_type = 'auteur';
  56      }
  57  
  58      // }}}
  59  
  60      // {{{
  61  
  62  	function alreadyIndex ($id_objet) {
  63          $indexAuteurMetier = &recuperer_instance_index_auteurs();
  64          return ($indexAuteurMetier->howManyIndexAuteurForAuteurId($id_objet) > 0);
  65      }
  66  
  67      // }}}
  68  
  69      // {{{
  70  
  71  	function _indexData ($id_objet) {
  72          $auteurMetier = &recuperer_instance_auteur();
  73          $loadOK = $auteurMetier->load($id_objet);
  74  
  75          if (PEAR::isError($loadOK)) {
  76              die ($loadOK->getMessage());
  77          }
  78          else {
  79              $this->_indexer_chaine($auteurMetier->getNom(), $this->_poids['auteur']['nom']);
  80              if ($this->_full) {
  81                  $this->_indexer_chaine($auteurMetier->getBio(), $this->_poids['auteur']['bio']);
  82              }
  83          }
  84  
  85          $indexAuteurMetier = &recuperer_instance_index_auteurs();
  86          $indexAuteurMetier->deleteIndexAuteurForAuteurId($id_objet);
  87      }
  88  
  89      // }}}
  90  
  91      // {{{ 
  92  
  93  	function _createIndex ($id_objet) {
  94          $indexAuteurCreateMetier = &recuperer_instance_index_auteurs();
  95  
  96          while (list($hash, $points) = each($this->_index)) {
  97              $indexAuteurCreateMetier->setHash("0x$hash");
  98              $indexAuteurCreateMetier->setPoints("$points");
  99              $indexAuteurCreateMetier->setAuteurId("$id_objet");
 100              $indexAuteurCreateMetier->create();
 101          }
 102      }
 103  
 104  // }}}
 105  
 106  }
 107  ?>


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