Example #1
0
function getMatchDetails($matchID)
{
    global $apiKey;
    $heroesArray = getHeroesArray();
    $itemsArray = getItemsArray();
    $match = getMatchObject($matchID);
    $players = $match->players;
    $matchString = getMatchString($match->game_mode);
    echo "<h1>{$matchID} ({$matchString})</h1>";
    echo "<h2>Began on " . date("l, F jS G:i:s", $match->start_time) . "</h2>";
    echo "<table class='table table-striped'>";
    echo "<tr>";
    echo "<th></th>";
    echo "<th>LH</th>";
    echo "<th>D</th>";
    echo "<th>XPM</th>";
    echo "<th>GPM</th>";
    echo "<th>HD</th>";
    echo "<th>TD</th>";
    echo "<th colspan=6>Items</th>";
    echo "</tr>";
    for ($i = 0; $i < count($players); $i++) {
        $player = $players[$i];
        if ($i < count($players) / 2) {
            echo "<tr class='success'>";
        } else {
            echo "<tr class='danger'>";
        }
        echo "<td>";
        if ($player->hero_id > 0) {
            $smallName = str_replace("npc_dota_hero_", "", $heroesArray[$player->hero_id]);
            echo "<a href='player.php?player={$player->account_id}'>";
            echo "<img src='http://cdn.dota2.com/apps/dota2/images/heroes/{$smallName}" . "_sb.png'/>";
            echo "</a>";
        } else {
            echo '<img src="unknown.png" />';
        }
        echo "</td>";
        echo "<td>{$player->last_hits}</td>";
        echo "<td>{$player->denies}</td>";
        echo "<td>{$player->xp_per_min}</td>";
        echo "<td>{$player->gold_per_min}</td>";
        echo "<td>{$player->hero_damage}</td>";
        echo "<td>{$player->tower_damage}</td>";
        $items = [$player->item_0, $player->item_1, $player->item_2, $player->item_3, $player->item_4, $player->item_5];
        for ($j = 0; $j < count($items); $j++) {
            $item = $itemsArray[$items[$j]];
            $shortName = str_replace("item_", "", $item);
            if (substr_count("item_", $shortName) > -1) {
                echo "<td><img class='item' src='http://cdn.dota2.com/apps/dota2/images/items/" . $shortName . "_lg.png'></td>";
            } else {
                echo "<td><img class='item' src='unknown_item.png' /></td>";
            }
        }
        echo "</tr>";
    }
    echo "</table>";
    echo "<!--" . $response . "-->";
}
Example #2
0
function getItemsJSONStr($sql_result, $con, $num_col = 3)
{
    $array = getItemsArray($sql_result, $con, $num_col);
    for ($i = 0; $i < $num_col; $i++) {
        $strs[$i] = "\"" . $array[$i] . "\"";
    }
    if ($num_col == 2) {
        $json_str = '{"left":' . $strs[0] . ',' . '"right":' . $strs[1] . '}';
    } else {
        $json_str = '{"left":' . $strs[0] . ',' . '"middle":' . $strs[1] . ',' . '"right":' . $strs[2] . '}';
    }
    return $json_str;
}
<?php 
include_once '../../config.php';
include_once 'includes/header.php';
use LearnositySdk\Request\Init;
use LearnositySdk\Utils\Uuid;
$item_ref = Uuid::generate();
$activity_id = 'Demo_Activity';
$security = array('consumer_key' => $consumer_key, 'domain' => $domain);
if (isset($_GET['session_id'])) {
    $session_id = $_GET['session_id'];
    $session_state = 'resume';
} else {
    $session_id = Uuid::generate();
    $session_state = 'initial';
}
$request = array('activity_id' => $activity_id, 'name' => 'End to End Demo - Assessment', 'rendering_type' => 'assess', 'state' => 'initial', 'type' => 'submit_practice', 'session_id' => $session_id, 'user_id' => $studentid, 'items' => getItemsArray(), 'assess_inline' => true, 'config' => ['title' => 'Demo Activity', 'configuration' => ['onsubmit_redirect_url' => 'feedback.php?session_id=' . $session_id], 'regions' => ['top-right' => [['type' => 'itemcount_element'], ['type' => 'timer_element'], ['type' => 'pause_button']], 'right' => [['type' => 'save_button'], ['type' => 'fullscreen_button'], ['type' => 'separator_element'], ['type' => 'accessibility_button'], ['type' => 'verticaltoc_element'], ['type' => 'masking_button']], 'bottom-right' => [['type' => 'next_button'], ['type' => 'previous_button']]], 'labelBundle' => array('close' => 'Go to Reporting'), 'time' => ['show_pause' => true, 'max_time' => 300]]);
function getItemsArray()
{
    return explode(",", $_GET['itemIDs']);
}
$Init = new Init('items', $security, $consumer_secret, $request);
$signedRequest = $Init->generate();
?>

<div class="jumbotron section">
    <div class="overview">
        <h1>End to End Demo – Assessment</h1>
        <p>Here is a sample student assessment containing the questions created by the author in step 1.</p>
        <p>Take the test as a student would, you will then be able to provide teacher feedback after completing the assessment.</p>
    </div>
</div>
Example #4
0
<?php

session_start();
if (isset($_SESSION["user"])) {
    $user = $_SESSION["user"];
} else {
    $user = "";
}
include "include/util.php";
$con = connect_db();
mysql_select_db("eswap", $con);
$cat_result = mysql_query("SELECT DISTINCT Category FROM items", $con);
$sql_result = mysql_query("SELECT * FROM items WHERE Swaped='no' ORDER BY _id DESC LIMIT 0,6", $con);
$nickname = getNickname($user, $con);
$items_array = getItemsArray($sql_result, $con);
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" />
	<title>eSwap</title>
	<link rel="stylesheet" href="/eSwap/css/footer.css" type="text/css" />
	<link rel="stylesheet" href="/eSwap/css/banner.css" type="text/css" />
	<link rel="stylesheet" href="/eSwap/css/home.css" type="text/css" />
  <script src="js/simpleajax.js" type="text/javascript"></script>	
  <script src="js/load_more.js" type="text/javascript"></script>
  <script src="js/nav_display.js" type="text/javascript"></script>
</head>
<body>
	<?php 
include "include/banner.php";
Example #5
0
<?php

session_start();
if (isset($_SESSION["user"])) {
    $user = $_SESSION["user"];
} else {
    $user = "";
}
include "include/util.php";
$con = connect_db();
mysql_select_db("eswap", $con);
$sql_result = mysql_query("SELECT * FROM items WHERE Email='{$user}'", $con);
$released_items = getItemsArray($sql_result, $con, 1, true);
// $user_info = getUserInfo($user, $con);
$nickname = getNickname($user, $con);
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>eSwap</title>
	<link rel="stylesheet" href="/eSwap/css/footer.css" type="text/css" />
	<link rel="stylesheet" href="/eSwap/css/banner.css" type="text/css" />
	<link rel="stylesheet" href="/eSwap/css/released.css" type="text/css" />
  <script src="js/nav_display.js" type="text/javascript"></script>
</head>
<body>
	<?php 
include "include/banner.php";
?>