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


PHP FormValidator::validate方法代码示例

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


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

示例1: validate

 function validate()
 {
     $result = parent::validate();
     if ($result) {
         $this->update_model();
     }
     return $result;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:glossary_form.class.php

示例2: validate

 protected function validate()
 {
     FormValidator::validate($this->login, self::LOGIN, ValidationRules::NAME);
     FormValidator::validate($this->firstname, self::FIRSTNAME, ValidationRules::NAME);
     FormValidator::validate($this->lastname, self::LASTNAME, ValidationRules::NAME);
     FormValidator::validate($this->email, self::EMAIL, ValidationRules::EMAIL);
     FormValidator::validate($this->password, self::PASSWORD, ValidationRules::PASS);
     FormValidator::validateDate($this->year, $this->month, $this->day);
     FormValidator::validate($this->gender, self::GENDER, ValidationRules::NAME);
     FormValidator::validate($this->rules, self::RULES, ValidationRules::TICK);
 }
开发者ID:anzasolutions,项目名称:simlandia,代码行数:11,代码来源:registerfo.class.php

示例3: testInteger

 public function testInteger()
 {
     $profile = array('constraints' => array('field1' => array('required' => 1, 'integer' => 1), 'field2' => array('integer' => 1), 'field3' => array('integer' => 1), 'field4' => array('integer' => 1), 'field5' => array('integer' => 1)));
     $data = array('field1' => '5', 'field2' => 10, 'field3' => 'asdf', 'field4' => '5.1', 'field5' => 5.1);
     $validator = new FormValidator();
     $errors = $validator->validate($data, $profile);
     $this->assertEquals($errors, array('field3 is invalid.', 'field4 is invalid.', 'field5 is invalid.'));
     $this->assertEquals($validator->valid, array('field1', 'field2'));
     $this->assertEquals($validator->invalid, array('field3', 'field4', 'field5'));
     $this->assertEquals($validator->missing, array());
 }
开发者ID:lmcro,项目名称:fcms,代码行数:11,代码来源:FormValidatorTest.php

示例4: validate

 public function validate()
 {
     $result = (bool) parent::validate();
     if ($result == false) {
         return false;
     }
     $file = $this->get_file();
     if (empty($file)) {
         return false;
     }
     return true;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:12,代码来源:upload_file_form.class.php

示例5: forum_search

/**
 * Display the search form for the forum and display the search results
 * @return void display an HTML search results
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
 * @version march 2008, dokeos 1.8.5
 */
function forum_search()
{
    // Initialize the object.
    $form = new FormValidator('forumsearch', 'post', 'forumsearch.php?' . api_get_cidreq());
    // Setting the form elements.
    $form->addElement('header', '', get_lang('ForumSearch'));
    $form->addElement('text', 'search_term', get_lang('SearchTerm'), array('autofocus'));
    $form->applyFilter('search_term', 'html_filter');
    $form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation'));
    $form->addButtonSearch(get_lang('Search'));
    // Setting the rules.
    $form->addRule('search_term', get_lang('ThisFieldIsRequired'), 'required');
    $form->addRule('search_term', get_lang('TooShort'), 'minlength', 3);
    // Validation or display.
    if ($form->validate()) {
        $values = $form->exportValues();
        $form->setDefaults($values);
        $form->display();
        // Display the search results.
        display_forum_search_results(stripslashes($values['search_term']));
    } else {
        $form->display();
    }
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:30,代码来源:forumfunction.inc.php

示例6: displayDeleteSubmit

 /**
  * displayDeleteSubmit 
  * 
  * @return void
  */
 function displayDeleteSubmit()
 {
     $aid = $_GET['delete'];
     $cat = $_GET['cat'];
     $validator = new FormValidator();
     if ($this->fcmsUser->access >= 2) {
         $this->displayHeader();
         echo '
         <p class="error-alert">' . T_('You do not have permission to perform this task.') . '</p>';
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $errors = $validator->validate($_GET, $this->fcmsBook->getProfile('delete'));
     if ($errors !== true) {
         $this->displayHeader();
         displayErrors($errors);
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $sql = "SELECT a.`user`, u.`phpass`\n                FROM `fcms_address` AS a, `fcms_users` AS u\n                WHERE a.`id` = ?\n                AND a.`user` = u.`id`";
     $r = $this->fcmsDatabase->getRow($sql, $aid);
     if ($r === false) {
         $this->displayHeader();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     $user = $r['user'];
     $pass = $r['phpass'];
     if ($r['phpass'] !== 'NONMEMBER' && $r['phpass'] !== 'PRIVATE') {
         $this->displayHeader();
         echo '
         <p class="error-alert">' . T_('You cannot delete the address of a member.') . '</p>';
         $this->fcmsBook->displayAddressList($cat);
         $this->displayFooter();
         return;
     }
     $sql = "DELETE FROM `fcms_users` \n                WHERE `id` = ?";
     if (!$this->fcmsDatabase->delete($sql, $user)) {
         $this->displayHeader();
         $this->fcmsDatabase->displayError();
         $this->displayFooter();
         return;
     }
     $sql = "DELETE FROM fcms_address \n                WHERE id = ?";
     if (!$this->fcmsDatabase->delete($sql, $aid)) {
         $this->displayHeader();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     $this->displayAddressList();
     displayOkMessage(T_('Address Deleted Successfully.'));
     $this->displayFooter();
 }
开发者ID:lmcro,项目名称:fcms,代码行数:62,代码来源:addressbook.php

示例7: FormValidator

$skillIssueDate = api_get_local_time($skillIssue->getAcquiredSkillAt());
$skillIssueInfo = ['id' => $skillIssue->getId(), 'datetime' => api_format_date($skillIssueDate, DATE_TIME_FORMAT_SHORT), 'argumentation' => $skillIssue->getArgumentation(), 'source_name' => $skillIssue->getSourceName(), 'user_id' => $skillIssue->getUser()->getId(), 'user_complete_name' => $skillIssue->getUser()->getCompleteName(), 'skill_badge_image' => $skillIssue->getSkill()->getWebIconPath(), 'skill_name' => $skillIssue->getSkill()->getName(), 'skill_short_code' => $skillIssue->getSkill()->getShortCode(), 'skill_description' => $skillIssue->getSkill()->getDescription(), 'skill_criteria' => $skillIssue->getSkill()->getCriteria(), 'badge_asserion' => [$skillIssue->getAssertionUrl()], 'comments' => [], 'feedback_average' => $skillIssue->getAverage()];
$skillIssueComments = $skillIssue->getComments(true);
foreach ($skillIssueComments as $comment) {
    $commentDate = api_get_local_time($comment->getFeedbackDateTime());
    $skillIssueInfo['comments'][] = ['text' => $comment->getFeedbackText(), 'value' => $comment->getFeedbackValue(), 'giver_complete_name' => $comment->getFeedbackGiver()->getCompleteName(), 'datetime' => api_format_date($commentDate, DATE_TIME_FORMAT_SHORT)];
}
$form = new FormValidator('comment');
$form->addTextarea('comment', get_lang('NewComment'), ['rows' => 4]);
$form->applyFilter('comment', 'trim');
$form->addRule('comment', get_lang('ThisFieldIsRequired'), 'required');
$form->addSelect('value', [get_lang('Value'), get_lang('RateTheSkillInPractice')], ['-', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
$form->addHidden('user', $skillIssue->getUser()->getId());
$form->addHidden('issue', $skillIssue->getId());
$form->addButtonSend(get_lang('Send'));
if ($form->validate() && $allowComment) {
    $values = $form->exportValues();
    $skillUserComment = new Chamilo\CoreBundle\Entity\SkillRelUserComment();
    $skillUserComment->setFeedbackDateTime(new DateTime())->setFeedbackGiver($currentUser)->setFeedbackText($values['comment'])->setFeedbackValue($values['value'] ? $values['value'] : null)->setSkillRelUser($skillIssue);
    $entityManager->persist($skillUserComment);
    $entityManager->flush();
    header("Location: " . $skillIssue->getIssueUrl());
    exit;
}
if ($allowExport) {
    $backpack = 'https://backpack.openbadges.org/';
    $configBackpack = api_get_setting('openbadges_backpack');
    if (strcmp($backpack, $configBackpack) !== 0) {
        $backpack = $configBackpack;
    }
    $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:issued.php

示例8: FormValidator

        if (!api_site_use_cookie_warning_cookie_exist()) {
            if (Template::isToolBarDisplayedForUser()) {
                $tpl->assign('toolBarDisplayed', true);
            } else {
                $tpl->assign('toolBarDisplayed', false);
            }
            $tpl->assign('displayCookieUsageWarning', true);
        }
    }
}
$tpl->assign('web_admin_ajax_url', $admin_ajax_url);
$tpl->assign('blocks', $blocks);
if (api_is_platform_admin()) {
    $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());
        }
    }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:index.php

示例9: FormValidator

        continue;
    }
    $skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
    $gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$editForm = new FormValidator('skill_edit');
$editForm->addHeader(get_lang('SkillEdit'));
$editForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$editForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$editForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$editForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$editForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$editForm->addButtonSave(get_lang('Save'));
$editForm->addHidden('id', null);
$editForm->setDefaults($skillDefaultInfo);
if ($editForm->validate()) {
    $updated = $objSkill->edit($editForm->getSubmitValues());
    if ($updated) {
        Session::write('message', Display::return_message(get_lang('TheSkillHasBeenUpdated'), 'success'));
    } else {
        Session::write('message', Display::return_message(get_lang('CannotUpdateSkill'), 'error'));
    }
    Header::location(api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
}
/* view */
$tpl = new Template(get_lang('SkillEdit'));
$tpl->assign('content', $editForm->returnForm());
$tpl->display_one_col_template();
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:skill_edit.php

示例10: add_category_form

function add_category_form($in_action, $type = 'simple')
{
    $in_action = Security::remove_XSS($in_action);
    // Initiate the object
    $form = new FormValidator('note', 'post', api_get_self() . '?' . api_get_cidreq() . '&action=' . $in_action . "&type=" . $type);
    // Setting the form elements
    $form->addElement('header', get_lang('AddACategory'));
    $form->addElement('text', 'category_name', get_lang('CategoryName'), array('class' => 'span6'));
    $form->add_html_editor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Width' => '90%', 'Height' => '200'));
    $form->addElement('select', 'parent_id', get_lang('Parent'), array(), array('id' => 'parent_id'));
    $form->addElement('style_submit_button', 'SubmitNote', get_lang('AddTestCategory'), 'class="add"');
    // Setting the rules
    $form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
    // The validation or display
    if ($form->validate()) {
        $check = Security::check_token('post');
        if ($check) {
            $values = $form->getSubmitValues();
            $parent_id = isset($values['parent_id']) && isset($values['parent_id'][0]) ? $values['parent_id'][0] : null;
            $objcat = new Testcategory(0, $values['category_name'], $values['category_description'], $parent_id, $type, api_get_course_int_id());
            if ($objcat->addCategoryInBDD()) {
                Display::display_confirmation_message(get_lang('AddCategoryDone'));
            } else {
                Display::display_confirmation_message(get_lang('AddCategoryNameAlreadyExists'));
            }
        }
        Security::clear_token();
        display_add_category($type);
        display_categories($type);
    } else {
        display_goback($type);
        $token = Security::get_token();
        $form->addElement('hidden', 'sec_token');
        $form->setConstants(array('sec_token' => $token));
        $form->display();
    }
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:37,代码来源:tests_category.php

示例11: header

        header('Location: usergroups.php');
        exit;
    }
}
// Filters
$filters = array(array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')), array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title')));
$searchForm = new FormValidator('search', 'get', api_get_self() . '?id=' . $id);
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);
foreach ($filters as $param) {
    $searchForm->addElement($param['type'], $param['name'], $param['label']);
}
$searchForm->addButtonSearch();
$filterData = array();
if ($searchForm->validate()) {
    $filterData = $searchForm->getSubmitValues();
}
$conditions = array();
if (!empty($filters) && !empty($filterData)) {
    foreach ($filters as $filter) {
        if (isset($filter['name']) && isset($filterData[$filter['name']])) {
            $value = $filterData[$filter['name']];
            if (!empty($value)) {
                $conditions[$filter['name']] = $value;
            }
        }
    }
}
$data = $usergroup->get($id);
$course_list_in = $usergroup->get_courses_by_usergroup($id, true);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:add_courses_to_usergroup.php

示例12: hyvaksy_tarjous

function hyvaksy_tarjous($valittu_tarjous_tunnus, $syotetyt_lisatiedot)
{
    global $kukarow, $yhtiorow;
    $kukarow['kesken'] = $valittu_tarjous_tunnus;
    $validations = array('syotetyt_lisatiedot' => 'kirjain_numero');
    $validator = new FormValidator($validations);
    if ($validator->validate(array('syotetyt_lisatiedot' => $syotetyt_lisatiedot))) {
        //asetetaan myyntitilaus Myyntitilaus kesken Tulostusjonossa
        $query = "UPDATE lasku\n              SET sisviesti1='{$syotetyt_lisatiedot}'\n              WHERE yhtio='{$kukarow['yhtio']}'\n              AND tunnus='{$valittu_tarjous_tunnus}'";
        pupe_query($query);
        // Kopsataan valitut rivit uudelle myyntitilaukselle
        require "tilauksesta_myyntitilaus.inc";
        $tilauksesta_myyntitilaus = tilauksesta_myyntitilaus($valittu_tarjous_tunnus, '', '', '');
        if ($tilauksesta_myyntitilaus != '') {
            echo "{$tilauksesta_myyntitilaus}<br><br>";
            $query = "UPDATE lasku SET alatila='B' where yhtio='{$kukarow['yhtio']}' and tunnus='{$valittu_tarjous_tunnus}'";
            pupe_query($query);
        }
        $aika = date("d.m.y @ G:i:s", time());
        echo "<font class='message'>{$otsikko} {$kukarow['kesken']} " . t("valmis") . "!</font><br><br>";
        $tee = '';
        $tilausnumero = '';
        $laskurow = '';
        $kukarow['kesken'] = '';
        return true;
    }
    return false;
}
开发者ID:Hermut,项目名称:pupesoft,代码行数:28,代码来源:extranet_tarjoukset_ja_ennakot.php

示例13: add_edit_template

/**
 * Add (or edit) a template. This function displays the form and also takes
 * care of uploading the image and storing the information in the database
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
 * @version August 2008
 * @since Dokeos 1.8.6
 */
function add_edit_template()
{
    // Initialize the object.
    $id = isset($_GET['id']) ? '&id=' . Security::remove_XSS($_GET['id']) : '';
    $form = new FormValidator('template', 'post', 'settings.php?category=Templates&action=' . Security::remove_XSS($_GET['action']) . $id);
    // Setting the form elements: the header.
    if ($_GET['action'] == 'add') {
        $title = get_lang('AddTemplate');
    } else {
        $title = get_lang('EditTemplate');
    }
    $form->addElement('header', '', $title);
    // Setting the form elements: the title of the template.
    $form->addText('title', get_lang('Title'), false);
    // Setting the form elements: the content of the template (wysiwyg editor).
    $form->addHtmlEditor('template_text', get_lang('Text'), false, false, array('ToolbarSet' => 'AdminTemplates', 'Width' => '100%', 'Height' => '400'));
    // Setting the form elements: the form to upload an image to be used with the template.
    $form->addElement('file', 'template_image', get_lang('Image'), '');
    // Setting the form elements: a little bit information about the template image.
    $form->addElement('static', 'file_comment', '', get_lang('TemplateImageComment100x70'));
    // Getting all the information of the template when editing a template.
    if ($_GET['action'] == 'edit') {
        // Database table definition.
        $table_system_template = Database::get_main_table('system_template');
        $sql = "SELECT * FROM {$table_system_template} WHERE id = " . intval($_GET['id']) . "";
        $result = Database::query($sql);
        $row = Database::fetch_array($result);
        $defaults['template_id'] = intval($_GET['id']);
        $defaults['template_text'] = $row['content'];
        // Forcing get_lang().
        $defaults['title'] = get_lang($row['title']);
        // Adding an extra field: a hidden field with the id of the template we are editing.
        $form->addElement('hidden', 'template_id');
        // Adding an extra field: a preview of the image that is currently used.
        if (!empty($row['image'])) {
            $form->addElement('static', 'template_image_preview', '', '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $row['image'] . '" alt="' . get_lang('TemplatePreview') . '"/>');
        } else {
            $form->addElement('static', 'template_image_preview', '', '<img src="' . api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/noimage.gif" alt="' . get_lang('NoTemplatePreview') . '"/>');
        }
        // Setting the information of the template that we are editing.
        $form->setDefaults($defaults);
    }
    // Setting the form elements: the submit button.
    $form->addButtonSave(get_lang('Ok'), 'submit');
    // Setting the rules: the required fields.
    $form->addRule('template_image', get_lang('ThisFieldIsRequired'), 'required');
    $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
    $form->addRule('template_text', get_lang('ThisFieldIsRequired'), 'required');
    // if the form validates (complies to all rules) we save the information, else we display the form again (with error message if needed)
    if ($form->validate()) {
        $check = Security::check_token('post');
        if ($check) {
            // Exporting the values.
            $values = $form->exportValues();
            // Upload the file.
            if (!empty($_FILES['template_image']['name'])) {
                $upload_ok = process_uploaded_file($_FILES['template_image']);
                if ($upload_ok) {
                    // Try to add an extension to the file if it hasn't one.
                    $new_file_name = add_ext_on_mime(stripslashes($_FILES['template_image']['name']), $_FILES['template_image']['type']);
                    // The upload directory.
                    $upload_dir = api_get_path(SYS_APP_PATH) . 'home/default_platform_document/template_thumb/';
                    // Create the directory if it does not exist.
                    if (!is_dir($upload_dir)) {
                        mkdir($upload_dir, api_get_permissions_for_new_directories());
                    }
                    // Resize the preview image to max default and upload.
                    $temp = new Image($_FILES['template_image']['tmp_name']);
                    $picture_info = $temp->get_image_info();
                    $max_width_for_picture = 100;
                    if ($picture_info['width'] > $max_width_for_picture) {
                        $temp->resize($max_width_for_picture);
                    }
                    $temp->send_image($upload_dir . $new_file_name);
                }
            }
            // Store the information in the database (as insert or as update).
            $table_system_template = Database::get_main_table('system_template');
            if ($_GET['action'] == 'add') {
                $content_template = Security::remove_XSS($values['template_text'], COURSEMANAGERLOWSECURITY);
                $params = ['title' => $values['title'], 'content' => $content_template, 'image' => $new_file_name];
                Database::insert($table_system_template, $params);
                // Display a feedback message.
                Display::display_confirmation_message(get_lang('TemplateAdded'));
                echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>';
            } else {
                $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>' . Database::escape_string($values['template_text']) . '</body>';
                $sql = "UPDATE {$table_system_template} set title = '" . Database::escape_string($values['title']) . "', content = '" . $content_template . "'";
                if (!empty($new_file_name)) {
                    $sql .= ", image = '" . Database::escape_string($new_file_name) . "'";
                }
                $sql .= " WHERE id = " . intval($_GET['id']) . "";
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:settings.lib.php

示例14: validate

 protected function validate()
 {
     // temporarily ValidationRules::NONE validation rule is applied
     FormValidator::validate($this->comment, self::COMMENT, ValidationRules::NONE);
 }
开发者ID:anzasolutions,项目名称:simlandia,代码行数:5,代码来源:commentfo.class.php

示例15: getSearchPages

 /**
  * @param string $action
  */
 public function getSearchPages($action)
 {
     echo '<div class="actions">' . get_lang('SearchPages') . '</div>';
     if (isset($_GET['mode_table'])) {
         if (!isset($_GET['SearchPages_table_page_nr'])) {
             $_GET['search_term'] = isset($_POST['search_term']) ? $_POST['search_term'] : '';
             $_GET['search_content'] = isset($_POST['search_content']) ? $_POST['search_content'] : '';
             $_GET['all_vers'] = isset($_POST['all_vers']) ? $_POST['all_vers'] : '';
         }
         self::display_wiki_search_results($_GET['search_term'], $_GET['search_content'], $_GET['all_vers']);
     } else {
         // initiate the object
         $form = new FormValidator('wiki_search', 'post', api_get_self() . '?cidReq=' . api_get_course_id() . '&action=' . api_htmlentities($action) . '&session_id=' . api_get_session_id() . '&group_id=' . api_get_group_id() . '&mode_table=yes1');
         // Setting the form elements
         $form->addText('search_term', get_lang('SearchTerm'), true, array('autofocus' => 'autofocus'));
         $form->addElement('checkbox', 'search_content', null, get_lang('AlsoSearchContent'));
         $form->addElement('checkbox', 'all_vers', null, get_lang('IncludeAllVersions'));
         $form->addButtonSearch(get_lang('Search'), 'SubmitWikiSearch');
         // setting the rules
         $form->addRule('search_term', get_lang('TooShort'), 'minlength', 3);
         //TODO: before fixing the pagination rules worked, not now
         if ($form->validate()) {
             $form->display();
             $values = $form->exportValues();
             self::display_wiki_search_results($values['search_term'], $values['search_content'], $values['all_vers']);
         } else {
             $form->display();
         }
     }
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:33,代码来源:wiki.inc.php


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