mirror of
https://github.com/moodle/moodle.git
synced 2025-06-03 14:46:35 +02:00
MDL-7547 yet more speed improvements in rebuild_course_cache() ; merged from MOODLE_19_STABLE
This commit is contained in:
parent
f36cbf1d6e
commit
1ea543df62
@ -974,7 +974,6 @@ function get_array_of_activities($courseid) {
|
||||
$mod[$seq]->cm = $rawmods[$seq]->id;
|
||||
$mod[$seq]->mod = $rawmods[$seq]->modname;
|
||||
$mod[$seq]->section = $section->section;
|
||||
$mod[$seq]->name = urlencode(get_field($rawmods[$seq]->modname, "name", "id", $rawmods[$seq]->instance));
|
||||
$mod[$seq]->visible = $rawmods[$seq]->visible;
|
||||
$mod[$seq]->groupmode = $rawmods[$seq]->groupmode;
|
||||
$mod[$seq]->groupingid = $rawmods[$seq]->groupingid;
|
||||
@ -994,8 +993,14 @@ function get_array_of_activities($courseid) {
|
||||
if (!empty($info->icon)) {
|
||||
$mod[$seq]->icon = $info->icon;
|
||||
}
|
||||
if (!empty($info->name)) {
|
||||
$mod[$seq]->name = urlencode($info->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($mod[$seq]->name)) {
|
||||
$mod[$seq]->name = urlencode(get_field($rawmods[$seq]->modname, "name", "id", $rawmods[$seq]->instance));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2744,20 +2744,26 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
|
||||
function assignment_get_coursemodule_info($coursemodule) {
|
||||
global $CFG;
|
||||
|
||||
if (! $type = get_field('assignment', 'assignmenttype', 'id', $coursemodule->instance)) {
|
||||
if (! $assignment = get_record('assignment', 'id', $coursemodule->instance, '', '', '', '', 'id, assignmenttype, name')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$libfile = "$CFG->dirroot/mod/assignment/type/$type/assignment.class.php";
|
||||
$libfile = "$CFG->dirroot/mod/assignment/type/$assignment->assignmenttype/assignment.class.php";
|
||||
|
||||
if (file_exists($libfile)) {
|
||||
require_once($libfile);
|
||||
$assignmentclass = "assignment_$type";
|
||||
$assignmentclass = "assignment_$assignment->assignmenttype";
|
||||
$ass = new $assignmentclass('staticonly');
|
||||
return $ass->get_coursemodule_info($coursemodule);
|
||||
if ($result = $ass->get_coursemodule_info($coursemodule)) {
|
||||
return $result;
|
||||
} else {
|
||||
$info = new object();
|
||||
$info->name = $assignment->name;
|
||||
return $info;
|
||||
}
|
||||
|
||||
} else {
|
||||
debugging('Incorrect assignment type: '.$type);
|
||||
debugging('Incorrect assignment type: '.$assignment->assignmenttype);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -71,9 +71,10 @@ function label_get_participants($labelid) {
|
||||
* See get_array_of_activities() in course/lib.php
|
||||
*/
|
||||
function label_get_coursemodule_info($coursemodule) {
|
||||
if ($content = get_field('label', 'content', 'id', $coursemodule->instance)) {
|
||||
if ($label = get_record('label', 'id', $coursemodule->instance, '', '', '', '', 'id, content, name')) {
|
||||
$info = new object();
|
||||
$info->extra = urlencode($content);
|
||||
$info->extra = urlencode($label->content);
|
||||
$info->name = urlencode($label->name);
|
||||
return $info;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -349,8 +349,9 @@ function resource_get_coursemodule_info($coursemodule) {
|
||||
|
||||
$info = NULL;
|
||||
|
||||
if ($resource = get_record("resource", "id", $coursemodule->instance, '', '', '', '', 'id, popup, reference, type')) {
|
||||
if ($resource = get_record("resource", "id", $coursemodule->instance, '', '', '', '', 'id, popup, reference, type, name')) {
|
||||
$info = new object();
|
||||
$info->name = $resource->name;
|
||||
if (!empty($resource->popup)) {
|
||||
$info->extra = urlencode("onclick=\"this.target='resource$resource->id'; return ".
|
||||
"openpopup('/mod/resource/view.php?inpopup=true&id=".
|
||||
|
Loading…
x
Reference in New Issue
Block a user