Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 71... Línea 71...
71
// Trigger an activity report viewed event.
71
// Trigger an activity report viewed event.
72
$event = \report_outline\event\activity_report_viewed::create(array('context' => $context));
72
$event = \report_outline\event\activity_report_viewed::create(array('context' => $context));
73
$event->trigger();
73
$event->trigger();
Línea 74... Línea 74...
74
 
74
 
-
 
75
$showlastaccess = true;
75
$showlastaccess = true;
76
$showblogs = !empty($CFG->enableblogs) && $CFG->useblogassociations;
Línea 76... Línea 77...
76
$hiddenfields = explode(',', $CFG->hiddenuserfields);
77
$hiddenfields = explode(',', $CFG->hiddenuserfields);
77
 
78
 
78
if (array_search('lastaccess', $hiddenfields) !== false and !has_capability('moodle/user:viewhiddendetails', $context)) {
79
if (array_search('lastaccess', $hiddenfields) !== false and !has_capability('moodle/user:viewhiddendetails', $context)) {
Línea 79... Línea 80...
79
    $showlastaccess = false;
80
    $showlastaccess = false;
80
}
-
 
81
 
-
 
82
$stractivityreport = get_string('pluginname', 'report_outline');
-
 
83
$stractivity       = get_string('activity');
-
 
84
$strlast           = get_string('lastaccess');
-
 
85
$strreports        = get_string('reports');
-
 
86
$strviews          = get_string('views');
81
}
87
$strrelatedblogentries = get_string('relatedblogentries', 'blog');
82
 
88
 
83
$stractivityreport = get_string('pluginname', 'report_outline');
Línea 89... Línea 84...
89
$PAGE->set_title($course->shortname .': '. $stractivityreport);
84
$PAGE->set_title($course->shortname .': '. $stractivityreport);
Línea 119... Línea 114...
119
    }
114
    }
120
}
115
}
Línea 121... Línea 116...
121
 
116
 
Línea 122... Línea -...
122
$filterform->display();
-
 
123
 
-
 
124
echo $OUTPUT->container(get_string('computedfromlogs', 'admin', userdate($minlog)), 'loginfo');
-
 
125
 
-
 
126
$outlinetable = new html_table();
-
 
127
$outlinetable->attributes['class'] = 'generaltable boxaligncenter';
-
 
128
$outlinetable->cellpadding = 5;
-
 
129
$outlinetable->id = 'outlinetable';
-
 
130
$outlinetable->head = array($stractivity, $strviews);
-
 
131
 
-
 
132
if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
-
 
133
    $outlinetable->head[] = $strrelatedblogentries;
-
 
134
}
-
 
135
 
-
 
136
if ($showlastaccess) {
-
 
137
    $outlinetable->head[] = $strlast;
-
 
138
}
117
$filterform->display();
Línea 139... Línea 118...
139
 
118
 
140
$modinfo = get_fast_modinfo($course);
119
$modinfo = get_fast_modinfo($course);
141
 
120
 
Línea 218... Línea 197...
218
            }
197
            }
219
        }
198
        }
220
    }
199
    }
221
}
200
}
Línea 222... Línea -...
222
 
-
 
223
$prevsecctionnum = 0;
-
 
224
foreach ($modinfo->sections as $sectionnum=>$section) {
-
 
225
    foreach ($section as $cmid) {
-
 
226
        $cm = $modinfo->cms[$cmid];
-
 
227
        if (!$cm->has_view()) {
-
 
228
            continue;
-
 
229
        }
-
 
230
        if (!$cm->uservisible) {
-
 
231
            continue;
-
 
232
        }
-
 
233
        if ($prevsecctionnum != $sectionnum) {
-
 
234
            $sectionrow = new html_table_row();
-
 
235
            $sectionrow->attributes['class'] = 'section';
-
 
236
            $sectioncell = new html_table_cell();
-
 
237
            $sectioncell->colspan = count($outlinetable->head);
-
 
238
 
-
 
239
            $sectiontitle = get_section_name($course, $sectionnum);
-
 
240
 
-
 
241
            $sectioncell->text = $OUTPUT->heading($sectiontitle, 3);
-
 
242
            $sectionrow->cells[] = $sectioncell;
-
 
243
            $outlinetable->data[] = $sectionrow;
-
 
244
 
-
 
245
            $prevsecctionnum = $sectionnum;
-
 
246
        }
-
 
247
 
-
 
248
        $dimmed = $cm->visible ? '' : 'class="dimmed"';
-
 
249
        $modulename = get_string('modulename', $cm->modname);
-
 
250
 
-
 
251
        $reportrow = new html_table_row();
-
 
252
        $activitycell = new html_table_cell();
-
 
253
        $activitycell->attributes['class'] = 'activity';
-
 
254
 
-
 
255
        $activityicon = $OUTPUT->pix_icon('monologo', $modulename, $cm->modname, array('class'=>'icon'));
-
 
256
 
-
 
257
        $attributes = array();
-
 
258
        if (!$cm->visible) {
-
 
259
            $attributes['class'] = 'dimmed';
-
 
260
        }
-
 
261
 
201
 
262
        $activitycell->text = $activityicon . html_writer::link("$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id", format_string($cm->name), $attributes);
-
 
263
 
-
 
264
        $reportrow->cells[] = $activitycell;
-
 
265
 
-
 
266
        $numviewscell = new html_table_cell();
-
 
267
        $numviewscell->attributes['class'] = 'numviews';
-
 
268
 
-
 
269
        if (!empty($views[$cm->id]->numviews)) {
202
$activitieslist = new report_outline\output\activitieslist($modinfo, $views, $showlastaccess, $minlog, $showblogs);
270
            $numviewscell->text = get_string('numviews', 'report_outline', $views[$cm->id]);
-
 
271
        } else {
-
 
272
            $numviewscell->text = '-';
-
 
273
        }
-
 
274
 
-
 
275
        $reportrow->cells[] = $numviewscell;
-
 
276
 
-
 
277
        if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
-
 
278
            require_once($CFG->dirroot.'/blog/lib.php');
-
 
279
            $blogcell = new html_table_cell();
-
 
280
            $blogcell->attributes['class'] = 'blog';
-
 
281
            if ($blogcount = blog_get_associated_count($course->id, $cm->id)) {
-
 
282
                $blogurl = new moodle_url('/blog/index.php', array('modid' => $cm->id));
-
 
283
                $blogcell->text = html_writer::link($blogurl, $blogcount);
-
 
284
            } else {
-
 
285
                $blogcell->text = '-';
-
 
286
            }
-
 
287
            $reportrow->cells[] = $blogcell;
-
 
288
        }
-
 
289
 
-
 
290
        if ($showlastaccess) {
-
 
291
            $lastaccesscell = new html_table_cell();
-
 
292
            $lastaccesscell->attributes['class'] = 'lastaccess';
-
 
293
 
-
 
294
            if (isset($views[$cm->id]->lasttime)) {
-
 
295
                $timeago = format_time(time() - $views[$cm->id]->lasttime);
-
 
296
                $lastaccesscell->text = userdate($views[$cm->id]->lasttime)." ($timeago)";
-
 
297
            }
-
 
298
            $reportrow->cells[] = $lastaccesscell;
-
 
299
        }
-
 
300
        $outlinetable->data[] = $reportrow;
-
 
301
    }
-
 
302
}
-
 
303
echo html_writer::table($outlinetable);
-
 
304
 
203
echo $OUTPUT->render_from_template('report_outline/report', $activitieslist->export_for_template($OUTPUT));