Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 33... Línea 33...
33
$id          = optional_param('id', 0, PARAM_INT);// Course ID.
33
$id          = optional_param('id', 0, PARAM_INT);// Course ID.
34
$group       = optional_param('group', 0, PARAM_INT); // Group to display.
34
$group       = optional_param('group', 0, PARAM_INT); // Group to display.
35
$user        = optional_param('user', 0, PARAM_INT); // User to display.
35
$user        = optional_param('user', 0, PARAM_INT); // User to display.
36
$date        = optional_param('date', 0, PARAM_INT); // Date to display.
36
$date        = optional_param('date', 0, PARAM_INT); // Date to display.
37
$modid       = optional_param('modid', 0, PARAM_ALPHANUMEXT); // Module id or 'site_errors'.
37
$modid       = optional_param('modid', 0, PARAM_ALPHANUMEXT); // Module id or 'site_errors'.
-
 
38
$isactivitypage = optional_param('isactivitypage', false, PARAM_BOOL); // Is this a course module page?
38
$modaction   = optional_param('modaction', '', PARAM_ALPHAEXT); // An action as recorded in the logs.
39
$modaction   = optional_param('modaction', '', PARAM_ALPHAEXT); // An action as recorded in the logs.
39
$page        = optional_param('page', '0', PARAM_INT);     // Which page to show.
40
$page        = optional_param('page', '0', PARAM_INT);     // Which page to show.
40
$perpage     = optional_param('perpage', '100', PARAM_INT); // How many per page.
41
$perpage     = optional_param('perpage', '100', PARAM_INT); // How many per page.
41
$showcourses = optional_param('showcourses', false, PARAM_BOOL); // Whether to show courses if we're over our limit.
42
$showcourses = optional_param('showcourses', false, PARAM_BOOL); // Whether to show courses if we're over our limit.
42
$showusers   = optional_param('showusers', false, PARAM_BOOL); // Whether to show users if we're over our limit.
43
$showusers   = optional_param('showusers', false, PARAM_BOOL); // Whether to show users if we're over our limit.
Línea 97... Línea 98...
97
$url = new moodle_url("/report/log/index.php", $params);
98
$url = new moodle_url("/report/log/index.php", $params);
Línea 98... Línea 99...
98
 
99
 
99
$PAGE->set_url('/report/log/index.php', array('id' => $id));
100
$PAGE->set_url('/report/log/index.php', array('id' => $id));
Línea -... Línea 101...
-
 
101
$PAGE->set_pagelayout('report');
-
 
102
 
-
 
103
$cminfo = null;
-
 
104
if (!is_number($modid)) {
-
 
105
    $isactivitypage = false;
-
 
106
}
-
 
107
if ($isactivitypage) {
-
 
108
    $modinfo = get_fast_modinfo($id);
-
 
109
    $cminfo = $modinfo->cms[intval($modid)] ?? null;
-
 
110
    if ($cminfo === null) {
-
 
111
        throw new moodle_exception('invalidmoduleid', '', '', $modid);
-
 
112
    }
100
$PAGE->set_pagelayout('report');
113
}
-
 
114
 
101
 
115
// Get course details.
102
// Get course details.
116
$sitecoursefilter = 0;
-
 
