本文整理汇总了PHP中Percent函数的典型用法代码示例。如果您正苦于以下问题:PHP Percent函数的具体用法?PHP Percent怎么用?PHP Percent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Percent函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _makePoints
function _makePoints($value, $column)
{
global $THIS_RET;
if ($value == '') {
return '<FONT class=red>Missing</FONT>';
} elseif ($value == '-1') {
return '<FONT color=#00a000>Excused</FONT>';
} elseif ($value < 0) {
return '<FONT class=red>Negative!</FONT>';
} elseif ($THIS_RET['TOTAL_POINTS'] == 0) {
return '<FONT color=#0000ff>Extra Credit</FONT>';
}
return Percent($value / $THIS_RET['TOTAL_POINTS'], 0);
}
示例2: _makeByDay
function _makeByDay($value, $column)
{
global $THIS_RET, $student_days_absent, $cal_days, $sum;
switch ($column) {
case 'STUDENTS':
break;
case 'DAYS_POSSIBLE':
return $cal_days;
break;
case 'PRESENT':
$sum['PRESENT'] += $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
return $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
break;
case 'ABSENT':
$sum['ABSENT'] += $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
return $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
break;
case 'ADA':
return Percent(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $THIS_RET['STUDENTS']);
break;
case 'AVERAGE_ATTENDANCE':
$sum['AVERAGE_ATTENDANCE'] += ($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $cal_days;
return round(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $cal_days, 1);
break;
case 'AVERAGE_ABSENT':
$sum['AVERAGE_ABSENT'] += $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'] / $cal_days;
return round($student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'] / $cal_days, 1);
break;
}
}
示例3: _makeByDay
function _makeByDay($value, $column)
{
global $THIS_RET, $student_days_absent, $atten_possible, $cal_days, $sum;
switch ($column) {
case 'ATTENDANCE_POSSIBLE':
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return 1;
} else {
return 0;
}
break;
case 'STUDENTS':
$sum['STUDENTS'] += $value / $cal_days;
return round($value / $cal_days, 1);
break;
case 'DAYS_POSSIBLE':
return $cal_days;
break;
case 'TOTAL_ATTENDANCE':
return $sum['TOTAL_ATTENDANCE'] += $total_attn;
break;
case 'PRESENT':
$sum['PRESENT'] += $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
$PRESENT_STU = $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return $THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
} else {
return "";
}
break;
case 'ABSENT':
$sum['ABSENT'] += $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'];
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return round($student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']);
} else {
return "";
}
break;
case 'ADA':
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return Percent(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $THIS_RET['STUDENTS']);
} else {
return "";
}
break;
case 'AVERAGE_ATTENDANCE':
$sum['AVERAGE_ATTENDANCE'] += ($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $cal_days;
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return round(($THIS_RET['ATTENDANCE_POSSIBLE'] - $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE']) / $cal_days, 1);
} else {
return "";
}
break;
case 'AVERAGE_ABSENT':
$sum['AVERAGE_ABSENT'] += $student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'] / $cal_days;
if ($atten_possible[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['ST_ID']) {
return round($student_days_absent[$THIS_RET['SCHOOL_DATE']][$THIS_RET['GRADE_ID']][1]['STATE_VALUE'] / $cal_days, 1);
} else {
return "";
}
break;
}
}
示例4: _makeExtraStuCols
function _makeExtraStuCols($value, $column)
{
global $THIS_RET, $assignment_count, $count_assignments, $max_allowed;
switch ($column) {
case 'POINTS':
$assignment_count++;
$tabindex = $assignment_count;
if ($value == '-1') {
$value = '*';
} elseif (strpos($value, '.')) {
$value = rtrim(rtrim($value, '0'), '.');
}
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD>' . TextInput($value, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $THIS_RET['ASSIGNMENT_ID'] . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '</TD><TD> / </TD><TD>' . $THIS_RET['TOTAL_POINTS'] . '</TD></TR></TABLE>';
break;
case 'LETTER_GRADE':
if ($THIS_RET['TOTAL_POINTS'] != 0) {
if ($THIS_RET['POINTS'] != '-1') {
if ($THIS_RET['POINTS'] != '') {
return ($THIS_RET['DUE'] || $THIS_RET['POINTS'] != '' ? $THIS_RET['POINTS'] > $THIS_RET['TOTAL_POINTS'] * $max_allowed ? '<FONT color=red>' : '' : '<FONT color=gray>') . Percent($THIS_RET['POINTS'] / $THIS_RET['TOTAL_POINTS']) . ($THIS_RET['DUE'] || $THIS_RET['POINTS'] != '' ? $THIS_RET['POINTS'] > $THIS_RET['TOTAL_POINTS'] * $max_allowed ? '</FONT>' : '' : '') . ' <B>' . _makeLetterGrade($THIS_RET['POINTS'] / $THIS_RET['TOTAL_POINTS']) . '</B>' . ($THIS_RET['DUE'] || $THIS_RET['POINTS'] != '' ? '' : '</FONT>');
} else {
return 'Not Graded';
}
} else {
return 'N/A N/A';
}
} else {
return 'E/C';
}
break;
case 'COMMENT':
$tabindex += $count_assignments;
return TextInput($value, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $THIS_RET['ASSIGNMENT_ID'] . '][COMMENT]', '', ' maxlength=100 tabindex=' . $tabindex);
break;
}
}
示例5: _makeExtra
function _makeExtra($value, $column)
{
global $THIS_RET, $student_points, $total_points, $percent_weights;
if ($column == 'POINTS') {
if ($THIS_RET['TOTAL_POINTS'] != '0') {
if ($value != '-1') {
if (($THIS_RET['DUE'] || $value != '') && $value != '') {
$student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value;
$total_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $THIS_RET['TOTAL_POINTS'];
$percent_weights[$THIS_RET['ASSIGNMENT_TYPE_ID']] = $THIS_RET['FINAL_GRADE_PERCENT'];
}
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>';
} else {
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>Excluded</font></TD><TD></TD><TD></TD></TR></TABLE>';
}
} else {
$student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value;
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR><TD><font size=-1>' . (rtrim(rtrim($value, '0'), '.') + 0) . '</font></TD><TD><font size=-1> / </font></TD><TD><font size=-1>' . $THIS_RET['TOTAL_POINTS'] . '</font></TD></TR></TABLE>';
}
} elseif ($column == 'LETTER_GRADE') {
if ($THIS_RET['TOTAL_POINTS'] != '0') {
if ($value != '-1') {
if ($THIS_RET['DUE'] && $value == '') {
return 'Not Graded';
} else {
if ($THIS_RET['DUE'] || $value != '') {
return Percent($value / $THIS_RET['TOTAL_POINTS'], 0) . ' ' . _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS'], $THIS_RET['COURSE_PERIOD_ID'], UserStaffID());
} else {
return 'not due';
}
}
} else {
return 'n/a n/a';
}
} else {
return 'e/c';
}
}
}
示例6: _makePercent
function _makePercent($value, $column)
{
return Percent($value, 2);
}
示例7: _makeExtraCols
function _makeExtraCols($assignment_id, $column)
{
global $THIS_RET, $assignments_RET, $current_RET, $old_student_id, $student_count, $tabindex, $count_students, $max_allowed, $program_config;
if ($THIS_RET['STUDENT_ID'] != $old_student_id) {
$student_count++;
$tabindex = $student_count;
$old_student_id = $THIS_RET['STUDENT_ID'];
} else {
$tabindex += $count_students;
}
$total_points = $assignments_RET[$assignment_id][1]['POINTS'];
if ($_REQUEST['include_all'] || ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] != '' || !$assignments_RET[$assignment_id][1]['DUE_EPOCH'] || $assignments_RET[$assignment_id][1]['DUE_EPOCH'] >= $THIS_RET['START_EPOCH'] && (!$THIS_RET['END_EPOCH'] || $assignments_RET[$assignment_id][1]['DUE_EPOCH'] <= $THIS_RET['END_EPOCH']))) {
if ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] == '-1') {
$points = '*';
} elseif (mb_strpos($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '.')) {
$points = rtrim(rtrim($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '0'), '.');
} else {
$points = $current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'];
}
if ($total_points != 0) {
if ($points != '*') {
// return '<TABLE cellspacing=0 cellpadding=0><TR align=center><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> '.($assignments_RET[$assignment_id][1]['DUE']||$points!=''?($points>$total_points*$max_allowed?'<span style="color:red">':''):'<span style="color:gray">').Percent($points/$total_points,0).($assignments_RET[$assignment_id][1]['DUE']||$points!=''?($points>$total_points*$max_allowed?'</span>':''):'').'<BR /> <B>'._makeLetterGrade($points/$total_points).'</B>'.'</TD></TR></TABLE>';
// modif Francois: display letter grade according to Configuration
return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ($program_config['GRADES_DOES_LETTER_PERCENT'][1]['VALUE'] <= 0 ? '' : ' − ' . ($assignments_RET[$assignment_id][1]['DUE'] || $points != '' ? $points > $total_points * $max_allowed ? '<span style="color:red">' : '' : '<span style="color:gray">') . Percent($points / $total_points, 0) . ($assignments_RET[$assignment_id][1]['DUE'] || $points != '' ? $points > $total_points * $max_allowed ? '</span>' : '' : '')) . ($program_config['GRADES_DOES_LETTER_PERCENT'][1]['VALUE'] >= 0 ? '' : ' − <B>' . _makeLetterGrade($points / $total_points) . '</B>');
} else {
// return '<TABLE cellspacing=0 cellpadding=1><TR align=center><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> '._('N/A').'<BR /> '._('N/A').'</TD></TR></TABLE>';
return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ' − ' . _('N/A');
}
} else {
//return '<TABLE class="cellpadding-1 cellspacing-0"><TR class="center"><TD>'.TextInput($points,'values['.$THIS_RET['STUDENT_ID'].']['.$assignment_id.'][POINTS]','',' size=2 maxlength=7 tabindex='.$tabindex).'<HR>'.$total_points.'</TD><TD> E/C</TD></TR></TABLE>';
return TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex, false) . ' / ' . $total_points . ' − ' . 'E/C';
}
}
}
示例8: _makeExtraCols
function _makeExtraCols($assignment_id, $column)
{
global $THIS_RET, $total_points, $current_RET, $old_student_id, $student_count, $tabindex, $count_students, $max_allowed;
if ($THIS_RET['STUDENT_ID'] != $old_student_id) {
$student_count++;
$tabindex = $student_count;
$old_student_id = $THIS_RET['STUDENT_ID'];
} else {
$tabindex += $count_students;
}
if ($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'] == '-1') {
$points = '*';
} elseif (strpos($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '.')) {
$points = rtrim(rtrim($current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'], '0'), '.');
} else {
$points = $current_RET[$THIS_RET['STUDENT_ID']][$assignment_id][1]['POINTS'];
}
if ($total_points[$assignment_id] != 0) {
if ($points != '*') {
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> ' . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '<FONT color=red>' : '' : '<FONT color=gray>') . Percent($points / $total_points[$assignment_id], 0) . ($THIS_RET['D' . $assignment_id] || $points != '' ? $points > $total_points[$assignment_id] * $max_allowed ? '</FONT>' : '' : '') . '<BR> <B>' . _makeLetterGrade($points / $total_points[$assignment_id]) . '</B>' . ($THIS_RET['D' . $assignment_id] || $points != '' ? '' : '</FONT>') . '</TD></TR></TABLE>';
} else {
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> N/A<BR> N/A</TD></TR></TABLE>';
}
} else {
return '<TABLE border=0 cellspacing=0 cellpadding=0 class=LO_field><TR align=center><TD>' . TextInput($points, 'values[' . $THIS_RET['STUDENT_ID'] . '][' . $assignment_id . '][POINTS]', '', ' size=2 maxlength=7 tabindex=' . $tabindex) . '<HR>' . $total_points[$assignment_id] . '</TD><TD> E/C</TD></TR></TABLE>';
}
}
示例9: _makePoints
function _makePoints($value, $column)
{
global $THIS_RET;
if ($value == '') {
return '<span style="color:#ff0000">' . _('Missing') . '</span>';
} elseif ($value == '-1') {
return '<span style="color:#00a000">' . _('Excused') . '</span>';
} elseif ($value < 0) {
return '<span style="color:#ff0000">' . _('Negative') . '</span>';
} elseif ($THIS_RET['TOTAL_POINTS'] == 0) {
return '<span style="color:#0000ff">' . _('Extra Credit') . '</span>';
}
return Percent($value / $THIS_RET['TOTAL_POINTS'], 0);
}
示例10: _makeExtra
function _makeExtra($value, $column)
{
global $THIS_RET, $student_points, $total_points, $percent_weights;
if ($column == 'POINTS') {
if ($THIS_RET['TOTAL_POINTS'] != '0') {
if ($value != '-1') {
if ($THIS_RET['DUE'] || $value != '') {
$student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value;
$total_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $THIS_RET['TOTAL_POINTS'];
$percent_weights[$THIS_RET['ASSIGNMENT_TYPE_ID']] = $THIS_RET['FINAL_GRADE_PERCENT'];
}
return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . (rtrim(rtrim($value, '0'), '.') + 0) . '</span></TD><TD><span class="size-1"> / </span></TD><TD><span class="size-1">' . $THIS_RET['TOTAL_POINTS'] . '</span></TD></TR></TABLE>';
} else {
return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . _('Excluded') . '</span></TD><TD></TD><TD></TD></TR></TABLE>';
}
} else {
$student_points[$THIS_RET['ASSIGNMENT_TYPE_ID']] += $value;
return '<TABLE class="cellpadding-0 cellspacing-0"><TR><TD><span class="size-1">' . (rtrim(rtrim($value, '0'), '.') + 0) . '</span></TD><TD><span class="size-1"> / </span></TD><TD><span class="size-1">' . $THIS_RET['TOTAL_POINTS'] . '</span></TD></TR></TABLE>';
}
} elseif ($column == 'PERCENT_GRADE') {
if ($THIS_RET['TOTAL_POINTS'] != '0') {
if ($value != '-1') {
if ($THIS_RET['DUE'] || $value != '') {
return Percent($value / $THIS_RET['TOTAL_POINTS'], 1);
} else {
return 'not due';
}
} else {
return _('N/A');
}
} else {
return 'e/c';
}
} elseif ($column == 'LETTER_GRADE') {
if ($THIS_RET['TOTAL_POINTS'] != '0') {
if ($value != '-1') {
if ($THIS_RET['DUE'] || $value != '') {
return _makeLetterGrade($value / $THIS_RET['TOTAL_POINTS']);
} else {
return 'not due';
}
} else {
return _('N/A');
}
} else {
return 'e/c';
}
}
}