示例#1
0
function draw_page($userinfo)
{
    ?>
  <div class="container">
  <?php 
    //Fetch the points total for this user
    $points = get_points_total($userinfo['user_id']);
    echo '<h3>';
    echo $userinfo['fname'] . ' ' . $userinfo['lname'];
    echo '&nbsp;<small>' . $points . ' points</small>';
    echo '</h3>';
    draw_points_table($userinfo);
    draw_add_points_form();
    ?>
  </div>
  <?php 
}
示例#2
0
function draw_user_list()
{
    $users = get_users('user');
    ?>
      <table class="userlist table table-condensed">
        <tr>
          <th>Name</th>
          <th>Points</th>
        </tr>
        <?php 
    while ($row = $users->fetch_array()) {
        $points = get_points_total($row['user_id']);
        echo '<tr class="userlist"';
        echo ' onclick="openPoints(' . $row['user_id'] . ')">';
        echo '<td>' . $row['fname'] . ' ' . $row['lname'] . '</td>';
        echo '<td>' . $points . '</td>';
        echo '</tr>';
    }
    ?>
      </table>
  <?php 
}
示例#3
0
$count = is_numeric($_GET['count']) ? intval($_GET['count']) : null;
$offset = is_numeric($_GET['offset']) ? intval($_GET['offset']) : 0;
$js_callback = $response_mime_type == 'text/javascript' && $_GET['callback'] ? sanitize_js_callback($_GET['callback']) : null;
if ($woe_id && $article_id) {
    $url = new Net_URL('http://' . get_domain_name() . get_base_dir() . '/point.php');
    $url->addQueryString('article', $article_id);
    $url->addQueryString('woe', $woe_id);
    $url->addQueryString('format', $response_format);
    header('Location: ' . $url->getURL());
    exit;
} elseif (($article_ids || $woe_ids) && ($article_id || $woe_id)) {
    header('Content-Type: text/plain');
    die_with_code(400, "It's not possible to specify both singular and plural article/WOE ID's.\n");
} else {
    $points = get_points($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids', 'count', 'offset'));
    $total = get_points_total($C, compact('article_id', 'woe_id', 'article_ids', 'woe_ids'));
    $count = count($points);
}
$C->close();
header("Content-Type: {$response_mime_type}; charset=UTF-8");
switch ($response_format) {
    case 'php':
        print serialize(compact('count', 'offset', 'total', 'points'));
        break;
    case 'json':
        echo json_encode(compact('count', 'offset', 'total', 'points'));
        break;
    case 'js':
        if (is_null($js_callback)) {
            die_with_code(400, "You must provide a javascript callback for format=js.");
        }