batiment.php 3.13 KB
Newer Older
Ayolo's avatar
Ayolo committed
1 2 3 4 5 6 7 8
<?php
/* Copyright 2006
 * - Julien Etelain < julien at pmad dot net >
 *
 * Ce fichier fait partie du site de l'Association des Étudiants de
 * l'UTBM, http://ae.utbm.fr.
 *
 * This program is free software; you can redistribute it and/or
Ayolo's avatar
Ayolo committed
9
 * modify it under the terms of the GNU General Public License a
Ayolo's avatar
Ayolo committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program 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 program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 */
 $topdir = "./";
include($topdir. "include/site.inc.php");

require_once($topdir. "include/cts/sqltable.inc.php");
require_once($topdir. "include/entities/sitebat.inc.php");
require_once($topdir. "include/entities/batiment.inc.php");
require_once($topdir. "include/entities/salle.inc.php");

$site = new site ();
$sitebat = new sitebat($site->db,$site->dbrw);
$bat = new batiment($site->db,$site->dbrw);

$bat->load_by_id($_REQUEST["id_batiment"]);
if ( $bat->id < 1 )
{
38
  $site->error_not_found("services");
mbriand's avatar
mbriand committed
39
  exit();
Ayolo's avatar
Ayolo committed
40 41 42 43 44
}
$sitebat->load_by_id($bat->id_site);

if ( $_REQUEST["action"] == "addsalle" )
{
45

mbriand's avatar
mbriand committed
46 47 48 49 50
  if ($_REQUEST["nom"] != "" && $_REQUEST["etage"]  != "")
  {
    $salle = new salle($site->db,$site->dbrw);
    $salle->add ( $bat->id, $_REQUEST["nom"], $_REQUEST["etage"], $_REQUEST["fumeur"], $_REQUEST["convention"], $_REQUEST["reservable"], $_REQUEST["surface"], $_REQUEST["tel"], $_REQUEST["notes"], $_REQUEST['bar_bdf'] );
  }
Ayolo's avatar
Ayolo committed
51 52
}

53
$site->start_page("services","Batiment ".$bat->nom);
54 55
$cts = new contents($sitebat->get_html_link()." / ".$bat->get_html_link());
$cts->add_paragraph("Site : ".$sitebat->get_html_link());
Ayolo's avatar
Ayolo committed
56 57 58 59
$cts->add_paragraph("Voir aussi : <a href=\"sitebat.php\">Autre sites</a>");

$req = new requete($site->db,"SELECT * FROM `sl_salle` WHERE `id_batiment`='".$bat->id."'");
$tbl = new sqltable(
mbriand's avatar
mbriand committed
60 61 62 63 64 65
  "listsalles",
  "Salles", $req, "batiment.php?id_batiment=".$bat->id,
  "id_salle",
  array("nom_salle"=>"Salle","etage"=>"Etage"),
  array(), array(),array()
  );
66
$cts->add($tbl,true);
Ayolo's avatar
Ayolo committed
67 68 69 70


if ( $site->user->is_in_group("gestion_ae") )
{
mbriand's avatar
mbriand committed
71 72 73 74 75 76 77 78 79 80 81 82 83
  $frm = new form("newsalle","batiment.php?id_batiment=".$bat->id,true,"POST","Nouvelle salle");
  $frm->add_hidden("action","addsalle");
  $frm->add_text_field("nom","Nom","",true);
  $frm->add_text_field("etage","Etage","",true);
  $frm->add_checkbox("fumeur","Fumeur",$bat->fumeur);
  $frm->add_checkbox("convention","Convention de locaux",$bat->convention);
  $frm->add_checkbox("bar_bdf","La salle contient un bar géré par le BDF",false);
  $frm->add_checkbox("reservable","Reservable");
  $frm->add_text_field("surface","Surface");
  $frm->add_text_field("tel","Téléphone");
  $frm->add_text_area("notes","Notes");
  $frm->add_submit("valid","Ajouter");
  $cts->add($frm,true);
Ayolo's avatar
Ayolo committed
84 85 86
}
$site->add_contents($cts);
$site->end_page();
87
exit();
Ayolo's avatar
Ayolo committed
88
?>