/** * Return data about the uploaded roster file. */ public static function get_roster_file() { $dh = opendir($GLOBALS['UPLOAD_DIR']); $roster_file_path = null; while (($name = readdir($dh)) !== false) { $path = $GLOBALS['UPLOAD_DIR'] . '/' . $name; if (is_file($path)) { $roster_file_path = $path; break; } } if (!$roster_file_path) { return false; } $info = array('name' => $name, 'size' => filesize($roster_file_path)); $info['uploader'] = new PSUPerson(PSUMeta::get($GLOBALS['META_WEBAPP'], 'roster_uploader')->value); $info['uploaded'] = PSUMeta::get($GLOBALS['META_WEBAPP'], 'roster_uploaded')->value; return $info; }
// no special overrides; } else { // non-tcert folks can only read $response->readonly(true); // non-faculty can only view the student page if (!$app->permissions->has('faculty')) { if (!$app->student_view) { $response->redirect($GLOBALS['BASE_URL'] . '/me/'); } } } // instantiate gate systems collection $app->populate('gatesystems', new TeacherCert\GateSystems()); // setup search default pref $wpid = $_SESSION['wp_id']; $meta = PSUMeta::get('teacher-cert', "search:{$wpid}:gs"); if ($meta) { $app->populate('search_default_gs', $meta->value); } }); // // Nothing specific requested; show list of gatesystems // respond('GET', '/', function ($request, $response, $app) { $app->tpl->display('index.tpl'); }); respond('POST', '/search', function ($request, $response, $app) { $gs_id = $request->param('gatesystem_id'); $q = $request->param('q'); $gate_system = new TeacherCert\GateSystem($gs_id); $wpid = $_SESSION['wp_id'];