7 |
jpm |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU Lesser General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | Lesser General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: adme_contenu.fonct.php,v 1.1 2004-06-16 15:04:32 jpm Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Gestion de la rédaction du contenu pour Papyrus.
|
|
|
25 |
*
|
|
|
26 |
* Contient les fonctions nécessaires à la gestion du contenu de Papyrus.
|
|
|
27 |
*
|
|
|
28 |
*@package Administrateur des Menus
|
|
|
29 |
*@subpackage Fonctions
|
|
|
30 |
//Auteur original :
|
|
|
31 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
32 |
//Autres auteurs :
|
|
|
33 |
*@author Aucun
|
|
|
34 |
*@copyright Tela-Botanica 2000-2004
|
|
|
35 |
*@version $Revision: 1.1 $ $Date: 2004-06-16 15:04:32 $
|
|
|
36 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
*/
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | ENTÊTE du PROGRAMME |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
/*Mettre ici les inclusions de fichiers*/
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
46 |
// | LISTE de FONCTIONS |
|
|
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
48 |
/** Fonction redigerContenu() - Affiche le formulaire de rédaction
|
|
|
49 |
*
|
|
|
50 |
*
|
|
|
51 |
* @return string Le HTML
|
|
|
52 |
*/
|
|
|
53 |
function redigerContenu($db, $adminProject, $adminLocale, $baseURL, $baseURLjs, $baseHidden,
|
|
|
54 |
$menuid, $docid, $pageid, $menuopen, $docopen, $pageopen)
|
|
|
55 |
{
|
|
|
56 |
//----------------------------------------------------------------------------
|
|
|
57 |
// Initialisation de variable
|
|
|
58 |
$closeURL = $baseURL.'&menuid='.$menuid.'&menuopen='.$menuopen;
|
|
|
59 |
|
|
|
60 |
//----------------------------------------------------------------------------
|
|
|
61 |
// Récupération des informations du contenu concerné.
|
|
|
62 |
$ligne_menu = GEN_lireInfoMenu($db, $menuid, DB_FETCHMODE_ASSOC);
|
|
|
63 |
if ($ligne_menu == false) {
|
|
|
64 |
die('ERREUR Génésia Administrateur de Menus: impossible de lire les infos du menu.<br />'.
|
|
|
65 |
'Idenitifiant du menu n° : '. $menuid .'<br />'.
|
|
|
66 |
'Ligne n° : '. __LINE__ .'<br />'.
|
|
|
67 |
'Fichier n° : '. __FILE__ .'<br />');
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
// Requête sur les applications
|
|
|
71 |
$requete = 'SELECT * '.
|
|
|
72 |
'FROM gen_menu_contenu '.
|
|
|
73 |
'WHERE gmc_ce_menu = '.$menuid.' '.
|
|
|
74 |
'AND gmc_bool_dernier = 1 ';
|
|
|
75 |
$resultat = $db->query($requete);
|
|
|
76 |
$ligne_dernier_contenu = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
77 |
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
$res = '<h1>'.'Rédaction'.'</h1>'."\n";
|
|
|
81 |
//----------------------------------------------------------------------------
|
|
|
82 |
// Création du formulaire
|
|
|
83 |
$form =& new HTML_QuickForm('updform', 'post', $baseURLjs);
|
|
|
84 |
$squelette =& $form->defaultRenderer();
|
|
|
85 |
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<ul>'."\n".'{content}'."\n".'</ul>'."\n".'</form>'."\n");
|
|
|
86 |
$squelette->setElementTemplate( '<li>'."\n".
|
|
|
87 |
'{label}'."\n".
|
|
|
88 |
'{element}'."\n".
|
|
|
89 |
'<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
|
|
|
90 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
|
|
91 |
'</li>'."\n");
|
|
|
92 |
//$squelette->setHeaderTemplate('<p>{header}</p>');
|
|
|
93 |
//$form->addElement('header', 'Entete', 'REDACTION');
|
|
|
94 |
$tab_type_contenu = array();
|
|
|
95 |
$tab_type_contenu[1] = 'XHTML';
|
|
|
96 |
$tab_type_contenu[2] = 'WIKINI';
|
|
|
97 |
$form->addElement('select', 'gmc_ce_type_contenu', 'Type de contenu : ', $tab_type_contenu);
|
|
|
98 |
$zone_redaction = $form->createElement('textarea', 'gmc_contenu', 'Contenu : ');
|
|
|
99 |
$zone_redaction->setCols(100);
|
|
|
100 |
$zone_redaction->setRows(20);
|
|
|
101 |
$form->addElement($zone_redaction);
|
|
|
102 |
$tab_type_modif = array();
|
|
|
103 |
$tab_type_modif[1] = 'Mineure';
|
|
|
104 |
$tab_type_modif[2] = 'Majeure';
|
|
|
105 |
$form->addElement('select', 'gmc_ce_type_modification', 'Type de modification : ', $tab_type_modif);
|
|
|
106 |
$form->addElement('text', 'gmc_resume_modification', 'Resumé modification : ');
|
|
|
107 |
|
|
|
108 |
$bouton_validation = '<input type="submit" value="'.'Enregistrer'.'" title="'.'Enregistrer'.'" />';
|
|
|
109 |
$bouton_annuler = '<a class="bouton" href="'.$closeURL.'" title="'.'Annuler'.'" >'.'Annuler'.'</a>';
|
|
|
110 |
$boutons = '<p>'."\n".
|
|
|
111 |
$bouton_validation."\n".
|
|
|
112 |
$bouton_annuler."\n".
|
|
|
113 |
'</p>'."\n";
|
|
|
114 |
$form->addElement('html', $boutons);
|
|
|
115 |
$form->addElement('html', $baseHidden);
|
|
|
116 |
$form->addElement('hidden', 'menuid', $menuid);
|
|
|
117 |
$form->addElement('hidden', 'docid', $docid);
|
|
|
118 |
$form->addElement('hidden', 'pageid', $pageid);
|
|
|
119 |
$form->addElement('hidden', 'menuopen', $menuopen);
|
|
|
120 |
$form->addElement('hidden', 'docopen', $docopen);
|
|
|
121 |
$form->addElement('hidden', 'pageopen', $pageopen);
|
|
|
122 |
$form->addElement('hidden', 'doccmd', 'contenuenreg');
|
|
|
123 |
$form->setDefaults($ligne_dernier_contenu);
|
|
|
124 |
|
|
|
125 |
$res .= $form->toHTML()."\n";
|
|
|
126 |
return $res;
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
/** Fonction ajouterContenu() - Enregistre les infos du formulaire de saisie d'un menu
|
|
|
130 |
*
|
|
|
131 |
*
|
|
|
132 |
* @return void les données sont enregistrées dans la base de données.
|
|
|
133 |
*/
|
|
|
134 |
function ajouterContenu($db, $adminProject, $adminLocale, $menuid, $tab_valeur)
|
|
|
135 |
{
|
|
|
136 |
global $_GEN_commun;
|
|
|
137 |
|
|
|
138 |
//----------------------------------------------------------------------------
|
|
|
139 |
// Mise à jour de l'ancien contenu du menu
|
|
|
140 |
$requete = 'UPDATE gen_menu_contenu SET '.
|
|
|
141 |
'gmc_bool_dernier = 0 '.
|
|
|
142 |
'WHERE gmc_ce_menu = '.$menuid;
|
|
|
143 |
$result = $db->query($requete);
|
|
|
144 |
(DB::isError($result)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $result->getMessage(), $requete)) : '';
|
|
|
145 |
//----------------------------------------------------------------------------
|
|
|
146 |
// Obtention d'un nouvel identifiant de contenu
|
|
|
147 |
$nouveau_id_contenu = SQL_obtenirNouveauId($db, 'gen_menu_contenu', 'gmc_id_contenu');
|
|
|
148 |
|
|
|
149 |
//----------------------------------------------------------------------------
|
|
|
150 |
// Ajout du nouveau contenu pour ce menu
|
|
|
151 |
$requete = 'INSERT INTO gen_menu_contenu SET '.
|
|
|
152 |
'gmc_id_contenu = '.$nouveau_id_contenu.', '.
|
|
|
153 |
'gmc_ce_admin = '.$_GEN_commun['pear_auth']->getAuthData('ga_id_administrateur').', '.
|
|
|
154 |
'gmc_ce_menu = '.$menuid.', '.
|
|
|
155 |
'gmc_ce_type_contenu = '.$tab_valeur['gmc_ce_type_contenu'].', '.
|
|
|
156 |
'gmc_contenu = "'.$tab_valeur['gmc_contenu'].'", '.
|
|
|
157 |
'gmc_ce_type_modification = '.$tab_valeur['gmc_ce_type_modification'].', '.
|
|
|
158 |
'gmc_resume_modification = "'.$tab_valeur['gmc_resume_modification'].'", '.
|
|
|
159 |
'gmc_date_modification = "'.date('Y-m-d H:i:s').'", '.
|
|
|
160 |
'gmc_bool_dernier = 1';
|
|
|
161 |
|
|
|
162 |
$result = $db->query($requete);
|
|
|
163 |
(DB::isError($result)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $result->getMessage(), $requete)) : '';
|
|
|
164 |
}
|
|
|
165 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
166 |
// | PIED du PROGRAMME |
|
|
|
167 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
168 |
/*Partie non obligatoire*/
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
172 |
*
|
|
|
173 |
* $Log: not supported by cvs2svn $
|
|
|
174 |
* Revision 1.5 2004/05/07 16:32:27 jpm
|
|
|
175 |
* Modification des commentaires.
|
|
|
176 |
*
|
|
|
177 |
* Revision 1.4 2004/05/07 07:23:53 jpm
|
|
|
178 |
* Amélioration du code, des commentaires et correction de bogues.
|
|
|
179 |
*
|
|
|
180 |
* Revision 1.3 2004/05/04 16:27:55 jpm
|
|
|
181 |
* Amélioration gestion du déplacement des menus.
|
|
|
182 |
*
|
|
|
183 |
* Revision 1.2 2004/05/03 14:51:59 jpm
|
|
|
184 |
* Normalisation du nom d'une fonction et ajout de la gestion d'une erreur.
|
|
|
185 |
*
|
|
|
186 |
* Revision 1.1 2004/04/30 16:21:30 jpm
|
|
|
187 |
* Ajout de la rédaction de contenu.
|
|
|
188 |
*
|
|
|
189 |
*
|
|
|
190 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
191 |
*/
|
|
|
192 |
?>
|