Subversion Repositories Applications.papyrus

Rev

Rev 846 | Rev 1034 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 1032
Line 82... Line 82...
82
	            // Initialisation du tableau de résultat vide
82
	            // Initialisation du tableau de résultat vide
83
	            $aso_resultat = array(  'poids' => 0, 'url' => '', 'titre' => '',
83
	            $aso_resultat = array(  'poids' => 0, 'url' => '', 'titre' => '',
84
	                                    'hreflang' => '', 'accesskey' => '', 'title' => '',
84
	                                    'hreflang' => '', 'accesskey' => '', 'title' => '',
85
	                                    'date_creation' => '', 'description' => '');
85
	                                    'date_creation' => '', 'description' => '');
Line 86... Line -...
86
	            
-
 
87
	            // Création de l'url
-
 
88
	            $var_recherche = str_replace(' ', '+', trim($motif));
-
 
89
	            $aso_resultat['url'] = $url_base.'article'.$article_id.'.html?var_recherche='.$var_recherche;
-
 
90
	            
-
 
91
	            // Récupération du titre de la page
-
 
92
	            if (trim($Article->titre) != '') {
-
 
93
	                $aso_resultat['titre'] = htmlentities($Article->titre);
-
 
94
	            } else if (trim($Article->surtitre) != '') {
-
 
95
	                $aso_resultat['titre'] = htmlentities($Article->surtitre);
-
 
96
	            } else if (trim($Article->soustitre) != '') {
-
 
97
	                $aso_resultat['titre'] = htmlentities($Article->soustitre);
-
 
98
	            }
-
 
99
	            $aso_resultat['hreflang'] = htmlentities($Article->lang);
-
 
100
	            
-
 
101
	            $aso_resultat['description'] = $this->couper($Article->texte, 450);
-
 
102
	            
-
 
103
	            if (($jour = date('d', strtotime($Article->date)) ) != 0 ) {
-
 
104
	                $aso_resultat['date_creation'] .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n";
-
 
105
	            }
-
 
106
	            if (($mois = $this->traduireMois(date('m', strtotime($Article->date))) ) != '' ) {
-
 
107
	                $aso_resultat['date_creation'] .= '<span class="page_modification_mois"> '.$mois.'</span>'."\n";
-
 
108
	            }
-
 
109
	            if (($annee = date('Y', strtotime($Article->date)) ) != 0 ) {
-
 
110
	                $aso_resultat['date_creation'] .= '<span class="page_modification_annee"> '.$annee.'</span>'."\n";
-
 
111
	            }
-
 
112
	            
86
	            
113
	            // Analyse du poids de cette page vis à vis des données
87
	            // Analyse du poids de cette page vis à vis des données
-
 
88
	            $tab_champs_a_visiter = array(  'surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps');
-
 
89
	            $tab_motif = explode(' ', $motif);
114
	            $tab_champs_a_visiter = array(  'surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps');
90
	            $bool_operateur_et = false;
-
 
91
	            foreach ($tab_champs_a_visiter as $val) {
-
 
92
	                $compteur_mot = 0;
115
	            foreach ($tab_champs_a_visiter as $val) {
93
	                foreach ($tab_motif as $mot_motif) {
-
 
94
	                	$nbre_mot = $this->retournerOccurenceMotif($mot_motif, $Article->$val);
-
 
95
	                	if ($nbre_mot > 0) {
-
 
96
	                		$compteur_mot++;
-
 
97
	                	}
-
 
98
	                	$aso_resultat['poids'] += $nbre_mot;
-
 
99
	                }
-
 
100
	                if ($compteur_mot == count($tab_motif)) {
-
 
101
	                	$bool_operateur_et = true;
116
	                $aso_resultat['poids'] += $this->retournerOccurenceMotif($motif, $Article->$val);
102
	                }
117
	            }
103
	            }
118
	            
104
	            
-
 
105
	            if ($aso_resultat['poids'] > 0 && $bool_operateur_et == true) {
-
 
106
	                // Création de l'url
-
 
107
		            $var_recherche = str_replace(' ', '+', trim($motif));
-
 
108
		            $aso_resultat['url'] = $url_base.'article'.$article_id.'.html?var_recherche='.$var_recherche;
-
 
109
		            
-
 
110
		            // Récupération du titre de la page
-
 
111
		            if (trim($Article->titre) != '') {
-
 
112
		                $aso_resultat['titre'] = htmlentities($Article->titre);
-
 
113
		            } else if (trim($Article->surtitre) != '') {
-
 
114
		                $aso_resultat['titre'] = htmlentities($Article->surtitre);
-
 
115
		            } else if (trim($Article->soustitre) != '') {
-
 
116
		                $aso_resultat['titre'] = htmlentities($Article->soustitre);
-
 
117
		            }
-
 
118
		            $aso_resultat['hreflang'] = htmlentities($Article->lang);
-
 
119
		            
-
 
120
		            $aso_resultat['description'] = $this->couper($Article->texte, 450);
-
 
121
		            
-
 
122
		            if (($jour = date('d', strtotime($Article->date)) ) != 0 ) {
-
 
123
		                $aso_resultat['date_creation'] .= '<span class="page_modification_jour"> '.$jour.'</span>'."\n";
-
 
124
		            }
-
 
125
		            if (($mois = $this->traduireMois(date('m', strtotime($Article->date))) ) != '' ) {
-
 
126
		                $aso_resultat['date_creation'] .= '<span class="page_modification_mois"> '.$mois.'</span>'."\n";
-
 
127
		            }
-
 
128
		            if (($annee = date('Y', strtotime($Article->date)) ) != 0 ) {
-
 
129
		                $aso_resultat['date_creation'] .= '<span class="page_modification_annee"> '.$annee.'</span>'."\n";
119
	            if ($aso_resultat['poids'] > 0) {
130
		            }
120
	                $this->setResultat($aso_resultat);
131
	                $this->setResultat($aso_resultat);
121
	            }
132
	            }
122
	        }
133
	        }
123
    	}
134
    	}
Line 243... Line 254...
243
}
254
}
Line 244... Line 255...
244
 
255
 
245
/* +--Fin du code ----------------------------------------------------------------------------------------+
256
/* +--Fin du code ----------------------------------------------------------------------------------------+
246
*
257
*
-
 
258
* $Log$
-
 
259
* Revision 1.1  2006/05/19 10:04:55  jp_milcent
-
 
260
* Ajout d'un moteur de recherche analysant les articles des sites sous Spip.
247
* $Log$
261
*
248
* 
262
* 
249
* +-- Fin du code ----------------------------------------------------------------------------------------+
263
* +-- Fin du code ----------------------------------------------------------------------------------------+
250
*/
264
*/
251
?>
265
?>