function form_rows(\AV\Form\FormViewInterface $form, $attributes = [])
{
    $html = '';
    foreach ($form->getFields() as $name => $fieldData) {
        $html .= form_row($fieldData, isset($attributes[$name]) ? $attributes[$name] : []);
    }
    return $html;
}
Exemple #2
0
        // Display form profile
        if (trim($profileText) != '') {
            $out .= '<div class="info profileEdit">' . $profileText . '</div>';
        }
        $out .= user_html_form($userId);
        break;
    case DISP_MOREINFO_FORM:
        // Display request course creator form
        $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exMoreInfo" />' . "\n" . '<table>' . "\n";
        foreach ($extraInfoDefList as $extraInfoDef) {
            $currentValue = array_key_exists($extraInfoDef['propertyId'], $userInfo) ? $userInfo[$extraInfoDef['propertyId']] : $extraInfoDef['defaultValue'];
            $requirement = (bool) (true == $extraInfoDef['required']);
            $labelExtraInfoDef = $extraInfoDef['label'];
            $out .= form_input_text('extraInfoList[' . claro_htmlentities($extraInfoDef['propertyId']) . ']', $currentValue, get_lang($labelExtraInfoDef), $requirement);
        }
        $out .= '<tr valign="top">' . "\n" . '<td>' . get_lang('Submit') . ': </td>' . "\n" . '<td>' . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp; ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td>' . '</tr>' . "\n" . form_row('&nbsp;', '<small>' . get_lang('<span class="required">*</span> denotes required field') . '</small>') . '</table>' . "\n" . '</form>' . "\n";
        break;
    case DISP_REQUEST_COURSE_CREATOR_STATUS:
        $out .= '<p>' . get_lang('Fill in the text area to motivate your request and then submit the form to send it to platform administrators') . '</p>';
        // Display request course creator form
        $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exCCstatus" />' . "\n" . '<table>' . "\n" . form_input_textarea('explanation', '', get_lang('Comment'), true, 6) . '<tr valign="top">' . "\n" . '<td>' . get_lang('Submit') . ': </td>' . "\n" . '<td><input type="submit" value="' . get_lang('Ok') . '" />&nbsp; ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td></tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n";
        break;
    case DISP_REQUEST_REVOQUATION:
        if (get_conf('can_request_revoquation')) {
            $out .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exRevoquation" />' . "\n" . '<table>' . "\n" . form_input_text('loginToDelete', '', get_lang('Username'), true) . form_input_password('passwordToDelete', '', get_lang('Password'), true) . form_input_textarea('explanation', '', get_lang('Comment'), true, 6) . '<tr valign="top">' . "\n" . '<td>' . get_lang('Delete my account') . ': </td>' . "\n" . '<td>' . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp; ' . "\n" . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . "\n" . '</td></tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n";
        }
        break;
}
// end switch display
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Exemple #3
0
/**
 * Prepare an html output of an input file wich  would be include in a <form>
 *
 * @param string $name use for name and for id
 * @return string : html stream
 */
function form_input_file($name, $displayedName = '', $required = false)
{
    if (empty($displayedName)) {
        $displayedName = $name;
    }
    if ($required) {
        $displayedName = form_required_field($displayedName);
    }
    return form_row('<label for="' . $name . '">' . $displayedName . '</label>&nbsp;: ', '<input type="file" ' . ' id="' . $name . '" name="' . $name . '"' . ' />');
}
Exemple #4
0
/**
 * Display form to search already registered users to add to course
 * Used when course managers can only add already registered users to their courses
 * @author Jean-Roch Meurisse <*****@*****.**>
 * @param $data array to fill the form
 */
function user_html_search_form($data)
{
    // init form
    $html = '<form action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" enctype="multipart/form-data" >' . "\n" . claro_form_relay_context() . form_input_hidden('cmd', 'registration') . form_input_hidden('claroFormId', uniqid(''));
    // init table
    $html .= '<table class="claroRecord" cellpadding="3" cellspacing="0" border="0">' . "\n";
    // display search criteria
    $html .= form_input_text('lastname', '', get_lang('Last name'), false);
    $html .= form_input_text('firstname', '', get_lang('First name'), false);
    if (get_conf('ask_for_official_code')) {
        $html .= form_input_text('officialCode', '', get_lang('Administrative code'), false);
    }
    $html .= form_input_text('username', '', get_lang('Username'), false);
    $html .= form_input_text('email', $data['email'], get_lang('Email'), false);
    // Profile settings for user to add (tutor/course manager)
    $html .= form_row(get_lang('Group Tutor') . '&nbsp;: ', '<input type="radio" name="tutor" value="1" id="tutorYes" ' . ($data['tutor'] ? 'checked="checked"' : '') . ' />' . '<label for="tutorYes">' . get_lang('Yes') . '</label>' . '<input type="radio" name="tutor" value="0"  id="tutorNo" ' . (!$data['tutor'] ? 'checked="checked"' : '') . ' />' . '<label for="tutorNo">' . get_lang('No') . '</label>');
    $html .= form_row(get_lang('Manager') . '&nbsp;: ', '<input type="radio" name="courseAdmin" value="1" id="courseAdminYes" ' . ($data['courseAdmin'] ? 'checked="checked"' : '') . ' />' . '<label for="courseAdminYes">' . get_lang('Yes') . '</label>' . '<input type="radio" name="courseAdmin" value="0" id="courseAdminNo" ' . ($data['courseAdmin'] ? '' : 'checked="checked"') . ' />' . '<label for="courseAdminNo">' . get_lang('No') . '</label>');
    // Submit
    $html .= form_row('&nbsp;', '<input type="submit" name="applySearch" id="applySearch" value="' . get_lang('Search') . '" />&nbsp;' . claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['HTTP_REFERER'])), get_lang('Cancel')));
    // close table and form
    $html .= '</table>' . "\n" . '</form>' . "\n";
    return $html;
}