Browse Source

edit notes et players

master
heuzef 10 years ago
parent
commit
b4d054e36c
6 changed files with 281 additions and 266 deletions
  1. +97
    -97
      action.php
  2. +159
    -154
      gamers.php
  3. +2
    -2
      gamers/player1.xml
  4. +5
    -5
      gamers/player2.xml
  5. +18
    -0
      gamers/player3.xml
  6. +0
    -8
      index.php

+ 97
- 97
action.php View File

@@ -1,98 +1,98 @@
<?php
$nom_modif="";
if (isset($_GET['entry'])) {
$nom_modif = $_GET['entry'];
} else {
header("location: index.php");
end;
}
$xml = simplexml_load_file('./gamers/'.$nom_modif.'.xml');
if (isset($_GET['hp_plus']) && $xml->entry->hp<10) {
$xml->entry->hp++;
}
if (isset($_GET['hp_moins']) && $xml->entry->hp>0) {
$xml->entry->hp--;
}
if (isset($_GET['xp_plus']) && $xml->entry->xp<99999) {
$xml->entry->xp++;
}
if (isset($_GET['xp_moins']) && $xml->entry->xp>0) {
$xml->entry->xp--;
}
if (isset($_GET['xp_plusplus']) && $xml->entry->xp<99989) {
$xml->entry->xp+=10;
}
if (isset($_GET['xp_moinsmoins']) && $xml->entry->xp>9) {
$xml->entry->xp-=10;
}
if (isset($_GET['eco_verte_plus']) && $xml->entry->ecos->verte<5) {
$xml->entry->ecos->verte++;
}
if (isset($_GET['eco_verte_moins']) && $xml->entry->ecos->verte>0) {
$xml->entry->ecos->verte--;
}
if (isset($_GET['eco_bleue_plus']) && $xml->entry->ecos->bleue<5) {
$xml->entry->ecos->bleue++;
}
if (isset($_GET['eco_bleue_moins']) && $xml->entry->ecos->bleue>0) {
$xml->entry->ecos->bleue--;
}
if (isset($_GET['eco_jaune_plus']) && $xml->entry->ecos->jaune<5) {
$xml->entry->ecos->jaune++;
}
if (isset($_GET['eco_jaune_moins']) && $xml->entry->ecos->jaune>0) {
$xml->entry->ecos->jaune--;
}
if (isset($_GET['eco_rouge_plus']) && $xml->entry->ecos->rouge<5) {
$xml->entry->ecos->rouge++;
}
if (isset($_GET['eco_rouge_moins']) && $xml->entry->ecos->rouge>0) {
$xml->entry->ecos->rouge--;
}
if (isset($_GET['eco_blanche_plus']) && $xml->entry->ecos->blanche<5) {
$xml->entry->ecos->blanche++;
}
if (isset($_GET['eco_blanche_moins']) && $xml->entry->ecos->blanche>0) {
$xml->entry->ecos->blanche--;
}
if (isset($_GET['eco_noire_plus']) && $xml->entry->ecos->noire<5) {
$xml->entry->ecos->noire++;
}
if (isset($_GET['eco_noire_moins']) && $xml->entry->ecos->noire>0) {
$xml->entry->ecos->noire--;
}
if (isset($_GET['trans_default'])) {
$xml->entry->trans="default";
}
if (isset($_GET['trans_light'])) {
$xml->entry->trans="light";
}
if (isset($_GET['trans_dark'])) {
$xml->entry->trans="dark";
}
if (isset($_POST['edit_notes'])) {
$xml->entry->notes = $_POST["edit_notes"];
}
$xml->asXml('./gamers/'.$nom_modif.'.xml');
header("location: index.php");
<?php
$nom_modif="";
if (isset($_GET['entry'])) {
$nom_modif = $_GET['entry'];
} else {
header("location: index.php");
end;
}
$xml = simplexml_load_file('./gamers/'.$nom_modif.'.xml');
if (isset($_GET['hp_plus']) && $xml->entry->hp<10) {
$xml->entry->hp++;
}
if (isset($_GET['hp_moins']) && $xml->entry->hp>0) {
$xml->entry->hp--;
}
if (isset($_GET['xp_plus']) && $xml->entry->xp<99999) {
$xml->entry->xp++;
}
if (isset($_GET['xp_moins']) && $xml->entry->xp>0) {
$xml->entry->xp--;
}
if (isset($_GET['xp_plusplus']) && $xml->entry->xp<99989) {
$xml->entry->xp+=10;
}
if (isset($_GET['xp_moinsmoins']) && $xml->entry->xp>9) {
$xml->entry->xp-=10;
}
if (isset($_GET['eco_verte_plus']) && $xml->entry->ecos->verte<5) {
$xml->entry->ecos->verte++;
}
if (isset($_GET['eco_verte_moins']) && $xml->entry->ecos->verte>0) {
$xml->entry->ecos->verte--;
}
if (isset($_GET['eco_bleue_plus']) && $xml->entry->ecos->bleue<5) {
$xml->entry->ecos->bleue++;
}
if (isset($_GET['eco_bleue_moins']) && $xml->entry->ecos->bleue>0) {
$xml->entry->ecos->bleue--;
}
if (isset($_GET['eco_jaune_plus']) && $xml->entry->ecos->jaune<5) {
$xml->entry->ecos->jaune++;
}
if (isset($_GET['eco_jaune_moins']) && $xml->entry->ecos->jaune>0) {
$xml->entry->ecos->jaune--;
}
if (isset($_GET['eco_rouge_plus']) && $xml->entry->ecos->rouge<5) {
$xml->entry->ecos->rouge++;
}
if (isset($_GET['eco_rouge_moins']) && $xml->entry->ecos->rouge>0) {
$xml->entry->ecos->rouge--;
}
if (isset($_GET['eco_blanche_plus']) && $xml->entry->ecos->blanche<5) {
$xml->entry->ecos->blanche++;
}
if (isset($_GET['eco_blanche_moins']) && $xml->entry->ecos->blanche>0) {
$xml->entry->ecos->blanche--;
}
if (isset($_GET['eco_noire_plus']) && $xml->entry->ecos->noire<5) {
$xml->entry->ecos->noire++;
}
if (isset($_GET['eco_noire_moins']) && $xml->entry->ecos->noire>0) {
$xml->entry->ecos->noire--;
}
if (isset($_GET['trans_default'])) {
$xml->entry->trans="default";
}
if (isset($_GET['trans_light'])) {
$xml->entry->trans="light";
}
if (isset($_GET['trans_dark'])) {
$xml->entry->trans="dark";
}
if (isset($_GET['edit_notes'])) {
$xml->entry->notes = $_POST["notes"];
}
$xml->asXml('./gamers/'.$nom_modif.'.xml');
header("location: index.php");
?> ?>

