poleUpd.php 4.12 KB
Newer Older
Hamza Arfaoui's avatar
Hamza Arfaoui 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
<?php
session_start();
if(!isset($_SESSION['auth'])) {
	header("location:index.php");
}

require_once("../inc/confNetisse.php");
require_once("./functions.php");

$PID = 0;
if(!isset($_GET["pid"])) {
	header("location:poleList.php");
} else {
	$PID = intval($_GET["pid"]);
}
$pole = getPoleByID($PID);
if($pole == null) header("location:poleList.php");
?>

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><?php echo $PROJECT_TITLE;?> : Edition d'un pôle</title>
	<link rel="stylesheet" href="css/font-awesome.min.css" />
	<link rel="stylesheet" type="text/css" href="css/cadif.css" />
	<link rel="stylesheet" type="text/css" href="css/dashboard.css" />
	<link rel="stylesheet" type="text/css" href="css/cans/jquery-ui-1.8.17.custom.css" />
	<!--<link rel="stylesheet" type="text/css" href="css/tableTools_jui.css" />-->
	<link rel="stylesheet" type="text/css" href="css/datatable_jui.css" />

	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
	<script type="text/javascript" src="js/jquery.dataTables.js"></script>
	<script type="text/javascript">
		function delPole() {
			if (confirm("Etes-vous sûr de vouloir supprimer ce pôle ?")) {
				document.getElementById("supp").value = 1;
				document.formAgencyUpd.submit();
			} else {
				document.getElementById("supp").value = 0;
			}

		}

		function checkForm() {
			if (document.getElementById("nom").value == "") {
				var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Nom'.</center>").dialog({autoOpen: false,title: 'Erreur'});
				POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("nom").focus();} });
				POP.dialog("open");
			} else if (document.getElementById("dsa").value == 0) {
				var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'DSA'.</center>").dialog({autoOpen: false,title: 'Erreur'});
				POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("dsa").focus();} });
				POP.dialog("open");
			} else {
				document.formAgencyUpd.submit();
			}
		}
		function addGrappe(){
			window.location.href = "grappeNew.php?pid=<?php echo $PID;?>";
		}
	</script>
</head>


<body>

	<div id="global">

		<div id="home">
			<div id="logo"><a href="dashboard.php"><img src="<?php echo $SERVER; ?>assets/img/logo.png" height="110" border="0"/></a></div>
			<div id="username">
				<b><?php echo isset($_SESSION["nom"]) ? $_SESSION["nom"] : $_SESSION["matricule"];?></b> &nbsp; | &nbsp; <a href="close.php" class="link" title="Fermer et clore votre session">D&#233;connexion</a>
				<br/>
			</div>
		</div>
		<div id="panels">
			<?php include "menu.php";?>
			<div class="main-content">
				<div id="title">
					Edition d'un pôle
				</div>
				<div id="form">
		<form name="formAgencyUpd" id="formAgencyUpd" action="do.php" method="post">
			<input type="hidden" name="act" value="poleUpd"/>
			<input type="hidden" name="pid" value="<?php echo $PID; ?>"/>
			<input type="hidden" name="supp" id="supp" value="0"/>

			<table align="center" class="form">
			<tr>
			<td>DSA</td>
			<td><select name="dsa" id="dsa" tabindex="2"><option value="">-- Sélectionnez un DSA --</option><?php echo getDSAs($pole->id_dsa);?></select></td>
			</tr>
			<tr>
			<td width="100">Nom du pôle</td>
			<td><input type="text" name="nom" id="nom" size="30" tabindex="1" value="<?php echo $pole->nom_pole; ?>"/></td>
			</tr>
			<tr>
			<td colspan="2">
				<br/><br/>
				<input type="button" class="formAct" name="supprimer" id="supprimer" value="Supprimer" onclick="delPole();" tabindex="9"/>
				&nbsp;&nbsp;<input type="button" class="formAct" name="valider" id="valider" value="Valider" onclick="checkForm();" tabindex="8"/>
				&nbsp;&nbsp;<input type="button" class="formAct2" name="ajouter" id="ajouter" value="Ajouter une grappe" onclick="addGrappe();" tabindex="9"/></td>
			</tr>
			</table>
		</form>
		</div>
	</div>

</div>

			<?php include 'footer.php';?>
<script>
document.getElementById('nom').focus();
</script>

</body>

</html>