本文整理汇总了PHP中glossary_grade_item_update函数的典型用法代码示例。如果您正苦于以下问题:PHP glossary_grade_item_update函数的具体用法?PHP glossary_grade_item_update怎么用?PHP glossary_grade_item_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了glossary_grade_item_update函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: glossary_reset_gradebook
/**
* Removes all grades from gradebook
* @param int $courseid
* @param string optional type
*/
function glossary_reset_gradebook($courseid, $type = '')
{
global $CFG;
switch ($type) {
case 'main':
$type = "AND g.mainglossary=1";
break;
case 'secondary':
$type = "AND g.mainglossary=0";
break;
default:
$type = "";
//all
}
$sql = "SELECT g.*, cm.idnumber as cmidnumber, g.course as courseid\n FROM {$CFG->prefix}glossary g, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id AND g.course={$courseid} {$type}";
if ($glossarys = get_records_sql($sql)) {
foreach ($glossarys as $glossary) {
glossary_grade_item_update($glossary, 'reset');
}
}
}
示例2: glossary_reset_gradebook
/**
* Removes all grades from gradebook
*
* @global object
* @param int $courseid
* @param string optional type
*/
function glossary_reset_gradebook($courseid, $type='') {
global $DB;
switch ($type) {
case 'main' : $type = "AND g.mainglossary=1"; break;
case 'secondary' : $type = "AND g.mainglossary=0"; break;
default : $type = ""; //all
}
$sql = "SELECT g.*, cm.idnumber as cmidnumber, g.course as courseid
FROM {glossary} g, {course_modules} cm, {modules} m
WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id AND g.course=? $type";
if ($glossarys = $DB->get_records_sql($sql, array($courseid))) {
foreach ($glossarys as $glossary) {
glossary_grade_item_update($glossary, 'reset');
}
}
}
示例3: glossary_update_grades
/**
* Update grades by firing grade_updated event
*
* @param object $glossary null means all glossaries
* @param int $userid specific user only, 0 mean all
*/
function glossary_update_grades($glossary = null, $userid = 0, $nullifnone = true)
{
global $CFG;
require_once $CFG->libdir . '/gradelib.php';
if ($glossary != null) {
if ($grades = glossary_get_user_grades($glossary, $userid)) {
grade_update('mod/glossary', $glossary->course, 'mod', 'glossary', $glossary->id, 0, $grades);
} else {
if ($userid and $nullifnone) {
$grade = new object();
$grade->userid = $userid;
$grade->rawgrade = NULL;
grade_update('mod/glossary', $glossary->course, 'mod', 'glossary', $glossary->id, 0, $grade);
}
}
} else {
$sql = "SELECT g.*, cm.idnumber as cmidnumber\n FROM {$CFG->prefix}glossary g, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m\n WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
if ($rs = get_recordset_sql($sql)) {
if ($rs->RecordCount() > 0) {
while ($glossary = rs_fetch_next_record($rs)) {
glossary_grade_item_update($glossary);
if ($glossary->assessed) {
glossary_update_grades($glossary, 0, false);
}
}
}
rs_close($rs);
}
}
}