当前位置: 首页>>代码示例>>PHP>>正文


PHP quiz_format_grade函数代码示例

本文整理汇总了PHP中quiz_format_grade函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_format_grade函数的具体用法?PHP quiz_format_grade怎么用?PHP quiz_format_grade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了quiz_format_grade函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_quiz_format_grade

 public function test_quiz_format_grade()
 {
     $quiz = new stdClass();
     $quiz->decimalpoints = 2;
     $this->assertEquals(quiz_format_grade($quiz, 0.12345678), format_float(0.12, 2));
     $this->assertEquals(quiz_format_grade($quiz, 0), format_float(0, 2));
     $this->assertEquals(quiz_format_grade($quiz, 1.0), format_float(1, 2));
     $quiz->decimalpoints = 0;
     $this->assertEquals(quiz_format_grade($quiz, 0.12345678), '0');
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:10,代码来源:lib_test.php

示例2: build_table

    function build_table(){
        global $CFG, $DB;
        if ($this->rawdata) {
            // Define some things we need later to process raw data from db.
            $this->strtimeformat = str_replace(',', '', get_string('strftimedatetime'));
            parent::build_table();
            //end of adding data from attempts data to table / download
            //now add averages at bottom of table :
            $params = array($this->quiz->id);
            $averagesql = "SELECT AVG(qg.grade) AS grade " .
                    "FROM {quiz_grades} qg " .
                    "WHERE quiz=?";

            $this->add_separator();
            if ($this->is_downloading()){
                $namekey = 'lastname';
            } else {
                $namekey = 'fullname';
            }
            if ($this->groupstudents){
                list($g_usql, $g_params) = $DB->get_in_or_equal($this->groupstudents);

                $groupaveragesql = $averagesql." AND qg.userid $g_usql";
                $groupaverage = $DB->get_record_sql($groupaveragesql, array_merge($params, $g_params));
                $groupaveragerow = array($namekey => get_string('groupavg', 'grades'),
                        'sumgrades' => quiz_format_grade($this->quiz, $groupaverage->grade),
                        'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($groupaverage->grade, $this->quiz->id, $this->context)));
                if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) {
                    $avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->groupstudents);
                    $groupaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading());
                }
                $this->add_data_keyed($groupaveragerow);
            }

            if ($this->students) {
                list($s_usql, $s_params) = $DB->get_in_or_equal($this->students);
                $overallaverage = $DB->get_record_sql($averagesql." AND qg.userid $s_usql", array_merge($params, $s_params));
                $overallaveragerow = array($namekey => get_string('overallaverage', 'grades'),
                            'sumgrades' => quiz_format_grade($this->quiz, $overallaverage->grade),
                            'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($overallaverage->grade, $this->quiz->id, $this->context)));
                if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) {
                    $avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->students);
                    $overallaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading());
                }
                $this->add_data_keyed($overallaveragerow);
            }
        }
    }
开发者ID:nuckey,项目名称:moodle,代码行数:48,代码来源:overview_table.php

示例3: quiz_rescale_grade

/**
 * Convert the raw grade stored in $attempt into a grade out of the maximum
 * grade for this quiz.
 *
 * @param float $rawgrade the unadjusted grade, fof example $attempt->sumgrades
 * @param object $quiz the quiz object. Only the fields grade, sumgrades and decimalpoints are used.
 * @param bool|string $format whether to format the results for display
 *      or 'question' to format a question grade (different number of decimal places.
 * @return float|string the rescaled grade, or null/the lang string 'notyetgraded'
 *      if the $grade is null.
 */
