diff --git a/CalendarModal.php b/CalendarModal.php index 66b0a18b..d63acd57 100644 --- a/CalendarModal.php +++ b/CalendarModal.php @@ -73,10 +73,13 @@ // if (AllowEdit()) if (User('PROFILE') == 'admin') { + if($_REQUEST['event_id']!='new') + { if($RET[1]['CALENDAR_ID']==0) $RET[1]['CALENDAR_ID']=1; else $RET[1]['CALENDAR_ID']=0; + } echo '
' . CheckboxInputSwitchModal($RET[1]['CALENDAR_ID'], 'new', 'Show Events System Wide', '', false, 'Yes', 'No', '', 'switch-success') . '
'; } //else diff --git a/ChooseCP.php b/ChooseCP.php index 7aef3e38..57c456b8 100644 --- a/ChooseCP.php +++ b/ChooseCP.php @@ -38,7 +38,7 @@ if ($_REQUEST['table_name'] != '' && $_REQUEST['table_name'] == 'courses') { - $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html = 'course_modal_cp||'; diff --git a/ChooseCPModal.php b/ChooseCPModal.php index 457498db..a1f2e4b9 100644 --- a/ChooseCPModal.php +++ b/ChooseCPModal.php @@ -56,7 +56,7 @@ if( $_REQUEST['table_name']!='' && $_REQUEST['table_name']=='courses') { - $sql="SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql="SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html='course_modal||'; diff --git a/ChooseCpSearch.php b/ChooseCpSearch.php index 8da863c4..444a6292 100644 --- a/ChooseCpSearch.php +++ b/ChooseCpSearch.php @@ -53,7 +53,7 @@ if ($_REQUEST['table_name'] != '' && $_REQUEST['table_name'] == 'courses') { - $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html = 'course_modal||'; diff --git a/ChooseRequestSearch.php b/ChooseRequestSearch.php index 913e7e23..3ad32341 100644 --- a/ChooseRequestSearch.php +++ b/ChooseRequestSearch.php @@ -33,7 +33,7 @@ if ($_REQUEST['table_name'] != '' && $_REQUEST['table_name'] == 'courses') { - $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html = 'course_modal_request||'; diff --git a/MassDropModal.php b/MassDropModal.php index d16c3e46..1da29017 100644 --- a/MassDropModal.php +++ b/MassDropModal.php @@ -52,7 +52,7 @@ if ($_REQUEST['table_name'] != '' && $_REQUEST['table_name'] == 'courses') { - $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html = 'course_modal||'; diff --git a/MassScheduleModal.php b/MassScheduleModal.php index 9038863d..ab4d27eb 100644 --- a/MassScheduleModal.php +++ b/MassScheduleModal.php @@ -55,7 +55,7 @@ if ($_REQUEST['table_name'] != '' && $_REQUEST['table_name'] == 'courses') { - $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.title,sg.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; + $sql = "SELECT COURSE_ID,c.TITLE, CONCAT_WS(' - ',c.short_name,c.title) AS GRADE_COURSE FROM courses c LEFT JOIN school_gradelevels sg ON c.grade_level=sg.id WHERE SUBJECT_ID='$_REQUEST[id]' ORDER BY c.TITLE"; $QI = DBQuery($sql); $courses_RET = DBGet($QI); $html = 'course_modal||'; @@ -65,7 +65,7 @@ $html.=''; foreach ($courses_RET as $val) { - $html.= '' . $val['TITLE'] . ''; + $html.= '' . $val['GRADE_COURSE'] . ''; } $html.=''; $html.=''; diff --git a/assets/css/custom.css b/assets/css/custom.css index 53cc10d2..60045e12 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -44,7 +44,7 @@ div.form-control { word-wrap: break-word; } .clockpicker input.form-control { - min-width: 90px; + min-width: 60px; } /* Bootstrap Overwrite End */ @@ -55,14 +55,13 @@ div.form-control { #loading-image { position: fixed; - top: 54px; - right: 0; + top: 48%; + right: 42%; z-index: 999; color: #fff; background: #d81c37; padding: 8px 15px 9px 11px; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; + border-radius: 4px; box-shadow: 0 0 10px rgba(0,0,0,0.6); } .version-info { @@ -165,6 +164,14 @@ ul[id*="select2-period-"] { width: 100%; } +.image-holder { + background: #eee; + border: 4px solid #fff; + border-radius: 3px; + box-shadow: 0 0 5px rgba(0,0,0,0.2); + padding: 10px; +} + .video-container iframe { position: absolute; diff --git a/assets/images/error-icon-animated.gif b/assets/images/error-icon-animated.gif new file mode 100644 index 00000000..978107d5 Binary files /dev/null and b/assets/images/error-icon-animated.gif differ diff --git a/assets/images/info-icon-animated.gif b/assets/images/info-icon-animated.gif new file mode 100644 index 00000000..5b676436 Binary files /dev/null and b/assets/images/info-icon-animated.gif differ diff --git a/assets/js/core/app.js b/assets/js/core/app.js index fdc63d11..e9d46e10 100644 --- a/assets/js/core/app.js +++ b/assets/js/core/app.js @@ -30,14 +30,17 @@ $(function () { $('body').addClass('no-transitions'); $('.navigation-main li a').click(function () { - $('.navigation-main li.active').removeClass('active'); - $(this).closest('li').addClass('active'); + var that = $(this); + that.closest('ul').children('li').each(function(){ + $(this).removeClass('active'); + }); + that.parents('li').addClass('active'); }); - if ($('.current-submenu').length > 0) { + /*if ($('.current-submenu').length > 0) { $('.current-submenu').closest('li').addClass('active'); $('.current-submenu').closest('ul').show(); - } + }*/ if ($(".switch-fake-title").length > 0) { diff --git a/assets/js/pages/picker_date.js b/assets/js/pages/picker_date.js index 6d7db104..0b9d8928 100644 --- a/assets/js/pages/picker_date.js +++ b/assets/js/pages/picker_date.js @@ -71,18 +71,51 @@ $(function () { $(this).children('.daterange-single').trigger('focus'); }); + $('.datepicker-group-month').click(function(){ + $(this).children('.daterange-single').trigger('focus'); + }); + $('.fake_datepicker').click(function(){ $(this).next('.input-group').children('.daterange-single').trigger('focus'); }); - $('.daterange-single').datepicker({ + $('.datepicker-group .daterange-single').datepicker({ selectYears: true, selectMonths: true, autoclose: true, //format: 'dd-M-yyyy', format: 'yyyy-mm-dd' }); + + $('.datepicker-group-month .daterange-single').datepicker({ + selectYears: true, + selectMonths: true, + autoclose: true, + format: "mm/yyyy", + minViewMode: 1, + maxViewMode: 2 + }) + .change(function(){ + + var calid2 = $(this).attr('id'); + var selectedDate2 = $(this).val(); + var newDate2 = selectedDate2.split("/"); + $('#monthSelect_' + calid2).val(newDate2[0]); + $('#yearSelect_' + calid2).val(newDate2[1]); + //$(this).closest('form').submit(); + }); + /*.on('changeDate', function(){ + var calid = $(this).attr('id'); + var selectedDate = $(this).val(); + var newDate = selectedDate.split("/"); + + $('#monthSelect_' + calid).val(newDate[0]); + $('#yearSelect_' + calid).val(newDate[1]); + //$(this).closest('form').submit(); + });*/ + + //datepickerMonthYear.changeDate - $('.daterange-single').change(function (e) { + $('.datepicker-group .daterange-single').change(function (e) { $('input[type=submit], button[type=submit]').attr('disabled',true); var calid = $(this).attr('id'); var selectedDate = $(this).val(); @@ -694,4 +727,4 @@ $(function () { }); */ -}); +}); \ No newline at end of file diff --git a/functions/InputsFnc.php b/functions/InputsFnc.php index de8dc408..5f9115b3 100644 --- a/functions/InputsFnc.php +++ b/functions/InputsFnc.php @@ -60,49 +60,49 @@ function DateInput2($value, $name, $selectid, $title = '', $div = true, $allow_n function SearchDateInput($day, $month, $year, $allow_day, $allow_month, $allow_year) { $dt = ''; - $dt.= '
'; + $dt.= '
'; $dt.= ''; - $dt.= ''; + $dt.= ''; $dt.= '
'; - + $dt.= ''; $dt.= ''; $dt.= ''; - - /*if ($allow_day == 'Y') { - $dt.='
'; - $dt.=''; - $dt.='
'; - } - - if ($allow_month == 'Y') { - $dt.='
'; - $dt.=''; - $dt.='
'; - } - - - if ($allow_year == 'Y') { - $dt.='
'; - $dt.=''; - $dt.='
'; - }*/ + /* if ($allow_day == 'Y') { + $dt.='
'; + $dt.=''; + $dt.='
'; + } + + + if ($allow_month == 'Y') { + $dt.='
'; + $dt.=''; + $dt.='
'; + } + + + if ($allow_year == 'Y') { + $dt.='
'; + $dt.=''; + $dt.='
'; + } */ return $dt; } @@ -157,7 +157,7 @@ function TextInput($value, $name, $title = '', $options = '', $div = true, $divO return (($title != '') ? '
' : '') . "" . (($title != '') ? '
' : ''); else { - return (($title != '') ? '
' : '') . "
\",\"div$name\",true); document.getElementById(\"input$name\").focus();' readonly=\"readonly\" class=\"form-control\">" . $value . '
' . (($title != '') ? '
' : ''); + return (($title != '') ? '
' : '') . "
\",\"div$name\",true); document.getElementById(\"input$name\").focus();' readonly=\"readonly\" class=\"form-control\">" . $value . '
' . (($title != '') ? '
' : ''); } } else { $value = str_replace("'", ''', str_replace('"', '”', $value)); @@ -180,16 +180,16 @@ function TextInput_time($value, $name, $title = '', $options = '', $div = true, if (strpos($options, 'size') === false && $value != '') $options .= ' size=' . strlen($value); elseif (strpos($options, 'size') === false) - $options .= ' size=10'; + $options .= ' size=7'; if (strstr($value, '\\') != '') $div = false; if ((trim($value) == '' || $div == false)) // return (($title != '') ? '
' : '') . "" . (($title != '') ? '
' : ''); - return (($title != '') ? '
' : '') . "
" . (($title != '') ? '
' : ''); + return (($title != '') ? '
' : '') . "
" . (($title != '') ? '
' : ''); else { - $tempId = rand(0000,9999); - return (($title != '') ? '
' : '') . "
" . $value . "
" . (($title != '') ? "
" : ""); + $tempId = rand(0000, 9999); + return (($title != '') ? '
' : '') . "
" . $value . "
" . (($title != '') ? "
" : ""); } } else { $value = str_replace("'", ''', str_replace('"', '”', $value)); @@ -290,7 +290,7 @@ function TextInput_mod_a($value, $name, $title = '', $options = '', $div = true) if ((trim($value) == '' || $div == false)) return (($title != '') ? '
' : '') . "" . (($title != '') ? '
' : ''); else - return "
" . ($title != '' ? $title : '') . "\",\"div$name\",true); document.getElementById(\"input$name\").focus();'>
'; + return "
" . ($title != '' ? $title : '') . "\",\"div$name\",true); document.getElementById(\"input$name\").focus();'>" . (($value != '') ? str_replace('"', '”', $value1) : '-') . ($title != '' ? $title : '') . "
"; } else return (((is_array($value) ? $value[1] : $value) != '') ? (is_array($value) ? $value[1] : $value) : '-') . ($title != '' ? '
' . (strpos(strtolower($title), '' : '') . $title . (strpos(strtolower($title), '' : '') . '' : ''); } diff --git a/functions/ListOutputFnc.php b/functions/ListOutputFnc.php index 942de70e..45fa3a91 100644 --- a/functions/ListOutputFnc.php +++ b/functions/ListOutputFnc.php @@ -1436,12 +1436,32 @@ function ListOutput($result, $column_names, $singular = '', $plural = '', $link $number_rec = 100; if ($result_count > $number_rec) { echo "\n"; } } @@ -8006,10 +8026,10 @@ function ListOutput_missing_attn($result, $column_names, $singular = '', $plural if (!isset($_REQUEST['_openSIS_PDF'])) { //echo ''; - $number_rec = 50; + $number_rec = 100; if ($result_count > $number_rec) { echo "\n"; } } diff --git a/functions/PrepareDateFnc.php b/functions/PrepareDateFnc.php index 05c8bca4..f5f30d00 100644 --- a/functions/PrepareDateFnc.php +++ b/functions/PrepareDateFnc.php @@ -33,6 +33,7 @@ // The third parameter (booleen) specifies whether Not Specified should be allowed as an option function PrepareDate($date = '', $title = '', $allow_na = true, $options = '', $cal_img = 'Y') { + //print_r($options); global $_openSIS; if ($options == '') { $options = array(); @@ -78,12 +79,12 @@ function PrepareDate($date = '', $title = '', $allow_na = true, $options = '', $ } $return .= '
'; - $return .= '
'; + $return .= '
'; $return .= '
'; - $return .= ''; } +// $events_RET = DBGet(DBQuery('SELECT ce.TITLE,ce.DESCRIPTION,ce.SCHOOL_DATE,s.TITLE AS SCHOOL +// FROM calendar_events ce,calendar_events_visibility cev,schools s +// WHERE ce.SCHOOL_DATE BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL 30 DAY +// AND ce.SYEAR=\'' . UserSyear() . '\' +// AND ce.school_id IN(' . GetUserSchools(UserID(), true) . ') +// AND s.ID=ce.SCHOOL_ID AND ce.CALENDAR_ID=cev.CALENDAR_ID +// AND ' . (User('PROFILE_ID') == '' ? 'cev.PROFILE=\'parent\'' : 'cev.PROFILE_ID=' . User('PROFILE_ID')) . ' +// ORDER BY ce.SCHOOL_DATE,s.TITLE'), array('SCHOOL_DATE' => 'ProperDate', 'DESCRIPTION' => 'makeDescription')); + $events_RET = DBGet(DBQuery('SELECT ce.TITLE,ce.DESCRIPTION,ce.SCHOOL_DATE,s.TITLE AS SCHOOL FROM calendar_events ce,calendar_events_visibility cev,schools s WHERE ce.SCHOOL_DATE BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL 30 DAY AND ce.SYEAR=\'' . UserSyear() . '\' - AND ce.school_id IN(' . GetUserSchools(UserID(), true) . ') + AND ce.school_id IN(' . UserSchool() . ') AND s.ID=ce.SCHOOL_ID AND ce.CALENDAR_ID=cev.CALENDAR_ID AND ' . (User('PROFILE_ID') == '' ? 'cev.PROFILE=\'parent\'' : 'cev.PROFILE_ID=' . User('PROFILE_ID')) . ' ORDER BY ce.SCHOOL_DATE,s.TITLE'), array('SCHOOL_DATE' => 'ProperDate', 'DESCRIPTION' => 'makeDescription')); diff --git a/modules/scheduling/MassSchedule.php b/modules/scheduling/MassSchedule.php index 4dfc4184..8291891a 100644 --- a/modules/scheduling/MassSchedule.php +++ b/modules/scheduling/MassSchedule.php @@ -645,7 +645,7 @@ function con_date($date) { echo ''; echo '
'; echo ''; //.row - PopTable('footer'); + PopTable_wo_header('footer'); } if ($note) { diff --git a/modules/schoolsetup/Calendar.php b/modules/schoolsetup/Calendar.php index e880227a..66bd2af1 100644 --- a/modules/schoolsetup/Calendar.php +++ b/modules/schoolsetup/Calendar.php @@ -730,20 +730,23 @@ foreach ($title_RET as $title) { $options[$title['CALENDAR_ID']] = $title['TITLE']; } - + //echo date('M Y',strtotime('first day of +1 month')); if (AllowEdit()) { $tmp_REQUEST = $_REQUEST; unset($tmp_REQUEST['calendar_id']); if ($_REQUEST['calendar_id']) { - $link .= '
'; - $link .= '
' . SelectInput($_REQUEST['calendar_id'], 'calendar_id', '', $options, false, " onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . '&calendar_id="+this.form.calendar_id.value;\' ', false) . '
'; + $link .= '
'; + $link .= '
' . SelectInput($_REQUEST['calendar_id'], 'calendar_id', '', $options, false, " onchange='document.location.href=\"" . PreparePHP_SELF($tmp_REQUEST) . '&calendar_id="+this.form.calendar_id.value;\' ', false) . '
'; + $link .= '

