本文整理汇总了PHP中Fisharebest\Webtrees\Auth类的典型用法代码示例。如果您正苦于以下问题:PHP Auth类的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Auth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-sour');
if (Auth::isEditor($this->record->getTree())) {
$fact = $this->record->getFirstFact('TITL');
if ($fact) {
// Edit existing name
$menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
} else {
// Add new name
$menu->addSubmenu(new Menu(I18N::translate('Edit the source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
}
// delete
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-sour-del', array('onclick' => "return delete_record('" . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');")));
}
// edit raw
if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-sour-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
return $menu;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:28,代码来源:SourceController.php
示例2: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-obje');
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the media object'), '#', 'menu-obje-edit', array('onclick' => 'window.open("addmedia.php?action=editmedia&pid=' . $this->record->getXref() . '", "_blank", edit_window_specs)')));
// main link displayed on page
if (Module::getModuleByName('GEDFact_assistant')) {
$menu->addSubmenu(new Menu(I18N::translate('Manage the links'), '#', 'menu-obje-link', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","manage");')));
} else {
$menu->addSubmenu(new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","person");')));
$menu->addSubmenu(new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","family");')));
$menu->addSubmenu(new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $this->record->getXref() . '","source");')));
}
// delete
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
// edit raw
if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-obje-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
return $menu;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:29,代码来源:MediaController.php
示例3: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Edit note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_note("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJS(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
// add to favorites
if (Module::getModuleByName('user_favorites')) {
$menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-note-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite",{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
}
// Get the link for the first submenu and set it as the link for the main menu
if ($menu->getSubmenus()) {
$submenus = $menu->getSubmenus();
$menu->setLink($submenus[0]->getLink());
$menu->setAttrs($submenus[0]->getAttrs());
}
return $menu;
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:29,代码来源:NoteController.php
示例4: pageHeader
private function pageHeader(PageController $controller)
{
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Fancy Treeview'))->pageHeader();
// add javascript and styleseheet
$this->includeJs($controller, 'admin');
echo $this->getStylesheet();
}
开发者ID:bxbroze,项目名称:webtrees,代码行数:7,代码来源:AdminTemplate.php
示例5: hookAfterInit
/**
* Create resources for the colors theme.
*/
public function hookAfterInit()
{
$this->palettes = array('aquamarine' => I18N::translate('Aqua Marine'), 'ash' => I18N::translate('Ash'), 'belgianchocolate' => I18N::translate('Belgian Chocolate'), 'bluelagoon' => I18N::translate('Blue Lagoon'), 'bluemarine' => I18N::translate('Blue Marine'), 'coffeeandcream' => I18N::translate('Coffee and Cream'), 'coldday' => I18N::translate('Cold Day'), 'greenbeam' => I18N::translate('Green Beam'), 'mediterranio' => I18N::translate('Mediterranio'), 'mercury' => I18N::translate('Mercury'), 'nocturnal' => I18N::translate('Nocturnal'), 'olivia' => I18N::translate('Olivia'), 'pinkplastic' => I18N::translate('Pink Plastic'), 'sage' => I18N::translate('Sage'), 'shinytomato' => I18N::translate('Shiny Tomato'), 'tealtop' => I18N::translate('Teal Top'));
uasort($this->palettes, '\\Fisharebest\\Webtrees\\I18N::strcasecmp');
// If we've selected a new palette, and we are logged in, set this value as a default.
if (isset($_GET['themecolor']) && array_key_exists($_GET['themecolor'], $this->palettes)) {
// Request to change color
$this->palette = $_GET['themecolor'];
Auth::user()->setPreference('themecolor', $this->palette);
if (Auth::isAdmin()) {
Site::setPreference('DEFAULT_COLOR_PALETTE', $this->palette);
}
unset($_GET['themecolor']);
// Rember that we have selected a value
Session::put('subColor', $this->palette);
}
// If we are logged in, use our preference
$this->palette = Auth::user()->getPreference('themecolor');
// If not logged in or no preference, use one we selected earlier in the session?
if (!$this->palette) {
$this->palette = Session::get('subColor');
}
// We haven't selected one this session? Use the site default
if (!$this->palette) {
$this->palette = Site::getPreference('DEFAULT_COLOR_PALETTE');
}
// Make sure our selected palette actually exists
if (!array_key_exists($this->palette, $this->palettes)) {
$this->palette = 'ash';
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:34,代码来源:ColorsTheme.php
示例6: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-repo');
if (Auth::isEditor($this->record->getTree())) {
$fact = $this->record->getFirstFact('NAME');
if ($fact) {
// Edit existing name
$menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return edit_record("' . $this->record->getXref() . '", "' . $fact->getFactId() . '");')));
} else {
// Add new name
$menu->addSubmenu(new Menu(I18N::translate('Edit the repository'), '#', 'menu-repo-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "NAME");')));
}
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-repo-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
// edit raw
if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-repo-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
// add to favorites
if (Module::getModuleByName('user_favorites')) {
$menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-repo-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})')));
}
return $menu;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:34,代码来源:RepositoryController.php
示例7: getActionButtons
/**
* Default buttons are update and update_all
*
* @param string $xref
*
* @return string[]
*/
public function getActionButtons($xref)
{
if (Auth::user()->getPreference('auto_accept')) {
return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'), BatchUpdateModule::createSubmitButton(I18N::translate('Update all'), $xref, 'update_all'));
} else {
return array(BatchUpdateModule::createSubmitButton(I18N::translate('Update'), $xref, 'update'));
}
}
开发者ID:jflash,项目名称:webtrees,代码行数:15,代码来源:BatchUpdateBasePlugin.php
示例8: __construct
/**
* {@inheritDoc}
* @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
*/
public function __construct(AbstractModule $module)
{
global $WT_TREE;
parent::__construct($module);
$this->sosa_provider = new SosaProvider($WT_TREE, Auth::user());
$this->generation = Filter::getInteger('gen');
$this->view_bag = new ViewBag();
$this->view_bag->set('generation', $this->generation);
$this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration());
$this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0);
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:15,代码来源:SosaListController.php
示例9: getMenu
/**
* A menu, to be added to the main application menu.
*
* @return Menu|null
*/
public function getMenu()
{
global $controller, $WT_TREE;
$menu = null;
if (empty($controller)) {
return null;
}
if (Auth::isEditor($WT_TREE) && method_exists($controller, 'getEditMenu')) {
$menu = $controller->getEditMenu();
}
return $menu;
}
开发者ID:AlexSnet,项目名称:webtrees,代码行数:17,代码来源:PageMenuModule.php
示例10: 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 $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc');
$block = $this->getBlockSetting($block_id, 'block', '1');
$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0');
foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$found_facts = FunctionsDb::getRecentChanges(WT_CLIENT_JD - $days);
if (!$found_facts && $hide_empty) {
return '';
}
// Print block header
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
$content = '';
// Print block content
if (count($found_facts) == 0) {
$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
} else {
ob_start();
switch ($infoStyle) {
case 'list':
$content .= FunctionsPrintLists::changesList($found_facts, $sortStyle);
break;
case 'table':
// sortable table
$content .= FunctionsPrintLists::changesTable($found_facts, $sortStyle);
break;
}
$content .= ob_get_clean();
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:61,代码来源:RecentChangesModule.php
示例11: 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 $ctype, $WT_TREE;
$num = $this->getBlockSetting($block_id, 'num', '10');
$count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before');
$block = $this->getBlockSetting($block_id, 'block', '0');
foreach (array('count_placement', 'num', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
$content = '';
// load the lines from the file
$top10 = Database::prepare("SELECT page_parameter, page_count" . " FROM `##hit_counter`" . " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . " ORDER BY page_count DESC LIMIT :limit")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'limit' => (int) $num))->fetchAssoc();
if ($block) {
$content .= '<table width="90%">';
} else {
$content .= '<table>';
}
foreach ($top10 as $id => $count) {
$record = GedcomRecord::getInstance($id, $WT_TREE);
if ($record && $record->canShow()) {
$content .= '<tr>';
if ($count_placement == 'before') {
$content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>';
}
$content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
if ($count_placement == 'after') {
$content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>';
}
$content .= '</tr>';
}
}
$content .= "</table>";
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
开发者ID:josefpavlik,项目名称:webtrees,代码行数:60,代码来源:TopPageViewsModule.php
示例12: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-note');
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Edit the note'), '#', 'menu-note-edit', array('onclick' => 'return edit_note("' . $this->record->getXref() . '");')));
// delete
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-note-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");')));
}
return $menu;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:17,代码来源:NoteController.php
示例13: getBlock
/** {@inheritdoc} */
public function getBlock($block_id, $template = true, $cfg = array())
{
global $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
$show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
$block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
if (empty($records) && $hide_empty) {
return '';
}
// Print block header
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
$content = '';
// Print block content
if (count($records) == 0) {
$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
} else {
switch ($infoStyle) {
case 'list':
$content .= $this->changesList($records, $sortStyle, $show_user);
break;
case 'table':
$content .= $this->changesTable($records, $sortStyle, $show_user);
break;
}
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:51,代码来源:RecentChangesModule.php
示例14: modAction
/**
* This is a general purpose hook, allowing modules to respond to routes
* of the form module.php?mod=FOO&mod_action=BAR
*
* @param string $mod_action
*/
public function modAction($mod_action)
{
global $WT_TREE;
switch ($mod_action) {
case 'menu-add-favorite':
// Process the "add to user favorites" menu item on indi/fam/etc. pages
$record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
if (Auth::check() && $record->canShowName()) {
self::addFavorite(array('user_id' => Auth::id(), 'gedcom_id' => $record->getTree()->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
FlashMessages::addMessage(I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
}
break;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:UserFavoritesModule.php
示例15: 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();
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:18,代码来源:AdminConfigController.php
示例16: pageHeader
private function pageHeader(PageController $controller)
{
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Fancy Research Links'))->pageHeader()->addInlineJavascript('
jQuery("head").append("<style>[dir=rtl] .checkbox-inline input[type=checkbox]{margin-left:-20px}</style>");
jQuery("input[name=select-all]").click(function(){
if (jQuery(this).is(":checked") == true) {
jQuery(".checkbox-inline").find(":checkbox").prop("checked", true).val(1);
jQuery("input[id^=NEW_FRL_PLUGINS]").val(1);
} else {
jQuery(".checkbox-inline").find(":checkbox").prop("checked", false).val(0);
jQuery("input[id^=NEW_FRL_PLUGINS]").val(0);
}
formChanged = true;
});
');
}
开发者ID:bschwede,项目名称:fancy_research_links,代码行数:16,代码来源:AdminTemplate.php
示例17: 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();
}
开发者ID:jon48,项目名称:webtrees-tools,代码行数:50,代码来源:TranslationController.php
示例18: 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 $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', '7');
$filter = $this->getBlockSetting($block_id, 'filter', '1');
$onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
$block = $this->getBlockSetting($block_id, 'block', '1');
foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$startjd = WT_CLIENT_JD + 1;
$endjd = WT_CLIENT_JD + $days;
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
$content = '';
switch ($infoStyle) {
case 'list':
// Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
$content .= FunctionsPrintLists::eventsList($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
break;
case 'table':
// Style 2: New format, tables, big text, etc. Not too good on right side of page
ob_start();
$content .= FunctionsPrintLists::eventsTable($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
$content .= ob_get_clean();
break;
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:55,代码来源:UpcomingAnniversariesModule.php
示例19: __construct
/**
* Create a branches list controller
*/
public function __construct()
{
global $WT_TREE;
parent::__construct();
$this->surname = Filter::get('surname');
$this->soundex_std = Filter::getBool('soundex_std');
$this->soundex_dm = Filter::getBool('soundex_dm');
if ($this->surname) {
$this->setPageTitle(I18N::translate('Branches of the %s family', Filter::escapeHtml($this->surname)));
$this->loadIndividuals();
$self = Individual::getInstance($WT_TREE->getUserPreference(Auth::user(), 'gedcomid'), $WT_TREE);
if ($self) {
$this->loadAncestors($self, 1);
}
} else {
$this->setPageTitle(I18N::translate('Branches'));
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:BranchesController.php
示例20: getActiveModulesByComponent
/**
* Get a list of modules which (a) provide a specific function and (b) we have permission to see.
*
* We cannot currently use auto-loading for modules, as there may be user-defined
* modules about which the auto-loader knows nothing.
*
* @param Tree $tree
* @param string $component The type of module, such as "tab", "report" or "menu"
*
* @return AbstractModule[]
*/
private static function getActiveModulesByComponent(Tree $tree, $component)
{
$module_names = Database::prepare("SELECT SQL_CACHE module_name" . " FROM `##module`" . " JOIN `##module_privacy` USING (module_name)" . " WHERE gedcom_id = :tree_id AND component = :component AND status = 'enabled' AND access_level >= :access_level" . " ORDER BY CASE component WHEN 'menu' THEN menu_order WHEN 'sidebar' THEN sidebar_order WHEN 'tab' THEN tab_order ELSE 0 END, module_name")->execute(array('tree_id' => $tree->getTreeId(), 'component' => $component, 'access_level' => Auth::accessLevel($tree)))->fetchOneColumn();
$array = array();
foreach ($module_names as $module_name) {
$interface = '\\Fisharebest\\Webtrees\\Module\\Module' . ucfirst($component) . 'Interface';
$module = self::getModuleByName($module_name);
if ($module instanceof $interface) {
$array[$module_name] = $module;
}
}
// The order of menus/sidebars/tabs is defined in the database. Others are sorted by name.
if ($component !== 'menu' && $component !== 'sidebar' && $component !== 'tab') {
uasort($array, function (AbstractModule $x, AbstractModule $y) {
return I18N::strcasecmp($x->getTitle(), $y->getTitle());
});
}
return $array;
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:30,代码来源:Module.php
注:本文中的Fisharebest\Webtrees\Auth类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论