Subversion Repositories Applications.framework

Rev

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

Rev 370 Rev 378
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 378 2011-10-10 09:25:12Z jpm $
13
 * @link		/doc/framework/
13
 * @link		/doc/framework/
14
 */
14
 */
15
class Tableau {
15
class Tableau {
16
	/**
16
	/**
17
	 * Etend le tableau à étendre avec les données du tableau à copier. Si des clés sont identiques entre les deux tableaux
17
	 * Etend le tableau à étendre avec les données du tableau à copier. Si des clés sont identiques entre les deux tableaux
Line 39... Line 39...
39
			trigger_error($e, E_USER_WARNING);
39
			trigger_error($e, E_USER_WARNING);
40
		}
40
		}
41
	}
41
	}
Line 42... Line 42...
42
	
42
	
-
 
43
	/**
-
 
44
	 * @deprecated Utiliser la méthode trierMD()
-
 
45
	 * @see  trierMD()
-
 
46
	 */
-
 
47
	public static function trierTableauMd($array, $cols) {
-
 
48
		return self::trierMD($array, $cols);
-
 
49
	}
-
 
50
	
43
	/**
51
	/**
44
	 * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
52
	 * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
45
	 * 
53
	 * 
46
	 * @param Array $array le tableau à trier
54
	 * @param Array $array le tableau à trier
47
	 * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
55
	 * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
48
	 * @return Array le tableau trié.
56
	 * @return Array le tableau trié.
49
	 * @author cagret at gmail dot com
57
	 * @author cagret at gmail dot com
50
	 * @see  http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
58
	 * @see  http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
51
	 */
59
	 */
52
	public static function trierTableauMd($array, $cols) {
60
	public static function trierMD($array, $cols) {
53
		$colarr = array();
61
		$colarr = array();
54
		foreach ($cols as $col => $order) {
62
		foreach ($cols as $col => $order) {
55
		$colarr[$col] = array();
63
		$colarr[$col] = array();
56
			foreach ($array as $k => $row) {
64
			foreach ($array as $k => $row) {