function quiz_rescale_grade($rawgrade, $quiz, $format = true) {
    if (is_null($rawgrade)) {
        $grade = null;
    } else if ($quiz->sumgrades >= 0.000005) {
        $grade = $rawgrade * $quiz->grade / $quiz->sumgrades;
    } else {
        $grade = 0;
    }
    if ($format === 'question') {
        $grade = quiz_format_question_grade($quiz, $grade);
    } else if ($format) {
        $grade = quiz_format_grade($quiz, $grade);
    }
    return $grade;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:26,代码来源:locallib.php

示例4: add_grade_columns

 /**
  * Add all the grade and feedback columns, if applicable, to the $columns
  * and $headers arrays.
  * @param object $quiz the quiz settings.
  * @param array $columns the list of columns. Added to.
  * @param array $headers the columns headings. Added to.
  */
 protected function add_grade_columns($quiz, &$columns, &$headers)
 {
     if ($this->should_show_grades($quiz)) {
         $columns[] = 'sumgrades';
         $headers[] = get_string('grade', 'quiz') . '/' . quiz_format_grade($quiz, $quiz->grade);
     }
     if (quiz_has_feedback($quiz)) {
         $columns[] = 'feedbacktext';
         $headers[] = get_string('feedback', 'quiz');
     }
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:18,代码来源:attemptsreport.php

示例5: foreach

                        foreach ($slots as $slot) {
                            $json[$slot->slot] = array('id' => $slot->id, 'slot' => $slot->slot, 'page' => $slot->page);
                        }
                        echo json_encode(array('slots' => $json));
                        break;
                    case 'updatedependency':
                        require_capability('mod/quiz:manage', $modcontext);
                        $slot = $structure->get_slot_by_id($id);
                        $value = (bool) $value;
                        $structure->update_question_dependency($slot->id, $value);
                        echo json_encode(array('requireprevious' => $value));
                        break;
                }
                break;
        }
        break;
    case 'DELETE':
        switch ($class) {
            case 'resource':
                require_capability('mod/quiz:manage', $modcontext);
                if (!($slot = $DB->get_record('quiz_slots', array('quizid' => $quiz->id, 'id' => $id)))) {
                    throw new moodle_exception('AJAX commands.php: Bad slot ID ' . $id);
                }
                $structure->remove_slot($quiz, $slot->slot);
                quiz_delete_previews($quiz);
                quiz_update_sumgrades($quiz);
                echo json_encode(array('newsummarks' => quiz_format_grade($quiz, $quiz->sumgrades), 'deleted' => true, 'newnumquestions' => $structure->get_question_count()));
                break;
        }
        break;
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:31,代码来源:edit_rest.php

