Commit 1b1bdf45 authored by François Jacquet's avatar François Jacquet
Browse files

Use DBGetOne() instead of DBGet() + $RET[1]['COLUMN'], bis

parent 32f3eb6a
......@@ -18,15 +18,14 @@ if ( isset( $_REQUEST['day_start'] )
if ( empty( $start_date ) )
{
$min_date = DBGet( "SELECT min(SCHOOL_DATE) AS MIN_DATE
$min_date = DBGetOne( "SELECT min(SCHOOL_DATE) AS MIN_DATE
FROM ATTENDANCE_CALENDAR
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'" );
if ( $min_date
&& $min_date[1]['MIN_DATE'] )
if ( $min_date )
{
$start_date = $min_date[1]['MIN_DATE'];
$start_date = $min_date;
}
else
$start_date = date( 'Y-m' ) . '-01';
......
......@@ -18,15 +18,14 @@ if ( isset( $_REQUEST['day_start'] )
if ( empty( $start_date ) )
{
$min_date = DBGet( "SELECT min(SCHOOL_DATE) AS MIN_DATE
$min_date = DBGetOne( "SELECT min(SCHOOL_DATE) AS MIN_DATE
FROM ATTENDANCE_CALENDAR
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'" );
if ( $min_date
&& $min_date[1]['MIN_DATE'] )
if ( $min_date )
{
$start_date = $min_date[1]['MIN_DATE'];
$start_date = $min_date;
}
else
$start_date = date( 'Y-m' ) . '-01';
......
......@@ -168,12 +168,12 @@ if (UserStudentID() && $_REQUEST['student_id'])
echo '<table class="width-100p">';
$student_name_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STUDENTS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
echo '<tr><td>' . NoInput(
MakeStudentPhotoTipMessage( UserStudentID(), $student_name_RET[1]['FULL_NAME'] ),
MakeStudentPhotoTipMessage( UserStudentID(), $student_full_name ),
_( 'Student' )
) . '</td></tr>';
......
......@@ -170,12 +170,12 @@ if ( ! $_REQUEST['modfunc']
echo '<table class="width-100p">';
$student_name_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STUDENTS
WHERE STUDENT_ID='" . $RET['STUDENT_ID'] . "'" );
echo '<tr><td>' . NoInput(
MakeStudentPhotoTipMessage( $RET['STUDENT_ID'], $student_name_RET[1]['FULL_NAME'] ),
MakeStudentPhotoTipMessage( $RET['STUDENT_ID'], $student_full_name ),
_( 'Student' )
) . '</td></tr>';
......
......@@ -18,15 +18,14 @@ if ( isset( $_REQUEST['day_start'] )
if ( empty( $start_date ) )
{
$min_date = DBGet( "SELECT min(SCHOOL_DATE) AS MIN_DATE
$min_date = DBGetOne( "SELECT min(SCHOOL_DATE) AS MIN_DATE
FROM ATTENDANCE_CALENDAR
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'" );
if ( $min_date
&& $min_date[1]['MIN_DATE'] )
if ( $min_date )
{
$start_date = $min_date[1]['MIN_DATE'];
$start_date = $min_date;
}
else
$start_date = date( 'Y-m' ) . '-01';
......
......@@ -45,12 +45,12 @@ function EmailReferral( $referral_id, $emails )
{
$referral = $referral_RET[1];
$student_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STUDENTS
WHERE STUDENT_ID='" . $referral['STUDENT_ID'] . "'" );
$student = _( 'Student' ) . ': ' . $student_RET[1]['FULL_NAME'] . ' (' . $referral['STUDENT_ID'] . ')';
$student = _( 'Student' ) . ': ' . $student_full_name . ' (' . $referral['STUDENT_ID'] . ')';
$date = _( 'Date' ) . ': ' . strip_tags( ProperDate( $referral['ENTRY_DATE'] ) );
......
......@@ -99,8 +99,11 @@ if ( UserStudentID()
$end_date = date( 'Y-m-d', $start_time + 60 * 60 * 24 * 6 );
}
$begin_year = DBGet( "SELECT min(date_part('epoch',SCHOOL_DATE)) as SCHOOL_DATE FROM ATTENDANCE_CALENDAR WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'" );
$begin_year = $begin_year[1]['SCHOOL_DATE'];
$begin_year = DBGetOne( "SELECT min(date_part('epoch',SCHOOL_DATE)) AS SCHOOL_DATE
FROM ATTENDANCE_CALENDAR
WHERE SCHOOL_ID='" . UserSchool() . "'
AND SYEAR='" . UserSyear() . "'" );
if (is_null($begin_year))
ErrorMessage(array(_('There are no calendars yet setup.')), 'fatal');
......
......@@ -61,8 +61,11 @@ if ( $_REQUEST['search_modfunc']
$tmp_PHP_SELF = PreparePHP_SELF();
echo '<form action="'.$tmp_PHP_SELF.'" method="POST">';
$begin_year = DBGet( "SELECT min(date_part('epoch',SCHOOL_DATE)) as SCHOOL_DATE FROM ATTENDANCE_CALENDAR WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'" );
$begin_year = $begin_year[1]['SCHOOL_DATE'];
$begin_year = DBGetOne( "SELECT min(date_part('epoch',SCHOOL_DATE)) AS SCHOOL_DATE
FROM ATTENDANCE_CALENDAR
WHERE SCHOOL_ID='" . UserSchool() . "'
AND SYEAR='" . UserSyear() . "'" );
if (is_null($begin_year))
ErrorMessage(array(_('There are no calendars yet setup.')), 'fatal');
......
......@@ -74,13 +74,11 @@ $period_select .= '</select>';
echo '<form action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
$begin_year = DBGet( "SELECT min(date_part('epoch',SCHOOL_DATE)) as SCHOOL_DATE
$begin_year = DBGetOne( "SELECT min(date_part('epoch',SCHOOL_DATE)) AS SCHOOL_DATE
FROM ATTENDANCE_CALENDAR
WHERE SCHOOL_ID='" . UserSchool() . "'
AND SYEAR='" . UserSyear() . "'" );
$begin_year = $begin_year[1]['SCHOOL_DATE'];
if ( $start
&& $begin_year )
{
......
......@@ -42,7 +42,7 @@ if ( ! function_exists( 'DashboardEligibilityAdmin' ) )
*/
function DashboardEligibilityAdmin()
{
$activities_RET = DBGet( "SELECT COUNT(ID) AS ACTIVITIES_NB
$activities_nb = DBGetOne( "SELECT COUNT(ID) AS ACTIVITIES_NB
FROM ELIGIBILITY_ACTIVITIES
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'
......@@ -50,11 +50,11 @@ if ( ! function_exists( 'DashboardEligibilityAdmin' ) )
AND END_DATE>=CURRENT_DATE" );
$data = array(
_( 'Activities' ) => $activities_RET[1]['ACTIVITIES_NB'],
_( 'Activities' ) => $activities_nb,
);
// Activities this week.
$activities_nb = (int) $activities_RET[1]['ACTIVITIES_NB'];
$activities_nb = (int) $activities_nb;
if ( ! $activities_nb )
{
......
......@@ -19,20 +19,35 @@ while (!checkdate($_REQUEST['month'],$last,$_REQUEST['year']))
$time = mktime(0,0,0,$_REQUEST['month'],1,$_REQUEST['year']);
$time_last = mktime(0,0,0,$_REQUEST['month'],$last,$_REQUEST['year']);
// use the dafault calendar
$default_RET = DBGet( "SELECT CALENDAR_ID FROM ATTENDANCE_CALENDARS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND DEFAULT_CALENDAR='Y'" );
if (count($default_RET))
$calendar_id = $default_RET[1]['CALENDAR_ID'];
// Use default calendar.
$default_calendar_id = DBGetOne( "SELECT CALENDAR_ID
FROM ATTENDANCE_CALENDARS
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'
AND DEFAULT_CALENDAR='Y'" );
if ( $default_calendar_id )
{
$calendar_id = $default_calendar_id;
}
else
{
$calendars_RET = DBGet( "SELECT CALENDAR_ID FROM ATTENDANCE_CALENDARS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'" );
if (count($calendars_RET))
$calendar_id = $calendars_RET[1]['CALENDAR_ID'];
else
ErrorMessage(array(_('There are no calendars yet setup.')),'fatal');
$calendar_id = DBGetOne( "SELECT CALENDAR_ID
FROM ATTENDANCE_CALENDARS
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'" );
if ( ! $calendar_id )
{
ErrorMessage( array( _( 'There are no calendars yet setup.' ) ), 'fatal' );
}
}
$menus_RET = DBGet( 'SELECT MENU_ID,TITLE FROM FOOD_SERVICE_MENUS WHERE SCHOOL_ID=\''.UserSchool().'\' ORDER BY SORT_ORDER',array(),array('MENU_ID'));
$menus_RET = DBGet( "SELECT MENU_ID,TITLE
FROM FOOD_SERVICE_MENUS
WHERE SCHOOL_ID='" . UserSchool() . "'
ORDER BY SORT_ORDER", array(), array( 'MENU_ID' ) );
if ( empty( $_REQUEST['menu_id'] ) )
if ( ! $_SESSION['FSA_menu_id'])
if (count($menus_RET))
......
......@@ -260,16 +260,31 @@ if ( ! $_REQUEST['modfunc'] )
if ( User( 'PROFILE' ) == 'admin' || User( 'PROFILE' ) == 'teacher' )
{
$LO_columns = array( 'DESCRIPTION' => _( 'Item Description' ), 'SHORT_NAME' => _( 'Short Name' ), 'ICON' => _( 'Icon' ), 'SORT_ORDER' => _( 'Sort Order' ), 'PRICE' => _( 'Student Price' ), 'PRICE_REDUCED' => _( 'Reduced Price' ), 'PRICE_FREE' => _( 'Free Price' ), 'PRICE_STAFF' => _( 'Staff Price' ) );
$LO_columns = array(
'DESCRIPTION' => _( 'Item Description' ),
'SHORT_NAME' => _( 'Short Name' ),
'ICON' => _( 'Icon' ),
'SORT_ORDER' => _( 'Sort Order' ),
'PRICE' => _( 'Student Price' ),
'PRICE_REDUCED' => _( 'Reduced Price' ),
'PRICE_FREE' => _( 'Free Price' ),
'PRICE_STAFF' => _( 'Staff Price' ),
);
}
else
{
$LO_columns = array( 'DESCRIPTION' => _( 'Item Description' ), 'SHORT_NAME' => _( 'Short Name' ), 'ICON' => _( 'Icon' ), 'PRICE' => _( 'Student Price' ) );
$LO_columns = array(
'DESCRIPTION' => _( 'Item Description' ),
'SHORT_NAME' => _( 'Short Name' ),
'ICON' => _( 'Icon' ),
'PRICE' => _( 'Student Price' ),
);
if ( UserStudentID() )
{
$discount = DBGet( 'SELECT DISCOUNT FROM FOOD_SERVICE_STUDENT_ACCOUNTS WHERE STUDENT_ID=\'' . UserStudentID() . '\'' );
$discount = $discount[1]['DISCOUNT'];
$discount = DBGetOne( "SELECT DISCOUNT
FROM FOOD_SERVICE_STUDENT_ACCOUNTS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
if ( $discount == 'Reduced' )
{
......
......@@ -11,33 +11,49 @@ if ( $_REQUEST['modfunc'] === 'update' )
{
if ( ! empty( $_REQUEST['food_service']['BARCODE'] ) )
{
$RET = DBGet( "SELECT ACCOUNT_ID FROM FOOD_SERVICE_STUDENT_ACCOUNTS WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."' AND STUDENT_ID!='".UserStudentID()."'" );
if ( $RET)
$question = _( 'Are you sure you want to assign that barcode?' );
$account_id = DBGetOne( "SELECT ACCOUNT_ID
FROM FOOD_SERVICE_STUDENT_ACCOUNTS
WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'
AND STUDENT_ID!='".UserStudentID()."'" );
if ( $account_id )
{
$student_RET = DBGet( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fssa
WHERE s.STUDENT_ID=fssa.STUDENT_ID
AND fssa.ACCOUNT_ID='" . $RET[1]['ACCOUNT_ID'] . "'" );
AND fssa.ACCOUNT_ID='" . $account_id . "'" );
$question = _("Are you sure you want to assign that barcode?");
$message = sprintf(_("That barcode is already assigned to Student <b>%s</b>."),$student_RET[1]['FULL_NAME']).' '._("Hit OK to reassign it to the current student or Cancel to cancel all changes.");
$message = sprintf(
_("That barcode is already assigned to Student <b>%s</b>."),
$student_full_name
).' '.
_("Hit OK to reassign it to the current student or Cancel to cancel all changes.");
}
else
{
$RET = DBGet( "SELECT STAFF_ID FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'" );
if ( $RET)
$account_id = DBGetOne( "SELECT STAFF_ID
FROM FOOD_SERVICE_STAFF_ACCOUNTS
WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'" );
if ( $account_id)
{
$staff_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
$staff_full_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STAFF
WHERE STAFF_ID='" . $RET[1]['STAFF_ID'] . "'" );
WHERE STAFF_ID='" . $account_id . "'" );
$question = _("Are you sure you want to assign that barcode?");
$message = sprintf(_("That barcode is already assigned to User <b>%s</b>."),$staff_RET[1]['FULL_NAME']).' '._("Hit OK to reassign it to the current student or Cancel to cancel all changes.");
$message = sprintf(
_("That barcode is already assigned to User <b>%s</b>."),
$staff_full_name
).' '.
_("Hit OK to reassign it to the current student or Cancel to cancel all changes.");
}
}
}
if ( ! $RET
if ( ! $account_id
|| Prompt( 'Confirm', $question, $message ) )
{
if ( ! isset( $_REQUEST['food_service']['ACCOUNT_ID'] )
......
......@@ -7,10 +7,9 @@ if ( $_REQUEST['values']
if ( UserStudentID()
&& AllowEdit() )
{
$account_id = DBGet( "SELECT ACCOUNT_ID
$account_id = DBGetOne( "SELECT ACCOUNT_ID
FROM FOOD_SERVICE_STUDENT_ACCOUNTS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
$account_id = $account_id[1]['ACCOUNT_ID'];
if ( ( $_REQUEST['values']['TYPE'] == 'Deposit' || $_REQUEST['values']['TYPE'] == 'Credit' || $_REQUEST['values']['TYPE'] == 'Debit' ) && ( $amount = is_money( $_REQUEST['values']['AMOUNT'] ) ) )
{
......
......@@ -150,13 +150,18 @@ DrawHeader(PrepareDate($date,'_date',false,array('submit'=>true)).$date_note,Sub
echo ErrorMessage( $note, 'note' );
$meal_RET = DBGet( 'SELECT DESCRIPTION FROM CALENDAR_EVENTS WHERE SYEAR='.UserSyear().' AND SCHOOL_ID='.UserSchool().' AND SCHOOL_DATE=\''.$date.'\' AND TITLE=\''.$menus_RET[$_REQUEST['menu_id']][1]['TITLE'].'\'' );
if ( $meal_RET)
$meal_description = DBGetOne( "SELECT DESCRIPTION
FROM CALENDAR_EVENTS
WHERE SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'
AND SCHOOL_DATE='" . $date . "'
AND TITLE='" . $menus_RET[$_REQUEST['menu_id']][1]['TITLE'] . "'" );
if ( $meal_description )
{
echo '<table class="width-100p">';
echo '<tr><td class="center">';
echo '<b>Today\'s '.$menus_RET[$_REQUEST['menu_id']][1]['TITLE'].':</b> '.$meal_RET[1]['DESCRIPTION'];
echo '<b>Today\'s '.$menus_RET[$_REQUEST['menu_id']][1]['TITLE'].':</b> '.$meal_description;
echo '</td></tr></table><hr />';
}
......
......@@ -23,33 +23,48 @@ if ( $_REQUEST['modfunc'] === 'update' )
{
if ( ! empty( $_REQUEST['food_service']['BARCODE'] ) )
{
$RET = DBGet( "SELECT STAFF_ID FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."' AND STAFF_ID!='".UserStaffID()."'" );
if ( $RET)
$question = _( 'Are you sure you want to assign that barcode?' );
$account_id = DBGetOne( "SELECT STAFF_ID
FROM FOOD_SERVICE_STAFF_ACCOUNTS
WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'
AND STAFF_ID!='".UserStaffID()."'" );
if ( $account_id )
{
$staff_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
$staff_full_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STAFF
WHERE STAFF_ID='" . $RET[1]['STAFF_ID'] . "'" );
WHERE STAFF_ID='" . $account_id . "'" );
$question = _("Are you sure you want to assign that barcode?");
$message = sprintf(_("That barcode is already assigned to User <b>%s</b>."),$staff_RET[1]['FULL_NAME']).' '._("Hit OK to reassign it to the current user or Cancel to cancel all changes.");
$message = sprintf(
_("That barcode is already assigned to User <b>%s</b>."),
$staff_full_name
).' '.
_("Hit OK to reassign it to the current user or Cancel to cancel all changes.");
}
else
{
$RET = DBGet( "SELECT ACCOUNT_ID FROM FOOD_SERVICE_STUDENT_ACCOUNTS WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'" );
if ( $RET)
$account_id = DBGetOne( "SELECT ACCOUNT_ID
FROM FOOD_SERVICE_STUDENT_ACCOUNTS
WHERE BARCODE='".trim($_REQUEST['food_service']['BARCODE'])."'" );
if ( $account_id )
{
$student_RET = DBGet( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fssa
WHERE s.STUDENT_ID=fssa.STUDENT_ID
AND fssa.ACCOUNT_ID='" . $RET[1]['ACCOUNT_ID'] . "'" );
AND fssa.ACCOUNT_ID='" . $account_id . "'" );
$question = _("Are you sure you want to assign that barcode?");
$message = sprintf(_("That barcode is already assigned to Student <b>%s</b>."),$student_RET[1]['FULL_NAME']).' '._("Hit OK to reassign it to the user student or Cancel to cancel all changes.");
$message = sprintf(
_("That barcode is already assigned to Student <b>%s</b>."),
$student_full_name
).' '.
_("Hit OK to reassign it to the user student or Cancel to cancel all changes.");
}
}
}
if ( ! $RET
if ( ! $account_id
|| Prompt( 'Confirm', $question, $message ) )
{
$sql = 'UPDATE FOOD_SERVICE_STAFF_ACCOUNTS SET ';
......
......@@ -26,12 +26,10 @@ if ( ! UserCoursePeriod() )
echo ErrorMessage( array( _( 'No courses assigned to teacher.' ) ), 'fatal' );
}
$course_id = DBGet( "SELECT COURSE_ID
$course_id = DBGetOne( "SELECT COURSE_ID
FROM COURSE_PERIODS
WHERE COURSE_PERIOD_ID='" . UserCoursePeriod() . "'" );
$course_id = $course_id[1]['COURSE_ID'];
$_ROSARIO['allow_edit'] = true;
//unset($_SESSION['_REQUEST_vars']['assignment_type_id']);
//unset($_SESSION['_REQUEST_vars']['assignment_id']);
......@@ -294,7 +292,7 @@ if ( $_REQUEST['modfunc'] === 'delete' )
$prompt_title = _( 'Assignment as well as the associated Grades' );
}
$assignment_file_RET = DBGet( "SELECT FILE
$assignment_file = DBGetOne( "SELECT FILE
FROM GRADEBOOK_ASSIGNMENTS
WHERE ASSIGNMENT_ID='" . $_REQUEST['assignment_id'] . "'" );
......@@ -358,11 +356,11 @@ if ( $_REQUEST['modfunc'] === 'delete' )
DBQuery( "DELETE FROM GRADEBOOK_GRADES
WHERE ASSIGNMENT_ID='" . $_REQUEST['assignment_id'] . "'" );
if ( ! empty( $assignment_file_RET[1]['FILE'] )
&& file_exists( $assignment_file_RET[1]['FILE'] ) )
if ( ! empty( $assignment_file )
&& file_exists( $assignment_file ) )
{
// Delete File Attached.
unlink( $assignment_file_RET[1]['FILE'] );
unlink( $assignment_file );
}
// Hook.
......
......@@ -82,12 +82,10 @@ if ( UserStudentID() )
$sql = 'INSERT INTO STUDENT_REPORT_CARD_GRADES ';
// FJ fix bug SQL SYEAR=NULL.
$syear = DBGet( "SELECT SYEAR
$syear = DBGetOne( "SELECT SYEAR
FROM MARKING_PERIODS
WHERE MARKING_PERIOD_ID='" . $mp_id . "'" );
$syear = $syear[1]['SYEAR'];
//$fields = 'ID, SCHOOL_ID, STUDENT_ID, MARKING_PERIOD_ID, ';
$fields = 'ID,SCHOOL_ID,STUDENT_ID,MARKING_PERIOD_ID,SYEAR,';
......
......@@ -176,12 +176,12 @@ if ( $_REQUEST['modfunc'] === 'save' )
}
// Optimization: Student Full Name.
$student_name_RET = DBGet( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
$student_full_name = DBGetOne( "SELECT " . DisplayNameSQL( 's' ) . " AS FULL_NAME
FROM STUDENTS s
WHERE s.STUDENT_ID='" . $student_id . "'
LIMIT 1" );
$grades_RET[ $i + 1 ]['FULL_NAME'] = $student_name_RET[1]['FULL_NAME'];
$grades_RET[ $i + 1 ]['FULL_NAME'] = $student_full_name;
if ( $name_tipmessage )
{
......
......@@ -195,12 +195,10 @@ elseif ( !is_numeric( $_REQUEST['assignment_id'] ) )
// Assignment
elseif ( ! empty( $_REQUEST['assignment_id'] ) )
{
$total_points = DBGet( "SELECT POINTS
$total_points = DBGetOne( "SELECT POINTS
FROM GRADEBOOK_ASSIGNMENTS
WHERE ASSIGNMENT_ID='" . $_REQUEST['assignment_id'] . "'" );
$total_points = $total_points[1]['POINTS'];
$current_RET = DBGet( "SELECT STUDENT_ID,POINTS,COMMENT,ASSIGNMENT_ID
FROM GRADEBOOK_GRADES
WHERE ASSIGNMENT_ID='" . $_REQUEST['assignment_id'] . "'
......
......@@ -486,12 +486,10 @@ if ( $_REQUEST['values']
$completed = true;
//FJ add precision to year weighted GPA if not year course period.
$course_period_mp = DBGet( "SELECT MP
$course_period_mp = DBGetOne( "SELECT MP
FROM COURSE_PERIODS
WHERE COURSE_PERIOD_ID='" . $course_period_id . "'" );
$course_period_mp = $course_period_mp[1]['MP'];
foreach ( (array) $_REQUEST['values'] as $student_id => $columns )
{
$sql = $sep = '';
......
......@@ -67,12 +67,10 @@ function StudentAssignmentSubmit( $assignment_id, &$error )
if ( isset( $_FILES['submission_file'] ) )
{
$student_name_RET = DBGet( "SELECT " . DisplayNameSQL() . " AS NAME
$student_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS NAME
FROM STUDENTS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
$student_name = $student_name_RET[1]['NAME'];
// Filename = [course_title]_[assignment_ID]_[student_name]_[timestamp].ext.
$file_name_no_ext = no_accents( $assignment['COURSE_TITLE'] . '_' . $assignment_id . '_' .
$student_name ) . '_' . $timestamp;
......
......@@ -451,7 +451,10 @@ if ( $_REQUEST['tables']
foreach ( $other_school_p as $school_p )
{
$school_p_title = DBGet( "SELECT TITLE FROM SCHOOL_PERIODS WHERE PERIOD_ID='" . $school_p['PERIOD_ID'] . "' AND SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'" );
$school_p_title = DBGetOne( "SELECT TITLE
FROM SCHOOL_PERIODS
WHERE PERIOD_ID='" . $school_p['PERIOD_ID'] . "'
AND SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'" );
//FJ days display to locale
$nb_days = mb_strlen( $school_p['DAYS'] );
......@@ -464,11 +467,11 @@ if ( $_REQUEST['tables']
if ( mb_strlen( $school_p['DAYS'] ) < 5 )
{
$periods_title .= $school_p_title[1]['TITLE'] . $columns_DAYS_locale . ' - ';
$periods_title .= $school_p_title . $columns_DAYS_locale . ' - ';
}
else
{
$periods_title .= $school_p_title[1]['TITLE'] . ' - ';
$periods_title .= $school_p_title . ' - ';
}
}
......@@ -492,7 +495,7 @@ if ( $_REQUEST['tables']
$columns_DAYS_locale .= mb_substr( $days_convert[mb_substr( $columns['DAYS'], $i, 1 )], 0, 3 ) . '.';
}
$period = DBGet( "SELECT sp.TITLE
$school_period_title = DBGetOne( "SELECT sp.TITLE
FROM SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp