本文整理汇总了PHP中FormValidator::getSubmitValues方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::getSubmitValues方法的具体用法?PHP FormValidator::getSubmitValues怎么用?PHP FormValidator::getSubmitValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::getSubmitValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCreation
/**
* function which process the creation of questions
* @param FormValidator $form the formvalidator instance
* @param Exercise $objExercise the Exercise instance
*/
public function processCreation($form, $objExercise = null)
{
$this->updateParentId($form->getSubmitValue('parent_id'));
$this->updateTitle($form->getSubmitValue('questionName'));
$this->updateDescription($form->getSubmitValue('questionDescription'));
$this->updateLevel($form->getSubmitValue('questionLevel'));
$this->updateCategory($form->getSubmitValue('questionCategory'));
// Save normal question if NOT media
if ($this->type != MEDIA_QUESTION) {
$this->save($objExercise->id);
$field_value = new ExtraFieldValue('question');
$params = $form->getSubmitValues();
$params['question_id'] = $this->id;
$field_value->save_field_values($params);
if ($objExercise) {
// modify the exercise
$objExercise->addToList($this->id);
$objExercise->update_question_positions();
}
}
}
示例2: FormValidator
$skillList = [0 => get_lang('None')];
$gradebookList = [];
foreach ($allSkills as $skill) {
$skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
$gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$createForm = new FormValidator('skill_create');
$createForm->addHeader(get_lang('CreateSkill'));
$createForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$createForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$createForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$createForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$createForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$createForm->addButtonSave(get_lang('Save'));
$createForm->addHidden('id', null);
$createForm->setDefaults($formDefaultValues);
if ($createForm->validate()) {
$created = $objSkill->add($createForm->getSubmitValues());
if ($created) {
Display::return_message(get_lang('TheSkillHasBeenCreated'), 'success');
} else {
Display::return_message(get_lang('CannotCreateSkill'), 'error');
}
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
exit;
}
//$tpl = new Template(get_lang('CreateSkill'));
echo $createForm->returnForm();
示例3: header
header('location:lp_controller.php?action=list&' . api_get_cidreq());
exit;
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list?' . api_get_cidreq(), 'name' => get_lang('LearningPaths'));
$form = new FormValidator('lp_add_category', 'post', 'lp_controller.php?' . api_get_cidreq());
// Form title
$form->addElement('header', null, get_lang('AddLPCategory'));
// Title
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
$values = $form->getSubmitValues();
if (!empty($values['id'])) {
learnpath::updateCategory($values);
$url = api_get_self() . '?action=list&' . api_get_cidreq();
header('Location: ' . $url);
exit;
} else {
learnpath::createCategory($values);
$url = api_get_self() . '?action=list&' . api_get_cidreq();
header('Location: ' . $url);
exit;
}
} else {
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
if ($id) {
$item = learnpath::getCategory($id);
示例4: array
$cidReset = true;
//require_once '../inc/global.inc.php';
$libpath = api_get_path(LIBRARY_PATH);
api_protect_admin_script();
$this_section = SECTION_PLATFORM_ADMIN;
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
Display::display_header(null);
$form = new FormValidator('filter_form', 'GET', api_get_self());
$career = new Career();
$condition = array('status = ?' => 1);
if ($form->validate()) {
$data = $form->getSubmitValues();
$filter = intval($data['filter']);
if (!empty($filter)) {
$condition = array('status = ? AND id = ? ' => array(1, $filter));
}
}
$careers = $career->get_all(array('status = ?' => 1));
//only status =1
$career_select_list = array();
$career_select_list[0] = ' -- ' . get_lang('Select') . ' --';
foreach ($careers as $item) {
$career_select_list[$item['id']] = $item['name'];
}
$form->addSelect('filter', get_lang('Career'), $career_select_list, array('id' => 'filter_1'));
$form->addButtonSearch(get_lang('Filter'));
// action links
示例5: FormValidator
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());
}
}
$extraContentForm->addTextarea('extra_content', null, ['id' => 'extra_content']);
示例6: processAnswersCreation
/**
* @param \FormValidator $form
*/
public function processAnswersCreation($form)
{
$params = $form->getSubmitValues();
$this->saveMedia($params);
}
示例7: array
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);
$course_list = CourseManager::get_courses_list(0, 0, 'title', 'asc', -1, null, api_get_current_access_url_id(), false, $conditions);
示例8: 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();
}
}
示例9: isset
$values['course_language'] = $course_request_info['course_language'];
$values['title'] = $course_request_info['title'];
$values['description'] = $course_request_info['description'];
//$values['category_code'] = $course_request_info['category_code'];
$values['tutor_name'] = $course_request_info['tutor_name'];
$values['visual_code'] = $course_request_info['visual_code'];
$values['request_date'] = $course_request_info['request_date'];
$values['objetives'] = $course_request_info['objetives'];
$values['target_audience'] = $course_request_info['target_audience'];
$values['status'] = $course_request_info['status'];
$values['info'] = $course_request_info['info'];
$values['exemplary_content'] = $course_request_info['exemplary_content'];
$form->setDefaults($values);
// Validate the form and perform the ordered actions.
if ($form->validate()) {
$course_request_values = $form->getSubmitValues();
// Detection which submit button has been pressed.
$submit_button = isset($_POST['save_button']) ? 'save_button' : (isset($_POST['accept_button']) ? 'accept_button' : (isset($_POST['reject_button']) ? 'reject_button' : (isset($_POST['ask_info_button']) ? 'ask_info_button' : 'submit_button')));
// Check the course code for avoiding duplication.
$course_code_ok = $course_request_values['wanted_code'] == $course_request_info['code'] ? true : !CourseRequestManager::course_code_exists($course_request_values['wanted_code']);
if ($course_code_ok) {
$message = array();
$is_error_message = false;
// Update the course request.
$update_ok = CourseRequestManager::update_course_request($id, $course_request_values['wanted_code'], $course_request_values['title'], $course_request_values['description'], $course_request_values['category_code'], $course_request_values['course_language'], $course_request_values['objetives'], $course_request_values['target_audience'], $course_request_values['user_id'], $course_request_values['exemplary_content']);
if ($update_ok) {
$message[] = sprintf(get_lang('CourseRequestUpdated'), $course_request_values['wanted_code']);
switch ($submit_button) {
case 'accept_button':
if (CourseRequestManager::accept_course_request($id)) {
$message[] = sprintf(get_lang('CourseRequestAccepted'), $course_request_values['wanted_code'], $course_request_values['wanted_code']);
示例10: header
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_global_admin_script();
if (!api_get_multiple_access_url()) {
header('Location: index.php');
exit;
}
// Create the form
$form = new FormValidator('add_url');
if ($form->validate()) {
$check = Security::check_token('post');
if ($check) {
$url_array = $form->getSubmitValues();
$url = Security::remove_XSS($url_array['url']);
$description = Security::remove_XSS($url_array['description']);
$active = intval($url_array['active']);
$url_id = $url_array['id'];
$url_to_go = 'access_urls.php';
if ($url_id != '') {
//we can't change the status of the url with id=1
if ($url_id == 1) {
$active = 1;
}
//checking url
if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
UrlManager::update($url_id, $url, $description, $active);
} else {
UrlManager::update($url_id, $url . '/', $description, $active);
示例11: getAttendanceBaseInLogin
/**
* Gets attendance base in the table:
* TABLE_STATISTIC_TRACK_E_COURSE_ACCESS
* @param bool $showForm
* @throws ViewException
*/
public function getAttendanceBaseInLogin($showForm = false, $exportToPdf = true)
{
$table = null;
$formToDisplay = null;
$startDate = null;
$endDate = null;
$sessionId = api_get_session_id();
if ($showForm) {
$form = new FormValidator('search', 'post', api_get_self() . '?' . api_get_cidreq() . '&action=calendar_logins');
$form->addDateRangePicker('range', get_lang('DateRange'));
$form->addButton('submit', get_lang('Submit'));
if ($form->validate()) {
$values = $form->getSubmitValues();
$startDate = api_get_utc_datetime($values['range_start']);
$endDate = api_get_utc_datetime($values['range_end']);
}
$formToDisplay = $form->returnForm();
} else {
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$startDate = $sessionInfo['access_start_date'];
$endDate = $sessionInfo['access_end_date'];
}
}
$attendance = new Attendance();
if ($exportToPdf) {
$result = $attendance->exportAttendanceLogin($startDate, $endDate);
if (empty($result)) {
api_not_allowed(true, get_lang('NoDataAvailable'));
}
}
$table = $attendance->getAttendanceLoginTable($startDate, $endDate);
$data = array('form' => $formToDisplay, 'table' => $table);
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('calendar_logins');
$this->view->render();
}
示例12: array
$form->addElement('button', 'submit', get_lang('Confirm'), array('class' => 'btn btn-primary'));
$formHtml = $form->return_form();
if ($form->validate()) {
$result = $form->getSubmitValues();
if (isset($result['left']) && $result['left']) {
$_SESSION['before_login_accepted'] = 1;
header('Location: ' . $urlOption1);
exit;
}
}
$form2 = new FormValidator('form');
if (!empty($option2) && !empty($urlOption2)) {
$renderer =& $form2->defaultRenderer();
$renderer->setHeaderTemplate('');
$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>');
$renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>');
$form2->addElement('html', $option2);
$form2->addElement('checkbox', 'right', null, get_lang('Yes'));
$form2->addElement('button', 'submit', get_lang('Send'));
$formHtml2 = $form2->return_form();
if ($form2->validate()) {
$result = $form2->getSubmitValues();
if (isset($result['right']) && $result['right']) {
header('Location: ' . $urlOption2);
exit;
}
}
}
$_template['form_option1'] = $formHtml;
$_template['form_option2'] = $formHtml2;
}
示例13: array
$form->addElement('hidden', '_extra_' . $extra_field['field_variable'], 0);
$field_display_text = $extra_field['field_display_text'];
$form->addElement('checkbox', 'extra_' . $extra_field['field_variable'], array(null, get_lang('AllUsersAreAutomaticallyRegistered')), get_lang('SpecialCourse'), $checked);
break;
}
}
$form->addElement('style_submit_button', 'button', get_lang('ModifyCourseInfo'), 'onclick="valide()"; class="save"');
// Set some default values
$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) / 1024 / 1024, 1);
$course['title'] = api_html_entity_decode($course['title'], ENT_QUOTES, $charset);
$course['real_code'] = $course['code'];
$course['add_teachers_to_sessions_courses'] = isset($course['add_teachers_to_sessions_courses']) ? $course['add_teachers_to_sessions_courses'] : 0;
$form->setDefaults($course);
// Validate form
if ($form->validate()) {
$course = $form->getSubmitValues();
$visibility = $course['visibility'];
global $_configuration;
$urlId = api_get_current_access_url_id();
if (isset($_configuration[$urlId]) && isset($_configuration[$urlId]['hosting_limit_active_courses']) && $_configuration[$urlId]['hosting_limit_active_courses'] > 0) {
// Check if
if ($course_info['visibility'] == COURSE_VISIBILITY_HIDDEN && $visibility != $course_info['visibility']) {
$num = CourseManager::countActiveCourses($urlId);
if ($num >= $_configuration[$urlId]['hosting_limit_active_courses']) {
api_warn_hosting_contact('hosting_limit_active_courses');
api_set_failure(get_lang('PortalActiveCoursesLimitReached'));
header('Location: course_list.php?action=show_msg&warn=' . urlencode(get_lang('PortalActiveCoursesLimitReached')));
exit;
}
}
}
示例14: 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();
示例15: FormValidator
$paypalForm->setDefaults($plugin->getPaypalParams());
// Platform Commissions
$commissionForm = new FormValidator('commissions');
if ($commissionForm->validate()) {
$commissionFormValues = $commissionForm->getSubmitValues();
$plugin->updateCommission($commissionFormValues);
Display::addFlash(Display::return_message(get_lang('Saved'), 'success'));
header('Location:' . api_get_self());
exit;
}
$commissionForm->addElement('number', 'commission', [$plugin->get_lang('Commission'), null, '%'], ['step' => 1, 'cols-size' => [3, 7, 1], 'min' => 0, 'max' => 100]);
$commissionForm->addButtonSave(get_lang('Save'));
$commissionForm->setDefaults($plugin->getPlatformCommission());
$transferForm = new FormValidator('transfer_account');
if ($transferForm->validate()) {
$transferFormValues = $transferForm->getSubmitValues();
$plugin->saveTransferAccount($transferFormValues);
Display::addFlash(Display::return_message(get_lang('Saved'), 'success'));
header('Location:' . api_get_self());
exit;
}
$transferForm->addText('tname', get_lang('Name'), false, ['cols-size' => [3, 8, 1]]);
$transferForm->addText('taccount', $plugin->get_lang('BankAccount'), false, ['cols-size' => [3, 8, 1]]);
$transferForm->addText('tswift', [$plugin->get_lang('SWIFT'), $plugin->get_lang('SWIFT_help')], false, ['cols-size' => [3, 8, 1]]);
$transferForm->addButtonCreate(get_lang('Add'));
$transferAccounts = $plugin->getTransferAccounts();
//view
$interbreadcrumb[] = ['url' => 'course_catalog.php', 'name' => $plugin->get_lang('CourseListOnSale')];
$interbreadcrumb[] = ['url' => 'configuration.php', 'name' => $plugin->get_lang('AvailableCoursesConfiguration')];
$templateName = $plugin->get_lang('PaymentsConfiguration');
$tpl = new Template($templateName);