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

Use MakeTipMessage() in TeacherCompletion & for FS Accounts warnings

parent 59b6db28
<?php
require_once 'ProgramFunctions/TipMessage.fnc.php';
// set date
if ( isset( $_REQUEST['month_date'] )
&& isset( $_REQUEST['day_date'] )
......@@ -77,38 +79,35 @@ $RET = DBGet(DBQuery($sql),array(),array('STAFF_ID'));
if ( !$_REQUEST['period'])
{
$tiptitle = false;
foreach ( (array)$RET as $staff_id => $periods)
foreach ( (array)$RET as $staff_id => $periods )
{
$i++;
$staff_RET[$i]['FULL_NAME'] = $periods[1]['FULL_NAME'];
foreach ( (array)$periods as $period)
foreach ( (array)$periods as $period )
{
if ( !isset($_REQUEST['_ROSARIO_PDF']))
if ( !isset( $_REQUEST['_ROSARIO_PDF'] ) )
{
$tipJS = '<script>';
if ( !$tiptitle)
{
$tipJS .= 'var tiptitle='.json_encode(_('Course Title')).';';
$tiptitle = true;
}
$tipJS .= 'var tipmsg'.$i.$period['PERIOD_ID'].'='.json_encode($period['COURSE_TITLE']).';</script>';
$staff_RET[$i][$period['PERIOD_ID']] .= $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$i.$period['PERIOD_ID'].'])" onMouseOut="htm()" onclick="return false;"').' ';
$staff_RET[$i][$period['PERIOD_ID']] = MakeTipMessage(
$period['COURSE_TITLE'],
_( 'Course Title' ),
button( $period['COMPLETED'] === 'Y' ? 'check' : 'x' )
);
}
else
$staff_RET[$i][$period['PERIOD_ID']] = ($period['COMPLETED']=='Y'?_('Yes'):_('No'))." ";
}
}
$columns = array('FULL_NAME' => _('Teacher'));
foreach ( (array)$periods_RET as $id => $period)
$columns = array( 'FULL_NAME' => _( 'Teacher' ) );
foreach ( (array)$periods_RET as $id => $period )
{
$columns[$id] = $period[1]['TITLE'];
}
ListOutput($staff_RET,$columns,'Teacher who takes attendance','Teachers who take attendance');
ListOutput( $staff_RET, $columns, 'Teacher who takes attendance', 'Teachers who take attendance' );
}
else
{
......@@ -123,21 +122,26 @@ else
{
if ( !isset($_REQUEST['_ROSARIO_PDF']))
{
$tipJS = '<script>';
if ( !$tiptitle)
{
$tipJS .= 'var tiptitle='.json_encode(_('Course Title')).';';
$tiptitle = true;
}
$tipJS .= 'var tipmsg'.$staff_id.$id.'='.json_encode($period['COURSE_TITLE']).';</script>';
$RET[$staff_id][$id]['COMPLETED'] = $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$staff_id.$id.'])" onMouseOut="htm()" onclick="return false;"').' ';
$RET[$staff_id][$id]['COMPLETED'] = MakeTipMessage(
$period['COURSE_TITLE'],
_( 'Course Title' ),
button( $period['COMPLETED'] === 'Y' ? 'check' : 'x' )
);
}
else
$RET[$staff_id][$id]['COMPLETED'] = ($period['COMPLETED']=='Y'?_('Yes'):_('No'))." ";
}
}
ListOutput($RET,array('FULL_NAME' => _('Teacher'),'COURSE_TITLE' => _('Course'),'COMPLETED' => _('Completed')),sprintf(_('Teacher who takes %s attendance'),$period_title),sprintf(_('Teachers who take %s attendance'),$period_title),false,array('STAFF_ID'));
ListOutput(
$RET,
array(
'FULL_NAME' => _( 'Teacher' ),
'COURSE_TITLE' => _( 'Course' ),
'COMPLETED' => _( 'Completed' ) ),
sprintf( _( 'Teacher who takes %s attendance' ), $period_title ),
sprintf( _( 'Teachers who take %s attendance' ), $period_title ),
false,
array( 'STAFF_ID' )
);
}
<?php
require_once 'ProgramFunctions/TipMessage.fnc.php';
if ( $_REQUEST['modfunc']=='update')
{
if (UserStudentID() && AllowEdit())
......@@ -26,49 +28,47 @@ if ( !$_REQUEST['modfunc'] && UserStudentID())
// find other students associated with the same account
$xstudents = DBGet(DBQuery("SELECT s.STUDENT_ID,s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME FROM STUDENTS s,FOOD_SERVICE_STUDENT_ACCOUNTS fssa WHERE fssa.ACCOUNT_ID='".$student['ACCOUNT_ID']."' AND s.STUDENT_ID=fssa.STUDENT_ID AND s.STUDENT_ID!='".UserStudentID()."'"));
echo '<table class="width-100p">';
echo '<tr>';
echo '<td class="valign-top">';
echo '<table class="width-100p"><tr>';
echo '<table class="width-100p valign-top fixed-col"><tr><td>';
echo '<td class="valign-top">'.NoInput(($student['BALANCE']<0?'<span style="color:red">':'').$student['BALANCE'].($student['BALANCE']<0?'</span>':''),_('Balance')).'</td>';
echo NoInput(($student['BALANCE']<0?'<span style="color:red">':'').$student['BALANCE'].($student['BALANCE']<0?'</span>':''),_('Balance'));
echo '</tr></table>';
echo '</td></tr></table>';
echo '<hr />';
echo '<table class="width-100p cellspacing-0">';
echo '<tr><td class="valign-top">';
echo '<table class="width-100 valign-top fixed-col"><tr><td>';
echo '<table class="width-100p">';
echo '<tr>';
echo '<td>';
echo TextInput(
$student['ACCOUNT_ID'],
'food_service[ACCOUNT_ID]',
_( 'Account ID' ),
'required size=12 maxlength=10'
);
// warn if account non-existent (balance query failed)
if ( $student['BALANCE']=='')
if ( $student['BALANCE'] == '' )
{
echo TextInput(array($student['ACCOUNT_ID'],'<span style="color:red">'.$student['ACCOUNT_ID'].'</span>'),'food_service[ACCOUNT_ID]',_('Account ID'),'size=12 maxlength=10');
$warning = _('Non-existent account!');
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
echo MakeTipMessage(
_( 'Non-existent account!' ),
_( 'Warning' ),
button( 'warning' )
);
}
else
echo TextInput($student['ACCOUNT_ID'],'food_service[ACCOUNT_ID]','Account ID','size=12 maxlength=10');
// warn if other students associated with the same account
if (count($xstudents))
if ( count( $xstudents ) )
{
$warning = _('Other students associated with the same account').':<br />';
foreach ( (array)$xstudents as $xstudent)
$warning .= '&nbsp;'.$xstudent['FULL_NAME'].'<br />';
$warning = _( 'Other students associated with the same account' ) . ':<br />';
$tipJS = '<script>var tiptitle2='.json_encode(_('Warning')).'; var tipmsg2='.json_encode($warning).';</script>';
foreach ( (array)$xstudents as $xstudent )
{
$warning .= '&nbsp;' . $xstudent['FULL_NAME'] . '<br />';
}
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2])" onMouseOut="htm()" onclick="return false;"');
echo MakeTipMessage(
$warning,
_( 'Warning' ),
button( 'warning' )
);
}
echo '</td>';
......@@ -80,7 +80,4 @@ if ( !$_REQUEST['modfunc'] && UserStudentID())
echo '<td>'.TextInput($student['BARCODE'],'food_service[BARCODE]',_('Barcode'),'size=12 maxlength=25').'</td>';
echo '</tr>';
echo '</table>';
echo '</td></tr>';
echo '</table>';
}
<?php
require_once 'ProgramFunctions/TipMessage.fnc.php';
if ( $_REQUEST['modfunc']=='update')
{
if (UserStudentID() && AllowEdit())
......@@ -107,43 +109,51 @@ if (UserStudentID() && empty($_REQUEST['modfunc']))
PopTable('header',_('Account Information'),'width="100%"');
echo '<table class="width-100p valign-top"><tr>';
echo '';
echo '<table class="width-100p valign-top fixed-col"><tr><td>';
echo '<td>'.NoInput($student['FULL_NAME'],'<b>'.$student['STUDENT_ID'].'</b>').'</td>';
echo '<td>'.NoInput(red($student['BALANCE']),_('Balance')).'</td>';
echo NoInput( $student['FULL_NAME'], '<b>' . $student['STUDENT_ID'] . '</b>' );
echo '</tr></table>';
echo '<hr />';
echo '</td><td>';
echo '<table class="width-100p cellspacing-0 valign-top"><tr><td>';
echo NoInput( red( $student['BALANCE'] ), _( 'Balance' ) );
// warn if account non-existent (balance query failed)
if ( $student['BALANCE']=='')
{
//var_dump($student['ACCOUNT_ID']);
echo TextInput(array($student['ACCOUNT_ID'],'<span style="color:red">'.$student['ACCOUNT_ID'].'</span>'),'food_service[ACCOUNT_ID]',_('Account ID'),'size=12 maxlength=10');
echo '</td></tr></table>';
echo '<hr />';
$warning = _('Non-existent account!');
echo '<table class="width-100p valign-top fixed-col"><tr><td>';
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo TextInput(
$student['ACCOUNT_ID'],
'food_service[ACCOUNT_ID]',
_( 'Account ID' ),
'required size=12 maxlength=10'
);
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
// warn if account non-existent (balance query failed)
if ( $student['BALANCE'] == '' )
{
echo MakeTipMessage(
_( 'Non-existent account!' ),
_( 'Warning' ),
button( 'warning' )
);
}
else
echo TextInput($student['ACCOUNT_ID'],'food_service[ACCOUNT_ID]',_('Account ID'),'size=12 maxlength=10');
// warn if other students associated with the same account
if (count($xstudents))
if ( count( $xstudents ) )
{
$warning = _('Other students associated with the same account').':<br />';
foreach ( (array)$xstudents as $xstudent)
$warning .= '&nbsp;'.$xstudent['FULL_NAME'].'<br />';
$tipJS = '<script>var tiptitle2='.json_encode(_('Warning')).'; var tipmsg2='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2])" onMouseOut="htm()" onclick="return false;"');
$warning = _( 'Other students associated with the same account' ) . ':<br />';
foreach ( (array)$xstudents as $xstudent )
{
$warning .= '&nbsp;' . $xstudent['FULL_NAME'] . '<br />';
}
echo MakeTipMessage(
$warning,
_( 'Warning' ),
button( 'warning' )
);
}
echo '</td>';
......
......@@ -37,13 +37,13 @@ if ( !$_REQUEST['modfunc'] && UserStaffID())
echo '<td class="valign-top">'.NoInput(($staff['BALANCE']<0?'<span style="color:red">':'').$staff['BALANCE'].($staff['BALANCE']<0?'</span>':''),'Balance');
// warn if account non-existent (balance query failed)
if ( !$staff['ACCOUNT_ID'])
if ( !$staff['ACCOUNT_ID'] )
{
$warning = _('This user does not have a Meal Account.');
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo '<br />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
echo '<br />' . MakeTipMessage(
_( 'This user does not have a Meal Account.' ),
_( 'Warning' ),
button( 'warning' )
);
}
echo '</td>';
......@@ -52,7 +52,7 @@ if ( !$_REQUEST['modfunc'] && UserStaffID())
echo '</td></tr></table>';
echo '<hr />';
echo '<table class="width-100p cellspacing-0">';
echo '<table class="width-100p fixed-col">';
echo '<tr><td class="valign-top">';
echo '<table class="width-100p">';
......
<?php
require_once 'ProgramFunctions/TipMessage.fnc.php';
if ( $_REQUEST['modfunc']=='update')
{
if (UserStaffID() && AllowEdit())
......@@ -119,28 +121,28 @@ if (UserStaffID() && empty($_REQUEST['modfunc']))
echo '<br />';
PopTable('header',_('Account Information'),'width="100%"');
echo '<table class="width-100p valign-top"><tr>';
echo '<table class="width-100p valign-top fixed-col"><tr><td>';
echo '<td>'.NoInput($staff['FULL_NAME'],$staff['STAFF_ID']);
echo NoInput( $staff['FULL_NAME'], $staff['STAFF_ID'] );
// warn if other users associated with the same account
if ( !$staff['ACCOUNT_ID'])
if ( !$staff['ACCOUNT_ID'] )
{
$warning = _('This user does not have a Meal Account.');
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo '<br />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
echo '<br />' . MakeTipMessage(
_( 'This user does not have a Meal Account.' ),
_( 'Warning' ),
button( 'warning' )
);
}
echo '</td>';
echo '</td><td>';
echo '<td>'.NoInput(red($staff['BALANCE']),_('Balance')).'</td>';
echo NoInput( red( $staff['BALANCE'] ), _( 'Balance' ) );
echo '</tr></table>';
echo '</td></tr></table>';
echo '<hr />';
echo '<table class="width-100p cellspacing-0 valign-top"><tr><td>';
echo '<table class="width-100p valign-top fixed-col"><tr><td>';
$options = array('Inactive' => _('Inactive'),'Disabled' => _('Disabled'),'Closed' => _('Closed'));
echo ($staff['ACCOUNT_ID']?SelectInput($staff['STATUS'],'food_service[STATUS]',_('Status'),$options,_('Active')):NoInput('-',_('Status')));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment