예제 #1
0
            if ($nextStandard) {
                $map[] = array('standard' => array_combine(['code', 'description'], explode(' - ', $standard)), "marks" => $level);
                $level = array();
                $standard = $nextStandard;
            } else {
                if ($total !== false && !empty($course)) {
                    $level[] = $total;
                }
            }
        }
    }
    $map[] = ['standard' => array_combine(array('code', 'description'), explode(' - ', $standard)), "marks" => $level];
    /* and send it off to Smarty to display */
    $smarty->assign('courses', $courses);
    $smarty->assign('map', $map);
    $smarty->assign('timestamp', $cache->getCacheTimestamp($_REQUEST['map'])->format('F j, Y'));
    $smarty->display('standards-map/sheet.tpl');
    exit;
    /* ...or are we being given data to cache? */
} elseif (!empty($_REQUEST['analysis'])) {
    /* allow access via bookmarklet */
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    /* the POST parameter is not URL-encoded, which breaks $_POST */
    $data = substr(file_get_contents('php://input'), strlen('analysis='));
    $key = 'analysis.' . md5($data);
    $cache->setCache($key, $data);
    echo $key;
    exit;
    /* ...or should we show some instructions? */
} else {
    $smarty->addStylesheet('css/standards-map/instructions.css');