1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Options globales chargées à chaque hit |
---|
5 | * |
---|
6 | * @package SPIP\Formidable\Puce_statut |
---|
7 | **/ |
---|
8 | |
---|
9 | |
---|
10 | /** |
---|
11 | * Déclare les états d'une puce statut d'une réponse de formulaire. |
---|
12 | * |
---|
13 | * [TODO] Migrer en 3... |
---|
14 | **/ |
---|
15 | function puce_statut_formulaires_reponse_dist($id, $statut, $id_rubrique, $type='formulaires_reponse', $ajax=false){ |
---|
16 | global $lang_objet; |
---|
17 | |
---|
18 | static $coord = array( |
---|
19 | 'publie' => 1, |
---|
20 | 'prop' => 0, |
---|
21 | 'poubelle' => 2 |
---|
22 | ); |
---|
23 | |
---|
24 | $lang_dir = lang_dir($lang_objet); |
---|
25 | $ajax_node = " id='imgstatut$type$id'"; |
---|
26 | $inser_puce = puce_statut($statut, " width='9' height='9' style='margin: 1px;'$ajax_node"); |
---|
27 | |
---|
28 | if (!autoriser('instituer', 'formulaires_reponse', $id) |
---|
29 | or !_ACTIVER_PUCE_RAPIDE |
---|
30 | ) |
---|
31 | return $inser_puce; |
---|
32 | |
---|
33 | $titles = array( |
---|
34 | "orange" => _T('texte_statut_propose_evaluation'), |
---|
35 | "verte" => _T('texte_statut_publie'), |
---|
36 | "poubelle" => _T('texte_statut_poubelle') |
---|
37 | ); |
---|
38 | |
---|
39 | $clip = 1 + (11 * $coord[$statut]); |
---|
40 | |
---|
41 | if ($ajax){ |
---|
42 | return "<span class='puce_article_fixe'>" |
---|
43 | . $inser_puce |
---|
44 | . "</span>" |
---|
45 | . "<span class='puce_article_popup' id='statutdecal$type$id' style='width:33px; margin-left: -$clip"."px;'>" |
---|
46 | . afficher_script_statut($id, $type, -1, 'puce-orange.gif', 'prop', $titles['orange']) |
---|
47 | . afficher_script_statut($id, $type, -12, 'puce-verte.gif', 'publie', $titles['verte']) |
---|
48 | . afficher_script_statut($id, $type, -23, 'puce-poubelle.gif', 'poubelle', $titles['poubelle']) |
---|
49 | . "</span>"; |
---|
50 | } |
---|
51 | |
---|
52 | $nom = "puce_statut_"; |
---|
53 | |
---|
54 | if ((! _SPIP_AJAX) AND $type != 'formulaires_reponse') |
---|
55 | $over =''; |
---|
56 | else { |
---|
57 | $action = generer_url_ecrire('puce_statut_formulaires',"",true); |
---|
58 | $action = "if (!this.puce_loaded) { this.puce_loaded = true; prepare_selec_statut('$nom', '$type', '$id', '$action'); }"; |
---|
59 | $over = "\nonmouseover=\"$action\""; |
---|
60 | } |
---|
61 | |
---|
62 | return "<span class='puce_article' id='$nom$type$id' dir='$lang_dir'$over>" |
---|
63 | . $inser_puce |
---|
64 | . '</span>'; |
---|
65 | } |
---|