Exemplo n.º 1
0
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $mnetprofileimportfields = '';
     if (isset($CFG->mnetprofileimportfields)) {
         $mnetprofileimportfields = str_replace(',', ', ', $CFG->mnetprofileimportfields);
     }
     $mnetprofileexportfields = '';
     if (isset($CFG->mnetprofileexportfields)) {
         $mnetprofileexportfields = str_replace(',', ', ', $CFG->mnetprofileexportfields);
     }
     $mform->addElement('hidden', 'hostid', $this->_customdata['hostid']);
     $mform->setType('hostid', PARAM_INT);
     $fields = mnet_profile_field_options();
     // Fields to import ----------------------------------------------------
     $mform->addElement('header', 'import', get_string('importfields', 'mnet'));
     $select = $mform->addElement('select', 'importfields', get_string('importfields', 'mnet'), $fields['optional']);
     $select->setMultiple(true);
     $mform->addElement('checkbox', 'importdefault', get_string('leavedefault', 'mnet'), $mnetprofileimportfields);
     // Fields to export ----------------------------------------------------
     $mform->addElement('header', 'export', get_string('exportfields', 'mnet'));
     $select = $mform->addElement('select', 'exportfields', get_string('exportfields', 'mnet'), $fields['optional']);
     $select->setMultiple(true);
     $mform->addElement('checkbox', 'exportdefault', get_string('leavedefault', 'mnet'), $mnetprofileexportfields);
     $this->add_action_buttons();
 }
Exemplo n.º 2
0
<?php

// This file defines settingpages and externalpages under the "mnet" category
if ($hassiteconfig) {
    // speedup for non-admins, add all caps used on this page
    $ADMIN->add('mnet', new admin_externalpage('net', get_string('settings', 'mnet'), "{$CFG->wwwroot}/{$CFG->admin}/mnet/index.php", 'moodle/site:config'));
    $ADMIN->add('mnet', new admin_externalpage('mnetpeers', get_string('managemnetpeers', 'mnet'), "{$CFG->wwwroot}/{$CFG->admin}/mnet/peers.php", 'moodle/site:config'));
    $ADMIN->add('mnet', new admin_category('mnetpeercat', get_string('mnetpeers', 'mnet')));
    if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off') {
        require_once $CFG->dirroot . '/mnet/lib.php';
        $hosts = mnet_get_hosts();
        foreach ($hosts as $host) {
            if ($host->id == $CFG->mnet_all_hosts_id) {
                $host->name = get_string('allhosts', 'core_mnet');
            }
            $ADMIN->add('mnetpeercat', new admin_externalpage('mnetpeer' . $host->id, $host->name, $CFG->wwwroot . '/admin/mnet/peers.php?step=update&hostid=' . $host->id, 'moodle/site:config'));
        }
    }
    $ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', get_string('ssoaccesscontrol', 'mnet'), "{$CFG->wwwroot}/{$CFG->admin}/mnet/access_control.php", 'moodle/site:config'));
    $ADMIN->add('mnet', new admin_externalpage('mnetenrol', get_string('clientname', 'mnetservice_enrol'), "{$CFG->wwwroot}/mnet/service/enrol/index.php", 'moodle/site:config'));
    $ADMIN->add('mnet', new admin_externalpage('trustedhosts', get_string('trustedhosts', 'mnet'), "{$CFG->wwwroot}/{$CFG->admin}/mnet/trustedhosts.php", 'moodle/site:config'));
    if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off') {
        $profilefields = new admin_settingpage('mnetprofilefields', get_string('profilefields', 'mnet'), 'moodle/site:config');
        $ADMIN->add('mnet', $profilefields);
        $fields = mnet_profile_field_options();
        $forced = implode(', ', $fields['forced']);
        $profilefields->add(new admin_setting_configmultiselect('mnetprofileexportfields', get_string('profileexportfields', 'mnet'), get_string('profilefielddesc', 'mnet', $forced), $fields['legacy'], $fields['optional']));
        $profilefields->add(new admin_setting_configmultiselect('mnetprofileimportfields', get_string('profileimportfields', 'mnet'), get_string('profilefielddesc', 'mnet', $forced), $fields['legacy'], $fields['optional']));
    }
}
// end of speedup
Exemplo n.º 3
0
/**
 * helper for {@see mnet_fields_to_import} and {@mnet_fields_to_send}
 *
 * @access private
 *
 * @param mnet_peer $peer the peer object
 * @param string    $key 'import' or 'export'
 *
 * @return array (like 'username', 'firstname', etc)
 */
function _mnet_field_helper(mnet_peer $peer, $key) {
    $tmp = mnet_profile_field_options();
    $defaults = explode(',', get_config('moodle', 'mnetprofile' . $key . 'fields'));
    if ('1' === get_config('mnet', 'host' . $peer->id . $key . 'default')) {
        return array_merge($tmp['forced'], $defaults);
    }
    $hostsettings = get_config('mnet', 'host' . $peer->id . $key . 'fields');
    if (false === $hostsettings) {
        return array_merge($tmp['forced'], $defaults);
    }
    return array_merge($tmp['forced'], explode(',', $hostsettings));
}