Exemple #1
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_usetthemes_install()
{
    // Migrate component.
    $oldcmp = 'pmplugins_userset_themes';
    $newcmp = 'elisprogram_usetthemes';
    $upgradestepfuncname = 'elisprogram_usetthemes_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    //set up the cluster theme category
    $theme_category = new field_category();
    $theme_category->name = get_string('userset_theme_category', 'elisprogram_usetthemes');
    //set up the theme priority field
    $theme_priority_field = new field();
    $theme_priority_field->shortname = '_elis_userset_themepriority';
    $theme_priority_field->name = get_string('userset_theme_priority', 'elisprogram_usetthemes');
    $theme_priority_field->datatype = 'int';
    //set up the field and category
    $theme_priority_field = field::ensure_field_exists_for_context_level($theme_priority_field, CONTEXT_ELIS_USERSET, $theme_category);
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'text', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_usetthemes/_elis_userset_themepriority');
    field_owner::ensure_field_owner_exists($theme_priority_field, 'manual', $owner_options);
    //set up the field for selecting the applicable theme
    $theme_field = new field();
    $theme_field->shortname = '_elis_userset_theme';
    $theme_field->name = get_string('userset_theme', 'elisprogram_usetthemes');
    $theme_field->datatype = 'char';
    //set up the field and category
    $theme_field = field::ensure_field_exists_for_context_level($theme_field, CONTEXT_ELIS_USERSET, $theme_category);
    $owner_options = array('control' => 'menu', 'options_source' => 'themes', 'required' => 0, 'edit_capability' => '', 'view_capability' => '', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_usetthemes/_elis_userset_theme');
    field_owner::ensure_field_owner_exists($theme_field, 'manual', $owner_options);
    return true;
}
Exemple #2
0
/**
 * Sets up the fields necessary for enabling cluster groups
 *
 * @return  boolean  Returns true to indicate success
 */
function xmldb_elisprogram_usetgroups_install()
{
    // Migrate component.
    $oldcmp = 'pmplugins_userset_groups';
    $newcmp = 'elisprogram_usetgroups';
    $upgradestepfuncname = 'elisprogram_usetgroups_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    //set up the cluster group category
    $group_category = new field_category();
    $group_category->name = get_string('userset_group_category', 'elisprogram_usetgroups');
    //set up the field that allows users to turn the groupings on
    $group_field = new field();
    $group_field->shortname = 'userset_group';
    $group_field->name = get_string('userset_group', 'elisprogram_usetgroups');
    $group_field->datatype = 'bool';
    //set up the field and category
    $group_field = field::ensure_field_exists_for_context_level($group_field, CONTEXT_ELIS_USERSET, $group_category);
    //set up the field owner
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'checkbox', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_usetgroups/userset_group');
    field_owner::ensure_field_owner_exists($group_field, 'manual', $owner_options);
    $field = new field();
    $field->shortname = 'userset_groupings';
    $field->name = get_string('autoenrol_groupings', 'elisprogram_usetclassify');
    $field->datatype = 'bool';
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_USERSET, $group_category);
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'checkbox', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_usetgroups/autoenrol_groupings');
    field_owner::ensure_field_owner_exists($field, 'manual', $owner_options);
    return true;
}
Exemple #3
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_usetdisppriority_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    // Migrate component.
    $oldcmp = 'pmplugins_userset_display_priority';
    $newcmp = 'elisprogram_usetdisppriority';
    $upgradestepfuncname = 'elisprogram_usetdisppriority_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    $field = new field();
    $field->shortname = USERSET_DISPLAY_PRIORITY_FIELD;
    $field->name = get_string('display_priority_field_name', 'elisprogram_usetdisppriority');
    $field->datatype = 'int';
    $category = new field_category();
    $category->name = get_string('display_settings_category_name', 'elisprogram_usetdisppriority');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_USERSET, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'text';
        $owner->param_options_source = 'userset_display_priority';
        $owner->param_help_file = 'elisprogram_usetdisppriority/display_priority';
        $owner->save();
    }
    return true;
}
Exemple #4
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_usetclassify_install()
{
    global $CFG, $DB;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    require_once elispm::file('plugins/usetclassify/usersetclassification.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_userset_classification';
    $newcmp = 'elisprogram_usetclassify';
    $upgradestepfuncname = 'elisprogram_usetclassify_pre26upgradesteps';
    $tablechanges = array('crlm_cluster_classification' => 'elisprogram_usetclassify');
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname, $tablechanges);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    $field = new field();
    $field->shortname = USERSET_CLASSIFICATION_FIELD;
    $field->name = get_string('classification_field_name', 'elisprogram_usetclassify');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('classification_category_name', 'elisprogram_usetclassify');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_USERSET, $category);
    // make sure we're set as owner
    if (!isset($field->owners['userset_classifications'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'userset_classifications';
        $owner->save();
    }
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = 'moodle/user:update';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'userset_classifications';
        $owner->param_help_file = 'elisprogram_usetclassify/cluster_classification';
        $owner->save();
    }
    // make sure we have a default value set
    if (!field_data::get_for_context_and_field(NULL, $field)) {
        field_data::set_for_context_and_field(NULL, $field, 'regular');
    }
    $regclassify = $DB->get_record(usersetclassification::TABLE, array('shortname' => 'regular'));
    if (empty($regclassify)) {
        $default = new usersetclassification();
        $default->shortname = 'regular';
        $default->name = get_string('cluster', 'local_elisprogram');
        $default->param_autoenrol_curricula = 1;
        $default->param_autoenrol_tracks = 1;
        $default->save();
    }
    return true;
}
Exemple #5
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_preposttest_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_pre_post_test';
    $newcmp = 'elisprogram_preposttest';
    $upgradestepfuncname = 'elisprogram_preposttest_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    // Pre-test field
    $field = new field();
    $field->shortname = PRE_TEST_FIELD;
    $field->name = get_string('pre_test_field_name', 'elisprogram_preposttest');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('pre_post_test_category_name', 'elisprogram_preposttest');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_COURSE, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'learning_objectives';
        $owner->param_help_file = 'elisprogram_preposttest/pre_test';
        $owner->save();
    }
    // Post-test field
    $field = new field();
    $field->shortname = POST_TEST_FIELD;
    $field->name = get_string('post_test_field_name', 'elisprogram_preposttest');
    $field->datatype = 'char';
    $category = new field_category();
    $category->name = get_string('pre_post_test_category_name', 'elisprogram_preposttest');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_COURSE, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'menu';
        $owner->param_options_source = 'learning_objectives';
        $owner->param_help_file = 'elisprogram_preposttest/post_test';
        $owner->save();
    }
    return true;
}
Exemple #6
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_usetenrol_moodleprofile_install()
{
    // Migrate component.
    $oldcmp = 'usersetenrol_moodle_profile';
    $newcmp = 'usetenrol_moodleprofile';
    $upgradestepfuncname = 'usetenrol_moodleprofile_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
}
Exemple #7
0
 /**
  * Test checking for the old component.
  */
 public function test_old_component_installed()
 {
     global $DB;
     $oldcomponent = 'testcomponent';
     $migrator = new \local_eliscore\install\migration\migrator('testcomponent', 'newcomponent');
     $this->assertFalse($migrator->old_component_installed());
     // Test correct component search.
     $rec = new \stdClass();
     $rec->name = 'version';
     $rec->value = 20140213;
     $rec->plugin = 'testcomponent2';
     $rec->id = $DB->insert_record('config_plugins', $rec);
     $this->assertFalse($migrator->old_component_installed());
     // Test correct config name search.
     $rec = new \stdClass();
     $rec->name = 'version2';
     $rec->value = 20140213;
     $rec->plugin = 'testcomponent';
     $rec->id = $DB->insert_record('config_plugins', $rec);
     $this->assertFalse($migrator->old_component_installed());
     // Test correct version test.
     $rec = new \stdClass();
     $rec->name = 'version';
     $rec->value = '';
     $rec->plugin = 'testcomponent';
     $rec->id = $DB->insert_record('config_plugins', $rec);
     $this->assertFalse($migrator->old_component_installed());
     $DB->delete_records('config_plugins', array('id' => $rec->id));
     // Test successful check.
     $rec = new \stdClass();
     $rec->name = 'version';
     $rec->value = 20140213;
     $rec->plugin = 'testcomponent';
     $rec->id = $DB->insert_record('config_plugins', $rec);
     $this->assertTrue($migrator->old_component_installed());
 }
