Skip to content

Commit

Permalink
page add
Browse files Browse the repository at this point in the history
  • Loading branch information
machine62 committed Oct 29, 2018
1 parent 6cf9b65 commit 9aa84d4
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 36 deletions.
47 changes: 47 additions & 0 deletions js/jsadd.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
if (!defined('IN_SPYOGAME')) die("Hacking attempt");
?>
<script language="JavaScript">
$(document).ready(function(){
$(".Filtre_status").click(function(){
var status = $(this).attr('data-status');
hideornot(this,status);
});

$( ".targetName" ).change(function() {

// alert( $(this).val());
});

});

var hideTag = [];
function hideornot(trItem,tag)
{
if (hideTag.indexOf(tag) != '-1')
{
var index = hideTag.indexOf(tag);
hideTag.splice(index, 1);
$( "tr." + tag ).show();
$(trItem).css('color', 'white');
$(trItem).css('background-color', 'rgba(0, 0, 0, 0.1)');

}
else
{
$( "tr." + tag ).hide();
hideTag.push(tag);
$(trItem).css('color', 'red');
$(trItem).css('background-color', 'rgba(255, 255, 255, 0.6)');

}
}

findPlayer()
{

}



</script>
20 changes: 19 additions & 1 deletion model/oversight.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
function getPlayer()
{
global $db;
$result = $db->sql_query("SELECT id_player, name_player , status FROM " . TABLE_SPA_PLAYERS);
$result = $db->sql_query("SELECT id_player, name_player , status FROM " . TABLE_SPA_PLAYERS." order by name_player ASC");
$Tretour=array();

while ($tPlayer = $db->sql_fetch_row($result))
Expand All @@ -16,4 +16,22 @@ function getPlayer()
}
return $Tretour;

}




function getStatus()
{
global $db;
$result = $db->sql_query("SELECT distinct(status)FROM " . TABLE_SPA_PLAYERS ." order by status ASC ");
$tRetour=array();

while ($tStatus = $db->sql_fetch_row($result))
{
$tRetour[] = $tStatus["status"];

}
return $tRetour;

}
3 changes: 3 additions & 0 deletions oversight.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$data["players"] = getPlayer();



// vue par defaut
switch ($pub_page) {
case "list":
Expand All @@ -21,7 +22,9 @@
break;
case "add":
$data["menuactif"]="add";
$data["playerStatus"]=getStatus();
include_once(FOLDER_VIEW . "header.php");
include_once(FOLDER_JS . "jsadd.php");
include_once(FOLDER_VIEW . "menu.php");
include_once(FOLDER_VIEW . "add.php");
include_once(FOLDER_VIEW . "footer.php");
Expand Down
49 changes: 16 additions & 33 deletions view/add.php
Original file line number Diff line number Diff line change
@@ -1,54 +1,37 @@
<?php
if (!defined('IN_SPYOGAME')) die("Hacking attempt");
global $data;
$px=100;
$px = 100;
?>

<h2> AJOUT</h2>

<form action="/index.php?action=oversight" id="add">
<select name="selectPlayer">
<?php foreach ($data["players"] as $player) : ?>
<option value="<?php echo $player["id_player"]; ?>">
<?php echo $player["name_player"]; ?>
</option>
<?php endforeach; ?>
</select>
<input type="submit">
</form>
<br />
<br/>
<table>
<thead>
<tr>
<!-- version utletieur ...
<th class="c">
Filtre :
Filtre Nom:
</th>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_">
None
</td>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_a">
a
<td width="<?php echo $px; ?>px" class="c Filtre_name">
<input type="text" id="Filtre_name" class="targetName"/>

</td>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_I">
I
</th>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_v">
v
</th>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_vI">
vI
</th>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_vIb">
vIb
</th>
<td width="<?php echo $px;?>px" class="c Filtre_status" data-status="status_b">
b
-->
<th class="c">
Filtre Status:
</th>
<?php foreach ($data["playerStatus"] as $sStatus) : ?>
<td width="<?php echo $px; ?>px" class="c Filtre_status" data-status="status_<?php echo $sStatus; ?>">
<?php echo $sStatus; ?>
</td>
<?php endforeach; ?>
</tr>
</thead>
</table>

<br />
<br/>
<table>
<thead>
<tr>
Expand Down
4 changes: 2 additions & 2 deletions view/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<?php foreach ($data["menu"] as $key) : ?>
<?php if ($data["menuactif"] == $key["url"]) : ?>
<th>
<?php echo $key["nom"]; ?></php>
<?php echo $key["nom"]; ?>
</th>
<?php else : ?>
<td class="c">
<a href="index.php?action=oversight&page=<?php echo $key["url"]; ?>">
<?php echo $key["nom"]; ?></php>
<?php echo $key["nom"]; ?>
</a>
</td>
<?php endif; ?>
Expand Down

0 comments on commit 9aa84d4

Please sign in to comment.