/** * 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 curriculummanagement * @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 * */ function xmldb_crlm_cluster_themes_upgrade($oldversion = 0) { global $CFG, $THEME, $db; $result = true; if ($result && $oldversion < 2010080602) { require_once $CFG->dirroot . '/curriculum/lib/customfield.class.php'; require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/lib.php'; require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/clusterclassification.class.php'; //theme priority $theme_priority_field = new field(field::get_for_context_level_with_name('cluster', 'cluster_themepriority')); if (isset($theme_priority_field->owners['manual'])) { $theme_priority_owner = new field_owner($theme_priority_field->owners['manual']); $theme_priority_owner->param_help_file = 'crlm_cluster_themes/cluster_themepriority'; $theme_priority_owner->update(); } //theme selection $theme_field = new field(field::get_for_context_level_with_name('cluster', 'cluster_theme')); if (isset($theme_field->owners['manual'])) { $theme_owner = new field_owner($theme_field->owners['manual']); $theme_owner->param_help_file = 'crlm_cluster_themes/cluster_theme'; $theme_owner->update(); } } return $result; }
/** * 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 curriculummanagement * @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 * */ function xmldb_crlm_cluster_groups_upgrade($oldversion = 0) { global $CFG, $THEME, $db; $result = true; if ($result && $oldversion < 2010080602) { require_once $CFG->dirroot . '/curriculum/lib/customfield.class.php'; require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/lib.php'; require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/clusterclassification.class.php'; $field = new field(field::get_for_context_level_with_name('cluster', 'cluster_group')); if (isset($field->owners['manual'])) { $owner = new field_owner($field->owners['manual']); $owner->param_help_file = 'crlm_cluster_groups/cluster_groups'; $owner->update(); } } if ($result && $oldversion < 2010080603) { //retrieve the cluster context $context = context_level_base::get_custom_context_level('cluster', 'block_curr_admin'); //get the cluster classification category $category = new field_category(); $category->name = get_string('cluster_group_category', 'crlm_cluster_groups'); $field = new field(); $field->shortname = 'cluster_groupings'; $field->name = get_string('autoenrol_groupings', 'crlm_cluster_classification'); $field->datatype = 'bool'; $field = field::ensure_field_exists_for_context_level($field, $context, $category); $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'checkbox', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'crlm_cluster_groups/cluster_groupings'); field_owner::ensure_field_owner_exists($field, 'manual', $owner_options); } if ($result && $oldversion < 2010080604) { if ($field = new field(field::get_for_context_level_with_name('cluster', 'cluster_site_course_group'))) { $field->shortname = 'cluster_groupings'; $field->update(); } } return $result; }
function moodle_profile_field_save_form_data($form, $field, $data) { $level = $form->_customdata->required_param('level', PARAM_ACTION); if ($level != 'user') { return; } global $CURMAN; if ($data->moodle_profile_exclusive == cm_moodle_profile::sync_to_moodle || $data->moodle_profile_exclusive == cm_moodle_profile::sync_from_moodle) { if (isset($field->owners['moodle_profile'])) { $owner = new field_owner($field->owners['moodle_profile']); $owner->exclude = $data->moodle_profile_exclusive; $owner->update(); } else { $owner = new field_owner(); $owner->fieldid = $field->id; $owner->plugin = 'moodle_profile'; $owner->exclude = $data->moodle_profile_exclusive; $owner->add(); } unset($field->owners); // force reload of owners field sync_profile_field_with_moodle($field); } else { $CURMAN->db->delete_records(FIELDOWNERTABLE, 'fieldid', $field->id, 'plugin', 'moodle_profile'); } }
function manual_field_save_form_data($form, $field, $data) { if (isset($data->manual_field_enabled) && $data->manual_field_enabled) { if (isset($field->owners['manual'])) { $manual = new field_owner($field->owners['manual']); } else { $manual = new field_owner(); $manual->fieldid = $field->id; $manual->plugin = 'manual'; } if (isset($data->manual_field_required)) { $manual->param_required = $data->manual_field_required; } else { $manual->param_required = false; } $parameters = array('edit_capability', 'view_capability', 'control', 'options_source', 'options', 'columns', 'rows', 'maxlength', 'help_file'); foreach ($parameters as $param) { $dataname = "manual_field_{$param}"; if (isset($data->{$dataname})) { $manual->{"param_{$param}"} = stripslashes($data->{$dataname}); } } $manual->params = addslashes($manual->params); if (empty($manual->id)) { $manual->add(); } else { $manual->update(); } } else { global $CURMAN; $CURMAN->db->delete_records(FIELDOWNERTABLE, 'fieldid', $field->id, 'plugin', 'manual'); } }