Exemple #1
0
  *  option) any later version.                                              *
  \**************************************************************************/
require './include.php';
require './includes/db_inc.php';
require './includes/general_inc.php';
require './includes/tablemanage_inc.php';
include './includes/defines_inc.php';
$editfield = $_GET['editfield'];
$editreport = $_GET['editreport'];
$post_vars = "newtable_name,newtable_label,newtable_sortkey,newtable_plugincode,addtable,table_id,table_name,table_display,addcol_name,addcol_label,addcol_sort,addcol_dtable,addcol_drecord,addcol_required,addcol_modifiable,addcol_datatype";
globalize_vars($post_vars, $_POST);
// this needs to be done before headers are sent in printheader
while (list($key, $val) = each($_POST)) {
    if (substr($key, 0, 9) == 'expreport') {
        $modarray = explode("_", $key);
        export_report($db, $modarray[1]);
        exit;
    }
}
reset($_POST);
// when editing columns of a table include this javascript file:
if (isset($editfield)) {
    $jsfiles[] = './includes/js/editfields.js';
}
$permissions = $USER['permissions'];
if ($addcol_datatype == 'table') {
    $jsfiles[] = './includes/js/tablemanage.js';
}
// Except for ajax requests, we'll send the general headers now
if (!isset($_POST['jsrequest'])) {
    printheader($httptitle, false, $jsfiles);
$action = $download ? 'download' : 'view';
add_to_log($report->courseid, 'configurable_reports', $action, '/block/configurable_reports/viewreport.php?id=' . $id, $report->name);
// No download, build navigation header etc..
if (!$download) {
    $reportname = format_string($report->name);
    $navlinks = array();
    if (has_capability('block/configurable_reports:managereports', $context) || has_capability('block/configurable_reports:manageownreports', $context) && $report->ownerid == $USER->id) {
        $navlinks[] = array('name' => get_string('managereports', 'block_configurable_reports'), 'link' => $CFG->wwwroot . '/blocks/configurable_reports/managereport.php?courseid=' . $report->courseid, 'type' => 'title');
    }
    $navlinks[] = array('name' => $reportname, 'link' => null, 'type' => 'title');
    $navigation = build_navigation($navlinks);
    $PAGE->set_title($reportname);
    $PAGE->set_heading($reportname);
    $PAGE->set_cacheable(true);
    echo $OUTPUT->header();
    if (has_capability('block/configurable_reports:managereports', $context) || has_capability('block/configurable_reports:manageownreports', $context) && $report->ownerid == $USER->id) {
        $currenttab = 'viewreport';
        include 'tabs.php';
    }
    // Print the report HTML
    $reportclass->print_report_page($context);
} else {
    $exportplugin = $CFG->dirroot . '/blocks/configurable_reports/export/' . $format . '/export.php';
    if (file_exists($exportplugin)) {
        require_once $exportplugin;
        export_report($reportclass->finalreport);
    }
    die;
}
// Never reached if download = true
echo $OUTPUT->footer();
        $PAGE->navbar->add($report->name);
    }

    $PAGE->set_title($reportname);
    $PAGE->set_heading($reportname);
    $PAGE->set_cacheable(true);
    echo $OUTPUT->header();

    if (has_capability('block/cobalt_reports:managereports', $context) || (has_capability('block/cobalt_reports:manageownreports', $context)) && $report->ownerid == $USER->id) {
        $currenttab = 'viewreport';
        include('tabs.php');
    }
echo $OUTPUT->heading($report->name,2);
    // Print the report HTML
    //$reportclass->print_report_page($context);
    $renderer = $PAGE->get_renderer('block_cobalt_reports');
    echo $renderer->generate_report_page($reportclass);
} else {

    $exportplugin = $CFG->dirroot . '/blocks/cobalt_reports/export/' . $format . '/export.php';
    if (file_exists($exportplugin)) {
        require_once($exportplugin);
        export_report($reportclass->finalreport,$id);
    }
    die;
}

// Never reached if download = true
echo $OUTPUT->footer();