diff options
| -rw-r--r-- | ancestry.php | 8 | ||||
| -rw-r--r-- | app/Controller/AncestryController.php | 10 | ||||
| -rw-r--r-- | app/Controller/DescendancyController.php | 6 | ||||
| -rw-r--r-- | app/Controller/Familybook.php | 11 | ||||
| -rw-r--r-- | app/Controller/HourglassController.php | 7 | ||||
| -rw-r--r-- | app/Controller/PedigreeController.php | 13 | ||||
| -rw-r--r-- | app/Controller/SearchController.php | 4 | ||||
| -rw-r--r-- | app/Date.php | 5 | ||||
| -rw-r--r-- | app/Place.php | 6 | ||||
| -rw-r--r-- | descendancy.php | 8 | ||||
| -rw-r--r-- | edit_interface.php | 29 | ||||
| -rw-r--r-- | family.php | 3 | ||||
| -rw-r--r-- | help_text.php | 3 | ||||
| -rw-r--r-- | includes/functions/functions.php | 18 | ||||
| -rw-r--r-- | includes/functions/functions_db.php | 1 | ||||
| -rw-r--r-- | includes/functions/functions_edit.php | 41 | ||||
| -rw-r--r-- | includes/functions/functions_print_facts.php | 6 | ||||
| -rw-r--r-- | includes/functions/functions_print_lists.php | 69 | ||||
| -rw-r--r-- | modules_v3/charts/module.php | 15 | ||||
| -rw-r--r-- | modules_v3/clippings/module.php | 6 | ||||
| -rw-r--r-- | modules_v3/gedcom_favorites/module.php | 17 | ||||
| -rw-r--r-- | modules_v3/googlemap/module.php | 4 | ||||
| -rw-r--r-- | modules_v3/personal_facts/module.php | 6 |
23 files changed, 130 insertions, 166 deletions
diff --git a/ancestry.php b/ancestry.php index abc2d5e256..dec23cf2ab 100644 --- a/ancestry.php +++ b/ancestry.php @@ -16,9 +16,17 @@ namespace Fisharebest\Webtrees; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * Defined in session.php + * + * @global Tree $WT_TREE + */ + define('WT_SCRIPT_NAME', 'ancestry.php'); require './includes/session.php'; +$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); + $controller = new AncestryController; $controller ->pageHeader() diff --git a/app/Controller/AncestryController.php b/app/Controller/AncestryController.php index 42e337e759..ec600bc535 100644 --- a/app/Controller/AncestryController.php +++ b/app/Controller/AncestryController.php @@ -35,22 +35,20 @@ class AncestryController extends ChartController { * Startup activity */ function __construct() { - global $bwidth, $bheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS; - global $DEFAULT_PEDIGREE_GENERATIONS, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight; - global $show_full; + global $bwidth, $bheight, $pbwidth, $pbheight, $show_full; + global $PEDIGREE_GENERATIONS, $WT_TREE, $OLD_PGENS, $box_width, $Dbwidth, $Dbheight; parent::__construct(); // Extract form parameters - $this->show_full = Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $this->show_cousins = Filter::getInteger('show_cousins', 0, 1); $this->chart_style = Filter::getInteger('chart_style', 0, 3); $box_width = Filter::getInteger('box_width', 50, 300, 100); - $PEDIGREE_GENERATIONS = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); + $PEDIGREE_GENERATIONS = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; - $OLD_PGENS = $PEDIGREE_GENERATIONS; // -- size of the detailed boxes based upon optional width parameter diff --git a/app/Controller/DescendancyController.php b/app/Controller/DescendancyController.php index 7455917ede..ae5a4ccef5 100644 --- a/app/Controller/DescendancyController.php +++ b/app/Controller/DescendancyController.php @@ -49,14 +49,14 @@ class DescendancyController extends ChartController { * Create the descendancy controller */ function __construct() { - global $bwidth, $bheight, $pbwidth, $pbheight, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full; + global $bwidth, $bheight, $pbwidth, $pbheight, $WT_TREE, $show_full; parent::__construct(); // Extract parameters from form - $this->show_full = Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $this->chart_style = Filter::getInteger('chart_style', 0, 3, 0); - $this->generations = Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); + $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); $this->box_width = Filter::getInteger('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... diff --git a/app/Controller/Familybook.php b/app/Controller/Familybook.php index 47f55c9052..dbb1febfe0 100644 --- a/app/Controller/Familybook.php +++ b/app/Controller/Familybook.php @@ -49,15 +49,12 @@ class FamilybookController extends ChartController { parent::__construct(); - $PEDIGREE_FULL_DETAILS = $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'); - $MAX_DESCENDANCY_GENERATIONS = $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'); - // Extract the request parameters - $this->show_full = Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $this->show_spouse = Filter::getInteger('show_spouse', 0, 1); - $this->descent = Filter::getInteger('descent', 0, 9, 5); - $this->generations = Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 2); - $this->box_width = Filter::getInteger('box_width', 50, 300, 100); + $this->descent = Filter::getInteger('descent', 0, 9, 5); + $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), 2); + $this->box_width = Filter::getInteger('box_width', 50, 300, 100); // Box sizes are set globally in the theme. Modify them here. global $bwidth, $bheight, $Dbwidth, $bhalfheight, $Dbheight; diff --git a/app/Controller/HourglassController.php b/app/Controller/HourglassController.php index d3b4870a92..9410aa978a 100644 --- a/app/Controller/HourglassController.php +++ b/app/Controller/HourglassController.php @@ -49,16 +49,15 @@ class HourglassController extends ChartController { * @param boolean $loadJS */ function __construct($rootid = '', $show_full = 1, $loadJS = true) { - global $bheight, $bwidth, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS; - global $TEXT_DIRECTION, $show_full; + global $bheight, $bwidth, $WT_TREE, $TEXT_DIRECTION, $show_full; parent::__construct(); // Extract parameters from from $this->pid = Filter::get('rootid', WT_REGEX_XREF); - $this->show_full = Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); + $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $this->show_spouse = Filter::getInteger('show_spouse', 0, 1, 0); - $this->generations = Filter::getInteger('generations', 2, $MAX_DESCENDANCY_GENERATIONS, 3); + $this->generations = Filter::getInteger('generations', 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS'), 3); $this->box_width = Filter::getInteger('box_width', 50, 300, 100); $this->canLoadJS = $loadJS; diff --git a/app/Controller/PedigreeController.php b/app/Controller/PedigreeController.php index 0189c345bc..87bc4fc74f 100644 --- a/app/Controller/PedigreeController.php +++ b/app/Controller/PedigreeController.php @@ -41,11 +41,8 @@ class PedigreeController extends ChartController { * Create a pedigree controller */ public function __construct() { - global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS; - global $DEFAULT_PEDIGREE_GENERATIONS; - global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing; - - global $show_full, $talloffset; + global $WT_TREE; + global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing, $show_full, $talloffset; parent::__construct(); $this->linewidth = Theme::theme()->parameter('line-width'); @@ -54,10 +51,10 @@ class PedigreeController extends ChartController { $this->shadowoffsetX = Theme::theme()->parameter('shadow-offset-x'); $this->shadowoffsetY = Theme::theme()->parameter('shadow-offset-y'); - $this->show_full = Filter::getInteger('show_full', 0, 1, $PEDIGREE_FULL_DETAILS); - $this->talloffset = Filter::getInteger('talloffset', 0, 3, $PEDIGREE_LAYOUT); + $this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); + $this->talloffset = Filter::getInteger('talloffset', 0, 3, $WT_TREE->getPreference('PEDIGREE_LAYOUT')); $this->box_width = Filter::getInteger('box_width', 50, 300, 100); - $this->PEDIGREE_GENERATIONS = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); + $this->PEDIGREE_GENERATIONS = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); // With more than 8 generations, we run out of pixels on the <canvas> if ($this->PEDIGREE_GENERATIONS > 8) { diff --git a/app/Controller/SearchController.php b/app/Controller/SearchController.php index 1a02dac8a8..90a219c6d0 100644 --- a/app/Controller/SearchController.php +++ b/app/Controller/SearchController.php @@ -133,7 +133,7 @@ class SearchController extends PageController { $str = str_replace(array(".", "-", " "), array("_", "_", "_"), $search_tree->getName()); if (isset ($_REQUEST["$str"]) || $topsearch) { $this->search_trees[$search_tree->getTreeId()] = $search_tree; - $_REQUEST["$str"] = 'yes'; + $_REQUEST[$str] = 'yes'; } } } else { @@ -602,7 +602,7 @@ class SearchController extends PageController { foreach ($this->search_trees as $search_tree) { $datalist = array(); foreach ($this->myindilist as $individual) { - if ($individual->getTree->getTreeId() === $search_tree->getTreeId()) { + if ($individual->getTree()->getTreeId() === $search_tree->getTreeId()) { $datalist[] = $individual; } } diff --git a/app/Date.php b/app/Date.php index 89e30891e2..09495a3f20 100644 --- a/app/Date.php +++ b/app/Date.php @@ -209,7 +209,10 @@ class Date { * @return string */ function display($url = false, $date_format = null, $convert_calendars = true) { - global $TEXT_DIRECTION, $DATE_FORMAT, $CALENDAR_FORMAT; + global $TEXT_DIRECTION, $WT_TREE; + + $CALENDAR_FORMAT = $WT_TREE->getPreference('CALENDAR_FORMAT'); + $DATE_FORMAT = $WT_TREE->getPreference('DATE_FORMAT'); if ($date_format === null) { $date_format = $DATE_FORMAT; diff --git a/app/Place.php b/app/Place.php index a3c936f6f4..deb93e35a5 100644 --- a/app/Place.php +++ b/app/Place.php @@ -151,14 +151,16 @@ class Place { * @return string */ public function getShortName() { - global $SHOW_PEDIGREE_PLACES, $SHOW_PEDIGREE_PLACES_SUFFIX; + global $WT_TREE; + + $SHOW_PEDIGREE_PLACES = $WT_TREE->getPreference('SHOW_PEDIGREE_PLACES'); if ($SHOW_PEDIGREE_PLACES >= count($this->gedcom_place)) { // A short place name - no need to abbreviate return $this->getFullName(); } else { // Abbreviate the place name, for lists - if ($SHOW_PEDIGREE_PLACES_SUFFIX) { + if ($WT_TREE->getPreference('SHOW_PEDIGREE_PLACES_SUFFIX')) { // The *last* $SHOW_PEDIGREE_PLACES components $short_name = implode(self::GEDCOM_SEPARATOR, array_slice($this->gedcom_place, -$SHOW_PEDIGREE_PLACES)); } else { diff --git a/descendancy.php b/descendancy.php index b190bbaa9b..97ef7f2223 100644 --- a/descendancy.php +++ b/descendancy.php @@ -16,6 +16,12 @@ namespace Fisharebest\Webtrees; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/** + * Defined in session.php + * + * @global Tree $WT_TREE + */ + define('WT_SCRIPT_NAME', 'descendancy.php'); require './includes/session.php'; @@ -71,7 +77,7 @@ $controller <?php echo I18N::translate('Generations'); ?> </td> <td class="optionbox"> - <?php echo edit_field_integers('generations', $controller->generations, 2, $MAX_DESCENDANCY_GENERATIONS); ?> + <?php echo edit_field_integers('generations', $controller->generations, 2, $WT_TREE->getPreference('MAX_DESCENDANCY_GENERATIONS')); ?> </td> <td class="descriptionbox"> <?php echo I18N::translate('Show details'); ?> diff --git a/edit_interface.php b/edit_interface.php index d0393ba2d6..aef60240ca 100644 --- a/edit_interface.php +++ b/edit_interface.php @@ -545,7 +545,7 @@ case 'add_child_to_family_action': $gedrec = "0 @REF@ INDI"; $gedrec .= addNewName(); $gedrec .= addNewSex(); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedrec .= addNewFact($match); } @@ -637,7 +637,7 @@ case 'add_child_to_individual_action': $gedcom .= addNewName(); $gedcom .= addNewSex(); $gedcom .= "\n" . WT_Gedcom_Code_Pedi::createNewFamcPedi($PEDI, $family->getXref()); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedcom .= addNewFact($match); } @@ -716,7 +716,7 @@ case 'add_parent_to_individual_action': $gedcom = '0 @NEW@ INDI'; $gedcom .= addNewName(); $gedcom .= addNewSex(); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedcom .= addNewFact($match); } @@ -777,7 +777,7 @@ case 'add_unlinked_indi_action': $gedrec = "0 @REF@ INDI"; $gedrec .= addNewName(); $gedrec .= addNewSex(); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedrec .= addNewFact($match); } @@ -846,7 +846,7 @@ case 'add_spouse_to_individual_action': $indi_gedcom = '0 @REF@ INDI'; $indi_gedcom .= addNewName(); $indi_gedcom .= addNewSex(); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $indi_gedcom .= addNewFact($match); } @@ -858,7 +858,7 @@ case 'add_spouse_to_individual_action': } $fam_gedcom = ''; - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FAMFACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { foreach ($matches[1] as $match) { $fam_gedcom .= addNewFact($match); } @@ -936,7 +936,7 @@ case 'add_spouse_to_family_action': $gedrec = "0 @REF@ INDI"; $gedrec .= addNewName(); $gedrec .= addNewSex(); - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { $gedrec .= addNewFact($match); } @@ -957,7 +957,7 @@ case 'add_spouse_to_family_action': $family->createFact('1 HUSB @' . $spouse->getXref() . '@', true); } $famrec = ''; - if (preg_match_all('/([A-Z0-9_]+)/', $QUICK_REQUIRED_FAMFACTS, $matches)) { + if (preg_match_all('/([A-Z0-9_]+)/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { foreach ($matches[1] as $match) { $famrec .= addNewFact($match); } @@ -2307,7 +2307,7 @@ case 'reorder_fams_update': * @return string */ function keep_chan(GedcomRecord $record = null) { - global $NO_UPDATE_CHAN; + global $WT_TREE; if (Auth::isAdmin()) { if ($record) { @@ -2322,7 +2322,7 @@ function keep_chan(GedcomRecord $record = null) { '<tr><td class="descriptionbox wrap width25">' . WT_Gedcom_Tag::getLabel('CHAN') . '</td><td class="optionbox wrap">' . - '<input type="checkbox" name="keep_chan" value="1" ' . ($NO_UPDATE_CHAN ? 'checked' : '') . '>' . + '<input type="checkbox" name="keep_chan" value="1" ' . ($WT_TREE->getPreference('NO_UPDATE_CHAN') ? 'checked' : '') . '>' . I18N::translate('Do not update the “last change” record') . help_link('no_update_CHAN') . $details . @@ -2343,8 +2343,7 @@ function keep_chan(GedcomRecord $record = null) { * @param string $gender */ function print_indi_form($nextaction, Individual $person = null, Family $family = null, Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U') { - global $WT_TREE, $NPFX_accept, $bdm, $STANDARD_NAME_FACTS; - global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $controller; + global $WT_TREE, $NPFX_accept, $bdm, $STANDARD_NAME_FACTS, $controller; $SURNAME_TRADITION = $WT_TREE->getPreference('SURNAME_TRADITION'); @@ -2760,7 +2759,7 @@ function print_indi_form($nextaction, Individual $person = null, Family $family add_simple_tag("0 SEX"); } $bdm = "BD"; - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { addSimpleTags($match); @@ -2770,13 +2769,13 @@ function print_indi_form($nextaction, Individual $person = null, Family $family //-- if adding a spouse add the option to add a marriage fact to the new family if ($nextaction == 'add_spouse_to_individual_action' || $nextaction == 'add_spouse_to_family_action') { $bdm .= "M"; - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { foreach ($matches[1] as $match) { addSimpleTags($match); } } } - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', WT_EVENTS_DEAT))) { addSimpleTags($match); diff --git a/family.php b/family.php index e99474af4c..2440b41148 100644 --- a/family.php +++ b/family.php @@ -78,9 +78,6 @@ if ($controller->record && $controller->record->canShow()) { return; } -$PEDIGREE_FULL_DETAILS = '1'; // Override GEDCOM configuration -$show_full = '1'; - ?> <div id="family-page"> <h2><?php echo $controller->record->getFullName(); ?></h2> diff --git a/help_text.php b/help_text.php index af4ebb2daa..2de2ce6de8 100644 --- a/help_text.php +++ b/help_text.php @@ -60,7 +60,6 @@ case 'CAUS': case 'DATE': $title = WT_Gedcom_Tag::getLabel('DATE'); - $CALENDAR_FORMAT = null; // Don't perform conversions here - it will confuse the examples! $dates = array( '1900' =>new Date('1900'), 'JAN 1900' =>new Date('JAN 1900'), @@ -137,7 +136,7 @@ case 'DATE': ); foreach ($dates as &$date) { - $date = strip_tags($date->Display()); + $date = strip_tags($date->display(false, null, false)); } // These shortcuts work differently for different languages switch (preg_replace('/[^DMY]/', '', str_replace(array('J', 'F'), array('D', 'M'), strtoupper($DATE_FORMAT)))) { diff --git a/includes/functions/functions.php b/includes/functions/functions.php index 2292f425af..d9f60ce4b5 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -88,24 +88,6 @@ function file_upload_error_text($error_code) { * @param integer $ged_id */ function load_gedcom_settings($ged_id) { - $tree = Tree::get($ged_id); - global $CALENDAR_FORMAT; $CALENDAR_FORMAT = $tree->getPreference('CALENDAR_FORMAT'); - global $DEFAULT_PEDIGREE_GENERATIONS; $DEFAULT_PEDIGREE_GENERATIONS = $tree->getPreference('DEFAULT_PEDIGREE_GENERATIONS'); - global $EXPAND_RELATIVES_EVENTS; $EXPAND_RELATIVES_EVENTS = $tree->getPreference('EXPAND_RELATIVES_EVENTS'); - global $EXPAND_SOURCES; $EXPAND_SOURCES = $tree->getPreference('EXPAND_SOURCES'); - global $FULL_SOURCES; $FULL_SOURCES = $tree->getPreference('FULL_SOURCES'); - global $MAX_DESCENDANCY_GENERATIONS; $MAX_DESCENDANCY_GENERATIONS = $tree->getPreference('MAX_DESCENDANCY_GENERATIONS'); - global $MAX_PEDIGREE_GENERATIONS; $MAX_PEDIGREE_GENERATIONS = $tree->getPreference('MAX_PEDIGREE_GENERATIONS'); - global $NO_UPDATE_CHAN; $NO_UPDATE_CHAN = $tree->getPreference('NO_UPDATE_CHAN'); - global $PEDIGREE_FULL_DETAILS; $PEDIGREE_FULL_DETAILS = $tree->getPreference('PEDIGREE_FULL_DETAILS'); - global $PEDIGREE_LAYOUT; $PEDIGREE_LAYOUT = $tree->getPreference('PEDIGREE_LAYOUT'); - global $PEDIGREE_SHOW_GENDER; $PEDIGREE_SHOW_GENDER = $tree->getPreference('PEDIGREE_SHOW_GENDER'); - global $PREFER_LEVEL2_SOURCES; $PREFER_LEVEL2_SOURCES = $tree->getPreference('PREFER_LEVEL2_SOURCES'); - global $QUICK_REQUIRED_FACTS; $QUICK_REQUIRED_FACTS = $tree->getPreference('QUICK_REQUIRED_FACTS'); - global $QUICK_REQUIRED_FAMFACTS; $QUICK_REQUIRED_FAMFACTS = $tree->getPreference('QUICK_REQUIRED_FAMFACTS'); - global $SHOW_LAST_CHANGE; $SHOW_LAST_CHANGE = $tree->getPreference('SHOW_LAST_CHANGE'); - global $SHOW_PEDIGREE_PLACES; $SHOW_PEDIGREE_PLACES = $tree->getPreference('SHOW_PEDIGREE_PLACES'); - global $SHOW_PEDIGREE_PLACES_SUFFIX; $SHOW_PEDIGREE_PLACES_SUFFIX = $tree->getPreference('SHOW_PEDIGREE_PLACES_SUFFIX'); } /** diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php index 97fa209411..be6db7e0b3 100644 --- a/includes/functions/functions_db.php +++ b/includes/functions/functions_db.php @@ -195,7 +195,6 @@ function search_fams_custom($join, $where, $order) { */ function search_indis($query, $geds, $match) { global $GEDCOM; - // No query => no results if (!$query) { return array(); diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index e616fa212c..026f4b5a1d 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -428,12 +428,8 @@ function print_addnewsource_link($element_id) { * * @return string */ -function add_simple_tag( - $tag, $upperlevel = '', $label = '', $extra = null, - Individual $person = null -) { - global $tags, $emptyfacts, $main_fact, $FILE_FORM_accept, $xref, $bdm, $action; - global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES; +function add_simple_tag($tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) { + global $tags, $emptyfacts, $main_fact, $FILE_FORM_accept, $xref, $bdm, $action, $WT_TREE; // Keep track of SOUR fields, so we can reference them in subsequent PAGE fields. static $source_element_id; @@ -814,20 +810,25 @@ function add_simple_tag( //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR' if ($level == 1) { echo '<br>'; - if ($PREFER_LEVEL2_SOURCES === '0') { - $level1_checked = ''; + switch ($WT_TREE->getPreference('PREFER_LEVEL2_SOURCES')) { + case '2': // records + $level1_checked = 'checked'; $level2_checked = ''; - } else if ($PREFER_LEVEL2_SOURCES === '1' || $PREFER_LEVEL2_SOURCES === true) { + break; + case '1': // facts $level1_checked = ''; $level2_checked = 'checked'; - } else { - $level1_checked = 'checked'; + break; + case '0': // none + default: + $level1_checked = ''; $level2_checked = ''; + break; } if (strpos($bdm, 'B') !== false) { echo ' <input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="1">'; echo I18N::translate('Individual'); - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '" ', $level2_checked, ' value="1">'; @@ -837,7 +838,7 @@ function add_simple_tag( } } if (strpos($bdm, 'D') !== false) { - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; @@ -849,7 +850,7 @@ function add_simple_tag( if (strpos($bdm, 'M') !== false) { echo ' <input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="1">'; echo I18N::translate('Family'); - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) { + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { foreach ($matches[1] as $match) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); @@ -944,7 +945,7 @@ function add_simple_tag( * @param integer $level */ function print_add_layer($tag, $level = 2) { - global $FULL_SOURCES, $WT_TREE; + global $WT_TREE; switch ($tag) { case 'SOUR': @@ -960,7 +961,7 @@ function print_add_layer($tag, $level = 2) { // 3 DATA // 4 TEXT add_simple_tag(($level + 2) . ' TEXT'); - if ($FULL_SOURCES) { + if ($WT_TREE->getPreference('FULL_SOURCES')) { // 4 DATE add_simple_tag(($level + 2) . ' DATE', '', WT_Gedcom_Tag::getLabel('DATA:DATE')); // 3 QUAY @@ -1433,7 +1434,7 @@ function handle_updates($newged, $levelOverride = 'no') { * @param string $fact the new fact we are adding */ function create_add_form($fact) { - global $tags, $FULL_SOURCES, $emptyfacts; + global $tags, $emptyfacts; $tags = array(); @@ -1461,7 +1462,7 @@ function create_add_form($fact) { if ($fact == 'SOUR') { add_simple_tag('2 PAGE'); add_simple_tag('3 TEXT'); - if ($FULL_SOURCES) { + if ($WT_TREE->getPreference('FULL_SOURCES')) { add_simple_tag('3 DATE', '', WT_Gedcom_Tag::getLabel('DATA:DATE')); add_simple_tag('2 QUAY'); } @@ -1478,7 +1479,7 @@ function create_add_form($fact) { * @return string */ function create_edit_form(GedcomRecord $record, Fact $fact) { - global $WT_TREE, $date_and_time, $FULL_SOURCES, $tags; + global $WT_TREE, $date_and_time, $tags; $pid = $record->getXref(); @@ -1509,7 +1510,7 @@ function create_edit_form(GedcomRecord $record, Fact $fact) { 'PLAC'=>array('MAP'), 'MAP' =>array('LATI', 'LONG') ); - if ($FULL_SOURCES) { + if ($WT_TREE->getPreference('FULL_SOURCES')) { $expected_subtags['SOUR'][] = 'QUAY'; $expected_subtags['DATA'][] = 'DATE'; } diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php index 2b62263871..424da89640 100644 --- a/includes/functions/functions_print_facts.php +++ b/includes/functions/functions_print_facts.php @@ -484,7 +484,7 @@ function print_repository_record($xref) { * @return string HTML text */ function print_fact_sources($factrec, $level) { - global $EXPAND_SOURCES; + global $WT_TREE; $data = ''; $nlevel = $level + 1; @@ -514,7 +514,7 @@ function print_fact_sources($factrec, $level) { $data .= '<div class="fact_SOUR">'; $data .= '<span class="label">'; $elementID = Uuid::uuid4(); - if ($EXPAND_SOURCES) { + if ($WT_TREE->getPreference('EXPAND_SOURCES')) { $plusminus = 'icon-minus'; } else { $plusminus = 'icon-plus'; @@ -527,7 +527,7 @@ function print_fact_sources($factrec, $level) { $data .= '</span></div>'; $data .= "<div id=\"$elementID\""; - if ($EXPAND_SOURCES) { + if ($WT_TREE->getPreference('EXPAND_SOURCES')) { $data .= ' style="display:block"'; } $data .= ' class="source_citations">'; diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index 1976b308c6..7f44ee4fea 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -28,7 +28,7 @@ use Zend_Tag_Cloud; * @return string */ function format_indi_table($datalist, $option = '') { - global $GEDCOM, $SHOW_LAST_CHANGE, $SEARCH_SPIDER, $controller, $WT_TREE; + global $GEDCOM, $WT_TREE, $SEARCH_SPIDER, $controller, $WT_TREE; $table_id = 'table-indi-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page $SHOW_EST_LIST_DATES = $WT_TREE->getPreference('SHOW_EST_LIST_DATES'); @@ -66,7 +66,7 @@ function format_indi_table($datalist, $option = '') { /* 15 age */ { dataSort: 16, class: "center" }, /* 16 AGE */ { type: "num", visible: false }, /* 17 deat plac */ { type: "unicode" }, - /* 18 CHAN */ { dataSort: 19, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . ' }, + /* 18 CHAN */ { dataSort: 19, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' }, /* 19 CHAN_sort */ { visible: false }, /* 20 SEX */ { visible: false }, /* 21 BIRT */ { visible: false }, @@ -435,13 +435,13 @@ function format_indi_table($datalist, $option = '') { } $html .= '</td>'; //-- Last change - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $person->lastChangeTimestamp() . '</td>'; } else { $html .= '<td></td>'; } //-- Last change hidden sort column - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $person->lastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; @@ -517,7 +517,7 @@ function format_indi_table($datalist, $option = '') { * @return string */ function format_fam_table($datalist) { - global $GEDCOM, $SHOW_LAST_CHANGE, $SEARCH_SPIDER, $controller; + global $GEDCOM, $WT_TREE, $SEARCH_SPIDER, $controller; $table_id = 'table-fam-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page @@ -552,7 +552,7 @@ function format_fam_table($datalist) { /* 15 marr plac */ {type: "unicode"}, /* 16 children */ {dataSort: 17, class: "center"}, /* 17 NCHI */ {type: "num", visible: false}, - /* 18 CHAN */ {dataSort: 19, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . '}, + /* 18 CHAN */ {dataSort: 19, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . '}, /* 19 CHAN_sort */ {visible: false}, /* 20 MARR */ {visible: false}, /* 21 DEAT */ {visible: false}, @@ -744,8 +744,8 @@ function format_fam_table($datalist) { <th>' . WT_Gedcom_Tag::getLabel('PLAC') . '</th> <th><i class="icon-children" title="' . I18N::translate('Children') . '"></i></th> <th>NCHI</th> - <th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th> - <th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th> + <th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th> + <th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th> <th>MARR</th> <th>DEAT</th> <th>TREE</th> @@ -931,13 +931,13 @@ function format_fam_table($datalist) { $nchi = $family->getNumberOfChildren(); $html .= '<td>' . I18N::number($nchi) . '</td><td>' . $nchi . '</td>'; //-- Last change - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $family->LastChangeTimestamp() . '</td>'; } else { $html .= '<td></td>'; } //-- Last change hidden sort column - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $family->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; @@ -1030,7 +1030,7 @@ function format_fam_table($datalist) { * @return string */ function format_sour_table($datalist) { - global $SHOW_LAST_CHANGE, $controller; + global $WT_TREE, $controller; $html = ''; $table_id = 'table-sour-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page $controller @@ -1056,7 +1056,7 @@ function format_sour_table($datalist) { /* 8 #OBJE */ { type: "num", visible: false }, /* 9 #note */ { dataSort: 10, class: "center" }, /* 10 #NOTE */ { type: "num", visible: false }, - /* 11 CHAN */ { dataSort: 12, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . ' }, + /* 11 CHAN */ { dataSort: 12, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' }, /* 12 CHAN_sort */ { visible: false }, /* 13 DELETE */ { visible: ' . (WT_USER_GEDCOM_ADMIN ? 'true' : 'false') . ', sortable: false } ], @@ -1083,8 +1083,8 @@ function format_sour_table($datalist) { $html .= '<th>#OBJE</th>'; $html .= '<th>' . I18N::translate('Shared notes') . '</th>'; $html .= '<th>#NOTE</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th>'; $html .= '<th></th>'; //delete $html .= '</tr></thead>'; //-- table body @@ -1138,13 +1138,13 @@ function format_sour_table($datalist) { $num = count($source->linkedNotes('SOUR')); $html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>'; //-- Last change - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $source->LastChangeTimestamp() . '</td>'; } else { $html .= '<td></td>'; } //-- Last change hidden sort column - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $source->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; @@ -1170,7 +1170,8 @@ function format_sour_table($datalist) { * @return string */ function format_note_table($datalist) { - global $SHOW_LAST_CHANGE, $controller; + global $WT_TREE, $controller; + $html = ''; $table_id = 'table-note-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page $controller @@ -1194,7 +1195,7 @@ function format_note_table($datalist) { /* 6 #OBJE */ { type: "num", visible: false }, /* 7 #sour */ { dataSort: 8, class: "center" }, /* 8 #SOUR */ { type: "num", visible: false }, - /* 9 CHAN */ { dataSort: 10, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . ' }, + /* 9 CHAN */ { dataSort: 10, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' }, /* 10 CHAN_sort */ { visible: false }, /* 11 DELETE */ { visible: ' . (WT_USER_GEDCOM_ADMIN ? 'true' : 'false') . ', sortable: false } ], @@ -1219,8 +1220,8 @@ function format_note_table($datalist) { $html .= '<th>#OBJE</th>'; $html .= '<th>' . I18N::translate('Sources') . '</th>'; $html .= '<th>#SOUR</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th>'; $html .= '<th></th>'; //delete $html .= '</tr></thead>'; //-- table body @@ -1252,13 +1253,13 @@ function format_note_table($datalist) { $num = count($note->linkedSources('NOTE')); $html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>'; //-- Last change - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $note->LastChangeTimestamp() . '</td>'; } else { $html .= '<td></td>'; } //-- Last change hidden sort column - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $note->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; @@ -1284,7 +1285,7 @@ function format_note_table($datalist) { * @return string */ function format_repo_table($repositories) { - global $SHOW_LAST_CHANGE, $controller; + global $WT_TREE, $controller; $html = ''; $table_id = 'table-repo-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page @@ -1303,7 +1304,7 @@ function format_repo_table($repositories) { /* 0 name */ { type: "unicode" }, /* 1 #sour */ { dataSort: 2, class: "center" }, /* 2 #SOUR */ { type: "num", visible: false }, - /* 3 CHAN */ { dataSort: 4, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . ' }, + /* 3 CHAN */ { dataSort: 4, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' }, /* 4 CHAN_sort */ { visible: false }, /* 5 DELETE */ { visible: ' . (WT_USER_GEDCOM_ADMIN ? 'true' : 'false') . ', sortable: false } ], @@ -1322,8 +1323,8 @@ function format_repo_table($repositories) { $html .= '<th>' . I18N::translate('Repository name') . '</th>'; $html .= '<th>' . I18N::translate('Sources') . '</th>'; $html .= '<th>#SOUR</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th>'; $html .= '<th></th>'; //delete $html .= '</tr></thead>'; //-- table body @@ -1358,13 +1359,13 @@ function format_repo_table($repositories) { $num = count($repository->linkedSources('REPO')); $html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>'; //-- Last change - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $repository->LastChangeTimestamp() . '</td>'; } else { $html .= '<td></td>'; } //-- Last change hidden sort column - if ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $repository->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; @@ -1390,7 +1391,7 @@ function format_repo_table($repositories) { * @return string */ function format_media_table($media_objects) { - global $SHOW_LAST_CHANGE, $controller; + global $WT_TREE, $controller; $html = ''; $table_id = 'table-obje-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page @@ -1414,7 +1415,7 @@ function format_media_table($media_objects) { /* 5 #FAM */ { type: "num", visible: false }, /* 6 #sour */ { dataSort: 7, class: "center" }, /* 7 #SOUR */ { type: "num", visible: false }, - /* 8 CHAN */ { dataSort: 9, visible: ' . ($SHOW_LAST_CHANGE ? 'true' : 'false') . ' }, + /* 8 CHAN */ { dataSort: 9, visible: ' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? 'true' : 'false') . ' }, /* 9 CHAN_sort */ { visible: false }, ], displayLength: 20, @@ -1437,8 +1438,8 @@ function format_media_table($media_objects) { $html .= '<th>#FAM</th>'; $html .= '<th>' . I18N::translate('Sources') . '</th>'; $html .= '<th>#SOUR</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; - $html .= '<th' . ($SHOW_LAST_CHANGE ? '' : '') . '>CHAN</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>' . WT_Gedcom_Tag::getLabel('CHAN') . '</th>'; + $html .= '<th' . ($WT_TREE->getPreference('SHOW_LAST_CHANGE') ? '' : '') . '>CHAN</th>'; $html .= '</tr></thead>'; //-- table body $html .= '<tbody>'; @@ -1475,13 +1476,13 @@ function format_media_table($media_objects) { $num = count($media_object->linkedSources('OBJE')); $html .= '<td>' . I18N::number($num) . '</td><td>' . $num . '</td>'; //-- Last change - if ($SHOW_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 ($SHOW_LAST_CHANGE) { + if ($WT_TREE->getPreference('SHOW_LAST_CHANGE')) { $html .= '<td>' . $media_object->LastChangeTimestamp(true) . '</td>'; } else { $html .= '<td></td>'; diff --git a/modules_v3/charts/module.php b/modules_v3/charts/module.php index 6231098397..e71ad806e8 100644 --- a/modules_v3/charts/module.php +++ b/modules_v3/charts/module.php @@ -32,7 +32,7 @@ class charts_WT_Module extends Module implements ModuleBlockInterface { /** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = null) { - global $WT_TREE, $ctype, $PEDIGREE_FULL_DETAILS, $show_full, $controller; + global $WT_TREE, $ctype, $show_full, $controller; $PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID'); @@ -48,11 +48,6 @@ class charts_WT_Module extends Module implements ModuleBlockInterface { } } - // Override GEDCOM configuration temporarily - if (isset($show_full)) { - $saveShowFull = $show_full; - } - $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; if (!$details) { $show_full = 0; // Here we could adjust the block width & height to accommodate larger displays @@ -60,7 +55,6 @@ class charts_WT_Module extends Module implements ModuleBlockInterface { $show_full = 1; // Here we could adjust the block width & height to accommodate larger displays } - $PEDIGREE_FULL_DETAILS = $show_full; $person = Individual::getInstance($pid); if (!$person) { @@ -139,13 +133,6 @@ class charts_WT_Module extends Module implements ModuleBlockInterface { $content = I18N::translate('You must select an individual and chart type in the block configuration settings.'); } - // Restore GEDCOM configuration - unset($show_full); - if (isset($saveShowFull)) { - $show_full = $saveShowFull; - } - $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; - if ($template) { return Theme::theme()->formatBlock($id, $title, $class, $content); } else { diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php index 5f9a32e3f0..e175472fa5 100644 --- a/modules_v3/clippings/module.php +++ b/modules_v3/clippings/module.php @@ -48,7 +48,9 @@ class clippings_WT_Module extends Module implements ModuleMenuInterface, ModuleS echo $html; break; case 'index': - global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $WT_TREE; + global $controller, $WT_SESSION, $WT_TREE; + + $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); $clip_ctrl = new ClippingsCart; @@ -471,7 +473,7 @@ class clippings_WT_Module extends Module implements ModuleMenuInterface, ModuleS * @return string */ public function askAddOptions(Individual $person) { - global $MAX_PEDIGREE_GENERATIONS; + $MAX_PEDIGREE_GENERATIONS = $person->getTree()->getPreference('MAX_PEDIGREE_GENERATIONS'); $out = '<h3><a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a></h3>'; $out .= '<script>'; diff --git a/modules_v3/gedcom_favorites/module.php b/modules_v3/gedcom_favorites/module.php index 25e89f0372..96ed0ab289 100644 --- a/modules_v3/gedcom_favorites/module.php +++ b/modules_v3/gedcom_favorites/module.php @@ -39,7 +39,7 @@ class gedcom_favorites_WT_Module extends Module implements ModuleBlockInterface /** {@inheritdoc} */ public function getBlock($block_id, $template = true, $cfg = null) { - global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller; + global $ctype, $controller; self::updateSchema(); // make sure the favorites table has been created @@ -94,14 +94,6 @@ class gedcom_favorites_WT_Module extends Module implements ModuleBlockInterface } } - // Override GEDCOM configuration temporarily - if (isset($show_full)) { - $saveShowFull = $show_full; - } - $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; - $show_full = 1; - $PEDIGREE_FULL_DETAILS = 1; - $userfavs = $this->getFavorites($ctype === 'user' ? Auth::id() : WT_GED_ID); if (!is_array($userfavs)) { $userfavs = array(); @@ -199,13 +191,6 @@ class gedcom_favorites_WT_Module extends Module implements ModuleBlockInterface $content .= '</form></div>'; } - // Restore GEDCOM configuration - unset($show_full); - if (isset($saveShowFull)) { - $show_full = $saveShowFull; - } - $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; - if ($template) { if ($block) { $class .= ' small_inner_block'; diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php index 0b7705b3a5..e29491a1c7 100644 --- a/modules_v3/googlemap/module.php +++ b/modules_v3/googlemap/module.php @@ -722,7 +722,9 @@ class googlemap_WT_Module extends Module implements ModuleConfigInterface, Modul * ... */ private function pedigreeMap() { - global $controller, $MAX_PEDIGREE_GENERATIONS; + global $controller, $WT_TREE; + + $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); // Default is show for both of these. $hideflags = Filter::getBool('hideflags'); diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php index c9431f5f2d..fa2587739b 100644 --- a/modules_v3/personal_facts/module.php +++ b/modules_v3/personal_facts/module.php @@ -42,7 +42,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { /** {@inheritdoc} */ public function getTabContent() { - global $EXPAND_RELATIVES_EVENTS, $controller; + global $controller; $EXPAND_HISTO_EVENTS = false; $indifacts = array(); @@ -116,7 +116,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { } echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" '; - echo $EXPAND_RELATIVES_EVENTS ? 'checked' : ''; + echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : ''; echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>'; if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) { echo ' <input id="checkbox_histo" type="checkbox" '; @@ -136,7 +136,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { echo '</tbody>'; echo '</table>'; - if (!$EXPAND_RELATIVES_EVENTS) { + if (!$controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS')) { echo '<script>jQuery("tr.rela").toggle();</script>'; } if (!$EXPAND_HISTO_EVENTS) { |
