Proyectos de Subversion Moodle

Rev

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

Rev 1165 Rev 1167
Línea 37... Línea 37...
37
 
37
 
38
 
38
 
39
$searchURL = false;
39
$searchURL = false;
40
$linkURL = '';
40
$linkURL = '';
41
if (!empty($PAGE->course->id)) {
41
if (!empty($PAGE->course->id)) {
42
    
42
 
43
    $course = get_course($PAGE->course->id);
43
    $course = get_course($PAGE->course->id);
44
    $course_context = context_course::instance($course->id);
44
    $course_context = context_course::instance($course->id);
45
    
45
 
46
    
46
 
47
    $notifyeditingon  = empty($_GET['notifyeditingon']) ? 0 : intval( $_GET['notifyeditingon'], 10);
47
    $notifyeditingon  = empty($_GET['notifyeditingon']) ? 0 : intval($_GET['notifyeditingon'], 10);
48
    if($notifyeditingon) {
48
    if ($notifyeditingon) {
49
               
49
 
50
        if (has_capability('moodle/course:manageactivities', $course_context, $USER->id) || has_capability('moodle/course:viewhiddenactivities', $course_context, $USER->id) ) {
50
        if (has_capability('moodle/course:manageactivities', $course_context, $USER->id) || has_capability('moodle/course:viewhiddenactivities', $course_context, $USER->id)) {
51
            $searchURL = false;
51
            $searchURL = false;
52
        } else {
52
        } else {
53
            $searchURL = true;
-
 
54
        }
53
            $searchURL = true;
55
        
54
        }
56
    } else {
55
    } else {
57
        $searchURL = true;
56
        $searchURL = true;
58
    }
57
    }
59
    
58
 
60
    
59
 
61
    if($searchURL) {
60
    if ($searchURL) {
62
        $completioninfo = new \completion_info($course);
61
        $completioninfo = new \completion_info($course);
63
    
62
 
64
    
63
 
65
        $modules = get_fast_modinfo($course->id)->get_cms();
64
        $modules = get_fast_modinfo($course->id)->get_cms();
66
        if (!empty($modules)) {
65
        if (!empty($modules)) {
67
            foreach ($modules as $module) {
66
            foreach ($modules as $module) {
68
                if (!$module->uservisible || $module->is_stealth() || empty($module->url)) {
67
                if (!$module->uservisible || $module->is_stealth() || empty($module->url)) {
69
                    continue;
68
                    continue;
70
                }
69
                }
71
                $linkURL = new \moodle_url($module->url, array('forceview' => 1));
70
                $linkURL = new \moodle_url($module->url, array('forceview' => 1));
72
    
71
 
73
                $completiondata = $completioninfo->get_data($module, true);
72
                $completiondata = $completioninfo->get_data($module, true);
74
                if ($completiondata &&  $completiondata->completionstate == COMPLETION_COMPLETE || $completiondata->completionstate == COMPLETION_COMPLETE_PASS) {
73
                if ($completiondata &&  $completiondata->completionstate == COMPLETION_COMPLETE || $completiondata->completionstate == COMPLETION_COMPLETE_PASS) {
75
                    continue;
74
                    continue;
Línea 81... Línea 80...
81
}
80
}
Línea 82... Línea 81...
82
 
81
 
83
if (!empty($linkURL)) {
82
if (!empty($linkURL)) {
84
    redirect($linkURL);
83
    redirect($linkURL);
85
    exit;
84
    exit;
Línea 86... Línea 85...
86
} 
85
}
87
 
86