' . date("F Y", $time) . '

'; if (User('PROFILE') == 'admin') { - $link .="
"; - $link .="
"; + $link .= '
'; + $link .= "
"; + $link .= "
"; + $link .= '
'; } - $link .= '
'; //.form-inline + $link .= '
'; //.row } } else { @@ -771,7 +774,7 @@ echo '
'; echo '
'; echo '
'; - DrawHeaderHome('
' . PrepareDate(strtoupper(date("d-M-y", $time)), '', false, array('M' => 1, 'Y' => 1, 'submit' => true)) . '
' . ' List Events', (User('PROFILE') == 'admin' ? SubmitButton('Save', '', 'class="btn btn-primary m-l-5"') : '')); + DrawHeaderHome('
' . PrepareDate(strtoupper(date("d-M-y", $time)), '', false, array('M' => date("m", $time), 'Y' => date("y", $time), 'submit' => true, 'view' => 'month')) . '
' . ' List Events', (User('PROFILE') == 'admin' ? SubmitButton('Save', '', 'class="btn btn-primary m-l-5"') : '')); echo '
'; //.form-inline echo '
'; //.panel-body echo '
'; //.panel diff --git a/modules/schoolsetup/CopySchool.php b/modules/schoolsetup/CopySchool.php index 0c9377aa..719895d4 100644 --- a/modules/schoolsetup/CopySchool.php +++ b/modules/schoolsetup/CopySchool.php @@ -69,11 +69,31 @@ DBQuery('INSERT INTO schools (ID,SYEAR,TITLE) values(\'' . $id . '\',\'' . $new_sch_syear . '\',\'' . str_replace("'", "''", str_replace("\'", "''", paramlib_validation($col = TITLE, $_REQUEST['title']))) . '\')'); DBQuery('INSERT INTO school_years (MARKING_PERIOD_ID,SYEAR,SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_EXAM,DOES_COMMENTS,ROLLOVER_ID) SELECT fn_marking_period_seq(),SYEAR,\'' . $id . '\' AS SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_EXAM,DOES_COMMENTS,MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY MARKING_PERIOD_ID'); DBQuery('INSERT INTO program_config(SCHOOL_ID,SYEAR,PROGRAM,TITLE,VALUE) VALUES(\'' . $id . '\',\'' . $new_sch_syear . '\',\'MissingAttendance\',\'LAST_UPDATE\',\'' . date('Y-m-d') . '\')'); + DBQuery('INSERT INTO program_config(SCHOOL_ID,SYEAR,PROGRAM,TITLE,VALUE) VALUES(\'' . $id . '\',\'' . $new_sch_syear . '\',\'UPDATENOTIFY\',\'display_school\',"Y")'); - DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear)VALUES(\'' . User('STAFF_ID') . '\',\'' . $id . '\',\'' . UserSyear() . '\')'); + $current_start_date = DBGet(DBQuery('SELECT START_DATE FROM staff_school_relationship WHERE STAFF_ID=\'' . User('STAFF_ID') . '\' AND SCHOOL_ID='.UserSchool().' AND syear='.UserSyear().'')); + $temp_start_date=''; + if($current_start_date[1]['START_DATE']!='') + $temp_start_date=$current_start_date[1]['START_DATE']; + else + $temp_start_date=date('Y-m-d'); + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date)VALUES(\'' . User('STAFF_ID') . '\',\'' . $id . '\',\'' . UserSyear() . '\',"'.$temp_start_date.'")'); + $other_admin_details=DBGet(DBQuery('SELECT * FROM login_authentication WHERE PROFILE_ID=0 AND USER_ID!=' . User('STAFF_ID') . '')); + if(!empty($other_admin_details)) + { + foreach($other_admin_details as $school_data) + { + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date) VALUES (' . $school_data['USER_ID'] . ',' . $id . ',' . UserSyear(). ',"'.$temp_start_date.'")'); + } + } if (User('PROFILE_ID') != 0) { $super_id = DBGet(DBQuery('SELECT STAFF_ID FROM staff WHERE PROFILE_ID=0 AND PROFILE=\'admin\'')); - DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear) VALUES (' . $super_id[1]['STAFF_ID'] . ',' . $id . ',' . UserSyear() . ')'); + $current_start_date = DBGet(DBQuery('SELECT START_DATE FROM staff_school_relationship WHERE STAFF_ID=\'' . $super_id[1]['STAFF_ID'] . '\' AND SCHOOL_ID='.$id.' AND syear='.UserSyear().'')); + if($current_start_date[1]['START_DATE']!='') + $temp_start_date=$current_start_date[1]['START_DATE']; + else + $temp_start_date=date('Y-m-d'); + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date) VALUES (' . $super_id[1]['STAFF_ID'] . ',' . $id . ',' . UserSyear() . ',"'.$temp_start_date.'")'); } foreach ($_REQUEST['tables'] as $table => $value) _rollover($table); diff --git a/modules/schoolsetup/Courses.php b/modules/schoolsetup/Courses.php index 32c56003..395df8b5 100644 --- a/modules/schoolsetup/Courses.php +++ b/modules/schoolsetup/Courses.php @@ -2182,7 +2182,7 @@ $header .='' . SelectInput($cp_var_val['PERIOD_ID'], 'course_period_variable[' . $_REQUEST['course_period_id'] . '][' . $cp_var_val['ID'] . '][PERIOD_ID]' . $i, '', $periods, 'N/A', 'id=' . $cp_var_val['DAYS'] . $i . '_period class=form-control onchange=show_period_time(this.value,"' . $cp_var_val['DAYS'] . $i . '","' . $_REQUEST['course_period_id'] . '","' . $cp_var_val['ID'] . '");', $div) . ''; $header .='
' . ($cp_var_val['PERIOD_ID'] ? ProperTime($cp_var_val[START_TIME]) . ' To ' . ProperTime($cp_var_val[END_TIME]) . '' : '') . '
'; $header .='' . SelectInput($cp_var_val['ROOM_ID'], 'course_period_variable[' . $_REQUEST['course_period_id'] . '][' . $cp_var_val['ID'] . '][ROOM_ID]', '', $rooms, 'N/A', 'id=' . $cp_var_val['DAYS'] . '_room ', $div) . ''; - $header .='' . CheckboxInput($cp_var_val['DOES_ATTENDANCE'], 'course_period_variable[' . $_REQUEST['course_period_id'] . '][' . $cp_var_val['ID'] . '][DOES_ATTENDANCE]' . $i, '', '', false, 'Yes', 'No', ($value == 'Y' ? $div : false), ' id=' . $cp_var_val['DAYS'] . $i . '_does_attendance onclick="formcheck_periods_attendance_F2(3,this,' . $i . ');"') . '
'; + $header .='' . CheckboxInput($cp_var_val['DOES_ATTENDANCE'], 'course_period_variable[' . $_REQUEST['course_period_id'] . '][' . $cp_var_val['ID'] . '][DOES_ATTENDANCE]' . $i, '', '', true, 'Yes', 'No', ($value == 'Y' ? $div : false), ' id=' . $cp_var_val['DAYS'] . $i . '_does_attendance onclick="formcheck_periods_attendance_F2(3,this,' . $i . ');"') . '
'; $does_attendance_ids[] = $cp_var_val['DAYS'] . $i . '_does_attendance'; echo ''; echo ''; @@ -2200,7 +2200,7 @@ $header .='' . SelectInput('', 'course_period_variable[' . $_REQUEST['course_period_id'] . '][n][PERIOD_ID]', '', $periods, 'N/A', 'id=n_period class=form-control ' . $disable . ' onchange=show_period_time(this.value,"n","' . $_REQUEST['course_period_id'] . '","n");', $div) . ''; $header .='
'; $header .='' . SelectInput('', 'course_period_variable[' . $_REQUEST['course_period_id'] . '][n][ROOM_ID]', '', $rooms, 'N/A', 'id=n_room ' . $disable, $div) . ''; - $header .='' . CheckboxInput('', 'course_period_variable[' . $_REQUEST['course_period_id'] . '][n][DOES_ATTENDANCE]', '', '', false, 'Yes', 'No', ($value == 'Y' ? $div : false), ' id=n_does_attendance onclick="formcheck_periods_attendance_F2(4,this);"' . $disable) . '
'; + $header .='' . CheckboxInput('', 'course_period_variable[' . $_REQUEST['course_period_id'] . '][n][DOES_ATTENDANCE]', '', '', true, 'Yes', 'No', ($value == 'Y' ? $div : false), ' id=n_does_attendance onclick="formcheck_periods_attendance_F2(4,this);"' . $disable) . '
'; $header .= ''; $header .= '
'; $header .=''; diff --git a/modules/schoolsetup/MarkingPeriods.php b/modules/schoolsetup/MarkingPeriods.php index ea6c4aa4..01d72157 100644 --- a/modules/schoolsetup/MarkingPeriods.php +++ b/modules/schoolsetup/MarkingPeriods.php @@ -616,10 +616,10 @@ $calender=$calender[1]; $attendance_calendar=DBGet(DBQuery('SELECT MIN(SCHOOL_DATE) as START_DATE,MAX(SCHOOL_DATE) as END_DATE FROM attendance_calendar WHERE SCHOOL_ID=\''.UserSchool().'\' AND SYEAR=\''.UserSyear().'\'')); // - - $vdate = explode("-", $columns['END_DATE']); $calender=$calender[1]; - $m=MonthNWSwitch($vdate[1],'tonum'); - $end_m=$vdate[0]."-".$m."-".$vdate[1]; + ; +// $vdate = explode("-", $columns['END_DATE']); $calender=$calender[1]; +// $m=MonthNWSwitch($vdate[1],'tonum'); + $end_m=date('Y-m-d',$columns['END_DATE']); if($attendance_calendar[1]['END_DATE']!='' && strtotime($end_m)>strtotime($attendance_calendar[1]['END_DATE'])) { @@ -1129,8 +1129,11 @@ $header .= '
'; $header .= '
' . CheckboxInput_comments($RET['DOES_COMMENTS'], 'tables[' . $_REQUEST['marking_period_id'] . '][DOES_COMMENTS]', '', $checked, $_REQUEST['marking_period_id'] == 'new', '', '') . '
'; $header .= '
'; - $header .= '
' . CheckboxInput_grade($RET['DOES_GRADES'], 'tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]', '', $checked, $_REQUEST['marking_period_id'] == 'new', '', '', 'true', 'onclick=show_div("tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]","' . $_REQUEST['marking_period_id'] . '");') . '
'; - $header .= '
'; + if($RET['DOES_GRADES']!='') + $header .= '
' . CheckboxInput_grade($RET['DOES_GRADES'], 'tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]', '', $checked, $_REQUEST['marking_period_id'] == 'new', '', '', 'true', 'onclick=show_div("tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]",'. $_REQUEST['marking_period_id'] .');') . '
'; + else + $header .= '
' . CheckboxInput_grade($RET['DOES_GRADES'], 'tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]', '', $checked, $_REQUEST['marking_period_id'] == 'new', '', '', 'true', 'onclick=show_div(\'tables[' . $_REQUEST['marking_period_id'] . '][DOES_GRADES]\',\''. $_REQUEST['marking_period_id'] .'\');') . '
'; + $header .= ''; $header .= ''; //.row $header .= '
'; diff --git a/modules/schoolsetup/Schools.php b/modules/schoolsetup/Schools.php index 2b140e8f..57e81f4c 100644 --- a/modules/schoolsetup/Schools.php +++ b/modules/schoolsetup/Schools.php @@ -125,16 +125,25 @@ $sql = 'INSERT INTO schools (SYEAR' . $fields . ') values(' . $syear . '' . $values . ')'; DBQuery($sql); - DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear) VALUES (' . UserID() . ',' . $id . ',' . $syear. ')'); + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date) VALUES (' . UserID() . ',' . $id . ',' . $syear. ',"'.date('Y-m-d').'")'); + $other_admin_details=DBGet(DBQuery('SELECT * FROM login_authentication WHERE PROFILE_ID=0 AND USER_ID!=' . UserID() . '')); + if(!empty($other_admin_details)) + { + foreach($other_admin_details as $school_data) + { + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date) VALUES (' . $school_data['USER_ID'] . ',' . $id . ',' . $syear. ',"'.date('Y-m-d').'")'); + } + } if (User('PROFILE_ID') != 0) { $super_id = DBGet(DBQuery('SELECT STAFF_ID FROM staff WHERE PROFILE_ID=0 AND PROFILE=\'admin\'')); - DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear) VALUES (' . $super_id[1]['STAFF_ID'] . ',' . $id . ',' . $syear . ')'); + DBQuery('INSERT INTO staff_school_relationship(staff_id,school_id,syear,start_date) VALUES (' . $super_id[1]['STAFF_ID'] . ',' . $id . ',' . $syear . ',"'.date('Y-m-d').'")'); } // DBQuery('INSERT INTO school_years (MARKING_PERIOD_ID,SYEAR,SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_EXAM,DOES_COMMENTS,ROLLOVER_ID) SELECT fn_marking_period_seq(),SYEAR,\'' . $id . '\' AS SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,POST_START_DATE,POST_END_DATE,DOES_GRADES,DOES_EXAM,DOES_COMMENTS,MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY MARKING_PERIOD_ID'); DBQuery('INSERT INTO school_years (MARKING_PERIOD_ID,SYEAR,SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,START_DATE,END_DATE,ROLLOVER_ID) SELECT fn_marking_period_seq(),\''.$syear.'\' as SYEAR,\'' . $id . '\' AS SCHOOL_ID,TITLE,SHORT_NAME,SORT_ORDER,\''.$start_date.'\' as START_DATE,\''.$end_date.'\' as END_DATE,MARKING_PERIOD_ID FROM school_years WHERE SYEAR=\'' . UserSyear() . '\' AND SCHOOL_ID=\'' . UserSchool() . '\' ORDER BY MARKING_PERIOD_ID'); DBQuery('INSERT INTO system_preference(school_id, full_day_minute, half_day_minute) VALUES (' . $id . ', NULL, NULL)'); DBQuery('INSERT INTO program_config (SCHOOL_ID,SYEAR,PROGRAM,TITLE,VALUE) VALUES(\'' . $id . '\',\'' . $syear. '\',\'MissingAttendance\',\'LAST_UPDATE\',\'' . date('Y-m-d') . '\')'); + DBQuery('INSERT INTO program_config(SCHOOL_ID,SYEAR,PROGRAM,TITLE,VALUE) VALUES(\'' . $id . '\',\'' . $syear . '\',\'UPDATENOTIFY\',\'display_school\',"Y")'); $_SESSION['UserSchool'] = $id; unset($_REQUEST['new_school']); } @@ -221,36 +230,36 @@ echo '
'; //.col-lg-6 echo '
'; - echo "
" . TextInput($schooldata['ADDRESS'], 'values[ADDRESS]', '', 'class=cell_floating maxlength=100 size=24') . "
"; + echo "
" . TextInput($schooldata['ADDRESS'], 'values[ADDRESS]', '', 'class=cell_floating maxlength=100 size=24') . "
"; echo '
'; //.col-lg-6 echo ''; //.row echo '
'; echo '
'; - echo "
" . TextInput($schooldata['CITY'], 'values[CITY]', '', 'maxlength=100, class=cell_floating size=24') . "
"; + echo "
" . TextInput($schooldata['CITY'], 'values[CITY]', '', 'maxlength=100, class=cell_floating size=24') . "
"; echo '
'; //.col-lg-6 echo '
'; - echo "
" . TextInput($schooldata['STATE'], 'values[STATE]', '', 'maxlength=100, class=cell_floating size=24') . "
"; + echo "
" . TextInput($schooldata['STATE'], 'values[STATE]', '', 'maxlength=100, class=cell_floating size=24') . "
"; echo '
'; //.col-lg-6 echo '
'; //.row echo '
'; echo '
'; - echo "
" . TextInput($schooldata['ZIPCODE'], 'values[ZIPCODE]', '', 'maxlength=10 class=cell_floating size=24') . "
"; + echo "
" . TextInput($schooldata['ZIPCODE'], 'values[ZIPCODE]', '', 'maxlength=10 class=cell_floating size=24') . "
"; echo '
'; //.col-lg-6 echo '
'; - echo "
" . TextInput($schooldata['PHONE'], 'values[PHONE]', '', 'class=cell_floating size=24') . "
"; + echo "
" . TextInput($schooldata['PHONE'], 'values[PHONE]', '', 'class=cell_floating size=24') . "
"; echo '
'; //.col-lg-6 echo '
'; //.row echo '
'; echo '
'; - echo "
" . TextInput($schooldata['PRINCIPAL'], 'values[PRINCIPAL]', '', 'class=cell_floating size=24') . "
"; + echo "
" . TextInput($schooldata['PRINCIPAL'], 'values[PRINCIPAL]', '', 'class=cell_floating size=24') . "
"; echo '
'; //.col-lg-6 echo '
'; @@ -291,9 +300,9 @@ if(!$_REQUEST['new_school'] && count($sch_img_info)>0) - echo "
" . (AllowEdit() != false ? "" : '') . "" . (AllowEdit() != false ? "" : '') . "" . (AllowEdit() != false ? "Click here to change logo" : '') . "
"; + echo "
" . (AllowEdit() != false ? "" : '') . "
" . (AllowEdit() != false ? "
" : '') . (AllowEdit() != false ? " Click here to change logo" : '') . "
"; else if (!$_REQUEST['new_school']) - echo "
" . (AllowEdit() != false ? "Click here to upload logo" : '-') . "
"; + echo "
" . (AllowEdit() != false ? " Click here to upload logo" : '-') . "
"; echo '
'; //.col-md-4 echo '
'; //.row @@ -307,23 +316,24 @@ echo "
" . DateInputAY($get_this_school_date[1]['START_DATE'], '_min', 1). "
"; echo ''; //.col-md-6 - echo '
'; echo '
'; echo "
" . DateInputAY($get_this_school_date[1]['END_DATE'], '_max', 2). "
"; echo '
'; //.col-md-6 + echo '
'; //.row } + $btns = ''; if (User('PROFILE') == 'admin' && AllowEdit()) { - echo '
'; + //echo '
'; if ($_REQUEST['new_school']) { - echo "
"; + $btns = "
"; } else { - echo "
"; + $btns = "
"; } } - PopTable('footer'); + PopTable('footer',$btns); echo ""; } diff --git a/modules/schoolsetup/UploadLogo.php b/modules/schoolsetup/UploadLogo.php index fa782ddb..66fae420 100644 --- a/modules/schoolsetup/UploadLogo.php +++ b/modules/schoolsetup/UploadLogo.php @@ -37,25 +37,23 @@ //} if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'edit') { - + // if ($SchoolLogoPath && (($file = @fopen($picture_path = $_SESSION['logo_path'], 'r')) )) { // echo '
'; // } // unset($_REQUEST['modfunc']); - - $sch_img_info= DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID='.UserSchool().' AND FILE_INFO=\'schlogo\'')); - if(count($sch_img_info)>0) - { - echo '
'; - } - unset($_REQUEST['modfunc']); - + + $sch_img_info = DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID=' . UserSchool() . ' AND FILE_INFO=\'schlogo\'')); + if (count($sch_img_info) > 0) { + echo '
'; + } + unset($_REQUEST['modfunc']); } if (UserSchool()) { - + if (clean_param($_REQUEST['action'], PARAM_ALPHAMOD) == 'upload' && $_FILES['file']['name']) { - - + + // $upload = new upload(); // $upload->name = $_FILES["file"]["name"]; // $target_path = $SchoolLogoPath . '/' . substr($_FILES["file"]["name"], 0, strrpos($_FILES["file"]["name"], ".")) . UserSchool() . '.' . $upload->get_file_extension($upload->name); @@ -82,57 +80,52 @@ //'; // PopTable('footer'); // } - $fileName=$_FILES['file']['name']; - $tmpName = $_FILES['file']['tmp_name']; + $fileName = $_FILES['file']['name']; + $tmpName = $_FILES['file']['tmp_name']; $fileSize = $_FILES['file']['size']; $fileType = $_FILES['file']['type']; - $upload= new upload(); - $upload->name=$_FILES["file"]["name"]; - $upload->fileSize=$fileSize; + $upload = new upload(); + $upload->name = $_FILES["file"]["name"]; + $upload->fileSize = $fileSize; // $target_path=$SchoolLogoPath.'/'.substr($_FILES["file"]["name"],0,strrpos($_FILES["file"]["name"],".")).UserSchool().'.'.$upload->get_file_extension($upload->name); - // $destination_path = $SchoolLogoPath; // $upload->target_path=$target_path; // // $upload->destination_path=$destination_path; - $sch_img_info= DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID='.UserSchool().' AND FILE_INFO=\'schlogo\'')); - if(count($sch_img_info)>0) + $sch_img_info = DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID=' . UserSchool() . ' AND FILE_INFO=\'schlogo\'')); + if (count($sch_img_info) > 0) $upload->deleteOldImage($sch_img_info[1]['ID']); - $upload->setFileExtension(); - - $upload->validateImage(); - if($upload->wrongFormat==1){ - $_FILES["file"]["error"]=1; - } + $upload->setFileExtension(); + + $upload->validateImage(); + if ($upload->wrongFormat == 1) { + $_FILES["file"]["error"] = 1; + } $upload->validateImageSize(); - if($upload->wrongSize==1){ - $_FILES["file"]["error"]=1; - } - if ($_FILES["file"]["error"] > 0 && $upload->wrongFormat==1) - { - $msg = "Cannot upload file. Only jpeg, jpg, png, gif files are allowed."; - echo ' - '.$msg.' + if ($upload->wrongSize == 1) { + $_FILES["file"]["error"] = 1; + } + if ($_FILES["file"]["error"] > 0 && $upload->wrongFormat == 1) { + $msg = "Cannot upload file. Only jpeg, jpg, png, gif files are allowed."; + echo ' + ' . $msg . '
'; -echo '
Select Logo: (Maximum upload file size 10 MB)

+ echo '
Select Logo: (Maximum upload file size 10 MB)

 
'; -PopTable ('footer'); - } - else if ($_FILES["file"]["error"] > 0 && $upload->wrongSize==1) - { - $msg = "File too large. Maximum upload file size limit 10 MB."; - echo ' - '.$msg.' + PopTable('footer'); + } else if ($_FILES["file"]["error"] > 0 && $upload->wrongSize == 1) { + $msg = "File too large. Maximum upload file size limit 10 MB."; + echo ' + ' . $msg . '
'; -echo '
Select Logo: (Maximum upload file size 10 MB)

+ echo '
Select Logo: (Maximum upload file size 10 MB)

 
'; -PopTable ('footer'); - } - else { - - + PopTable('footer'); + } else { + + // move_uploaded_file($_FILES["file"]["tmp_name"], $upload->target_path); // if ($_SESSION['logo_path']) { // $upload_edit_sql = DBQuery("UPDATE program_config SET VALUE='$upload->target_path' WHERE SCHOOL_ID='" . UserSchool() . "' AND PROGRAM='SchoolLogo' AND TITLE='PATH'"); @@ -150,28 +143,24 @@ // $filename = $upload->target_path; // echo '
'; // PopTable('footer'); - - $fp = fopen($tmpName, 'r'); + + $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); - if(!get_magic_quotes_gpc()) - { + if (!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } - DBQuery('INSERT INTO user_file_upload (USER_ID,PROFILE_ID,SCHOOL_ID,SYEAR,NAME, SIZE, TYPE, CONTENT,FILE_INFO) VALUES ('.UserID().','. UserProfileID().','.UserSchool().','.UserSyear().',\''.$fileName.'\', \''.$fileSize.'\', \''.$fileType.'\', \''.$content.'\',\'schlogo\')'); - $sch_img_info= DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID='. UserSchool().' AND FILE_INFO=\'schlogo\'')); - - echo '
'; + DBQuery('INSERT INTO user_file_upload (USER_ID,PROFILE_ID,SCHOOL_ID,SYEAR,NAME, SIZE, TYPE, CONTENT,FILE_INFO) VALUES (' . UserID() . ',' . UserProfileID() . ',' . UserSchool() . ',' . UserSyear() . ',\'' . $fileName . '\', \'' . $fileSize . '\', \'' . $fileType . '\', \'' . $content . '\',\'schlogo\')'); + $sch_img_info = DBGet(DBQuery('SELECT * FROM user_file_upload WHERE SCHOOL_ID=' . UserSchool() . ' AND FILE_INFO=\'schlogo\'')); + + echo '
'; //fclose($upload->target_path); - // $filename = $upload->target_path; - echo '
'; - PopTable ('footer'); - - + echo '
'; + PopTable('footer'); } } else { echo ' diff --git a/modules/students/AssignOtherInfo.php b/modules/students/AssignOtherInfo.php index ce976f25..9a156075 100644 --- a/modules/students/AssignOtherInfo.php +++ b/modules/students/AssignOtherInfo.php @@ -300,7 +300,7 @@ $select_options[$option] = $option; } - array_push($fields, "
" . _makeSelectInput($field[TITLE], $select_options) . '
'); + array_push($fields, "
" . _makeSelectInput($field[TITLE], $select_options) . '
'); } else { $select_options = array(); $field['SELECT_OPTIONS'] = str_replace("\n", "\r", str_replace("\r\n", "\r", $field['SELECT_OPTIONS'])); @@ -310,7 +310,7 @@ $select_options[$option] = $option; } - array_push($fields, "
" . _makeSelectInput('CUSTOM_' . $field['ID'], $select_options) . '
'); + array_push($fields, "
" . _makeSelectInput('CUSTOM_' . $field['ID'], $select_options) . '
'); } } } @@ -415,7 +415,7 @@ $item .= '
' . $col1html . '
' . $col2html . '
'; echo $item; - PopTable('footer'); + PopTable_wo_header('footer'); echo ''; //.col-md-6 echo ''; //.row @@ -437,7 +437,7 @@ $extra['search'] .= ''; //.row $extra['functions'] = array('CHECKBOX' => '_makeChooseCheckbox'); - $extra['columns_before'] = array('CHECKBOX' => ''); + $extra['columns_before'] = array('CHECKBOX' => ''); $extra['new'] = true; Search('student_id', $extra); diff --git a/modules/tools/Backup.php b/modules/tools/Backup.php index c474f797..ae5d7779 100644 --- a/modules/tools/Backup.php +++ b/modules/tools/Backup.php @@ -44,7 +44,38 @@ if (('Backup' == $_REQUEST['action']) || ($_REQUEST['action'] == 'backup')) { $print_form = 0; - EXPORT_TABLES($host, $user, $pass, $name); + $date_time = date("m-d-Y"); + //EXPORT_TABLES($host, $user, $pass, $name); + $Export_FileName = $name . 'Backup' . $date_time . '.sql'; + $dbconn = new mysqli($host,$user,$pass,$name,$port); + if($dbconn->connect_errno!=0) + exit($dbconn->error); + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $result = $dbconn->query("SHOW VARIABLES LIKE 'basedir'"); + $row = $result->fetch_assoc(); + $mysql_dir1 = substr($row['Value'], 0, 2); +// $sql_path_arr=explode("\\",$_SERVER['MYSQL_HOME']); +// $sql_path="\\".$sql_path_arr[1].'8\\'.$sql_path_arr[2].'\\'.$sql_path_arr[3]; + $mysql_dir = str_replace('\\', '\\\\', $mysql_dir1 . $_SERVER['MYSQL_HOME']); +} + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + if ($pass == '') + exec("$mysql_dir\\mysqldump -n -c --skip-add-locks --skip-disable-keys --routines --triggers --user $user $name > $Export_FileName"); + else + exec("$mysql_dir\\mysqldump -n -c --skip-add-locks --skip-disable-keys --routines --triggers --user $user --password='$pass' $name > $Export_FileName"); +} +else { + exec("mysqldump -n -c --skip-add-locks --skip-disable-keys --routines --triggers --user $user --password='$pass' $name > $Export_FileName"); +} + $content= file_get_contents($Export_FileName); + $fname=$Export_FileName; + unlink($Export_FileName); + header('Content-Type: application/octet-stream'); + header("Content-Transfer-Encoding: Binary"); + header("Content-disposition: attachment; filename=\"" . $fname . "\""); + //$content= file_get_contents($Export_FileName); + echo $content; + exit; //see import.php too } if ($print_form > 0 && !$_REQUEST['modfunc'] == 'cancel') { @@ -219,7 +250,7 @@ function EXPORT_TABLES($host, $user, $pass, $name, $tables = false, $backup_name INNER JOIN schools s ON s.ID=acc.SCHOOL_ID LEFT JOIN teacher_reassignment tra ON (cp.course_period_id=tra.course_period_id) INNER JOIN schedule sch ON sch.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND sch.student_id IN(SELECT student_id FROM student_enrollment se WHERE sch.school_id=se.school_id AND sch.syear=se.syear AND start_date<=acc.school_date AND (end_date IS NULL OR end_date>=acc.school_date)) AND (cp.MARKING_PERIOD_ID IS NOT NULL AND cp.MARKING_PERIOD_ID IN (SELECT MARKING_PERIOD_ID FROM school_years WHERE SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM school_semesters WHERE SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM school_quarters WHERE SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE) OR (cp.MARKING_PERIOD_ID IS NULL AND acc.school_date BETWEEN cp.begin_date AND cp.end_date)) - AND sch.START_DATE<=acc.SCHOOL_DATE AND (sch.END_DATE IS NULL OR sch.END_DATE>=acc.SCHOOL_DATE ) AND cpv.DOES_ATTENDANCE='Y' AND acc.SCHOOL_DATE<=CURDATE() AND cp.course_period_id=cp_id + AND sch.START_DATE<=acc.SCHOOL_DATE AND (sch.END_DATE IS NULL OR sch.END_DATE>=acc.SCHOOL_DATE ) AND cpv.DOES_ATTENDANCE='Y' AND acc.SCHOOL_DATE0 AND srcg.course_period_id IS NOT NULL AND (rcgs.gpa_cal='Y' OR cp.grade_scale_id IS NULL) AND srcg.marking_period_id NOT LIKE 'E%' AND (eg.START_DATE IS NULL OR eg.START_DATE='0000-00-00' OR eg.START_DATE<=CURDATE()) AND (eg.END_DATE IS NULL OR eg.END_DATE='0000-00-00' OR eg.END_DATE>=CURDATE()) GROUP BY srcg.student_id,eg.short_name; - - - IF NOT EXISTS(SELECT NULL FROM student_gpa_calculated WHERE marking_period_id=mp_id AND student_id=s_id) THEN + +IF NOT EXISTS(SELECT NULL FROM student_gpa_calculated WHERE marking_period_id=mp_id AND student_id=s_id) THEN INSERT INTO student_gpa_calculated (student_id,marking_period_id) VALUES(s_id,mp_id); END IF; @@ -587,10 +617,8 @@ class_rank = rank WHERE srcg.marking_period_id=mp_id AND srcg.student_id=s_id AND srcg.gp_scale<>0 AND srcg.school_id=sch_id AND srcg.syear=sy AND srcg.marking_period_id NOT LIKE 'E%' AND (eg.START_DATE IS NULL OR eg.START_DATE='0000-00-00' OR eg.START_DATE<=CURDATE()) AND (eg.END_DATE IS NULL OR eg.END_DATE='0000-00-00' OR eg.END_DATE>=CURDATE()) GROUP BY srcg.student_id,eg.short_name; - - - IF NOT EXISTS(SELECT NULL FROM student_gpa_calculated WHERE marking_period_id=mp_id AND student_id=s_id) THEN +IF NOT EXISTS(SELECT NULL FROM student_gpa_calculated WHERE marking_period_id=mp_id AND student_id=s_id) THEN INSERT INTO student_mp_stats(student_id,marking_period_id) VALUES(s_id,mp_id); END IF; @@ -775,6 +803,7 @@ class_rank = rank header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . $backup_name . "\""); + //$a= file_get_contents($content); echo $content; exit; } diff --git a/modules/tools/DataImport.php b/modules/tools/DataImport.php index 7d152f55..41d4a8af 100644 --- a/modules/tools/DataImport.php +++ b/modules/tools/DataImport.php @@ -93,7 +93,7 @@ function add_person($first, $middle, $last, $email) { echo ''; //.panel-heading echo '
'; - + echo '
'; echo ''; echo ''; echo ''; @@ -120,7 +120,7 @@ function add_person($first, $middle, $last, $email) { } $_SESSION['data'] = $arr_data; - $options = array('FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'NAME_SUFFIX' => 'Name Suffix', 'GENDER' => 'Gender', 'ETHNICITY' => 'Ethnicity', 'COMMON_NAME' => 'Common Name', 'SOCIAL_SECURITY' => 'Social Security', 'BIRTHDATE' => 'Birthdate', 'LANGUAGE' => 'Language', 'ESTIMATED_GRAD_DATE' => 'Estimated Grade Date', 'ALT_ID' => 'Alternate Id', 'EMAIL' => 'Email (Student\'s)', 'PHONE' => 'Contact No (Student\'s)', 'IS_DISABLE' => 'Disabled'); + $options = array('FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'NAME_SUFFIX' => 'Name Suffix', 'GENDER' => 'Gender', 'ETHNICITY' => 'Ethnicity', 'COMMON_NAME' => 'Common Name', 'SOCIAL_SECURITY' => 'Social Security', 'BIRTHDATE' => 'Birthdate', 'LANGUAGE' => 'Language', 'ESTIMATED_GRAD_DATE' => 'Estimated Graduation Date', 'ALT_ID' => 'Alternate Id', 'EMAIL' => 'Email (Student\'s)', 'PHONE' => 'Contact No (Student\'s)', 'IS_DISABLE' => 'Disabled'); $options+=array('USERNAME' => 'Username', 'PASSWORD' => 'Password'); $options+=array('GRADE_ID' => 'Grade', 'SECTION_ID' => 'Section', 'START_DATE' => 'Student Enrollment Date', 'END_DATE' => 'Student Enrollment End Date'); @@ -169,8 +169,8 @@ function add_person($first, $middle, $last, $email) { //print_r($options); } - echo "
These fields are in your Excel spread sheet These are available fields in openSIS
"; - + echo ''; + echo '
'; //.table-responsive echo '
'; //.panel-body echo ''; echo ''; @@ -188,10 +188,10 @@ function add_person($first, $middle, $last, $email) { echo ''; //.panel-body echo '
'; - + echo '
'; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; // $custom=DBGet(DBQuery("SHOW COLUMNS FROM STUDENTS WHERE FIELD IN ('FIRST_NAME','MIDDLE_NAME' ,'LAST_NAME','GENDER','LANGUAGE','BIRTHDATE','ESTIMATED_GRAD_DATE','PHONE','USERNAME') ")); @@ -207,7 +207,7 @@ function add_person($first, $middle, $last, $email) { // $options[$custom_enroll_value['FIELD']]=strtoupper(str_replace("_", " ", $custom_enroll_value['FIELD']) ); // } - $options = array('FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'NAME_SUFFIX' => 'Name Suffix', 'GENDER' => 'Gender', 'ETHNICITY' => 'Ethnicity', 'COMMON_NAME' => 'Common Name', 'SOCIAL_SECURITY' => 'Social Security', 'BIRTHDATE' => 'Birthdate', 'LANGUAGE' => 'Language', 'ESTIMATED_GRAD_DATE' => 'Estimated Grade Date', 'ALT_ID' => 'Alternate Id', 'EMAIL' => 'Email (Student\'s)', 'PHONE' => 'Contact No (Student\'s)', 'IS_DISABLE' => 'Disabled'); + $options = array('FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'NAME_SUFFIX' => 'Name Suffix', 'GENDER' => 'Gender', 'ETHNICITY' => 'Ethnicity', 'COMMON_NAME' => 'Common Name', 'SOCIAL_SECURITY' => 'Social Security', 'BIRTHDATE' => 'Birthdate', 'LANGUAGE' => 'Language', 'ESTIMATED_GRAD_DATE' => 'Estimated Graduation Date', 'ALT_ID' => 'Alternate Id', 'EMAIL' => 'Email (Student\'s)', 'PHONE' => 'Contact No (Student\'s)', 'IS_DISABLE' => 'Disabled'); $options+=array('USERNAME' => 'Username', 'PASSWORD' => 'Password'); $options+=array('GRADE_ID' => 'Grade', 'SECTION_ID' => 'Section', 'START_DATE' => 'Student Enrollment Date', 'END_DATE' => 'Student Enrollment End Date'); @@ -242,12 +242,14 @@ function add_person($first, $middle, $last, $email) { echo ""; } - echo ""; + echo ""; } echo ''; echo '
These fields are in your Excel spread sheet These are available fields in openSIS (Click to change the field values)
These fields are in your Excel spread sheet These are available fields in openSIS
" . SelectInput($value_stu, 'student[' . $key_stu . '][' . $value_stu . ']', '', $options, 'N/A', ' onchange=drawmapping_full(this.value,' . 'k' . $i . ',' . preg_replace('/[()\/]/', '', $key_stu) . ');') . "
" . SelectInput($value_stu, 'student[' . $key_stu . '][' . $value_stu . ']', '', $options, 'N/A', ' onchange=drawmapping_full(this.value,' . 'k' . $i . ',' . preg_replace('/[()\/]/', '', $key_stu) . ');'); echo ""; + echo "
'; + echo '
'; //.table-responsive echo '
'; //.panel-body echo ''; echo ''; //.panel @@ -345,7 +347,7 @@ function add_person($first, $middle, $last, $email) { echo ''; //.panel-heading echo '
'; - + echo '
'; echo ''; echo ''; echo ''; @@ -372,7 +374,7 @@ function add_person($first, $middle, $last, $email) { } $_SESSION['data'] = $arr_data; - $options = array('TITLE' => 'Salutation', 'FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'IS_DISABLE' => 'Disabled', 'EMAIL' => 'Email', 'PHONE' => 'Phone', 'PROFILE' => 'Profile', 'HOMEROOM' => 'Homeroom', 'BIRTHDATE' => 'Birthdate', 'ETHNICITY_ID' => 'Ethnicity', 'ALTERNATE_ID' => 'Alternate ID', 'PRIMARY_LANGUAGE_ID' => 'Primary Language', 'SECONDARY_LANGUAGE_ID' => 'Secondary Language', 'THIRD_LANGUAGE_ID' => 'Third Language', 'IS_DISABLE' => 'Disabled'); + $options = array('TITLE' => 'Salutation', 'FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'IS_DISABLE' => 'Disabled', 'EMAIL' => 'Email', 'PHONE' => 'Phone', 'PROFILE' => 'Profile', 'HOMEROOM' => 'Homeroom', 'BIRTHDATE' => 'Birthdate', 'ETHNICITY_ID' => 'Ethnicity', 'ALTERNATE_ID' => 'Alternate ID', 'PRIMARY_LANGUAGE_ID' => 'Primary Language', 'SECOND_LANGUAGE_ID' => 'Secondary Language', 'THIRD_LANGUAGE_ID' => 'Third Language', 'IS_DISABLE' => 'Disabled'); $options+=array('USERNAME' => 'Username', 'PASSWORD' => 'Password'); $options+=array('START_DATE' => 'Start Date', 'END_DATE' => 'End Date'); $options+=array('CATEGORY' => 'Category', 'JOB_TITLE' => 'Job Title', 'JOINING_DATE' => 'Joining Date'); @@ -408,7 +410,8 @@ function add_person($first, $middle, $last, $email) { // // echo ""; - echo "
These fields are in your Excel spread sheet These are available fields in openSIS
"; + echo ''; + echo '
'; //.table-responsive echo '
'; //.panel-body echo ''; echo ''; @@ -428,7 +431,7 @@ function add_person($first, $middle, $last, $email) { echo ''; //.panel-body echo '
'; - + echo '
'; echo ''; echo ''; echo ''; @@ -443,7 +446,7 @@ function add_person($first, $middle, $last, $email) { // // "; // $custom=DBGet(DBQuery("SHOW COLUMNS FROM STAFF WHERE FIELD IN ('TITLE','FIRST_NAME','MIDDLE_NAME','LAST_NAME','IS_DISABLE','EMAIL','PHONE','PROFILE','USERNAME') ")); - $options = array('TITLE' => 'Salutation', 'FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'IS_DISABLE' => 'Disabled', 'EMAIL' => 'Email', 'PHONE' => 'Phone', 'PROFILE' => 'Profile', 'HOMEROOM' => 'Homeroom', 'BIRTHDATE' => 'Birthdate', 'ETHNICITY_ID' => 'Ethnicity', 'ALTERNATE_ID' => 'Alternate ID', 'PRIMARY_LANGUAGE_ID' => 'Primary Language', 'SECONDARY_LANGUAGE_ID' => 'Secondary Language', 'THIRD_LANGUAGE_ID' => 'Third Language', 'IS_DISABLE' => 'Disabled'); + $options = array('TITLE' => 'Salutation', 'FIRST_NAME' => 'First Name', 'LAST_NAME' => 'Last Name', 'MIDDLE_NAME' => 'Middle Name', 'IS_DISABLE' => 'Disabled', 'EMAIL' => 'Email', 'PHONE' => 'Phone', 'PROFILE' => 'Profile', 'HOMEROOM' => 'Homeroom', 'BIRTHDATE' => 'Birthdate', 'ETHNICITY_ID' => 'Ethnicity', 'ALTERNATE_ID' => 'Alternate ID', 'PRIMARY_LANGUAGE_ID' => 'Primary Language', 'SECOND_LANGUAGE_ID' => 'Secondary Language', 'THIRD_LANGUAGE_ID' => 'Third Language', 'IS_DISABLE' => 'Disabled'); $options+=array('USERNAME' => 'Username', 'PASSWORD' => 'Password'); $options+=array('START_DATE' => 'Start Date', 'END_DATE' => 'End Date'); $options+=array('CATEGORY' => 'Category', 'JOB_TITLE' => 'Job Title', 'JOINING_DATE' => 'Joining Date'); @@ -484,6 +487,7 @@ function add_person($first, $middle, $last, $email) { echo ''; echo '
These fields are in your Excel spread sheet These are available fields in openSIS (Click to change the field values)
These fields are in your Excel spread sheet These are available fields in openSIS(Click to change the field values)
'; + echo '
'; //.table-responsive echo '
'; //.panel-body echo ''; echo ''; //.panel diff --git a/modules/tools/DataImportCounter.php b/modules/tools/DataImportCounter.php index 0978be03..d2f8da65 100644 --- a/modules/tools/DataImportCounter.php +++ b/modules/tools/DataImportCounter.php @@ -105,7 +105,7 @@ $student_values[] = "'" . singleQuoteReplace("", "", $arr_v[$array_index[$students_v]]) . "'"; } if ($students_v == 'FIRST_NAME' || $students_v == 'LAST_NAME' || $students_v == 'EMAIL' || $students_v == 'BIRTHDATE') - $check_query[] = $students_v . '=' . "'" . singleQuoteReplace("", "", $arr_v[$array_index[$students_v]]) . "'"; + $check_query[] = $students_v . '=' . "'" .($students_v=='BIRTHDATE'?fromExcelToLinux(singleQuoteReplace("", "", $arr_v[$array_index[$students_v]])):singleQuoteReplace("", "", $arr_v[$array_index[$students_v]]) ). "'"; } } if (count($check_query) > 0) { @@ -248,23 +248,36 @@ } } - echo '
'; - echo '

Congratulations !!!

'; - echo '
The data import has successfully concluded.
'; - - echo '
'; - echo '
Number of input records:
' . $records . '
'; - echo '
'; - echo '
'; - echo '
Number of records loaded into the database:
' . $accepted . '
'; - echo '
'; - echo '
'; - echo '
Number or records rejected:
' . $rejected . '
'; - echo '
'; - if ($rejected != 0) { - echo '
'; - echo '
Possible cause for rejection is duplicate records
'; + + if ($records > 0) { + if ($records == $accepted) { + echo '
'; + echo '

Congratulations !!!

'; + echo '
The data import has successfully concluded.
'; + } elseif ($accepted > 0 && $rejected > 0) { + echo '
'; + echo '

Partial Import !!!

'; + echo '
Some data couldn\'t be processed.
'; + } elseif ($accepted == 0) { + echo '
'; + echo '

Oops !!!

'; + echo '
The data import was rejected by the system.
'; + } + + echo '
'; + echo '
Number of input records:
' . $records . '
'; + echo '
'; + echo '
'; + echo '
Number of records loaded into the database:
' . $accepted . '
'; echo '
'; + echo '
'; + echo '
Number or records rejected:
' . $rejected . '
'; + echo '
'; + if ($rejected != 0) { + echo '
'; + echo '
Possible cause for rejection is duplicate records
'; + echo '
'; + } } @@ -312,7 +325,7 @@ // echo '

'; // print_r($array_index); // exit; - $staff = array('TITLE', 'FIRST_NAME', 'LAST_NAME', 'MIDDLE_NAME', 'IS_DISABLE', 'EMAIL', 'PHONE', 'PROFILE', 'HOMEROOM', 'BIRTHDATE', 'ETHNICITY_ID', 'ALTERNATE_ID', 'PRIMARY_LANGUAGE_ID', 'SECONDARY_LANGUAGE_ID', 'THIRD_LANGUAGE_ID', 'IS_DISABLE'); + $staff = array('TITLE', 'FIRST_NAME', 'LAST_NAME', 'MIDDLE_NAME', 'IS_DISABLE', 'EMAIL', 'PHONE', 'PROFILE', 'HOMEROOM', 'BIRTHDATE', 'ETHNICITY_ID', 'ALTERNATE_ID', 'PRIMARY_LANGUAGE_ID', 'SECOND_LANGUAGE_ID', 'THIRD_LANGUAGE_ID', 'IS_DISABLE'); $login_authentication = array('USERNAME', 'PASSWORD'); $staff_school_relationship = array('START_DATE', 'END_DATE'); $staff_school_info = array('CATEGORY', 'JOB_TITLE', 'JOINING_DATE'); @@ -328,9 +341,7 @@ $rejected = 0; $records = 0; foreach ($arr_data as $arr_i => $arr_v) { -// print_r($arr_v); -// echo '

'; -// echo "if($arr_i>0)



"; + ///////////////////////////For Students//////////////////////////////////////////////////////////// $staff_columns = array(); $staff_values = array(); @@ -344,6 +355,7 @@ foreach ($staff as $staff_v) { // echo $staff_v.'---'.$arr_v[$array_index[$staff_v]].'

'; if ($staff_v == 'PROFILE') { + $arr_v[$array_index[$staff_v]]=strtolower($arr_v[$array_index[$staff_v]]); $profile = DBGet(DBQuery('SELECT * FROM user_profiles WHERE title=\'' . singleQuoteReplace("", "", $arr_v[$array_index[$staff_v]]) . '\' ')); if ($profile[1]['ID'] == '') { $profile_id = '2'; @@ -361,21 +373,21 @@ $arr_v[$array_index[$staff_v]] = ''; } if ($staff_v == 'PRIMARY_LANGUAGE_ID') { - $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[$students_v]]) . '\' ')); + $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[$staff_v]]) . '\' ')); if ($language[1]['LANGUAGE_ID'] != '') $arr_v[$array_index[$staff_v]] = $language[1]['LANGUAGE_ID']; else $arr_v[$array_index[$staff_v]] = ''; } if ($staff_v == 'SECOND_LANGUAGE_ID') { - $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[$students_v]]) . '\' ')); + $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[$staff_v]]) . '\' ')); if ($language[1]['LANGUAGE_ID'] != '') $arr_v[$array_index[$staff_v]] = $language[1]['LANGUAGE_ID']; else $arr_v[$array_index[$staff_v]] = ''; } if ($staff_v == 'THIRD_LANGUAGE_ID') { - $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[strtolower($students_v)]]) . '\' ')); + $language = DBGet(DBQuery('SELECT * FROM language WHERE language_name=\'' . singleQuoteReplace("", "", $arr_v[$array_index[strtolower($staff_v)]]) . '\' ')); if ($language[1]['LANGUAGE_ID'] != '') $arr_v[$array_index[$staff_v]] = $language[1]['LANGUAGE_ID']; else @@ -401,13 +413,31 @@ ///////////////////////////For Staff Enrollment//////////////////////////////////////////////////////////// $ssr_columns = array('STAFF_ID', 'SYEAR', 'SCHOOL_ID'); $ssr_values = array($staff_id, UserSyear(), UserSchool()); + $start_date_i = 0; foreach ($staff_school_relationship as $ssr_v) { // echo $students_v.'---'.$arr_v[$array_index[strtolower($students_v)]].'

