=START_DATE AND ('" . DBDate() . "'<=END_DATE OR END_DATE IS NULL) AND MARKING_PERIOD_ID IN (" . GetAllMP( 'QTR', UserMP() ) . ")" ); // If student not scheduled in new Course Period or MP, remove. $unset_student = ! $is_student_scheduled; } /** * If current School OR SchoolYear changed from menu, * reset Admin & Teacher's CoursePeriod */ if ( ( UserSchool() != $old_school || UserSyear() != $old_syear ) && ( User( 'PROFILE' ) === 'admin' || User( 'PROFILE' ) === 'teacher' ) ) { unset( $_SESSION['UserCoursePeriod'] ); // Remove period from URL. unset( $_SESSION['_REQUEST_vars']['period'] ); } // Remove current Student/User from menu if user clicked on red cross. if ( ( User( 'PROFILE' ) === 'admin' || User( 'PROFILE' ) === 'teacher' ) && ( ( $new_student = isset( $_REQUEST['side_student_id'] ) && $_REQUEST['side_student_id'] === 'new' ) || ( $new_staff = isset( $_REQUEST['side_staff_id'] ) && $_REQUEST['side_staff_id'] === 'new' ) ) ) { if ( $new_student ) { $unset_student = true; } elseif ( $new_staff ) { $unset_staff = true; } unset( $_SESSION['_REQUEST_vars']['search_modfunc'] ); } } /** * Set current * SchoolYear / Student / User / School / MarkingPeriod * after login */ else { // Set current Student (if user is student). if ( ! UserStudentID() && User( 'PROFILE' ) === 'student' ) { SetUserStudentID( $_SESSION['STUDENT_ID'] ); } // Set current User (if user is parent). if ( ! UserStaffID() && User( 'PROFILE' ) === 'parent' ) { SetUserStaffID( $_SESSION['STAFF_ID'] ); } // Set current School. if ( ! UserSchool() ) { // If user is admin or teacher. if ( ( User( 'PROFILE' ) === 'admin' || User( 'PROFILE' ) === 'teacher' ) && ( ! User( 'SCHOOLS' ) || mb_strpos( User( 'SCHOOLS' ), ',' . User( 'CURRENT_SCHOOL_ID' ) . ',' ) !== false ) ) { $_SESSION['UserSchool'] = User( 'CURRENT_SCHOOL_ID' ); } // If user is student. elseif ( User( 'PROFILE' ) === 'student' ) { $_SESSION['UserSchool'] = trim( User( 'SCHOOLS' ), ',' ); } // Do not set here if user is parent (set later on depending on current Student). } // Set current MarkingPeriod (Quarter). if ( ! UserMP() ) { $_SESSION['UserMP'] = GetCurrentMP( 'QTR', DBDate(), false ); } } // Unset current Student. if ( $unset_student ) { unset( $_SESSION['student_id'] ); // Remove student_id from URL. unset( $_SESSION['_REQUEST_vars']['student_id'] ); } // Unset current User. if ( $unset_staff ) { unset( $_SESSION['staff_id'] ); // Remove staff_id from URL. unset( $_SESSION['_REQUEST_vars']['staff_id'] ); } // Update "#body" Module page. if ( $update_body ) { /** * If last mod is popup, redirect to Portal! * * Happens when Current Student / SYear... update while popup opened * Preserves integrity and prevents bugs */ if ( isPopup( $_SESSION['_REQUEST_vars']['modname'], $_SESSION['_REQUEST_vars']['modfunc'] ) ) { $ajax_link = 'Modules.php?modname=misc/Portal.php'; } else { $ajax_link = PreparePHP_SELF( $_SESSION['_REQUEST_vars'], [ 'advanced' ] ); } $addJavascripts .= 'ajaxLink(' . json_encode( $ajax_link ) . ');'; } /** * Set menu * Student / User / School / Marking Period / CoursePeriod * check if have been changed in Warehouse.php */ $addJavascripts .= 'var menuStudentID="' . UserStudentID() . '", menuStaffID="' . UserStaffID() . '", menuSchool="' . UserSchool() . '", menuMP="' . UserMP() . '", menuCoursePeriod="' . UserCoursePeriod() . '";'; if ( ! isset( $_REQUEST['sidefunc'] ) || $_REQUEST['sidefunc'] !== 'update' ) : ?>