+ 159
- 154
gamers.php View File

@@ -1,155 +1,160 @@
<?php

$xml = simplexml_load_file('./gamers/'.$fichier);

foreach($xml->entry as $entry) {
?>

<!-- gamers -->
<div class="col-lg-4">
<div class="panel panel-<?php echo $entry->trans; ?>">
<div class="panel-heading">
<div class="row">
<div class="col-lg-4">
<h2><strong><?php echo $entry->nom; ?></strong></h2>
</div>
<div class="col-lg-4">
<h3><i class="glyphicon glyphicon-heart" style="color:red;";></i>&nbsp;<strong><?php echo $entry->hp; ?></strong></h3>
</div>
<div class="col-lg-4">
<h3><i class="glyphicon glyphicon-flash" style="color:#FFD700;";></i>&nbsp;<strong><?php echo $entry->xp; ?></strong></h3>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<a href="index.php"><div id="des"><?php echo rand(1, 6); ?></div></a>
<?php trans("trans_dark", $entry->nom, "#8128B5"); ?>
<?php trans("trans_light", $entry->nom, "#ADDFFF"); ?>
<?php trans("trans_default", $entry->nom, "#AAA"); ?>
</div>
<div class="col-lg-4">
<?php button_modif_hp("hp_moins", $entry->nom, "-"); ?><?php button_modif_hp("hp_plus", $entry->nom, "+"); ?>
</div>
<div class="col-lg-4">
<?php button_modif_xp("xp_moinsmoins", $entry->nom, "--"); ?><?php button_modif_xp("xp_moins", $entry->nom, "-"); ?><?php button_modif_xp("xp_plus", $entry->nom, "+"); ?><?php button_modif_xp("xp_plusplus", $entry->nom, "++"); ?>
</div>
</div>
</div>

<div class="panel-body">
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_verte_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco verte glow"><span style="width: <?php echo ($entry->ecos->verte)*20; ?>%"><?php echo $entry->ecos->verte; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_verte_plus", $entry->nom, "+"); ?>
</div>
</div>

<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_bleue_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco bleue glow"><span style="width: <?php echo ($entry->ecos->bleue)*20; ?>%"><?php echo $entry->ecos->bleue; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_bleue_plus", $entry->nom, "+"); ?>
</div>
</div>

<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_jaune_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco jaune glow"><span style="width: <?php echo ($entry->ecos->jaune)*20; ?>%"><?php echo $entry->ecos->jaune; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_jaune_plus", $entry->nom, "+"); ?>
</div>
</div>

