• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_default_enrol_roles函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_default_enrol_roles函数的典型用法代码示例。如果您正苦于以下问题:PHP get_default_enrol_roles函数的具体用法?PHP get_default_enrol_roles怎么用?PHP get_default_enrol_roles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_default_enrol_roles函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_apply'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $mform->setType('name', PARAM_TEXT);
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_apply'), $options);
     //$mform->addHelpButton('status', 'status', 'enrol_apply');
     $mform->setDefault('status', $plugin->get_config('status'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('defaultrole', 'role'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('textarea', 'customtext1', get_string('editdescription', 'enrol_apply'));
     $mform->addElement('select', 'customint1', get_string('show_standard_user_profile', 'enrol_apply'), $options);
     $mform->setDefault('customint1', $plugin->get_config('customint1'));
     $mform->addElement('select', 'customint2', get_string('show_extra_user_profile', 'enrol_apply'), $options);
     $mform->setDefault('customint2', $plugin->get_config('customint2'));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:alendit,项目名称:moodle-enrol_apply,代码行数:30,代码来源:edit_form.php


示例2: definition

 public function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_license'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_license'), $options);
     $mform->addHelpButton('status', 'status', 'enrol_license');
     $mform->setDefault('status', $plugin->get_config('status'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('role', 'enrol_license'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $options = array(0 => get_string('never'), 1800 * 3600 * 24 => get_string('numdays', '', 1800), 1000 * 3600 * 24 => get_string('numdays', '', 1000), 365 * 3600 * 24 => get_string('numdays', '', 365), 180 * 3600 * 24 => get_string('numdays', '', 180), 150 * 3600 * 24 => get_string('numdays', '', 150), 120 * 3600 * 24 => get_string('numdays', '', 120), 90 * 3600 * 24 => get_string('numdays', '', 90), 60 * 3600 * 24 => get_string('numdays', '', 60), 30 * 3600 * 24 => get_string('numdays', '', 30), 21 * 3600 * 24 => get_string('numdays', '', 21), 14 * 3600 * 24 => get_string('numdays', '', 14), 7 * 3600 * 24 => get_string('numdays', '', 7));
     $mform->addElement('select', 'customint2', get_string('longtimenosee', 'enrol_license'), $options);
     $mform->setDefault('customint2', $plugin->get_config('longtimenosee'));
     $mform->addHelpButton('customint2', 'longtimenosee', 'enrol_license');
     $mform->addElement('advcheckbox', 'customint4', get_string('sendcoursewelcomemessage', 'enrol_license'));
     $mform->setDefault('customint4', $plugin->get_config('sendcoursewelcomemessage'));
     $mform->addHelpButton('customint4', 'sendcoursewelcomemessage', 'enrol_license');
     $mform->addElement('textarea', 'customtext1', get_string('customwelcomemessage', 'enrol_license'), array('cols' => '60', 'rows' => '8'));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:32,代码来源:edit_form.php


示例3: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_manual'));
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_manual'), $options);
     $mform->addHelpButton('status', 'status', 'enrol_manual');
     $mform->setDefault('status', $plugin->get_config('status'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('defaultrole', 'role'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('duration', 'enrolperiod', get_string('defaultperiod', 'enrol_manual'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
     $mform->addHelpButton('enrolperiod', 'defaultperiod', 'enrol_manual');
     $options = array(0 => get_string('no'), 1 => get_string('expirynotifyenroller', 'core_enrol'), 2 => get_string('expirynotifyall', 'core_enrol'));
     $mform->addElement('select', 'expirynotify', get_string('expirynotify', 'core_enrol'), $options);
     $mform->addHelpButton('expirynotify', 'expirynotify', 'core_enrol');
     $mform->addElement('duration', 'expirythreshold', get_string('expirythreshold', 'core_enrol'), array('optional' => false, 'defaultunit' => 86400));
     $mform->addHelpButton('expirythreshold', 'expirythreshold', 'core_enrol');
     $mform->disabledIf('expirythreshold', 'expirynotify', 'eq', 0);
     $mform->addElement('hidden', 'courseid');
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:Burick,项目名称:moodle,代码行数:29,代码来源:edit_form.php


示例4: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_paypal'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_paypal'), $options);
     $mform->setDefault('status', $plugin->get_config('status'));
     $mform->addElement('text', 'cost', get_string('cost', 'enrol_paypal'), array('size' => 4));
     $mform->setDefault('cost', $plugin->get_config('cost'));
     $paypalcurrencies = array('USD' => 'US Dollars', 'EUR' => 'Euros', 'JPY' => 'Japanese Yen', 'GBP' => 'British Pounds', 'CAD' => 'Canadian Dollars', 'AUD' => 'Australian Dollars');
     $mform->addElement('select', 'currency', get_string('currency', 'enrol_paypal'), $paypalcurrencies);
     $mform->setDefault('currency', $plugin->get_config('currency'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('assignrole', 'enrol_paypal'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'enrol_paypal'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
     $mform->addHelpButton('enrolperiod', 'enrolperiod', 'enrol_paypal');
     $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_paypal'), array('optional' => true));
     $mform->setDefault('enrolstartdate', 0);
     $mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'enrol_paypal');
     $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_paypal'), array('optional' => true));
     $mform->setDefault('enrolenddate', 0);
     $mform->addHelpButton('enrolenddate', 'enrolenddate', 'enrol_paypal');
     $mform->addElement('hidden', 'id');
     $mform->addElement('hidden', 'courseid');
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:35,代码来源:edit_form.php


示例5: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_alipay'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_alipay'), $options);
     $mform->setDefault('status', $plugin->get_config('status'));
     $mform->addElement('text', 'cost', get_string('cost', 'enrol_alipay'), array('size' => 4));
     $mform->setDefault('cost', $plugin->get_config('cost'));
     $alipaycurrencies = array('RMB' => 'China Yuan');
     $mform->addElement('select', 'currency', get_string('currency', 'enrol_alipay'), $alipaycurrencies);
     $mform->setDefault('currency', $plugin->get_config('currency'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('assignrole', 'enrol_alipay'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'enrol_alipay'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
     $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_alipay'), array('optional' => true));
     $mform->setDefault('enrolstartdate', 0);
     $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_alipay'), array('optional' => true));
     $mform->setDefault('enrolenddate', 0);
     $mform->addElement('hidden', 'id');
     $mform->addElement('hidden', 'courseid');
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:huanle0610,项目名称:moodledameon,代码行数:32,代码来源:edit_form.php


示例6: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_attributes'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $mform->setType('name', PARAM_TEXT);
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('default_roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('role'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('default_roleid'));
     $mform->addElement('textarea', 'customtext1', get_string('attrsyntax', 'enrol_attributes'), array('cols' => '60', 'rows' => '8'));
     $mform->addHelpButton('customtext1', 'attrsyntax', 'enrol_attributes');
     $mform->addElement('checkbox', 'customint1', get_string('removewhenexpired', 'enrol_attributes'));
     $mform->addHelpButton('customint1', 'removewhenexpired', 'enrol_attributes');
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:ndunand,项目名称:moodle-enrol_attributes,代码行数:25,代码来源:edit_form.php


示例7: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_globalclassroom'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_globalclassroom'), $options);
     $mform->setDefault('status', $plugin->get_config('status'));
     $mform->addElement('passwordunmask', 'password', get_string('password', 'enrol_globalclassroom'));
     $mform->addHelpButton('password', 'password', 'enrol_globalclassroom');
     if (empty($instance->id) and $plugin->get_config('requirepassword')) {
         $mform->addRule('password', get_string('required'), 'required', null, 'client');
     }
     $options = array(1 => get_string('yes'), 0 => get_string('no'));
     $mform->addElement('select', 'customint1', get_string('groupkey', 'enrol_globalclassroom'), $options);
     $mform->addHelpButton('customint1', 'groupkey', 'enrol_globalclassroom');
     $mform->setDefault('customint1', $plugin->get_config('groupkey'));
     $options = array(1 => get_string('yes'), 0 => get_string('no'));
     $mform->addElement('select', 'customchar1', get_string('freeformembers', 'enrol_globalclassroom'), $options);
     $mform->setDefault('customchar1', $plugin->get_config('freeformembers'));
     $mform->addElement('text', 'cost', get_string('cost', 'enrol_globalclassroom'), array('size' => 4));
     $mform->setDefault('cost', $plugin->get_config('cost'));
     $paypalcurrencies = array('USD' => 'US Dollars', 'EUR' => 'Euros', 'JPY' => 'Japanese Yen', 'GBP' => 'British Pounds', 'CAD' => 'Canadian Dollars', 'AUD' => 'Australian Dollars');
     $mform->addElement('select', 'currency', get_string('currency', 'enrol_globalclassroom'), $paypalcurrencies);
     $mform->setDefault('currency', $plugin->get_config('currency'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('assignrole', 'enrol_globalclassroom'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'enrol_globalclassroom'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
     $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_globalclassroom'), array('optional' => true));
     $mform->setDefault('enrolstartdate', 0);
     $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_globalclassroom'), array('optional' => true));
     $mform->setDefault('enrolenddate', 0);
     $options = array(0 => get_string('never'), 1800 * 3600 * 24 => get_string('numdays', '', 1800), 1000 * 3600 * 24 => get_string('numdays', '', 1000), 365 * 3600 * 24 => get_string('numdays', '', 365), 180 * 3600 * 24 => get_string('numdays', '', 180), 150 * 3600 * 24 => get_string('numdays', '', 150), 120 * 3600 * 24 => get_string('numdays', '', 120), 90 * 3600 * 24 => get_string('numdays', '', 90), 60 * 3600 * 24 => get_string('numdays', '', 60), 30 * 3600 * 24 => get_string('numdays', '', 30), 21 * 3600 * 24 => get_string('numdays', '', 21), 14 * 3600 * 24 => get_string('numdays', '', 14), 7 * 3600 * 24 => get_string('numdays', '', 7));
     $mform->addElement('select', 'customint2', get_string('longtimenosee', 'enrol_globalclassroom'), $options);
     $mform->setDefault('customint2', $plugin->get_config('longtimenosee'));
     $mform->addHelpButton('customint2', 'longtimenosee', 'enrol_globalclassroom');
     $mform->addElement('text', 'customint3', get_string('maxenrolled', 'enrol_globalclassroom'));
     $mform->setDefault('customint3', $plugin->get_config('maxenrolled'));
     $mform->addHelpButton('customint3', 'maxenrolled', 'enrol_globalclassroom');
     $mform->setType('customint3', PARAM_INT);
     $mform->addElement('advcheckbox', 'customint4', get_string('sendcoursewelcomemessage', 'enrol_globalclassroom'));
     $mform->setDefault('customint4', $plugin->get_config('sendcoursewelcomemessage'));
     $mform->addHelpButton('customint4', 'sendcoursewelcomemessage', 'enrol_globalclassroom');
     $mform->addElement('textarea', 'customtext1', get_string('customwelcomemessage', 'enrol_globalclassroom'), array('cols' => '60', 'rows' => '8'));
     $mform->addElement('hidden', 'id');
     $mform->addElement('hidden', 'courseid');
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:56,代码来源:edit_form.php


示例8: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_ipay'));
     $mform->addElement('text', 'name', get_string('custominstancename', 'enrol'));
     $mform->setType('name', PARAM_TEXT);
     $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), ENROL_INSTANCE_DISABLED => get_string('no'));
     $mform->addElement('select', 'status', get_string('status', 'enrol_ipay'), $options);
     $mform->setDefault('status', $plugin->get_config('status'));
     $mform->addElement('text', 'businessname', get_string('businessname', 'enrol_ipay'));
     $mform->setType('businessname', PARAM_TEXT);
     // test if i can see business name
     $mform->setDefault('businessname', $plugin->get_config('businessname'));
     //this faetches from the configured setings the business name
     $mform->addElement('text', 'cost', get_string('cost', 'enrol_ipay'), array('size' => 4));
     $mform->setType('cost', PARAM_RAW);
     // Use unformat_float to get real value.
     $mform->setDefault('cost', format_float($plugin->get_config('cost'), 2, true));
     $ipaycurrencies = $plugin->get_currencies();
     $mform->addElement('select', 'currency', get_string('currency', 'enrol_ipay'), $ipaycurrencies);
     $mform->setDefault('currency', $plugin->get_config('currency'));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('assignrole', 'enrol_ipay'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'enrol_ipay'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', $plugin->get_config('enrolperiod'));
     $mform->addHelpButton('enrolperiod', 'enrolperiod', 'enrol_ipay');
     $mform->addElement('date_time_selector', 'enrolstartdate', get_string('enrolstartdate', 'enrol_ipay'), array('optional' => true));
     $mform->setDefault('enrolstartdate', 0);
     $mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'enrol_ipay');
     $mform->addElement('date_time_selector', 'enrolenddate', get_string('enrolenddate', 'enrol_ipay'), array('optional' => true));
     $mform->setDefault('enrolenddate', 0);
     $mform->addHelpButton('enrolenddate', 'enrolenddate', 'enrol_ipay');
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     if (enrol_accessing_via_instance($instance)) {
         $mform->addElement('static', 'selfwarn', get_string('instanceeditselfwarning', 'core_enrol'), get_string('instanceeditselfwarningtext', 'core_enrol'));
     }
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:kiarie,项目名称:ipay,代码行数:48,代码来源:edit_form.php


示例9: definition

 function definition()
 {
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', get_string('pluginname', 'enrol_manual'));
     $mform->addElement('advcheckbox', enrol_elis_plugin::ENROL_FROM_COURSE_CATALOG_DB, get_string(enrol_elis_plugin::ENROL_FROM_COURSE_CATALOG_CONFIG, 'enrol_elis'));
     $mform->setDefault(enrol_elis_plugin::ENROL_FROM_COURSE_CATALOG_DB, $plugin->get_config(enrol_elis_plugin::ENROL_FROM_COURSE_CATALOG_CONFIG));
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $mform->addElement('select', 'roleid', get_string('defaultrole', 'role'), $roles);
     $mform->setDefault('roleid', $plugin->get_config('roleid'));
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     $this->add_action_buttons(true, $instance->id ? null : get_string('addinstance', 'enrol'));
     $this->set_data($instance);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:19,代码来源:edit_form.php


示例10: definition

 /**
  * Define the form.
  * 
  * @global moodle_database $DB
  */
 public function definition()
 {
     global $DB;
     /** @var moodle_form $mform */
     $mform = $this->_form;
     list($instance, $plugin, $context) = $this->_customdata;
     $mform->addElement('header', 'header', 'Mandatory Enrolment');
     // Roles
     $roles = get_default_enrol_roles($context, $instance->id ? $instance->roleid : null);
     $mform->addElement('select', 'roleid', 'Role', $roles);
     $mform->setDefault('roleid', $plugin->get_config('default_roleid'));
     // Hidden values for convenience
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     // Buttons
     $this->add_action_buttons();
     $this->set_data($instance);
 }
开发者ID:HCPSS,项目名称:moodle-enrol_mandatory,代码行数:25,代码来源:edit_form.php


示例11: add_general_section

 /**
  * @param $instance
  * @param $plugin
  * @param $context
  *
  * @throws coding_exception
  */
 protected function add_general_section($instance, $plugin, $context)
 {
     global $CFG, $OUTPUT;
     $this->_form->addElement('header', 'generalsection', get_string('general', 'enrol_autoenrol'));
     $this->_form->setExpanded('generalsection');
     $img = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('logo', 'enrol_autoenrol'), 'alt' => 'AutoEnrol Logo', 'title' => 'AutoEnrol Logo'));
     $img = html_writer::div($img, null, array('style' => 'text-align:center;margin: 1em 0;'));
     $this->_form->addElement('html', $img);
     $this->_form->addElement('static', 'description', html_writer::tag('strong', get_string('warning', 'enrol_autoenrol')), get_string('warning_message', 'enrol_autoenrol'));
     $this->_form->addElement('text', 'customchar2', get_string('instancename', 'enrol_autoenrol'));
     $this->_form->setType('customchar2', PARAM_TEXT);
     $this->_form->setDefault('customchar2', '');
     $this->_form->addHelpButton('customchar2', 'instancename', 'enrol_autoenrol');
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $plugin->get_config('roleid'));
     }
     $this->_form->addElement('select', 'customint3', get_string('role', 'enrol_autoenrol'), $roles);
     $this->_form->setAdvanced('customint3');
     $this->_form->addHelpButton('customint3', 'role', 'enrol_autoenrol');
     if (!has_capability('enrol/autoenrol:method', $context)) {
         $this->_form->disabledIf('customint3', 'customint2');
     }
     $this->_form->setDefault('customint3', $plugin->get_config('defaultrole'));
     $this->_form->setType('customint3', PARAM_INT);
     $method = array(get_string('m_course', 'enrol_autoenrol'), get_string('m_site', 'enrol_autoenrol'));
     $this->_form->addElement('select', 'customint1', get_string('method', 'enrol_autoenrol'), $method);
     if (!has_capability('enrol/autoenrol:method', $context)) {
         $this->_form->disabledIf('customint1', 'customint2');
     }
     $this->_form->setAdvanced('customint1');
     $this->_form->setType('customint1', PARAM_INT);
     $this->_form->addHelpButton('customint1', 'method', 'enrol_autoenrol');
     $this->_form->addElement('selectyesno', 'customint8', get_string('alwaysenrol', 'enrol_autoenrol'));
     $this->_form->setAdvanced('customint8');
     $this->_form->setType('customint8', PARAM_INT);
     $this->_form->setDefault('customint8', 0);
     $this->_form->addHelpButton('customint8', 'alwaysenrol', 'enrol_autoenrol');
 }
开发者ID:rboyatt,项目名称:enrol_autoenrol,代码行数:47,代码来源:edit_form.php


示例12: defined

// Moodle 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.
//
// Moodle 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 Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Cohort enrolment plugin settings and default values
 *
 * @package    enrol_mnet
 * @copyright  2010 David Mudrak <[email protected]>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    //--- general settings -----------------------------------------------------------------------------------
    $settings->add(new admin_setting_heading('enrol_mnet_settings', '', get_string('pluginname_desc', 'enrol_mnet')));
    //--- enrol instance defaults ----------------------------------------------------------------------------
    if (!during_initial_install()) {
        $options = get_default_enrol_roles(context_system::instance());
        $student = get_archetype_roles('student');
        $student = reset($student);
        $settings->add(new admin_setting_configselect_with_advanced('enrol_mnet/roleid', get_string('defaultrole', 'role'), '', array('value' => $student->id, 'adv' => true), $options));
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:settings.php


示例13: defined

// (at your option) any later version.
//
// Moodle 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 Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Cohort enrolment plugin settings and presets.
 *
 * @package    enrol
 * @subpackage cohort
 * @copyright  2010 Petr Skoda {@link http://skodak.org}
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    //--- general settings -----------------------------------------------------------------------------------
    $settings->add(new admin_setting_heading('enrol_cohort_settings', '', get_string('pluginname_desc', 'enrol_cohort')));
    //--- enrol instance defaults ----------------------------------------------------------------------------
    if (!during_initial_install()) {
        $options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
        $student = get_archetype_roles('student');
        $student = reset($student);
        $settings->add(new admin_setting_configselect('enrol_cohort/roleid', get_string('defaultrole', 'role'), '', $student->id, $options));
        $options = array(ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'));
        $settings->add(new admin_setting_configselect('enrol_cohort/unenrolaction', get_string('extremovedaction', 'enrol'), get_string('extremovedaction_help', 'enrol'), ENROL_EXT_REMOVED_UNENROL, $options));
    }
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:settings.php


示例14: get_roles

 /**
  * Returns an array of available roles
  * @return array of availble roles
  */
 function get_roles()
 {
     $context = context_system::instance();
     $roles = array(0 => get_string('anyrole', 'filters')) + get_default_enrol_roles($context);
     return $roles;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:10,代码来源:courserole.php


示例15: test_get_default_enrol_roles

 /**
  * Test default enrol roles.
  */
 public function test_get_default_enrol_roles()
 {
     $this->resetAfterTest();
     $course = $this->getDataGenerator()->create_course();
     $coursecontext = context_course::instance($course->id);
     $id2 = create_role('New student role', 'student2', 'New student description', 'student');
     set_role_contextlevels($id2, array(CONTEXT_COURSE));
     $allroles = get_all_roles();
     $expected = array($id2 => $allroles[$id2]);
     foreach (get_role_archetypes() as $archetype) {
         $defaults = get_default_contextlevels($archetype);
         if (in_array(CONTEXT_COURSE, $defaults)) {
             $roles = get_archetype_roles($archetype);
             foreach ($roles as $role) {
                 $expected[$role->id] = $role;
             }
         }
     }
     $roles = get_default_enrol_roles($coursecontext);
     foreach ($allroles as $role) {
         $this->assertEquals(isset($expected[$role->id]), isset($roles[$role->id]));
         if (isset($roles[$role->id])) {
             $this->assertSame(role_get_name($role, $coursecontext), $roles[$role->id]);
         }
     }
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:29,代码来源:accesslib_test.php


示例16: get_roles

 /**
  * Returns an array of available roles
  * @return array of availble roles
  */
 function get_roles()
 {
     $context = get_context_instance(CONTEXT_SYSTEM);
     $roles = array(0 => get_string('anyrole', 'filters')) + get_default_enrol_roles($context);
     return $roles;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:10,代码来源:courserole.php


示例17: prepare_notice_object

/**
 * Setups the object used in the notice strings for when a user is accepting
 * a site invitation.
 *
 * @param object $invitation
 * @return object
 */
function prepare_notice_object($invitation)
{
    global $CFG, $course, $DB;
    $noticeobject = new stdClass();
    $noticeobject->email = $invitation->email;
    $noticeobject->coursefullname = $course->fullname;
    $noticeobject->supportemail = $CFG->supportemail;
    // Get role name for use in acceptance message.
    //role name is no longer defined in `role` table. It is scattered around database.
    $context = context_course::instance($course->id);
    $roles = get_default_enrol_roles($context);
    //fetching roles using API
    if (array_key_exists($invitation->roleid, $roles)) {
        //Normally we should have roles here
        $noticeobject->rolename = $roles[$invitation->roleid];
    } else {
        //In case something gone wrong we will do this the old way
        $role = $DB->get_record('role', array('id' => $invitation->roleid));
        $noticeobject->rolename = $role->name;
        //empty in new Moodle versions
        // role description is not used anywhere in plugin
        // and is also empty in new Moodle versions
        $noticeobject->roledescription = strip_tags($role->description);
    }
    return $noticeobject;
}
开发者ID:GaoxinHuang,项目名称:moodle-enrol_invitation,代码行数:33,代码来源:locallib.php


示例18: get_roleid_options

 /**
  * Return an array of valid options for the roleid.
  *
  * @param stdClass $instance
  * @param context $context
  * @return array
  */
 protected function get_roleid_options($instance, $context)
 {
     if ($instance->id) {
         $roles = get_default_enrol_roles($context, $instance->roleid);
     } else {
         $roles = get_default_enrol_roles($context, $this->get_config('roleid'));
     }
     return $roles;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:lib.php



注:本文中的get_default_enrol_roles函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_default_feed函数代码示例发布时间:2022-05-15
下一篇:
PHP get_default_course_role函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap