本文整理汇总了PHP中profile_definition函数的典型用法代码示例。如果您正苦于以下问题:PHP profile_definition函数的具体用法?PHP profile_definition怎么用?PHP profile_definition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了profile_definition函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
function definition()
{
global $CFG, $COURSE;
$mform =& $this->_form;
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'course', $COURSE->id);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
/// shared fields
useredit_shared_definition($mform);
/// extra settigs
$mform->addRule('description', $strrequired, 'required', null, 'client');
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例2: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
$this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'course', $COURSE->id);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$modules = get_list_of_plugins('auth');
$auth_options = array();
foreach ($modules as $module) {
$auth_options[$module] = get_string("auth_{$module}" . "title", "auth");
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod', 'auth')));
$mform->setAdvanced('auth');
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->setHelpButton('newpassword', array('newpassword', get_string('leavetokeep')));
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->setHelpButton('preference_auth_forcepasswordchange', array('forcepasswordchange', get_string('forcepasswordchange')));
/// shared fields
useredit_shared_definition($mform);
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例3: definition
function definition()
{
global $CFG, $COURSE;
$mform =& $this->_form;
if (is_array($this->_customdata) && array_key_exists('editoroptions', $this->_customdata)) {
$editoroptions = $this->_customdata['editoroptions'];
} else {
$editoroptions = null;
}
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
/// shared fields
useredit_shared_definition($mform, $editoroptions);
/// extra settigs
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例4: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
$editoroptions = null;
$filemanageroptions = null;
$userid = $USER->id;
if (is_array($this->_customdata)) {
if (array_key_exists('editoroptions', $this->_customdata)) {
$editoroptions = $this->_customdata['editoroptions'];
}
if (array_key_exists('filemanageroptions', $this->_customdata)) {
$filemanageroptions = $this->_customdata['filemanageroptions'];
}
if (array_key_exists('userid', $this->_customdata)) {
$userid = $this->_customdata['userid'];
}
}
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$auths = get_plugin_list('auth');
$auth_options = array();
foreach ($auths as $auth => $unused) {
$auth_options[$auth] = get_string('pluginname', "auth_{$auth}");
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
$mform->addElement('advcheckbox', 'suspended', get_string('suspended', 'auth'));
$mform->addHelpButton('suspended', 'suspended', 'auth');
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->addHelpButton('newpassword', 'newpassword');
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->addHelpButton('preference_auth_forcepasswordchange', 'forcepasswordchange');
/// shared fields
useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
/// Next the customisable profile fields
profile_definition($mform, $userid);
if ($userid == -1) {
$btnstring = get_string('createuser');
} else {
$btnstring = get_string('updatemyprofile');
}
$this->add_action_buttons(false, $btnstring);
}
示例5: definition
/**
* Define the form.
*/
public function definition () {
global $CFG, $COURSE, $USER;
$mform = $this->_form;
$editoroptions = null;
$filemanageroptions = null;
if (!is_array($this->_customdata)) {
throw new coding_exception('invalid custom data for user_edit_form');
}
$editoroptions = $this->_customdata['editoroptions'];
$filemanageroptions = $this->_customdata['filemanageroptions'];
$user = $this->_customdata['user'];
$userid = $user->id;
if (empty($user->country)) {
// We must unset the value here so $CFG->country can be used as default one.
unset($user->country);
}
// Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
// Add some extra hidden fields.
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);
// Shared fields.
useredit_shared_definition($mform, $editoroptions, $filemanageroptions, $user);
// Extra settigs.
if (!empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
// Next the customisable profile fields.
profile_definition($mform, $userid);
$this->add_action_buttons(false, get_string('updatemyprofile'));
$this->set_data($user);
}
示例6: definition
function definition()
{
global $CFG, $COURSE;
$mform =& $this->_form;
$this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
/**
* *******************************************************
* TEOSSO auth patch to give the CPM profile link for users
* should be added after the 'header' element and before
* useredit_shared_definition($mform);
*/
// add link to joump to CPM user profile editing
global $USER;
if ($USER->auth == 'teosso') {
$profilestr = get_string('profile', 'auth_teosso');
$teosso_config = get_config('auth/teosso');
$link = "<a href=\"" . $teosso_config->cpm_edit_url . "\" target=\"_blank\">" . $profilestr . "</a>";
$mform->addElement('static', 'jump_to_cpm', get_string('profileedit', 'auth_teosso'), $link);
}
/// shared fields
useredit_shared_definition($mform);
/// extra settigs
$mform->addRule('description', $strrequired, 'required', null, 'client');
if (!empty($CFG->gdversion) and !empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例7: definition
/**
* Define the form.
*/
public function definition()
{
global $CFG, $COURSE, $USER;
$mform = $this->_form;
$editoroptions = null;
$filemanageroptions = null;
$userid = $USER->id;
if (is_array($this->_customdata)) {
if (array_key_exists('editoroptions', $this->_customdata)) {
$editoroptions = $this->_customdata['editoroptions'];
}
if (array_key_exists('filemanageroptions', $this->_customdata)) {
$filemanageroptions = $this->_customdata['filemanageroptions'];
}
if (array_key_exists('userid', $this->_customdata)) {
$userid = $this->_customdata['userid'];
}
}
// Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
// Add some extra hidden fields.
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);
// Shared fields.
useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
// Extra settigs.
if (!empty($CFG->disableuserimages)) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
// Next the customisable profile fields.
profile_definition($mform, $userid);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
示例8: definition
//.........这里部分代码省略.........
unset($teacherroles);
}
}
// default values
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'tool_uploaduser'));
$mform->addElement('text', 'username', get_string('uuusernametemplate', 'tool_uploaduser'), 'size="20"');
$mform->setType('username', PARAM_RAW);
// No cleaning here. The process verifies it later.
$mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client');
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE);
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE);
$mform->setForceLtr('username');
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
$mform->setType('email', PARAM_RAW);
// No cleaning here. The process verifies it later.
$mform->disabledIf('email', 'uutype', 'eq', UU_USER_ADD_UPDATE);
$mform->disabledIf('email', 'uutype', 'eq', UU_USER_UPDATE);
$mform->setForceLtr('email');
// only enabled and known to work plugins
$choices = uu_supported_auths();
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $choices);
$mform->setDefault('auth', 'manual');
// manual is a sensible backwards compatible default
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
$mform->setAdvanced('auth');
$choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
$mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
$mform->setDefault('maildisplay', core_user::get_property_default('maildisplay'));
$choices = array(0 => get_string('textformat'), 1 => get_string('htmlformat'));
$mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
$mform->setDefault('mailformat', core_user::get_property_default('mailformat'));
$mform->setAdvanced('mailformat');
$choices = array(0 => get_string('emaildigestoff'), 1 => get_string('emaildigestcomplete'), 2 => get_string('emaildigestsubjects'));
$mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
$mform->setDefault('maildigest', core_user::get_property_default('maildigest'));
$mform->setAdvanced('maildigest');
$choices = array(1 => get_string('autosubscribeyes'), 0 => get_string('autosubscribeno'));
$mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
$mform->setDefault('autosubscribe', core_user::get_property_default('autosubscribe'));
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="25"');
$mform->setType('city', PARAM_TEXT);
if (empty($CFG->defaultcity)) {
$mform->setDefault('city', $templateuser->city);
} else {
$mform->setDefault('city', core_user::get_property_default('city'));
}
$choices = get_string_manager()->get_list_of_countries();
$choices = array('' => get_string('selectacountry') . '...') + $choices;
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
if (empty($CFG->country)) {
$mform->setDefault('country', $templateuser->country);
} else {
$mform->setDefault('country', core_user::get_property_default('country'));
}
$mform->setAdvanced('country');
$choices = core_date::get_list_of_timezones($templateuser->timezone, true);
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
$mform->setDefault('timezone', $templateuser->timezone);
$mform->setAdvanced('timezone');
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
$mform->setDefault('lang', $templateuser->lang);
$mform->setAdvanced('lang');
$editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false);
$mform->addElement('editor', 'description', get_string('userdescription'), null, $editoroptions);
$mform->setType('description', PARAM_CLEANHTML);
$mform->addHelpButton('description', 'userdescription');
$mform->setAdvanced('description');
$mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
$mform->setType('url', PARAM_URL);
$mform->setAdvanced('url');
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
$mform->setType('idnumber', PARAM_NOTAGS);
$mform->setForceLtr('idnumber');
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"');
$mform->setType('institution', PARAM_TEXT);
$mform->setDefault('institution', $templateuser->institution);
$mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"');
$mform->setType('department', PARAM_TEXT);
$mform->setDefault('department', $templateuser->department);
$mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_NOTAGS);
$mform->setAdvanced('phone1');
$mform->setForceLtr('phone1');
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
$mform->setType('phone2', PARAM_NOTAGS);
$mform->setAdvanced('phone2');
$mform->setForceLtr('phone2');
$mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
$mform->setType('address', PARAM_TEXT);
$mform->setAdvanced('address');
// Next the profile defaults
profile_definition($mform);
// hidden fields
$mform->addElement('hidden', 'iid');
$mform->setType('iid', PARAM_INT);
$mform->addElement('hidden', 'previewrows');
$mform->setType('previewrows', PARAM_INT);
$this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
$this->set_data($data);
}
示例9: definition
public function definition()
{
global $CFG, $USER, $SESSION;
$mform =& $this->_form;
$columns =& $this->_customdata;
// I am the template user, why should it be the administrator? we have roles now, other ppl may use this script ;-).
$templateuser = $USER;
// Upload settings and file.
$mform->addElement('header', 'settingsheader', get_string('settings'));
$mform->addElement('static', 'uutypelabel', get_string('uuoptype', 'tool_uploaduser'));
$choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
$mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'tool_uploaduser'), $choices);
$mform->setDefault('uupasswordnew', 1);
$mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_UPDATE);
$mform->addElement('selectyesno', 'sendnewpasswordemails', get_string('sendnewpasswordemails', 'block_iomad_company_admin'));
$mform->setDefault('sendnewpasswordemails', 1);
$choices = array(0 => get_string('nochanges', 'tool_uploaduser'), 1 => get_string('uuupdatefromfile', 'tool_uploaduser'), 2 => get_string('uuupdateall', 'tool_uploaduser'), 3 => get_string('uuupdatemissing', 'tool_uploaduser'));
$mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'tool_uploaduser'), $choices);
$mform->setDefault('uuupdatetype', 0);
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDNEW);
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_ADDINC);
$choices = array(0 => get_string('nochanges', 'tool_uploaduser'), 1 => get_string('update'));
$mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'tool_uploaduser'), $choices);
$mform->setDefault('uupasswordold', 0);
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDNEW);
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_ADDINC);
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 0);
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 3);
$mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'tool_uploaduser'));
$mform->setDefault('uuallowrenames', 0);
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDNEW);
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_ADDINC);
$mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'tool_uploaduser'));
$mform->setDefault('uuallowdeletes', 0);
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDNEW);
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_ADDINC);
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'tool_uploaduser'));
$mform->setDefault('uunoemailduplicates', 1);
$choices = array(0 => get_string('no'), 1 => get_string('uubulknew', 'tool_uploaduser'), 2 => get_string('uubulkupdated', 'tool_uploaduser'), 3 => get_string('uubulkall', 'tool_uploaduser'));
$mform->addElement('select', 'uubulk', get_string('uubulk', 'tool_uploaduser'), $choices);
$mform->setDefault('uubulk', 0);
// Roles selection.
$showroles = false;
foreach ($columns as $column) {
if (preg_match('/^type\\d+$/', $column)) {
$showroles = true;
break;
}
}
if ($showroles) {
$mform->addElement('header', 'rolesheader', get_string('roles'));
$choices = uu_allowed_roles(true);
$mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'tool_uploaduser'), $choices);
if ($studentroles = get_archetype_roles('student')) {
foreach ($studentroles as $role) {
if (isset($choices[$role->id])) {
$mform->setDefault('uulegacy1', $role->id);
break;
}
}
unset($studentroles);
}
$mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'tool_uploaduser'), $choices);
if ($editteacherroles = get_archetype_roles('editingteacher')) {
foreach ($editteacherroles as $role) {
if (isset($choices[$role->id])) {
$mform->setDefault('uulegacy2', $role->id);
break;
}
}
unset($editteacherroles);
}
$mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'tool_uploaduser'), $choices);
if ($teacherroles = get_archetype_roles('teacher')) {
foreach ($teacherroles as $role) {
if (isset($choices[$role->id])) {
$mform->setDefault('uulegacy3', $role->id);
break;
}
}
unset($teacherroles);
}
}
// Next the profile defaults.
profile_definition($mform);
// Remove the company profile field from the form (this was added by the call to profile_definition
// above but we don't want the user to edit this here).
// Hidden fields.
$mform->addElement('hidden', 'iid');
$mform->setType('iid', PARAM_INT);
$mform->addElement('hidden', 'auth');
$mform->setDefault('auth', '');
$mform->setType('auth', PARAM_TEXT);
$mform->addElement('hidden', 'previewrows');
$mform->setType('previewrows', PARAM_INT);
$mform->addElement('hidden', 'readcount');
$mform->setType('readcount', PARAM_INT);
$mform->addElement('hidden', 'uutype');
$mform->setType('uutype', PARAM_INT);
$mform->addElement('hidden', 'companyid', $this->selectedcompany);
//.........这里部分代码省略.........
示例10: definition
/**
* Define the form.
*/
public function definition()
{
global $USER, $CFG, $COURSE;
$mform = $this->_form;
$editoroptions = null;
$filemanageroptions = null;
if (!is_array($this->_customdata)) {
throw new coding_exception('invalid custom data for user_edit_form');
}
$editoroptions = $this->_customdata['editoroptions'];
$filemanageroptions = $this->_customdata['filemanageroptions'];
$user = $this->_customdata['user'];
$userid = $user->id;
// Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
// Add some extra hidden fields.
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$auths = core_component::get_plugin_list('auth');
$enabled = get_string('pluginenabled', 'core_plugin');
$disabled = get_string('plugindisabled', 'core_plugin');
$authoptions = array($enabled => array(), $disabled => array());
$cannotchangepass = array();
foreach ($auths as $auth => $unused) {
$authinst = get_auth_plugin($auth);
$passwordurl = $authinst->change_password_url();
if (!($authinst->can_change_password() && empty($passwordurl))) {
if ($userid < 1 and $authinst->is_internal()) {
// This is unlikely but we can not create account without password
// when plugin uses passwords, we need to set it initially at least.
} else {
$cannotchangepass[] = $auth;
}
}
if (is_enabled_auth($auth)) {
$authoptions[$enabled][$auth] = get_string('pluginname', "auth_{$auth}");
} else {
$authoptions[$disabled][$auth] = get_string('pluginname', "auth_{$auth}");
}
}
$mform->addElement('selectgroups', 'auth', get_string('chooseauthmethod', 'auth'), $authoptions);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
$mform->addElement('advcheckbox', 'suspended', get_string('suspended', 'auth'));
$mform->addHelpButton('suspended', 'suspended', 'auth');
$mform->addElement('checkbox', 'createpassword', get_string('createpassword', 'auth'));
$mform->disabledIf('createpassword', 'auth', 'in', $cannotchangepass);
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->addHelpButton('newpassword', 'newpassword');
$mform->setType('newpassword', PARAM_RAW);
$mform->disabledIf('newpassword', 'createpassword', 'checked');
$mform->disabledIf('newpassword', 'auth', 'in', $cannotchangepass);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->addHelpButton('preference_auth_forcepasswordchange', 'forcepasswordchange');
$mform->disabledIf('preference_auth_forcepasswordchange', 'createpassword', 'checked');
// Shared fields.
useredit_shared_definition($mform, $editoroptions, $filemanageroptions, $user);
// Next the customisable profile fields.
profile_definition($mform, $userid);
if ($userid == -1) {
$btnstring = get_string('createuser');
} else {
$btnstring = get_string('updatemyprofile');
}
$this->add_action_buttons(false, $btnstring);
$this->set_data($user);
}
示例11: definition
//.........这里部分代码省略.........
foreach ($themeobjects as $key => $theme) {
if (empty($theme->hidefromselector)) {
$themes[$key] = get_string('pluginname', 'theme_' . $theme->name);
}
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
}
//--------------------------------------------------------------------------------
enrol_course_edit_form($mform, $course, $context);
//--------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('groups', 'group'));
$choices = array();
$choices[NOGROUPS] = get_string('groupsnone', 'group');
$choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
$choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
$mform->addElement('select', 'groupmode', get_string('groupmode', 'group'), $choices);
$mform->addHelpButton('groupmode', 'groupmode', 'group');
$mform->setDefault('groupmode', $courseconfig->groupmode);
$choices = array();
$choices['0'] = get_string('no');
$choices['1'] = get_string('yes');
$mform->addElement('select', 'groupmodeforce', get_string('groupmodeforce', 'group'), $choices);
$mform->addHelpButton('groupmodeforce', 'groupmodeforce', 'group');
$mform->setDefault('groupmodeforce', $courseconfig->groupmodeforce);
//default groupings selector
$options = array();
$options[0] = get_string('none');
$mform->addElement('select', 'defaultgroupingid', get_string('defaultgrouping', 'group'), $options);
//--------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('availability'));
$choices = array();
$choices['0'] = get_string('courseavailablenot');
$choices['1'] = get_string('courseavailable');
$mform->addElement('select', 'visible', get_string('availability'), $choices);
$mform->addHelpButton('visible', 'availability');
$mform->setDefault('visible', $courseconfig->visible);
if (!has_capability('moodle/course:visibility', $context)) {
$mform->hardFreeze('visible');
if (!empty($course->id)) {
$mform->setConstant('visible', $course->visible);
} else {
$mform->setConstant('visible', $category->visible);
}
}
//--------------------------------------------------------------------------------
$mform->addElement('header', '', get_string('language'));
$languages = array();
$languages[''] = get_string('forceno');
$languages += get_string_manager()->get_list_of_translations();
$mform->addElement('select', 'lang', get_string('forcelanguage'), $languages);
$mform->setDefault('lang', $courseconfig->lang);
//--------------------------------------------------------------------------------
if (completion_info::is_enabled_for_site()) {
$mform->addElement('header', '', get_string('progress', 'completion'));
$mform->addElement('select', 'enablecompletion', get_string('completion', 'completion'), array(0 => get_string('completiondisabled', 'completion'), 1 => get_string('completionenabled', 'completion')));
$mform->setDefault('enablecompletion', $courseconfig->enablecompletion);
$mform->addElement('checkbox', 'completionstartonenrol', get_string('completionstartonenrol', 'completion'));
$mform->setDefault('completionstartonenrol', $courseconfig->completionstartonenrol);
$mform->disabledIf('completionstartonenrol', 'enablecompletion', 'eq', 0);
} else {
$mform->addElement('hidden', 'enablecompletion');
$mform->setType('enablecompletion', PARAM_INT);
$mform->setDefault('enablecompletion', 0);
$mform->addElement('hidden', 'completionstartonenrol');
$mform->setType('completionstartonenrol', PARAM_INT);
$mform->setDefault('completionstartonenrol', 0);
}
/// customizable role names in this course
//--------------------------------------------------------------------------------
$mform->addElement('header', 'rolerenaming', get_string('rolerenaming'));
$mform->addHelpButton('rolerenaming', 'rolerenaming');
if ($roles = get_all_roles()) {
if ($coursecontext) {
$roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS_RAW);
}
$assignableroles = get_roles_for_contextlevels(CONTEXT_COURSE);
foreach ($roles as $role) {
$mform->addElement('text', 'role_' . $role->id, get_string('yourwordforx', '', $role->name));
if (isset($role->localname)) {
$mform->setDefault('role_' . $role->id, $role->localname);
}
$mform->setType('role_' . $role->id, PARAM_TEXT);
if (!in_array($role->id, $assignableroles)) {
$mform->setAdvanced('role_' . $role->id);
}
}
}
// customisable profile fields
//--------------------------------------------------------------------------------
profile_definition($mform);
//--------------------------------------------------------------------------------
$this->add_action_buttons();
//--------------------------------------------------------------------------------
$mform->addElement('hidden', 'id', null);
$mform->setType('id', PARAM_INT);
/// finally set the current form data
//--------------------------------------------------------------------------------
profile_load_data($course);
$this->set_data($course);
}
示例12: definition
public function definition()
{
global $DB;
$mform = $this->_form;
$instance = $this->_customdata;
$this->instance = $instance;
$plugin = enrol_get_plugin('self');
$heading = $plugin->get_instance_name($instance);
$mform->addElement('header', 'selfheader', $heading);
if ($instance->password) {
$heading = $plugin->get_instance_name($instance);
$mform->addElement('header', 'selfheader', $heading);
//change the id of self enrolment key input as there can be multiple self enrolment methods
$mform->addElement('passwordunmask', 'enrolpassword', get_string('password', 'enrol_self'), array('id' => $instance->id . "_enrolpassword"));
} else {
// nothing?
}
$mform->addElement('html', '<p>' . $instance->customtext1 . '</p>');
$mform->addElement('textarea', 'applydescription', get_string('comment', 'enrol_apply'), 'cols="80"');
//user profile
global $USER, $CFG, $DB;
require_once $CFG->libdir . '/gdlib.php';
require_once $CFG->dirroot . '/user/edit_form.php';
require_once $CFG->dirroot . '/user/editlib.php';
require_once $CFG->dirroot . '/user/profile/lib.php';
require_once $CFG->dirroot . '/user/lib.php';
$user = $DB->get_record('user', array('id' => $USER->id));
$editoroptions = $filemanageroptions = null;
$apply_setting = $DB->get_records_sql("select name,value from " . $CFG->prefix . "config_plugins where plugin='enrol_apply'");
$show_standard_user_profile = $show_extra_user_profile = false;
if ($instance->customint1 != '') {
$instance->customint1 == 0 ? $show_standard_user_profile = true : ($show_standard_user_profile = false);
} else {
$apply_setting['show_standard_user_profile']->value == 0 ? $show_standard_user_profile = true : ($show_standard_user_profile = false);
}
if ($instance->customint2 != '') {
$instance->customint2 == 0 ? $show_extra_user_profile = true : ($show_extra_user_profile = false);
} else {
$apply_setting['show_extra_user_profile']->value == 0 ? $show_extra_user_profile = true : ($show_extra_user_profile = false);
}
if ($show_standard_user_profile) {
useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
}
if ($show_extra_user_profile) {
profile_definition($mform, $user->id);
}
$profile_default_values = $user;
if (is_object($profile_default_values)) {
$profile_default_values = (array) $profile_default_values;
}
$mform->setDefaults($profile_default_values);
$this->add_action_buttons(false, get_string('enrolme', 'enrol_self'));
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->setDefault('id', $instance->courseid);
$mform->addElement('hidden', 'instance');
$mform->setType('instance', PARAM_INT);
$mform->setDefault('instance', $instance->id);
//$mform->addElement('html',"<script type='text/javascript' src='../../lib/jquery/jquery-1.10.2.min.js'></script>");
//$mform->addElement('html','<script>$(document).ready(function(){$(".collapsible-actions a").trigger("click");})</script>');
//$mform->addElement('html','<script type="text/javascript">$(document).ready(function(){setTimeout(function(){$(".collapseexpand").trigger("click");},3000)})</script>');
}
示例13: definition
/**
* Define the form.
*/
public function definition()
{
global $CFG, $COURSE, $USER;
$mform = $this->_form;
$editoroptions = null;
$filemanageroptions = null;
$usernotfullysetup = user_not_fully_set_up($USER);
if (!is_array($this->_customdata)) {
throw new coding_exception('invalid custom data for user_edit_form');
}
$editoroptions = $this->_customdata['editoroptions'];
$filemanageroptions = $this->_customdata['filemanageroptions'];
$user = $this->_customdata['user'];
$userid = $user->id;
if (empty($user->country)) {
// We must unset the value here so $CFG->country can be used as default one.
unset($user->country);
}
// Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
// Add some extra hidden fields.
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);
// Shared fields.
useredit_shared_definition($mform, $editoroptions, $filemanageroptions, $user);
// Extra settigs.
if (!empty($CFG->disableuserimages) || $usernotfullysetup) {
$mform->removeElement('deletepicture');
$mform->removeElement('imagefile');
$mform->removeElement('imagealt');
}
// If the user isn't fully set up, let them know that they will be able to change
// their profile picture once their profile is complete.
if ($usernotfullysetup) {
$userpicturewarning = $mform->createElement('warning', 'userpicturewarning', 'notifymessage', get_string('newpictureusernotsetup'));
$enabledusernamefields = useredit_get_enabled_name_fields();
if ($mform->elementExists('moodle_additional_names')) {
$mform->insertElementBefore($userpicturewarning, 'moodle_additional_names');
} else {
if ($mform->elementExists('moodle_interests')) {
$mform->insertElementBefore($userpicturewarning, 'moodle_interests');
} else {
$mform->insertElementBefore($userpicturewarning, 'moodle_optional');
}
}
// This is expected to exist when the form is submitted.
$imagefile = $mform->createElement('hidden', 'imagefile');
$mform->insertElementBefore($imagefile, 'userpicturewarning');
}
// Next the customisable profile fields.
profile_definition($mform, $userid);
$this->add_action_buttons(false, get_string('updatemyprofile'));
$this->set_data($user);
}
示例14: definition
//.........这里部分代码省略.........
$mform->setDefault('autosubscribe', 1);
$editors = editors_get_enabled();
if (count($editors) > 1) {
$choices = array();
$choices['0'] = get_string('texteditor');
$choices['1'] = get_string('htmleditor');
$mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
$mform->setDefault('htmleditor', 1);
} else {
$mform->addElement('hidden', 'htmleditor');
$mform->setDefault('htmleditor', 1);
$mform->setType('htmleditor', PARAM_INT);
}
if (empty($CFG->enableajax)) {
$mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
} else {
$choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
$mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
$mform->setDefault('ajax', 1);
}
$mform->setAdvanced('ajax');
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
if (empty($CFG->defaultcity)) {
$mform->setDefault('city', $templateuser->city);
} else {
$mform->setDefault('city', $CFG->defaultcity);
}
$mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
if (empty($CFG->country)) {
$mform->setDefault('country', $templateuser->country);
} else {
$mform->setDefault('country', $CFG->country);
}
$mform->setAdvanced('country');
$choices = get_list_of_timezones();
$choices['99'] = get_string('serverlocaltime');
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
$mform->setDefault('timezone', $templateuser->timezone);
$mform->setAdvanced('timezone');
$mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
$mform->setDefault('lang', $templateuser->lang);
$mform->setAdvanced('lang');
$editoroptions = array('maxfiles'=>0, 'maxbytes'=>0, 'trusttext'=>false, 'forcehttps'=>false);
$mform->addElement('editor', 'description', get_string('userdescription'), null, $editoroptions);
$mform->setType('description', PARAM_CLEANHTML);
$mform->addHelpButton('description', 'userdescription');
$mform->setAdvanced('description');
$mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
$mform->setAdvanced('url');
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
$mform->setType('idnumber', PARAM_NOTAGS);
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
$mform->setType('institution', PARAM_MULTILANG);
$mform->setDefault('institution', $templateuser->institution);
$mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
$mform->setType('department', PARAM_MULTILANG);
$mform->setDefault('department', $templateuser->department);
$mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
$mform->setType('phone1', PARAM_NOTAGS);
$mform->setAdvanced('phone1');
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
$mform->setType('phone2', PARAM_NOTAGS);
$mform->setAdvanced('phone2');
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
$mform->setType('address', PARAM_MULTILANG);
$mform->setAdvanced('address');
// Next the profile defaults
profile_definition($mform);
// hidden fields
$mform->addElement('hidden', 'iid');
$mform->setType('iid', PARAM_INT);
$mform->addElement('hidden', 'previewrows');
$mform->setType('previewrows', PARAM_INT);
$mform->addElement('hidden', 'readcount');
$mform->setType('readcount', PARAM_INT);
$mform->addElement('hidden', 'uutype');
$mform->setType('uutype', PARAM_INT);
$this->add_action_buttons(true, get_string('uploadusers', 'admin'));
}