<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_rouge_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco rouge glow"><span style="width: <?php echo ($entry->ecos->rouge)*20; ?>%"><?php echo $entry->ecos->rouge; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_rouge_plus", $entry->nom, "+"); ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_blanche_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco blanche glow"><span style="width: <?php echo ($entry->ecos->blanche)*20; ?>%"><?php echo $entry->ecos->blanche; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_blanche_plus", $entry->nom, "+"); ?>
</div>
</div>

<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_noire_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco noire glow"><span style="width: <?php echo ($entry->ecos->noire)*20; ?>%"><?php echo $entry->ecos->noire; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_noire_plus", $entry->nom, "+"); ?>
</div>
</div>
<hr />
<div class="list-group">
<a class="list-group-item">
<button class="btn btn-default btn-xs" data-toggle="modal" data-target="#notes" style="float:right;"><i class="glyphicon glyphicon-pencil"></i></button>
<h4>Notes :</h4>
<p class="list-group-item-text"><?php echo $entry->notes ?></p>
</a>
</div>
<!-- notes -->
<div class="modal fade" id="notes" tabindex="-1" role="dialog" aria-labelledby="notes" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="container-fluid">
<div class="col-lg-12">
<form action="action.php?edit_notes&amp;entry=<?php echo $entry->nom; ?>" method="post">
<textarea name="notes" id="notes" cols="68" rows="10"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="float:left;">Fermer</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Editer</button></form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /gamers -->

<?php
$xml = simplexml_load_file('./gamers/'.$fichier);
if (!isset($itemnb)) {
$itemnb=0;
} else {
$itemnb++;
}
foreach($xml->entry as $entry) {
?>
<!-- gamers -->
<div class="col-lg-4">
<div class="panel panel-<?php echo $entry->trans; ?>">
<div class="panel-heading">
<div class="row">
<div class="col-lg-4">
<h2><strong><?php echo $entry->nom; ?></strong></h2>
</div>
<div class="col-lg-4">
<h3><i class="glyphicon glyphicon-heart" style="color:red;";></i>&nbsp;<strong><?php echo $entry->hp; ?></strong></h3>
</div>
<div class="col-lg-4">
<h3><i class="glyphicon glyphicon-flash" style="color:#FFD700;";></i>&nbsp;<strong><?php echo $entry->xp; ?></strong></h3>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<a href="index.php"><div id="des"><?php echo rand(1, 6); ?></div></a>
<?php trans("trans_dark", $entry->nom, "#8128B5"); ?>
<?php trans("trans_light", $entry->nom, "#ADDFFF"); ?>
<?php trans("trans_default", $entry->nom, "#AAA"); ?>
</div>
<div class="col-lg-4">
<?php button_modif_hp("hp_moins", $entry->nom, "-"); ?><?php button_modif_hp("hp_plus", $entry->nom, "+"); ?>
</div>
<div class="col-lg-4">
<?php button_modif_xp("xp_moinsmoins", $entry->nom, "--"); ?><?php button_modif_xp("xp_moins", $entry->nom, "-"); ?><?php button_modif_xp("xp_plus", $entry->nom, "+"); ?><?php button_modif_xp("xp_plusplus", $entry->nom, "++"); ?>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_verte_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco verte glow"><span style="width: <?php echo ($entry->ecos->verte)*20; ?>%"><?php echo $entry->ecos->verte; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_verte_plus", $entry->nom, "+"); ?>
</div>
</div>
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_bleue_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco bleue glow"><span style="width: <?php echo ($entry->ecos->bleue)*20; ?>%"><?php echo $entry->ecos->bleue; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_bleue_plus", $entry->nom, "+"); ?>
</div>
</div>
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_jaune_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco jaune glow"><span style="width: <?php echo ($entry->ecos->jaune)*20; ?>%"><?php echo $entry->ecos->jaune; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_jaune_plus", $entry->nom, "+"); ?>
</div>
</div>
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_rouge_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco rouge glow"><span style="width: <?php echo ($entry->ecos->rouge)*20; ?>%"><?php echo $entry->ecos->rouge; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_rouge_plus", $entry->nom, "+"); ?>
</div>
</div>
<hr />
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_blanche_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco blanche glow"><span style="width: <?php echo ($entry->ecos->blanche)*20; ?>%"><?php echo $entry->ecos->blanche; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_blanche_plus", $entry->nom, "+"); ?>
</div>
</div>
<div class="row">
<div class="col-lg-1">
<?php button_modif_ecos("eco_noire_moins", $entry->nom, "-"); ?>
</div>
<div class="col-lg-9">
<div class="progress progress-striped active">
<div class="progress-bar-eco noire glow"><span style="width: <?php echo ($entry->ecos->noire)*20; ?>%"><?php echo $entry->ecos->noire; ?></span></div>
</div>
</div>
<div class="col-lg-2">
<?php button_modif_ecos("eco_noire_plus", $entry->nom, "+"); ?>
</div>
</div>
<hr />
<div class="list-group">
<a class="list-group-item">
<button class="btn btn-default btn-xs" data-toggle="modal" data-target="#notes<?php echo $itemnb; ?>" style="float:right;"><i class="glyphicon glyphicon-pencil"></i></button>
<h4>Notes :</h4>
<p class="list-group-item-text"><?php echo $entry->notes ?></p>
</a>
</div>
<!-- notes -->
<div class="modal fade" id="notes<?php echo $itemnb;?>" tabindex="-1" role="dialog" aria-labelledby="notes<?php echo $itemnb;?>" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="container-fluid">
<div class="col-lg-12">
<form action="action.php?edit_notes&amp;entry=<?php echo $entry->nom; ?>" method="post">
<textarea name="notes" id="notes<?php echo $itemnb; ?>" cols="68" rows="10"><?php echo $entry->notes;?></textarea>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="float:left;">Fermer</button>
<input type="submit" class="btn btn-primary" value="Editer" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /gamers -->
<?php } ?> <?php } ?>