示例6: ceil

        $bands = $bands * 5;
    } else {
        if ($bands <= 10) {
            $bands = $bands * 2;
        }
    }
}
$bandwidth = $quiz->grade / $bands;
$bands = ceil($bands);
$bandlabels = array();
for ($i = 0; $i < $quiz->grade; $i += $bandwidth) {
    $label = quiz_format_grade($quiz, $i) . ' - ';
    if ($quiz->grade > $i + $bandwidth) {
        $label .= quiz_format_grade($quiz, $i + $bandwidth);
    } else {
        $label .= quiz_format_grade($quiz, $quiz->grade);
    }
    $bandlabels[] = $label;
}
$line->x_data = $bandlabels;
$line->y_format['allusers'] = array('colour' => 'red', 'bar' => 'fill', 'shadow_offset' => 1, 'legend' => get_string('allparticipants'));
$line->y_data['allusers'] = quiz_report_grade_bands($bandwidth, $bands, $quizid, $groupusers);
$line->y_order = array('allusers');
$line->parameter['y_min_left'] = 0;
// start at 0
$line->parameter['y_max_left'] = max($line->y_data['allusers']);
$line->parameter['y_decimal_left'] = 0;
// 2 decimal places for y axis.
//pick a sensible number of gridlines depending on max value on graph.
$gridlines = max($line->y_data['allusers']);
while ($gridlines >= 10) {
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:overviewgraph.php

示例7: display


//.........这里部分代码省略.........
                 $where = 'qa.id IS NOT NULL AND qa.preview = 0';
                 break;
             case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH:
                 // Show only students with attempts
                 list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000');
                 $params += $allowed_params;
                 $where = "u.id {$allowed_usql} AND qa.preview = 0 AND qa.id IS NOT NULL";
                 break;
             case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO:
                 // Show only students without attempts
                 list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000');
                 $params += $allowed_params;
                 $where = "u.id {$allowed_usql} AND qa.id IS NULL";
                 break;
             case QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS:
                 // Show all students with or without attempts
                 list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000');
                 $params += $allowed_params;
                 $where = "u.id {$allowed_usql} AND (qa.preview = 0 OR qa.preview IS NULL)";
                 break;
         }
         $table->set_count_sql("SELECT COUNT(1) FROM {$from} WHERE {$where}", $params);
         $table->set_sql($fields, $from, $where, $params);
         // Define table columns
         $columns = array();
         $headers = array();
         if (!$table->is_downloading() && $candelete) {
             $columns[] = 'checkbox';
             $headers[] = NULL;
         }
         if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
             $columns[] = 'picture';
             $headers[] = '';
         }
         if (!$table->is_downloading()) {
             $columns[] = 'fullname';
             $headers[] = get_string('name');
         } else {
             $columns[] = 'lastname';
             $headers[] = get_string('lastname');
             $columns[] = 'firstname';
             $headers[] = get_string('firstname');
         }
         if ($CFG->grade_report_showuseridnumber) {
             $columns[] = 'idnumber';
             $headers[] = get_string('idnumber');
         }
         if ($table->is_downloading()) {
             $columns[] = 'institution';
             $headers[] = get_string('institution');
             $columns[] = 'department';
             $headers[] = get_string('department');
             $columns[] = 'email';
             $headers[] = get_string('email');
             $columns[] = 'timestart';
             $headers[] = get_string('startedon', 'quiz');
             $columns[] = 'timefinish';
             $headers[] = get_string('timecompleted', 'quiz');
             $columns[] = 'duration';
             $headers[] = get_string('attemptduration', 'quiz');
         }
         if ($showgrades) {
             $columns[] = 'sumgrades';
             $headers[] = get_string('grade', 'quiz') . '/' . quiz_format_grade($quiz, $quiz->grade);
         }
         if ($hasfeedback) {
             $columns[] = 'feedbacktext';
             $headers[] = get_string('feedback', 'quiz');
         }
         // we want to display responses for all questions
         foreach ($questions as $id => $question) {
             // Ignore questions of zero length
             $columns[] = 'qsanswer' . $id;
             $headers[] = '#' . $question->number;
             $question->formattedname = strip_tags(format_string($question->name));
         }
         // Load the question type specific information
         if (!get_question_options($questions)) {
             print_error('cannotloadoptions', 'quiz_responses');
         }
         $table->define_columns($columns);
         $table->define_headers($headers);
         $table->sortable(true, 'concattedid');
         // Set up the table
         $table->define_baseurl($reporturl->out(false, $displayoptions));
         $table->collapsible(true);
         $table->column_suppress('picture');
         $table->column_suppress('fullname');
         $table->column_suppress('idnumber');
         $table->no_sorting('feedbacktext');
         $table->column_class('picture', 'picture');
         $table->column_class('lastname', 'bold');
         $table->column_class('firstname', 'bold');
         $table->column_class('fullname', 'bold');
         $table->column_class('sumgrades', 'bold');
         $table->set_attribute('id', 'attempts');
         $table->out($pagesize, true);
     }
     return true;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:report.php

示例8: formatted_quiz_grade

 /**
  * Get the overall quiz grade formatted for display.
  * @return string the maximum grade for this quiz.
  */
 public function formatted_quiz_grade()
 {
     return quiz_format_grade($this->get_quiz(), $this->get_quiz()->grade);
 }
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:8,代码来源:structure.php

示例9: grade_by_category

 public function grade_by_category($uniqueattemptid, $catid)
 {
     $qcount = 0;
     $totalpossiblemark = 0;
     $totalactualmark = 0;
     foreach ($this->lateststeps[$uniqueattemptid] as $lateststep) {
         if (isset($this->qidtocatidhash[$lateststep->questionid])) {
             if ($this->qidtocatidhash[$lateststep->questionid] == $catid) {
                 $totalpossiblemark += $lateststep->maxmark;
                 $totalactualmark += $lateststep->fraction * $lateststep->maxmark;
                 $qcount++;
             }
         }
     }
     if ($totalpossiblemark > 0) {
         $grade = quiz_format_grade($this->quiz, $totalactualmark / $totalpossiblemark * 100);
     } else {
         $grade = '--';
     }
     return "{$grade} ({$qcount})";
 }
