batiment.php 2.99 KB
Newer Older
Ayolo's avatar
Ayolo committed
1 2 3 4 5 6 7 8 9 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
<?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
 * modify it under the terms of the GNU General Public License as
 * 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();
Ayolo's avatar
Ayolo committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
	exit();
}
$sitebat->load_by_id($bat->id_site);

if ( $_REQUEST["action"] == "addsalle" )
{
	
	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"] );
	}
}

$site->start_page("none","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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
$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(
	"listsalles", 
	"Salles", $req, "batiment.php?id_batiment=".$bat->id, 
	"id_salle", 
	array("nom_salle"=>"Salle","etage"=>"Etage"), 
	array(), array(),array()
	);	
$cts->add($tbl,true); 


if ( $site->user->is_in_group("gestion_ae") )
{
	$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("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);
}
$site->add_contents($cts);
$site->end_page();
exit();	
?>