Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 *
19
 */
20
 
21
require_once(dirname(__FILE__).'/../../../config.php');
22
require_once('../locallib.php');
23
 
24
$systemcontext = context_system::instance();
25
 
26
require_login();
27
require_capability('report/training:viewdashboard', $systemcontext);
28
 
29
$pagetitle = get_string('dashboard_title', 'report_training');
30
$PAGE->set_context($systemcontext);
31
$PAGE->set_url('/report/training/admin/dashboard.php');
32
$PAGE->set_title($pagetitle);
33
$PAGE->set_heading($pagetitle);
34
$PAGE->set_pagelayout('admin');
35
$PAGE->set_cacheable(false);
36
$PAGE->requires->css('/report/training/css/dashboard_css.css');
37
$PAGE->requires->js('/report/training/libs/jquery-1.12.2.min.js', true);
38
$PAGE->requires->js('/report/training/libs/Chart.min.js', true);
39
$PAGE->requires->js('/report/training/js/dashboardcharts.js', false);
40
 
41
$timeform = new training_dashboard_time_form();
42
if ($fromform = $timeform->get_data()) {
43
    $timeform->set_data($fromform);
44
    $analyticsdata = report_training_load_datas($fromform->timestart, $fromform->timefinish);
45
} else {
46
    $analyticsdata = report_training_load_datas();
47
}
48
 
49
//var_dump($analyticsdata);
50
 
51
$PAGE->requires->js_function_call('createCharts', array($analyticsdata), true);
52
 
53
echo $OUTPUT->header();
54
 
55
echo $OUTPUT->heading(get_string('dashboard_name', 'report_training'));
56
echo '<noscript>';
57
echo $OUTPUT->error_text(get_string('dashboard_nojs_error_message', 'report_training'));
58
echo '</noscript>';
59
if ((is_null($analyticsdata))||(empty($analyticsdata))) {
60
    echo $OUTPUT->error_text(get_string('dashboard_no_data_error', 'report_training'));
61
} else {
62
    echo $OUTPUT->heading(get_string('dashboard_time_title', 'report_training'), 4);
63
    $timeform->display();
64
    echo $OUTPUT->container_start(null, 'datas');
65
    $vtables = report_training_create_data_tables($analyticsdata);
66
    $chartout = report_training_create_charts();
67
    $out = report_training_create_containers($chartout, $vtables);
68
    foreach ($out as $wrap) {
69
        echo $wrap;
70
    }
71
    echo $OUTPUT->container_end();
72
}
73
echo $OUTPUT->footer();