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


PHP grade_format_gradevalue函数代码示例

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


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

示例1: get_moodle_grades

 private function get_moodle_grades()
 {
     global $DB, $CFG;
     $grades = $DB->get_records('grade_grades', array('itemid' => $this->course_grade_item->id), 'userid', 'userid, finalgrade');
     if (!is_array($grades)) {
         $grades = array();
     }
     $this->moodle_grades = array();
     if ($this->course_grade_item->gradetype == GRADE_TYPE_SCALE) {
         $pg_scale = new grade_scale(array('id' => $CFG->grade_report_newgradereport_scale));
         $scale_items = $pg_scale->load_items();
         foreach ($this->moodle_students as $st) {
             if (isset($grades[$st->id])) {
                 $fg = (int) $grades[$st->id]->finalgrade;
                 if (isset($scale_items[$fg - 1])) {
                     $this->moodle_grades[$st->id] = $scale_items[$fg - 1];
                 } else {
                     $this->moodle_grades[$st->id] = null;
                 }
             } else {
                 $this->moodle_grades[$st->id] = null;
             }
         }
     } else {
         foreach ($this->moodle_students as $st) {
             if (isset($grades[$st->id])) {
                 $this->moodle_grades[$st->id] = grade_format_gradevalue($grades[$st->id]->finalgrade, $this->course_grade_item, true, $this->course_grade_item->get_displaytype(), null);
             } else {
                 $this->moodle_grades[$st->id] = null;
             }
         }
     }
 }
开发者ID:danielneis,项目名称:moodle-gradereport_newgradereport,代码行数:33,代码来源:lib.php

示例2: iomadcertificate_print_course_grade

/**
 * Prepare to print the course grade.
 *
 * @deprecated since iomadcertificate version 2012052501
 * @param stdClass $course
 * @return mixed
 */
