Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * 
 */

require_once(dirname(__FILE__).'/../../../config.php');
require_once('../locallib.php');

$systemcontext = context_system::instance();

require_login();
require_capability('report/training:viewdashboard', $systemcontext);

$pagetitle = get_string('dashboard_title', 'report_training');
$PAGE->set_context($systemcontext);
$PAGE->set_url('/report/training/admin/dashboard.php');
$PAGE->set_title($pagetitle);
$PAGE->set_heading($pagetitle);
$PAGE->set_pagelayout('admin');
$PAGE->set_cacheable(false);
$PAGE->requires->css('/report/training/css/dashboard_css.css');
$PAGE->requires->js('/report/training/libs/jquery-1.12.2.min.js', true);
$PAGE->requires->js('/report/training/libs/Chart.min.js', true);
$PAGE->requires->js('/report/training/js/dashboardcharts.js', false);

$timeform = new training_dashboard_time_form();
if ($fromform = $timeform->get_data()) {
    $timeform->set_data($fromform);
    $analyticsdata = report_training_load_datas($fromform->timestart, $fromform->timefinish);
} else {
    $analyticsdata = report_training_load_datas();
}

//var_dump($analyticsdata);

$PAGE->requires->js_function_call('createCharts', array($analyticsdata), true);

echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('dashboard_name', 'report_training'));
echo '<noscript>';
echo $OUTPUT->error_text(get_string('dashboard_nojs_error_message', 'report_training'));
echo '</noscript>';
if ((is_null($analyticsdata))||(empty($analyticsdata))) {
    echo $OUTPUT->error_text(get_string('dashboard_no_data_error', 'report_training'));
} else {
    echo $OUTPUT->heading(get_string('dashboard_time_title', 'report_training'), 4);
    $timeform->display();
    echo $OUTPUT->container_start(null, 'datas');
    $vtables = report_training_create_data_tables($analyticsdata);
    $chartout = report_training_create_charts();
    $out = report_training_create_containers($chartout, $vtables);
    foreach ($out as $wrap) {
        echo $wrap;
    }
    echo $OUTPUT->container_end();
}
echo $OUTPUT->footer();