本文整理汇总了PHP中Fisharebest\Webtrees\Theme类的典型用法代码示例。如果您正苦于以下问题:PHP Theme类的具体用法?PHP Theme怎么用?PHP 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: generateFanChart
/**
* Generate both the HTML and PNG components of the fan chart
*
* The HTML and PNG components both require the same co-ordinate calculations,
* so we generate them using the same code, but we send them in separate
* HTTP requests.
*
* @param string $what "png" or "html"
*
* @return string
*/
public function generateFanChart($what)
{
$treeid = $this->sosaAncestors($this->generations);
$fanw = 640 * $this->fan_width / 100;
$fandeg = 90 * $this->fan_style;
$html = '';
$treesize = count($treeid) + 1;
// generations count
$gen = log($treesize) / log(2) - 1;
$sosa = $treesize - 1;
// fan size
if ($fandeg == 0) {
$fandeg = 360;
}
$fandeg = min($fandeg, 360);
$fandeg = max($fandeg, 90);
$cx = $fanw / 2 - 1;
// center x
$cy = $cx;
// center y
$rx = $fanw - 1;
$rw = $fanw / ($gen + 1);
$fanh = $fanw;
// fan height
if ($fandeg == 180) {
$fanh = round($fanh * ($gen + 1) / ($gen * 2));
}
if ($fandeg == 270) {
$fanh = round($fanh * 0.86);
}
$scale = $fanw / 640;
// image init
$image = ImageCreate($fanw, $fanh);
$white = ImageColorAllocate($image, 0xff, 0xff, 0xff);
ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white);
ImageColorTransparent($image, $white);
$color = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-font-color'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-font-color'), 4, 2)));
$bgcolor = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-u'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-u'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-u'), 4, 2)));
$bgcolorM = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-m'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-m'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-m'), 4, 2)));
$bgcolorF = ImageColorAllocate($image, hexdec(substr(Theme::theme()->parameter('chart-background-f'), 0, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-f'), 2, 2)), hexdec(substr(Theme::theme()->parameter('chart-background-f'), 4, 2)));
// imagemap
$imagemap = '<map id="fanmap" name="fanmap">';
// loop to create fan cells
while ($gen >= 0) {
// clean current generation area
$deg2 = 360 + ($fandeg - 180) / 2;
$deg1 = $deg2 - $fandeg;
ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE);
$rx -= 3;
// calculate new angle
$p2 = pow(2, $gen);
$angle = $fandeg / $p2;
$deg2 = 360 + ($fandeg - 180) / 2;
$deg1 = $deg2 - $angle;
// special case for rootid cell
if ($gen == 0) {
$deg1 = 90;
$deg2 = 360 + $deg1;
}
// draw each cell
while ($sosa >= $p2) {
$person = $treeid[$sosa];
if ($person) {
$name = $person->getFullName();
$addname = $person->getAddName();
$text = I18N::reverseText($name);
if ($addname) {
$text .= "\n" . I18N::reverseText($addname);
}
$text .= "\n" . I18N::reverseText($person->getLifeSpan());
switch ($person->getSex()) {
case 'M':
$bg = $bgcolorM;
break;
case 'F':
$bg = $bgcolorF;
break;
default:
$bg = $bgcolor;
break;
}
ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
// split and center text by lines
$wmax = (int) ($angle * 7 / Theme::theme()->parameter('chart-font-size') * $scale);
$wmax = min($wmax, 35 * $scale);
if ($gen == 0) {
$wmax = min($wmax, 17 * $scale);
}
$text = $this->splitAlignText($text, $wmax);
//.........这里部分代码省略.........
示例11: 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;
}
示例12: 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');
?>
示例13:
echo I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.');
?>
</p>
</div>
</div>
<!-- THEME -->
<div class="form-group">
<label class="control-label col-sm-3" for="theme">
<?php
echo I18N::translate('Theme');
?>
</label>
<div class="col-sm-9">
<?php
echo FunctionsEdit::selectEditControl('theme', Theme::themeNames(), I18N::translate('<default theme>'), $user->getPreference('theme'), 'class="form-control"');
?>
</div>
</div>
<!-- COMMENTS -->
<div class="form-group">
<label class="control-label col-sm-3" for="comment">
<?php
echo I18N::translate('Administrator comments on user');
?>
</label>
<div class="col-sm-9">
<textarea class="form-control" id="comment" name="comment" rows="5" maxlength="255"><?php
echo Filter::escapeHtml($user->getPreference('comment'));
?>
示例14: elseif
echo Filter::escapeHtml(Site::getPreference('SMTP_HELO'));
?>
" placeholder="localhost" maxlength="255" pattern="[a-z0-9-]+(\.[a-z0-9-]+)*">
<p class="small text-muted">
<?php
echo I18N::translate('Many mail servers require that the sending server identifies itself correctly, using a valid domain name.');
?>
</p>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
<p class="small text-muted">
<?php
echo Theme::theme()->htmlAlert(I18N::translate('To use a Google mail account, use the following settings: server=smtp.gmail.com, port=587, security=tls, username=xxxxx@gmail.com, password=[your gmail password]'), 'info', false);
?>
</p>
</div>
</div>
<?php
} elseif (Filter::get('action') === 'login') {
?>
<input type="hidden" name="action" value="login">
<!-- LOGIN_URL -->
<div class="form-group">
<label for="LOGIN_URL" class="col-sm-3 control-label">
<?php
echo I18N::translate('Login URL');
示例15: printEmptyBox
/**
* Print empty box
*/
private function printEmptyBox()
{
echo $this->showFull() ? Theme::theme()->individualBoxEmpty() : Theme::theme()->individualBoxSmallEmpty();
}