[ 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_Syndic_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_Syndic.
  20  //
  21  
  22  require_once dirname(__FILE__). "/../Indexer.php";
  23  
  24  require_once dirname(__FILE__). "/../../bd/inc_syndic_factory.php";
  25  require_once dirname(__FILE__). "/../../bd/inc_syndic_articles_factory.php";
  26  require_once dirname(__FILE__). "/../../bd/inc_index_syndic_factory.php";
  27  
  28  require_once dirname(__FILE__). "/../../../inc_sites.php";
  29  
  30  /**
  31   * Indexer_Syndic_common is an implementation for Common of syndic indexer.
  32   * @package    indexer/common
  33   * @author     Erwan Le Bescond <elebescond@clever-age.com>
  34   * @access    public
  35   */
  36  class Indexer_Syndic_common extends Indexer {
  37  
  38      // {{{ constructor
  39  
  40      /**
  41       * ListeAction constructor.
  42       *
  43       * @access public
  44       */
  45  
  46  	function Indexer_Syndic_common () {
  47          $poids = array();
  48          include (dirname(__FILE__). "/configurationSyndicPoids_common.php");
  49  
  50          if (file_exists(dirname(__FILE__). "/configurationSyndicPoids_" . $GLOBALS['type_indexer']. ".php")) {
  51              include (dirname(__FILE__). "/configurationSyndicPoids_" . $GLOBALS['type_indexer']. ".php");
  52          }
  53  
  54          $this->_poids = $poids;
  55  
  56          $this->_full = false;
  57  
  58          $this->_type = 'syndic';
  59      }
  60  
  61      // }}}
  62  
  63      // {{{
  64  
  65  	function alreadyIndex ($id_objet) {
  66          $indexSyndicMetier = &recuperer_instance_index_syndic();
  67          /*
  68          return ($indexSyndicMetier->howManyIndexSyndicForMotId($id_objet) > 0);
  69          */
  70          return ($indexSyndicMetier->howManyIndexSyndicForSyndicId($id_objet) > 0);
  71      }
  72  
  73      // }}}
  74  
  75      // {{{
  76  
  77  	function _indexData ($id_objet) {
  78          $syndicMetier = &recuperer_instance_syndic();
  79          $loadOK = $syndicMetier->load($id_objet);
  80  
  81          if (PEAR::isError($loadOK)) {
  82              die ($loadOK->getMessage());
  83          }
  84          else {
  85              $this->_indexer_chaine($syndicMetier->getNomSite(), $this->_poids['syndic']['nom_site']);
  86              $this->_indexer_chaine($syndicMetier->getDescriptif(), $this->_poids['syndic']['descriptif']);
  87              if ($this->_full) {
  88                  // Ajouter les titres des articles syndiques de ce site, le cas echeant
  89                  if ($syndicMetier->getSyndication() == "oui") {
  90                      $syndicArticleMetier = &recuperer_instance_syndic_articles();
  91                      $allSyndicArticleByDate = $syndicArticleMetier->getAllForSyndicId($id_objet, "date_heure");
  92  
  93                      if (PEAR::isError($allSyndicArticleByDate)) {
  94                          die ($allSyndicArticleByDate->getMessage());
  95                      }
  96                      while (list(, $syndicArticleMetier) = each($allSyndicArticleByDate)) {
  97                          $titre = $this->_indexer_chaine($syndicArticleMetier->getTitre(), $this->_poids['syndication']['titre']);
  98                      }
  99                  }
 100                  // Aller chercher la page d'accueil
 101                  if (lire_meta("visiter_sites") == "oui") {
 102                      include_ecrire  ("inc_sites.php");
 103  
 104                      if (function_exists(spip_log)) {
 105                          spip_log ("indexation contenu syndic " . $syndicMetier->getUrlSite());
 106                      }
 107                      $this->_indexer_chaine(supprimer_tags(substr(recuperer_page($syndicMetier->getUrlSite()), 0, 50000)), $this->_poids['syndic']['page_accueil']);
 108                  }
 109              }
 110          }
 111      }
 112  
 113      // }}}
 114  
 115      // {{{ 
 116  
 117  	function _createIndex ($id_objet) {
 118          $indexSyndicCreateMetier = &recuperer_instance_index_syndic();
 119  
 120          while (list($hash, $points) = each($this->_index)) {
 121              $indexSyndicCreateMetier->setHash("0x$hash");
 122              $indexSyndicCreateMetier->setPoints("$points");
 123              $indexSyndicCreateMetier->setSyndicId("$id_objet");
 124              $indexSyndicCreateMetier->create();
 125              if (PEAR::isError($createOK)) {
 126                  die ($createOK->getMessage());
 127              }
 128          }
 129      }
 130  
 131  // }}}
 132  
 133  }
 134  ?>


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