本文整理汇总了PHP中FormValidator::addButtonCancel方法的典型用法代码示例。如果您正苦于以下问题:PHP FormValidator::addButtonCancel方法的具体用法?PHP FormValidator::addButtonCancel怎么用?PHP FormValidator::addButtonCancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormValidator
的用法示例。
在下文中一共展示了FormValidator::addButtonCancel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$form->addRule('objetives', get_lang('ThisFieldIsRequired'), 'required');
// Target audience of the requested course.
$form->addElement('textarea', 'target_audience', get_lang('TargetAudience'), array('style' => 'border:#A5ACB2 solid 1px; font-family:arial,verdana,helvetica,sans-serif; font-size:12px', 'rows' => '3', 'cols' => '116'));
$form->addRule('target_audience', get_lang('ThisFieldIsRequired'), 'required');
// Course language.
$form->addElement('select_language', 'course_language', get_lang('Ln'));
$form->applyFilter('select_language', 'html_filter');
// Exemplary content checkbox.
$form->addElement('checkbox', 'exemplary_content', get_lang('FillWithExemplaryContent'));
// Submit buttons.
$submit_buttons[] = $form->addButtonSave(get_lang('Save'), 'save_button', true);
if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED) {
$submit_buttons[] = $form->addButtonSave(get_lang('Accept'), 'accept_button', true);
}
if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED && $course_request_info['status'] != COURSE_REQUEST_REJECTED) {
$submit_buttons[] = $form->addButtonCancel(get_lang('Reject'), 'reject_button', true);
}
if ($course_request_info['status'] != COURSE_REQUEST_ACCEPTED && intval($course_request_info['info']) <= 0) {
$submit_buttons[] = $form->addButtonPreview(get_lang('AskAdditionalInfo'), 'ask_info_button', true);
}
$form->addGroup($submit_buttons);
// Hidden form fields.
$form->addElement('hidden', 'user_id');
$form->addElement('hidden', 'directory');
$form->addElement('hidden', 'visual_code');
$form->addElement('hidden', 'request_date');
$form->addElement('hidden', 'status');
$form->addElement('hidden', 'info');
// Set the default values based on the corresponding database record.
$values['wanted_code'] = $course_request_info['code'];
$values['user_id'] = $course_request_info['user_id'];
示例2: foreach
foreach ($groupList as $group) {
$groupIdList[$group['id']] = $group['name'];
}
echo Display::page_subheader(get_lang('CalendarList'));
echo '<div class="attendance-calendar-list">';
if (!empty($attendance_calendar)) {
foreach ($attendance_calendar as $calendar) {
echo '<div class="attendance-calendar-row">';
if (isset($action) && $action == 'calendar_edit' && (isset($calendar_id) && $calendar_id == $calendar['id'])) {
// calendar edit form
echo '<div class="attendance-calendar-edit">';
$form = new FormValidator('attendance_calendar_edit', 'POST', 'index.php?action=calendar_edit&attendance_id=' . $attendance_id . '&calendar_id=' . $calendar_id . '&' . api_get_cidreq() . $param_gradebook, '');
$form->addElement('date_time_picker', 'date_time', '', array('form_name' => 'attendance_calendar_edit'), 5);
$defaults['date_time'] = $calendar['date_time'];
$form->addButtonSave(get_lang('Save'));
$form->addButtonCancel(get_lang('Cancel'), 'cancel');
$form->setDefaults($defaults);
$form->display();
echo '</div>';
} else {
echo Display::return_icon('lp_calendar_event.png', get_lang('DateTime')) . ' ' . substr($calendar['date_time'], 0, strlen($calendar['date_time']) - 3) . ' ';
if (isset($calendar['groups']) && !empty($calendar['groups'])) {
foreach ($calendar['groups'] as $group) {
echo ' ' . Display::label($groupIdList[$group['group_id']]);
}
}
if (!$is_locked_attendance || api_is_platform_admin()) {
if (api_is_allowed_to_edit()) {
echo '<span style="margin-left:20px;">';
echo '<a href="index.php?' . api_get_cidreq() . '&action=calendar_edit&calendar_id=' . intval($calendar['id']) . '&attendance_id=' . $attendance_id . $param_gradebook . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align:middle'), ICON_SIZE_SMALL) . '</a> ';
echo '<a onclick="javascript:if(!confirm(\'' . get_lang('AreYouSureToDelete') . '\')) return false;" href="index.php?' . api_get_cidreq() . $param_gradebook . '&action=calendar_delete&calendar_id=' . intval($calendar['id']) . '&attendance_id=' . $attendance_id . '">' . Display::return_icon('delete.png', get_lang('Delete'), array('style' => 'vertical-align:middle'), ICON_SIZE_SMALL) . '</a>';
示例3: unset
unset($_SESSION['bc_sale_id']);
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php');
exit;
}
$messageTemplate = new Template();
$messageTemplate->assign('user', $userInfo);
$messageTemplate->assign('sale', ['date' => api_format_date($sale['date'], DATE_FORMAT_LONG_NO_DAY), 'product' => $sale['product_name'], 'currency' => $currency['iso_code'], 'price' => $sale['price'], 'reference' => $sale['reference']]);
$messageTemplate->assign('transfer_accounts', $transferAccounts);
api_mail_html($userInfo['complete_name'], $userInfo['email'], $plugin->get_lang('bc_subject'), $messageTemplate->fetch('buycourses/view/message_transfer.tpl'));
Display::addFlash(Display::return_message(sprintf($plugin->get_lang('PurchaseStatusX'), $plugin->get_lang('PendingReasonByTransfer')), 'success', false));
unset($_SESSION['bc_sale_id']);
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/course_catalog.php');
exit;
}
$form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
$form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
$template = new Template();
if ($buyingCourse) {
$template->assign('course', $course);
} elseif ($buyingSession) {
$template->assign('session', $session);
}
$template->assign('buying_course', $buyingCourse);
$template->assign('buying_session', $buyingSession);
$template->assign('title', $sale['product_name']);
$template->assign('price', $sale['price']);
$template->assign('currency', $sale['currency_id']);
$template->assign('user', $userInfo);
$template->assign('transfer_accounts', $transferAccounts);
$template->assign('form', $form->returnForm());
$content = $template->fetch('buycourses/view/process_confirm.tpl');
示例4: handle_stylesheets
//.........这里部分代码省略.........
}
}
closedir($handle);
}
// Sort styles in alphabetical order.
asort($list_of_names);
$select_list = array();
foreach ($list_of_names as $style_dir => $item) {
$select_list[$style_dir] = $item;
}
$styles =& $form_change->addElement('select', 'style', get_lang('NameStylesheet'), $select_list);
$styles->setSelected($selected);
if ($form_change->validate()) {
// Submit stylesheets.
if (isset($_POST['save'])) {
store_stylesheets();
Display::display_normal_message(get_lang('Saved'));
}
if (isset($_POST['download'])) {
$arch = api_get_path(SYS_ARCHIVE_PATH) . $safe_style_dir . '.zip';
$dir = api_get_path(SYS_CSS_PATH) . 'themes/' . $safe_style_dir;
if (is_dir($dir)) {
$zip = new PclZip($arch);
// Remove path prefix except the style name and put file on disk
$zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
//@TODO: use more generic script to download.
$str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch) . '">' . get_lang('ClickHereToDownloadTheFile') . '</a>';
Display::display_normal_message($str, false);
} else {
Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
}
}
}
$logoForm = new FormValidator('logo_upload', 'post', 'settings.php?category=Stylesheets#tabs-2');
$logoForm->addHtml(Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'), 'info'));
$dir = api_get_path(SYS_PUBLIC_PATH) . 'css/themes/' . $selected . '/images/';
$url = api_get_path(WEB_CSS_PATH) . 'themes/' . $selected . '/images/';
$logoFileName = 'header-logo.png';
$newLogoFileName = 'header-logo-custom.png';
if (is_file($dir . $newLogoFileName)) {
$logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="' . $url . $newLogoFileName . '?' . time() . '">');
} else {
$logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="' . $url . $logoFileName . '?' . time() . '">');
}
$logoForm->addFile('new_logo', get_lang('UpdateLogo'));
$allowedFileTypes = ['png'];
if (isset($_POST['logo_reset'])) {
if (is_file($dir . $newLogoFileName)) {
unlink($dir . $newLogoFileName);
Display::display_normal_message(get_lang('ResetToTheOriginalLogo'));
echo '<script>' . '$("#header-logo").attr("src","' . $url . $logoFileName . '");' . '</script>';
}
} elseif (isset($_POST['logo_upload'])) {
$logoForm->addRule('new_logo', get_lang('InvalidExtension') . ' (' . implode(',', $allowedFileTypes) . ')', 'filetype', $allowedFileTypes);
$logoForm->addRule('new_logo', get_lang('ThisFieldIsRequired'), 'required');
if ($logoForm->validate()) {
$imageInfo = getimagesize($_FILES['new_logo']['tmp_name']);
$width = $imageInfo[0];
$height = $imageInfo[1];
if ($width <= 250 && $height <= 70) {
if (is_file($dir . $newLogoFileName)) {
unlink($dir . $newLogoFileName);
}
$status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir . $newLogoFileName);
if ($status) {
Display::display_normal_message(get_lang('NewLogoUpdated'));
echo '<script>' . '$("#header-logo").attr("src","' . $url . $newLogoFileName . '");' . '</script>';
} else {
Display::display_error_message('Error - ' . get_lang('UplNoFileUploaded'));
}
} else {
Display::display_error_message('Error - ' . get_lang('InvalidImageDimensions'));
}
}
}
if ($is_style_changeable) {
$group = [$form_change->addButtonSave(get_lang('SaveSettings'), 'save', true), $form_change->addButtonPreview(get_lang('Preview'), 'preview', true), $form_change->addButtonDownload(get_lang('Download'), 'download', true)];
$form_change->addGroup($group);
$logoGroup = [$logoForm->addButtonUpload(get_lang('Upload'), 'logo_upload', true), $logoForm->addButtonCancel(get_lang('Reset'), 'logo_reset', true)];
$logoForm->addGroup($logoGroup);
if ($show_upload_form) {
echo '<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>';
echo Display::tabs(array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')), array($form_change->return_form(), $logoForm->return_form(), $form->return_form()));
} else {
$form_change->display();
}
//Little hack to update the logo image in update form when submiting
if (isset($_POST['logo_reset'])) {
echo '<script>' . '$("#header-logo-custom").attr("src","' . $url . $logoFileName . '");' . '</script>';
} elseif (isset($_POST['logo_upload']) && is_file($dir . $newLogoFileName)) {
echo '<script>' . '$("#header-logo-custom").attr("src","' . $url . $newLogoFileName . '");' . '</script>';
}
} else {
$form_change->freeze();
}
}