Subversion Repositories eFlore/Applications.del

Rev

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

Rev 2182 Rev 2185
Line 286... Line 286...
286
	}
286
	}
Line 287... Line 287...
287
 
287
 
288
	private function ajouterContrainteDepartement() {
288
	private function ajouterContrainteDepartement() {
289
		if (isset($this->parametres['masque.departement'])) {
289
		if (isset($this->parametres['masque.departement'])) {
290
			$dept = $this->parametres['masque.departement'];
290
			$dept = $this->parametres['masque.departement'];
291
			$deptMotif = $this->bdd->proteger("INSEE-C:$dept");
291
			$deptMotif = $this->bdd->proteger("$dept");
Line 292... Line 292...
292
			$this->addWhere('masque.departement', "do.ce_zone_geo LIKE $deptMotif");
292
			$this->addWhere('masque.departement', "substr(do.ce_zone_geo, 1, 2) = $deptMotif");
293
 
293
 
294
			$this->ajouterJoinObsSiNecessaire();
294
			$this->ajouterJoinObsSiNecessaire();
Line 685... Line 685...
685
	public function getAliasDesChamps($champsEtAlias, $select = null, $prefix = null) {
685
	public function getAliasDesChamps($champsEtAlias, $select = null, $prefix = null) {
686
		$arr = ($select) ? array_intersect_key($champsEtAlias, array_flip($select)) :  $champsEtAlias;
686
		$arr = ($select) ? array_intersect_key($champsEtAlias, array_flip($select)) :  $champsEtAlias;
687
		$keys = array_keys($arr);
687
		$keys = array_keys($arr);
Line 688... Line 688...
688
 
688
 
689
		if ($prefix) {
689
		if ($prefix) {
690
			array_walk($keys, create_function('&$val, $k, $prefix', '$val = sprintf("%s.`%s`", $prefix, $val);'), $prefix);
690
		    array_walk($keys, function(&$val, $k, $prefix) { $val = sprintf("%s.`%s`", $prefix, $val);}, $prefix);
691
		} else {
691
		} else {
692
			array_walk($keys, create_function('&$val, $k', '$val = sprintf("`%s`", $val);'));
692
		    array_walk($keys, function(&$val, $k) { $val = sprintf("`%s`", $val);});
Line 693... Line 693...
693
		}
693
		}
694
 
694
 
Line 695... Line 695...
695
		return implode(', ', array_map(create_function('$v, $k', 'return sprintf("%s AS `%s`", $k, $v);'), $arr, $keys));
695
		return implode(', ', array_map(function($v, $k) {return sprintf("%s AS `%s`", $k, $v);}, $arr, $keys));
696
	}
696
	}