function iomadcertificate_print_course_grade($course)
{
    debugging('iomadcertificate_print_course_grade is deprecated, please use iomadcertificate_get_grade instead. Ideally
               you should be using iomadcertificate_get_grade in your iomadcertificate type which will either get the course
               or module grade depending on your iomadcertificate settings.', DEBUG_DEVELOPER);
    global $USER, $DB;
    if ($course_item = grade_item::fetch_course_item($course->id)) {
        $grade = new grade_grade(array('itemid' => $course_item->id, 'userid' => $USER->id));
        $course_item->gradetype = GRADE_TYPE_VALUE;
        $coursegrade = new stdClass();
        $coursegrade->points = grade_format_gradevalue($grade->finalgrade, $course_item, true, GRADE_DISPLAY_TYPE_REAL, $decimals = 2);
        $coursegrade->percentage = grade_format_gradevalue($grade->finalgrade, $course_item, true, GRADE_DISPLAY_TYPE_PERCENTAGE, $decimals = 2);
        $coursegrade->letter = grade_format_gradevalue($grade->finalgrade, $course_item, true, GRADE_DISPLAY_TYPE_LETTER, $decimals = 0);
        return $coursegrade;
    }
    return false;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:24,代码来源:deprecatedlib.php

示例3: edit_form

 public function edit_form(&$mform, $locks)
 {
     global $COURSE;
     foreach ($locks as $lock) {
         if ($lock['type'] == 'grade' and $item = $this->get_grade_item($lock['id'])) {
             $name = $this->get_grade_item_name($item);
             $mform->addElement('header', 'grade_' . $lock['id'] . '_header', get_string('activitygradelockx', 'format_page', $name));
             $fieldname = 'grade[' . $lock['id'] . '][grade]';
             $maxgrade = grade_format_gradevalue($item->grademax, $item);
             $gradegroup = array();
             $gradegroup[] =& $mform->createElement('text', $fieldname, get_string('requiredgrade', 'format_page'), array('size' => '5'));
             $gradegroup[] =& $mform->createElement('static', "{$fieldname}_maxgrade", '', get_string('maxgradex', 'format_page', $maxgrade));
             $mform->addGroup($gradegroup, "group{$fieldname}", get_string('requiredgrade', 'format_page'), ' ', false);
             $mform->setHelpButton("group{$fieldname}", array('reqgrade', get_string('requiredgrade', 'format_page'), 'format_page'));
             $mform->setDefault($fieldname, $lock['grade']);
             $mform->addElement('checkbox', 'grade[' . $lock['id'] . '][delete]', get_string('removelock', 'format_page'));
         }
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:grade.php

示例4: get_course_grades

 /**
  * Get the given user courses final grades
  *
  * @param int $userid get grades for this user (optional, default current)
  *
  * @return array the grades tables
  * @since Moodle 3.2
  */
 public static function get_course_grades($userid = 0)
 {
     global $USER;
     $warnings = array();
     // Validate the parameter.
     $params = self::validate_parameters(self::get_course_grades_parameters(), array('userid' => $userid));
     $userid = $params['userid'];
     if (empty($userid)) {
         $userid = $USER->id;
     }
     $systemcontext = context_system::instance();
     self::validate_context($systemcontext);
     if ($USER->id != $userid) {
         // We must check if the current user can view other users grades.
         $user = core_user::get_user($userid, '*', MUST_EXIST);
         core_user::require_active_user($user);
         require_capability('moodle/grade:viewall', $systemcontext);
     }
     // We need the site course, and course context.
     $course = get_course(SITEID);
     $context = context_course::instance($course->id);
     // Force a regrade if required.
     grade_regrade_final_grades_if_required($course);
     // Get the course final grades now.
     $gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'overview', 'courseid' => $course->id, 'userid' => $userid));
     $report = new grade_report_overview($userid, $gpr, $context);
     $coursesgrades = $report->setup_courses_data(true);
     $grades = array();
     foreach ($coursesgrades as $coursegrade) {
         $gradeinfo = array('courseid' => $coursegrade['course']->id, 'grade' => grade_format_gradevalue($coursegrade['finalgrade'], $coursegrade['courseitem'], true), 'rawgrade' => $coursegrade['finalgrade']);
         if (isset($coursegrade['rank'])) {
             $gradeinfo['rank'] = $coursegrade['rank'];
         }
         $grades[] = $gradeinfo;
     }
     $result = array();
     $result['grades'] = $grades;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:dg711,项目名称:moodle,代码行数:48,代码来源:external.php

示例5: next

 /**
  * Hook for export the next data record in-place
  *
  * @return array The next record to be exported
  */
 public function next()
 {
     // Fetch the current record.
     $record = $this->recordset->current();
     // Set up our grade item.
     $grade_item = new stdClass();
     if ($record->mdlcrsid !== null) {
         $grade_item->courseid = $record->mdlcrsid;
     } else {
         $grade_item->courseid = SITEID;
     }
     $grade_item->gradetype = GRADE_TYPE_VALUE;
     $grade_item->grademin = 0;
     $grade_item->grademax = 100;
     // Write the line out of a file.
     $csvrecord = array($record->firstname, $record->lastname, $record->username, $record->idnumber, $record->crsidnumber, date('M/d/Y', $record->enrolmenttime), date('M/d/Y', $record->completetime), $this->completestatusstring, $record->grade, grade_format_gradevalue($record->grade, $grade_item, true, GRADE_DISPLAY_TYPE_LETTER, 5));
     // Add additional data for extra fields.
     $additional_data = rlipexport_version1elis_extrafields::get_all_data($record);
     $csvrecord = array_merge($csvrecord, $additional_data);
     // Move on to the next data record.
     $this->recordset->next();
     return $csvrecord;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:28,代码来源:version1elis.class.php

示例6: get_right_avg_row


//.........这里部分代码省略.........
         $groupsql = $this->groupsql;
         $groupwheresql = $this->groupwheresql;
         $groupwheresqlparams = $this->groupwheresql_params;
     } else {
         $showaverages = $this->get_pref('showaverages');
         $groupsql = "";
         $groupwheresql = "";
         $groupwheresqlparams = array();
     }
     if ($showaverages) {
         $totalcount = $this->get_numusers($grouponly);
         // Limit to users with a gradeable role.
         list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $this->gradebookroles), SQL_PARAMS_NAMED, 'grbr0');
         // Limit to users with an active enrollment.
         $coursecontext = $this->context->get_course_context(true);
         $defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
         $showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
         $showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $coursecontext);
         list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->context, '', 0, $showonlyactiveenrol);
         // We want to query both the current context and parent contexts.
         list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($this->context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx');
         $params = array_merge(array('courseid' => $this->courseid), $gradebookrolesparams, $enrolledparams, $groupwheresqlparams, $relatedctxparams);
         // Find sums of all grade items in course.
         $sql = "SELECT g.itemid, SUM(g.finalgrade) AS sum\n                      FROM {grade_items} gi\n                      JOIN {grade_grades} g ON g.itemid = gi.id\n                      JOIN {user} u ON u.id = g.userid\n                      JOIN ({$enrolledsql}) je ON je.id = u.id\n                      JOIN (\n                               SELECT DISTINCT ra.userid\n                                 FROM {role_assignments} ra\n                                WHERE ra.roleid {$gradebookrolessql}\n                                  AND ra.contextid {$relatedctxsql}\n                           ) rainner ON rainner.userid = u.id\n                      {$groupsql}\n                     WHERE gi.courseid = :courseid\n                       AND u.deleted = 0\n                       AND g.finalgrade IS NOT NULL\n                       {$groupwheresql}\n                     GROUP BY g.itemid";
         $sumarray = array();
         if ($sums = $DB->get_records_sql($sql, $params)) {
             foreach ($sums as $itemid => $csum) {
                 $sumarray[$itemid] = $csum->sum;
             }
         }
         // MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
         // This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
         $sql = "SELECT gi.id, COUNT(DISTINCT u.id) AS count\n                      FROM {grade_items} gi\n                      CROSS JOIN {user} u\n                      JOIN ({$enrolledsql}) je\n                           ON je.id = u.id\n                      JOIN {role_assignments} ra\n                           ON ra.userid = u.id\n                      LEFT OUTER JOIN {grade_grades} g\n                           ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)\n                      {$groupsql}\n                     WHERE gi.courseid = :courseid\n                           AND ra.roleid {$gradebookrolessql}\n                           AND ra.contextid {$relatedctxsql}\n                           AND u.deleted = 0\n                           AND g.id IS NULL\n                           {$groupwheresql}\n                  GROUP BY gi.id";
         $ungradedcounts = $DB->get_records_sql($sql, $params);
         $avgrow = new html_table_row();
         $avgrow->attributes['class'] = 'avg';
         foreach ($this->gtree->items as $itemid => $unused) {
             $item =& $this->gtree->items[$itemid];
             if ($item->needsupdate) {
                 $avgcell = new html_table_cell();
                 $avgcell->attributes['class'] = 'i' . $itemid;
                 $avgcell->text = $OUTPUT->container(get_string('error'), 'gradingerror');
                 $avgrow->cells[] = $avgcell;
                 continue;
             }
             if (!isset($sumarray[$item->id])) {
                 $sumarray[$item->id] = 0;
             }
             if (empty($ungradedcounts[$itemid])) {
                 $ungradedcount = 0;
             } else {
                 $ungradedcount = $ungradedcounts[$itemid]->count;
             }
             if ($meanselection == GRADE_REPORT_MEAN_GRADED) {
                 $meancount = $totalcount - $ungradedcount;
             } else {
                 // Bump up the sum by the number of ungraded items * grademin
                 $sumarray[$item->id] += $ungradedcount * $item->grademin;
                 $meancount = $totalcount;
             }
             // Determine which display type to use for this average
             if ($USER->gradeediting[$this->courseid]) {
                 $displaytype = GRADE_DISPLAY_TYPE_REAL;
             } else {
                 if ($averagesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) {
                     // no ==0 here, please resave the report and user preferences
                     $displaytype = $item->get_displaytype();
                 } else {
                     $displaytype = $averagesdisplaytype;
                 }
             }
             // Override grade_item setting if a display preference (not inherit) was set for the averages
             if ($averagesdecimalpoints == GRADE_REPORT_PREFERENCE_INHERIT) {
                 $decimalpoints = $item->get_decimals();
             } else {
                 $decimalpoints = $averagesdecimalpoints;
             }
             if (!isset($sumarray[$item->id]) || $meancount == 0) {
                 $avgcell = new html_table_cell();
                 $avgcell->attributes['class'] = 'i' . $itemid;
                 $avgcell->text = '-';
                 $avgrow->cells[] = $avgcell;
             } else {
                 $sum = $sumarray[$item->id];
                 $avgradeval = $sum / $meancount;
                 $gradehtml = grade_format_gradevalue($avgradeval, $item, true, $displaytype, $decimalpoints);
                 $numberofgrades = '';
                 if ($shownumberofgrades) {
                     $numberofgrades = " ({$meancount})";
                 }
                 $avgcell = new html_table_cell();
                 $avgcell->attributes['class'] = 'i' . $itemid;
                 $avgcell->text = $gradehtml . $numberofgrades;
                 $avgrow->cells[] = $avgcell;
             }
         }
         $rows[] = $avgrow;
     }
     return $rows;
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:101,代码来源:lib.php

