<?php
require_once ($staticpath."modules/mod_portal/date_to_ru.php");

$reports_array = array(
						'mod_grades/BlankGradebook.php'=>_('Blank Gradebook'),
						'mod_grades/GrdBookTeacher.php'=>_('Teachers & Final Grades'),
						'mod_grades/GrdAnalytic.php'=>_('Analytical Grade Report'),
#						'mod_grades/GrdBookAnalyticReport.php'=>_('Analytical Report'),
						'mod_grades/GrdBookMissingGradesReport.php'=>_('Missing Final Grades'),
						'mod_grades/GrdPrintStudentReportCards.php?servicefunction=gradelist'=>_('Student Final Grades'),
						'mod_grades/GrdArrupeCustomReport.php'=>_('Print Final Grades (Customized)'),
//						'mod_grades/GrdYearStudGradeReport.php?servicefunction=gradelist'=>_('Year Grades & Ranking'),
						'mod_grades/GrdReqReport.php'=>_('Graduation Requirements Report')
			);

//die('nn');
$menu['mod_grades']['admin'] = array(
						'mod_grades/GrdPrintStudGrades.php'=>_('Final Grades Info'),
						'mod_grades/GrdBook.php'=>_('Gradebook Grades'),
						'mod_grades/GrdPrintStudentReportCards.php'=>_('Report Cards'),
						//'mod_grades/BncGetStudReportCard.php'=>_('Benchmarks Report Cards'),
						'mod_grades/GrdStudentPrintGC.php'=>_('Transcripts'),
                                                'mod_grades/MassTeacherAssign.php'=>_('Mass Create Assignment'),
//                                                'mod_grades/GrdHomeWork.php'=>_('Home Work'),
						_('Gradebook_Reports &#8658;')=>$reports_array,
						2=>_('Setup'),
                                                'mod_grades/AssignmentConfig.php'=>_('Assignment Creator'),
						'mod_grades/GrdBookManualGPACalculation.php'=>_('GPA/PA Calculation'),
						'mod_grades/GrdRCProperties.php'=>_('Grading Scales Settings'),
						//'mod_grades/BncCourseProperties.php'=>_('Standards & Benchmarks'),
						'mod_grades/GrdCreditGradReq.php'=>_('Graduation Requirements'),
						
					);
if(!$menu['mod_users']['admin'])
	$menu['mod_users']['admin'] = array();

$menu['mod_grades']['teacher'] = array(
						'mod_grades/Grades.php'=>_('Gradebook'),
						'mod_grades/GrdBookConfiguration.php'=>_('Gradebook Configuration'),
						'mod_grades/GrdBookAssignments.php'=>_('Gradebook Assignments'),
						'mod_grades/MassTeacherAssign.php'=>_('Mass Create Assignment'),
						'mod_grades/GrdBookReportWorkspace.php'=>_('Gradebook Reports'),
						'mod_grades/BlankGradebook.php'=>_('Blank Gradebook'),
//						'mod_grades/GrdHomeWork.php'=>_('Home Work'),
						1=>_('Report Cards'),
						'mod_grades/GrdBookEnterFinalGrades.php'=>_('Post Final Grades'),
						'mod_evaluation/BncPostBenchmark.php'=>_('Post Benchmark Evaluations'),
						//'mod_evaluation/BncCourseProperties.php'=>_('Define Benchmarks'),
						'mod_students/Students.php?include=studescinfotab'=>_('Teacher Comments'),
						'mod_grades/GrdPrintStudentReportCards.php'=>_('Print Report Cards'),
					);


if(!$menu['My_Child']['parent'])
	$menu['My_Child']['parent'] = array();
if(!$menu['My_Info']['student'])
	$menu['My_Info']['student'] = array();

$menu['My_Child']['parent'] += array(
						'mod_grades/GrdPrintStudGrades.php'=>_('Final Grades Info'),
						'mod_grades/GrdReqReport.php'=>_('Graduation Requirements')
//						'mod_grades/GrdHomeWork.php'=>_('Home Work')

					);

$menu['My_Info']['student'] += array(
						'mod_grades/GrdPrintStudGrades.php'=>_('Final Grades Info'),
						'mod_grades/GrdReqReport.php'=>_('Graduation Requirements')
//						'mod_grades/GrdHomeWork.php'=>_('Home Work')
					);

if(get_user('PROFILE')=='parent' || get_user('PROFILE')=='student')
{
	$classes = db_request(db_execute("SELECT cp.TITLE,cp.COURSE_SECTION_ID,cp.TEACHER_ID,s.COURSE_ID,s.COURSE_SECTION_ID,c.TITLE AS COURSE_TITLE 
				FROM STUDENT_SCHEDULE s,COURSE_SECTIONS cp,COURSES c,SCHOOL_PERIODS sp WHERE c.COURSE_ID=cp.COURSE_ID AND cp.COURSE_SECTION_ID=s.COURSE_SECTION_ID 
				AND sp.SCHOOL_PERIOD_ID=cp.SCHOOL_PERIOD_ID AND s.STUDENT_ID='".get_student_id()."' AND s.SCHOOL_YEAR='".get_school_year()."' 
				AND cp.SCHOOL_TERM_ID IN (".get_all_school_term('QTR',get_user_school_term()).") AND ('".get_db_date()."' BETWEEN s.START_DATE 
				AND s.END_DATE OR s.END_DATE IS NULL) AND cp.DOES_GRADES='Y' ORDER BY sp.SORT_ORDER,cp.SCHOOL_TERM_ID"),array(),array('COURSE_ID'));
	foreach($classes as $course=>$class){
            foreach($class as $key=>$value)
                $adv_menu[$course]['mod_grades/GrdBook.php?course_section_id='.$value['COURSE_SECTION_ID']] = $value['COURSE_TITLE'].' - '.change_date_ru('days_replace',$value['TITLE']);
                $menu['Assignments_&_Grades'][get_user('PROFILE')][str_replace(' ','_',$class[1]['COURSE_TITLE']).' &#8658;'] = $adv_menu[$course];
        }
}
else
	$menu['Assignments_&_Grades']['parent'] = $menu['Assignments']['student'] = array('mod_grades/GrdBook.php'=>_('Gradebook Grades'));
// So that Permissions and Profiles give users the options to turn off Assignments & Grades for students & parents
if(($_REQUEST['servicemod']=='mod_users/UsrPermissions.php' || $_REQUEST['servicemod']=='mod_users/UsrProfile.php') && (get_user('PROFILE')=='parent' || get_user('PROFILE')=='student') && $old_profile)
{
	$menu['Assignments_&_Grades']['parent'] = $menu['Assignments_&_Grades']['student'] = array('mod_grades/GrdBook.php'=>_('Gradebook Grades'));
}

$exceptions['mod_grades'] = array(
						'mod_grades/GrdBookManualGPACalculation.php'=>true
					);
$menu['mod_grades']['icon'] = 'modules/mod_grades/Grades.png';
$menu['Assignments_&_Grades']['icon'] = 'modules/mod_grades/Grades.png';
?>