本文整理汇总了PHP中FormValidator::addDateRangePicker方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addDateRangePicker方法的具体用法?PHP FormValidator::addDateRangePicker怎么用?PHP FormValidator::addDateRangePicker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addDateRangePicker方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
$form_title = get_lang('EditNews');
$url = api_get_self() . '?id=' . intval($_GET['id']);
}
$form = new FormValidator('system_announcement', 'post', $url);
$form->addElement('header', '', $form_title);
$form->addText('title', get_lang('Title'), true);
$language_list = api_get_languages();
$language_list_with_keys = array();
$language_list_with_keys['all'] = get_lang('All');
for ($i = 0; $i < count($language_list['name']); $i++) {
$language_list_with_keys[$language_list['folder'][$i]] = $language_list['name'][$i];
}
$form->addElement('select', 'lang', get_lang('Language'), $language_list_with_keys);
$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'PortalNews', 'Width' => '100%', 'Height' => '300'));
$form->addDateRangePicker('range', get_lang('StartTimeWindow'), true, array('id' => 'date_range'));
$group = array();
$group[] = $form->createElement('checkbox', 'visible_teacher', null, get_lang('Teacher'));
$group[] = $form->createElement('checkbox', 'visible_student', null, get_lang('Student'));
$group[] = $form->createElement('checkbox', 'visible_guest', null, get_lang('Guest'));
$form->addGroup($group, null, get_lang('Visible'), '');
$form->addElement('hidden', 'id');
$userGroup = new UserGroup();
$group_list = $userGroup->get_all();
if (!empty($group_list)) {
$group_list = array_column($group_list, 'name', 'id');
$group_list[0] = get_lang('All');
$form->addElement('select', 'group', get_lang('AnnouncementForGroup'), $group_list);
}
$values['group'] = isset($values['group']) ? $values['group'] : '0';
$form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
示例2: displayTrackingAccessOverView
public static function displayTrackingAccessOverView($courseId, $sessionId, $studentId)
{
$courseId = intval($courseId);
$sessionId = intval($sessionId);
$studentId = intval($studentId);
$em = Database::getManager();
$sessionRepo = $em->getRepository('ChamiloCoreBundle:Session');
$courseList = [];
$sessionList = [];
$studentList = [];
if (!empty($courseId)) {
$course = $em->find('ChamiloCoreBundle:Course', $courseId);
$courseList[$course->getId()] = $course->getTitle();
}
if (!empty($sessionId)) {
$session = $em->find('ChamiloCoreBundle:Session', $sessionId);
$sessionList[$session->getId()] = $session->getName();
}
if (!empty($studentId)) {
$student = $em->find('ChamiloUserBundle:User', $studentId);
$studentList[$student->getId()] = $student->getCompleteName();
}
$form = new FormValidator('access_overview', 'GET');
$form->addElement('select_ajax', 'course_id', get_lang('SearchCourse'), $courseList, ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query(['a' => 'search_course_by_session_all', 'session_id' => $sessionId])]);
$form->addElement('select_ajax', 'session_id', get_lang('SearchSession'), $sessionList, ['url_function' => "\n function () {\n var params = \$.param({\n a: 'search_session_by_course',\n course_id: \$('#course_id').val() || 0\n });\n\n return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;\n }\n "]);
$form->addSelect('profile', get_lang('Profile'), ['' => get_lang('Select'), STUDENT => get_lang('Student'), COURSEMANAGER => get_lang('CourseManager'), DRH => get_lang('Drh')], ['id' => 'profile']);
$form->addElement('select_ajax', 'student_id', get_lang('SearchUsers'), $studentList, ['placeholder' => get_lang('All'), 'url_function' => "\n function () {\n var params = \$.param({\n a: 'search_user_by_course',\n session_id: \$('#session_id').val(),\n course_id: \$('#course_id').val()\n });\n\n return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;\n }\n "]);
$form->addDateRangePicker('date', get_lang('DateRange'), true, ['id' => 'date_range', 'format' => 'YYYY-MM-DD', 'timePicker' => 'false', 'validate_format' => 'Y-m-d']);
$form->addHidden('display', 'accessoverview');
$form->addRule('course_id', get_lang('Required'), 'required');
$form->addRule('profile', get_lang('Required'), 'required');
$form->addButton('submit', get_lang('Generate'), 'gear', 'primary');
$table = null;
if ($form->validate()) {
$table = new SortableTable('tracking_access_overview', ['MySpace', 'getNumberOfRrackingAccessOverview'], ['MySpace', 'getUserDataAccessTrackingOverview'], 0);
$table->additional_parameters = $form->exportValues();
$table->set_header(0, get_lang('LoginDate'), true);
$table->set_header(1, get_lang('Username'), true);
if (api_is_western_name_order()) {
$table->set_header(2, get_lang('FirstName'), true);
$table->set_header(3, get_lang('LastName'), true);
} else {
$table->set_header(2, get_lang('LastName'), true);
$table->set_header(3, get_lang('FirstName'), true);
}
$table->set_header(4, get_lang('Clicks'), false);
$table->set_header(5, get_lang('IP'), false);
$table->set_header(6, get_lang('TimeLoggedIn'), false);
}
$template = new Template(null, false, false, false, false, false, false);
$template->assign('form', $form->returnForm());
$template->assign('table', $table ? $table->return_table() : null);
echo $template->fetch($template->get_template('my_space/accessoverview.tpl'));
}
示例3: 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();
}
示例4: array
case 'pdf':
$params = array('add_signatures' => false, 'filename' => $fileName, 'pdf_title' => "{$reportTitle} - {$reportSubTitle}", 'pdf_description' => get_lang('TeacherTimeReport'), 'format' => 'A4-L', 'orientation' => 'L');
$pdfContent = Export::convert_array_to_html($dataToExport);
Export::export_html_to_pdf($pdfContent, $params);
break;
case 'xls':
array_unshift($dataToExport, array($reportTitle), array($reportSubTitle), array());
Export::export_table_xls_html($dataToExport, $fileName);
break;
}
die;
}
$form->addSelect('course', get_lang('Course'), $optionsCourses, ['id' => 'courses']);
$form->addSelect('session', get_lang('Session'), $optionsSessions, ['id' => 'session']);
$form->addSelect('teacher', get_lang('Teacher'), $optionsTeachers, ['id' => 'teacher']);
$form->addDateRangePicker('daterange', get_lang('Date'), false, ['id' => 'daterange', 'maxDate' => $limitDate->format('Y-m-d'), 'format' => 'YYYY-MM-DD', 'timePicker' => 'false', 'value' => "{$selectedFrom} / {$selectedUntil}"]);
$form->addButtonFilter(get_lang('Filter'));
$form->addHidden('from', '');
$form->addHidden('until', '');
$form->setDefaults(['course' => $selectedCourse, 'session' => $selectedSession, 'teacher' => $selectedTeacher, 'date_range' => "{$selectedFrom} / {$selectedUntil}", 'from' => $selectedFrom, 'until' => $selectedUntil]);
$tpl = new Template($toolName);
$tpl->assign('reportTitle', $reportTitle);
$tpl->assign('reportSubTitle', $reportSubTitle);
$tpl->assign('selectedCourse', $selectedCourse);
$tpl->assign('selectedSession', $selectedSession);
$tpl->assign('selectedTeacher', $selectedTeacher);
$tpl->assign('selectedFrom', $selectedFrom);
$tpl->assign('selectedUntil', $selectedUntil);
$tpl->assign('withFilter', $withFilter);
$tpl->assign('courses', $courseList);
$tpl->assign('sessions', $sessionsList);