本文整理汇总了PHP中make_grades_menu函数的典型用法代码示例。如果您正苦于以下问题:PHP make_grades_menu函数的具体用法?PHP make_grades_menu怎么用?PHP make_grades_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_grades_menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition_inner
/**
* Define the elements to be displayed at the form
*
* Called by the parent::definition()
*
* @return void
*/
protected function definition_inner(&$mform)
{
$fields = $this->_customdata['fields'];
$current = $this->_customdata['current'];
$nodims = $this->_customdata['nodims'];
// number of assessment dimensions
$mform->addElement('hidden', 'nodims', $nodims);
$mform->setType('nodims', PARAM_INT);
for ($i = 0; $i < $nodims; $i++) {
// dimension header
$dimtitle = get_string('dimensionnumber', 'workshopform_accumulative', $i + 1);
$mform->addElement('header', 'dimensionhdr__idx_' . $i, $dimtitle);
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_' . $i, $fields->{'dimensionid__idx_' . $i});
$mform->setType('dimensionid__idx_' . $i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_' . $i);
// value set by set_data() later
$mform->setType('gradeid__idx_' . $i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_' . $fields->{'dimensionid__idx_' . $i} . '_desc" class="fitem description accumulative">' . "\n";
$desc .= format_text($fields->{'description__idx_' . $i}, $fields->{'description__idx_' . $i . 'format'});
$desc .= "\n</div>";
$mform->addElement('html', $desc);
// grade for this aspect
$label = get_string('dimensiongrade', 'workshopform_accumulative');
$options = make_grades_menu($fields->{'grade__idx_' . $i});
$mform->addElement('select', 'grade__idx_' . $i, $label, $options);
// comment
$label = get_string('dimensioncomment', 'workshopform_accumulative');
//$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0));
$mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5));
}
$this->set_data($current);
}
示例2: definition
/**
* Defines the elements of the form used to mark a quiz submission.
*/
public function definition()
{
global $OUTPUT;
$mform =& $this->_form;
$mform->addElement('hidden', 'attemptid');
$mform->setType('attemptid', PARAM_INT);
$mform->addElement('hidden', 'questionid');
$mform->setType('questionid', PARAM_INT);
$mform->addElement('hidden', 'sesskey', sesskey());
$mform->setType('sesskey', PARAM_ALPHANUM);
$mform->addElement('static', 'picture', $OUTPUT->user_picture($this->_customdata->user), fullname($this->_customdata->user, true) . '<br/>' . userdate($this->_customdata->submission->timemodified) . $this->_customdata->lateness);
// Now come multiple (possibly) question comment fields.
// Use $attemptobj->get_questions($arrayofquestionis) for this.
foreach ($this->_customdata->questions as $questionid => $question) {
$mform->addElement('header', 'question' . $questionid, get_string('question', 'modulename'));
// Display question text.
// Display user's answer.
// Display comment form.
$mform->addElement('editor', 'comment[' . $questionid . ']', get_string('comment', 'quiz') . ':', null, $this->get_editor_options());
// Display grade selector.
$grademenu = make_grades_menu($question->grade);
$grademenu['-1'] = get_string('nograde');
// TODO broken!
$attributes = array();
$mform->addElement('select', 'grade[' . $questionid . ']', get_string('grade') . ':', $grademenu, $attributes);
// TODO set default to existing grade?
$mform->setDefault('grade[' . $questionid . ']', -1);
}
}
示例3: definition
function definition()
{
$mform =& $this->_form;
$qcreate = $this->_customdata['qcreate'];
if ($qcreate->graderatio != 100) {
//--------------------------------------------------------------------------------
$mform->addElement('header', 'exportselection', get_string('exportselection', 'qcreate'));
$menu = make_grades_menu($qcreate->grade);
unset($menu[0]);
$menu += array(0 => get_string('allquestions', 'qcreate'));
$mform->addElement('select', 'betterthangrade', get_string('betterthangrade', 'qcreate'), $menu);
$mform->setDefault('betterthangrade', 0);
}
$mform->addElement('header', 'exportnaming', get_string('exportnaming', 'qcreate'));
$cbarray3 = array();
$cbarray3[] =& MoodleQuickForm::createElement('checkbox', 'naming[other]', '', get_string('specifictext', 'qcreate'));
$cbarray3[] =& MoodleQuickForm::createElement('text', 'naming[othertext]');
$mform->addGroup($cbarray3, 'naming3', '', array(' '), false);
$mform->disabledIf('naming3', 'naming[other]');
$cbarray1 = array();
$cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[firstname]', '', get_string('firstname'));
$cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[lastname]', '', get_string('lastname'));
$cbarray1[] =& MoodleQuickForm::createElement('checkbox', 'naming[username]', '', get_string('username', 'qcreate'));
$mform->addGroup($cbarray1, 'naming1', '', array(' '), false);
$cbarray2 = array();
$cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[activityname]', '', get_string('activityname', 'qcreate'));
$cbarray2[] =& MoodleQuickForm::createElement('checkbox', 'naming[timecreated]', '', get_string('timecreated', 'qcreate'));
$mform->addGroup($cbarray2, 'naming2', '', array(' '), false);
parent::definition();
}
示例4: journal_user_complete_index
function journal_user_complete_index($course, $user, $journal, $journalopen, $heading)
{
/// Prints a journal, entry and feedback ... used on the journal index page.
if (isteacher($course->id)) {
$entrycount = journal_count_entries($journal, get_current_group($course->id));
$entryinfo = " (<a href=\"report.php?id={$journal->coursemodule}\">" . get_string("viewallentries", "journal", $entrycount) . "</a>)";
} else {
$entryinfo = "";
}
$journal->name = "<a href=\"view.php?id={$journal->coursemodule}\">" . format_string($journal->name, true) . "</a>";
if ($heading) {
echo "<h3>{$heading} - {$journal->name}{$entryinfo}</h3>";
} else {
echo "<h3>{$journal->name}{$entryinfo}</h3>";
}
print_simple_box_start("left", "90%");
echo format_text($journal->intro, $journal->introformat);
print_simple_box_end();
echo "<br clear=\"all\" />";
echo "<br />";
if (isstudent($course->id) or isteacher($course->id)) {
print_simple_box_start("right", "90%");
if ($journalopen) {
echo "<p align=\"right\"><a href=\"edit.php?id={$journal->coursemodule}\">";
echo get_string("edit") . "</a></p>";
} else {
echo "<p align=\"right\"><a href=\"view.php?id={$journal->coursemodule}\">";
echo get_string("view") . "</a></p>";
}
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
if ($entry->modified) {
echo "<p align=\"center\"><font size=\"1\">" . get_string("lastedited") . ": " . userdate($entry->modified) . "</font></p>";
}
if ($entry->text) {
echo format_text($entry->text, $entry->format);
}
if ($entry->teacher) {
$grades = make_grades_menu($journal->assessed);
journal_print_feedback($course, $entry, $grades);
}
} else {
print_string("noentry", "journal");
}
print_simple_box_end();
echo "<br clear=\"all\" />";
echo "<br />";
}
}
示例5: definition
/**
* Define the form - called by parent constructor
*/
function definition()
{
global $CFG;
$mform = $this->_form;
list($geogebra, $data, $params) = $this->_customdata;
// visible elements
$this->geogebra = $geogebra;
$attemptelement = $mform->addElement('text', 'attempt', get_string('attempt', 'geogebra'), array('style' => 'border:none'));
$mform->setType('attempt', PARAM_TEXT);
$attemptelement->freeze();
$durationelement = $mform->addElement('text', 'duration', get_string('duration', 'geogebra'), array('style' => 'border:none'));
$mform->setType('duration', PARAM_TEXT);
$durationelement->freeze();
if ($geogebra->grade > 0) {
$gradingelement = $mform->addElement('text', 'grade', get_string('grade', 'geogebra'));
$mform->setType('grade', PARAM_TEXT);
} else {
$grademenu = make_grades_menu($geogebra->grade);
if (count($grademenu) > 0) {
$grademenu = array(RATING_UNSET_RATING => get_string('rate', 'rating') . '...') + $grademenu;
$gradingelement = $mform->addElement('select', 'grade', get_string('grade') . ':', $grademenu);
// The grade is already formatted with format_float so it needs to be converted back to an integer.
if (!empty($data->grade)) {
$data->grade = (int) unformat_float($data->grade);
}
$mform->setType('grade', PARAM_INT);
}
}
$mform->addElement('editor', 'comment_editor', get_string('comment', 'geogebra'), null, null);
$mform->setType('comment_editor', PARAM_RAW);
// Hidden parameters
$mform->addElement('hidden', 'id', $data->id);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'student', $data->student);
$mform->setType('student', PARAM_INT);
$mform->addElement('hidden', 'attemptid', $data->attemptid);
$mform->setType('attemptid', PARAM_INT);
$mform->addElement('hidden', 'action', 'submitgrade');
$mform->setType('action', PARAM_ALPHA);
// Buttons
$this->add_action_buttons(true, get_string('savechanges', 'assign'));
$mform->closeHeaderBefore('buttonar');
if ($data) {
$this->set_data($data);
}
}
示例6: add_grades_section
protected function add_grades_section()
{
global $CFG;
$mform = $this->_form;
$mform->addElement('header', 'Grades', get_string('grades', 'grades'));
$grademenu = make_grades_menu($this->_customdata['gradesetting']);
$mform->addElement('select', 'xgrade', get_string('grade') . ':', $grademenu);
$mform->setType('xgrade', PARAM_INT);
$course = $this->_customdata['course'];
$context = context_course::instance($course->id);
if (has_capability('gradereport/grader:view', $context) && has_capability('moodle/grade:viewall', $context)) {
$grade = '<a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '" >' . $this->_customdata['str_grade'] . '</a>';
} else {
$grade = $this->_customdata['str_grade'];
}
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assignment') . ':', $grade);
$mform->setType('finalgrade', PARAM_INT);
}
示例7: definition_inner
/**
* Define the elements to be displayed at the form
*
* Called by the parent::definition()
*
* @return void
*/
protected function definition_inner(&$mform)
{
$fields = $this->_customdata['fields'];
$current = $this->_customdata['current'];
$nodims = $this->_customdata['nodims'];
// number of assessment dimensions
$mform->addElement('hidden', 'nodims', $nodims);
$mform->setType('nodims', PARAM_INT);
// minimal grade value to select - used by the 'compare' rule below
// (just an implementation detail to make the rule work, this element is
// not processed by the server)
$mform->addElement('hidden', 'minusone', -1);
$mform->setType('minusone', PARAM_INT);
for ($i = 0; $i < $nodims; $i++) {
// dimension header
$dimtitle = get_string('dimensionnumber', 'workshopform_accumulative', $i + 1);
$mform->addElement('header', 'dimensionhdr__idx_' . $i, $dimtitle);
// dimension id
$mform->addElement('hidden', 'dimensionid__idx_' . $i, $fields->{'dimensionid__idx_' . $i});
$mform->setType('dimensionid__idx_' . $i, PARAM_INT);
// grade id
$mform->addElement('hidden', 'gradeid__idx_' . $i);
// value set by set_data() later
$mform->setType('gradeid__idx_' . $i, PARAM_INT);
// dimension description
$desc = '<div id="id_dim_' . $fields->{'dimensionid__idx_' . $i} . '_desc" class="fitem description accumulative">' . "\n";
$desc .= format_text($fields->{'description__idx_' . $i}, $fields->{'description__idx_' . $i . 'format'});
$desc .= "\n</div>";
$mform->addElement('html', $desc);
// grade for this aspect
$label = get_string('dimensiongrade', 'workshopform_accumulative');
$options = make_grades_menu($fields->{'grade__idx_' . $i});
$options = array('-1' => get_string('choosedots')) + $options;
$mform->addElement('select', 'grade__idx_' . $i, $label, $options);
$mform->addRule(array('grade__idx_' . $i, 'minusone'), get_string('mustchoosegrade', 'workshopform_accumulative'), 'compare', 'gt');
// comment
$label = get_string('dimensioncomment', 'workshopform_accumulative');
//$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0));
$mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5));
}
$this->set_data($current);
}
示例8: make_grades_menu
/**
* Wrapper for Moodle function that caches result, so can be called
* without worry of a performance impact.
* @param int $gradingtype Grading type value
* @return array Array from value=>name
*/
public static function make_grades_menu($gradingtype)
{
if (!array_key_exists($gradingtype, self::$scales)) {
self::$scales[$gradingtype] = make_grades_menu($gradingtype);
}
return self::$scales[$gradingtype];
}
示例9: get_min_max_score
/**
* Calculates and returns the possible minimum and maximum score (in points) for this guide
*
* @return array
*/
public function get_min_max_score()
{
if (!$this->is_form_available()) {
return null;
}
$returnvalue = array('minscore' => 0, 'maxscore' => 0);
$maxscore = 0;
foreach ($this->get_definition()->guide_criteria as $id => $criterion) {
$maxscore += $criterion['maxscore'];
}
$returnvalue['maxscore'] = $maxscore;
$returnvalue['minscore'] = 0;
if (!empty($this->moduleinstance->grade)) {
$graderange = make_grades_menu($this->moduleinstance->grade);
$returnvalue['modulegrade'] = count($graderange) - 1;
}
return $returnvalue;
}
示例10: taoview_print_artefacts
function taoview_print_artefacts($artefacts, $viewtype, $tagfilter, $userfilter, $sort, $page, $perpage)
{
global $CFG, $USER;
//get scale
$scale = get_record("scale", "name", 'TAO: Stars');
$artefacts = taoview_get_paginated_results($artefacts, $page, $perpage);
foreach ($artefacts as $artefact) {
if ($perpage <= 0) {
//not a great way to paginate.
break;
}
echo '<div class="taoview">';
if (!empty($artefact['thumbnail'])) {
echo '<div class="taoview-thumb"><img src="' . $artefact['thumbnail'] . '"></div>';
}
echo '<div class="taoview-download"><a href="' . $artefact['download'] . '" target="_blank">' . $artefact['name'] . '</a></div>';
if (!empty($artefact['uploader'])) {
$user = get_record('user', 'username', $artefact['uploader']);
if (!empty($user)) {
echo '<div class="taoview-user">' . get_string('submittedby', 'local') . ': <a href="' . $CFG->wwwroot . '/local/mahara/taoview' . $viewtype . '.php?tag=' . $tagfilter . '&filteruser=' . $artefact['uploader'] . '&sort=' . $sort . '">' . fullname($user) . '</a></div>';
}
}
if (!empty($artefact['ctime'])) {
echo '<div class="taoview-date">' . $artefact['ctime'] . '</div>';
}
if (!empty($artefact['description'])) {
echo '<div class="taoview-desc">' . $artefact['description'] . '</div>';
}
if (!empty($artefact['tags']) && is_array($artefact['tags'])) {
echo '<div class="taoview-tags">' . get_string('tags') . ': ';
foreach ($artefact['tags'] as $tag) {
echo '<a href="' . $CFG->wwwroot . '/local/mahara/taoview' . $viewtype . '.php?tag=' . $tag . '&sort=' . $sort . '">' . $tag . '</a>, ';
}
echo '</div>';
}
//now do ratings stuff
echo '<div class="ratings">';
$possiblevalues = make_grades_menu(-$scale->id);
echo '<span class="taoviewratingtext">';
tao_print_ratings($artefact['id'], $possiblevalues);
echo '</span>';
if (!empty($user) && $user->id != $USER->id && !isguest()) {
tao_print_rating_menu($artefact['id'], $USER->id, $possiblevalues);
}
echo '</div>';
//end of ratings stuff
if (!empty($artefact['page'])) {
echo '<div class="taoview-page"><a href="' . $artefact['page'] . '">' . get_string('moreinfo', 'local') . '</a></div>';
}
echo '</div>';
$perpage--;
}
if (!empty($artefacts) && !isguest()) {
echo "<div class=\"boxaligncenter\"><input id=\"taoviewratingsubmit\" type=\"submit\" value=\"" . get_string("sendinratings", "local") . "\" />";
if (ajaxenabled()) {
/// AJAX enabled, standard submission form
$rate_ajax_config_settings = array("pixpath" => $CFG->pixpath, "wwwroot" => $CFG->wwwroot, "sesskey" => sesskey());
echo "<script type=\"text/javascript\">//<![CDATA[\n" . "var rate_ajax_config = " . json_encode($rate_ajax_config_settings) . ";\n" . "init_rate_ajax();\n" . "//]]></script>\n";
}
//print_scale_menu_helpbutton(SITEID, $scale); //no help file written yet.
echo "</div>";
}
}
示例11: error
error("You do not have the capability to view post ratings");
}
if (!has_capability('mod/forum:viewanyrating', $context) and $USER->id != $post->userid) {
error("You can only look at results for posts that you made");
}
switch ($sort) {
case 'firstname':
$sqlsort = "u.firstname ASC";
break;
case 'rating':
$sqlsort = "r.rating ASC";
break;
default:
$sqlsort = "r.time ASC";
}
$scalemenu = make_grades_menu($forum->scale);
$strratings = get_string('ratings', 'forum');
$strrating = get_string('rating', 'forum');
$strname = get_string('name');
$strtime = get_string('time');
print_header("{$strratings}: " . format_string($post->subject));
if (!($ratings = forum_get_ratings($post->id, $sqlsort))) {
error("No ratings for this post: \"" . format_string($post->subject) . "\"");
} else {
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" style=\"width:100%\">";
echo "<tr>";
echo "<th class=\"header\" scope=\"col\"> </th>";
echo "<th class=\"header\" scope=\"col\"><a href=\"report.php?id={$post->id}&sort=firstname\">{$strname}</a></th>";
echo "<th class=\"header\" scope=\"col\" style=\"width:100%\"><a href=\"report.php?id={$post->id}&sort=rating\">{$strrating}</a></th>";
echo "<th class=\"header\" scope=\"col\"><a href=\"report.php?id={$post->id}&sort=time\">{$strtime}</a></th>";
echo "</tr>";
示例12: display_submissions
//.........这里部分代码省略.........
$table->column_class('outcome', 'outcome');
}
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'submissions');
$table->set_attribute('width', '100%');
//$table->set_attribute('align', 'center');
$table->no_sorting('finalgrade');
$table->no_sorting('outcome');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
if (empty($users)) {
echo $OUTPUT->heading(get_string('nosubmitusers', 'assignment'));
return true;
}
/// Construct the SQL
if ($where = $table->get_sql_where()) {
$where .= ' AND ';
}
if ($sort = $table->get_sql_sort()) {
$sort = ' ORDER BY ' . $sort;
}
$select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt,
s.id AS submissionid, s.grade, s.submissioncomment,
s.timemodified, s.timemarked,
COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
$sql = 'FROM {user} u ' . 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid
AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
$table->pagesize($perpage, count($users));
///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
$offset = $page * $perpage;
$strupdate = get_string('update');
$strgrade = get_string('grade');
$grademenu = make_grades_menu($this->assignment->grade);
if (($ausers = $DB->get_records_sql($select . $sql . $sort, null, $table->get_page_start(), $table->get_page_size())) !== false) {
$grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
foreach ($ausers as $auser) {
$final_grade = $grading_info->items[0]->grades[$auser->id];
$grademax = $grading_info->items[0]->grademax;
$final_grade->formatted_grade = round($final_grade->grade, 2) . ' / ' . round($grademax, 2);
$locked_overridden = 'locked';
if ($final_grade->overridden) {
$locked_overridden = 'overridden';
}
/// Calculate user status
$auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified;
$picture = $OUTPUT->user_picture(moodle_user_picture::make($auser, $course->id));
if (empty($auser->submissionid)) {
$auser->grade = -1;
//no submission yet
}
if (!empty($auser->submissionid)) {
///Prints student answer and student modified date
///attach file or print link to student answer, depending on the type of the assignment.
///Refer to print_student_answer in inherited classes.
if ($auser->timemodified > 0) {
$studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>';
} else {
$studentmodified = '<div id="ts' . $auser->id . '"> </div>';
}
///Print grade, dropdown or text
if ($auser->timemarked > 0) {
$teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
if ($final_grade->locked or $final_grade->overridden) {
$grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
} else {
示例13: add_grades_section
function add_grades_section() {
global $CFG;
$mform =& $this->_form;
$attributes = array();
if ($this->_customdata->gradingdisabled) {
$attributes['disabled'] ='disabled';
}
$grademenu = make_grades_menu($this->_customdata->assignment->grade);
$grademenu['-1'] = get_string('nograde');
$mform->addElement('header', 'Grades', get_string('grades', 'grades'));
$mform->addElement('select', 'xgrade', get_string('grade').':', $grademenu, $attributes);
$mform->setDefault('xgrade', $this->_customdata->submission->grade ); //@fixme some bug when element called 'grade' makes it break
$mform->setType('xgrade', PARAM_INT);
if (!empty($this->_customdata->enableoutcomes)) {
foreach($this->_customdata->grading_info->outcomes as $n=>$outcome) {
$options = make_grades_menu(-$outcome->scaleid);
if ($outcome->grades[$this->_customdata->submission->userid]->locked) {
$options[0] = get_string('nooutcome', 'grades');
echo $options[$outcome->grades[$this->_customdata->submission->userid]->grade];
} else {
$options[''] = get_string('nooutcome', 'grades');
$attributes = array('id' => 'menuoutcome_'.$n );
$mform->addElement('select', 'outcome_'.$n.'['.$this->_customdata->userid.']', $outcome->name.':', $options, $attributes );
$mform->setType('outcome_'.$n.'['.$this->_customdata->userid.']', PARAM_INT);
$mform->setDefault('outcome_'.$n.'['.$this->_customdata->userid.']', $outcome->grades[$this->_customdata->submission->userid]->grade );
}
}
}
$course_context = get_context_instance(CONTEXT_MODULE , $this->_customdata->cm->id);
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
$grade = '<a href="'.$CFG->wwwroot.'/grade/report/grader/index.php?id='. $this->_customdata->courseid .'" >'.
$this->_customdata->grading_info->items[0]->grades[$this->_customdata->userid]->str_grade . '</a>';
}else{
$grade = $this->_customdata->grading_info->items[0]->grades[$this->_customdata->userid]->str_grade;
}
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assignment').':' ,$grade);
$mform->setType('finalgrade', PARAM_INT);
}
示例14: add_grade_form_elements
/**
* add elements to grade form
*
* @param MoodleQuickForm $mform
* @param stdClass $data
* @param array $params
* @return void
*/
public function add_grade_form_elements(MoodleQuickForm $mform, stdClass $data, $params) {
global $USER, $CFG;
$settings = $this->get_instance();
$rownum = $params['rownum'];
$last = $params['last'];
$useridlist = $params['useridlist'];
$userid = $useridlist[$rownum];
$grade = $this->get_user_grade($userid, false);
// add advanced grading
$gradingdisabled = $this->grading_disabled($userid);
$gradinginstance = $this->get_grading_instance($userid, $gradingdisabled);
if ($gradinginstance) {
$gradingelement = $mform->addElement('grading', 'advancedgrading', get_string('grade').':', array('gradinginstance' => $gradinginstance));
if ($gradingdisabled) {
$gradingelement->freeze();
} else {
$mform->addElement('hidden', 'advancedgradinginstanceid', $gradinginstance->get_id());
}
} else {
// use simple direct grading
if ($this->get_instance()->grade > 0) {
$gradingelement = $mform->addElement('text', 'grade', get_string('gradeoutof', 'assign',$this->get_instance()->grade));
$mform->addHelpButton('grade', 'gradeoutofhelp', 'assign');
$mform->setType('grade', PARAM_TEXT);
if ($gradingdisabled) {
$gradingelement->freeze();
}
} else {
$grademenu = make_grades_menu($this->get_instance()->grade);
if (count($grademenu) > 0) {
$gradingelement = $mform->addElement('select', 'grade', get_string('grade').':', $grademenu);
$mform->setType('grade', PARAM_INT);
if ($gradingdisabled) {
$gradingelement->freeze();
}
}
}
}
$gradinginfo = grade_get_grades($this->get_course()->id,
'mod',
'assign',
$this->get_instance()->id,
$userid);
if (!empty($CFG->enableoutcomes)) {
foreach($gradinginfo->outcomes as $index=>$outcome) {
$options = make_grades_menu(-$outcome->scaleid);
if ($outcome->grades[$userid]->locked) {
$options[0] = get_string('nooutcome', 'grades');
$mform->addElement('static', 'outcome_'.$index.'['.$userid.']', $outcome->name.':',
$options[$outcome->grades[$userid]->grade]);
} else {
$options[''] = get_string('nooutcome', 'grades');
$attributes = array('id' => 'menuoutcome_'.$index );
$mform->addElement('select', 'outcome_'.$index.'['.$userid.']', $outcome->name.':', $options, $attributes );
$mform->setType('outcome_'.$index.'['.$userid.']', PARAM_INT);
$mform->setDefault('outcome_'.$index.'['.$userid.']', $outcome->grades[$userid]->grade );
}
}
}
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
$gradestring = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
array('id'=>$this->get_course()->id)),
$gradinginfo->items[0]->grades[$userid]->str_grade);
} else {
$gradestring = $gradinginfo->items[0]->grades[$userid]->str_grade;
}
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assign').':', $gradestring);
$mform->addElement('static', 'progress', '', get_string('gradingstudentprogress', 'assign', array('index'=>$rownum+1, 'count'=>count($useridlist))));
// plugins
$this->add_plugin_grade_elements($grade, $mform, $data);
// hidden params
$mform->addElement('hidden', 'id', $this->get_course_module()->id);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'rownum', $rownum);
$mform->setType('rownum', PARAM_INT);
$mform->addElement('hidden', 'useridlist', implode(',', $useridlist));
$mform->setType('useridlist', PARAM_TEXT);
$mform->addElement('hidden', 'ajax', optional_param('ajax', 0, PARAM_INT));
$mform->setType('ajax', PARAM_INT);
if ($this->get_instance()->teamsubmission) {
$mform->addElement('selectyesno', 'applytoall', get_string('applytoteam', 'assign'));
$mform->setDefault('applytoall', 1);
//.........这里部分代码省略.........
示例15: error
}
$discussions[$post->discussion] = $discussion;
} else {
$discussion = $discussions[$post->discussion];
}
if (!isset($forums[$discussion->forum])) {
if (!($forum = get_record('forum', 'id', $discussion->forum))) {
error("Could not find forum {$discussion->forum}");
}
$forums[$discussion->forum] = $forum;
} else {
$forum = $forums[$discussion->forum];
}
$ratings = null;
if ($forum->assessed) {
if ($scale = make_grades_menu($forum->scale)) {
$ratings = new object();
$ratings->scale = $scale;
$ratings->assesstimestart = $forum->assesstimestart;
$ratings->assesstimefinish = $forum->assesstimefinish;
$ratings->allow = false;
}
}
if (!isset($cms[$forum->id])) {
if (!($cm = get_coursemodule_from_instance('forum', $forum->id))) {
error('Course Module ID was incorrect');
}
$cms[$forum->id] = $cm;
unset($cm);
// do not use cm directly, it would break caching
}