Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/admin/mnet/profilefields.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 require(dirname(dirname(dirname(__FILE__))).'/config.php');
00028 require_once($CFG->libdir.'/adminlib.php');
00029 require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
00030 $mnet = get_mnet_environment();
00031 
00032 require_login();
00033 $hostid = required_param('hostid', PARAM_INT);
00034 $mnet_peer = new mnet_peer();
00035 $mnet_peer->set_id($hostid);
00036 
00037 $context = get_context_instance(CONTEXT_SYSTEM);
00038 
00039 require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
00040 admin_externalpage_setup('mnetpeers');
00041 $form = new mnet_profile_form(null, array('hostid' => $hostid));
00042 
00043 if ($data = $form->get_data()) {
00044     if (!isset($data->importdefault)) {
00045         $data->importdefault = 0;
00046     }
00047     if (!isset($data->exportdefault)) {
00048         $data->exportdefault = 0;
00049     }
00050     if (!isset($data->importfields)) {
00051         $data->importfields = array();
00052     }
00053     if (!isset($data->exportfields)) {
00054         $data->exportfields = array();
00055     }
00056     set_config('host' . $hostid . 'importdefault', $data->importdefault, 'mnet');
00057     set_config('host' . $hostid . 'importfields', implode(',', $data->importfields), 'mnet');
00058     set_config('host' . $hostid . 'exportdefault', $data->exportdefault, 'mnet');
00059     set_config('host' . $hostid . 'exportfields', implode(',', $data->exportfields), 'mnet');
00060 
00061     redirect(new moodle_url('/admin/mnet/peers.php'), get_string('changessaved'));
00062 } elseif ($form->is_cancelled()) {
00063     redirect(new moodle_url('/admin/mnet/peers.php', array('hostid' => $hostid)));
00064 }
00065 
00066 echo $OUTPUT->header();
00067 
00068 $currenttab = 'mnetprofilefields';
00069 require_once('tabs.php');
00070 
00071 echo $OUTPUT->heading(get_string('peerprofilefielddesc', 'mnet'), 4);
00072 
00073 $data = new Stdclass;
00074 $data->importdefault = get_config('mnet', 'host' . $hostid . 'importdefault');
00075 $data->exportdefault = get_config('mnet', 'host' . $hostid . 'exportdefault');
00076 $data->importfields = get_config('mnet', 'host' . $hostid . 'importfields');
00077 $data->exportfields = get_config('mnet', 'host' . $hostid . 'exportfields');
00078 
00079 if ($data->importfields === false) {
00080     $data->importdefault = true;
00081 } else {
00082     $data->importfields = explode(',', $data->importfields);
00083 }
00084 if ($data->exportfields === false) {
00085     $data->exportdefault = true;
00086 } else {
00087     $data->exportfields = explode(',', $data->exportfields);
00088 }
00089 
00090 $form->set_data($data);
00091 $form->display();
00092 
00093 echo $OUTPUT->footer();
 All Data Structures Namespaces Files Functions Variables Enumerations