gamers/Player.xml → gamers/player1.xml View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<response> <response>
<entry> <entry>
<nom>Player</nom>
<nom>player1</nom>
<hp>10</hp> <hp>10</hp>
<xp>10</xp> <xp>10</xp>
<ecos> <ecos>
@@ -13,6 +13,6 @@
<noire>0</noire> <noire>0</noire>
</ecos> </ecos>
<trans>default</trans> <trans>default</trans>
<notes>Lorem ipsum dolor sit amet.</notes>
<notes></notes>
</entry> </entry>
</response> </response>

gamers/Prout.xml → gamers/player2.xml View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<response> <response>
<entry> <entry>
<nom>Prout</nom>
<nom>player2</nom>
<hp>10</hp> <hp>10</hp>
<xp>10</xp> <xp>10</xp>
<ecos> <ecos>
<verte>1</verte>
<bleue>1</bleue>
<verte>0</verte>
<bleue>0</bleue>
<jaune>0</jaune> <jaune>0</jaune>
<rouge>0</rouge> <rouge>0</rouge>
<blanche>1</blanche>
<blanche>0</blanche>
<noire>0</noire> <noire>0</noire>
</ecos> </ecos>
<trans>default</trans> <trans>default</trans>
<notes>Lorem ipsum dolor sit amet.</notes>
<notes></notes>
</entry> </entry>
</response> </response>

+ 18
- 0
gamers/player3.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<response>
<entry>
<nom>player3</nom>
<hp>10</hp>
<xp>10</xp>
<ecos>
<verte>0</verte>
<bleue>0</bleue>
<jaune>0</jaune>
<rouge>0</rouge>
<blanche>0</blanche>
<noire>0</noire>
</ecos>
<trans>default</trans>
<notes></notes>
</entry>
</response>

+ 0
- 8
index.php View File

@@ -1,5 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<!-- saved from url=(0028)http://bootswatch.com/lumen/ -->
<html lang="fr"> <html lang="fr">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -8,7 +7,6 @@
<link rel="stylesheet" href="./css/bootstrap.css" media="screen"> <link rel="stylesheet" href="./css/bootstrap.css" media="screen">
<link rel="stylesheet" href="./css/bootswatch.min.css"> <link rel="stylesheet" href="./css/bootswatch.min.css">
<link rel="stylesheet" href="./css/ecomonde.css"> <link rel="stylesheet" href="./css/ecomonde.css">

</head> </head>


<body> <body>
@@ -18,12 +16,6 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="col-lg-2"> <div class="col-lg-2">
<button class="btn btn-default btn-sm" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><i class="glyphicon glyphicon-map-marker"></i></button> <button class="btn btn-default btn-sm" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><i class="glyphicon glyphicon-map-marker"></i></button>






</div> </div>
<div class="col-lg-2"> <div class="col-lg-2">
<a onclick="window.open('music.php?sample=soft.mp3','ecomonde','menubar=no, scrollbars=no, top=100, left=50, width=320, height=100');"><button class="btn btn-default btn-sm"><i class="glyphicon glyphicon-music" style="color:#CCC;"></i></button></a> <a onclick="window.open('music.php?sample=soft.mp3','ecomonde','menubar=no, scrollbars=no, top=100, left=50, width=320, height=100');"><button class="btn btn-default btn-sm"><i class="glyphicon glyphicon-music" style="color:#CCC;"></i></button></a>


Loading…
Cancel
Save