本文整理汇总了PHP中grade_item::get_name方法的典型用法代码示例。如果您正苦于以下问题:PHP grade_item::get_name方法的具体用法?PHP grade_item::get_name怎么用?PHP grade_item::get_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grade_item
的用法示例。
在下文中一共展示了grade_item::get_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: certificate_print_outcome
/**
* Prepare to print an outcome.
*
* @param stdClass $course
* @param int $moduleid
* @return mixed
*/
function certificate_print_outcome($course, $id)
{
global $USER, $DB;
if ($grade_item = new grade_item(array('id' => $id))) {
$outcomeinfo = new stdClass();
$outcomeinfo->name = $grade_item->get_name();
$outcome = new grade_grade(array('itemid' => $grade_item->id, 'userid' => $USER->id));
$outcomeinfo->grade = grade_format_gradevalue($outcome->finalgrade, $grade_item, true, GRADE_DISPLAY_TYPE_REAL);
return $outcomeinfo;
}
return false;
}
示例2: certificate_get_outcome
/**
* Returns the outcome to display on the certificate
*
* @param stdClass $certificate
* @param stdClass $course
* @return string the outcome
*/
function certificate_get_outcome($certificate, $course)
{
global $USER;
if ($certificate->printoutcome > 0) {
if ($grade_item = new grade_item(array('id' => $certificate->printoutcome))) {
$outcomeinfo = new stdClass();
$outcomeinfo->name = $grade_item->get_name();
$outcome = new grade_grade(array('itemid' => $grade_item->id, 'userid' => $USER->id));
$outcomeinfo->grade = grade_format_gradevalue($outcome->finalgrade, $grade_item, true, GRADE_DISPLAY_TYPE_REAL);
return $outcomeinfo->name . ': ' . $outcomeinfo->grade;
}
}
return '';
}
示例3: get_outcome
/**
* Returns the outcome to display on the certificate
*
* @return string the outcome
*/
protected function get_outcome($userid)
{
global $USER, $DB;
if (empty($userid)) {
$userid = $USER->id;
}
if ($this->get_instance()->outcome > 0) {
if ($grade_item = new grade_item(array('id' => $this->get_instance()->outcome))) {
$outcomeinfo = new stdClass();
$outcomeinfo->name = $grade_item->get_name();
$outcome = new grade_grade(array('itemid' => $grade_item->id, 'userid' => $userid));
$outcomeinfo->grade = grade_format_gradevalue($outcome->finalgrade, $grade_item, true, GRADE_DISPLAY_TYPE_REAL);
return $outcomeinfo->name . ': ' . $outcomeinfo->grade;
}
}
return '';
}
示例4: foreach
}
$sitewide_html = '<td class="cell c2" rowspan="' . $rowspan . '">' . $sitewide . "</td>\n";
$outcomedata['outcome']->sum = 0;
$scale = new grade_scale(array('id' => $outcomedata['outcome']->scaleid), false);
$print_tr = false;
$items_html = '';
if (!empty($outcomedata['items'])) {
foreach ($outcomedata['items'] as $itemid => $item) {
if ($print_tr) {
$row++;
$items_html .= "<tr class=\"r{$row}\">\n";
}
$grade_item = new grade_item($item, false);
if ($item->itemtype == 'mod') {
$cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance, $item->courseid);
$itemname = '<a href="' . $CFG->wwwroot . '/mod/' . $item->itemmodule . '/view.php?id=' . $cm->id . '">' . $grade_item->get_name() . '</a>';
} else {
$itemname = $grade_item->get_name();
}
$outcomedata['outcome']->sum += $item->avg;
$gradehtml = $scale->get_nearest_item($item->avg);
$items_html .= "<td class=\"cell c3\">{$itemname}</td>" . "<td class=\"cell c4\">{$gradehtml} ({$item->avg})</td>" . "<td class=\"cell c5\">{$item->count}</td></tr>\n";
$print_tr = true;
}
} else {
$items_html .= "<td class=\"cell c3\"> - </td><td class=\"cell c4\"> - </td><td class=\"cell c5\"> 0 </td></tr>\n";
}
// Calculate outcome average
if (is_array($outcomedata['items'])) {
$count = count($outcomedata['items']);
if ($count > 0) {
示例5: foreach
$outcomedata['outcome']->sum = 0;
$scale = new grade_scale(array('id' => $outcomedata['outcome']->scaleid), false);
$print_tr = false;
$items_html = '';
if (!empty($outcomedata['items'])) {
foreach ($outcomedata['items'] as $itemid => $item) {
if ($print_tr) {
$row++;
$items_html .= "<tr class=\"r{$row}\">\n";
}
$grade_item = new grade_item($item, false);
if ($item->itemtype == 'mod') {
$cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance, $item->courseid);
$itemname = '<a href="' . $CFG->wwwroot . '/mod/' . $item->itemmodule . '/view.php?id=' . $cm->id . '">' . format_string($cm->name, true, $cm->course) . '</a>';
} else {
$itemname = $grade_item->get_name();
}
$outcomedata['outcome']->sum += $item->avg;
$gradehtml = $scale->get_nearest_item($item->avg);
$items_html .= "<td class=\"cell c3\">{$itemname}</td>" . "<td class=\"cell c4\">{$gradehtml} ({$item->avg})</td>" . "<td class=\"cell c5\">{$item->count}</td></tr>\n";
$print_tr = true;
}
} else {
$items_html .= "<td class=\"cell c3\"> - </td><td class=\"cell c4\"> - </td><td class=\"cell c5\"> 0 </td></tr>\n";
}
// Calculate outcome average
if (is_array($outcomedata['items'])) {
$count = count($outcomedata['items']);
if ($count > 0) {
$avg = $outcomedata['outcome']->sum / $count;
} else {