X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fecrire%2Fexec%2Fpuce_statut.php;h=8716bafb8364900b9964079b4e000b5a200bc2c2;hb=4f443dce95ff6f8221c189880a70c74ce1c1f238;hp=0d362c5eca6cd34ea8855a47feee5a644fc6a585;hpb=4a628e9b277d3617535f99d663ca79fa2e891177;p=lhc%2Fweb%2Fwww.git diff --git a/www/ecrire/exec/puce_statut.php b/www/ecrire/exec/puce_statut.php index 0d362c5e..8716bafb 100644 --- a/www/ecrire/exec/puce_statut.php +++ b/www/ecrire/exec/puce_statut.php @@ -3,45 +3,74 @@ /***************************************************************************\ * SPIP, Systeme de publication pour l'internet * * * - * Copyright (c) 2001-2016 * + * Copyright (c) 2001-2017 * * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * * * * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ -if (!defined('_ECRIRE_INC_VERSION')) return; +/** + * Gestion des puces d'action rapide + * + * @package SPIP\Core\Puce_statut + **/ + +if (!defined('_ECRIRE_INC_VERSION')) { + return; +} include_spip('inc/presentation'); -// http://doc.spip.org/@exec_puce_statut_dist -function exec_puce_statut_dist() -{ - exec_puce_statut_args(_request('id'), _request('type')); +/** + * Gestion de l'affichage ajax des puces d'action rapide + * + * Récupère l'identifiant id et le type d'objet dans les données postées + * et appelle la fonction de traitement de cet exec. + * + * @uses exec_puce_statut_args() + * @return string Code HTML + **/ +function exec_puce_statut_dist() { + exec_puce_statut_args(_request('id'), _request('type')); } -// http://doc.spip.org/@exec_puce_statut_args -function exec_puce_statut_args($id, $type) -{ +/** + * Traitement de l'affichage ajax des puces d'action rapide + * + * Appelle la fonction de traitement des puces statuts + * après avoir retrouvé le statut en cours de l'objet + * et son parent (une rubrique) + * + * @uses inc_puce_statut_dist() + * @uses ajax_retour() + * + * @param int $id + * Identifiant de l'objet + * @param string $type + * Type d'objet + * @return string Code HTML + **/ +function exec_puce_statut_args($id, $type) { + $id = intval($id); if ($table_objet_sql = table_objet_sql($type) - AND $d = lister_tables_objets_sql($table_objet_sql) - AND isset($d['statut_textes_instituer']) - AND $d['statut_textes_instituer']) { + and $d = lister_tables_objets_sql($table_objet_sql) + and isset($d['statut_textes_instituer']) + and $d['statut_textes_instituer'] + ) { $prim = id_table_objet($type); - $id = intval($id); - if (isset($d['field']['id_rubrique'])) + if (isset($d['field']['id_rubrique'])) { $select = "id_rubrique,statut"; - else + } else { $select = "0 as id_rubrique,statut"; + } $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); $statut = $r['statut']; $id_rubrique = $r['id_rubrique']; - } - else { - $id_rubrique = intval($id); + } else { + $id_rubrique = $id; $statut = 'prop'; // arbitraire } $puce_statut = charger_fonction('puce_statut', 'inc'); - ajax_retour($puce_statut($id,$statut,$id_rubrique,$type, true)); + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); } -?>