[ Index ] |
|
Code source de SPIP Agora 1.4 |
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_Article. 20 // 21 22 require_once dirname(__FILE__). "/../Indexer.php"; 23 24 require_once dirname(__FILE__). "/../../bd/inc_article_factory.php"; 25 require_once dirname(__FILE__). "/../../bd/inc_mot_factory.php"; 26 require_once dirname(__FILE__). "/../../bd/inc_auteur_factory.php"; 27 require_once dirname(__FILE__). "/../../bd/inc_index_articles_factory.php"; 28 29 /** 30 * Indexer_Article_common is an implementation for Common of article indexer. 31 * @package indexer/common 32 * @author Erwan Le Bescond <elebescond@clever-age.com> 33 * @access public 34 */ 35 class Indexer_Article_common extends Indexer { 36 37 // {{{ constructor 38 39 /** 40 * ListeAction constructor. 41 * 42 * @access public 43 */ 44 45 function Indexer_Article_common () { 46 $poids = array(); 47 include (dirname(__FILE__). "/configurationArticlePoids_common.php"); 48 49 if (file_exists(dirname(__FILE__). "/configurationArticlePoids_" . $GLOBALS['type_indexer']. ".php")) { 50 include (dirname(__FILE__). "/configurationArticlePoids_" . $GLOBALS['type_indexer']. ".php"); 51 } 52 53 $this->_poids = $poids; 54 55 $this->_full = false; 56 57 $this->_type = 'article'; 58 } 59 60 // }}} 61 62 // {{{ 63 64 function alreadyIndex ($id_objet) { 65 $indexArticleMetier = &recuperer_instance_index_articles(); 66 return ($indexArticleMetier->howManyIndexArticleForArticleId($id_objet) > 0); 67 } 68 69 // }}} 70 71 // {{{ 72 73 function _indexData ($id_objet) { 74 $articleMetier = &recuperer_instance_article(); 75 $loadOk = $articleMetier->load($id_objet); 76 77 if (!PEAR::isError($loadOk)) { 78 $this->_indexer_chaine($articleMetier->getTitre(), $this->_poids['article']['titre']); 79 $this->_indexer_chaine($articleMetier->getSoustitre(), $this->_poids['article']['soustitre']); 80 $this->_indexer_chaine($articleMetier->getSurtitre(), $this->_poids['article']['surtitre']); 81 $this->_indexer_chaine($articleMetier->getDescriptif(), $this->_poids['article']['descriptif']); 82 if ($this->_full) { 83 $this->_indexer_chaine($articleMetier->getChapo(), $this->_poids['article']['chapo']); 84 $this->_indexer_chaine($articleMetier->getTexte(), $this->_poids['article']['texte']); 85 $this->_indexer_chaine($articleMetier->getPs(), $this->_poids['article']['ps']); 86 } 87 } 88 89 $motMetier = &recuperer_instance_mot(); 90 91 $allMots = $motMetier->getAllFromMotsAndAnotherTable("articles", "id_article", $id_objet); 92 93 if (!PEAR::isError($allMots)) { 94 while (list(, $motMetier) = each($allMots)) { 95 $this->_indexer_chaine($motMetier->getTitre(), $this->_poids['mot']['titre']); 96 $this->_indexer_chaine($motMetier->getDescriptif(), $this->_poids['mot']['descriptif']); 97 } 98 } 99 100 $articleMetier = &recuperer_instance_article(); 101 $allAuteurs = $articleMetier->getAuteursForArticleId($id_objet); 102 103 while (list(, $monAuteur) = each($allAuteurs)) { 104 $this->_indexer_chaine($monAuteur->getNom(), $this->_poids['auteur']['nom']); 105 } 106 107 $indexArticleMetier = &recuperer_instance_index_articles(); 108 $indexArticleMetier->deleteIndexArticleForArticleId($id_objet); 109 } 110 111 // }}} 112 113 // {{{ 114 115 function _createIndex ($id_objet) { 116 $indexArticleCreateMetier = &recuperer_instance_index_articles(); 117 118 while (list($hash, $points) = each($this->_index)) { 119 $indexArticleCreateMetier->setHash("0x$hash"); 120 $indexArticleCreateMetier->setPoints("$points"); 121 $indexArticleCreateMetier->setArticleId("$id_objet"); 122 $indexArticleCreateMetier->create(); 123 } 124 } 125 126 // }}} 127 128 } 129 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |