<?php

require_once 'common.inc.php';
use Battis\HierarchicalSimpleCache;
$cache = new HierarchicalSimpleCache($sql, basename(__FILE__, '.php'));
$cache->setLifetime(7 * 24 * 60 * 60);
/* reset the cache for the course placement */
$sourceCourse = $_SESSION['toolProvider']->user->getResourceLink()->settings['custom_canvas_course_id'];
/*
	List all assessments during the assessment week (take dates as parameters)
	Sort by department and course (call out colors)
	Link back to course (and roster?) from page
*/
/* assume main account if none specified */
$accountId = null;
if (empty($_REQUEST['account'])) {
    $accountId = 1;
} elseif (is_numeric($_REQUEST['account'])) {
    $accountId = $_REQUEST['account'];
} else {
    $accountId = "sis_account_id:{$_REQUEST['account']}";
}
/* check dates -- default to "between today and this time next week" if not specified */
$start = date('Y-m-d');
if (!empty($_REQUEST['start'])) {
    $start = date('Y-m-d', strtotime($_REQUEST['start']));
}
$end = date('Y-m-d');
if (!empty($_REQUEST['end'])) {
    $end = date('Y-m-d', strtotime($_REQUEST['end']));
}
Exemple #2
0
 * @link http://stackoverflow.com/a/3954887 Stack Overflow
 *
 * @param integer $length
 * @return string
 */
function getUniqueId($length = 8)
{
    global $cache;
    // FIXME bad!
    do {
        $candidate = substr(md5(uniqid(mt_rand(), true)), 0, $length);
    } while (!empty($cache->getCache($candidate)));
    return $candidate;
}
$cache = new HierarchicalSimpleCache($sql, basename(__FILE__, '.php'));
$cache->setLifetime(HierarchicalSimpleCache::IMMORTAL_LIFETIME);
if (!empty($_REQUEST['cache'])) {
    $vars = $cache->getCache($_REQUEST['cache']);
    if (!empty($vars)) {
        foreach ($vars as $name => $value) {
            ${$name} = $value;
        }
    } else {
        unset($_REQUEST['cache']);
        header('Location: ' . $_SERVER['PHP_SELF'] . '?' . http_build_query($_REQUEST));
        exit;
    }
} else {
    /* general schedule */
    $NORMAL_MORNING = array(TITLE => '', LOCATION => '', START => strtotime('7:45am'), END => strtotime('8:00am'));
    $MORNING_MEETING = array(TITLE => '', LOCATION => '', START => strtotime('8:00am'), END => strtotime('8:25am'));