Example #1
0
<?php

// quick check to determine if this is the release version
// normally this would be set through a define in Drupal
if ($_SERVER['SERVER_PORT'] == ':80') {
    $dbBasePath = '/var/www-croma/database-release';
    $modulesBasePath = '/var/www-croma/croma_modules-release';
} else {
    $dbBasePath = '/var/www-croma/database';
    $modulesBasePath = '/var/www-croma/croma_modules';
}
include $dbBasePath . '/croma_dbFunctions.php';
include $dbBasePath . '/drupalCompatibility.php';
if (isset($_GET['teamNumber'])) {
    $TID = dbGetTeamTIDByNumber($_GET['teamNumber']);
} else {
    return;
}
$fontpath = realpath($modulesBasePath . '/images');
//replace . with a different directory if needed
putenv('GDFONTPATH=' . $fontpath);
// General settings
$padding = 10;
$image = imagecreatefrompng($modulesBasePath . '/images/widget.png');
$font['size'] = 40;
$font['angle'] = 0;
$font['file'] = 'Serpentine.ttf';
$font['color'] = imagecolorallocate($image, 0, 0, 0);
$font['minSize'] = 15;
// "Hours" settings
$hours['text'] = dbGetHoursForTeam($TID);
<?php

/*
  ---- widgets/fancyScrollingStats.php ----
  returns JSON-encoded stats data for a team (when called by fancyScrollingStats.js)
*/
// quick check to determine if this is the release version
// normally this would be set through a define in Drupal
if ($_SERVER['SERVER_PORT'] == ':80') {
    $basePath = '/var/www-croma/database-release';
} else {
    $basePath = '/var/www-croma/database';
}
include $basePath . '/croma_dbFunctions.php';
include $basePath . '/drupalCompatibility.php';
if (isset($_POST['teamNumber'])) {
    $teamNumber = $_POST['teamNumber'];
} else {
    echo 'errorTID';
    return;
}
$TID = dbGetTeamTIDByNumber($teamNumber);
$data['numHours'] = dbGetHoursForTeam($TID);
$data['teamName'] = dbGetTeamName($TID);
$data['numOutreaches'] = dbGetNumOutreachForTeam($TID);
$json = json_encode($data);
echo $json;