Example #1
0
<?php

require_once '../BackEnd/init.php';
require_once 'NavBar.php';
if (isset($_GET['Id'])) {
    $deck = new Decks();
    $data = array();
    $class = $deck->getDeckClass($_GET['Id']);
    $name = $deck->getDeckName($_GET['Id']);
    $deckCards = $deck->getDeckCards($_GET['Id']);
    echo " <input type='hidden' id='background_image' value={$class}>";
    echo " <input type='hidden' id='DeckId' value=" . $_GET['Id'] . ">";
}
?>
<div class="Page">
    <div id="DeckHero" class="col-md-2">
        <div id="DeckHeroLogo">
            <input id="DeckNameInput" class="form-control" type="text" name="DeckName" value="<?php 
echo $name;
?>
" disabled>
        </div>
        <div id="deckBox" style="position: fixed; top:214px; right:0; width: 250px; background-color: #122b40">
        </div>
    </div>
</div>
<div id="login-dialog" style="display: none;">
    <form id="data">
        <div class="form-group">
            <label>Email or Username</label>
            <input type="text" id="LogUsername" placeholder="Write in your username or email" class="form-control"/>
Example #2
0
<div class="main-content">
    <h1 class="text-center main-page-header-style"><strong>Your Decks!</strong></h1>
    <?php 
$decks = new Decks();
if ($decks->getDeckCount() == 0) {
    echo "<div class='content text-center'>\n       <h2 class='text-center main-page-header-style'><strong>You have no decks created!</strong></h2>\n        <button class='btn btn-lg btn-style CreateADeck'>Create a deck</button>\n    </div>";
} else {
    $data = $decks->getDecks();
    $picture = new Pictures();
    echo "\n                <div class='container-fluid marginBottom'>";
    foreach ($data as $row) {
        echo "<div class='col-md-4 text-center deck-class'>\n                        <div style='width: 300px; height: 200px;'>\n                            <a href='DeckBuilding.php?Id={$row->Id}'><img src ='" . $picture->getHeroLogo($row->Class) . "'></a>\n                            <span class='DeckName-style'>{$row->Name}</span>\n                        </div>\n                 </div>";
    }
    echo "</div>";
}
?>
</div>

<div id="CreateADeck-dialog" style="display: none;">
    <form class="text-center" method="POST" action="DeckBuilding.php">

        <input name="hero" type="image" src="../Content/Heroes/Druid.png" value="druid">
        <input name="hero" type="image" src="../Content/Heroes/Warrior.png" value="warrior">
        <input name="hero" type="image" src="../Content/Heroes/Warlock.png" value="warlock">
        <input name="hero" type="image" src="../Content/Heroes/Mage.png" value="mage">
        <input name="hero" type="image" src="../Content/Heroes/Rogue.png" value="rogue">
        <input name="hero" type="image" src="../Content/Heroes/Hunter.png" value="hunter">
        <input name="hero" type="image" src="../Content/Heroes/Priest.png" value="priest">
        <input name="hero" type="image" src="../Content/Heroes/Shaman.png" value="shaman">
        <input name="hero" type="image" src="../Content/Heroes/Paladin.png" value="paladin">
Example #3
0
<?php

require_once '../Includes.php';
if (isset($_POST['data'], $_POST['Id'], $_POST['DeckName'])) {
    $data = array();
    $data['Success'] = false;
    $count = 0;
    $name = $_POST['DeckName'];
    if (!empty($name)) {
        $name = trim(htmlentities($name));
        $data = json_decode($_POST['data']);
        foreach ($data as $row) {
            $count += $row->count;
        }
        if ($count == 30) {
            $decks = new Decks();
            foreach ($data as $row) {
                $decks->InsertCard($row->Id, $id, $row->count);
            }
            $data['Success'] = true;
            $data['redirect'] = 'Index.php';
            echo json_encode($data);
        } else {
            $data['errors'] = "Not enough cards!" . $count;
            echo json_encode($data);
        }
    } else {
        $data['errors'] = "Write in a deck name!";
        echo json_encode($data);
    }
}
Example #4
0
<?php

require_once '../BackEnd/Includes.php';
require_once 'NavBar.php';
?>
        <?php 
if (isset($_GET['value']) && !empty($_GET['value'])) {
    $user = new User();
    $username = $user->getUsernameById($_GET['value']);
    echo "<div class='Page'>\n                    <div class='main-content'>\n                        <h1 class='text-center main-page-header-style'><strong>";
    foreach ($username as $users) {
        echo $users->Username . " ";
    }
    echo "Decks!</strong></h1>";
    $decks = new Decks();
    $data = $decks->getDecksByUserId($_GET['value']);
    if (!$data) {
        echo "<div class='content text-center'>\n                        <h2 class='text-center main-page-header-style'><strong>This user has no decks</strong></h2>\n                      </div>";
    }
    $picture = new Pictures();
    echo "\n                <div class='container-fluid marginBottom'>";
    foreach ($data as $row) {
        echo "<div class='col-md-4 text-center deck-class'>\n                        <div style='width: 300px; height: 200px;'>\n                            <a href='DeckView.php?Id={$row->Id}'><img src ='" . $picture->getHeroLogo($row->Class) . "'></a>\n                            <span class='DeckName-style'>{$row->Name}</span>\n                        </div>\n                 </div>";
    }
    echo "</div>\n                </div>\n            </div>";
}
?>
<div id="login-dialog" style="display: none;">
    <form id="data">
        <div class="form-group">
            <label>Email or Username</label>
Example #5
0
 if (isset($_POST['DeckId'])) {
     $delete = new Decks();
     $delete->DeleteDeck($_POST['DeckId']);
 }
 $data = array();
 $data['Success'] = false;
 $count = 0;
 $name = $_POST['DeckName'];
 if (!empty($name)) {
     $name = trim(htmlentities($name));
     $data = json_decode($_POST['data']);
     foreach ($data as $row) {
         $count += $row->count;
     }
     if ($count == 30) {
         $decks = new Decks();
         if ($id = $decks->CreateADeck($_POST['hero'], $name)) {
             foreach ($data as $row) {
                 $decks->InsertCard($row->Id, $id, $row->count);
             }
             $data['Success'] = true;
             $data['redirect'] = 'Index.php';
             echo json_encode($data);
         }
     } else {
         $data['errors'] = "Not enough cards!" . $count;
         echo json_encode($data);
     }
 } else {
     $data['errors'] = "Write in a deck name!";
     echo json_encode($data);
Example #6
0
<?php

require_once "../Includes.php";
if (isset($_GET['username']) && !empty($_GET['username'])) {
    $decks = new Decks();
    echo json_encode($decks->getDecks());
}
Example #7
0
<?php

require_once '../../Includes.php';
if (isset($_GET['Id'])) {
    $deck = new Decks();
    $data = $deck->getDeckCards($_GET['Id']);
    echo json_encode($data);
}