require 'includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Page(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('Module administration'))->pageHeader()->addInlineJavascript(' jQuery("#sidebars_table").sortable({items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y"}); //-- update the order numbers after drag-n-drop sorting is complete jQuery("#sidebars_table").bind("sortupdate", function(event, ui) { jQuery("#"+jQuery(this).attr("id")+" input").each( function (index, value) { value.value = index+1; } ); }); '); $modules = WT_Module::getActiveSidebars(WT_GED_ID, WT_PRIV_HIDE); $action = WT_Filter::post('action'); if ($action == 'update_mods' && WT_Filter::checkCsrf()) { foreach ($modules as $module_name => $module) { foreach (WT_Tree::getAll() as $tree) { $access_level = WT_Filter::post("sidebaraccess-{$module_name}-{$tree->tree_id}", WT_REGEX_INTEGER, $module->defaultAccessLevel()); WT_DB::prepare("REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'sidebar', ?)")->execute(array($module_name, $tree->tree_id, $access_level)); } $order = WT_Filter::post('sidebarorder-' . $module_name); WT_DB::prepare("UPDATE `##module` SET sidebar_order=? WHERE module_name=?")->execute(array($order, $module_name)); $module->order = $order; // Make the new order take effect immediately } uasort($modules, function ($x, $y) { return $x->order - $y->order; });
public function getSideBarContent() { global $controller; $html = ''; $active = 0; $n = 0; foreach (WT_Module::getActiveSidebars() as $mod) { if ($mod->hasSidebarContent()) { $html .= '<h3 id="' . $mod->getName() . '"><a href="#">' . $mod->getTitle() . '</a></h3>'; $html .= '<div id="sb_content_' . $mod->getName() . '">' . $mod->getSidebarContent() . '</div>'; // The family navigator should be opened by default if ($mod->getName() == 'family_nav') { $active = $n; } ++$n; } } if ($html) { $controller->addInlineJavascript(' jQuery("#sidebarAccordion").accordion({ active:' . $active . ', heightStyle: "content", collapsible: true, }); '); return '<div id="sidebar"><div id="sidebarAccordion">' . $html . '</div></div>'; } else { return ''; } }
public function getTabContent() { global $EXPAND_RELATIVES_EVENTS, $controller; $EXPAND_HISTO_EVENTS = false; $indifacts = array(); // The individual’s own facts foreach ($controller->record->getFacts() as $fact) { switch ($fact->getTag()) { case 'SEX': case 'NAME': case 'SOUR': case 'OBJE': case 'NOTE': case 'FAMC': case 'FAMS': break; default: if (!array_key_exists('extra_info', WT_Module::getActiveSidebars()) || !extra_info_WT_Module::showFact($fact)) { $indifacts[] = $fact; } break; } } // Add spouse-family facts foreach ($controller->record->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { switch ($fact->getTag()) { case 'SOUR': case 'NOTE': case 'OBJE': case 'CHAN': case '_UID': case 'RIN': case 'HUSB': case 'WIFE': case 'CHIL': break; default: $indifacts[] = $fact; break; } } $spouse = $family->getSpouse($controller->record); if ($spouse) { foreach (self::spouse_facts($controller->record, $spouse) as $fact) { $indifacts[] = $fact; } } foreach (self::child_facts($controller->record, $family, '_CHIL', '') as $fact) { $indifacts[] = $fact; } } foreach (self::parent_facts($controller->record, 1) as $fact) { $indifacts[] = $fact; } foreach (self::historical_facts($controller->record) as $fact) { $indifacts[] = $fact; } foreach (self::associate_facts($controller->record) as $fact) { $indifacts[] = $fact; } sort_facts($indifacts); ob_start(); echo '<table class="facts_table">'; echo '<tbody>'; if (!$indifacts) { echo '<tr><td colspan="2" class="facts_value">', WT_I18N::translate('There are no facts for this individual.'), '</td></tr>'; } echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox"'; if ($EXPAND_RELATIVES_EVENTS) { echo ' checked="checked"'; } echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', WT_I18N::translate('Events of close relatives'), '</label>'; if (file_exists(WT_Site::preference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) { echo ' <input id="checkbox_histo" type="checkbox"'; if ($EXPAND_HISTO_EVENTS) { echo ' checked="checked"'; } echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', WT_I18N::translate('Historical facts'), '</label>'; } echo '</form></td></tr>'; foreach ($indifacts as $fact) { print_fact($fact, $controller->record); } //-- new fact link if ($controller->record->canEdit()) { print_add_new_fact($controller->record->getXref(), $indifacts, 'INDI'); } echo '</tbody>'; echo '</table>'; if (!$EXPAND_RELATIVES_EVENTS) { echo '<script>jQuery("tr.rela").toggle();</script>'; } if (!$EXPAND_HISTO_EVENTS) { echo '<script>jQuery("tr.histo").toggle();</script>'; } return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }