当前位置: 首页>>代码示例>>PHP>>正文


PHP FormValidator::addElement方法代码示例

本文整理汇总了PHP中FormValidator::addElement方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addElement方法的具体用法?PHP FormValidator::addElement怎么用?PHP FormValidator::addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormValidator的用法示例。


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

示例1: openid_form

function openid_form()
{
    $form = new FormValidator('openid_login', 'post', null, null, array('class' => 'form-vertical form_login'));
    $form->addElement('text', 'openid_url', array(get_lang('OpenIDURL'), Display::url(get_lang('OpenIDWhatIs'), 'main/auth/openid/whatis.php')), array('class' => 'openid_input'));
    $form->addElement('button', 'submit', get_lang('Login'));
    return $form->return_form();
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:7,代码来源:login.php

示例2: getSearchForm

 /**
  * @param string $url
  * @return \FormValidator
  */
 private function getSearchForm($url)
 {
     $form = new \FormValidator('search-form', 'get', $url, null, array('class' => 'form-inline'));
     $form->addElement('text', 'keyword');
     $form->addElement('button', 'submit', get_lang('Search'));
     return $form;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:11,代码来源:AdminController.php

示例3: getSearchForm

 /**
  * @return FormValidator
  */
 private function getSearchForm()
 {
     $form = new FormValidator('form-search', 'post', api_get_self() . '?action=subscribe&hidden_links=0', null, array('class' => 'form-search'));
     $form->addElement('hidden', 'search_course', '1');
     $form->addElement('text', 'search_term');
     $form->addElement('button', 'submit', get_lang('Search'));
     return $form;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:11,代码来源:courses_controller.php

示例4: lp_upload_quiz_main

function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : null;
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
    $form->addElement('label', '', $link);
    $table = new HTML_Table(array('class' => 'table'));
    $tableList = array(UNIQUE_ANSWER => get_lang('UniqueSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'), FILL_IN_BLANKS => get_lang('FillBlanks'), MATCHING => get_lang('Matching'), FREE_ANSWER => get_lang('FreeAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'));
    $table->setHeaderContents(0, 0, get_lang('QuestionType'));
    $table->setHeaderContents(0, 1, '#');
    $row = 1;
    foreach ($tableList as $key => $label) {
        $table->setCellContents($row, 0, $label);
        $table->setCellContents($row, 1, $key);
        $row++;
    }
    $table = $table->toHtml();
    $form->addElement('label', get_lang('QuestionType'), $table);
    $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
    $form->addElement('html', '<div id="options" style="display:none">');
    $form->addElement('text', 'correct_score', get_lang('CorrectScore'));
    $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
    $form->addElement('html', '</div>');
    $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
    $form->add_progress_bar();
    $form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz');
    // Display the upload field
    $form->display();
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:32,代码来源:upload_exercise.php

示例5: ch_qti2_display_form

/**
 * This function displays the form for import of the zip file with qti2
 */
function ch_qti2_display_form()
{
    $name_tools = get_lang('ImportQtiQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?show=test&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $formValidator = new FormValidator('qti_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $formValidator->addElement('header', $name_tools);
    $formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $formValidator->addButtonImport(get_lang('Upload'));
    $form .= $formValidator->returnForm();
    echo $form;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:16,代码来源:qti2.php

示例6: lp_upload_quiz_main

function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = Security::remove_XSS($_GET['lp_id']);
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate'), null, 16) . get_lang('DownloadExcelTemplate');
    $form->addElement('advanced_settings', $link);
    //button send document
    $form->addElement('style_submit_button', 'submit_upload_quiz', get_lang('Send'), 'class="upload"');
    // Display the upload field
    $form->display();
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:14,代码来源:upload_exercise.php

示例7: openid_form

function openid_form()
{
    //get_lang('OpenIdAuthentication')
    $form = new FormValidator('openid_login', 'post', null, null, array('class' => 'form-vertical form_login'));
    $form->addElement('text', 'openid_url', array(get_lang('OpenIDURL'), Display::url(get_lang('OpenIDWhatIs'), 'main/auth/openid/whatis.php')), array('class' => 'openid_input'));
    $form->addElement('button', 'submit', get_lang('Login'));
    return $form->return_form();
    /*
     return '<label for="openid_url">'.get_lang('OpenIDURL').' <a href="main/auth/openid/whatis.php" title="'.get_lang('OpenIDWhatIs').'">'.Display::return_icon('info3.gif',get_lang('Info')).'</a></label>
     <input type="text" id="openid_url" name="openid_url" style="background: url(main/img/openid_small_logo.png) no-repeat; background-color: #fff; background-position: 0 50%; padding-left:18px;" value="http://"></input>
    * <input type="submit" name="openid_login" value="'.get_lang('Enter').'" /><br /><br /></form></div>';
    *
    */
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:14,代码来源:login.php

示例8: aiken_display_form

/**
 * This function displays the form for import of the zip file with qti2
 * @param   string  Report message to show in case of error
 */
function aiken_display_form($msg = '')
{
    $name_tools = get_lang('ImportAikenQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $form .= $msg;
    $form_validator = new FormValidator('aiken_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $form_validator->addElement('header', $name_tools);
    $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight'));
    $form_validator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $form_validator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"');
    $form .= $form_validator->return_form();
    $form .= '<blockquote>' . get_lang('ImportAikenQuizExplanation') . '<br /><pre>' . get_lang('ImportAikenQuizExplanationExample') . '</pre></blockquote>';
    echo $form;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:20,代码来源:aiken_import.inc.php

示例9: createAnswersForm

 /**
  * function which redefine Question::createAnswersForm
  * @param FormValidator $form
  */
 function createAnswersForm($form)
 {
     $form->addElement('text', 'weighting', get_lang('Weighting'), array('class' => 'span1'));
     global $text, $class;
     // setting the save button here and not in the question class.php
     $form->addButtonSave($text, 'submitQuestion');
     if (!empty($this->id)) {
         $form->setDefaults(array('weighting' => float_format($this->weighting, 1)));
     } else {
         if ($this->isContent == 1) {
             $form->setDefaults(array('weighting' => '10'));
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:18,代码来源:oral_expression.class.php

示例10: return_form

 /**
  * Returns a Form validator Obj
  * @param   string  $url
  * @param   string  $action add, edit
  *
  * @return  FormValidator
  */
 public function return_form($url, $action)
 {
     $form = new FormValidator('career', 'post', $url);
     // Setting the form elements
     $header = get_lang('Add');
     if ($action == 'edit') {
         $header = get_lang('Modify');
     }
     $form->addElement('header', $header);
     $id = isset($_GET['id']) ? intval($_GET['id']) : '';
     $form->addElement('hidden', 'id', $id);
     $form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
     $form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'careers', 'Width' => '100%', 'Height' => '250'));
     $status_list = $this->get_status_list();
     $form->addElement('select', 'status', get_lang('Status'), $status_list);
     if ($action == 'edit') {
         $form->addElement('text', 'created_at', get_lang('CreatedAt'));
         $form->freeze('created_at');
     }
     if ($action == 'edit') {
         $form->addButtonSave(get_lang('Modify'), 'submit');
     } else {
         $form->addButtonCreate(get_lang('Add'), 'submit');
     }
     // Setting the defaults
     $defaults = $this->get($id);
     if (!empty($defaults['created_at'])) {
         $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
     }
     if (!empty($defaults['updated_at'])) {
         $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
     }
     $form->setDefaults($defaults);
     // Setting the rules
     $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
     return $form;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:44,代码来源:event_email_template.class.php

示例11: lp_upload_quiz_main

function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = isset($_GET['lp_id']) ? Security::remove_XSS($_GET['lp_id']) : null;
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
    $form->addElement('advanced_settings', $link);
    $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
    $form->addElement('html', '<div id="options" style="display:none">');
    $form->addElement('text', 'correct_score', get_lang('CorrectScore'));
    $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
    $form->addElement('html', '</div>');
    $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
    $form->add_progress_bar();
    $form->addElement('style_submit_button', 'submit_upload_quiz', get_lang('Send'), 'class="upload"');
    // Display the upload field
    $form->display();
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:20,代码来源:upload_exercise.php

示例12: create

 /**
  * Create a form validator based on an array of form data:
  *
  *         array(
  *             'name' => 'zombie_report_parameters',    //optional
  *             'method' => 'GET',                       //optional
  *             'items' => array(
  *                 array(
  *                     'name' => 'ceiling',
  *                     'label' => 'Ceiling',            //optional
  *                     'type' => 'date',
  *                     'default' => date()              //optional
  *                 ),
  *                 array(
  *                     'name' => 'active_only',
  *                     'label' => 'ActiveOnly',
  *                     'type' => 'checkbox',
  *                     'default' => true
  *                 ),
  *                 array(
  *                     'name' => 'submit_button',
  *                     'type' => 'style_submit_button',
  *                     'value' => get_lang('Search'),
  *                     'attributes' => array('class' => 'search')
  *                 )
  *             )
  *         );
  *
  * @param array $form_data
  *
  * @return FormValidator
  */
 public static function create($form_data)
 {
     if (empty($form_data)) {
         return null;
     }
     $form_name = isset($form_data['name']) ? $form_data['name'] : 'form';
     $form_method = isset($form_data['method']) ? $form_data['method'] : 'POST';
     $form_action = isset($form_data['action']) ? $form_data['action'] : '';
     $form_target = isset($form_data['target']) ? $form_data['target'] : '';
     $form_attributes = isset($form_data['attributes']) ? $form_data['attributes'] : null;
     $form_track_submit = isset($form_data['track_submit']) ? $form_data['track_submit'] : true;
     $result = new FormValidator($form_name, $form_method, $form_action, $form_target, $form_attributes, $form_track_submit);
     $defaults = array();
     foreach ($form_data['items'] as $item) {
         $name = $item['name'];
         $type = isset($item['type']) ? $item['type'] : 'text';
         $label = isset($item['label']) ? $item['label'] : '';
         if ($type == 'wysiwyg') {
             $element = $result->add_html_editor($name, $label);
         } else {
             $element = $result->addElement($type, $name, $label);
         }
         if (isset($item['attributes'])) {
             $attributes = $item['attributes'];
             $element->setAttributes($attributes);
         }
         if (isset($item['value'])) {
             $value = $item['value'];
             $element->setValue($value);
         }
         if (isset($item['default'])) {
             $defaults[$name] = $item['default'];
         }
         if (isset($item['rules'])) {
             $rules = $item['rules'];
             foreach ($rules as $rule) {
                 $message = $rule['message'];
                 $type = $rule['type'];
                 $format = isset($rule['format']) ? $rule['format'] : null;
                 $validation = isset($rule['validation']) ? $rule['validation'] : 'server';
                 $force = isset($rule['force']) ? $rule['force'] : false;
                 $result->addRule($name, $message, $type, $format, $validation, $reset, $force);
             }
         }
     }
     $result->setDefaults($defaults);
     return $result;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:80,代码来源:FormValidator.class.php

示例13: array

            $actionsLeft .= $item;
        }
    }
    $actionsRight = '';
    if (count($a_sessions) > 0) {
        $actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();'));
        $actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self() . '?export=csv');
    }
    $toolbar = Display::toolbarAction('toolbar-session', $content = array(0 => $actionsLeft, 1 => $actionsRight));
    echo $toolbar;
    echo Display::page_header(get_lang('YourSessionsList'));
} else {
    $a_sessions = Tracking::get_sessions_coached_by_user($id_coach);
}
$form = new FormValidator('search_course', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/session.php');
$form->addElement('text', 'keyword', get_lang('Keyword'));
$form->addButtonSearch(get_lang('Search'));
$keyword = '';
if ($form->validate()) {
    $keyword = $form->getSubmitValue('keyword');
}
$form->setDefaults(array('keyword' => $keyword));
$url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_sessions_tracking&keyword=' . Security::remove_XSS($keyword);
$columns = array(get_lang('Title'), get_lang('Date'), get_lang('NbCoursesPerSession'), get_lang('NbStudentPerSession'), get_lang('Details'));
// Column config
$columnModel = array(array('name' => 'name', 'index' => 'name', 'width' => '255', 'align' => 'left'), array('name' => 'date', 'index' => 'date', 'width' => '150', 'align' => 'left', 'sortable' => 'false'), array('name' => 'course_per_session', 'index' => 'course_per_session', 'width' => '150', 'sortable' => 'false'), array('name' => 'student_per_session', 'index' => 'student_per_session', 'width' => '100', 'sortable' => 'false'), array('name' => 'details', 'index' => 'details', 'width' => '100', 'sortable' => 'false'));
$extraParams = array('autowidth' => 'true', 'height' => 'auto');
$js = '<script>
    $(function() {
        ' . Display::grid_js('session_tracking', $url, $columns, $columnModel, $extraParams, array(), null, true) . '
    });
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:session.php

示例14: array

        }
    }
    if ($total_resource_weight != $total_weight) {
        Display::display_warning_message(get_lang('SumOfActivitiesWeightMustBeEqualToTotalWeight'));
    }
}
$filter = api_get_setting('certificate_filter_by_official_code');
$userList = array();
$filterForm = null;
$certificate_list = array();
if ($filter === 'true') {
    echo '<br />';
    $options = UserManager::getOfficialCodeGrouped();
    $options = array_merge(array('all' => get_lang('All')), $options);
    $form = new FormValidator('official_code_filter', 'POST', api_get_self() . '?' . api_get_cidreq() . '&cat_id=' . $cat_id);
    $form->addElement('select', 'filter', get_lang('OfficialCode'), $options);
    $form->addButton('submit', get_lang('Submit'));
    $filterForm = '<br />' . $form->return_form();
    if ($form->validate()) {
        $officialCode = $form->getSubmitValue('filter');
        if ($officialCode == 'all') {
            $certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
        } else {
            $userList = UserManager::getUsersByOfficialCode($officialCode);
            if (!empty($userList)) {
                $certificate_list = GradebookUtils::get_list_users_certificates($cat_id, $userList);
            }
        }
    } else {
        $certificate_list = GradebookUtils::get_list_users_certificates($cat_id);
    }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_display_certificate.php

示例15: FormValidator

    $extraContentForm = new FormValidator('block_extra_data', 'post', '#', null, array('id' => 'block-extra-data', 'class' => ''), FormValidator::LAYOUT_BOX_NO_LABEL);
    $extraContentFormRenderer = $extraContentForm->getDefaultRenderer();
    if ($extraContentForm->validate()) {
        $extraData = $extraContentForm->getSubmitValues();
        $extraData = array_map(['Security', 'remove_XSS'], $extraData);
        if (!empty($extraData['block'])) {
            if (!is_dir($adminExtraContentDir)) {
                mkdir($adminExtraContentDir, api_get_permissions_for_new_directories(), true);
            }
            if (!is_writable($adminExtraContentDir)) {
                die;
            }
            $fullFilePath = $adminExtraContentDir . $extraData['block'];
            $fullFilePath .= "_extra.html";
            file_put_contents($fullFilePath, $extraData['extra_content']);
            Header::location(api_get_self());
        }
    }
    $extraContentForm->addTextarea('extra_content', null, ['id' => 'extra_content']);
    $extraContentFormRenderer->setElementTemplate('<div class="form-group">{element}</div>', 'extra_content');
    $extraContentForm->addElement('hidden', 'block', null, array('id' => 'extra-block'));
    $extraContentForm->addButtonExport(get_lang('Save'), 'submit_extra_content');
    $tpl->assign('extraDataForm', $extraContentForm->returnForm());
}
// The template contains the call to the AJAX version checker
$admin_template = $tpl->get_template('admin/settings_index.tpl');
$content = $tpl->fetch($admin_template);
$tpl->assign('content', $content);
$tpl->assign('message', $message);
$tpl->display_one_col_template();
// Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:index.php


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