Subversion Repositories Applications.framework

Rev

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

Rev 370 Rev 379
Line 7... Line 7...
7
 * @package	Utilitaire
7
 * @package	Utilitaire
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
9
 * @copyright	Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
10
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
10
 * @license	http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 
11
 * @license	http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 
12
 * @version	$Id: Tableau.php 370 2011-10-04 14:39:38Z jpm $
12
 * @version	$Id: Tableau.php 379 2011-10-14 09:11:52Z jpm $
13
 * @link		/doc/framework/
13
 * @link		/doc/framework/
14
 */
14
 */
15
class Tableau {
15
class Tableau {
Line 16... Line 16...
16
	
16
	
Line 40... Line 40...
40
			trigger_error($e, E_USER_WARNING);
40
			trigger_error($e, E_USER_WARNING);
41
		}
41
		}
42
	}
42
	}
Line 43... Line 43...
43
	
43
	
-
 
44
	/**
-
 
45
	 * @deprecated Utiliser la méthode trierMD()
-
 
46
	 * @see  trierMD()
-
 
47
	 */
-
 
48
	public static function trierTableauMd($array, $cols) {
-
 
49
		return self::trierMD($array, $cols);
-
 
50
	}
-
 
51
	
44
	/**
52
	/**
45
	 * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
53
	 * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
46
	 * 
54
	 * 
47
	 * @param Array $array le tableau à trier
55
	 * @param Array $array le tableau à trier
48
	 * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
56
	 * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
49
	 * @return Array le tableau trié.
57
	 * @return Array le tableau trié.
50
	 * @author cagret at gmail dot com
58
	 * @author cagret at gmail dot com
51
	 * @see  http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
59
	 * @see  http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
52
	 */
60
	 */
53
	public static function trierTableauMd($array, $cols) {
61
	public static function trierMD($array, $cols) {
54
		$colarr = array();
62
		$colarr = array();
55
		foreach ($cols as $col => $order) {
63
		foreach ($cols as $col => $order) {
56
		$colarr[$col] = array();
64
		$colarr[$col] = array();
57
			foreach ($array as $k => $row) {
65
			foreach ($array as $k => $row) {