3 /* * * * * * * * * * * * * * * * * * * *
5 * - FullCalendar pour SPIP -
7 * Formulaires d'ajout et modification
9 * Auteur : Grégory PASCAL - ngombe at gmail dot com
14 function exec_fullcalendar_add(){
15 include_spip("inc/presentation");
16 // vérifier les droits
17 global $connect_statut;
18 global $connect_toutes_rubriques;
19 if ($connect_statut != '0minirezo' OR !$connect_toutes_rubriques) {
20 print _T('avis_non_acces_page');
26 # Ajout d'un calendrier
29 isset($_POST['ajouter'])
30 && $_POST['action_to_take']=='add'
31 && strlen($_POST['CalName'])
33 sql_insert("spip_fullcalendar_main","(type, nom)","(".sql_quote($_POST['CalSource']).", ".sql_quote($_POST['CalName']).")");
34 $INFO="<center><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/ok.png'> "._T('fullcalendar:calendar_add').".</center><br/>";
37 # Modification d'un calendrier
40 isset($_POST['enregistrer'])
41 && $_POST['action_to_take']=='update'
42 && strlen($_POST['CalName'])
44 sql_update('spip_fullcalendar_main', array('nom' => sql_quote($_POST['CalName'])), "id_fullcalendar=".sql_quote(intval($_POST['id_calendrier'])) );
45 $INFO="<center><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/ok.png'> "._T('fullcalendar:calendar_edit').".</center><br/>";
48 # Effacer un calendrier
51 isset($_POST['action_to_take'])
52 && $_POST['action_to_take']=='del'
53 &&isset($_POST['id_calendrier'])
54 && $_POST['id_calendrier']
56 sql_delete("spip_fullcalendar_events", "id_fullcalendar=".$_POST['id_calendrier']);
57 $INFO=_T('fullcalendar:calendar_del_events')." ".$_POST['id_calendrier']."<br/><br/>";
58 sql_delete("spip_fullcalendar_main", "id_fullcalendar=".$_POST['id_calendrier']);
59 $INFO.=_T('fullcalendar:calendar_del_events')." ".$_POST['id_calendrier']."<br/><br/>";
65 $BUTTON='<input type="submit" name="ajouter" value=" '._T('fullcalendar:add').' " class="fondo" />';
66 $SOURCE='<select name="CalSource" id="CalSource">
67 <option value="mysql">'._T('fullcalendar:source_mysql').'</option>
68 <option value="article">'._T('fullcalendar:source_art').'</option>
69 <option value="rub">'._T('fullcalendar:source_rub').'</option>
70 <option value="google">'._T('fullcalendar:source_google').'</option>
73 $TEXT=_T('fullcalendar:calendar_add');
76 # Récupère les calendriers
78 $res = sql_select('*', 'spip_fullcalendar_main');
79 $num_calendar = sql_count($res);
81 if(!$num_calendar) $INFO="
82 <b>"._T('fullcalendar:welcome_title')."</b><br/>
83 <br/>"._T('fullcalendar:welcome_text')."</center><br/>
88 $INFO.= "<center>"._T('fullcalendar:vous_avez')." ".$num_calendar." ";
89 $INFO.=($num_calendar==1)?
_T('fullcalendar:calendar'):_T('fullcalendar:calendars');
90 $INFO.="</center><br/>";
93 <script type=\"text/javascript\">
95 function EffacerCalendrier(id){
96 if(!document.getElementById) return false;
97 if(confirm('"._T('fullcalendar:calendar_del')." ?')){
98 document.Formulaire.id_calendrier.value=id;
99 document.Formulaire.action_to_take.value='del';
100 document.Formulaire.submit();
105 function ModifierCalendrier(id){
106 if(!document.getElementById) return false;
107 document.Formulaire.id_calendrier.value=id;
108 document.Formulaire.action_to_take.value='edit';
109 document.Formulaire.submit();
117 <table class='spip' style='width:100%'>
118 <tr class='row_first'>
119 <th>"._T('fullcalendar:calendar')."</th>
121 <th>"._T('fullcalendar:shortcut')."</th>
125 $icons['mysql']="<img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/mysql-24.png'>";
126 $icons['google']="<img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/google-24.png'>";
127 $icons['rub']='<img src="../prive/images/rubrique-24.gif">';
128 $icons['article']='<img src="../prive/images/mot-cle-24.gif">';
130 while ($row = sql_fetch($res)) {
132 $id = $row['id_fullcalendar'];
133 $type = $row['type'];
138 $_POST['action_to_take']=='edit'
139 && $id==$_POST['id_calendrier']
142 $BUTTON='<input type="submit" name="enregistrer" value=" '._T('bouton_enregistrer').' " class="fondo" />
143 <input type="submit" name="cancel" value=" '._T('bouton_annuler').' " class="fondo" />';
144 $SOURCE='<b>'.$type.'</b>';
147 $TEXT=_T('fullcalendar:calendar_edit');
150 $LISTE .= "<center class='formulaire_spip'><a href=\"?exec=fullcalendar_edit&id=".$id."\">".$nom."</a></center><br/>";
151 $nom = "<a href=\"?exec=fullcalendar_edit&id=".$id."\">".$nom."</a>";
153 <tr class='".$class."'>
154 <td style='text-align:center'><b>".$nom."</b></td>
155 <td style='text-align:center'>".$icon."</td>
156 <td style='text-align:center'><b><fullcalendar".$id."></b></td>
157 <td style='text-align:center;width:44px;'>
158 <a href=\"javascript:ModifierCalendrier('".$id."')\"><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/calendar_edit.png'></a>
159 <a href=\"javascript:EffacerCalendrier('".$id."')\"><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/calendar_remove.png'></a>
162 $class=($class=='row_odd')?
'row_even':'row_odd';
168 $commencer_page = charger_fonction('commencer_page', 'inc');
169 print $commencer_page(_T('fullcalendar:fullcalendar'), "", "") ;
171 print gros_titre(_T('fullcalendar:fullcalendar')." : "._T('fullcalendar:gestion_calendriers'),'',false);
172 print debut_gauche ("",true);
174 print debut_boite_info(true);
175 print "<center><b>"._T('fullcalendar:fullcalendar')."</b></center>";
176 print "<br/><center><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/fullcalendar.jpg'></center><br/>";
178 print fin_boite_info(true);
180 print debut_cadre_enfonce('',true,'','','');
181 print "<table class=\"cellule-h-table\" style=\"vertical-align: middle;\" cellpadding=\"0\"><tbody><tr>
182 <td><a href=\"?exec=cfg&cfg=fullcalendar\" class=\"cellule-h\"><span class=\"cell-i\"><img src='../plugins/cfg/cfg-22.png' alt=\"CFG : "._T('fullcalendar:configuration')."\"></span></a></td>
183 <td class=\"cellule-h-lien\"><a href=\"?exec=cfg&cfg=fullcalendar\" class=\"cellule-h\">CFG - "._T('fullcalendar:configuration')."</a></td>
184 </tr></tbody></table>";
185 print fin_cadre_enfonce(true);
187 print debut_cadre_enfonce('',true,'','','');
188 print "<table class=\"cellule-h-table\" style=\"vertical-align: middle;\" cellpadding=\"0\"><tbody><tr>
189 <td><a href=\"?exec=fullcalendar_css\" class=\"cellule-h\"><span class=\"cell-i\"><img src='"._DIR_PLUGIN_FULLCALENDAR
."prive/themes/spip/images/edit_css.png' alt=\"CSS : "._T('fullcalendar:configuration')."\"></span></a></td>
190 <td class=\"cellule-h-lien\"><a href=\"?exec=fullcalendar_css\" class=\"cellule-h\">CSS - "._T('fullcalendar:configuration')."</a></td>
191 </tr></tbody></table>";
192 print fin_cadre_enfonce(true);
195 print debut_cadre_enfonce('',true,'',_T('fullcalendar:vos_calendriers'),'');
197 print fin_cadre_enfonce(true);
200 print creer_colonne_droite('',true);
201 print debut_droite("", true);
202 print debut_cadre_trait_couleur("", true, "", $titre=_T('fullcalendar:plugin_name'),"","");
207 <div class="formulaire_spip formulaire_config">
208 <div class="cadre_padding">
209 <form action="#" name="Formulaire" method="POST">
210 <input type="hidden" name="action_to_take" value="'.$ACTION.'">
211 <input type="hidden" name="id_calendrier" value="'.$ID.'">
212 <p><label>'.$TEXT.' : <input type="text" name="CalName" style="width:60%" value="'.$NOM.'"></label></p>
213 <p><label>'._T('fullcalendar:source_select').' : '.$SOURCE.'</label>
216 <div class="boutons">'.$BUTTON.'</div>
221 # GESTION DES CALENDRIERS
224 print debut_cadre_relief("", false,"", $titre = _T('Vos calendriers'));
226 print fin_cadre_relief(false);
229 print fin_cadre_trait_couleur(true);