本文整理汇总了PHP中Fisharebest\Webtrees\Theme::theme方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::theme方法的具体用法?PHP Theme::theme怎么用?PHP Theme::theme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Theme
的用法示例。
在下文中一共展示了Theme::theme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create the chart controller
*
* @param int $show_full needed for use by charts module
*/
public function __construct($show_full = 1)
{
global $WT_TREE;
parent::__construct();
$rootid = Filter::get('rootid', WT_REGEX_XREF);
$this->root = Individual::getInstance($rootid, $WT_TREE);
if (!$this->root) {
// Missing root individual? Show the chart for someone.
$this->root = $this->getSignificantIndividual();
}
if (!$this->root || !$this->root->canShowName()) {
http_response_code(404);
$this->error_message = I18N::translate('This individual does not exist or you do not have permission to view it.');
}
// Extract parameter from form
if ($show_full) {
$this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'));
} else {
$this->show_full = 0;
}
$this->box = new \stdClass();
if ($this->showFull()) {
$this->box->width = Theme::theme()->parameter('chart-box-x');
$this->box->height = Theme::theme()->parameter('chart-box-y');
} else {
$this->box->width = Theme::theme()->parameter('compact-chart-box-x');
$this->box->height = Theme::theme()->parameter('compact-chart-box-y');
}
}
示例2: index
/**
* AdminConfig@index
*/
public function index()
{
global $WT_TREE;
$action = Filter::post('action');
if ($action == 'update' && Filter::checkCsrf()) {
$this->update();
}
Theme::theme(new AdministrationTheme())->init($WT_TREE);
$ctrl = new PageController();
$ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle());
$view_bag = new ViewBag();
$view_bag->set('title', $ctrl->getPageTitle());
$view_bag->set('module', $this->module);
ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
}
示例3: status
/**
* Translation@status
*/
public function status()
{
global $WT_TREE;
$table_id = \Rhumsaa\Uuid\Uuid::uuid4();
Theme::theme(new AdministrationTheme())->init($WT_TREE);
$ctrl = new PageController();
$ctrl->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Translations status'))->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript('
//Datatable initialisation
jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
jQuery("#table_missing_' . $table_id . '").DataTable({
' . I18N::datatablesI18N() . ',
sorting: [[0, "asc"]],
pageLength: 15,
columns: [
/* 0 Message */ null,
/* 1 Reference */ null
],
});
jQuery("#table_nonused_' . $table_id . '").DataTable({
' . I18N::datatablesI18N() . ',
sorting: [[0, "asc"]],
pageLength: 15,
columns: [
/* 0 Message */ null,
/* 1 Reference */ null
],
});
');
$source_code_paths = array(WT_ROOT . 'vendor/jon48/webtrees-lib/src', WT_ROOT . 'vendor/jon48/webtrees-tools/src/app');
$analyzer = new TranslationsAnalyzer($source_code_paths);
$analyzer->load();
$locale = $analyzer->getLocale();
$view_bag = new ViewBag();
$view_bag->set('table_id', $table_id);
$view_bag->set('module', $this->module);
$view_bag->set('source_code_paths', $source_code_paths);
$view_bag->set('title', $ctrl->getPageTitle() . ' - ' . I18N::languageName($locale->languageTag()));
$view_bag->set('missing_translations', $analyzer->getMissingTranslations());
$view_bag->set('non_used_translations', $analyzer->getMajNonUsedTranslations());
$view_bag->set('loading_stats', $analyzer->getLoadingStatistics());
ViewFactory::make('TranslationStatus', $this, $ctrl, $view_bag)->render();
}
示例4: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = $this->getTitle();
$menu = Theme::theme()->menuThemes();
if ($menu) {
$content = '<div class="center theme_form">' . $menu . '</div><br>';
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
} else {
return '';
}
}
示例5: printChildAscendancy
/**
* print a child ascendancy
*
* @param Individual $individual
* @param int $sosa child sosa number
* @param int $depth the ascendancy depth to show
*/
public function printChildAscendancy(Individual $individual, $sosa, $depth)
{
echo '<li>';
echo '<table><tbody><tr><td>';
if ($sosa === 1) {
echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent'), '"></td><td>';
} else {
echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="2" alt="">';
echo '<img src="', Theme::theme()->parameter('image-hline'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent') - 2, '"></td><td>';
}
FunctionsPrint::printPedigreePerson($individual, $this->showFull());
echo '</td><td>';
if ($sosa > 1) {
FunctionsCharts::printUrlArrow('?rootid=' . $individual->getXref() . '&PEDIGREE_GENERATIONS=' . $this->generations . '&show_full=' . $this->showFull() . '&chart_style=' . $this->chart_style . '&ged=' . $individual->getTree()->getNameUrl(), I18N::translate('Ancestors of %s', $individual->getFullName()), 3);
}
echo '</td><td class="details1"> <span class="person_box' . ($sosa === 1 ? 'NN' : ($sosa % 2 ? 'F' : '')) . '">', I18N::number($sosa), '</span> ';
echo '</td><td class="details1"> ', FunctionsCharts::getSosaName($sosa), '</td>';
echo '</tr></tbody></table>';
// Parents
$family = $individual->getPrimaryChildFamily();
if ($family && $depth > 0) {
// Marriage details
echo '<span class="details1">';
echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent'), '" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', I18N::translate('View family'), '"></i></a>';
echo ' <span class="person_box">', I18N::number($sosa * 2), '</span> ', I18N::translate('and');
echo ' <span class="person_boxF">', I18N::number($sosa * 2 + 1), '</span>';
if ($family->canShow()) {
foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
}
}
echo '</span>';
// display parents recursively - or show empty boxes
echo '<ul id="sosa_', $sosa, '" class="generation">';
if ($family->getHusband()) {
$this->printChildAscendancy($family->getHusband(), $sosa * 2, $depth - 1);
}
if ($family->getWife()) {
$this->printChildAscendancy($family->getWife(), $sosa * 2 + 1, $depth - 1);
}
echo '</ul>';
}
echo '</li>';
}
示例6: printPedigreePerson
/**
* print the information for an individual chart box
*
* find and print a given individuals information for a pedigree chart
*
* @param Individual $person The person to print
* @param int $show_full The style to print the box in, 0 for smaller boxes, 1 for larger boxes
*/
public static function printPedigreePerson(Individual $person = null, $show_full = 1)
{
switch ($show_full) {
case 0:
if ($person) {
echo Theme::theme()->individualBoxSmall($person);
} else {
echo Theme::theme()->individualBoxSmallEmpty();
}
break;
case 1:
if ($person) {
echo Theme::theme()->individualBox($person);
} else {
echo Theme::theme()->individualBoxEmpty();
}
break;
}
}
示例7: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
global $WT_TREE;
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = '<span dir="auto">' . I18N::translate('Welcome %s', Auth::user()->getRealNameHtml()) . '</span>';
$content = '<table><tr>';
$content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>';
$gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid');
if ($gedcomid) {
$content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>';
$content .= '<td><a href="individual.php?pid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>';
}
$content .= '</tr></table>';
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例8: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
global $controller, $WT_TREE;
$indi_xref = $controller->getSignificantIndividual()->getXref();
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = $WT_TREE->getTitleHtml();
$content = '<table><tr>';
$content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>';
$content .= '<td><a href="individual.php?pid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>';
if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) {
$content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request new user account') . '</a></td>';
}
$content .= "</tr>";
$content .= "</table>";
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例9: index
/**
* WelcomeBlock@index
*
* @param PageController $parent_controller
* @param Tree $tree
* @param string $block_id
* @param string $template
* @return $string
*/
public function index(PageController $parent_controller, Tree $tree, $block_id, $template)
{
$view_bag = new ViewBag();
if ($parent_controller && $tree) {
$view_bag->set('tree', $tree);
$view_bag->set('indi', $parent_controller->getSignificantIndividual());
$id = $this->module->getName() . $block_id;
$class = $this->module->getName() . '_block';
$parent_controller->addInlineJavascript('
jQuery("#maj-new_passwd").hide();
jQuery("#maj-passwd_click").click(function()
{
jQuery("#maj-new_passwd").slideToggle(100, function() {
jQuery("#maj-new_passwd_username").focus();
});
return false;
});
');
if (Auth::isAdmin()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>';
} else {
$title = '';
}
$title .= '<span dir="auto">' . $tree->getTitleHtml() . '</span>';
$piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false);
$view_bag->set('piwik_enabled', $piwik_enabled);
if ($piwik_enabled) {
$parent_controller->addInlineJavascript('$("#piwik_stats")
.load("module.php?mod=' . $this->module->getName() . '&mod_action=Piwik&block_id=' . $block_id . '");');
}
$content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial();
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
}
示例10: getSidebarContent
/**
* Load this sidebar synchronously.
*
* @return string
*/
public function getSidebarContent()
{
global $controller, $WT_TREE;
// Fetch a list of the initial letters of all surnames in the database
$initials = QueryName::surnameAlpha($WT_TREE, true, false, false);
$controller->addInlineJavascript('
var loadedNames = new Array();
function isearchQ() {
var query = jQuery("#sb_indi_name").val();
if (query.length>1) {
jQuery("#sb_indi_content").load("module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=individuals&search="+query);
}
}
var timerid = null;
jQuery("#sb_indi_name").keyup(function(e) {
if (timerid) window.clearTimeout(timerid);
timerid = window.setTimeout("isearchQ()", 500);
});
jQuery("#sb_content_individuals").on("click", ".sb_indi_letter", function() {
jQuery("#sb_indi_content").load(this.href);
return false;
});
jQuery("#sb_content_individuals").on("click", ".sb_indi_surname", function() {
var element = jQuery(this);
var surname = element.data("surname");
var alpha = element.data("alpha");
if (!loadedNames[surname]) {
jQuery.ajax({
url: "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=individuals&alpha=" + encodeURIComponent(alpha) + "&surname=" + encodeURIComponent(surname),
cache: false,
success: function(html) {
jQuery("div.name_tree_div", element.closest("li"))
.html(html)
.show("fast")
.css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
loadedNames[surname]=2;
}
});
} else if (loadedNames[surname]==1) {
loadedNames[surname]=2;
jQuery("div.name_tree_div", jQuery(this).closest("li"))
.show()
.css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
} else {
loadedNames[surname]=1;
jQuery("div.name_tree_div", jQuery(this).closest("li"))
.hide("fast")
.css("list-style-image", "url(' . Theme::theme()->parameter('image-plus') . ')");
}
return false;
});
');
$out = '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_indi_name" id="sb_indi_name" placeholder="' . I18N::translate('Search') . '"><p>';
foreach ($initials as $letter => $count) {
switch ($letter) {
case '@':
$html = I18N::translateContext('Unknown surname', '…');
break;
case ',':
$html = I18N::translate('None');
break;
case ' ':
$html = ' ';
break;
default:
$html = $letter;
break;
}
$html = '<a href="module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=individuals&alpha=' . urlencode($letter) . '" class="sb_indi_letter">' . $html . '</a>';
$out .= $html . " ";
}
$out .= '</p>';
$out .= '<div id="sb_indi_content">';
$out .= '</div></form>';
return $out;
}
示例11: asort
$sortkey = 100000000.0;
// birth date missing => sort last
}
$children[$child->getXref()] = $sortkey;
}
if ($option === 'bybirth') {
asort($children);
}
$i = 0;
foreach ($children as $id => $child) {
echo '<li style="cursor:move; margin-bottom:2px; position:relative;"';
if (!in_array($id, $ids)) {
echo ' class="facts_value new"';
}
echo ' id="li_', $id, '">';
echo Theme::theme()->individualBoxLarge(Individual::getInstance($id, $WT_TREE));
echo '<input type="hidden" name="order[', $id, ']" value="', $i, '">';
echo '</li>';
$i++;
}
echo '</ul>';
?>
<table>
<?php
echo keep_chan($family);
?>
</table>
<p id="save-cancel">
<input type="submit" class="save" value="<?php
echo I18N::translate('save');
?>
示例12: contactGedcom
/**
* Create a link to contact the genealogy contact.
*
* @return string
*/
public function contactGedcom()
{
$user_id = $this->tree->getPreference('CONTACT_USER_ID');
$user = User::find($user_id);
if ($user) {
return Theme::theme()->contactLink($user);
} else {
return $user_id;
}
}
示例13: pageHeader
/**
* Print the page header, using the theme
*
* @param bool $popup Is this a popup window
*
* @return $this
*/
public function pageHeader($popup = false)
{
global $WT_TREE;
$this->popup = $popup;
// Give Javascript access to some PHP constants
$this->addInlineJavascript('
var WT_STATIC_URL = "' . Filter::escapeJs(WT_STATIC_URL) . '";
var WT_MODULES_DIR = "' . Filter::escapeJs(WT_MODULES_DIR) . '";
var WT_GEDCOM = "' . Filter::escapeJs($WT_TREE ? $WT_TREE->getName() : '') . '";
var textDirection = "' . Filter::escapeJs(I18N::direction()) . '";
var WT_SCRIPT_NAME = "' . Filter::escapeJs(WT_SCRIPT_NAME) . '";
var WT_LOCALE = "' . Filter::escapeJs(WT_LOCALE) . '";
var WT_CSRF_TOKEN = "' . Filter::escapeJs(Filter::getCsrfToken()) . '";
', self::JS_PRIORITY_HIGH);
Theme::theme()->sendHeaders();
echo Theme::theme()->doctype();
echo Theme::theme()->html();
echo Theme::theme()->head($this);
if ($this->popup) {
echo Theme::theme()->bodyHeaderPopupWindow();
// We've displayed the header - display the footer automatically
register_shutdown_function(array($this, 'pageFooterPopupWindow'), $this->popup);
} else {
echo Theme::theme()->bodyHeader();
// We've displayed the header - display the footer automatically
register_shutdown_function(array($this, 'pageFooter'), $this->popup);
}
return $this;
}
示例14: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
global $controller;
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$controller->addInlineJavascript('
jQuery("#new_passwd").hide();
jQuery("#passwd_click").click(function() {
jQuery("#new_passwd").slideToggle(100, function() {
jQuery("#new_passwd_username").focus();
});
return false;
});
');
if (Auth::check()) {
$title = I18N::translate('Logout');
$content = '<div class="center"><form method="post" action="logout.php" name="logoutform" onsubmit="return true;">';
$content .= '<br><a href="../../edituser.php" class="name2">' . I18N::translate('Logged in as ') . ' ' . Auth::user()->getRealNameHtml() . '</a><br><br>';
$content .= '<input type="submit" value="' . I18N::translate('Logout') . '">';
$content .= '<br><br></form></div>';
} else {
$title = I18N::translate('Login');
$content = '<div id="login-box">
<form id="login-form" name="login-form" method="post" action="' . WT_LOGIN_URL . '">
<input type="hidden" name="action" value="login">';
$content .= '<div>
<label for="username">' . I18N::translate('Username') . '<input type="text" id="username" name="username" class="formField">
</label>
</div>
<div>
<label for="password">' . I18N::translate('Password') . '<input type="password" id="password" name="password" class="formField">
</label>
</div>
<div>
<input type="submit" value="' . I18N::translate('Login') . '">
</div>
<div>
<a href="#" id="passwd_click">' . I18N::translate('Request new password') . '</a>
</div>';
if (Site::getPreference('USE_REGISTRATION_MODULE')) {
$content .= '<div><a href="' . WT_LOGIN_URL . '?action=register">' . I18N::translate('Request new user account') . '</a></div>';
}
$content .= '</form>';
// close "login-form"
// hidden New Password block
$content .= '<div id="new_passwd">
<form id="new_passwd_form" name="new_passwd_form" action="' . WT_LOGIN_URL . '" method="post">
<input type="hidden" name="time" value="">
<input type="hidden" name="action" value="requestpw">
<h4>' . I18N::translate('Lost password request') . '</h4>
<div>
<label for="new_passwd_username">' . I18N::translate('Username or email address') . '<input type="text" id="new_passwd_username" name="new_passwd_username" value="">
</label>
</div>
<div><input type="submit" value="' . I18N::translate('continue') . '"></div>
</form>
</div>';
//"new_passwd"
$content .= '</div>';
//"login-box"
}
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例15: printEmptyBox
/**
* Print empty box
*/
private function printEmptyBox()
{
echo $this->showFull() ? Theme::theme()->individualBoxEmpty() : Theme::theme()->individualBoxSmallEmpty();
}