Subversion Repositories Applications.papyrus

Rev

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

Rev 832 Rev 846
Line 19... Line 19...
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: more_recherche.class.php,v 1.6 2006-04-28 12:41:49 florian Exp $
24
// CVS : $Id: more_recherche.class.php,v 1.7 2006-05-19 10:04:55 jp_milcent Exp $
25
/**
25
/**
26
* Classe permettant d'effectuer des recherches sur les métas informations des menus.
26
* Classe permettant d'effectuer des recherches sur les métas informations des menus.
27
*
27
*
28
* Permet de rechercher et classer les menus en fonction d'une chaine.
28
* Permet de rechercher et classer les menus en fonction d'une chaine.
29
*
29
*
Line 32... Line 32...
32
//Auteur original :
32
//Auteur original :
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        aucun
35
*@author        aucun
36
*@copyright     Tela-Botanica 2000-2004
36
*@copyright     Tela-Botanica 2000-2004
37
*@version       $Revision: 1.6 $ $Date: 2006-04-28 12:41:49 $
37
*@version       $Revision: 1.7 $ $Date: 2006-05-19 10:04:55 $
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
*/
39
*/
Line 40... Line 40...
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
Line 88... Line 88...
88
    // Méthodes
88
    // Méthodes
Line 89... Line 89...
89
    
89
    
90
    function ajouterRecherche(&$objet_recherche) {
90
    function ajouterRecherche(&$objet_recherche) {
91
        return $this->setMoteur($objet_recherche);
91
        return $this->setMoteur($objet_recherche);
92
    }
-
 
93
    /*
-
 
94
    function supprimerRecherche($id_objet_recherche) {
-
 
95
        if (isset($this->getMoteur($id_objet_recherche))) {
-
 
96
            $this->setMoteur($id_objet_recherche, null);
-
 
97
            return true;
-
 
98
        } else {
-
 
99
            return false;
-
 
100
        }
92
    }
101
    }
-
 
102
    */
93
 
103
    function rechercherMotif() {
94
    function rechercherMotif() {
104
        foreach ($this->getMoteurs() as $cle => $val) {
95
        foreach ($this->getMoteurs() as $cle => $val) {
105
            $this->setResultats(array_merge((array)$this->getResultats(),(array) $val->rechercherMotif($this->getMotif())));
96
            $this->setResultats(array_merge((array)$this->getResultats(),(array)$val->rechercherMotif($this->getMotif())));
106
        }
97
        }
107
        $aso_resultats = $this->getResultats();
98
        $aso_resultats = $this->getResultats();
108
        function comparer($a, $b) {
99
        function comparer($a, $b) {
109
            if ($a['poids'] > $b['poids']) {
100
            if ($a['poids'] > $b['poids']) {
Line 126... Line 117...
126
        }
117
        }
Line 127... Line 118...
127
        
118
        
128
        return $aso_resultats;
119
        return $aso_resultats;
Line -... Line 120...
-
 
120
    }
-
 
121
    
-
 
122
    /** Renvoie le nombre d'occurences total de la présence de chaque mot.
-
 
123
	*
-
 
124
	* @param  string	le motif à rechercher.
-
 
125
	* @param  string	le texte dans lequel effectuer la recherche. 
-
 
126
	* @return integer	le nombre de fois où les mots sont trouvés.
-
 
127
	*/
-
 
128
	function retournerOccurenceMotif($motif, &$texte)
-
 
129
	{
-
 
130
		$nbre_correspondance = 0;
-
 
131
		// Découpage en mot
-
 
132
		$tab_motif = explode(' ', trim($motif));
-
 
133
		// Nous recherchons chaque mot
-
 
134
		foreach ($tab_motif as $mot) {
-
 
135
			$nbre_correspondance += substr_count(strtolower($texte), ' '.strtolower(stripslashes($mot)).' ');
-
 
136
			//$nbre_correspondance += preg_match_all('/'.$mot.'/i', $texte, $tab_morceaux);
-
 
137
		}
-
 
138
		return $nbre_correspondance;
129
    }
139
	}
130
    
140
	
131
    function traduireMois($mois_numerique)
141
    function traduireMois($mois_numerique)
132
    {
142
    {
133
        switch ($mois_numerique) {
143
        switch ($mois_numerique) {
Line 162... Line 172...
162
}
172
}
Line 163... Line 173...
163
 
173
 
164
/* +--Fin du code ----------------------------------------------------------------------------------------+
174
/* +--Fin du code ----------------------------------------------------------------------------------------+
165
*
175
*
-
 
176
* $Log: not supported by cvs2svn $
-
 
177
* Revision 1.6  2006/04/28 12:41:49  florian
-
 
178
* corrections erreurs chemin
166
* $Log: not supported by cvs2svn $
179
*
167
* Revision 1.5  2005/09/20 17:01:22  ddelon
180
* Revision 1.5  2005/09/20 17:01:22  ddelon
168
* php5 et bugs divers
181
* php5 et bugs divers
169
*
182
*
170
* Revision 1.4  2005/05/25 13:49:22  jpm
183
* Revision 1.4  2005/05/25 13:49:22  jpm