Subversion Repositories Applications.dictionnaire

Rev

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

Rev 6 Rev 8
Line 18... Line 18...
18
    		switch($methode) {
18
    		switch($methode) {
Line 19... Line 19...
19
    			
19
    			
20
    			case 'mots':
20
    			case 'mots':
21
    				$retour = $this->getMots();
21
    				$retour = $this->getMots();
-
 
22
    			break;
-
 
23
 
-
 
24
    			case 'zglossary':
-
 
25
    				$retour = $this->getMots_zglossary();
-
 
26
    			break;
-
 
27
 
-
 
28
    			case 'autoabbr':
-
 
29
    				$retour = $this->getMots_autoabbr();
Line 22... Line 30...
22
    			break;
30
    			break;
23
    			
31
    			
24
    			case 'def':
32
    			case 'def':
25
    				if(isset($ressources[1])) {
33
    				if(isset($ressources[1])) {
Line 43... Line 51...
43
    	} else {
51
    	} else {
44
    		$entete_http = RestServeur::HTTP_CODE_CONTENU_REQUIS;
52
    		$entete_http = RestServeur::HTTP_CODE_CONTENU_REQUIS;
45
    	}
53
    	}
Line 46... Line 54...
46
    	
54
    	
47
    	RestServeur::envoyerEnteteStatutHttp($entete_http);
55
    	RestServeur::envoyerEnteteStatutHttp($entete_http);
48
    	header('Content-type : application/json; charset=UTF-8');
56
    	header('Content-type: application/json; charset=UTF-8');
49
    	echo $corps_http; 
57
    	echo $corps_http; 
50
    	exit;
58
    	exit;
Line 51... Line 59...
51
    }
59
    }
Line 68... Line 76...
68
						   implode(",", self::$sous_mots));
76
						   implode(",", self::$sous_mots));
69
		$requete = sprintf('SELECT cle FROM definitions WHERE id NOT IN (%s)',
77
		$requete = sprintf('SELECT cle FROM definitions WHERE id NOT IN (%s)',
70
						   implode(",", self::$sous_mots));
78
						   implode(",", self::$sous_mots));
71
		*/
79
		*/
72
		$requete = 'SELECT cle FROM definitions';
80
		$requete = 'SELECT cle FROM definitions';
-
 
81
		$assoc = $this->bdd->recupererTous($requete);
Line 73... Line -...
73
 
-
 
74
    	$assoc = $this->bdd->recupererTous($requete);
82
 
75
		array_walk($assoc, function(&$item) { $item = $item['cle']; });
83
		array_walk($assoc, function(&$item) { $item = $item['cle']; });
76
		return $assoc;
84
		return $assoc;
-
 
85
    }
-
 
86
 
-
 
87
    private function getMots_zglossary() {
-
 
88
		$assoc = $this->bdd->recupererTous('SELECT cle as term, 0 as type, valeur as definition FROM definitions' .
-
 
89
										   ' WHERE valeur != ""');
-
 
90
		return $assoc;
-
 
91
    }
-
 
92
 
-
 
93
    private function getMots_autoabbr() {
-
 
94
		$assoc = $this->bdd->recupererTous("SELECT CONCAT(cle, '*') as cle FROM definitions WHERE valeur != ''");
-
 
95
		$assoc2 = Array();
-
 
96
		foreach($assoc as $v) {
-
 
97
			$assoc2[$v['cle']] = true;
-
 
98
		}
-
 
99
		return $assoc2;
Line 77... Line 100...
77
    }
100
    }
78
    
101
    
79
    static function simplifier($chaine){
102
    static function simplifier($chaine){
80
		return strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $chaine));
103
		return trim(strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $chaine)), " \t\n\r\0\x0b*");
81
	}
104
	}
82
}
105
}