agencePrincipaleList.php 4.5 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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
<?php
session_start();
if(!isset($_SESSION['auth'])) {
	header("location:index.php");
}

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

$filter = $specificTitle = "";
$values =array();
if(isset($_REQUEST['sid'])){
	$filter = " AND ap.id_secteur=:id_secteur";
	$values[':id_secteur'] = intval($_REQUEST['sid']);
}
$DATA = "";
$q = "SELECT ap.id_agence_principale, ap.nom_agence_principale, s.nom_secteur,(SELECT count(id_agence) FROM ca_agences WHERE id_agence_principale = ap.id_agence_principale) as nbAgences
FROM ca_agence_principales ap
LEFT JOIN ca_secteurs s ON s.id_secteur = ap.id_secteur
WHERE ap.supp IS NULL".$filter." ORDER BY ap.nom_agence_principale ASC";
// echo $q;
$result = excuteQuery($q, $values);
$r = $result['stmt'];
while($o = $r->fetchObject()) {
	$DATA .= "<tr>\r\n<td>".$o->nom_agence_principale."</td>\r\n<td>".$o->nom_secteur."</td>\r\n<td><a href='agcList.php?apid=".$o->id_agence_principale."'>Gérer(".$o->nbAgences.")</a></td>";
	$DATA .= "\r\n<td><a href='agencePrincipaleUpd.php?apid=".$o->id_agence_principale."' >Editer</a></td>";

	if($filter){
		$specificTitle = " du secteur : <span class='agcTitle'>".$o->nom_secteur."</span>";
	}
}

?>

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><?php echo $PROJECT_TITLE;?> : Liste des agences principales</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">
	$(document).ready( function () {

		oTable = $('#AdminsDataTable').dataTable( {
			"bJQueryUI": true,
			"sPaginationType": "full_numbers",
			"sDom": '<"H"Tfr>t<"F"ip>',

			"oTableTools": {
				"sSwfPath": "./swf/copy_csv_xls_pdf.swf",
				"aButtons": [{"sExtends":    "xls","sButtonText": "Excel"},{"sExtends":    "pdf","sButtonText": "PDF"}]
			},
			"oLanguage": {
				"sProcessing":     "Traitement en cours...",
				"sLengthMenu":     "Afficher _MENU_ &eacute;l&eacute;ments",
				"sZeroRecords":    "Aucun &eacute;l&eacute;ment &agrave; afficher",
				"sInfo":           "Affichage : _START_ &agrave; _END_ sur _TOTAL_ &eacute;l&eacute;ments",
				"sInfoEmpty":      "Affichage de l'&eacute;lement 0 &agrave; 0 sur 0 &eacute;l&eacute;ments",
				"sInfoFiltered":   "(filtr&eacute; de _MAX_ &eacute;l&eacute;ments au total)",
				"sInfoPostFix":    "",
				"sSearch":         "Rechercher&nbsp;/&nbsp;Filtrer&nbsp;:",
				"sLoadingRecords": "T&#233;l&#233;chargement...",
				"sUrl":            "",
				"oPaginate": {
					"sFirst":    "Premier",
					"sPrevious": "Pr&eacute;c&eacute;dent",
					"sNext":     "Suivant",
					"sLast":     "Dernier"
				}
			}


		});

	});
	</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">
					Liste des agences principales<?php echo $specificTitle;?>
				</div>
				<div>
					<?php if(in_array("add_all_agences",$_SESSION['permissions'])) { ?>
						<a href='agencePrincipaleNew.php' class='formNav2'><i class="fa fa-plus-circle" style="color:#ED1B2F;font-size:150%"></i> <span style="color:#ED1B2F;">Cr&#233;er une nouvelle agence principale</span></a><br/><br/>
					<?php } ?>
				</div>
				<div id="list">
					<table cellpadding="0" cellspacing="0" border="0" class="display" id="AdminsDataTable">
						<thead>
							<tr>
								<td>Nom</td>
								<td>Secteur</td>
								<td>Agences</td>
								<td>Actions</td>
							</tr>
						</thead>
						<tbody>
							<?php
							echo $DATA;
							?>
						</tbody>

					</table>

					<br/>

				</div>

			</div>

			<?php include 'footer.php';?>


		</body>

		</html>