<?php

/**
 * ELIS(TM): Enterprise Learning Intelligence Suite
 * Copyright (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    elis
 * @subpackage php_reports
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
require_once '../../config.php';
require_once $CFG->dirroot . '/blocks/php_report/lib/schedulelib.php';
$page = new scheduling_page();
$page->print_page();
Beispiel #2
0
      </div>';
//field to fill in with errors
echo '<div id="php_report_schedule_errors">
      </div>';
//retrieve the labels of scheduled tasks
$schedulenames = array();
//store all the schedule ids that are valid
$valid_scheduleids = array();
$test_scheduleids = json_decode($scheduleids);
//error checking
if (!is_array($test_scheduleids) || count($test_scheduleids) == 0) {
    print_error('popup_jobs_error', 'local_elisreports');
}
//create a page for permissions checking
require_once $CFG->dirroot . '/local/elisreports/lib/schedulelib.php';
$page = new scheduling_page();
foreach ($test_scheduleids as $scheduleid) {
    //retrieve the schedule name
    $config = $DB->get_field('local_elisreports_schedule', 'config', array('id' => $scheduleid));
    $config = unserialize($config);
    //check permissions
    if ($page->can_do_schedule_action($scheduleid, $config['report'])) {
        $valid_scheduleids[] = $scheduleid;
        // urlencode config label
        $schedulenames[] = urlencode($config['label']);
    }
}
// Calculate the labels to display.
$runninglabel = get_string('popup_running_label', 'local_elisreports');
$donerunninglabel = get_string('popup_done_running_label', 'local_elisreports');
$a = new stdClass();
Beispiel #3
0
/**
 * Specifies the tree entries used to represent links to PHP reports
 *
 * @return  menuitem array  List of menu items to add (including report categories
 *                          but excluding the top-level report entry)
 */
function block_elisadmin_get_report_tree_items()
{
    global $CFG, $DB;
    // If the reports block is not installed, no entries will be displayed.
    if (file_exists($CFG->dirroot . '/local/elisreports/version.php') !== true) {
        return array();
    }
    //get the category-level links
    $items = block_elisadmin_get_report_category_items();
    //path to library file for scheduling classes
    $schedulelib_path = $CFG->dirroot . '/local/elisreports/lib/schedulelib.php';
    //check to make sure the required functionality is there
    //todo: remove this check when it's safe to do so
    if (file_exists($schedulelib_path)) {
        //reporting base class
        require_once $schedulelib_path;
        //schedule report entry
        //make sure we are using a "clean" page to check global permissions
        $test_permissions_page = new scheduling_page(array());
        //make sure we can access the report listing
        if ($test_permissions_page->can_do('list')) {
            //create a direct url to the list page
            $schedule_reports_page = new menuitempage('url_page', 'lib/menuitem.class.php', $CFG->wwwroot . '/local/elisreports/schedule.php?action=list');
            //convert to a menu item
            $css_class = block_elisadmin_get_item_css_class('schedulereports');
            $schedule_reports_item = new menuitem('schedule_reports', $schedule_reports_page, 'rept', get_string('schedule_reports', 'local_elisreports'), $css_class, '', FALSE, 'rept');
            //merge in with the current result
            $items = array_merge(array($schedule_reports_item), $items);
        }
    }
    //for storing the items bucketed by category
    $buckets = array();
    //look for all report instances
    if (file_exists($CFG->dirroot . '/local/elisreports/instances') && ($handle = opendir($CFG->dirroot . '/local/elisreports/instances'))) {
        while (FALSE !== ($report_shortname = readdir($handle))) {
            //grab a test instance of the report in question
            $default_instance = php_report::get_default_instance($report_shortname);
            //make sure the report shortname is valid
            if ($default_instance !== FALSE) {
                //make sure the current user can access this report
                if ($default_instance->is_available() && $default_instance->can_view_report()) {
                    //user-friendly report name
                    $displayname = $default_instance->get_display_name();
                    //add the item to the necessary bucket
                    $item_category = $default_instance->get_category();
                    if (!isset($buckets[$item_category])) {
                        $buckets[$item_category] = array();
                    }
                    //obtain the page specific to this report
                    $report_page_classpath = $CFG->dirroot . '/local/elisreports/lib/reportpage.class.php';
                    $report_page_params = array('report' => $report_shortname);
                    $page = new generic_menuitempage('report_page', $report_page_classpath, $report_page_params);
                    //retrieve the actual menuitem
                    $page_css_class = block_elisadmin_get_item_css_class('reportinstance');
                    $category_path = 'rept/' . $item_category;
                    $buckets[$item_category][$displayname] = new menuitem($report_shortname, $page, $item_category, $displayname, $page_css_class, '', FALSE, $category_path);
                }
            }
        }
    }
    //retrieve the items representing the reports themselves from the bucketed listings
    $report_instance_items = block_elisadmin_get_report_bucket_items($buckets);
    //merge the flat listings of category items and report instance items
    $items = array_merge($items, $report_instance_items);
    //return the flat listing
    return $items;
}
Beispiel #4
0
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    local_elisreports
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 */

require_once '../../config.php';
require_once $CFG->dirroot . '/local/elisreports/lib/schedulelib.php';

$PAGE = new scheduling_page();
//load necessary css classes
$PAGE->requires->css('/local/eliscore/styles.css');
$PAGE->requires->css('/local/elisreports/styles.css');

$PAGE->run();