Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:hackathonUTC/myutc-app
- Loading branch information
Showing
11 changed files
with
204 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<head> | ||
<style> | ||
th, td | ||
{padding: 10px;} | ||
input[type="text"] | ||
{ | ||
padding:3px; | ||
border:1px solid #848484; | ||
border-radius:5px; | ||
box-shadow:1px 1px 2px #C0C0C0 inset; | ||
} | ||
.affix { | ||
top: 0; | ||
width: 100%; | ||
} | ||
.affix + .container-fluid { | ||
padding-top: 80px; | ||
} | ||
.navbar-brand { | ||
font-family: arial black; aharoni; | ||
font-size: 30; | ||
} | ||
</style> | ||
</head> | ||
<body data-spy="scroll" data-spy="affix" data-target=".navbar" style="background-color:#848484"> | ||
<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color:#FACC2E"> | ||
<div class="container-fluid"> | ||
<div class="navbar-header"> | ||
<a class="navbar-brand" style="color:#fff;text-align:left" href="index.php" class="btn btn-info" role="button">MYUTC</a> | ||
</div> | ||
<div class="col-xs-3"><a src="" type="button" class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" style="background-color:#61380B; border-color:#FACC2E">Login | ||
<span class="caret"></span> | ||
</a> | ||
<ul class="dropdown-menu"> | ||
<li><a href="#">Déconnexion</a></li> | ||
<li><a href="#">Profil</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
function mix_modules($my_modules, $every_modules){ | ||
//MIXE LES MODULES EN AJOUTANT UN ATTRIBUT "ISADDED"; => permet d'etre reutilisé | ||
$modules = array(); | ||
|
||
foreach ($every_modules as $module) { | ||
if (in_array($module, $my_modules)){ | ||
$module['isAdded'] = 1; | ||
} | ||
else $module['isAdded'] = 0; | ||
$modules[] = $module; | ||
} | ||
|
||
return $modules; | ||
} | ||
|
||
|
||
function get_modules() { | ||
//get every modules in the data base | ||
$sql = "SELECT * FROM module ORDER BY id"; | ||
$conn = new connection(); | ||
$conn->Connect(); | ||
$response = $conn->Conn->query($sql); | ||
|
||
$retour = array(); | ||
while ( $vResult = $response->fetch()) { | ||
$module = array(); | ||
$module[titre] = $vResult['titre']; | ||
$module[description] = $vResult['description']; | ||
$module[lien] = $vResult['lien']; | ||
$module[id] = $vResult['id']; | ||
$retour[] = $module; | ||
} | ||
return $retour; | ||
} | ||
|
||
|
||
function get_user_modules($login) { | ||
//get every module added by the user | ||
$sql = "SELECT * | ||
FROM module INNER JOIN menu_utilisateur | ||
ON module.id = menu_utilisateur.module | ||
WHERE menu_utilisateur.utilisateur = '".phpCAS::getUser()."';"; | ||
$conn = new connection(); | ||
$conn->Connect(); | ||
$response = $conn->Conn->query($sql); | ||
|
||
$retour = array(); | ||
while ( $vResult = $response->fetch()) { | ||
$module = array(); | ||
$module[titre] = $vResult['titre']; | ||
$module[description] = $vResult['description']; | ||
$module[lien] = $vResult['lien']; | ||
$module[id] = $vResult['id']; | ||
$retour[] = $module; | ||
} | ||
return $retour; | ||
} | ||
?> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
require_once 'check-cas-connection.php'; | ||
require_once "class/connection.php"; | ||
require_once "includes/functions.php"; | ||
|
||
|
||
|
||
|
||
//phpCAS::getUser(); | ||
|
||
//USER | ||
$my_modules = get_user_modules(phpCAS::getUser()); | ||
$every_modules = get_modules(); | ||
|
||
$modules = mix_modules($my_modules, $every_modules); | ||
|
||
display_modules($modules); | ||
|
||
function display_modules($modules) { | ||
?> | ||
<br> | ||
<br> | ||
<br> | ||
<div class="container"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<?php | ||
$n=count($modules); | ||
$i=0; | ||
while($i<$n){ | ||
write_module($modules[$i]); | ||
$i++; | ||
} ?> | ||
</table> | ||
<?php | ||
} | ||
function write_module($module){ | ||
?> | ||
<tr> | ||
<td><img src="<?php echo $module['img']; ?>" class="img-rounded" width=60% style="max-width:450px; min-width:100px" height=width></td> | ||
<td><table style="width:100%"> | ||
<thead> | ||
<tr> | ||
<th><?php echo $module['titre']; ?></th> | ||
<th><?php if ($module['isAdded']==0) { | ||
?> | ||
<button type="button" class="btn btn-success">Ajouter</button></th> | ||
|
||
<?php | ||
} | ||
else { ?> | ||
<button type="button" class="btn btn-danger">Supprimer</button></th> | ||
<?php } ?> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><?php echo $module['description'];?></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
<?php | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.