本文整理汇总了PHP中FormValidator::addButtonFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addButtonFilter方法的具体用法?PHP FormValidator::addButtonFilter怎么用?PHP FormValidator::addButtonFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addButtonFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
if (empty($session_id)) {
$session_id = 1;
}
$form = new FormValidator('search_simple', 'POST', '', '', null, false);
//Get session list
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$my_session_list = array();
foreach ($session_list as $sesion_item) {
$my_session_list[$sesion_item['id']] = $sesion_item['name'];
}
if (count($session_list) == 0) {
$my_session_list[0] = get_lang('None');
}
$form->addElement('select', 'session_id', get_lang('Sessions'), $my_session_list);
$form->addButtonFilter(get_lang('Filter'));
if (!empty($_REQUEST['score'])) {
$filter_score = intval($_REQUEST['score']);
} else {
$filter_score = 70;
}
if (!empty($_REQUEST['session_id'])) {
$session_id = intval($_REQUEST['session_id']);
} else {
$session_id = 0;
}
if (empty($session_id)) {
$session_id = key($my_session_list);
}
$form->setDefaults(array('session_id' => $session_id));
$course_list = SessionManager::get_course_list_by_session_id($session_id);
示例2: FormValidator
$nameFilter = null;
$minFilter = 0;
$maxFilter = 0;
$form = new FormValidator('search_filter_form', 'get', null, null, [], FormValidator::LAYOUT_INLINE);
if ($form->validate()) {
$formValues = $form->getSubmitValues();
$nameFilter = isset($formValues['name']) ? $formValues['name'] : null;
$minFilter = isset($formValues['min']) ? $formValues['min'] : 0;
$maxFilter = isset($formValues['max']) ? $formValues['max'] : 0;
}
$form->addHeader($plugin->get_lang('SearchFilter'));
$form->addText('name', get_lang('SessionName'), false);
$form->addElement('number', 'min', $plugin->get_lang('MinimumPrice'), ['step' => '0.01', 'min' => '0']);
$form->addElement('number', 'max', $plugin->get_lang('MaximumPrice'), ['step' => '0.01', 'min' => '0']);
$form->addHtml('<hr>');
$form->addButtonFilter(get_lang('Search'));
$courseList = $plugin->getCatalogCourseList($nameFilter, $minFilter, $maxFilter);
//View
if (api_is_platform_admin()) {
$interbreadcrumb[] = ['url' => 'configuration.php', 'name' => $plugin->get_lang('AvailableCoursesConfiguration')];
$interbreadcrumb[] = ['url' => 'paymentsetup.php', 'name' => $plugin->get_lang('PaymentsConfiguration')];
} else {
$interbreadcrumb[] = ['url' => 'course_panel.php', 'name' => get_lang('TabsDashboard')];
}
$templateName = $plugin->get_lang('CourseListOnSale');
$tpl = new Template($templateName);
$tpl->assign('search_filter_form', $form->returnForm());
$tpl->assign('showing_courses', true);
$tpl->assign('courses', $courseList);
$tpl->assign('sessions_are_included', $includeSessions);
$content = $tpl->fetch('buycourses/view/catalog.tpl');
示例3: array
}
foreach ($temp_course_list as $temp_course_item) {
$course_item = CourseManager::get_course_information($temp_course_item['code']);
$course_select_list[$temp_course_item['code']] = $course_item['title'];
}
//Get session list
$session_list = SessionManager::get_sessions_list(array(), array('name'));
$my_session_list = array();
$my_session_list[0] = get_lang('None');
foreach ($session_list as $sesion_item) {
$my_session_list[$sesion_item['id']] = $sesion_item['name'];
}
$form = new FormValidator('search_simple', 'POST', '', '', null, false);
$form->addElement('select', 'session_id', get_lang('Sessions'), $my_session_list, array('id' => 'session_id', 'onchange' => 'load_courses();'));
$form->addElement('select', 'course_code', get_lang('Courses'), $course_select_list);
$form->addButtonFilter(get_lang('Filter'), 'submit_form');
if (!empty($_REQUEST['course_code'])) {
$course_code = $_REQUEST['course_code'];
} else {
$course_code = '';
}
if (empty($course_code)) {
$course_code = 0;
}
$form->setDefaults(array('course_code' => (string) $course_code));
$course_info = api_get_course_info($course_code);
if (!empty($course_info)) {
$list = new LearnpathList('', $course_code);
$lp_list = $list->get_flat_list();
$main_question_list = array();
foreach ($lp_list as $lp_id => $lp) {
示例4: displayActions
/**
* @param int $filter
* @param string $view
* @return string
*/
public function displayActions($view, $filter = 0)
{
$courseInfo = api_get_course_info();
$actions = "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php?type={$this->type}'>" . Display::return_icon('calendar.png', get_lang('Calendar'), '', ICON_SIZE_MEDIUM) . "</a>";
$courseCondition = '';
if (!empty($courseInfo)) {
$courseCondition = api_get_cidreq();
}
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_list.php?type={$this->type}&" . $courseCondition . "'>" . Display::return_icon('week.png', get_lang('AgendaList'), '', ICON_SIZE_MEDIUM) . "</a>";
if (api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) || GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
if ($this->type == 'course') {
$form = null;
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'post', '', '', array(), FormValidator::LAYOUT_INLINE);
$attributes = array('multiple' => false, 'id' => 'select_form_id_search');
$selectedValues = $this->parseAgendaFilter($filter);
$this->showToForm($form, $selectedValues, $attributes);
$form = $form->returnForm();
}
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=add&type=course'>" . Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM) . "</a>";
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=importical&type=course'>" . Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM) . "</a>";
if ($view == 'calendar') {
$actions .= $form;
}
}
}
if (api_is_platform_admin() || api_is_teacher() || api_is_student_boss() || api_is_drh() || api_is_session_admin() || api_is_coach()) {
if ($this->type == 'personal') {
$form = null;
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'get', api_get_self() . '?type=personal&', '', array(), FormValidator::LAYOUT_INLINE);
$sessions = SessionManager::get_sessions_by_user(api_get_user_id());
$form->addHidden('type', 'personal');
$sessions = array_column($sessions, 'session_name', 'session_id');
$sessions = ['0' => get_lang('SelectAnOption')] + $sessions;
$form->addSelect('session_id', get_lang('Session'), $sessions, ['id' => 'session_id']);
$form->addButtonFilter(get_lang('Filter'));
$form->addButtonReset(get_lang('Reset'));
$form = $form->returnForm();
}
if ($view == 'calendar') {
$actions .= $form;
}
}
}
return $actions;
}