예제 #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);
    }
}
 /**
  * Delete a form element
  */
 public function delete_form_element($reportfield_id)
 {
     return parent::delete_form_element($this->tablename, $reportfield_id);
 }
예제 #3
0
 * Global config file for the ILP 
 *
 * @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
 */
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>';
 /**
  * Deletes a form element and any items that it may have 
  *  
  *  @param int $reportfield_id the id of the reportfield 
  */
 public function delete_form_element($reportfield_id)
 {
     //get the record for the field
     $pluginrecord = $this->dbc->get_form_element_by_reportfield($this->tablename, $reportfield_id);
     if (!empty($this->items_tablename)) {
         //delete all items for the field then delete the field itself by calling the function in the
         //parent class
         $this->dbc->delete_items($this->items_tablename, $pluginrecord->id);
     }
     //also delete any submitted data - it'll survive in ghostly form in the log table
     $this->dbc->delete_items($this->data_entry_tablename, $pluginrecord->id);
     $reportfield = $this->dbc->get_report_field_data($reportfield_id);
     $extraparams = array('audit_type' => $this->audit_type(), 'label' => $reportfield->label, 'description' => $reportfield->description, 'id' => $reportfield_id);
     return parent::delete_form_element($this->tablename, $reportfield_id, $extraparams);
 }
 public function delete_form_element($reportfield_id)
 {
     $reportfield = $this->dbc->get_report_field_data($reportfield_id);
     $extraparams = array('audit_type' => $this->audit_type(), 'label' => $reportfield->label, 'description' => $reportfield->description, 'id' => $reportfield_id);
     return parent::delete_form_element($this->tablename, $reportfield_id, $extraparams);
 }