开发者ID:advancingdesign,项目名称:moodle-mod_quiz_accessrule_gradebycategory,代码行数:21,代码来源:gradebycatcalculator.php

示例10: ceil

            $bands /= 2;
        }
    }
    if ($bands < 4) {
        $bands *= 5;
    } else {
        if ($bands <= 10) {
            $bands *= 2;
        }
    }
}
$bands = ceil($bands);
$bandwidth = $quiz->grade / $bands;
$bandlabels = array();
for ($i = 1; $i <= $bands; $i++) {
    $bandlabels[] = quiz_format_grade($quiz, ($i - 1) * $bandwidth) . ' - ' . quiz_format_grade($quiz, $i * $bandwidth);
}
$line->x_data = $bandlabels;
$line->y_format['allusers'] = array('colour' => 'red', 'bar' => 'fill', 'shadow_offset' => 1, 'legend' => get_string('allparticipants'));
$line->y_data['allusers'] = quiz_report_grade_bands($bandwidth, $bands, $quizid, $groupusers);
$line->y_order = array('allusers');
$ymax = max($line->y_data['allusers']);
$line->parameter['y_min_left'] = 0;
// start at 0
$line->parameter['y_max_left'] = $ymax;
$line->parameter['y_decimal_left'] = 0;
// 2 decimal places for y axis.
//pick a sensible number of gridlines depending on max value on graph.
$gridlines = $ymax;
while ($gridlines >= 10) {
    if ($gridlines >= 50) {
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:overviewgraph.php

示例11: display


//.........这里部分代码省略.........
            }

            if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
                $columns[]= 'picture';
                $headers[]= '';
            }
            if (!$table->is_downloading()) {
                $columns[]= 'fullname';
                $headers[]= get_string('name');
             } else {
                $columns[]= 'lastname';
                $headers[]= get_string('lastname');
                $columns[]= 'firstname';
                $headers[]= get_string('firstname');
             }

            if ($CFG->grade_report_showuseridnumber) {
                $columns[]= 'idnumber';
                $headers[]= get_string('idnumber');
            }

            $columns[]= 'timestart';
            $headers[]= get_string('startedon', 'quiz');

            $columns[]= 'timefinish';
            $headers[]= get_string('timecompleted','quiz');

            $columns[]= 'duration';
            $headers[]= get_string('attemptduration', 'quiz');

            if ($detailedmarks) {
                foreach ($questions as $id => $question) {
                    // Ignore questions of zero length
                    $columns[] = 'qsgrade'.$id;
                    $header = '#'.$question->number;
                    if (!$table->is_downloading()) {
                        $header .='<br />';
                    } else {
                        $header .=' ';
                    }
                    $header .='--/'.quiz_rescale_grade($question->maxgrade, $quiz, 'question');
                    $headers[] = $header;
                    $question->formattedname = strip_tags(format_string($question->name));
                }
            }
            if (!$table->is_downloading() && has_capability('mod/quiz:regrade', $this->context) && $regradedattempts) {
                $columns[] = 'regraded';
                $headers[] = get_string('regrade', 'quiz_overview');
            }
            if ($showgrades) {
                $columns[] = 'sumgrades';
                $headers[] = get_string('grade', 'quiz').'/'.quiz_format_grade($quiz, $quiz->grade);
             }

            if ($hasfeedback) {
                $columns[] = 'feedbacktext';
                $headers[] = get_string('feedback', 'quiz');
             }

            $table->define_columns($columns);
            $table->define_headers($headers);
            $table->sortable(true, 'uniqueid');

            // Set up the table
            $table->define_baseurl($reporturl->out(true, $displayoptions));

            $table->collapsible(true);

            $table->no_sorting('feedbacktext');

            $table->column_class('picture', 'picture');
            $table->column_class('lastname', 'bold');
            $table->column_class('firstname', 'bold');
            $table->column_class('fullname', 'bold');
            $table->column_class('sumgrades', 'bold');

            $table->set_attribute('id', 'attempts');

            $table->out($pagesize, true);
        }
        if (!$table->is_downloading() && $showgrades) {
            if ($currentgroup && $groupstudents) {
                list($usql, $params) = $DB->get_in_or_equal($groupstudents);
                $params[] = $quiz->id;
                if ($DB->record_exists_select('quiz_grades', "userid $usql AND quiz = ?", $params)) {
                     $imageurl = "{$CFG->wwwroot}/mod/quiz/report/overview/overviewgraph.php?id={$quiz->id}&amp;groupid=$currentgroup";
                     $graphname = get_string('overviewreportgraphgroup', 'quiz_overview', groups_get_group_name($currentgroup));
                     echo $OUTPUT->heading($graphname);
                     echo '<div class="graph"><img src="'.$imageurl.'" alt="'.$graphname.'" /></div>';
                }
            }
            if ($DB->record_exists('quiz_grades', array('quiz'=> $quiz->id))) {
                 $graphname = get_string('overviewreportgraph', 'quiz_overview');
                 $imageurl = $CFG->wwwroot.'/mod/quiz/report/overview/overviewgraph.php?id='.$quiz->id;
                 echo $OUTPUT->heading($graphname);
                 echo '<div class="graph"><img src="'.$imageurl.'" alt="'.$graphname.'" /></div>';
            }
        }
        return true;
    }