117
if ($id != $SITE->id) {
103
if ($id != $SITE->id) {
118
    $course = $DB->get_record('course', ['id' => $id], '*');
104
    $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
119
    if ($course) {
-
 
120
        require_login($course);
-
 
121
        $context = context_course::instance($course->id);
-
 
122
        if ($cminfo !== null) {
-
 
123
            $context = $cminfo->context;
105
    require_login($course);
124
            $PAGE->set_cm($cminfo);
-
 
125
        }
-
 
126
    } else {
-
 
127
        // Missing courses may have be deleted, so display them in site context.
-
 
128
        $sitecoursefilter = $id;
-
 
129
    }
-
 
130
}
106
    $context = context_course::instance($course->id);
131
 
107
} else {
132
if (empty($course)) {
108
    $course = $SITE;
133
    $course = $SITE;
109
    require_login();
134
    require_login();
110
    $context = context_system::instance();
135
    $context = context_system::instance();
Línea 139... Línea 164...
139
if ($course->id == $SITE->id) {
164
if ($course->id == $SITE->id) {
140
    admin_externalpage_setup('reportlog', '', null, '', array('pagelayout' => 'report'));
165
    admin_externalpage_setup('reportlog', '', null, '', array('pagelayout' => 'report'));
141
    $PAGE->set_title($strlogs);
166
    $PAGE->set_title($strlogs);
142
    $PAGE->set_primary_active_tab('siteadminnode');
167
    $PAGE->set_primary_active_tab('siteadminnode');
143
} else {
168
} else {
-
 
169
    $contexttitle = $course->shortname . ': ';
-
 
170
    if ($cminfo !== null) {
-
 
171
        $contexttitle .= $cminfo->name . ' - ';
-
 
172
    }
144
    $PAGE->set_title($course->shortname .': '. $strlogs);
173
    $PAGE->set_title($contexttitle . $strlogs);
145
    $PAGE->set_heading($course->fullname);
174
    $PAGE->set_heading($course->fullname);
146
}
175
}
Línea 147... Línea -...
147
 
-
 
148
$reportlog = new report_log_renderable($logreader, $course, $user, $modid, $modaction, $group, $edulevel, $showcourses, $showusers,
-
 
149
        $chooselog, true, $url, $date, $logformat, $page, $perpage, 'timecreated DESC', $origin);
-
 
150
$readers = $reportlog->get_readers();
176
 
-
 
177
$output = $PAGE->get_renderer('report_log');
-
 
178
if (!report_helper::has_valid_group($context)) {
-
 
179
    echo $output->header();
-
 
180
    echo $output->notification(get_string('notingroup'));
-
 
181
    echo $output->footer();
-
 
182
    exit();
-
 
183
}
-
 
184
 
-
 
185
$reportlog = new report_log_renderable(
-
 
186
    logreader: $logreader,
-
 
187
    course: $course,
-
 
188
    userid: $user,
-
 
189
    modid: $modid,
-
 
190
    action: $modaction,
-
 
191
    groupid: $group,
-
 
192
    edulevel: $edulevel,
-
 
193
    showcourses: $showcourses,
-
 
194
    showusers: $showusers,
-
 
195
    showreport: $chooselog,
-
 
196
    showselectorform: true,
-
 
197
    url: $url,
-
 
198
    date: $date,
-
 
199
    logformat: $logformat,
-
 
200
    page: $page,
-
 
201
    perpage: $perpage,
-
 
202
    order: 'timecreated DESC',
-
 
203
    origin: $origin,
-
 
204
    isactivitypage: $isactivitypage,
-
 
205
    sitecoursefilter: $sitecoursefilter,
Línea -... Línea 206...
-
 
206
);
151
$output = $PAGE->get_renderer('report_log');
207
 
152
 
208
$readers = $reportlog->get_readers();
153
if (empty($readers)) {
209
if (empty($readers)) {
154
    echo $output->header();
210
    echo $output->header();
155
    echo $output->heading(get_string('nologreaderenabled', 'report_log'));
211
    echo $output->heading(get_string('nologreaderenabled', 'report_log'));
Línea 160... Línea 216...
160
 
216
 
161
        if (empty($logformat)) {
217
        if (empty($logformat)) {
162
            echo $output->header();
218
            echo $output->header();
163
            // Print selector dropdown.
219
            // Print selector dropdown.
-
 
220
            $pluginname = get_string('pluginname', 'report_log');
164
            $pluginname = get_string('pluginname', 'report_log');
221
            if (!$isactivitypage) {
-
 
222
                report_helper::print_report_selector($pluginname);
165
            report_helper::print_report_selector($pluginname);
223
            }
166
            $userinfo = get_string('allparticipants');
224
            $userinfo = get_string('allparticipants');
Línea 167... Línea 225...
167
            $dateinfo = get_string('alldays');
225
            $dateinfo = get_string('alldays');
168
 
226
 
Línea 184... Línea 242...
184
        }
242
        }
185
    } else {
243
    } else {
186
        echo $output->header();
244
        echo $output->header();
187
        // Print selector dropdown.
245
        // Print selector dropdown.
188
        $pluginname = get_string('pluginname', 'report_log');
246
        $pluginname = get_string('pluginname', 'report_log');
-
 
247
        if (!$isactivitypage) {
189
        report_helper::print_report_selector($pluginname);
248
            report_helper::print_report_selector($pluginname);
-
 
249
        }
190
        echo $output->heading(get_string('chooselogs') .':', 3);
250
        echo $output->heading(get_string('chooselogs') .':', 3);
191
        echo $output->render($reportlog);
251
        echo $output->render($reportlog);
192
    }
252
    }
193
}
253
}