本文整理汇总了PHP中FormValidator::addButtonExport方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addButtonExport方法的具体用法?PHP FormValidator::addButtonExport怎么用?PHP FormValidator::addButtonExport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addButtonExport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: FormValidator
if ($access_url_id != -1) {
$sql = "SELECT s.id, name FROM {$tbl_session} s\n\t\t\tINNER JOIN {$tbl_session_rel_access_url} as session_rel_url\n\t\t\tON (s.id = session_rel_url.session_id)\n\t\t\tWHERE access_url_id = {$access_url_id}\n\t\t\tORDER BY name";
}
}
$result = Database::query($sql);
$Sessions = Database::store_result($result);
echo '<div class="actions">';
echo '<a href="../session/session_list.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('SessionList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg, false);
//main API
}
$form = new FormValidator('session_export', 'post', api_get_self());
$form->addElement('hidden', 'formSent', 1);
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
$form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
$options = array();
$options['0'] = get_lang('AllSessions');
foreach ($Sessions as $enreg) {
$options[$enreg['id']] = $enreg['name'];
}
$form->addElement('select', 'session_id', get_lang('WhichSessionToExport'), $options);
$form->addButtonExport(get_lang('ExportSession'));
$defaults = array();
$defaults['file_type'] = 'csv';
$form->setDefaults($defaults);
$form->display();
unset($Courses);
Display::display_footer();
示例3: FormValidator
if ($access_url_id != -1) {
$sql = "SELECT code,visual_code,title\n\t\tFROM {$course_table} as c\n\t\tINNER JOIN {$tbl_course_rel_access_url} as course_rel_url\n\t\tON (c.id = course_rel_url.c_id)\n\t\tWHERE access_url_id = {$access_url_id}\n\t\tORDER BY visual_code";
}
}
$result = Database::query($sql);
while ($course = Database::fetch_object($result)) {
$courses[$course->code] = $course->visual_code . ' - ' . $course->title;
}
$form = new FormValidator('export_users');
$form->addElement('header', $tool_name);
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'XML', 'xml');
$form->addElement('radio', 'file_type', null, 'CSV', 'csv');
$form->addElement('radio', 'file_type', null, 'XLS', 'xls');
$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'), '1');
$form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
$form->addButtonExport(get_lang('Export'));
$form->setDefaults(array('file_type' => 'csv'));
if ($form->validate()) {
$export = $form->exportValues();
$file_type = $export['file_type'];
$course_code = Database::escape_string($export['course_code']);
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$sql = "SELECT\n\t\t\t\tu.user_id \tAS UserId,\n\t\t\t\tu.lastname \tAS LastName,\n\t\t\t\tu.firstname \tAS FirstName,\n\t\t\t\tu.email \t\tAS Email,\n\t\t\t\tu.username\tAS UserName,\n\t\t\t\t" . ($_configuration['password_encryption'] != 'none' ? " " : "u.password AS Password, ") . "\n\t\t\t\tu.auth_source\tAS AuthSource,\n\t\t\t\tu.status\t\tAS Status,\n\t\t\t\tu.official_code\tAS OfficialCode,\n\t\t\t\tu.phone\t\tAS Phone";
if (strlen($course_code) > 0) {
$sql .= " FROM {$user_table} u, {$course_user_table} cu\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tu.user_id = cu.user_id AND\n\t\t\t\t\t\tcu.c_id = {$courseId} AND\n\t\t\t\t\t\tcu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . "\n\t\t\t\t\tORDER BY lastname,firstname";
$filename = 'export_users_' . $course_code . '_' . api_get_local_time();
} else {
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
示例4: form_special_export
function form_special_export()
{
$form = new FormValidator('special_exports', 'post');
$renderer = $form->defaultRenderer();
$renderer->setCustomElementTemplate('<div>{element}</div> ');
$form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup');
$form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items');
$form->addElement('html', '<br />');
$form->addButtonExport(get_lang('CreateBackup'));
$form->add_progress_bar();
$values['backup_option'] = 'full_backup';
$form->setDefaults($values);
$form->display();
}
示例5: FormValidator
Export::arrayToCsv($listToExport, $archiveFile);
case 'xls':
Export::arrayToXls($listToExport, $archiveFile);
break;
}
} else {
Display::addFlash(Display::return_message(get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty')));
}
}
Display::display_header($tool_name);
$form = new FormValidator('export', 'post', api_get_self());
$form->addHeader($tool_name);
$form->addHidden('formSent', 1);
$form->addElement('radio', 'select_type', get_lang('Option'), get_lang('ExportAllCoursesList'), '1', ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"]);
$form->addElement('radio', 'select_type', '', get_lang('ExportSelectedCoursesFromCoursesList'), '2', ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"]);
if (!empty($course_list)) {
$form->addHtml('<div id="div-course-list" style="display:none">');
$coursesInList = [];
foreach ($course_list as $course) {
$coursesInList[$course['code']] = $course['title'] . ' (' . $course['code'] . ')';
}
$form->addSelect('course_code', get_lang('WhichCoursesToExport'), $coursesInList, ['multiple' => 'multiple']);
$form->addHtml('</div>');
}
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
$form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
$form->setDefaults(['select_type' => '1', 'file_type' => 'csv']);
$form->addButtonExport(get_lang('ExportCourses'));
$form->display();
Display::display_footer();