function draw_page() { ?> <div class="container"> <?php open_panel('quals', 'Quals'); draw_user_list(); close_panel(); ?> </div> <? } function draw_user_list() { $users = get_users("user"); $total = get_qual_point_total(); ?> <table class="userlist table table-condensed"> <tr> <th>Last Name</th> <th>First Name</th> <th>Username</th> <th>Progress</th> </tr> <?php while ($row = $users->fetch_array()) { $row['role'] = get_role($row['user_id']); $progress = get_progress($row['user_id']); echo '<tr class="userlist '; echo 'userlist-' . $row['role']; if ($row['inactive']) { echo ' userlist-inactive'; } echo '" onclick="openProgress(' . $row['user_id'] . ')">'; echo '<td>' . $row['lname'] . "</td>"; echo '<td>' . $row['fname'] . "</td>"; echo '<td>' . $row['username'] . "</td>"; echo '<td>'; draw_qual_progress_bar($progress, $total); echo '</td>'; echo '</tr>'; } ?> </table> <?php }
function draw_page($userinfo) { $progress = get_progress($userinfo['user_id']); $total = get_qual_point_total(); ?> <div class="container"> <?php echo '<h3>'; echo $userinfo['fname'] . ' ' . $userinfo['lname']; echo ' <small>' . user_level_to_levelname(get_level($userinfo['user_id'])) . '</small>'; echo '</h3>'; draw_qual_progress_bar($progress, $total); draw_progress_table($userinfo); draw_qual_progress_form($userinfo); ?> </div> <?php }
</div> <h5><a data-toggle="modal" data-target="#myModal">Medallion Benefits <i class="fa fa-arrow-circle-right" style="padding-left:10px"></i></a></h5> <br> <h2><?php echo get_user_info('loyalty_points'); ?> MP</h2> <div class="progress"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo get_progress(); ?> " aria-valuemin="0" aria-valuemax="100" style="width: <?php echo get_progress(); ?> %"><span class="sr-only"><?php echo get_progress(); ?> % Complete (success)</span></div> </div> <h5><?php echo get_progress_counter(); ?> </h5> <?php echo $countdown ? "{$countdown}" : ''; ?> </div> </div> </div> </div> <!-- /points -->
<?php // Submit answer to some toufu header('Content-Type: application/json; charset=utf-8'); $pdo = new PDO("sqlite:toufu.sq3"); if (!isset($_POST['p']) || !isset($_POST['par']) || !isset($_POST['ans']) || strlen(trim($_POST['ans'])) == 0) { get_progress($pdo); die; } $v = array(':p' => intval($_POST['p']), ':par' => $_POST['par'], ':ans' => $_POST['ans']); $stmt = $pdo->prepare("UPDATE toufu SET ans=:ans,cnt=cnt+1 WHERE p=:p AND par=:par"); $stmt->execute($v); $stmt = $pdo->prepare("INSERT INTO log VALUES (:p, :par, :ans)"); $stmt->execute($v); get_progress($pdo); function get_progress($pdo) { $st = $pdo->prepare("SELECT COUNT(1) FROM toufu WHERE cnt < 5"); $st->execute(); $row = $st->fetch(); if ($row) { echo json_encode(array('cnt' => 15829 - intval($row[0]))); } }
function draw_progress() { $progress = get_progress($_SESSION['user_id']); $total = get_qual_point_total(); open_panel_item('Qual Progress', 'goals', '12'); draw_qual_progress_bar($progress, $total); close_panel_item(); }