コード例 #1
0
ファイル: forum_sessions.php プロジェクト: fferriere/web
 $commentaires = $forum_appel->obtenirCommentairesPourSession($_GET['id']);
 if (is_array($commentaires)) {
     foreach ($commentaires as $commentaire) {
         $formulaire->addElement('static', 'id_commentaire_' . $commentaire['id'], date('d/m/Y h:i', $commentaire['date']), $commentaire['commentaire'] . '<br /><br /><em>' . $commentaire['nom'] . ' ' . $commentaire['prenom'] . '</em>');
     }
 }
 require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Configuration.php';
 $conf = $GLOBALS['AFUP_CONF'];
 $formulaire->addElement('header', null, 'Nouveau commentaire');
 $formulaire->addElement('textarea', 'commentaire', 'Commentaire', array('cols' => 40, 'rows' => 15, 'class' => 'tinymce'));
 $formulaire->addElement('header', 'boutons', '');
 $formulaire->addElement('submit', 'soumettre', 'Soumettre');
 $formulaire->addElement('submit', 'passer', 'Passer');
 if (isset($_POST['passer'])) {
     $url = 'index.php?page=forum_sessions&action=lister';
     if ($id_next = $forum_appel->obtenirSessionSuivanteSansCommentaire($id_forum, $droits->obtenirIdentifiant())) {
         $url = 'index.php?page=forum_sessions&action=commenter&id=' . $id_next . '&id_forum=' . $id_forum;
     }
     afficherMessage('Direction une autre session sans commentaire', $url);
 } elseif ($formulaire->validate()) {
     $identifiant = $droits->obtenirIdentifiant();
     $valeurs = $formulaire->exportValues();
     if (!empty($valeurs['commentaire'])) {
         $ok = $forum_appel->ajouterCommentaire($id, $identifiant, $valeurs['commentaire'], time(), 0);
         if ($ok) {
             AFUP_Logs::log('Ajout d\'un commentaire sur la session n°' . $formulaire->exportValue('id'));
             $url = 'index.php?page=forum_sessions&action=lister';
             if ($id_next = $forum_appel->obtenirSessionSuivanteSansCommentaire($id_forum, $droits->obtenirIdentifiant())) {
                 $url = 'index.php?page=forum_sessions&action=commenter&id=' . $id_next . '&id_forum=' . $id_forum;
             }
             afficherMessage('Un commentaire sur la session n°' . $formulaire->exportValue('id') . ' a été ajouté', $url);