Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU General Public                                                  |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | General Public License for more details.                                                             |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public                                            |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: forums-lst.php,v 1.1 2005-09-22 14:02:48 ddelon Exp $
/**
* Application détail d'un forum
*
* Fichier d'appel pour papyrus
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.1 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

include_once PROJET_CHEMIN_APPLI.'forums.functions.php' ;
define ('PROJET_CHEMIN_IMAGES', 'client/projet/images/') ;
/* DEBUT APPLI */

function putFrame () {
  /* Inclusion des paramètres généraux spécifiques au programme */

  include_once PROJET_CHEMIN_APPLI.'forums.param.php' ;


  /* Global des variables */


  if (isset($_GET['forum'])) $forum = $_GET['forum'];
  else $forum = "";

  global $sel_rub;


  /* initialisation des variables */

  if (!empty($GS_ARGUMENTS['sel_rub'])) $sel_rub = $GS_ARGUMENTS['sel_rub'];
  
  $sous_titre = "";
  $sel_query = "";
  $sel_from = "";

  $ret = "<!-- DEBUT -->\n\n";
  $ret .= "<div>";
  $ret .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" summary=\"\">";

  // formatage des colonnes
  $ret .= "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";

  /* ligne de titre */
  
  $ret .= "<tr><td colspan=\"2\" align=\"center\" class=\"insMsg\">\n";

  if (isset($forum)&&($forum != ""))
    {
    $ret .= "D&eacute;tail du forum $forum";

    $query = "select * from ".$tbl['forums']." where AGO_A_NOMGRP like '$forum'";
    $result = mysql_query($query) or die ("Erreur de query : $query");
    $num = mysql_num_rows($result);

    if ($num != 1)
      {
      die("<B>ERREUR dans la requête</B> : $query retourne $num.");
      }

    else
      {
      $row = mysql_fetch_object($result);

      $left_image['id'] = $row->AGO_A_IMAGE;
      $left_image['image'] = "";
      $left_image['alt'] = "";

      $id_grp = $row->AGO_A_ID;
      $nomgrplg = $row->AGO_A_NOMGRPLG;
      $nomgrp = $row->AGO_A_NOMGRP;
      $alias = $row->AGO_A_ALIAS;
      $date_creation = $row->AGO_A_DATE_CREATION;
      $date_ajout = $row->AGO_A_DATE_AJOUT;
      $mailabo = $row->AGO_A_MAILABO;
      $mailsend = $row->AGO_A_MAILSEND;
      $maildesa = $row->AGO_A_MAILDESA;
      $urlgrp = $row->AGO_A_URLGRP;
      $resum = $row->AGO_A_RESUM;
      $resumlg = $row->AGO_A_RESUMLG;
      $mode_n = $row->AGO_A_MODERATEUR_N;
      $mode_e = $row->AGO_A_MODERATEUR_E;
      $prop_n = $row->AGO_A_PROP_N;
      $prop_e = $row->AGO_A_PROP_E;
      $cekoi = $row->AGO_A_CEKOI;
      $grptype = $row->AGO_A_GRPTYPE;
      $public = $row->AGO_A_PUBLIC;
      $modere = $row->AGO_A_MODERE;
      $grp_tb = $row->AGO_A_GRP_TB;
      $plusinfo = $row->AGO_A_PLUSINFO;
      $helper = $row->AGO_A_HELPER;
      $nb_adherents = $row->AGO_A_NB_ADH;
      $nb_messages = $row->AGO_A_NB_MES;

      mysql_free_result($result);
      }
    }

  else
    {
    if (isset($sel_rub) && ($sel_rub != ""))
      {
      $query_c = "select * from ".$tbl['forums_cat']." where AGO_CAT_IDCAT = '$sel_rub'";
      $resu_c = mysql_query($query_c) or die ("<B>Erreur de query :</B> $query_c");
      $nb_c = mysql_num_rows($resu_c);

      if ($nb_c != 1)
        {
        die("<B>ERREUR dans la requête</B> : $query_c retourne $nb_c.");
        }

      else
        {
        $row_c = mysql_fetch_object($resu_c);

        $sous_titre = $row_c->AGO_CAT_TITRE;
        $left_image['id'] = $row_c->AGO_CAT_IMAGE;
        $left_image['image'] = "";
        $left_image['alt'] = "";
        }

      mysql_free_result($resu_c);

      $sel_from = ", ".$tbl['forums_cat'].", ".$tbl['forums_join'];
      $sel_query = "AND AGO_CAT_IDCAT = '$sel_rub' AND (AGO_A_ID = AGO_J_IDFORUM) AND (AGO_J_IDCATEG = AGO_CAT_IDCAT)";
      }

    $ret .= "Liste des forums";
    if ($sous_titre != "") $ret .= " &quot;$sous_titre&quot;";
    }

  $ret .= "</td></tr>";

  $ret .= "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n";

  /* fin de la ligne de titre */


  /* ouverture de la ligne contenu */

  $ret .= "<tr>";

  /* ouverture de la colonne de gauche (placer une image) ; il s'agit de $left_image */

  $ret .= '<td width="125" valign="top">';

  get_image(&$left_image);

  $ret .= '<img src="'.PROJET_CHEMIN_IMAGES.$left_image['image'].'" width="100" height="100" alt="'.$left_image['alt'].'" />'."\n"; 

  $ret .= "</td>";

  /* fin de la colonne de gauche */


  /* colonne de droite */

  $ret .= "<td>";

  if ($forum != "")
    {
    /* ********** Affichage du détail d'un forum ************ */

    $ret .= "<table summary=\"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";

    $ret .= "<tr><td>";
    $ret .= '<hr size="1" />';

    if ($plusinfo != "")
      {
      $ret .= "$plusinfo";
      $ret .= '<hr size="1" />';
      }

    $ret .= "<b>Nom complet :</b> $nomgrplg";
    if (($alias != "")&&($alias != $nomgrplg)) $ret .= " (<i>alias</i> $alias)";

    /* Ici on met le résumé court */

    if ($resum != "") $ret .= "<br /><b>Description :</b> $resum";

    /* Ici on met la date de création de la liste si l'info est connue */

    if ($date_creation != "")
      {
      $ret .= "<br /><b>Date de création :</b> ";
      $var_date = explode("-",$date_creation);
      $yr = $var_date[0];
      $mt = $var_date[1];
      $day = $var_date[2];
      $ret .= "$day/$mt/$yr";
      }

    $ret .= '<hr size="1" />';

    if ($nb_adherents > 0) $ret .= "<b>Nombre d'abonnés :</b> $nb_adherents";
    if (($nb_adherents > 0)&&($nb_messages > 0)) $ret .= "<br />";
    if ($nb_messages > 0) $ret .= "<b>Nombre de messages :</b> $nb_messages";

    if (($nb_adherents > 0)||($nb_messages > 0)) $ret .= '<hr size="1" />';

    $ret .= "</td></tr>";

    /* Ici on met le résumé long */

    if ($resumlg != "")
      {
      $ret .= "<tr><td>";
      $ret .= "<b>Résumé :</b> $resumlg";
      $ret .= '<hr size="1" />';
      $ret .= "</td></tr>";
      }

    /* Ici on met les adresses mails de la liste */

    if ($urlgrp == "http://") $urlgrp = "";

    if (($mailabo != "")||($mailsend != "")||($maildesa != "")||($urlgrp != ""))
      {
      $ret .= "<tr><td>";
      if ($mailabo != "") $ret .= "<b>Abonnement :</b> <a href=\"mailto:$mailabo\">$mailabo</a>";
      if (($mailabo != "")&&($mailsend != "")) $ret .= "<br />";
      if ($mailsend != "") $ret .= "<b>Envoyer un message :</b> <a href=\"mailto:$mailsend\">$mailsend</a>";
      if (($mailsend != "")&&($maildesa != "")) $ret .= "<br />";
      if ($maildesa != "") $ret .= "<b>Désabonnement :</b> <a href=\"mailto:$maildesa\">$maildesa</a>";

      /* Ici on met l'URL */

      if ($urlgrp != "") $ret .= "<br /><b>Adresse web :</b> <a href=\"$urlgrp\" target=\"_blank\">$urlgrp</a>";

      $ret .= '<hr size="1" />';
      $ret .= "</td></tr>";
      }

    /* Ici on met les infos de propriétaire et de modérateur */

    if ($mode_n == "Anonyme") $mode_n = "";
    if ($mode_e == "Anonyme") $mode_e = "";
    if ($prop_n == "Anonyme") $prop_n = "";
    if ($prop_e == "Anonyme") $prop_e = "";

    if (($mode_n != "")||($mode_e != "")||($prop_n != "")||($prop_e != ""))
      {
      $ret .= "<tr><td>";

      if (($mode_n != "")&&($mode_e != "")) $mode_aff = "<a href=\"mailto:$mode_e\">$mode_n</a>";
      else if (($mode_n == "")&&($mode_e != "")) $mode_aff = "<a href=\"mailto:$mode_e\">$mode_e</a>";
      else if (($mode_n != "")&&($mode_e == "")) $mode_aff = "$mode_n";
      else $mode_aff = "";

      if (($prop_n != "")&&($prop_e != "")) $prop_aff = "<a href=\"mailto:$prop_e\">$prop_n</a>";
      else if (($prop_n == "")&&($prop_e != "")) $prop_aff = "<a href=\"mailto:$prop_e\">$prop_e</a>";
      else if (($prop_n != "")&&($prop_e == "")) $prop_aff = "$prop_n";
      else $prop_aff = "";

      if ($mode_aff != "") $ret .= "<b>Modérateur :</b> $mode_aff";
      if (($mode_aff != "")&&($prop_aff != "")) $ret .= "<br />";
      if ($prop_aff != "") $ret .= "<b>Propriétaire :</b> $prop_aff";

      $ret .= '<hr size="1" />';
      $ret .= "</td></tr>";
      }

    /* Ici on met la typologie des forums */

    $ret .= "<tr><td>";

    $ret .= "<b>Type :</b> ".ucfirst($cekoi)." de ".ucfirst($grptype)."<br />";

    if ($public == 1) $public = "Public";
    else $public = "Privé";

    if ($modere == 1) $modere = "Modéré";
    else $modere = "Non modéré";

    $ret .= "<b>Statut :</b> $public - $modere";

    $ret .= '<hr size="1" />';
    $ret .= "</td></tr>";

    /* Ici on met le plus important ! */

    if ($grp_tb == 1) $grp_tb = "Créé et géré par Tela Botanica.";
    else $grp_tb = "Ce forum n'est pas géré par Tela Botanica.";

    $ret .= "<tr><td align=\"right\">";
    $ret .= "$grp_tb";
    $ret .= "</td></tr>";

    $ret .= "</table>";

    /* ********** Fin Affichage forum ************ */
    }

  else
    {
    /* ********** Affichage de la liste des forums, avec éventuellement un raffinement par catégorie ************ */

    $query = "select AGO_A_NOMGRP, AGO_A_NOMGRPLG, AGO_A_ALIAS, AGO_A_DATE_AJOUT, AGO_A_RESUM, AGO_A_GRP_TB from ".$tbl['forums']." $sel_from where AGO_A_VISIBLE = 1 $sel_query ORDER BY AGO_A_PRIORITE, AGO_A_NOMGRP";
    $result = mysql_query($query) or die ("Erreur de query : $query");

    $num = mysql_num_rows($result);
    if ($num > 1) $pluriel = "s";
    $ret .= "<b>$num</b> résultat$pluriel :<br /><br />\n";

    while ($row = mysql_fetch_object($result))
      {
      $nomgrp = $row->AGO_A_NOMGRP;
      $nomgrplg = $row->AGO_A_NOMGRPLG;
      $alias = $row->AGO_A_ALIAS;
      $date_ajout = $row->AGO_A_DATE_AJOUT;
      $resum = $row->AGO_A_RESUM;
      $grp_tb = $row->AGO_A_GRP_TB;

      if ($alias == "") $what_aff = "$nomgrp";
      else $what_aff = "$alias";

      if ($grp_tb == '1') $ret .= "<img src=\"Local/".$GS_GLOBAL['project']."/".$GS_GLOBAL['locale']."/feuille20-16.gif\" width=\"20\" height=\"16\" alt=\"\"> \n";
      else $ret .= "<img src=\"Local/".$GS_GLOBAL['project']."/".$GS_GLOBAL['locale']."/feuille20-16r.gif\" width=\"20\" height=\"16\" alt=\"\"> \n";

      $ret .= "<b><a href=\"Javascript:openDocumentPopup ('".$GS_GLOBAL['project']."', '".$GS_GLOBAL['locale']."', 'pop-forums-info', '".$GS_GLOBAL['set']."', '&forum=$nomgrp&arg_0=forum%3D$nomgrp&amp;arg_1=forum%3D$nomgrp', 780, 450)\">$what_aff</a></B>\n\n";
      if ($alias != "") $ret .= " ($nomgrp)";

      /* calcul qui affiche "nouveau" si le forum a moins d'un certain temps */
      $how_long_stp = $how_long * 24 * 60 * 60;

      $today_is = time();
      if (($date_ajout+$how_long_stp)>=$today_is) $ret .= " <img src=\"Local/".$GS_GLOBAL['project']."/".$GS_GLOBAL['locale']."/nouveau.gif\" alt=\"\">\n";

      $ret .= "<br />$resum";

      $ret .= "<br /><br />";
      }


    $ret .= "</td></tr>\n";
    $ret .= "<tr><td colspan=\"2\" valign=\"top\">\n";
    $ret .= '<hr size="1" />';
    $ret .= "<img src=\"Local/".$GS_GLOBAL['project']."/".$GS_GLOBAL['locale']."/feuille20-16.gif\" width=\"20\" height=\"16\" alt=\"\" /> forum Tela Botanica<br />\n";
    $ret .= "<img src=\"Local/".$GS_GLOBAL['project']."/".$GS_GLOBAL['locale']."/feuille20-16r.gif\" width=\"20\" height=\"16\" alt=\"\" /> forum ind&eacute;pendant\n";

    /* *************** Fin affichage liste ***************** */
    }


  /* fin de la colonne d'information */

  $ret .= "</td>";

  /* fin de la ligne d'information */

  $ret .= "</tr>";

  $ret .= "</table>\n";
  $ret .= "</div>\n";
  $ret .= "<!-- FIN -->";

  return $ret;
  }

?>