Esempio n. 1
0
}
$user_fields = $authplugin->userfields;
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = $authplugin->get_title();
/// Get the auth descriptions (from core or own auth lang files)
$authdescription = $authplugin->get_description();
// output configuration form
echo $OUTPUT->header();
// choose an authentication method
echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"" . $auth . "\" />\n";
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
echo prevent_form_autofill_password();
// auth plugin description
echo $OUTPUT->box_start();
echo $OUTPUT->heading($authtitle);
echo $OUTPUT->box_start('informationbox');
echo $authdescription;
echo $OUTPUT->box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
echo $OUTPUT->box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
$PAGE->requires->string_for_js('unmaskpassword', 'core_form');
$PAGE->requires->yui_module('moodle-auth-passwordunmask', 'M.auth.passwordunmask');
echo $OUTPUT->footer();
Esempio n. 2
0
    /**
     * FilePicker JS template for repository login form including templates for each element type
     *
     * Must contain one <form> element with templates for different input types inside:
     * Elements with classes 'fp-login-popup', 'fp-login-textarea', 'fp-login-select' and
     * 'fp-login-input' are templates for displaying respective login form elements. Inside
     * there must be exactly one element with type <button>, <textarea>, <select> or <input>
     * (i.e. fp-login-popup should have <button>, fp-login-textarea should have <textarea>, etc.);
     * They may also contain the <label> element and it's content will be substituted with
     * label;
     *
     * You can also define elements with classes 'fp-login-checkbox', 'fp-login-text'
     * but if they are not found, 'fp-login-input' will be used;
     *
     * Element with class 'fp-login-radiogroup' will be used for group of radio inputs. Inside
     * it should hava a template for one radio input (with class 'fp-login-radio');
     *
     * Element with class 'fp-login-submit' will hold on click mouse event (form submission). It
     * will be removed if at least one popup element is present;
     *
     * @return string
     */
    private function fp_js_template_loginform()
    {
        $rv = '
<div class="fp-login-form">
    <div class="fp-content-center">
        <form class="form-horizontal">
            <div class="fp-formset">
                <div class="fp-login-popup control-group clearfix">
                    <div class="controls fp-popup">
                        <button class="fp-login-popup-but btn-primary btn">' . get_string('login', 'repository') . '</button>
                    </div>
                </div>
                <div class="fp-login-textarea control-group clearfix">
                    <div class="controls"><textarea></textarea></div>
                </div>
                <div class="fp-login-select control-group clearfix">
                    <label class="control-label"></label>

                    <div class="controls"><select></select></div>
                </div>';
        // HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
        $rv .= prevent_form_autofill_password();
        $rv .= '
                <div class="fp-login-input control-group clearfix">
                    <label class="control-label"></label>
                    <div class="controls"><input/></div>
                </div>
                <div class="fp-login-radiogroup control-group clearfix">
                    <label class="control-label"></label>
                    <div class="controls fp-login-radio"><input /> <label></label></div>
                </div>
            </div>
            <p><button class="fp-login-submit btn-primary btn">' . get_string('submit', 'repository') . '</button></p>
        </form>
    </div>
</div>';
        return $rv;
    }
Esempio n. 3
0
 /**
  * What to do when starting the form
  *
  * @param MoodleQuickForm $form reference of the form
  */
 function startForm(&$form)
 {
     global $PAGE;
     $this->_reqHTML = $form->getReqHTML();
     $this->_elementTemplates = str_replace('{req}', $this->_reqHTML, $this->_elementTemplates);
     $this->_advancedHTML = $form->getAdvancedHTML();
     $this->_collapseButtons = '';
     $formid = $form->getAttribute('id');
     parent::startForm($form);
     // HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
     $this->_hiddenHtml .= prevent_form_autofill_password();
     if ($form->isFrozen()) {
         $this->_formTemplate = "\n<div class=\"mform frozen\">\n{content}\n</div>";
     } else {
         $this->_formTemplate = "\n<form{attributes}>\n\t<div style=\"display: none;\">{hidden}</div>\n{collapsebtns}\n{content}\n</form>";
         $this->_hiddenHtml .= $form->_pageparams;
     }
     if ($form->is_form_change_checker_enabled()) {
         $PAGE->requires->yui_module('moodle-core-formchangechecker', 'M.core_formchangechecker.init', array(array('formid' => $formid)));
         $PAGE->requires->string_for_js('changesmadereallygoaway', 'moodle');
     }
     if (!empty($this->_collapsibleElements)) {
         if (count($this->_collapsibleElements) > 1) {
             $this->_collapseButtons = $this->_collapseButtonsTemplate;
             $this->_collapseButtons = str_replace('{strexpandall}', get_string('expandall'), $this->_collapseButtons);
             $PAGE->requires->strings_for_js(array('collapseall', 'expandall'), 'moodle');
         }
         $PAGE->requires->yui_module('moodle-form-shortforms', 'M.form.shortforms', array(array('formid' => $formid)));
     }
     if (!empty($this->_advancedElements)) {
         $PAGE->requires->strings_for_js(array('showmore', 'showless'), 'form');
         $PAGE->requires->yui_module('moodle-form-showadvanced', 'M.form.showadvanced', array(array('formid' => $formid)));
     }
 }
Esempio n. 4
0
 /**
  * FilePicker JS template for repository login form including templates for each element type
  *
  * @return string
  */
 protected function fp_js_template_loginform()
 {
     return $this->render_from_template('core/filemanager_loginform', ['autofillhack' => prevent_form_autofill_password()]);
 }