本文整理汇总了PHP中Fisharebest\Webtrees\Controller\PageController::pageHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP PageController::pageHeader方法的具体用法?PHP PageController::pageHeader怎么用?PHP PageController::pageHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Controller\PageController
的用法示例。
在下文中一共展示了PageController::pageHeader方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
header('Content-length: ' . filesize($temp_dir . $zip_file));
readfile($temp_dir . $zip_file);
File::delete($temp_dir);
}
} else {
header('Content-Type: text/plain; charset=UTF-8');
header('Content-Disposition: attachment; filename="' . $download_filename . '"');
// Stream the GEDCOM file straight to the browser.
// We could open "php://compress.zlib" to create a .gz file or "php://compress.bzip2" to create a .bz2 file
$stream = fopen('php://output', 'w');
FunctionsExport::exportGedcom($WT_TREE, $stream, $exportOptions);
fclose($stream);
}
return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_trees_manage.php"><?php
echo I18N::translate('Manage family trees');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
示例2: User
return;
case 'edit':
$user_id = Filter::getInteger('user_id');
if ($user_id === 0) {
$controller->setPageTitle(I18N::translate('Add a user'));
$tmp = new \stdClass();
$tmp->user_id = '';
$tmp->user_name = '';
$tmp->real_name = '';
$tmp->email = '';
$user = new User($tmp);
} else {
$controller->setPageTitle(I18N::translate('Edit the user'));
$user = User::find($user_id);
}
$controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addInlineJavascript('
jQuery(".relpath").change(function() {
var fieldIDx = jQuery(this).attr("id");
var idNum = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH","");
var newIDx = "gedcomid"+idNum;
if (jQuery("#"+newIDx).val() === "" && jQuery("#".fieldIDx).val() !== "0") {
alert("' . I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') . '");
jQuery(this).val("0");
}
});
function regex_quote(str) {
return str.replace(/[\\\\.?+*()[\\](){}|]/g, "\\\\$&");
}
');
?>
<ol class="breadcrumb small">
示例3: edit
private function edit()
{
global $WT_TREE;
if (webtrees\Filter::postBool('save') && webtrees\Filter::checkCsrf()) {
$block_id = webtrees\Filter::post('block_id');
if ($block_id) {
webtrees\Database::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, ''), block_order=? WHERE block_id=?")->execute(array(webtrees\Filter::post('gedcom_id'), (int) webtrees\Filter::post('block_order'), $block_id));
} else {
webtrees\Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, ''), ?, ?)")->execute(array(webtrees\Filter::post('gedcom_id'), $this->getName(), (int) webtrees\Filter::post('block_order')));
$block_id = webtrees\Database::getInstance()->lastInsertId();
}
$this->setBlockSetting($block_id, 'menu_title', webtrees\Filter::post('menu_title'));
$this->setBlockSetting($block_id, 'menu_address', webtrees\Filter::post('menu_address'));
$this->setBlockSetting($block_id, 'menu_access', webtrees\Filter::post('menu_access'));
$languages = array();
foreach (webtrees\I18N::installedLocales() as $locale) {
if (webtrees\Filter::postBool('lang_' . $locale->languageTag())) {
$languages[] = $locale->languageTag();
}
}
$this->setBlockSetting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = webtrees\Filter::get('block_id');
$controller = new webtrees\Controller\PageController();
$controller->restrictAccess(webtrees\Auth::isEditor($WT_TREE));
if ($block_id) {
$controller->setPageTitle(webtrees\I18N::translate('Edit menu'));
$menu_title = $this->getBlockSetting($block_id, 'menu_title');
$menu_address = $this->getBlockSetting($block_id, 'menu_address');
$menu_access = $this->getBlockSetting($block_id, 'menu_access');
$block_order = webtrees\Database::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
$gedcom_id = webtrees\Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
} else {
$controller->setPageTitle(webtrees\I18N::translate('Add menu'));
$menu_access = 1;
$menu_title = '';
$menu_address = '';
$block_order = webtrees\Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
$gedcom_id = $WT_TREE->getTreeId();
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo webtrees\I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
echo webtrees\I18N::translate('Module administration');
?>
</a></li>
<li><a href="module.php?mod=<?php
echo $this->getName();
?>
&mod_action=admin_config"><?php
echo webtrees\I18N::translate($this->getTitle());
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<form class="form-horizontal" method="POST" action="#" name="menu" id="menuForm">
<?php
echo webtrees\Filter::getCsrf();
?>
<input type="hidden" name="save" value="1">
<input type="hidden" name="block_id" value="<?php
echo $block_id;
?>
">
<h3><?php
echo webtrees\I18N::translate('General');
?>
</h3>
<div class="form-group">
<label class="control-label col-sm-3" for="menu_title">
<?php
echo webtrees\I18N::translate('Title');
?>
</label>
<div class="col-sm-9">
<input
class="form-control"
id="menu_title"
size="90"
name="menu_title"
required
type="text"
value="<?php
echo webtrees\Filter::escapeHtml($menu_title);
?>
"
>
</div>
//.........这里部分代码省略.........
示例4: COUNT
$datum[2] = I18N::translate($datum[2]);
$datum[3] = '<a href="gedrecord.php?pid=' . $datum[3] . '&ged=' . $datum[7] . '">' . $datum[3] . '</a>';
$datum[4] = '<div class="gedcom-data" dir="ltr">' . Filter::escapeHtml($datum[4]) . '</div>';
$datum[5] = '<div class="gedcom-data" dir="ltr">' . Filter::escapeHtml($datum[5]) . '</div>';
$datum[6] = Filter::escapeHtml($datum[6]);
$datum[7] = Filter::escapeHtml($datum[7]);
}
// Total filtered/unfiltered rows
$recordsFiltered = (int) Database::prepare("SELECT FOUND_ROWS()")->fetchOne();
$recordsTotal = (int) Database::prepare("SELECT COUNT(*) FROM `##change`")->fetchOne();
header('Content-type: application/json');
// See http://www.datatables.net/usage/server-side
echo json_encode(array('draw' => Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
return;
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addExternalJavascript(WT_MOMENT_JS_URL)->addExternalJavascript(WT_BOOTSTRAP_DATETIMEPICKER_JS_URL)->addInlineJavascript('
jQuery(".table-site-changes").dataTable( {
processing: true,
serverSide: true,
ajax: "' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user=' . rawurlencode($user) . '&gedc=' . rawurlencode($gedc) . '",
' . I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
sorting: [[ 0, "desc" ]],
pageLength: ' . Auth::user()->getPreference('admin_site_change_page_size', 10) . ',
columns: [
/* change_id */ { visible: false },
/* Timestamp */ { sort: 0 },
/* Status */ { },
/* Record */ { },
/* Old data */ { sortable: false },
/* New data */ { sortable: false },
/* User */ { },
示例5: config
/**
* A form to edit the module configuration.
*/
private function config()
{
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Google Maps™'));
if (Filter::post('action') === 'update') {
$this->setSetting('GM_MAP_TYPE', Filter::post('GM_MAP_TYPE'));
$this->setSetting('GM_USE_STREETVIEW', Filter::post('GM_USE_STREETVIEW'));
$this->setSetting('GM_MIN_ZOOM', Filter::post('GM_MIN_ZOOM'));
$this->setSetting('GM_MAX_ZOOM', Filter::post('GM_MAX_ZOOM'));
$this->setSetting('GM_XSIZE', Filter::post('GM_XSIZE'));
$this->setSetting('GM_YSIZE', Filter::post('GM_YSIZE'));
$this->setSetting('GM_PRECISION_0', Filter::post('GM_PRECISION_0'));
$this->setSetting('GM_PRECISION_1', Filter::post('GM_PRECISION_1'));
$this->setSetting('GM_PRECISION_2', Filter::post('GM_PRECISION_2'));
$this->setSetting('GM_PRECISION_3', Filter::post('GM_PRECISION_3'));
$this->setSetting('GM_PRECISION_4', Filter::post('GM_PRECISION_4'));
$this->setSetting('GM_PRECISION_5', Filter::post('GM_PRECISION_5'));
$this->setSetting('GM_COORD', Filter::post('GM_COORD'));
$this->setSetting('GM_PLACE_HIERARCHY', Filter::post('GM_PLACE_HIERARCHY'));
$this->setSetting('GM_PH_XSIZE', Filter::post('GM_PH_XSIZE'));
$this->setSetting('GM_PH_YSIZE', Filter::post('GM_PH_YSIZE'));
$this->setSetting('GM_PH_MARKER', Filter::post('GM_PH_MARKER'));
$this->setSetting('GM_PREFIX_1', Filter::post('GM_PREFIX_1'));
$this->setSetting('GM_PREFIX_2', Filter::post('GM_PREFIX_2'));
$this->setSetting('GM_PREFIX_3', Filter::post('GM_PREFIX_3'));
$this->setSetting('GM_PREFIX_4', Filter::post('GM_PREFIX_4'));
$this->setSetting('GM_PREFIX_5', Filter::post('GM_PREFIX_5'));
$this->setSetting('GM_PREFIX_6', Filter::post('GM_PREFIX_6'));
$this->setSetting('GM_PREFIX_7', Filter::post('GM_PREFIX_7'));
$this->setSetting('GM_PREFIX_8', Filter::post('GM_PREFIX_8'));
$this->setSetting('GM_PREFIX_9', Filter::post('GM_PREFIX_9'));
$this->setSetting('GM_POSTFIX_1', Filter::post('GM_POSTFIX_1'));
$this->setSetting('GM_POSTFIX_2', Filter::post('GM_POSTFIX_2'));
$this->setSetting('GM_POSTFIX_3', Filter::post('GM_POSTFIX_3'));
$this->setSetting('GM_POSTFIX_4', Filter::post('GM_POSTFIX_4'));
$this->setSetting('GM_POSTFIX_5', Filter::post('GM_POSTFIX_5'));
$this->setSetting('GM_POSTFIX_6', Filter::post('GM_POSTFIX_6'));
$this->setSetting('GM_POSTFIX_7', Filter::post('GM_POSTFIX_7'));
$this->setSetting('GM_POSTFIX_8', Filter::post('GM_POSTFIX_8'));
$this->setSetting('GM_POSTFIX_9', Filter::post('GM_POSTFIX_9'));
FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->getName()), 'success');
header('Location: ' . WT_BASE_URL . 'module.php?mod=googlemap&mod_action=admin_config');
return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
echo I18N::translate('Module administration');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<ul class="nav nav-tabs nav-justified" role="tablist">
<li role="presentation" class="active">
<a href="#" role="tab">
<?php
echo I18N::translate('Google Maps™ preferences');
?>
</a>
</li>
<li role="presentation">
<a href="?mod=googlemap&mod_action=admin_places">
<?php
echo I18N::translate('Geographic data');
?>
</a>
</li>
<li role="presentation">
<a href="?mod=googlemap&mod_action=admin_placecheck">
<?php
echo I18N::translate('Place check');
?>
</a>
</li>
</ul>
<h2><?php
echo I18N::translate('Google Maps™ preferences');
?>
</h2>
<form class="form-horizontal" method="post" name="configform" action="module.php?mod=googlemap&mod_action=admin_config">
<input type="hidden" name="action" value="update">
<h3><?php
echo I18N::translate('Basic');
?>
</h3>
//.........这里部分代码省略.........
示例6: edit
/**
* Action from the configuration page
*/
private function edit()
{
global $WT_TREE;
if (Filter::postBool('save') && Filter::checkCsrf()) {
$block_id = Filter::postInteger('block_id');
if ($block_id) {
Database::prepare("UPDATE `##block` SET gedcom_id = NULLIF(:tree_id, '0'), block_order = :block_order WHERE block_id = :block_id")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'block_order' => Filter::postInteger('block_order'), 'block_id' => $block_id));
} else {
Database::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(:tree_id, '0'), :module_name, :block_order)")->execute(array('tree_id' => Filter::postInteger('gedcom_id'), 'module_name' => $this->getName(), 'block_order' => Filter::postInteger('block_order')));
$block_id = Database::getInstance()->lastInsertId();
}
$this->setBlockSetting($block_id, 'header', Filter::post('header'));
$this->setBlockSetting($block_id, 'faqbody', Filter::post('faqbody'));
$languages = Filter::postArray('lang');
$this->setBlockSetting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = Filter::getInteger('block_id');
$controller = new PageController();
if ($block_id) {
$controller->setPageTitle(I18N::translate('Edit FAQ item'));
$header = $this->getBlockSetting($block_id, 'header');
$faqbody = $this->getBlockSetting($block_id, 'faqbody');
$block_order = Database::prepare("SELECT block_order FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
$gedcom_id = Database::prepare("SELECT gedcom_id FROM `##block` WHERE block_id = :block_id")->execute(array('block_id' => $block_id))->fetchOne();
} else {
$controller->setPageTitle(I18N::translate('Add an FAQ item'));
$header = '';
$faqbody = '';
$block_order = Database::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name = :module_name")->execute(array('module_name' => $this->getName()))->fetchOne();
$gedcom_id = $WT_TREE->getTreeId();
}
$controller->pageHeader();
if (Module::getModuleByName('ckeditor')) {
CkeditorModule::enableEditor($controller);
}
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
echo I18N::translate('Module administration');
?>
</a></li>
<li><a
href="module.php?mod=<?php
echo $this->getName();
?>
&mod_action=admin_config"><?php
echo I18N::translate('Frequently asked questions');
?>
</a>
</li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<h1><?php
echo $controller->getPageTitle();
?>
</h1>
<form name="faq" class="form-horizontal" method="post" action="module.php?mod=<?php
echo $this->getName();
?>
&mod_action=admin_edit">
<?php
echo Filter::getCsrf();
?>
<input type="hidden" name="save" value="1">
<input type="hidden" name="block_id" value="<?php
echo $block_id;
?>
">
<div class="form-group">
<label for="header" class="col-sm-3 control-label">
<?php
echo I18N::translate('Question');
?>
</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="header" id="header"
value="<?php
echo Filter::escapeHtml($header);
?>
">
</div>
</div>
<div class="form-group">
<label for="faqbody" class="col-sm-3 control-label">
<?php
//.........这里部分代码省略.........
示例7: elseif
return;
}
$controller->setPageTitle(I18N::translate('Request new user account'));
// The form parameters are mandatory, and the validation errors are shown in the client.
if (Session::get('good_to_send') && $user_name && $user_password01 && $user_password01 == $user_password02 && $user_realname && $user_email && $user_comments) {
// These validation errors cannot be shown in the client.
if (User::findByUserName($user_name)) {
FlashMessages::addMessage(I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
} elseif (User::findByEmail($user_email)) {
FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
} elseif (preg_match('/(?!' . preg_quote(WT_BASE_URL, '/') . ')(((?:ftp|http|https):\\/\\/)[a-zA-Z0-9.-]+)/', $user_comments, $match)) {
FlashMessages::addMessage(I18N::translate('You are not allowed to send messages that contain external links.') . ' ' . I18N::translate('You should delete the “%1$s” from “%2$s” and try again.', $match[2], $match[1]));
Log::addAuthenticationLog('Possible spam registration from "' . $user_name . '"/"' . $user_email . '" comments="' . $user_comments . '"');
} else {
// Everything looks good - create the user
$controller->pageHeader();
Log::addAuthenticationLog('User registration requested for: ' . $user_name);
$user = User::create($user_name, $user_realname, $user_email, $user_password01);
$user->setPreference('language', WT_LOCALE)->setPreference('verified', '0')->setPreference('verified_by_admin', 0)->setPreference('reg_timestamp', date('U'))->setPreference('reg_hashcode', md5(Uuid::uuid4()))->setPreference('contactmethod', 'messaging2')->setPreference('comment', $user_comments)->setPreference('visibleonline', '1')->setPreference('auto_accept', '0')->setPreference('canadmin', '0')->setPreference('sessiontime', '0');
// Generate an email in the admin’s language
$webmaster = User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'));
I18N::init($webmaster->getPreference('language'));
$mail1_body = I18N::translate('Hello administrator…') . Mail::EOL . Mail::EOL . I18N::translate('A prospective user has registered with webtrees at %s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml()) . Mail::EOL . Mail::EOL . I18N::translate('Username') . ' ' . Filter::escapeHtml($user->getUserName()) . Mail::EOL . I18N::translate('Real name') . ' ' . $user->getRealNameHtml() . Mail::EOL . I18N::translate('Email address') . ' ' . Filter::escapeHtml($user->getEmail()) . Mail::EOL . I18N::translate('Comments') . ' ' . Filter::escapeHtml($user_comments) . Mail::EOL . Mail::EOL . I18N::translate('The user has been sent an e-mail with the information necessary to confirm the access request.') . Mail::EOL . Mail::EOL . I18N::translate('You will be informed by e-mail when this prospective user has confirmed the request. You can then complete the process by activating the user name. The new user will not be able to login until you activate the account.');
$mail1_subject = I18N::translate('New registration at %s', WT_BASE_URL . ' ' . $WT_TREE->getTitle());
I18N::init(WT_LOCALE);
echo '<div id="login-register-page">';
// Generate an email in the user’s language
$mail2_body = I18N::translate('Hello %s…', $user->getRealNameHtml()) . Mail::EOL . Mail::EOL . I18N::translate('You (or someone claiming to be you) has requested an account at %1$s using the email address %2$s.', WT_BASE_URL . ' ' . $WT_TREE->getTitleHtml(), $user->getEmail()) . ' ' . I18N::translate('Information about the request is shown under the link below.') . Mail::EOL . I18N::translate('Please click on the following link and fill in the requested data to confirm your request and email address.') . Mail::EOL . Mail::EOL . '<a href="' . WT_LOGIN_URL . '?user_name=' . Filter::escapeUrl($user->getUserName()) . '&user_hashcode=' . $user->getPreference('reg_hashcode') . '&action=userverify&ged=' . $WT_TREE->getNameUrl() . '">' . WT_LOGIN_URL . "?user_name=" . Filter::escapeHtml($user->getUserName()) . "&user_hashcode=" . urlencode($user->getPreference('reg_hashcode')) . '&action=userverify&ged=' . $WT_TREE->getNameHtml() . '</a>' . Mail::EOL . Mail::EOL . I18N::translate('Username') . " - " . Filter::escapeHtml($user->getUserName()) . Mail::EOL . I18N::translate('Verification code') . " - " . $user->getPreference('reg_hashcode') . Mail::EOL . I18N::translate('Comments') . " - " . $user->getPreference('comment') . Mail::EOL . I18N::translate('If you didn’t request an account, you can just delete this message.') . Mail::EOL;
$mail2_subject = I18N::translate('Your registration at %s', WT_BASE_URL);
$mail2_to = $user->getEmail();
$mail2_from = $WT_TREE->getPreference('WEBTREES_EMAIL');
示例8: foreach
// deleted blocks
foreach ($blocks[$location] as $block_id => $block_name) {
if (!in_array($block_id, $main) && !in_array($block_id, $right)) {
Database::prepare("DELETE FROM `##block_setting` WHERE block_id=?")->execute(array($block_id));
Database::prepare("DELETE FROM `##block` WHERE block_id=?")->execute(array($block_id));
}
}
}
if ($user_id) {
header('Location: ' . WT_BASE_URL . 'index.php?ctype=user&ged=' . $WT_TREE->getNameUrl());
} else {
header('Location: ' . WT_BASE_URL . 'index.php?ctype=gedcom&ged=' . $WT_TREE->getNameUrl());
}
return;
}
$controller->pageHeader()->addInlineJavascript('
/**
* Move Up Block Javascript function
*
* This function moves the selected option up in the given select list
*
* @param String section_name the name of the select to move the options
*/
function move_up_block(section_name) {
section_select = document.getElementById(section_name);
if (section_select) {
if (section_select.selectedIndex <= 0) return false;
index = section_select.selectedIndex;
temp = new Option(section_select.options[index-1].text, section_select.options[index-1].value);
section_select.options[index-1] = new Option(section_select.options[index].text, section_select.options[index].value);
section_select.options[index] = temp;
示例9: edit
/**
* Show and process a form to edit a story.
*/
private function edit()
{
global $WT_TREE;
if (Auth::isEditor($WT_TREE)) {
if (Filter::postBool('save') && Filter::checkCsrf()) {
$block_id = Filter::postInteger('block_id');
if ($block_id) {
Database::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $block_id));
} else {
Database::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
$block_id = Database::getInstance()->lastInsertId();
}
$this->setBlockSetting($block_id, 'title', Filter::post('title'));
$this->setBlockSetting($block_id, 'story_body', Filter::post('story_body'));
$languages = Filter::postArray('lang');
$this->setBlockSetting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = Filter::getInteger('block_id');
$controller = new PageController();
if ($block_id) {
$controller->setPageTitle(I18N::translate('Edit story'));
$title = $this->getBlockSetting($block_id, 'title');
$story_body = $this->getBlockSetting($block_id, 'story_body');
$xref = Database::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
} else {
$controller->setPageTitle(I18N::translate('Add a story'));
$title = '';
$story_body = '';
$xref = Filter::get('xref', WT_REGEX_XREF);
}
$controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
if (Module::getModuleByName('ckeditor')) {
CkeditorModule::enableEditor($controller);
}
$individual = Individual::getInstance($xref, $WT_TREE);
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
echo I18N::translate('Module administration');
?>
</a></li>
<li><a href="module.php?mod=<?php
echo $this->getName();
?>
&mod_action=admin_config"><?php
echo $this->getTitle();
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<h1><?php
echo $controller->getPageTitle();
?>
</h1>
<form class="form-horizontal" method="post" action="module.php?mod=<?php
echo $this->getName();
?>
&mod_action=admin_edit">
<?php
echo Filter::getCsrf();
?>
<input type="hidden" name="save" value="1">
<input type="hidden" name="block_id" value="<?php
echo $block_id;
?>
">
<input type="hidden" name="gedcom_id" value="<?php
echo $WT_TREE->getTreeId();
?>
">
<div class="form-group">
<label for="title" class="col-sm-3 control-label">
<?php
echo I18N::translate('Story title');
?>
</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="title" id="title" value="<?php
echo Filter::escapeHtml($title);
?>
">
</div>
</div>
<div class="form-group">
<label for="story_body" class="col-sm-3 control-label">
//.........这里部分代码省略.........
示例10: config
/**
* A form to edit the module configuration.
*/
private function config()
{
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Google Maps™'));
if (Filter::post('action') === 'update') {
$this->setSetting('GM_MAP_TYPE', Filter::post('GM_MAP_TYPE'));
$this->setSetting('GM_USE_STREETVIEW', Filter::post('GM_USE_STREETVIEW'));
$this->setSetting('GM_MIN_ZOOM', Filter::post('GM_MIN_ZOOM'));
$this->setSetting('GM_MAX_ZOOM', Filter::post('GM_MAX_ZOOM'));
$this->setSetting('GM_XSIZE', Filter::post('GM_XSIZE'));
$this->setSetting('GM_YSIZE', Filter::post('GM_YSIZE'));
$this->setSetting('GM_PRECISION_0', Filter::post('GM_PRECISION_0'));
$this->setSetting('GM_PRECISION_1', Filter::post('GM_PRECISION_1'));
$this->setSetting('GM_PRECISION_2', Filter::post('GM_PRECISION_2'));
$this->setSetting('GM_PRECISION_3', Filter::post('GM_PRECISION_3'));
$this->setSetting('GM_PRECISION_4', Filter::post('GM_PRECISION_4'));
$this->setSetting('GM_PRECISION_5', Filter::post('GM_PRECISION_5'));
$this->setSetting('GM_COORD', Filter::post('GM_COORD'));
$this->setSetting('GM_PLACE_HIERARCHY', Filter::post('GM_PLACE_HIERARCHY'));
$this->setSetting('GM_PH_XSIZE', Filter::post('GM_PH_XSIZE'));
$this->setSetting('GM_PH_YSIZE', Filter::post('GM_PH_YSIZE'));
$this->setSetting('GM_PH_MARKER', Filter::post('GM_PH_MARKER'));
$this->setSetting('GM_DISP_SHORT_PLACE', Filter::post('GM_DISP_SHORT_PLACE'));
$this->setSetting('GM_PREFIX_1', Filter::post('GM_PREFIX_1'));
$this->setSetting('GM_PREFIX_2', Filter::post('GM_PREFIX_2'));
$this->setSetting('GM_PREFIX_3', Filter::post('GM_PREFIX_3'));
$this->setSetting('GM_PREFIX_4', Filter::post('GM_PREFIX_4'));
$this->setSetting('GM_PREFIX_5', Filter::post('GM_PREFIX_5'));
$this->setSetting('GM_PREFIX_6', Filter::post('GM_PREFIX_6'));
$this->setSetting('GM_PREFIX_7', Filter::post('GM_PREFIX_7'));
$this->setSetting('GM_PREFIX_8', Filter::post('GM_PREFIX_8'));
$this->setSetting('GM_PREFIX_9', Filter::post('GM_PREFIX_9'));
$this->setSetting('GM_POSTFIX_1', Filter::post('GM_POSTFIX_1'));
$this->setSetting('GM_POSTFIX_2', Filter::post('GM_POSTFIX_2'));
$this->setSetting('GM_POSTFIX_3', Filter::post('GM_POSTFIX_3'));
$this->setSetting('GM_POSTFIX_4', Filter::post('GM_POSTFIX_4'));
$this->setSetting('GM_POSTFIX_5', Filter::post('GM_POSTFIX_5'));
$this->setSetting('GM_POSTFIX_6', Filter::post('GM_POSTFIX_6'));
$this->setSetting('GM_POSTFIX_7', Filter::post('GM_POSTFIX_7'));
$this->setSetting('GM_POSTFIX_8', Filter::post('GM_POSTFIX_8'));
$this->setSetting('GM_POSTFIX_9', Filter::post('GM_POSTFIX_9'));
FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->getName()), 'success');
header('Location: ' . WT_BASE_URL . 'module.php?mod=googlemap&mod_action=admin_config');
return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_modules.php"><?php
echo I18N::translate('Module administration');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
<ul class="nav nav-tabs nav-justified" role="tablist">
<li role="presentation" class="active">
<a href="#" role="tab">
<?php
echo I18N::translate('Google Maps™ preferences');
?>
</a>
</li>
<li role="presentation">
<a href="?mod=googlemap&mod_action=admin_places">
<?php
echo I18N::translate('Geographic data');
?>
</a>
</li>
<li role="presentation">
<a href="?mod=googlemap&mod_action=admin_placecheck">
<?php
echo I18N::translate('Place check');
?>
</a>
</li>
</ul>
<form method="post" name="configform" action="module.php?mod=googlemap&mod_action=admin_config">
<input type="hidden" name="action" value="update">
<h2><?php
echo I18N::translate('Basic');
?>
</h2>
<div id="tabs">
<div id="gm_basic">
<table class="gm_edit_config">
<tr>
<th><?php
//.........这里部分代码省略.........