public static function refreshHomePageCache()
 {
     //check if cache exists
     if (file_exists(TEMP_URL . 'home.html')) {
         // retrieve the file
         $file = file_get_html(VCAAExamController::getBaseURLToLoad(), false, VCAAExamController::getContext());
         // delete existing file
         unlink(TEMP_URL . 'home.html');
         // load new file
         $fo = fopen(TEMP_URL . 'home.html', 'w');
         fwrite($fo, $file);
         fclose($fo);
         return "Successfully refreshed";
     } else {
         return "Error! Cache does not exist!";
     }
 }
Exemplo n.º 2
0
if (isset($_GET['remotedownload'])) {
    //retrieve data
    $downloadData = json_decode(base64_decode($_GET['remotedownload']), true);
    //download to zip
    VCAAExamDownloader::downloadToZip($downloadData);
}
/*** POST METHODS ***/
// Download
if ($_POST['action'] == "download-zip") {
    //retrieve data
    $downloadData = json_decode($_POST['download'], true);
    //download to zip for now
    VCAAExamDownloader::downloadToZip($downloadData);
} else {
    if ($_POST['action'] == "single-download") {
        $url = VCAAExamController::getBaseURLToLoad() . $_POST['download'];
        //download
        VCAAExamDownloader::downloadFile($url);
    } else {
        if ($_POST['action'] == "fetch") {
            // retrieve mode indicator
            $modeIndicator = null;
            $paperChecked = false;
            $reportChecked = false;
            if (isset($_POST['modeIndicator'])) {
                $modeIndicator = $_POST['modeIndicator'];
            }
            // retrieve checkbox values
            if (isset($_POST['paperChecked'])) {
                $paperChecked = true;
            }