Exemple #8
0
/**
 * ELIS(TM): Enterprise Learning Intelligence Suite
 * Copyright (C) 2008-2014 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    block_elisadmin
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @copyright  (C) 2008-2014 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
function xmldb_block_elisadmin_install()
{
    global $DB;
    // Migrate component.
    $oldcmp = 'block_curr_admin';
    $newcmp = 'block_elisadmin';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    // Update instances.
    $sql = 'UPDATE {block_instances} SET blockname = ? WHERE blockname = ?';
    $params = array('elisadmin', 'curr_admin');
    $DB->execute($sql, $params);
    $java_app = new stdClass();
    $java_app->name = 'java';
    $java_app->display_name = 'Java servlet';
    $java_app->xmlrpc_server_url = '/mnet/server';
    $java_app->sso_land_url = '/mnet/land.jsp';
    $DB->insert_record('mnet_application', $java_app);
}
Exemple #9
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_enrolrolesync_install()
{
    // Migrate component.
    $oldcmp = 'pmplugins_enrolment_role_sync';
    $newcmp = 'elisprogram_enrolrolesync';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    //set the student role based on the old value
    $old_student_roleid = get_config('local_elisprogram', 'enrolment_role_sync_student_role');
    if ($old_student_roleid !== null) {
        set_config('student_role', $old_student_roleid, 'elisprogram_enrolrolesync');
    }
    //set the instructor role based on the old value
    $old_instructor_roleid = get_config('local_elisprogram', 'enrolment_role_sync_instructor_role');
    if ($old_instructor_roleid !== null) {
        set_config('instructor_role', $old_instructor_roleid, 'elisprogram_enrolrolesync');
    }
    return true;
}
Exemple #10
0
/**
 * Install function for this plugin
 *
 * @return  boolean  true  Returns true to satisfy install procedure
 */
