Esempio n. 1
0
/**
 * Carries out functions needed after installation
 *
 * @copyright © 2011 University of London Computer Centre
 * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package ILP
 * @version 2.0
 */
function xmldb_block_ilp_install()
{
    global $USER, $CFG, $SESSION, $PARSER;
    // include the ilp db
    require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php';
    // instantiate the db
    $dbc = new ilp_db();
    //install the various plugins and templates into the database
    require_once $CFG->dirroot . '/blocks/ilp/classes/form_elements/ilp_element_plugin.php';
    //install new plugins
    ilp_element_plugin::install_new_plugins();
    require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_template.php';
    //install new templates
    ilp_dashboard_template::install_new_plugins();
    require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_plugin.php';
    //install new dashboard plugins
    ilp_dashboard_plugin::install_new_plugins();
    require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_tab.php';
    //install new tabs
    ilp_dashboard_tab::install_new_plugins();
    //create relationships betweendashboard plugins and template regions
    //get the enabled template should be the default temmplate at this stage
    $enabled_template = $dbc->get_enabled_template();
    $regions = $dbc->get_template_regions($enabled_template->id);
    $region_plugins = array();
    //create the association between the plugin and the first region
    $plugin = $dbc->get_dashboard_plugin_by_name('ilp_dashboard_student_info_plugin');
    $rp = new stdClass();
    $rp->plugin_id = $plugin->id;
    $region_plugins[] = $rp;
    $plugin = $dbc->get_dashboard_plugin_by_name('ilp_dashboard_main_plugin');
    $rp = new stdClass();
    $rp->plugin_id = $plugin->id;
    $region_plugins[] = $rp;
    //loop through the regions and assign the region to a plugin
    $i = 0;
    foreach ($regions as $r) {
        $region_plugins[$i]->region_id = $r->id;
        //create the record
        $dbc->create_region_plugin($region_plugins[$i]);
        $i++;
    }
    //create default user status record and subsequent items
    $statusitem = new stdClass();
    $statusitem->selecttype = NULL;
    $id = $dbc->create_plugin_record('block_ilp_plu_sts', $statusitem);
    $statusitems = array('red' => '1', 'orange' => '0', 'green' => '2');
    foreach ($statusitems as $key => $passfail) {
        $si = new stdClass();
        $si->name = $key;
        $si->value = $key;
        $si->passfail = $passfail;
        $si->parent_id = $id;
        $dbc->create_plugin_record('block_ilp_plu_sts_items', $si);
    }
}
 function __construct()
 {
     //calling the parent constructor as I require some of the variables
     //that intialised in the parent class
     parent::__construct();
     //specify the regions that exist in the template file
     //note the region names in the template must be exactly
     //the same as the regions named. Also a region name must
     //be unique in a template
     $this->regions[] = 'region1';
     //the region where student information is usually displayed
     $this->regions[] = 'region2';
     //the region where ilp information is displayed
 }
Esempio n. 3
0
 * @author http://www.ulcc.ac.uk, http://moodle.ulcc.ac.uk
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package ILP
 * @version 2.0
 */
global $CFG;
// include the assmgr db
require_once $CFG->dirroot . '/blocks/ilp/db/ilp_db.php';
// instantiate the assmgr db
$dbc = new ilp_db();
require_once $CFG->dirroot . '/blocks/ilp/classes/form_elements/ilp_element_plugin.php';
//install new plugins
ilp_element_plugin::install_new_plugins();
require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_template.php';
//install new templates
ilp_dashboard_template::install_new_plugins();
require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_plugin.php';
//install new dashboard plugins
ilp_dashboard_plugin::install_new_plugins();
require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_dashboard_tab.php';
//install new tabs
ilp_dashboard_tab::install_new_plugins();
require_once $CFG->dirroot . '/blocks/ilp/classes/dashboard/ilp_mis_plugin.php';
//install new tabs
ilp_mis_plugin::install_new_plugins();
$globalsettings = new admin_setting_heading('block_ilp/reportconfig', get_string('reports', 'block_ilp'), '');
$settings->add($globalsettings);
$link = '<a href="' . $CFG->wwwroot . '/blocks/ilp/actions/edit_report_configuration.php">' . get_string('reportconfigurationsection', 'block_ilp') . '</a>';
$settings->add(new admin_setting_heading('block_ilp_report_configuration', '', $link));
$link = '<a href="' . $CFG->wwwroot . '/blocks/ilp/actions/edit_status_items.php">' . get_string('editstatusitems', 'block_ilp') . '</a>';
$settings->add(new admin_setting_heading('block_ilp_statusitems', '', $link));