'; if ($arr_v[$array_index[$ssr_v]] != '') { $ssr_columns[] = $ssr_v; - $ssr_values[] = "'" . singleQuoteReplace("", "", $arr_v[$array_index[$ssr_v]]) . "'"; + if ($ssr_v == 'START_DATE') { + $start_date_i = 1; + if ($arr_v[$array_index[$ssr_v]] == '') { + $start_date = DBGet(DBQuery('SELECT START_DATE FROM school_years WHERE SCHOOL_ID=' . UserSchool() . ' AND SYEAR=' . UserSyear())); + + $ssr_values[] = "'" . $start_date[1]['START_DATE'] . "'"; + } else + $ssr_values[] = "'" . fromExcelToLinux(singleQuoteReplace("", "", $arr_v[$array_index[$ssr_v]])) . "'"; + } elseif ($ssr_v == 'END_DATE') { + $ssr_values[] = "'" . fromExcelToLinux(singleQuoteReplace("", "", $arr_v[$array_index[$ssr_v]])) . "'"; + } else + $ssr_values[] = "'" . singleQuoteReplace("", "", $arr_v[$array_index[$ssr_v]]) . "'"; } } + if ($start_date_i == 0) { + $start_date = DBGet(DBQuery('SELECT START_DATE FROM school_years WHERE SCHOOL_ID=' . UserSchool() . ' AND SYEAR=' . UserSyear())); + $ssr_columns[] = 'START_DATE'; + $ssr_values[] = "'" . $start_date[1]['START_DATE'] . "'"; + } + DBQuery('INSERT INTO staff_school_relationship (' . implode(',', $ssr_columns) . ') VALUES (' . implode(',', $ssr_values) . ')'); unset($ssr_columns); unset($ssr_values); @@ -455,7 +485,7 @@ if ($arr_v[$array_index['JOINING_DATE']] != '') { $ssi_columns[] = 'JOINING_DATE'; - $ssi_values[] = "'" . str_replace("'", "", $arr_v[$array_index['JOINING_DATE']]) . "'"; + $ssi_values[] = "'" . fromExcelToLinux(singleQuoteReplace("", "", $arr_v[$array_index['JOINING_DATE']])) . "'"; } DBQuery('INSERT INTO staff_school_info (' . implode(',', $ssi_columns) . ') VALUES (' . implode(',', $ssi_values) . ')'); @@ -471,24 +501,37 @@ } } - echo '
'; - echo '