function xmldb_elisprogram_archive_install()
{
    global $CFG;
    require_once elispm::lib('setup.php');
    require_once elis::lib('data/customfield.class.php');
    // Migrate component.
    $oldcmp = 'pmplugins_archive';
    $newcmp = 'elisprogram_archive';
    $upgradestepfuncname = 'elisprogram_archive_pre26upgradesteps';
    $migrator = new \local_eliscore\install\migration\migrator($oldcmp, $newcmp, $upgradestepfuncname);
    if ($migrator->old_component_installed() === true) {
        $migrator->migrate();
    }
    // Archive field
    $field = new field();
    $field->shortname = ARCHIVE_FIELD;
    $field->name = get_string('archive_field_name', 'elisprogram_archive');
    $field->datatype = 'bool';
    $category = new field_category();
    $category->name = get_string('archive_category_name', 'elisprogram_archive');
    $field = field::ensure_field_exists_for_context_level($field, CONTEXT_ELIS_PROGRAM, $category);
    // make sure 'manual' is an owner
    if (!isset($field->owners['manual'])) {
        $owner = new field_owner();
        $owner->fieldid = $field->id;
        $owner->plugin = 'manual';
        $owner->param_required = 0;
        $owner->param_view_capability = '';
        $owner->param_edit_capability = '';
        $owner->param_control = 'checkbox';
        $owner->param_options_source = '';
        $owner->param_help_file = 'elisprogram_archive/archive_program';
        $owner->save();
    }
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'checkbox', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'elisprogram_archive/archive_program');
    field_owner::ensure_field_owner_exists($field, 'manual', $owner_options);
    return true;
}