Example #1
0
 function __construct()
 {
     global $USE_RIN;
     $xref = WT_Filter::get('pid', WT_REGEX_XREF);
     $this->record = WT_Individual::getInstance($xref);
     if (!$this->record && $USE_RIN) {
         $rin = find_rin_id($xref);
         $this->record = WT_Individual::getInstance($rin);
     }
     parent::__construct();
     $this->tabs = WT_Module::getActiveTabs();
     // If we can display the details, add them to the page header
     if ($this->record && $this->record->canShow()) {
         $this->setPageTitle($this->record->getFullName() . ' ' . $this->record->getLifespan());
     }
 }
Example #2
0
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("#tabs_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("#tabs_table").bind("sortupdate", function(event, ui) {
			jQuery("#"+jQuery(this).attr("id")+" input").each(
				function (index, value) {
					value.value = index+1;
				}
			);
		});
	');
$modules = WT_Module::getActiveTabs(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("tabaccess-{$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 (?, ?, 'tab', ?)")->execute(array($module_name, $tree->tree_id, $access_level));
        }
        $order = WT_Filter::post('taborder-' . $module_name);
        WT_DB::prepare("UPDATE `##module` SET tab_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;
    });