[CSS] +fix page header and title color
[lhc/web/www.git] / www / plugins / formidable / public / formidable_criteres.php
1 <?php
2
3 if (!defined('_ECRIRE_INC_VERSION')) {
4 return;
5 }
6
7 // {tri_donnee champ}
8 /**
9 * Depuis la boucle FORMULAIRES_REPONSES, trier les résulats en fonction d'un champ
10 * de la table FORMULAIRES_REPONSES_CHAMPS
11 * {tri_selon_donnee}
12 *
13 * @global array $exceptions_des_tables
14 * @param string $idb
15 * @param array $boucles
16 * @param <type> $crit
17 *
18 * Auteurs :
19 * Antoine Pitrou
20 * Cedric Morin
21 * Renato
22 * @ 2005,2006 - Distribue sous licence GNU/GPL
23 */
24
25 function critere_tri_selon_donnee_dist($idb, &$boucles, $crit) {
26 // Garder cette fontion pour compatibilité
27 critere_tri_selon_reponse_dist($idb, $boucles, $crit) ;
28 }
29 function critere_tri_selon_reponse_dist($idb, &$boucles, $crit) {
30
31 $boucle = &$boucles[$idb];
32 $t = $boucle->id_table;
33
34 if ($t=='formulaires_reponses') {
35 $not = $crit->not;
36 $_quoi = calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent);
37 $k = count($boucle->join)+1;
38 $boucle->join[$k]= array($t,'id_formulaires_reponse');
39 $boucle->from["L$k"]= 'spip_formulaires_reponses_champs';
40 $op = array("'='", "'L$k.nom'", "sql_quote(".$_quoi.")");
41 $boucle->where[]= array("'?'","!in_array($_quoi,array('date','id_formulaires_reponse'))",$op,"''");
42 $boucle->order[]= "(in_array($_quoi,array('date','id_formulaires_reponse'))?'$t.'.$_quoi:(strncmp($_quoi,'date_',5)==0?'STR_TO_DATE(L$k.valeur,\'%d/%m/%Y\')':'L$k.valeur'))".($not?".' DESC'":"");
43 }
44 }
45
46 // {recherche_donnee} ou {recherche_donnee susan}
47 // Intégralement pompé et adapté de Forms&Tables
48 function critere_recherche_reponse_dist($idb, &$boucles, $crit) {
49 global $table_des_tables;
50 $boucle = &$boucles[$idb];
51 $t = $boucle->id_table;
52 if ($t=='formulaires_reponses') {
53 if (isset($crit->param[0])) {
54 $_quoi = calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent);
55 } else {
56 $_quoi = '@$Pile[0]["recherche"]';
57 }
58
59 $k = count($boucle->join)+1;
60 $boucle->join[$k]= array($t,'id_formulaires_reponse');
61 $boucle->from["L$k"]= 'spip_formulaires_reponses_champs';
62 $op = array("'LIKE'","'L$k.valeur'","sql_quote(strpos($_quoi,'%')===false?'%'.".$_quoi.".'%':$_quoi)");
63 $boucle->where[]= array("'?'",$_quoi,$op,"''");
64 }
65 }