开发者ID:nuckey,项目名称:moodle,代码行数:101,代码来源:report.php

示例12: total_marks

 /**
  * Render the total marks available for the quiz.
  *
  * @param \stdClass $quiz the quiz settings from the database.
  * @return string HTML to output.
  */
 public function total_marks($quiz)
 {
     $totalmark = html_writer::span(quiz_format_grade($quiz, $quiz->sumgrades), 'mod_quiz_summarks');
     return html_writer::tag('span', get_string('totalmarksx', 'quiz', $totalmark), array('class' => 'totalpoints'));
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:11,代码来源:edit_renderer.php

示例13: quiz_report_scale_sumgrades_as_percentage

function quiz_report_scale_sumgrades_as_percentage($rawgrade, $quiz, $round = true)
{
    if ($quiz->sumgrades != 0) {
        $grade = $rawgrade * 100 / $quiz->sumgrades;
        if ($round) {
            $grade = quiz_format_grade($quiz, $grade);
        }
    } else {
        return '';
    }
    return $grade . '%';
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:12,代码来源:reportlib.php

示例14: view_table

 /**
  * Generates the table of data
  *
  * @param array $quiz Array contining quiz data
  * @param int $context The page context ID
  * @param mod_quiz_view_object $viewobj
  */
 public function view_table($quiz, $context, $viewobj)
 {
     // Most of the following code is unfortunately a duplicate of the existing renderer. There was no way to reuse the existing
     // code and add the extra columns we wanted so I had to duplicate it.
     // New parts of the code are marked with a comment // Grade by category code start. and // Grade by category code end.
     global $DB;
     // Grade by category code start.
     // If gradebycategory setting is not on then just use the existing renderer.
     if (!$quiz->gradebycategory) {
         return parent::view_table($quiz, $context, $viewobj);
     }
     // Grade by category code end.
     if (!$viewobj->attempts) {
         return '';
     }
     // Prepare table header.
     $table = new html_table();
     $table->attributes['class'] = 'generaltable quizattemptsummary';
     $table->head = array();
     $table->align = array();
     $table->size = array();
     if ($viewobj->attemptcolumn) {
         $table->head[] = get_string('attemptnumber', 'quiz');
         $table->align[] = 'center';
         $table->size[] = '';
     }
     $table->head[] = get_string('attemptstate', 'quiz');
     $table->align[] = 'left';
     $table->size[] = '';
     if ($viewobj->markcolumn) {
         $table->head[] = get_string('marks', 'quiz') . ' / ' . quiz_format_grade($quiz, $quiz->sumgrades);
         $table->align[] = 'center';
         $table->size[] = '';
     }
     if ($viewobj->gradecolumn) {
         $table->head[] = get_string('grade') . ' / ' . quiz_format_grade($quiz, $quiz->grade);
         $table->align[] = 'center';
         $table->size[] = '';
     }
     // Grade by category code start.
     $catgrades = new quizaccess_gradebycategory_calculator($quiz);
     // $this->lateststeps may or may not already have been loaded depending if the reoprt
     // is set to show question grades.
     $catgrades->load_latest_steps($viewobj->attempts);
     $categorynames = $catgrades->load_cat_data();
     // Output column headings for category averages
     foreach ($categorynames as $catname) {
         $table->head[] = $catname . ' / ' . quiz_format_grade($quiz, 100);
         $table->align[] = 'center';
         $table->size[] = '';
     }
     // Grade by category code end.
     if ($viewobj->canreviewmine) {
         $table->head[] = get_string('review', 'quiz');
         $table->align[] = 'center';
         $table->size[] = '';
     }
     if ($viewobj->feedbackcolumn) {
         $table->head[] = get_string('feedback', 'quiz');
         $table->align[] = 'left';
         $table->size[] = '';
     }
     // One row for each attempt.
     foreach ($viewobj->attemptobjs as $attemptobj) {
         $attemptoptions = $attemptobj->get_display_options(true);
         $row = array();
         // Add the attempt number.
         if ($viewobj->attemptcolumn) {
             if ($attemptobj->is_preview()) {
                 $row[] = get_string('preview', 'quiz');
             } else {
                 $row[] = $attemptobj->get_attempt_number();
             }
         }
         $row[] = $this->attempt_state($attemptobj);
         if ($viewobj->markcolumn) {
             if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX && $attemptobj->is_finished()) {
                 $row[] = quiz_format_grade($quiz, $attemptobj->get_sum_marks());
             } else {
                 $row[] = '';
             }
         }
         // Outside the if because we may be showing feedback but not grades.
         $attemptgrade = quiz_rescale_grade($attemptobj->get_sum_marks(), $quiz, false);
         if ($viewobj->gradecolumn) {
             if ($attemptoptions->marks >= question_display_options::MARK_AND_MAX && $attemptobj->is_finished()) {
                 // Highlight the highest grade if appropriate.
                 if ($viewobj->overallstats && !$attemptobj->is_preview() && $viewobj->numattempts > 1 && !is_null($viewobj->mygrade) && $attemptgrade == $viewobj->mygrade && $quiz->grademethod == QUIZ_GRADEHIGHEST) {
                     $table->rowclasses[$attemptobj->get_attempt_number()] = 'bestrow';
                 }
                 $row[] = quiz_format_grade($quiz, $attemptgrade);
             } else {
                 $row[] = '';
//.........这里部分代码省略.........
开发者ID:advancingdesign,项目名称:moodle-mod_quiz_accessrule_gradebycategory,代码行数:101,代码来源:mod_quiz_renderer.php

示例15: format_average

 /**
  * Format an entry in an average row.
  * @param object $record with fields grade and numaveraged
  */
 protected function format_average($record, $question = false)
 {
     if (is_null($record->grade)) {
         $average = '-';
     } else {
         if ($question) {
             $average = quiz_format_question_grade($this->quiz, $record->grade);
         } else {
             $average = quiz_format_grade($this->quiz, $record->grade);
         }
     }
     if ($this->download) {
         return $average;
     } else {
         if (is_null($record->numaveraged) || $record->numaveraged == 0) {
             return html_writer::tag('span', html_writer::tag('span', $average, array('class' => 'average')), array('class' => 'avgcell'));
         } else {
             return html_writer::tag('span', html_writer::tag('span', $average, array('class' => 'average')) . ' ' . html_writer::tag('span', '(' . $record->numaveraged . ')', array('class' => 'count')), array('class' => 'avgcell'));
         }
     }
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:25,代码来源:overview_table.php


注:本文中的quiz_format_grade函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。