Congratulations !!!

'; - echo '
The data import has successfully concluded.
'; - - echo '
'; - echo '
Number of input records:
' . $records . '
'; - echo '
'; - echo '
'; - echo '
Number of records loaded into the database:
' . $accepted . '
'; - echo '
'; - echo '
'; - echo '
Number or records rejected:
' . (($rejected > 0) ? '' . $rejected . '' : $rejected) . '
'; - echo '
'; - - if ($rejected != 0) { - echo '
'; - echo '
Possible cause for rejection is duplicate records
'; + + if ($records > 0) { + if ($records == $accepted) { + echo '
'; + echo '

Congratulations !!!

'; + echo '
The data import has successfully concluded.
'; + } elseif ($accepted > 0 && $rejected > 0) { + echo '
'; + echo '

Partial Import !!!

'; + echo '
Some data could not be processed.
'; + } elseif ($accepted == 0) { + echo '
'; + echo '

Oops !!!

'; + echo '
The data import was rejected by the system.
'; + } + + echo '
'; + echo '
Number of input records:
' . $records . '
'; echo '
'; + echo '
'; + echo '
Number of records loaded into the database:
' . $accepted . '
'; + echo '
'; + echo '
'; + echo '
Number or records rejected:
' . (($rejected > 0) ? '' . $rejected . '' : $rejected) . '
'; + echo '
'; + + if ($rejected != 0) { + echo '
'; + echo '
Possible cause for rejection is duplicate records
'; + echo '
'; + } } unset($arr_data); unset($_SESSION['data']); diff --git a/modules/users/SearchMissAttnInc.php b/modules/users/SearchMissAttnInc.php index 71721e4d..80dc3471 100644 --- a/modules/users/SearchMissAttnInc.php +++ b/modules/users/SearchMissAttnInc.php @@ -95,7 +95,9 @@ } else { $singular = 'User'; $plural = 'users'; - $columns = array('FULL_NAME' => 'Staff Member', 'PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); +// $columns = array('FULL_NAME' => 'Staff Member', 'PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); + $columns = array('FULL_NAME' => 'Name', 'PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); + } if (is_array($extra['columns_before'])) $columns = $extra['columns_before'] + $columns; diff --git a/modules/users/SearchStaffInc.php b/modules/users/SearchStaffInc.php index 89c0e378..29728245 100644 --- a/modules/users/SearchStaffInc.php +++ b/modules/users/SearchStaffInc.php @@ -130,8 +130,17 @@ DrawHeader('Please select a Staff'); if ($_REQUEST['_search_all_schools'] == 'Y') $extra['GROUP'] = ' s.STAFF_ID '; - $extra['SELECT'].=',s.STAFF_ID as CATEGORY,la.LAST_LOGIN'; + + if($_REQUEST['_search_all_schools']=='Y') + { + $extra['SELECT'].=',s.STAFF_ID as STF_ID'; + $extra['functions']=array('STF_ID'=>makeStaffAllSchool); + } + else + { + $extra['SELECT'].=',s.STAFF_ID as CATEGORY,la.LAST_LOGIN'; $extra['functions']=array('CATEGORY'=>StaffCategory); + } $staff_RET = GetUserStaffList($extra); if($_REQUEST['_dis_user']=='Y') { @@ -165,9 +174,16 @@ $singular = 'Staff'; $plural = 'Staffs'; if ($_REQUEST['_dis_user']) - $columns = array('FULL_NAME' => 'Staff Member', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID', 'Status' => 'Status'); + $columns = array('FULL_NAME' => 'Name', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID', 'Status' => 'Status'); +// $columns = array('FULL_NAME' => 'Staff Member', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID', 'Status' => 'Status'); else - $columns = array('FULL_NAME' => 'Staff Member', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); + $columns = array('FULL_NAME' => 'Name', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); +// $columns = array('FULL_NAME' => 'Staff Member', 'CATEGORY' => 'Category','PROFILE' => 'Profile', 'STAFF_ID' => 'Staff ID'); + + if($_REQUEST['_search_all_schools']=='Y') + { + $columns+= array('STF_ID' => 'School Name'); + } } if (is_array($extra['columns_before'])) $columns = $extra['columns_before'] + $columns; @@ -200,5 +216,17 @@ function makeLogin($value) { return ProperDate(substr($value, 0, 10)) . substr($value, 10); } - +function makeStaffAllSchool($value) +{ + $schools=DBGet(DBQuery('SELECT * FROM staff_school_relationship WHERE (END_DATE=\'0000-00-00\' OR END_DATE IS NULL OR END_DATE>=\''.date('y-m-d').'\') AND SYEAR='.UserSyear().' AND STAFF_ID='.$value)); + $return_name=array(); + foreach($schools as $s) + { + $name=DBGet(DBQuery('SELECT TITLE FROM schools WHERE ID='.$s['SCHOOL_ID'])); + $return_name[]=$name[1]['TITLE']; + + } + return implode(',',$return_name); + +} ?> \ No newline at end of file diff --git a/modules/users/TeacherPrograms.php b/modules/users/TeacherPrograms.php index a5bb5cb4..fec47084 100644 --- a/modules/users/TeacherPrograms.php +++ b/modules/users/TeacherPrograms.php @@ -28,7 +28,7 @@ include('../../RedirectModulesInc.php'); $cp_id = $_REQUEST['cp_id']; if (UserStaffID() || $_REQUEST['staff_id']) - echo "
"; + echo ""; DrawBC("Users > Teacher Programs"); ########################################### if (UserStaffID() || $_REQUEST['staff_id']) {