Exemplo n.º 1
0
						<!-- note to the php writer: the rows in the table alternate in color with alternating classes. -->
						<?php 
if (isset($_POST['getcheckins'])) {
    // ensures proper formatting for api function
    $month = intval($_POST['month']);
    if ($month < 10) {
        $month = "0" . $month;
    }
    $day = intval($_POST['day']);
    if ($day < 10) {
        $day = "0" . $day;
    }
    $year = intval($_POST['year']);
    $api = new roboSISAPI();
    $numericdate = "{$year}" . "{$month}" . "{$day}";
    $arr_checkins = $api->getUsersCheckedInForDate($numericdate);
    // 2D Array
    $arr_checkins = json_decode($arr_checkins);
    // splits the array for easier management
    $arr_usernames = $arr_checkins[0];
    $arr_texttimes = $arr_checkins[1];
    // checks if arrays are empty
    $size = count($arr_usernames);
    if (empty($arr_usernames)) {
        echo "<br />";
        echo "<p>There are no checkins for the selected date: {$month}/{$day}/{$year}.</p>";
    } else {
        if ($size == 1) {
            // allows appropriate grammar; person vs. people
            echo "<p>{$size} person checked in on {$month}/{$day}/{$year}.</p>";
        } else {
Exemplo n.º 2
0
<?php

// autoloader code
// loads classes as needed, eliminates the need for a long list of includes at the top
spl_autoload_register(function ($className) {
    $possibilities = array('../controllers' . DIRECTORY_SEPARATOR . $className . '.php', '../back_end' . DIRECTORY_SEPARATOR . $className . '.php', '../views' . DIRECTORY_SEPARATOR . $className . '.php', $className . '.php');
    foreach ($possibilities as $file) {
        if (file_exists($file)) {
            require_once $file;
            return true;
        }
    }
    return false;
});
$api = new roboSISAPI();
//print_r($api->getCheckIns("12rohits");
//$jk = 1399924;
//$di = 1;
//$api->inputCheckIn($jk,"12rohits");
//print_r($api->getUserID("12rohits"));
//$api->getAllEmails();
//$api->getUserType("12rohits");
$api->getUsersCheckedInForDate(20111005);