本文整理汇总了PHP中Fisharebest\Webtrees\Auth::isEditor方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isEditor方法的具体用法?PHP Auth::isEditor怎么用?PHP Auth::isEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Auth
的用法示例。
在下文中一共展示了Auth::isEditor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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-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;
}
示例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-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;
}
示例4: 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;
}
示例5: 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;
}
示例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-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;
}
示例7: 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 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 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
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-obje-del', array('onclick' => 'return delete_media("' . 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 raw GEDCOM'), '#', 'menu-obje-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-obje-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;
}
示例8: 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 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 source'), '#', 'menu-sour-edit', array('onclick' => 'return add_fact("' . $this->record->getXref() . '", "TITL");')));
}
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$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 raw GEDCOM'), '#', 'menu-sour-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-sour-addfav', array('onlick' => '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;
}
示例9: getEditMenu
/**
* get edit menu
*/
public function getEditMenu()
{
if (!$this->record || $this->record->isPendingDeletion()) {
return null;
}
// edit menu
$menu = new Menu(I18N::translate('Edit'), '#', 'menu-record');
// 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-record-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");')));
}
// delete
if (Auth::isEditor($this->record->getTree())) {
$menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-record-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;
}
示例10: formatAssociateRelationship
/**
* Print the associations from the associated individuals in $event to the individuals in $record
*
* @param Fact $event
*
* @return string
*/
private static function formatAssociateRelationship(Fact $event)
{
$parent = $event->getParent();
// To whom is this record an assocate?
if ($parent instanceof Individual) {
// On an individual page, we just show links to the person
$associates = array($parent);
} elseif ($parent instanceof Family) {
// On a family page, we show links to both spouses
$associates = $parent->getSpouses();
} else {
// On other pages, it does not make sense to show associates
return '';
}
preg_match_all('/^1 ASSO @(' . WT_REGEX_XREF . ')@((\\n[2-9].*)*)/', $event->getGedcom(), $amatches1, PREG_SET_ORDER);
preg_match_all('/\\n2 _?ASSO @(' . WT_REGEX_XREF . ')@((\\n[3-9].*)*)/', $event->getGedcom(), $amatches2, PREG_SET_ORDER);
$html = '';
// For each ASSO record
foreach (array_merge($amatches1, $amatches2) as $amatch) {
$person = Individual::getInstance($amatch[1], $event->getParent()->getTree());
if ($person && $person->canShowName()) {
// Is there a "RELA" tag
if (preg_match('/\\n[23] RELA (.+)/', $amatch[2], $rmatch)) {
// Use the supplied relationship as a label
$label = GedcomCodeRela::getValue($rmatch[1], $person);
} else {
// Use a default label
$label = GedcomTag::getLabel('ASSO', $person);
}
$values = array('<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>');
foreach ($associates as $associate) {
$relationship_name = Functions::getAssociateRelationshipName($associate, $person);
if (!$relationship_name) {
$relationship_name = GedcomTag::getLabel('RELA');
}
if ($parent instanceof Family) {
// For family ASSO records (e.g. MARR), identify the spouse with a sex icon
$relationship_name .= $associate->getSexImage();
}
$values[] = '<a href="relationship.php?pid1=' . $associate->getXref() . '&pid2=' . $person->getXref() . '&ged=' . $associate->getTree()->getNameUrl() . '" rel="nofollow">' . $relationship_name . '</a>';
}
$value = implode(' — ', $values);
// Use same markup as GedcomTag::getLabelValue()
$asso = I18N::translate('<span class="label">%1$s:</span> <span class="field" dir="auto">%2$s</span>', $label, $value);
} elseif (!$person && Auth::isEditor($event->getParent()->getTree())) {
$asso = GedcomTag::getLabelValue('ASSO', '<span class="error">' . $amatch[1] . '</span>');
} else {
$asso = '';
}
$html .= '<div class="fact_ASSO">' . $asso . '</div>';
}
return $html;
}
示例11: printFamilyFacts
/**
* Print the facts
*/
public function printFamilyFacts()
{
global $linkToID;
$linkToID = $this->record->getXref();
// -- Tell addmedia.php what to link to
$indifacts = $this->record->getFacts();
if ($indifacts) {
Functions::sortFacts($indifacts);
foreach ($indifacts as $fact) {
FunctionsPrintFacts::printFact($fact, $this->record);
}
} else {
echo '<tr><td class="messagebox" colspan="2">', I18N::translate('No facts exist for this family.'), '</td></tr>';
}
if (Auth::isEditor($this->record->getTree())) {
FunctionsPrint::printAddNewFact($this->record->getXref(), $indifacts, 'FAM');
echo '<tr><td class="descriptionbox">';
echo I18N::translate('Note');
echo '</td><td class="optionbox">';
echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", I18N::translate('Add a note'), '</a>';
echo '</td></tr>';
echo '<tr><td class="descriptionbox">';
echo I18N::translate('Shared note');
echo '</td><td class="optionbox">';
echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", I18N::translate('Add a shared note'), '</a>';
echo '</td></tr>';
if ($this->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($this->record->getTree())) {
echo '<tr><td class="descriptionbox">';
echo I18N::translate('Media object');
echo '</td><td class="optionbox">';
echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", I18N::translate('Add a media object'), '</a>';
echo FunctionsPrint::helpLink('OBJE');
echo '<br>';
echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&linkto=family', '_blank', find_window_specs); return false;\">", I18N::translate('Link to an existing media object'), '</a>';
echo '</td></tr>';
}
echo '<tr><td class="descriptionbox">';
echo I18N::translate('Source');
echo '</td><td class="optionbox">';
echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", I18N::translate('Add a source citation'), '</a>';
echo '</td></tr>';
}
}
示例12: SimpleController
$glevels = Filter::postArray('glevels', '[0-9]');
$folder = Filter::post('folder');
$update_CHAN = !Filter::postBool('preserve_last_changed');
$controller = new SimpleController();
$controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->restrictAccess(Auth::isMember($WT_TREE));
$disp = true;
$media = Media::getInstance($pid, $WT_TREE);
if ($media) {
$disp = $media->canShow();
}
if ($action == 'update' || $action == 'create') {
if ($linktoid) {
$disp = GedcomRecord::getInstance($linktoid, $WT_TREE)->canShow();
}
}
if (!Auth::isEditor($WT_TREE) || !$disp) {
$controller->pageHeader()->addInlineJavascript('closePopupAndReloadParent();');
return;
}
// There is a lot of common code in the create and update cases…
// …and also in the admin_media_upload.php script
switch ($action) {
case 'create':
// Save the information from the “showcreateform” action
$controller->setPageTitle(I18N::translate('Create a new media object'));
// Validate the media folder
$folderName = str_replace('\\', '/', $folder);
$folderName = trim($folderName, '/');
if ($folderName == '.') {
$folderName = '';
}
示例13: mediaTable
/**
* Print a table of media objects
*
* @param Media[] $media_objects
*
* @return string
*/
public static function mediaTable($media_objects)
{
global $WT_TREE, $controller;
$html = '';
$table_id = 'table-obje-' . Uuid::uuid4();
// lists requires a unique ID in case there are multiple lists per page
$controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
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("#' . $table_id . '").dataTable({
dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
' . I18N::datatablesI18N() . ',
jQueryUI: true,
autoWidth:false,
processing: true,
columns: [
/* 0 media */ { sortable: false },
/* 1 title */ { type: "unicode" },
/* 2 #indi */ { dataSort: 3, class: "center" },
/* 3 #INDI */ { type: "num", visible: false },
/* 4 #fam */ { dataSort: 5, class: "center" },
/* 5 #FAM */ { type: "num", visible: false },
/* 6 #sour */ { dataSort: 7, class: "center" },
/* 7 #SOUR */ { type: "num", visible: false },
/* 8 CHAN */ { dataSort: 9, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' },
/* 9 CHAN_sort */ { visible: false },
],
displayLength: 20,
pagingType: "full_numbers"
});
jQuery(".media-list").css("visibility", "visible");
jQuery(".loading-image").css("display", "none");
');
//--table wrapper
$html .= '<div class="loading-image"> </div>';
$html .= '<div class="media-list">';
//-- table header
$html .= '<table id="' . $table_id . '"><thead><tr>';
$html .= '<th>' . I18N::translate('Media') . '</th>';
$html .= '<th>' . GedcomTag::getLabel('TITL') . '</th>';
$html .= '<th>' . I18N::translate('Individuals') . '</th>';
$html .= '<th>#INDI</th>';
$html .= '<th>' . I18N::translate('Families') . '</th>';
$html .= '<th>#FAM</th>';
$html .= '<th>' . I18N::translate('Sources') . '</th>';
$html .= '<th>#SOUR</th>';
$html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . GedcomTag::getLabel('CHAN') . '</th>';
$html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th>';
$html .= '</tr></thead>';
//-- table body
$html .= '<tbody>';
foreach ($media_objects as $media_object) {
if ($media_object->canShow()) {
$name = $media_object->getFullName();
if ($media_object->isPendingAddtion()) {
$class = ' class="new"';
} elseif ($media_object->isPendingDeletion()) {
$class = ' class="old"';
} else {
$class = '';
}
$html .= '<tr' . $class . '>';
//-- Object thumbnail
$html .= '<td>' . $media_object->displayImage() . '</td>';
//-- Object name(s)
$html .= '<td>';
$html .= '<a href="' . $media_object->getHtmlUrl() . '" class="list_item name2">';
$html .= FunctionsPrint::highlightSearchHits($name) . '</a>';
if (Auth::isEditor($media_object->getTree())) {
$html .= '<br><a href="' . $media_object->getHtmlUrl() . '">' . basename($media_object->getFilename()) . '</a>';
}
$html .= '</td>';
//-- Linked INDIs
$num = count($media_object->linkedIndividuals('OBJE'));
$html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>';
//-- Linked FAMs
$num = count($media_object->linkedfamilies('OBJE'));
$html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>';
//-- Linked SOURces
$num = count($media_object->linkedSources('OBJE'));
$html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>';
//-- Last change
if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) {
$html .= '<td>' . $media_object->LastChangeTimestamp() . '</td>';
} else {
$html .= '<td></td>';
}
//-- Last change hidden sort column
if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) {
$html .= '<td>' . $media_object->LastChangeTimestamp(true) . '</td>';
} else {
$html .= '<td></td>';
}
//.........这里部分代码省略.........
示例14: hasTabContent
/** {@inheritdoc} */
public function hasTabContent()
{
global $WT_TREE;
return Auth::isEditor($WT_TREE) || $this->getFactsWithNotes();
}
示例15: 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>
//.........这里部分代码省略.........