示例7: report_ncccscensus_build_grades_array

/**
 * Build the array of grades for the report.
 *
 * @param int   $courseid    The course record ID.
 * @param mixed $users       An array of user IDs.
 * @param int   $startdate   The start date for the time period to fetch logs.
 * @param int   $enddate     The end date for the time period to fetch logs.
 * @return array An array of user course log information.
 * @uses $CFG, $DB
 */
function report_ncccscensus_build_grades_array($courseid, $users, $startdate, $enddate)
{
    global $CFG, $DB;
    require_once $CFG->dirroot . '/lib/gradelib.php';
    require_once $CFG->dirroot . '/lib/grade/constants.php';
    require_once $CFG->dirroot . '/lib/grade/grade_item.php';
    require_once $CFG->dirroot . '/mod/assign/locallib.php';
    require_once $CFG->dirroot . '/mod/quiz/locallib.php';
    $reportname = 'report_ncccscensus';
    $context = context_course::instance($courseid);
    $results = array();
    $gis = array();
    if (empty($users)) {
        $users = 'null';
    } else {
        $users = implode(',', $users);
    }
    // Pass #1 - Get any graded forum post records from the DB.
    $sql = 'SELECT DISTINCT u.id AS userid, fp.id AS postid, gi.id AS giid, u.firstname,
                   u.lastname, u.idnumber, gg.overridden, fp.message, gi.itemname,
                   gg.finalgrade, fp.created AS timesubmitted, fp.modified AS timecreated,
                   u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename
              FROM {forum_posts} fp
        INNER JOIN {forum_discussions} fd ON fd.id = fp.discussion
        INNER JOIN {forum} f ON f.id = fd.forum
        INNER JOIN {grade_items} gi ON gi.iteminstance = fd.forum
         LEFT JOIN {grade_grades} gg ON gg.itemid = gi.id AND gg.userid = fp.userid
        INNER JOIN {user} u ON u.id = fp.userid AND fp.userid in (' . $users . ')
             WHERE fd.course = :courseid
                   AND f.assessed > 0
                   AND fp.userid != 0
                   AND gi.itemmodule = \'forum\'
                   AND fp.created >= :timestart
                   AND fp.created <= :timeend
          ORDER BY fp.created ASC, u.lastname ASC, u.firstname ASC';
    $dbparams = array('courseid' => $courseid, 'timestart' => $startdate, 'timeend' => $enddate);
    $rs = $DB->get_recordset_sql($sql, $dbparams);
    foreach ($rs as $record) {
        if (empty($gis[$record->giid])) {
            $gis[$record->giid] = new grade_item(array('id' => $record->giid));
        }
        // Only record the oldest record found.
        if (empty($results[$record->userid]) || $record->timecreated < $results[$record->userid]->timecreated) {
            if (empty($record->finalgrade)) {
                $grade = get_string('nograde', $reportname);
                $date = '';
            } else {
                $grade = grade_format_gradevalue($record->finalgrade, $gis[$record->giid]);
                $date = userdate($record->timecreated, get_string('dateformat', $reportname));
            }
            $result = new stdClass();
            $result->userid = $record->userid;
            $result->lastname = $record->lastname;
            $result->firstname = $record->firstname;
            $result->student = fullname($record);
            $result->studentid = $record->idnumber;
            $result->activity = $record->itemname;
            $result->module = get_string('moduleforum', $reportname);
            $result->status = get_string('submissionstatusna', $reportname);
            // No status info required for 'forum'.
            $result->submitdate = userdate($record->timesubmitted, get_string('dateformat', $reportname));
            $result->grade = $grade;
            $result->overridden = $record->overridden;
            $result->timecreated = $record->timecreated;
            $result->date = $date;
            $results[$record->userid] = $result;
        }
    }
    unset($rs);
    // Pass #2 - Get any graded glossary entries from the DB.
    $sql = 'SELECT u.id AS userid, ent.id AS entid, gi.id AS giid, u.firstname, u.lastname, u.idnumber, gi.itemname,
                   gg.finalgrade, ent.timecreated AS timesubmitted, ent.timemodified AS timecreated, gg.overridden,
                   u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename
              FROM {glossary_entries} ent
        INNER JOIN {glossary} glos ON ent.glossaryid = glos.id
        INNER JOIN {grade_items} gi ON gi.iteminstance = glos.id
         LEFT JOIN {grade_grades} gg ON gg.itemid = gi.id AND gg.userid = ent.userid
        INNER JOIN {user} u ON u.id = ent.userid AND ent.userid in (' . $users . ')
             WHERE glos.course = :courseid
                   AND glos.assessed > 0
                   AND ent.userid != 0
                   AND gi.itemmodule = \'glossary\'
                   AND ent.timecreated >= :timestart
                   AND ent.timecreated <= :timeend';
    $dbparams = array('courseid' => $courseid, 'timestart' => $startdate, 'timeend' => $enddate);
    $rs = $DB->get_recordset_sql($sql, $dbparams);
    foreach ($rs as $record) {
        if (empty($gis[$record->giid])) {
            $gis[$record->giid] = new grade_item(array('id' => $record->giid));
        }
//.........这里部分代码省略.........
开发者ID:cbmegahan,项目名称:report_ncccscensus,代码行数:101,代码来源:lib.php

示例8: fill_table

 /**
  * Fill the table for displaying.
  *
  * @param bool $activitylink If this report link to the activity report or the user report.
  * @param bool $studentcoursesonly Only show courses that the user is a student of.
  */
 public function fill_table($activitylink = false, $studentcoursesonly = false)
 {
     global $CFG, $DB, $OUTPUT, $USER;
     if ($studentcoursesonly && count($this->studentcourseids) == 0) {
         return false;
     }
     // Only show user's courses instead of all courses.
     if ($this->courses) {
         $numusers = $this->get_numusers(false);
         foreach ($this->courses as $course) {
             if (!$course->showgrades) {
                 continue;
             }
             // If we are only showing student courses and this course isn't part of the group, then move on.
             if ($studentcoursesonly && !isset($this->studentcourseids[$course->id])) {
                 continue;
             }
             $coursecontext = context_course::instance($course->id);
             if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
                 // The course is hidden and the user isn't allowed to see it
                 continue;
             }
             if (!has_capability('moodle/user:viewuseractivitiesreport', context_user::instance($this->user->id)) && ((!has_capability('moodle/grade:view', $coursecontext) || $this->user->id != $USER->id) && !has_capability('moodle/grade:viewall', $coursecontext))) {
                 continue;
             }
             $coursename = format_string(get_course_display_name_for_list($course), true, array('context' => $coursecontext));
             // Link to the activity report version of the user grade report.
             if ($activitylink) {
                 $courselink = html_writer::link(new moodle_url('/course/user.php', array('mode' => 'grade', 'id' => $course->id, 'user' => $this->user->id)), $coursename);
             } else {
                 $courselink = html_writer::link(new moodle_url('/grade/report/user/index.php', array('id' => $course->id, 'userid' => $this->user->id)), $coursename);
             }
             $canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
             // Get course grade_item
             $course_item = grade_item::fetch_course_item($course->id);
             // Get the stored grade
             $course_grade = new grade_grade(array('itemid' => $course_item->id, 'userid' => $this->user->id));
             $course_grade->grade_item =& $course_item;
             $finalgrade = $course_grade->finalgrade;
             if (!$canviewhidden and !is_null($finalgrade)) {
                 if ($course_grade->is_hidden()) {
                     $finalgrade = null;
                 } else {
                     $adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($course->id, $course_item, $finalgrade);
                     // We temporarily adjust the view of this grade item - because the min and
                     // max are affected by the hidden values in the aggregation.
                     $finalgrade = $adjustedgrade['grade'];
                     $course_item->grademax = $adjustedgrade['grademax'];
                     $course_item->grademin = $adjustedgrade['grademin'];
                 }
             } else {
                 // We must use the rawgrademin / rawgrademax because it can be different for
                 // each grade_grade when items are excluded from sum of grades.
                 if (!is_null($finalgrade)) {
                     $course_item->grademin = $course_grade->rawgrademin;
                     $course_item->grademax = $course_grade->rawgrademax;
                 }
             }
             $data = array($courselink, grade_format_gradevalue($finalgrade, $course_item, true));
             if (!$this->showrank['any']) {
                 //nothing to do
             } else {
                 if ($this->showrank[$course->id] && !is_null($finalgrade)) {
                     /// find the number of users with a higher grade
                     /// please note this can not work if hidden grades involved :-( to be fixed in 2.0
                     $params = array($finalgrade, $course_item->id);
                     $sql = "SELECT COUNT(DISTINCT(userid))\n                              FROM {grade_grades}\n                             WHERE finalgrade IS NOT NULL AND finalgrade > ?\n                                   AND itemid = ?";
                     $rank = $DB->count_records_sql($sql, $params) + 1;
                     $data[] = "{$rank}/{$numusers}";
                 } else {
                     // No grade, no rank.
                     // Or this course wants rank hidden.
                     $data[] = '-';
                 }
             }
             $this->table->add_data($data);
         }
         return true;
     } else {
         echo $OUTPUT->notification(get_string('notenrolled', 'grades'), 'notifymessage');
         return false;
     }
 }
开发者ID:grug,项目名称:moodle,代码行数:89,代码来源:lib.php

示例9: get_formatted_range

 /**
  * Returns a string representing the range of grademin - grademax for this grade item.
  * @param int $rangesdisplaytype
  * @param int $rangesdecimalpoints
  * @return string
  */
 function get_formatted_range($rangesdisplaytype = null, $rangesdecimalpoints = null)
 {
     global $USER;
     // Determine which display type to use for this average
     if (isset($USER->gradeediting) && $USER->gradeediting[$this->courseid]) {
         $displaytype = GRADE_DISPLAY_TYPE_REAL;
     } else {
         if ($rangesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) {
             // no ==0 here, please resave report and user prefs
             $displaytype = $this->get_displaytype();
         } else {
             $displaytype = $rangesdisplaytype;
         }
     }
     // Override grade_item setting if a display preference (not default) was set for the averages
     if ($rangesdecimalpoints == GRADE_REPORT_PREFERENCE_INHERIT) {
         $decimalpoints = $this->get_decimals();
     } else {
         $decimalpoints = $rangesdecimalpoints;
     }
     if ($displaytype == GRADE_DISPLAY_TYPE_PERCENTAGE) {
         $grademin = "0 %";
         $grademax = "100 %";
     } else {
         $grademin = grade_format_gradevalue($this->grademin, $this, true, $displaytype, $decimalpoints);
         $grademax = grade_format_gradevalue($this->grademax, $this, true, $displaytype, $decimalpoints);
     }
     return $grademin . '&ndash;' . $grademax;
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:35,代码来源:grade_item.php

示例10: fill_table

 public function fill_table()
 {
     global $CFG, $DB;
     // MDL-11679, only show 'mycourses' instead of all courses
     if ($courses = get_my_courses($this->user->id, 'c.sortorder ASC', 'id, shortname, showgrades')) {
         $numusers = $this->get_numusers(false);
         foreach ($courses as $course) {
             if (!$course->showgrades) {
                 continue;
             }
             $courselink = '<a href="' . $CFG->wwwroot . '/grade/report/user/index.php?id=' . $course->id . '">' . $course->shortname . '</a>';
             $canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $course->id));
             // Get course grade_item
             $course_item = grade_item::fetch_course_item($course->id);
             // Get the stored grade
             $course_grade = new grade_grade(array('itemid' => $course_item->id, 'userid' => $this->user->id));
             $course_grade->grade_item =& $course_item;
             $finalgrade = $course_grade->finalgrade;
             if (!$canviewhidden and !is_null($finalgrade)) {
                 if ($course_grade->is_hidden()) {
                     $finalgrade = null;
                 } else {
                     // This is a really ugly hack, it will be fixed in 2.0
                     $items = grade_item::fetch_all(array('courseid' => $course->id));
                     $grades = array();
                     $sql = "SELECT g.*\n                                  FROM {grade_grades} g\n                                  JOIN {grade_items} gi ON gi.id = g.itemid\n                                 WHERE g.userid = ? AND gi.courseid = ?";
                     if ($gradesrecords = $DB->get_records_sql($sql, array($this->user->id, $course->id))) {
                         foreach ($gradesrecords as $grade) {
                             $grades[$grade->itemid] = new grade_grade($grade, false);
                         }
                         unset($gradesrecords);
                     }
                     foreach ($items as $itemid => $unused) {
                         if (!isset($grades[$itemid])) {
                             $grade_grade = new grade_grade();
                             $grade_grade->userid = $this->user->id;
                             $grade_grade->itemid = $items[$itemid]->id;
                             $grades[$itemid] = $grade_grade;
                         }
                         $grades[$itemid]->grade_item =& $items[$itemid];
                     }
                     $hiding_affected = grade_grade::get_hiding_affected($grades, $items);
                     if (array_key_exists($course_item->id, $hiding_affected['altered'])) {
                         $finalgrade = $hiding_affected['altered'][$course_item->id];
                     } else {
                         if (!empty($hiding_affected['unknown'][$course_item->id])) {
                             $finalgrade = null;
                         }
                     }
                     unset($hiding_affected);
                     unset($grades);
                     unset($items);
                 }
             }
             $data = array($courselink, grade_format_gradevalue($finalgrade, $course_item, true));
             if (!$this->showrank) {
                 //nothing to do
             } else {
                 if (!is_null($finalgrade)) {
                     /// find the number of users with a higher grade
                     /// please note this can not work if hidden grades involved :-( to be fixed in 2.0
                     $params = array($finalgrade, $course_item->id);
                     $sql = "SELECT COUNT(DISTINCT(userid))\n                              FROM {grade_grades}\n                             WHERE finalgrade IS NOT NULL AND finalgrade > ?\n                                   AND itemid = ?";
                     $rank = $DB->count_records_sql($sql, $params) + 1;
                     $data[] = "{$rank}/{$numusers}";
                 } else {
                     // no grade, no rank
                     $data[] = '-';
                 }
             }
             $this->table->add_data($data);
         }
         return true;
     } else {
         notify(get_string('nocourses', 'grades'));
         return false;
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:78,代码来源:lib.php

示例11: display_grade

 /**
  * Return a grade in user-friendly form, whether it's a scale or not.
  *
  * @param mixed $grade int|null
  * @param boolean $editing Are we allowing changes to this grade?
  * @param int $userid The user id the grade belongs to
  * @param int $modified Timestamp from when the grade was last modified
  * @return string User-friendly representation of grade
  */
 public function display_grade($grade, $editing, $userid = 0, $modified = 0)
 {
     global $DB;
     static $scalegrades = array();
     $o = '';
     if ($this->get_instance()->grade >= 0) {
         // Normal number.
         if ($editing && $this->get_instance()->grade > 0) {
             if ($grade < 0) {
                 $displaygrade = '';
             } else {
                 $displaygrade = format_float($grade, 2);
             }
             $o .= '<label class="accesshide" for="quickgrade_' . $userid . '">' . get_string('usergrade', 'assign') . '</label>';
             $o .= '<input type="text"
                           id="quickgrade_' . $userid . '"
                           name="quickgrade_' . $userid . '"
                           value="' . $displaygrade . '"
                           size="6"
                           maxlength="10"
                           class="quickgrade"/>';
             $o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, 2);
             $o .= '<input type="hidden"
                           name="grademodified_' . $userid . '"
                           value="' . $modified . '"/>';
             return $o;
         } else {
             $o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
             if ($grade == -1 || $grade === null) {
                 $o .= '-';
             } else {
                 $item = $this->get_grade_item();
                 $o .= grade_format_gradevalue($grade, $item);
                 if ($item->get_displaytype() == GRADE_DISPLAY_TYPE_REAL) {
                     // If displaying the raw grade, also display the total value.
                     $o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, 2);
                 }
             }
             return $o;
         }
     } else {
         // Scale.
         if (empty($this->cache['scale'])) {
             if ($scale = $DB->get_record('scale', array('id' => -$this->get_instance()->grade))) {
                 $this->cache['scale'] = make_menu_from_list($scale->scale);
             } else {
                 $o .= '-';
                 return $o;
             }
         }
         if ($editing) {
             $o .= '<label class="accesshide"
                           for="quickgrade_' . $userid . '">' . get_string('usergrade', 'assign') . '</label>';
             $o .= '<select name="quickgrade_' . $userid . '" class="quickgrade">';
             $o .= '<option value="-1">' . get_string('nograde') . '</option>';
             foreach ($this->cache['scale'] as $optionid => $option) {
                 $selected = '';
                 if ($grade == $optionid) {
                     $selected = 'selected="selected"';
                 }
                 $o .= '<option value="' . $optionid . '" ' . $selected . '>' . $option . '</option>';
             }
             $o .= '</select>';
             $o .= '<input type="hidden" ' . 'name="grademodified_' . $userid . '" ' . 'value="' . $modified . '"/>';
             return $o;
         } else {
             $scaleid = (int) $grade;
             if (isset($this->cache['scale'][$scaleid])) {
                 $o .= $this->cache['scale'][$scaleid];
                 return $o;
             }
             $o .= '-';
             return $o;
         }
     }
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:85,代码来源:locallib.php

示例12: format_grade

 /**
  * Returns string representation of final grade
  * @param object $grade instance of grade_grade class
  * @param integer $gradedisplayconst grade display type constant.
  * @return string
  */
 public function format_grade($grade, $gradedisplayconst = null)
 {
     $displaytype = $this->displaytype;
     if (is_array($this->displaytype) && !is_null($gradedisplayconst)) {
         $displaytype = $gradedisplayconst;
     }
     $gradeitem = $this->grade_items[$grade->itemid];
     // We are going to store the min and max so that we can "reset" the grade_item for later.
     $grademax = $gradeitem->grademax;
     $grademin = $gradeitem->grademin;
     // Updating grade_item with this grade_grades min and max.
     $gradeitem->grademax = $grade->get_grade_max();
     $gradeitem->grademin = $grade->get_grade_min();
     $formattedgrade = grade_format_gradevalue($grade->finalgrade, $gradeitem, false, $displaytype, $this->decimalpoints);
     // Resetting the grade item in case it is reused.
     $gradeitem->grademax = $grademax;
     $gradeitem->grademin = $grademin;
     return $formattedgrade;
 }
开发者ID:elie89,项目名称:moodle,代码行数:25,代码来源:lib.php

示例13: grade_get_grades

/**
 * Returns grading information for given activity - optionally with users grades
 * Manual, course or category items can not be queried.
 * @param int $courseid id of course
 * @param string $itemtype 'mod', 'block'
 * @param string $itemmodule 'forum, 'quiz', etc.
 * @param int $iteminstance id of the item module
 * @param int $userid optional id of the graded user; if userid not used, returns only information about grade_item
 * @return array of grade information objects (scaleid, name, grade and locked status, etc.) indexed with itemnumbers
 */
function grade_get_grades($courseid, $itemtype, $itemmodule, $iteminstance, $userid_or_ids = 0)
{
    global $CFG;
    $return = new object();
    $return->items = array();
    $return->outcomes = array();
    $course_item = grade_item::fetch_course_item($courseid);
    $needsupdate = array();
    if ($course_item->needsupdate) {
        $result = grade_regrade_final_grades($courseid);
        if ($result !== true) {
            $needsupdate = array_keys($result);
        }
    }
    if ($grade_items = grade_item::fetch_all(array('itemtype' => $itemtype, 'itemmodule' => $itemmodule, 'iteminstance' => $iteminstance, 'courseid' => $courseid))) {
        foreach ($grade_items as $grade_item) {
            $decimalpoints = null;
            if (empty($grade_item->outcomeid)) {
                // prepare information about grade item
                $item = new object();
                $item->itemnumber = $grade_item->itemnumber;
                $item->scaleid = $grade_item->scaleid;
                $item->name = $grade_item->get_name();
                $item->grademin = $grade_item->grademin;
                $item->grademax = $grade_item->grademax;
                $item->gradepass = $grade_item->gradepass;
                $item->locked = $grade_item->is_locked();
                $item->hidden = $grade_item->is_hidden();
                $item->grades = array();
                switch ($grade_item->gradetype) {
                    case GRADE_TYPE_NONE:
                        continue;
                    case GRADE_TYPE_VALUE:
                        $item->scaleid = 0;
                        break;
                    case GRADE_TYPE_TEXT:
                        $item->scaleid = 0;
                        $item->grademin = 0;
                        $item->grademax = 0;
                        $item->gradepass = 0;
                        break;
                }
                if (empty($userid_or_ids)) {
                    $userids = array();
                } else {
                    if (is_array($userid_or_ids)) {
                        $userids = $userid_or_ids;
                    } else {
                        $userids = array($userid_or_ids);
                    }
                }
                if ($userids) {
                    $grade_grades = grade_grade::fetch_users_grades($grade_item, $userids, true);
                    foreach ($userids as $userid) {
                        $grade_grades[$userid]->grade_item =& $grade_item;
                        $grade = new object();
                        $grade->grade = $grade_grades[$userid]->finalgrade;
                        $grade->locked = $grade_grades[$userid]->is_locked();
                        $grade->hidden = $grade_grades[$userid]->is_hidden();
                        $grade->overridden = $grade_grades[$userid]->overridden;
                        $grade->feedback = $grade_grades[$userid]->feedback;
                        $grade->feedbackformat = $grade_grades[$userid]->feedbackformat;
                        $grade->usermodified = $grade_grades[$userid]->usermodified;
                        // create text representation of grade
                        if (in_array($grade_item->id, $needsupdate)) {
                            $grade->grade = false;
                            $grade->str_grade = get_string('error');
                        } else {
                            if (is_null($grade->grade)) {
                                $grade->str_grade = '-';
                            } else {
                                $grade->str_grade = grade_format_gradevalue($grade->grade, $grade_item);
                            }
                        }
                        // create html representation of feedback
                        if (is_null($grade->feedback)) {
                            $grade->str_feedback = '';
                        } else {
                            $grade->str_feedback = format_text($grade->feedback, $grade->feedbackformat);
                        }
                        $item->grades[$userid] = $grade;
                    }
                }
                $return->items[$grade_item->itemnumber] = $item;
            } else {
                if (!($grade_outcome = grade_outcome::fetch(array('id' => $grade_item->outcomeid)))) {
                    debugging('Incorect outcomeid found');
                    continue;
                }
                // outcome info
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:gradelib.php

示例14: fill_table_recursive

 private function fill_table_recursive(&$element)
 {
     global $CFG, $DB;
     $type = $element['type'];
     $depth = $element['depth'];
     $grade_object = $element['object'];
     $eid = $grade_object->id;
     $fullname = $this->gtree->get_element_header($element, true, true, true);
     $data = array();
     $hidden = '';
     $excluded = '';
     $class = '';
     // If this is a hidden grade category, hide it completely from the user
     if ($type == 'category' && $grade_object->is_hidden() && !$this->canviewhidden && ($this->showhiddenitems == GRADE_REPORT_USER_HIDE_HIDDEN || $this->showhiddenitems == GRADE_REPORT_USER_HIDE_UNTIL && !$grade_object->is_hiddenuntil())) {
         return false;
     }
     if ($type == 'category') {
         $this->evenodd[$depth] = ($this->evenodd[$depth] + 1) % 2;
     }
     $alter = $this->evenodd[$depth] == 0 ? 'even' : 'odd';
     /// Process those items that have scores associated
     if ($type == 'item' or $type == 'categoryitem' or $type == 'courseitem') {
         if (!($grade_grade = grade_grade::fetch(array('itemid' => $grade_object->id, 'userid' => $this->user->id)))) {
             $grade_grade = new grade_grade();
             $grade_grade->userid = $this->user->id;
             $grade_grade->itemid = $grade_object->id;
         }
         $grade_grade->load_grade_item();
         /// Hidden Items
         if ($grade_grade->grade_item->is_hidden()) {
             $hidden = ' hidden';
         }
         // If this is a hidden grade item, hide it completely from the user.
         if ($grade_grade->is_hidden() && !$this->canviewhidden && ($this->showhiddenitems == GRADE_REPORT_USER_HIDE_HIDDEN || $this->showhiddenitems == GRADE_REPORT_USER_HIDE_UNTIL && !$grade_grade->is_hiddenuntil())) {
             // return false;
         } else {
             /// Excluded Item
             if ($grade_grade->is_excluded()) {
                 $fullname .= ' [' . get_string('excluded', 'grades') . ']';
                 $excluded = ' excluded';
             }
             /// Other class information
             $class = "{$hidden} {$excluded}";
             if ($this->switch) {
                 // alter style based on whether aggregation is first or last
                 $class .= ($type == 'categoryitem' or $type == 'courseitem') ? " " . $alter . "d{$depth} baggt b2b" : " item b1b";
             } else {
                 $class .= ($type == 'categoryitem' or $type == 'courseitem') ? " " . $alter . "d{$depth} baggb" : " item b1b";
             }
             /// Name
             $data['itemname']['content'] = $fullname;
             $data['itemname']['class'] = $class;
             $data['itemname']['colspan'] = $this->maxdepth - $depth;
             /// Actual Grade
             $gradeval = $grade_grade->finalgrade;
             if ($grade_grade->grade_item->needsupdate) {
                 $data['grade']['class'] = $class . ' gradingerror';
                 $data['grade']['content'] = get_string('error');
             } else {
                 if (!empty($CFG->grade_hiddenasdate) and $grade_grade->get_datesubmitted() and !$this->canviewhidden and $grade_grade->is_hidden() and !$grade_grade->grade_item->is_category_item() and !$grade_grade->grade_item->is_course_item()) {
                     // the problem here is that we do not have the time when grade value was modified, 'timemodified' is general modification date for grade_grades records
                     $class .= ' datesubmitted';
                     $data['grade']['class'] = $class;
                     $data['grade']['content'] = get_string('submittedon', 'grades', userdate($grade_grade->get_datesubmitted(), get_string('strftimedatetimeshort')));
                 } elseif ($grade_grade->is_hidden()) {
                     $data['grade']['class'] = $class . ' hidden';
                     $data['grade']['content'] = '-';
                 } else {
                     $data['grade']['class'] = $class;
                     $gradeval = $this->blank_hidden_total($this->courseid, $grade_grade->grade_item, $gradeval);
                     $data['grade']['content'] = grade_format_gradevalue($gradeval, $grade_grade->grade_item, true);
                 }
             }
             /// Percentage
             if ($this->showpercentage) {
                 if ($grade_grade->grade_item->needsupdate) {
                     $data['percentage']['class'] = $class . ' gradingerror';
                     $data['percentage']['content'] = get_string('error');
                 } elseif ($grade_grade->is_hidden()) {
                     $data['percentage']['class'] = $class . ' hidden';
                     $data['percentage']['content'] = '-';
                 } else {
                     $data['percentage']['class'] = $class;
                     $data['percentage']['content'] = grade_format_gradevalue($gradeval, $grade_grade->grade_item, true, GRADE_DISPLAY_TYPE_PERCENTAGE);
                 }
             }
             /// Rank
             if ($this->showrank) {
                 // TODO: this is broken if hidden grades present!!
                 if ($grade_grade->grade_item->needsupdate) {
                     $data['rank']['class'] = $class . ' gradingerror';
                     $data['rank']['content'] = get_string('error');
                 } elseif ($grade_grade->is_hidden()) {
                     $data['rank']['class'] = $class . ' hidden';
                     $data['rank']['content'] = '-';
                 } else {
                     if (is_null($gradeval)) {
                         // no grade, no rank
                         $data['rank']['class'] = $class;
                         $data['rank']['content'] = '-';
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:lib.php

示例15: get_avghtml


//.........这里部分代码省略.........
     $averagesdecimalpoints = $this->get_pref('averagesdecimalpoints');
     $meanselection = $this->get_pref('meanselection');
     $shownumberofgrades = $this->get_pref('shownumberofgrades');
     $avghtml = '';
     $avgcssclass = 'avg';
     if ($grouponly) {
         $straverage = get_string('groupavg', 'grades');
         $showaverages = $this->currentgroup && $this->get_pref('showaverages');
         $groupsql = $this->groupsql;
         $groupwheresql = $this->groupwheresql;
         $avgcssclass = 'groupavg';
     } else {
         $straverage = get_string('overallaverage', 'grades');
         $showaverages = $this->get_pref('showaverages');
         $groupsql = "";
         $groupwheresql = "";
     }
     if ($shownumberofgrades) {
         $straverage .= ' (' . get_string('submissions', 'grades') . ') ';
     }
     $totalcount = $this->get_numusers($grouponly);
     if ($showaverages) {
         // find sums of all grade items in course
         $SQL = "SELECT g.itemid, SUM(g.finalgrade) AS sum\n                      FROM {$CFG->prefix}grade_items gi\n                           JOIN {$CFG->prefix}grade_grades g      ON g.itemid = gi.id\n                           JOIN {$CFG->prefix}user u              ON u.id = g.userid\n                           JOIN {$CFG->prefix}role_assignments ra ON ra.userid = u.id\n                           {$groupsql}\n                     WHERE gi.courseid = {$this->courseid}\n                           AND ra.roleid in ({$this->gradebookroles})\n                           AND ra.contextid " . get_related_contexts_string($this->context) . "\n                           AND g.finalgrade IS NOT NULL\n                           {$groupwheresql}\n                  GROUP BY g.itemid";
         $sum_array = array();
         if ($sums = get_records_sql($SQL)) {
             foreach ($sums as $itemid => $csum) {
                 $sum_array[$itemid] = $csum->sum;
             }
         }
         $columncount = 0;
         $avghtml = '<tr class="' . $avgcssclass . ' r' . $this->rowcount++ . '">';
         // MDL-10875 Empty grades must be evaluated as grademin, NOT always 0
         // This query returns a count of ungraded grades (NULL finalgrade OR no matching record in grade_grades table)
         $SQL = "SELECT gi.id, COUNT(u.id) AS count\n                      FROM {$CFG->prefix}grade_items gi\n                           CROSS JOIN {$CFG->prefix}user u\n                           JOIN {$CFG->prefix}role_assignments ra        ON ra.userid = u.id\n                           LEFT OUTER JOIN  {$CFG->prefix}grade_grades g ON (g.itemid = gi.id AND g.userid = u.id AND g.finalgrade IS NOT NULL)\n                           {$groupsql}\n                     WHERE gi.courseid = {$this->courseid}\n                           AND ra.roleid in ({$this->gradebookroles})\n                           AND ra.contextid " . get_related_contexts_string($this->context) . "\n                           AND g.id IS NULL\n                           {$groupwheresql}\n                  GROUP BY gi.id";
         $ungraded_counts = get_records_sql($SQL);
         $fixedstudents = $this->is_fixed_students();
         if (!$fixedstudents) {
             $colspan = '';
             if ($this->get_pref('showuseridnumber')) {
                 $colspan = 'colspan="2" ';
             }
             $avghtml .= '<th class="header c0 range" ' . $colspan . ' scope="row">' . $straverage . '</th>';
         }
         foreach ($this->gtree->items as $itemid => $unused) {
             $item =& $this->gtree->items[$itemid];
             if ($item->needsupdate) {
                 $avghtml .= '<td class="cell c' . $columncount++ . '"><span class="gradingerror">' . get_string('error') . '</span></td>';
                 continue;
             }
             if (!isset($sum_array[$item->id])) {
                 $sum_array[$item->id] = 0;
             }
             if (empty($ungraded_counts[$itemid])) {
                 $ungraded_count = 0;
             } else {
                 $ungraded_count = $ungraded_counts[$itemid]->count;
             }
             if ($meanselection == GRADE_REPORT_MEAN_GRADED) {
                 $mean_count = $totalcount - $ungraded_count;
             } else {
                 // Bump up the sum by the number of ungraded items * grademin
                 $sum_array[$item->id] += $ungraded_count * $item->grademin;
                 $mean_count = $totalcount;
             }
             $decimalpoints = $item->get_decimals();
             // Determine which display type to use for this average
             if ($USER->gradeediting[$this->courseid]) {
                 $displaytype = GRADE_DISPLAY_TYPE_REAL;
             } else {
                 if ($averagesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) {
                     // no ==0 here, please resave the report and user preferences
                     $displaytype = $item->get_displaytype();
                 } else {
                     $displaytype = $averagesdisplaytype;
                 }
             }
             // Override grade_item setting if a display preference (not inherit) was set for the averages
             if ($averagesdecimalpoints == GRADE_REPORT_PREFERENCE_INHERIT) {
                 $decimalpoints = $item->get_decimals();
             } else {
                 $decimalpoints = $averagesdecimalpoints;
             }
             if (!isset($sum_array[$item->id]) || $mean_count == 0) {
                 $avghtml .= '<td class="cell c' . $columncount++ . '">-</td>';
             } else {
                 $sum = $sum_array[$item->id];
                 $avgradeval = $sum / $mean_count;
                 $gradehtml = grade_format_gradevalue($avgradeval, $item, true, $displaytype, $decimalpoints);
                 $numberofgrades = '';
                 if ($shownumberofgrades) {
                     $numberofgrades = " ({$mean_count})";
                 }
                 $avghtml .= '<td class="cell c' . $columncount++ . '">' . $gradehtml . $numberofgrades . '</td>';
             }
         }
         $avghtml .= '</tr>';
     }
     return $avghtml;
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:101,代码来源:lib.php


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