Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 911 Rev 917
Line 40... Line 40...
40
		$methode .= str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($nom))));
40
		$methode .= str_replace(' ', '', ucwords(str_replace('-', ' ', strtolower($nom))));
41
		return $methode;
41
		return $methode;
42
	}
42
	}
Line 43... Line 43...
43
	
43
	
44
	//+----------------------------------------------------------------------------------------------------------------+
44
	//+----------------------------------------------------------------------------------------------------------------+
Line 45... Line 45...
45
	// GESTION DU DAO
45
	// GESTION des CLASSES CHARGÉES à la DEMANDE
46
	
46
	
47
	protected function getDao() {
47
	protected function getDao() {
48
		if (! isset($this->dao)) {
48
		if (! isset($this->dao)) {
Line 354... Line 354...
354
		$contenu = str_replace('<?=', '<?php echo ',  $contenu);
354
		$contenu = str_replace('<?=', '<?php echo ',  $contenu);
355
		// Ajout systématique d'un point virgule avant la fermeture php
355
		// Ajout systématique d'un point virgule avant la fermeture php
356
		$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
356
		$contenu = preg_replace("/;*\s*\?>/", "; ?>", $contenu);
357
		return $contenu;
357
		return $contenu;
358
	}
358
	}
-
 
359
	
-
 
360
	//+----------------------------------------------------------------------------------------------------------------+
-
 
361
	// UTILITAIRES
-
 
362
	
-
 
363
	/**
-
 
364
	 * Permet de trier un tableau multi-dimenssionnel en gardant l'ordre des clés.
-
 
365
	 * 
-
 
366
	 * @param Array $array le tableau à trier
-
 
367
	 * @param Array $cols tableau indiquant en clé la colonne à trier et en valeur l'ordre avec SORT_ASC ou SORT_DESC
-
 
368
	 * @author cagret at gmail dot com
-
 
369
	 * @see  http://fr.php.net/manual/fr/function.array-multisort.php Post du 21-Jun-2009 12:38
-
 
370
	 */
-
 
371
	public static function trierTableauMd($array, $cols) {
-
 
372
		$colarr = array();
-
 
373
		foreach ($cols as $col => $order) {
-
 
374
		$colarr[$col] = array();
-
 
375
			foreach ($array as $k => $row) {
-
 
376
				$colarr[$col]['_'.$k] = strtolower($row[$col]);
-
 
377
			}
-
 
378
		}
-
 
379
		$params = array();
-
 
380
		foreach ($cols as $col => $order) {
-
 
381
			$params[] =& $colarr[$col];
-
 
382
			$params = array_merge($params, (array)$order);
-
 
383
		}
-
 
384
		call_user_func_array('array_multisort', $params);
-
 
385
		$ret = array();
-
 
386
		$keys = array();
-
 
387
		$first = true;
-
 
388
		foreach ($colarr as $col => $arr) {
-
 
389
			foreach ($arr as $k => $v) {
-
 
390
				if ($first) {
-
 
391
					$keys[$k] = substr($k,1);
-
 
392
				}
-
 
393
				$k = $keys[$k];
-
 
394
				if (!isset($ret[$k])) {
-
 
395
					$ret[$k] = $array[$k];
-
 
396
				}
-
 
397
				$ret[$k][$col] = $array[$k][$col];
-
 
398
			}
-
 
399
			$first = false;
-
 
400
		}
-
 
401
		return $ret;
-
 
402
	}
359
}
403
}
360
?>
404
?>
361
405