function definition() { global $USER, $CFG; $mform =& $this->_form; $mform->addElement('header', '', get_string('createuserandpass'), ''); $mform->addElement('text', 'username', get_string('username'), 'maxlength="100" size="12"'); $mform->setType('username', PARAM_NOTAGS); $mform->addRule('username', get_string('missingusername'), 'required', null, 'server'); $mform->addElement('passwordunmask', 'password', get_string('password'), 'maxlength="32" size="12"'); $mform->setType('password', PARAM_RAW); $mform->addRule('password', get_string('missingpassword'), 'required', null, 'server'); $mform->addElement('header', '', get_string('supplyinfo'), ''); $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"'); $mform->setType('email', PARAM_NOTAGS); $mform->addRule('email', get_string('missingemail'), 'required', null, 'server'); $mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"'); $mform->setType('email2', PARAM_NOTAGS); $mform->addRule('email2', get_string('missingemail'), 'required', null, 'server'); $nameordercheck = new object(); $nameordercheck->firstname = 'a'; $nameordercheck->lastname = 'b'; if (fullname($nameordercheck) == 'b a') { // See MDL-4325 $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); } else { $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); } $mform->setType('firstname', PARAM_TEXT); $mform->addRule('firstname', get_string('missingfirstname'), 'required', null, 'server'); $mform->setType('lastname', PARAM_TEXT); $mform->addRule('lastname', get_string('missinglastname'), 'required', null, 'server'); $mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="20"'); $mform->setType('city', PARAM_TEXT); $mform->addRule('city', get_string('missingcity'), 'required', null, 'server'); $country = get_list_of_countries(); $default_country[''] = get_string('selectacountry'); $country = array_merge($default_country, $country); $mform->addElement('select', 'country', get_string('country'), $country); $mform->addRule('country', get_string('missingcountry'), 'required', null, 'server'); if (!empty($CFG->country)) { $mform->setDefault('country', $CFG->country); } else { $mform->setDefault('country', ''); } if (signup_captcha_enabled()) { $mform->addElement('recaptcha', 'recaptcha_element', get_string('recaptcha', 'auth'), array('https' => $CFG->loginhttps)); $mform->setHelpButton('recaptcha_element', array('recaptcha', get_string('recaptcha', 'auth'))); } profile_signup_fields($mform); if (!empty($CFG->sitepolicy)) { $mform->addElement('header', '', get_string('policyagreement'), ''); $mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>'); $mform->addElement('checkbox', 'policyagreed', get_string('policyaccept')); $mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server'); } // buttons $this->add_action_buttons(true, get_string('createaccount')); }
/** * Validate the data in passed in the configuration page * * @param $config - the information from the form mod.html * @return nothing , but returns an error if the configuration is wrong */ function liveclassroom_process_options(&$config) { global $CFG, $USER; /******* we do the following verfication before submitting the configuration -The parameters sent can not be empty -The url of the server can not finish with a / -The url must start with http:// -The api account has to valid ********/ $config->servername = trim($config->servername); $config->adminusername = trim($config->adminusername); $config->adminpassword = trim($config->adminpassword); if (!isadmin($USER->id)) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom')); error(get_string('errormustbeadmin', 'liveclassroom')); } if (empty($config->servername)) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom')); error(get_string('wrongconfigurationURLunavailable', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } else { if (empty($config->adminusername)) { wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminUsername', 'liveclassroom')); error(get_string('emptyAdminUsername', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } else { if (empty($config->adminpassword)) { wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminPassword', 'liveclassroom')); error(get_string('emptyAdminPassword', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } } } $length = strlen($config->servername); if ($config->servername[$length - 1] == '/') { wimba_add_log(WIMBA_ERROR, WC, get_String('trailingSlash', 'liveclassroom')); error(get_String('trailingSlash', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } if (!preg_match('/^http:\\/\\//', $config->servername)) { wimba_add_log(WIMBA_ERROR, WC, get_String('trailingHttp', 'liveclassroom')); error(get_String('trailingHttp', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } $prefixUtil = new PrefixUtil(); $prefix = $prefixUtil->getPrefix($config->adminusername); $api = new LCApi($config->servername, $config->adminusername, $config->adminpassword, $prefix); if (!$api->lcapi_authenticate()) { wimba_add_log(WIMBA_ERROR, WC, get_string('wrongadminpass', 'liveclassroom')); error(get_string('wrongadminpass', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } $domxml = false; $php_extension = get_loaded_extensions(); for ($i = 0; $i < count($php_extension); $i++) { if ($php_extension[$i] == "libxml" || $php_extension[$i] == "domxml") { $domxml = true; } } if ($domxml === false) { wimba_add_log(WIMBA_ERROR, WC, get_string('domxml', 'liveclassroom')); error(get_string('domxml', 'liveclassroom'), $_SERVER["HTTP_REFERER"]); } return; }
function definition() { global $USER, $CFG; $mform = $this->_form; $mform->addElement('header', 'createuserandpass', get_string('createuserandpass'), ''); $mform->addElement('text', 'username', get_string('username'), 'maxlength="100" size="12"'); $mform->setType('username', PARAM_NOTAGS); $mform->addRule('username', get_string('missingusername'), 'required', null, 'server'); if (!empty($CFG->passwordpolicy)) { $mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy()); } $mform->addElement('passwordunmask', 'password', get_string('password'), 'maxlength="32" size="12"'); $mform->setType('password', PARAM_RAW); $mform->addRule('password', get_string('missingpassword'), 'required', null, 'server'); $mform->addElement('header', 'supplyinfo', get_string('supplyinfo'), ''); $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"'); $mform->setType('email', PARAM_RAW_TRIMMED); $mform->addRule('email', get_string('missingemail'), 'required', null, 'server'); $mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"'); $mform->setType('email2', PARAM_RAW_TRIMMED); $mform->addRule('email2', get_string('missingemail'), 'required', null, 'server'); $namefields = useredit_get_required_name_fields(); foreach ($namefields as $field) { $mform->addElement('text', $field, get_string($field), 'maxlength="100" size="30"'); $mform->setType($field, PARAM_TEXT); $stringid = 'missing' . $field; if (!get_string_manager()->string_exists($stringid, 'moodle')) { $stringid = 'required'; } $mform->addRule($field, get_string($stringid), 'required', null, 'server'); } $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="20"'); $mform->setType('city', PARAM_TEXT); if (!empty($CFG->defaultcity)) { $mform->setDefault('city', $CFG->defaultcity); } $country = get_string_manager()->get_list_of_countries(); $default_country[''] = get_string('selectacountry'); $country = array_merge($default_country, $country); $mform->addElement('select', 'country', get_string('country'), $country); if (!empty($CFG->country)) { $mform->setDefault('country', $CFG->country); } else { $mform->setDefault('country', ''); } if ($this->signup_captcha_enabled()) { $mform->addElement('recaptcha', 'recaptcha_element', get_string('security_question', 'auth'), array('https' => $CFG->loginhttps)); $mform->addHelpButton('recaptcha_element', 'recaptcha', 'auth'); } profile_signup_fields($mform); if (!empty($CFG->sitepolicy)) { $mform->addElement('header', 'policyagreement', get_string('policyagreement'), ''); $mform->setExpanded('policyagreement'); $mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>'); $mform->addElement('checkbox', 'policyagreed', get_string('policyaccept')); $mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server'); } // buttons $this->add_action_buttons(true, get_string('createaccount')); }
function definition() { global $USER; $mform =& $this->_form; $mform->addElement('header', '', get_string('changepassword'), ''); // visible elements $mform->addElement('static', 'username', get_string('username'), $USER->username); $mform->addElement('password', 'password', get_string('oldpassword')); $mform->addRule('password', get_string('required'), 'required', null, 'client'); $mform->setType('password', PARAM_RAW); $mform->addElement('password', 'newpassword1', get_string('newpassword')); $mform->addRule('newpassword1', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword1', PARAM_RAW); $mform->addElement('password', 'newpassword2', get_string('newpassword') . ' (' . get_String('again') . ')'); $mform->addRule('newpassword2', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword2', PARAM_RAW); // hidden optional params $mform->addElement('hidden', 'id', 0); $mform->setType('id', PARAM_INT); // buttons if (get_user_preferences('auth_forcepasswordchange')) { $this->add_action_buttons(false); } else { $this->add_action_buttons(true); } }
function definition() { global $CFG; $mform = $this->_form; // This 'dummy' element has two purposes: // - To force open the Moodle Forms invisible fieldset outside of any table on the form (corrupts display otherwise) // - To let us inform the user that there are validation errors without them having to scroll down further $mform->addElement('static', 'form_errors'); $mform->addElement('header', 'emailandpassword', get_string('emailandpassword', 'local_obu_application'), ''); $mform->addElement('static', 'preregistered', get_string('preregistered', 'local_obu_application')); $mform->addElement('text', 'email', get_string('email'), 'size="25" maxlength="100"'); $mform->setType('email', PARAM_RAW_TRIMMED); $mform->addRule('email', get_string('missingemail'), 'required', null, 'server'); $mform->addElement('text', 'username', get_string('confirm_email', 'local_obu_application'), 'size="25" maxlength="100"'); $mform->setType('username', PARAM_RAW_TRIMMED); $mform->addRule('username', get_string('missingemail'), 'required', null, 'server'); if (!empty($CFG->passwordpolicy)) { $mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy()); } $mform->addElement('passwordunmask', 'password', get_string('password'), 'size="12" maxlength="32"'); $mform->setType('password', PARAM_RAW); $mform->addRule('password', get_string('missingpassword'), 'required', null, 'server'); $mform->addElement('header', 'contactdetails', get_string('contactdetails', 'local_obu_application'), ''); $mform->addElement('text', 'title', get_string('title', 'local_obu_application'), 'size="10" maxlength="10"'); $mform->setType('title', PARAM_TEXT); $mform->addRule('title', null, 'required', null, 'server'); $mform->addElement('text', 'firstname', get_string('firstname'), 'size="30" maxlength="100"'); $mform->setType('firstname', PARAM_TEXT); $mform->addRule('firstname', null, 'required', null, 'server'); $mform->addElement('text', 'lastname', get_string('lastname'), 'size="30" maxlength="100"'); $mform->setType('lastname', PARAM_TEXT); $mform->addRule('lastname', null, 'required', null, 'server'); $mform->addElement('text', 'phone1', get_string('phone', 'local_obu_application'), 'size="20" maxlength="20"'); $mform->setType('phone1', PARAM_TEXT); $mform->addRule('phone1', null, 'required', null, 'server'); // Use reCAPTCHA if it's setup if (!empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey)) { $mform->addElement('recaptcha', 'recaptcha_element', get_string('recaptcha', 'auth'), array('https' => $CFG->loginhttps)); $mform->addHelpButton('recaptcha_element', 'recaptcha', 'auth'); } if (!empty($CFG->sitepolicy)) { $mform->addElement('header', 'policyagreement', get_string('policyagreement'), ''); $mform->setExpanded('policyagreement'); $mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>'); $mform->addElement('checkbox', 'policyagreed', get_string('policyaccept')); $mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server'); } // buttons $this->add_action_buttons(true, get_string('register', 'local_obu_application')); }
function definition() { global $USER, $CFG, $COURSE; $mform =& $this->_form; $mform->addElement('hidden', 'id', $USER->id); $mform->addElement('header', 'Editar', 'Editar Perfil'); $mform->addElement('text', 'username', get_string('username'), array('readonly' => 'readonly')); $mform->setDefault('username', $USER->username); $mform->addRule('username', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'firstname', get_string('firstname'), array('readonly' => 'readonly')); $mform->setDefault('firstname', $USER->firstname); $mform->addRule('firstname', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'lastname', get_string('lastname'), array('readonly' => 'readonly')); $mform->setDefault('lastname', $USER->lastname); $mform->addRule('lastname', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('password', 'pass1', get_string('newpassword')); $mform->addElement('password', 'pass2', get_string('newpassword') . ' (' . get_String('again') . ')'); if (get_user_preferences('auth_forcepasswordchange')) { $mform->addRule('pass1', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('pass2', get_string('required'), 'required', '', 'client', false, false); } $mform->addElement('text', 'email', 'Correo Banco'); $mform->setDefault('email', $USER->email); $mform->addRule('email', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('email', get_string('invalidemail'), 'email', '', 'client', false, false); $mform->addElement('text', 'msn', get_string('msnid')); $mform->setDefault('msn', $USER->msn); $mform->addRule('msn', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('msn', get_string('invalidemail'), 'email', '', 'client', false, false); $mform->addElement('date_selector', 'icq', get_string('icqnumber'), array('startyear' => 1920, 'stopyear' => 2020, 'timezone' => 99, 'step' => 5)); $mform->setDefault('icq', $USER->icq); $mform->addRule('icq', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'phone1', get_string('phone')); $mform->setDefault('phone1', $USER->phone1); $mform->addRule('phone1', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('phone1', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('text', 'yahoo', get_string('yahooid')); $mform->setDefault('yahoo', $USER->yahoo); // $mform->addRule('yahoo', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('yahoo', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('text', 'phone2', get_string('phone2')); $mform->setDefault('phone2', $USER->phone2); //$mform->addRule('phone2', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('phone2', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('html', '<div><span class="msg-picture">Recuerda que esta imagen será vista por tus compañeros.</span></div>'); $mform->addElement('file', 'picture', get_string('userpic')); $mform->addElement('submit', 'save', get_string('savechanges')); $mform->addElement('html', '<div style="color:#A00" align="right">En caso no cuente con correo BCP ingrese un correo personal**</div>'); }
function definition() { global $USER, $CFG, $COURSE; $mform =& $this->_form; $mform->addElement('hidden', 'id', $USER->id); $mform->addElement('text', 'username', get_string('username'), array('readonly' => 'readonly')); $mform->setDefault('username', $USER->username); $mform->addRule('username', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'firstname', get_string('firstname'), array('readonly' => 'readonly')); $mform->setDefault('firstname', $USER->firstname); $mform->addRule('firstname', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'lastname', get_string('lastname'), array('readonly' => 'readonly')); $mform->setDefault('lastname', $USER->lastname); $mform->addRule('lastname', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'pass1', get_string('newpassword')); $mform->addElement('text', 'pass2', get_string('newpassword') . ' (' . get_String('again') . ')'); if (get_user_preferences('auth_forcepasswordchange')) { $mform->addRule('pass1', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('pass2', get_string('required'), 'required', '', 'client', false, false); } $mform->addElement('text', 'email', get_string('email')); $mform->setDefault('email', $USER->email); $mform->addRule('email', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('email', get_string('invalidemail'), 'email', '', 'client', false, false); $mform->addElement('text', 'msn', get_string('msnid')); $mform->setDefault('msn', $USER->msn); $mform->addRule('msn', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('msn', get_string('invalidemail'), 'email', '', 'client', false, false); $mform->addElement('date_selector', 'icq', get_string('icqnumber'), array('startyear' => 1920, 'stopyear' => 2020, 'timezone' => 99, 'step' => 5)); $mform->setDefault('icq', $USER->icq); $mform->addRule('icq', get_string('required'), 'required', '', 'client', false, false); $mform->addElement('text', 'phone1', get_string('phone')); $mform->setDefault('phone1', $USER->phone1); $mform->addRule('phone1', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('phone1', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('text', 'yahoo', get_string('yahooid')); $mform->setDefault('yahoo', $USER->yahoo); // $mform->addRule('yahoo', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('yahoo', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('text', 'phone2', get_string('phone2')); $mform->setDefault('phone2', $USER->phone2); //$mform->addRule('phone2', get_string('required'), 'required', '', 'client', false, false); $mform->addRule('phone2', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false); $mform->addElement('file', 'picture', get_string('userpic')); $mform->addElement('submit', 'save', get_string('savechanges')); }
/** * TODO comment this */ function definition() { global $USER, $CFG; $dbc = new ilp_db(); $mform =& $this->_form; $fieldsettitle = !empty($this->report_id) ? get_string('editreport', 'block_ilp') : get_string('createreport', 'block_ilp'); //create a new fieldset $mform->addElement('html', '<fieldset id="reportfieldset" class="clearfix ilpfieldset">'); $mform->addElement('html', '<legend >' . $fieldsettitle . '</legend>'); $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'creator_id', $USER->id); $mform->setType('creator_id', PARAM_INT); //the id of the form element creator $mform->addElement('hidden', 'position'); $mform->setType('position', PARAM_INT); //set the field position of the field $mform->setDefault('position', $this->dbc->get_new_report_position()); // NAME element $mform->addElement('text', 'name', get_string('name', 'block_ilp'), array('class' => 'form_input')); $mform->addRule('name', null, 'maxlength', 255, 'client'); $mform->addRule('name', null, 'required', null, 'client'); $mform->setType('name', PARAM_RAW); $mform->addElement('checkbox', 'maxedit', get_String('maxedit', 'block_ilp'), null); $mform->addElement('checkbox', 'comments', get_String('allowcomments', 'block_ilp'), null); $mform->addElement('checkbox', 'frequency', get_String('multipleentries', 'block_ilp'), null); // DESCRIPTION element $mform->addElement('htmleditor', 'description', get_string('description', 'block_ilp'), array('class' => 'form_input', 'rows' => '10', 'cols' => '65')); $mform->addRule('description', null, 'maxlength', 65535, 'client'); // commented out as causing problems with double submitting // $mform->addRule('description', null, 'required', null, 'client'); $mform->setType('description', PARAM_RAW); //TODO add the elements to implement the frequency functionlaity if (stripos($CFG->release, "2.") !== false) { $mform->addElement('filepicker', 'binary_icon', get_string('binary_icon', 'block_ilp'), null, array('maxbytes' => ILP_MAXFILE_SIZE, 'accepted_types' => ILP_ICON_TYPES)); } else { $this->set_upload_manager(new upload_manager('binary_icon', false, false, 0, false, ILP_MAXFILE_SIZE, true, true, false)); $mform->addElement('file', 'binary_icon', get_string('binary_icon', 'block_ilp')); } $buttonarray[] = $mform->createElement('submit', 'saveanddisplaybutton', get_string('submit')); $buttonarray[] =& $mform->createElement('cancel'); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); //close the fieldset $mform->addElement('html', '</fieldset>'); }
function definition() { global $USER, $CFG; $mform = $this->_form; $mform->setDisableShortforms(true); $mform->addElement('header', 'changepassword', get_string('changepassword'), ''); // visible elements $mform->addElement('static', 'username', get_string('username'), $USER->username); $policies = array(); if (!empty($CFG->passwordpolicy)) { $policies[] = print_password_policy(); } if (!empty($CFG->passwordreuselimit) and $CFG->passwordreuselimit > 0) { $policies[] = get_string('informminpasswordreuselimit', 'auth', $CFG->passwordreuselimit); } if ($policies) { $mform->addElement('static', 'passwordpolicyinfo', '', implode('<br />', $policies)); } $mform->addElement('password', 'password', get_string('oldpassword')); $mform->addRule('password', get_string('required'), 'required', null, 'client'); $mform->setType('password', PARAM_RAW); $mform->addElement('password', 'newpassword1', get_string('newpassword')); $mform->addRule('newpassword1', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword1', PARAM_RAW); $mform->addElement('password', 'newpassword2', get_string('newpassword') . ' (' . get_String('again') . ')'); $mform->addRule('newpassword2', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword2', PARAM_RAW); if (empty($CFG->passwordchangetokendeletion) and !empty(webservice::get_active_tokens($USER->id))) { $mform->addElement('advcheckbox', 'signoutofotherservices', get_string('signoutofotherservices')); $mform->addHelpButton('signoutofotherservices', 'signoutofotherservices'); $mform->setDefault('signoutofotherservices', 1); } // hidden optional params $mform->addElement('hidden', 'id', 0); $mform->setType('id', PARAM_INT); // buttons if (get_user_preferences('auth_forcepasswordchange')) { $this->add_action_buttons(false); } else { $this->add_action_buttons(true); } }
function definition() { global $USER, $CFG; $mform = $this->_form; $mform->setDisableShortforms(true); // visible elements $mform->addElement('static', 'username', get_string('username'), $USER->username); if (!empty($CFG->passwordpolicy)) { $mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy()); } $mform->addElement('password', 'password', get_string('oldpassword')); $mform->addRule('password', get_string('required'), 'required', null, 'client'); $mform->setType('password', PARAM_RAW); $mform->addElement('password', 'newpassword1', get_string('newpassword')); $mform->addRule('newpassword1', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword1', PARAM_RAW); $mform->addElement('password', 'newpassword2', get_string('newpassword') . ' (' . get_String('again') . ')'); $mform->addRule('newpassword2', get_string('required'), 'required', null, 'client'); $mform->setType('newpassword2', PARAM_RAW); // hidden optional params $mform->addElement('hidden', 'id', 0); $mform->setType('id', PARAM_INT); // buttons if (get_user_preferences('auth_forcepasswordchange')) { $this->add_action_buttons(false); } else { $this->add_action_buttons(true); } }
<?php /// $Id$ /// Search and replace strings throughout all texts in the whole database require_once '../config.php'; require_once $CFG->dirroot . '/course/lib.php'; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('multilangupgrade'); $go = optional_param('go', 0, PARAM_BOOL); ################################################################### admin_externalpage_print_header(); print_heading(get_string('multilangupgrade', 'admin')); $strmultilangupgrade = get_String('multilangupgradeinfo', 'admin'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go' => 1, 'sesskey' => sesskey()); notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get'); admin_externalpage_print_footer(); die; } if (!($tables = $db->Metatables())) { // No tables yet at all. error("no tables"); } print_simple_box_start('center'); /// Turn off time limits, sometimes upgrades can be slow. @set_time_limit(0); @ob_implicit_flush(true); while (@ob_end_flush()) { } echo '<strong>Progress:</strong>';
/** * Validate the data in passed in the configuration page * @param $config - the information from the form mod.html */ function voicepresentation_process_options($config) { global $CFG; /******* we do the following verfication before submitting the configuration -The parameters sent can not be empty -The url of the server can not finish with a / -The url must start with http:// or https:// -The api account has to valid ********/ $config->module = "voicetools"; if (empty($config->servername)) { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_string('wrongconfigurationURLunavailable', 'voicepresentation')); error(get_string('wrongconfigurationURLunavailable', 'voicepresentation'), $_SERVER["HTTP_REFERER"]); } if (empty($config->adminusername)) { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_string('emptyAdminUsername', 'voicepresentation')); error(get_string('emptyAdminUsername', 'voicepresentation'), $_SERVER["HTTP_REFERER"]); } if (empty($config->adminpassword)) { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_string('emptyAdminPassword', 'voicepresentation')); error(get_string('emptyAdminPassword', 'voicepresentation'), $_SERVER["HTTP_REFERER"]); } if ($config->servername[strlen($config->servername) - 1] == '/') { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_String('trailingSlash', 'voicepresentation')); error(get_String('trailingSlash', 'voicepresentation'), $_SERVER["HTTP_REFERER"]); } if (!preg_match('/^http:\\/\\//', $config->servername) && !preg_match('/^https:\\/\\//', $config->servername)) { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_String('trailingHttp', 'voicepresentation')); error(get_String('trailingHttp', 'voicepresentation'), $_SERVER["HTTP_REFERER"]); } //check if the api account filled is correct and allowed $result = voicetools_api_check_documentbase($config->servername, $config->adminusername, $config->adminpassword, $CFG->wwwroot); if ($result != "ok") { if (get_string($result, 'voicepresentation') == "[[]]") { //the error description is not in the bundle wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, $result); error($result, 'javascript:history.back();'); } else { wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, get_String($result, 'voicepresentation')); error(get_string($result, 'voicepresentation'), 'javascript:history.back();'); } } //to make sure that all the necessary module are installed wimba_add_log(WIMBA_INFO, voicepresentation_LOGS, "php info :\n" . print_r(get_loaded_extensions(), true)); wimba_add_log(WIMBA_INFO, voicepresentation_LOGS, "The module is well configured"); }
print_error('nocourseid'); } require_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); require_capability('moodle/course:managegroups', $context); $strgrouping = get_string('grouping', 'group'); $strgroups = get_string('groups'); $strname = get_string('name'); $strdelete = get_string('delete'); $stredit = get_string('edit'); $srtnewgrouping = get_string('creategrouping', 'group'); $strgroups = get_string('groups'); $strgroupings = get_string('groupings', 'group'); $struses = get_string('activities'); $strparticipants = get_string('participants'); $strmanagegrping = get_String('showgroupsingrouping', 'group'); $navlinks = array(array('name' => $strparticipants, 'link' => $CFG->wwwroot . '/user/index.php?id=' . $courseid, 'type' => 'misc'), array('name' => $strgroupings, 'link' => '', 'type' => 'misc')); $navigation = build_navigation($navlinks); /// Print header print_header_simple($strgroupings, ': ' . $strgroupings, $navigation, '', '', true, '', navmenu($course)); // Add tabs $currenttab = 'groupings'; require 'tabs.php'; echo $OUTPUT->heading($strgroupings); $data = array(); if ($groupings = $DB->get_records('groupings', array('courseid' => $course->id), 'name')) { foreach ($groupings as $grouping) { $line = array(); $line[0] = format_string($grouping->name); if ($groups = groups_get_all_groups($courseid, 0, $grouping->id)) { $groupnames = array();
* * @package tool * @subpackage multilangupgrade * @copyright 2006 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('NO_OUTPUT_BUFFERING', true); require '../../../config.php'; require_once $CFG->dirroot . '/course/lib.php'; require_once $CFG->libdir . '/adminlib.php'; admin_externalpage_setup('toolmultilangupgrade'); $go = optional_param('go', 0, PARAM_BOOL); ################################################################### echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('pluginname', 'tool_multilangupgrade')); $strmultilangupgrade = get_String('multilangupgradeinfo', 'tool_multilangupgrade'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go' => 1, 'sesskey' => sesskey()); echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('/admin/tool/multilangupgrade/index.php', $optionsyes), new moodle_url('/admin/')); echo $OUTPUT->footer(); die; } if (!($tables = $DB->get_tables())) { // No tables yet at all. print_error('notables', 'debug'); } echo $OUTPUT->box_start(); /// Turn off time limits, sometimes upgrades can be slow. core_php_time_limit::raise(); echo '<strong>Progress:</strong>';
<?php // This file is part of Moodle - http://moodle.org/ // // 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/>. /** * This script handles adobeconnect Help Me Now settings. * * @package block_helpmenow * @copyright 2012 VLACS * @author David Zaharee <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die("Direct access to this location is not allowed."); $settings->add(new admin_setting_configtext('helpmenow_adobeconnect_url', get_string('adobeconnect_settings_url', 'block_helpmenow'), get_string('adobeconnect_settings_url_desc', 'block_helpmenow'), '', PARAM_TEXT, 100)); $settings->add(new admin_setting_configtext('helpmenow_adobeconnect_helpurl', get_string('adobeconnect_settings_helpurl', 'block_helpmenow'), get_String('adobeconnect_settings_helpurl_desc', 'block_helpmenow'), '', PARAM_TEXT, 100)); $settings->add(new admin_setting_configtext('helpmenow_adobeconnect_orgname', get_string('adobeconnect_settings_orgname', 'block_helpmenow'), get_string('adobeconnect_settings_orgname_desc', 'block_helpmenow'), '', PARAM_TEXT, 25)); $settings->add(new admin_setting_configtext('helpmenow_adobeconnect_logourl', get_string('adobeconnect_settings_logourl', 'block_helpmenow'), get_string('adobeconnect_settings_logourl_desc', 'block_helpmenow'), '', PARAM_TEXT, 100));
function definition() { global $USER, $CFG; $invite = false; $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (isloggedin() && has_capability('moodle/local:invitenewuser', $sitecontext)) { $invite = true; } $mform =& $this->_form; $mform->addElement('header', '', get_string('createuserandpass'), ''); $mform->addElement('text', 'username', get_string('username'), 'maxlength="100" size="12"'); $mform->setType('username', PARAM_NOTAGS); $mform->addRule('username', get_string('missingusername'), 'required', null, 'server'); $mform->addElement('passwordunmask', 'password1', get_string('password'), 'maxlength="32" size="12"'); $mform->setType('password1', PARAM_RAW); $mform->addRule('password1', get_string('missingpassword'), 'required', null, 'server'); $mform->addElement('passwordunmask', 'password2', get_string('password') . ' (' . get_String('again') . ')', 'maxlength="32" size="12"'); $mform->setType('password2', PARAM_RAW); $mform->addRule('password2', get_string('missingpassword'), 'required', null, 'server'); $mform->addElement('header', '', get_string('supplyinfo'), ''); $nameordercheck = new object(); $nameordercheck->firstname = 'a'; $nameordercheck->lastname = 'b'; if (fullname($nameordercheck) == 'b a') { // See MDL-4325 $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); } else { $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); } $mform->setType('firstname', PARAM_TEXT); $mform->addRule('firstname', get_string('missingfirstname'), 'required', null, 'server'); $mform->setType('lastname', PARAM_TEXT); $mform->addRule('lastname', get_string('missinglastname'), 'required', null, 'server'); $mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="20"'); $mform->setType('city', PARAM_TEXT); $mform->addRule('city', get_string('missingcity'), 'required', null, 'server'); $country = get_list_of_countries(); $default_country[''] = get_string('selectacountry'); $country = array_merge($default_country, $country); $mform->addElement('select', 'country', get_string('country'), $country); $mform->addRule('country', get_string('missingcountry'), 'required', null, 'server'); if (!empty($CFG->country)) { $mform->setDefault('country', $CFG->country); } else { $mform->setDefault('country', ''); } $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="20" size="20"'); $mform->setType('idnumber', PARAM_NOTAGS); $mform->addRule('idnumber', get_string('missingidnumber', 'local'), 'required', null, 'server'); profile_signup_fields($mform); if (!empty($CFG->sitepolicy)) { $mform->addElement('header', '', get_string('policyagreement'), ''); $mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>'); $mform->addElement('checkbox', 'policyagreed', get_string('policyaccept')); $mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server'); } $mform->addElement('hidden', 'data'); // buttons $this->add_action_buttons(true, get_string('createaccount')); }
function grade_display_grade_preferences($course, $preferences) { global $CFG; global $USER; if ($preferences->use_advanced == 0) { $useadvanced = 1; $buttonlabel = get_string('useadvanced', 'grades'); } else { $useadvanced = 0; $buttonlabel = get_String('hideadvanced', 'grades'); } $buttonoptions = array('action' => 'set_grade_preferences', 'id' => $course->id, 'sesskey' => sesskey(), 'use_advanced' => $useadvanced); print_heading_with_help(get_string('setpreferences', 'grades'), 'preferences', 'grade'); echo '<center>'; print_single_button('index.php', $buttonoptions, $buttonlabel, 'post'); echo '<br /></center>'; echo '<form id="set_grade_preferences" method="post" action="./index.php">'; echo '<input type="hidden" name="action" value="set_grade_preferences" />'; echo '<input type="hidden" name="id" value="' . $course->id . '" />'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<table border="0" cellspacing="2" cellpadding="5" align="center" class="gradeprefs generalbox">'; $optionsyesno = NULL; $optionsyesno[0] = get_string('no'); $optionsyesno[1] = get_string('yes'); if ($preferences->use_advanced) { $options = NULL; $options[0] = get_string('no'); $options[1] = get_string('toonly', 'moodle', $course->teachers); $options[2] = get_string('toeveryone', 'moodle'); // display grade weights echo '<tr><td class="c0">' . get_string('displayweighted', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($options, 'display_weighted', $preferences->display_weighted, ''); echo '</td></tr>'; // display points echo '<tr><td class="c0">' . get_string('displaypoints', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($options, 'display_points', $preferences->display_points, ''); echo '</td></tr>'; // display percent echo '<tr><td class="c0">' . get_string('displaypercent', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($options, 'display_percent', $preferences->display_percent, ''); echo '</td></tr>'; // display letter grade echo '<tr><td class="c0">' . get_string('displaylettergrade', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($options, 'display_letters', $preferences->display_letters, ''); echo '</td></tr>'; // letter grade uses weighted percent $options = NULL; $options[0] = get_string('usepercent', 'grades'); $options[1] = get_string('useweighted', 'grades'); echo '<tr><td class="c0">' . get_string('lettergrade', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($options, 'use_weighted_for_letter', $preferences->use_weighted_for_letter, ''); echo '</td></tr>'; } $headerlist[0] = get_string('none'); for ($i = 1; $i <= 100; $i++) { $headerlist[$i] = $i; } // reprint headers every n lines default n=0 echo '<tr><td class="c0">' . get_string('reprintheaders', 'grades') . ':</td>'; echo '<td class="c1">'; choose_from_menu($headerlist, 'reprint_headers', $preferences->reprint_headers, ''); echo '</td></tr>'; // show hidden grade items to teacher echo '<tr><td class="c0">' . get_string('showhiddenitems', 'grades') . '</td>'; echo '<td class="c1">'; choose_from_menu($optionsyesno, 'show_hidden', $preferences->show_hidden, ''); echo '</td></tr>'; echo '<tr><td colspan="3" align="center"><input type="submit" value="' . get_string('savepreferences', 'grades') . '" /></td></tr></table></form>'; }
function validation($data) { $errors = array(); if (array_key_exists('idnumber', $data)) { if ($data['id']) { $grade_item = new grade_item(array('id' => $data['id'], 'courseid' => $data['courseid'])); if ($grade_item->itemtype == 'mod') { $cm = get_coursemodule_from_instance($grade_item->itemmodule, $grade_item->iteminstance, $grade_item->courseid); } else { $cm = null; } } else { $grade_item = null; $cm = null; } if (!grade_verify_idnumber($data['idnumber'], $grade_item, $cm)) { $errors['idnumber'] = get_string('idnumbertaken'); } } /* if (array_key_exists('calculation', $data) and $data['calculation'] != '') { $grade_item = new grade_item(array('id'=>$data['id'], 'itemtype'=>$data['itemtype'], 'courseid'=>$data['courseid'])); $result = $grade_item->validate_formula($data['calculation']); if ($result !== true) { $errors['calculation'] = $result; } } */ if (array_key_exists('grademin', $data) and array_key_exists('grademax', $data)) { if ($data['grademax'] == $data['grademin'] or $data['grademax'] < $data['grademin']) { $errors['grademin'] = get_String('incorrectminmax', 'grades'); $errors['grademax'] = get_String('incorrectminmax', 'grades'); } } if (0 == count($errors)) { return true; } else { return $errors; } }
if ($groupid = groups_get_activity_group($cm)) { if (!$group = groups_get_group($groupid)) { print_error('invalidgroupid'); } $groupname = ': '.$group->name; } else { $groupname = ': '.get_string('allparticipants'); } } else { $groupid = 0; $groupname = ''; } $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!! $strchats = get_string('modulenameplural', 'chat'); $stridle = get_String('idle', 'chat'); if (!$chat_sid = chat_login_user($chat->id, 'basic', $groupid, $course)) { print_error('cantlogin', 'chat'); } if (!$chatusers = chat_get_users($chat->id, $groupid, $cm->groupingid)) { print_error('errornousers', 'chat'); } $DB->set_field('chat_users', 'lastping', time(), array('sid'=>$chat_sid)); if (!isset($SESSION->chatprefs)) { $SESSION->chatprefs = array(); } if (!isset($SESSION->chatprefs[$chat->id])) { $SESSION->chatprefs[$chat->id] = array();
/** * Show vpl submission restriction **/ function print_submission_restriction() { global $CFG, $USER; //TODO print_submission_restriction $filegroup = $this->get_required_fgm(); $files = $filegroup->getFileList(); if (count($files)) { $text = ''; $need_comma = false; foreach ($files as $file) { if ($need_comma) { $text .= ', '; } $text .= s($file); $need_comma = true; } $link = ' (<a href="'; $link .= vpl_mod_href('views/downloadrequiredfiles.php', 'id', $this->get_course_module()->id); $link .= '">'; $link .= get_string('download', VPL); $link .= '</a>)'; $this->print_restriction('requestedfiles', $text . $link); } if (count($files) != $this->instance->maxfiles) { $this->print_restriction('maxfiles'); } if ($this->instance->maxfilesize) { $mfs = $this->get_maxfilesize(); $this->print_restriction('maxfilesize', vpl_conv_size_to_string($mfs)); } $worktype = $this->instance->worktype; $values = array(0 => get_string('individualwork', VPL), 1 => get_string('groupwork', VPL)); if ($worktype) { $this->print_restriction('worktype', $values[$worktype] . ' ' . $this->fullname($USER)); } else { $this->print_restriction('worktype', $values[$worktype]); } if ($this->has_capability(VPL_GRADE_CAPABILITY)) { $str_yes = get_string('yes'); $str_no = get_string('no'); require_once $CFG->libdir . '/gradelib.php'; if ($gie = $this->get_grade_info()) { if ($gie->scaleid == 0) { $info = get_string('grademax', 'core_grades') . ': ' . vpl_rtzeros($gie->grademax); $info .= $gie->hidden ? ' <b>' . get_string('hidden', 'core_grades') . '</b>' : ''; $info .= $gie->locked ? ' <b>' . get_string('locked', 'core_grades') . '</b>' : ''; } else { $info = get_string('typescale', 'core_grades'); } $this->print_restriction(get_String('gradessettings', 'core_grades'), $info, true); } else { $this->print_restriction(get_String('gradessettings', 'core_grades'), get_string('nograde'), true); } if (trim($this->instance->password) > '') { $this->print_restriction(get_string('password'), $str_yes, true); } if (trim($this->instance->requirednet) > '') { $this->print_restriction('requirednet', s($this->instance->requirednet)); } if ($this->instance->restrictededitor) { $this->print_restriction('restrictededitor', $str_yes); } if ($this->instance->example) { $this->print_restriction('isexample', $str_yes); } if (!$this->get_course_module()->visible) { $this->print_restriction(get_string('visible'), $str_no, true); } if ($this->instance->basedon) { $basedon = new mod_vpl(null, $this->instance->basedon); $link = '<a href="'; $link .= vpl_mod_href('view.php', 'id', $basedon->cm->id); $link .= '">'; $link .= $basedon->get_printable_name(); $link .= '</a>'; $this->print_restriction('basedon', $link); } $noyes = array($str_no, $str_yes); $this->print_restriction('run', $noyes[$this->instance->run], false, false); if ($this->instance->debug) { $this->print_restriction('debug', $noyes[1], false, false); } $this->print_restriction('evaluate', $noyes[$this->instance->evaluate], false, !($this->instance->evaluate && $this->instance->evaluateonsubmission)); if ($this->instance->evaluate && $this->instance->evaluateonsubmission) { $this->print_restriction('evaluateonsubmission', $noyes[1]); } if ($this->instance->automaticgrading) { $this->print_restriction('automaticgrading', $noyes[1], false, false); } if ($this->instance->maxexetime) { $this->print_restriction('maxexetime', $this->instance->maxexetime . ' s', false, false); } if ($this->instance->maxexememory) { $this->print_restriction('maxexememory', vpl_conv_size_to_string($this->instance->maxexememory), false, false); } if ($this->instance->maxexefilesize) { $this->print_restriction('maxexefilesize', vpl_conv_size_to_string($this->instance->maxexefilesize), false, false); } if ($this->instance->maxexeprocesses) { $this->print_restriction('maxexeprocesses', null, false, false); } } }
global $CFG; require_once "../../config.php"; require_once 'lib/php/common/WimbaLib.php'; require_once 'lib/php/vt/WimbaVoicetoolsAPI.php'; $user = optional_param("user", PARAM_ALPHANUM); $pass = optional_param("pass", PARAM_ALPHANUM); $server = optional_param("server", PARAM_TEXT); $result = voicetools_api_check_documentbase($server, $user, $pass, $CFG->wwwroot); if ($result != "ok") { if (get_string($result, 'voicetools') == "[[" . $result . "]]") { //the error description is not in the bundle wimba_add_log(WIMBA_ERROR, "wimbaConfiguration", $result); echo get_string("generic_error", 'voicetools'); } else { wimba_add_log(WIMBA_ERROR, "wimbaConfiguration", get_String($result, 'voicetools')); echo get_string($result, 'voicetools'); } } else { $php_extension = get_loaded_extensions(); for ($i = 0; $i < count($php_extension); $i++) { if ($php_extension[$i] == "libxml" || $php_extension[$i] == "domxml") { wimba_add_log(WIMBA_INFO, 'wimbaConfiguration', "The module is well configured"); echo $result; exit; } } wimba_add_log(WIMBA_INFO, 'wimbaConfiguration', "domxml is not installed"); echo get_string("domxml", 'voicetools'); } //add important informations to the log
/** * Build form content */ function buildForm() { $this->_formBuilt = true; // rectangle around elements $this->addElement('header', 'top_header', get_string('newuser.contactform', 'samouk')); $this->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"'); $this->setType('email', PARAM_NOTAGS); $this->addRule('email', get_string('missingemail'), 'required', null, 'server'); $nameordercheck = new object(); $nameordercheck->firstname = 'a'; $nameordercheck->lastname = 'b'; if (fullname($nameordercheck) == 'b a') { // See MDL-4325 $this->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); $this->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); } else { $this->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"'); $this->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"'); } $this->setType('firstname', PARAM_TEXT); $this->addRule('firstname', get_string('missingfirstname'), 'required', null, 'server'); $this->setType('lastname', PARAM_TEXT); $this->addRule('lastname', get_string('missinglastname'), 'required', null, 'server'); // add an address textbox $this->addElement('text', 'address', get_string('address'), 'maxlength="70" size="30"'); $this->setType('address', PARAM_TEXT); // add a city textbox $this->addElement('text', 'city', get_string('city'), 'maxlength="20" size="30"'); $this->setType('city', PARAM_TEXT); $this->addRule('city', get_string('missingcity'), 'required', null, 'server'); $country = get_list_of_countries(); $default_country[''] = get_string('selectacountry'); $country = array_merge($default_country, $country); $this->addElement('select', 'country', get_string('country'), $country, 'width="130"'); $this->addRule('country', get_string('missingcountry'), 'required', null, 'server'); $this->setDefault('country', 'CZ'); // show phone number input box $this->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="30"'); $this->setType('phone1', PARAM_TEXT); // add custom profile elements profile_signup_fields($this); if (!empty($CFG->sitepolicy)) { $this->addElement('header', 'top_header', get_string('policyagreement')); $this->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>'); $this->addElement('checkbox', 'policyagreed', get_string('policyaccept')); $this->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server'); } ShowStepPrediction($this, 2, 4); // add command buttons $buttons[0] =& HTML_QuickForm::createElement('submit', $this->getButtonName('back'), get_string('button.prev', 'samouk')); $buttons[1] =& HTML_QuickForm::createElement('button', 'cancel', get_string('cancel'), array('onclick' => "javascript:location.href='index.php';")); $buttons[2] =& HTML_QuickForm::createElement('submit', $this->getButtonName('next'), get_string('button.next', 'samouk')); $this->addGroup($buttons, 'buttons', '', ' ', false); $this->setDefaultAction('next'); }