Proyectos de Subversion Moodle

Rev

Rev 886 | Rev 888 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 886 Rev 887
Línea 139... Línea 139...
139
 
139
 
140
$header = $PAGE->activityheader;
140
$header = $PAGE->activityheader;
141
$headercontent = $header->export_for_template($renderer);
141
$headercontent = $header->export_for_template($renderer);
Línea 142... Línea 142...
142
$completed = false;
142
$completed = false;
143
 
143
 
-
 
144
$course_context = context_course::instance($COURSE->id);
-
 
145
$roles = get_user_roles($course_context, $USER->id, true);
-
 
146
 
-
 
147
$completion_visible = true;
144
if ($currentmod->completionview != 1 && $currentmod->completion != 2) {
148
foreach ($roles as $role) {
145
    if ($completiondata->completionstate == COMPLETION_COMPLETE || $completiondata->completionstate == COMPLETION_COMPLETE_PASS) {
149
    if ($role->shortname != 'student') {
146
        $completed = true;
150
        $completion_visible  = false;
Línea -... Línea 151...
-
 
151
    }
-
 
152
}
-
 
153
 
-
 
154
if (!$completion_visible) {
-
 
155
    $completed = false;
-
 
156
}
-
 
157
 
-
 
158
$modules = get_fast_modinfo($COURSE->id)->get_cms();
-
 
159
 
-
 
160
$mods = [];
-
 
161
foreach ($modules as $module) {
-
 
162
    if (!$module->uservisible || $module->is_stealth() || empty($module->url)) {
-
 
163
        continue;
-
 
164
    }
-
 
165
    $mods[$module->id] = $module;
-
 
166
}
-
 
167
 
-
 
168
 
-
 
169
 
-
 
170
$nummods = count($mods);
-
 
171
 
-
 
172
// If there is only one mod then do nothing.
-
 
173
if ($nummods == 1) {
-
 
174
    $completed = false;
-
 
175
}
-
 
176
 
-
 
177
$modids = array_keys($mods);
-
 
178
$position = array_search($page_context->id, $modids);   //array_search($this->page->cm->id, $modids);
-
 
179
 
-
 
180
$currentmod = $mods[$modids[$position]];
-
 
181
 
-
 
182
/*if(!$currentmod->completion) {
-
 
183
    return '';
-
 
184
}*/
-
 
185
 
-
 
186
$completioninfo = new \completion_info($COURSE);
-
 
187
$completiondata = $completioninfo->get_data($currentmod, true);
-
 
188
if ($completiondata->completionstate == COMPLETION_COMPLETE && $completiondata->completionstate == COMPLETION_COMPLETE_PASS) {
-
 
189
    $completed = true;
147
    }
190
}
148
}
191
 
Línea 149... Línea 192...
149
 
192
 
150
// RUI.
193
// RUI.