# HG changeset patch # User Nathan Phillip Brink # Date 2010-10-09 19:26:35 # Node ID 1e78016d44638b7a3b3f1de33e51f295b741f317 # Parent d903bd3d579e5c9ba361d6cad8048535d9da2eb7 A less messy way to force the user to choose his school the first time he navigates to input.php. diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -42,24 +42,25 @@ var sectionsOfClass = Array(); /* * Force a student to choose a school or declare he's a generic - * student before displaying the input form. + * student before displaying the input form. To do this, we need + * another variable in $_SESSION: $_SESSION['school_chosen']. */ $school = $inputPage->get_school(); -if ($_REQUEST['setted'] == 1 || $school['id'] != 'default') - $_SESSION['school_setted'] = TRUE; +if ($_REQUEST['school'] == 1 || $school['id'] != 'default') + $_SESSION['school_chosen'] = TRUE; if ($_REQUEST['selectschool'] == 1 - || $school['id'] == 'default' && !isset($_SESSION['school_setted'])) + || $school['id'] == 'default' && !isset($_SESSION['school_chosen'])) { ?>

School Selection

Choose the school you attend from the list below. If you cannot find your school, you may proceed using - the generic + the generic settings.

showSchools('input.php?setted=1'); + $inputPage->showSchools('input.php'); $inputPage->foot(); exit; }