diff options
Diffstat (limited to 'modules_v3')
29 files changed, 233 insertions, 307 deletions
diff --git a/modules_v3/GEDFact_assistant/CENS_ctrl.php b/modules_v3/GEDFact_assistant/CENS_ctrl.php index 0e0b7a63af..cf5fb08ca8 100644 --- a/modules_v3/GEDFact_assistant/CENS_ctrl.php +++ b/modules_v3/GEDFact_assistant/CENS_ctrl.php @@ -25,25 +25,22 @@ // // $Id$ -$controller = new WT_Controller_Individual(); -$controller->init(); +$controller=new WT_Controller_Individual(); global $tabno, $linkToID, $SEARCH_SPIDER, $GOOGLEMAP_PH_CONTROLS; global $WT_IMAGES, $SHOW_AGE_DIFF, $GEDCOM, $ABBREVIATE_CHART_LABELS; global $show_full, $famid; echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'GEDFact_assistant/css/cens_style.css" rel="stylesheet" />'; -$summary=$controller->indi->format_first_major_fact(WT_EVENTS_BIRT, 2); -if (!($controller->indi->isDead())) { +$summary=$controller->record->format_first_major_fact(WT_EVENTS_BIRT, 2); +if (!($controller->record->isDead())) { // If alive display age - $bdate=$controller->indi->getBirthDate(); + $bdate=$controller->record->getBirthDate(); $age = WT_Date::GetAgeGedcom($bdate); if ($age!="") { $summary.= "<span class=\"label\">".WT_I18N::translate('Age').":</span><span class=\"field\"> ".get_age_at_event($age, true)."</span>"; } } -$summary.=$controller->indi->format_first_major_fact(WT_EVENTS_DEAT, 2); +$summary.=$controller->record->format_first_major_fact(WT_EVENTS_DEAT, 2); $controller->census_assistant(); - -// print_footer(); diff --git a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php index c2bc5e19ce..02ef06d7da 100644 --- a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php +++ b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php @@ -25,8 +25,8 @@ // // $Id$ -$controller = new WT_Controller_Individual(); -$controller->init(); +$controller=new WT_Controller_Individual(); + echo '<link href="'.WT_STATIC_URL.WT_MODULES_DIR.'GEDFact_assistant/css/gf_styles.css" rel="stylesheet" type="text/css" media="screen" />'; global $tabno, $linkToID, $SEARCH_SPIDER, $GOOGLEMAP_PH_CONTROLS; @@ -37,17 +37,15 @@ global $famid, $censyear, $censdate; // print_simple_header("Census"); -$summary=$controller->indi->format_first_major_fact(WT_EVENTS_BIRT, 2); -if (!($controller->indi->isDead())) { +$summary=$controller->record->format_first_major_fact(WT_EVENTS_BIRT, 2); +if (!($controller->record->isDead())) { // If alive display age - $bdate=$controller->indi->getBirthDate(); + $bdate=$controller->record->getBirthDate(); $age = WT_Date::GetAgeGedcom($bdate); //if ($age!="") { //$summary.= "<span class=\"label\">".WT_I18N::translate('Age').":</span><span class=\"field\"> ".get_age_at_event($age, true)."</span>"; //} } -$summary.=$controller->indi->format_first_major_fact(WT_EVENTS_DEAT, 2); +$summary.=$controller->record->format_first_major_fact(WT_EVENTS_DEAT, 2); $controller->medialink_assistant(); - -// print_footer(); diff --git a/modules_v3/ahnentafel_report/module.php b/modules_v3/ahnentafel_report/module.php index 53db375ff6..4c3340bb86 100644 --- a/modules_v3/ahnentafel_report/module.php +++ b/modules_v3/ahnentafel_report/module.php @@ -50,12 +50,12 @@ class ahnentafel_report_WT_Module extends WT_Module implements WT_Module_Report public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/charts/module.php b/modules_v3/charts/module.php index cd99588454..11346b6977 100644 --- a/modules_v3/charts/module.php +++ b/modules_v3/charts/module.php @@ -68,8 +68,7 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block { $PEDIGREE_FULL_DETAILS = $show_full; if ($type!='treenav') { - $controller = new WT_Controller_Hourglass(); - $controller->init($pid,0,3); + $controller=new WT_Controller_Hourglass($pid,0,3); $controller->setupJavascript(); } diff --git a/modules_v3/clippings/clippings_ctrl.php b/modules_v3/clippings/clippings_ctrl.php index c4f2e8c42f..f03612e029 100644 --- a/modules_v3/clippings/clippings_ctrl.php +++ b/modules_v3/clippings/clippings_ctrl.php @@ -49,7 +49,7 @@ function same_group($a, $b) { /** * Main controller class for the Clippings page. */ -class WT_Controller_Clippings extends WT_Controller_Base { +class WT_Controller_Clippings { var $download_data; var $media_list = array(); @@ -66,14 +66,8 @@ class WT_Controller_Clippings extends WT_Controller_Base { var $level2; var $level3; // number of levels of descendents - /** - * @param string $thing the id of the person - */ - function __construct() { + public function __construct() { parent::__construct(); - } - //----------------beginning of function definitions for WT_Controller_Clippings - function init() { global $SCRIPT_NAME, $MEDIA_DIRECTORY, $MEDIA_FIREWALL_ROOTDIR, $GEDCOM, $cart; if (!isset($_SESSION['exportConvPath'])) $_SESSION['exportConvPath'] = $MEDIA_DIRECTORY; @@ -299,6 +293,11 @@ class WT_Controller_Clippings extends WT_Controller_Base { } return false; } + // + // What should this page show in the browser's title bar? + public function getPageTitle() { + return WT_I18N::translate('Clippings cart'); + } /** * Loads everything in the clippings cart into a zip file. diff --git a/modules_v3/clippings/index.php b/modules_v3/clippings/index.php index a7708fc009..d453b80ac3 100644 --- a/modules_v3/clippings/index.php +++ b/modules_v3/clippings/index.php @@ -25,15 +25,17 @@ // // $Id$ +if (!defined('WT_WEBTREES')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} + global $ENABLE_AUTOCOMPLETE, $cart, $MAX_PEDIGREE_GENERATIONS, $TEXT_DIRECTION, $GEDCOM, $WT_IMAGES; require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php'; -$controller = new WT_Controller_Clippings(); -$controller->init(); - -// -- print html header information -print_header(WT_I18N::translate('Clippings cart')); +$controller=new WT_Controller_Clippings(); +$controller->pageHeader(); if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm'; @@ -307,5 +309,3 @@ if ($ct==0) { </td></tr></table> <?php } -if (isset($_SESSION["cart"])) $_SESSION["cart"]=$cart; -print_footer(); diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php index 687e565705..19b457bfaf 100644 --- a/modules_v3/clippings/module.php +++ b/modules_v3/clippings/module.php @@ -77,34 +77,8 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module $submenu->addIcon('clippings'); $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_clippings'); $menu->addSubmenu($submenu); - if (isset($controller->indi) && $controller->indi->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->pid}&type=indi", 'menu-clippingsadd'); - $submenu->addIcon('clippings'); - $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); - - $menu->addSubmenu($submenu); - } elseif (isset($controller->family) && $controller->family->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->famid}&type=fam", 'menu-clippingsadd'); - $submenu->addIcon('clippings'); - $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); - $menu->addSubmenu($submenu); - } elseif (isset($controller->mediaobject) && $controller->mediaobject->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->mid}&type=obje", 'menu-clippingsadd'); - $submenu->addIcon('clippings'); - $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); - $menu->addSubmenu($submenu); - } elseif (isset($controller->source) && $controller->source->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->sid}&type=sour", 'menu-clippingsadd'); - $submenu->addIcon('clippings'); - $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); - $menu->addSubmenu($submenu); - } elseif (isset($controller->note) && $controller->note->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->nid}&type=note", 'menu-clippingsadd'); - $submenu->addIcon('clippings'); - $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); - $menu->addSubmenu($submenu); - } elseif (isset($controller->repository) && $controller->repository->canDisplayDetails()) { - $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), "module.php?mod=clippings&mod_action=index&action=add&id={$controller->rid}&type=repo", 'menu-clippingsadd'); + if (!empty($controller->record) && $controller->record->canDisplayDetails()) { + $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&mod_action=index&action=add&id='.$controller->record->getXref(), 'menu-clippingsadd'); $submenu->addIcon('clippings'); $submenu->addClass('submenuitem', 'submenuitem_hover', 'submenu', 'icon_small_add_clip'); $menu->addSubmenu($submenu); @@ -125,11 +99,12 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module // Impelement WT_Module_Sidebar public function getSidebarContent() { require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php'; - global $WT_IMAGES, $cart; + + global $WT_IMAGES, $cart, $controller; $out = ''; - if ($this->controller) { + if ($controller) { $out .= '<script type="text/javascript"> <!-- jQuery(document).ready(function() { @@ -142,12 +117,8 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module </script> <div id="sb_clippings_content">'; $out .= $this->getCartList(); - $root = null; - if ($this->controller->pid && !WT_Controller_Clippings::id_in_cart($this->controller->pid)) { - $root = WT_GedcomRecord::getInstance($this->controller->pid); - if ($root && $root->canDisplayDetails()) - $out .= '<a href="sidebar.php?sb_action=clippings&add='.$root->getXref().'" class="add_cart"> - <img src="'.$WT_IMAGES['clippings'].'" width="20" /> '.WT_I18N::translate('Add %s to cart', $root->getFullName()).'</a>'; + if (!WT_Controller_Clippings::id_in_cart($controller->record->getXref())) { + $out .= '<a href="sidebar.php?sb_action=clippings&add='.$controller->record->getXref().'" class="add_cart"><img src="'.$WT_IMAGES['clippings'].'" width="20" /> '.WT_I18N::translate('Add %s to cart', $controller->record->getFullName()).'</a>'; } $out .= '</div>'; } @@ -157,9 +128,10 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module // Impelement WT_Module_Sidebar public function getSidebarAjaxContent() { require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php'; - global $cart; + + global $cart, $controller; + $controller = new WT_Controller_Clippings(); - $this->controller = $controller; $add = safe_GET_xref('add',''); $add1 = safe_GET_xref('add1',''); $remove = safe_GET('remove', WT_REGEX_INTEGER, -1); @@ -341,8 +313,9 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module } public function downloadForm() { - global $TEXT_DIRECTION; - $controller = $this->controller; + global $TEXT_DIRECTION, $controller; + + $controller = $controller; $out = WT_JS_START; $out .= 'function cancelDownload() { var link = "sidebar.php?sb_action=clippings"; diff --git a/modules_v3/descendancy/module.php b/modules_v3/descendancy/module.php index 0dd35ae74a..1149577afa 100644 --- a/modules_v3/descendancy/module.php +++ b/modules_v3/descendancy/module.php @@ -65,7 +65,7 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar { // Implement WT_Module_Sidebar public function getSidebarContent() { - global $WT_IMAGES; + global $WT_IMAGES, $controller; $out = '<script type="text/javascript"> <!-- @@ -112,25 +112,9 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar { </script> <form method="post" action="sidebar.php" onsubmit="return false;"> <input type="text" name="sb_desc_name" id="sb_desc_name" value="'.WT_I18N::translate('Search').'" />'; - $out .= '</form><div id="sb_desc_content">'; - - if ($this->controller) { - $root = null; - if ($this->controller->pid) { - $root = WT_Person::getInstance($this->controller->pid); - } elseif ($this->controller->famid) { - $fam = WT_Family::getInstance($this->controller->famid); - if ($fam) { - $root = $fam->getHusband(); - } - if (!$root) { - $root = $fam->getWife(); - } - } - if ($root) { - $out .= '<ul>'.$this->getPersonLi($root, 1).'</ul>'; - } - } + $out .= '</form>'; + $out .= '<div id="sb_desc_content">'; + $out .= '<ul>'.$this->getPersonLi($controller->record, 1).'</ul>'; $out .= '</div>'; return $out; } diff --git a/modules_v3/descendancy_report/module.php b/modules_v3/descendancy_report/module.php index 77488531d8..0d765ef81a 100644 --- a/modules_v3/descendancy_report/module.php +++ b/modules_v3/descendancy_report/module.php @@ -50,12 +50,12 @@ class descendancy_report_WT_Module extends WT_Module implements WT_Module_Report public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/extra_info/module.php b/modules_v3/extra_info/module.php index 4a7897b4c9..b47f41b248 100644 --- a/modules_v3/extra_info/module.php +++ b/modules_v3/extra_info/module.php @@ -50,31 +50,17 @@ class extra_info_WT_Module extends WT_Module implements WT_Module_Sidebar { // Implement WT_Module_Sidebar
public function getSidebarContent() {
- global $WT_IMAGES, $FACT_COUNT, $SHOW_COUNTER;
+ global $WT_IMAGES, $FACT_COUNT, $SHOW_COUNTER, $controller;
- //$reftags = array ('CHAN', 'IDNO', 'RFN', 'AFN', 'REFN', 'RIN', '_UID');// list of tags that can be displayed in this sidebar block
-
- $root = WT_Person::getInstance($this->controller->pid);
- if ($root!=null) {
- $this->controller = new WT_Controller_Individual();
- $this->controller->indi=$root;
- $this->controller->pid=$root->getXref();
- $this->setController($this->controller);
+ $indifacts = $controller->getIndiFacts();
+ if (count($indifacts)==0) {
+ echo WT_I18N::translate('There are no Facts for this individual.');
}
-
- if (!$this->controller->indi->canDisplayDetails()) {
- print_privacy_error();
- } else {
- $indifacts = $this->controller->getIndiFacts();
- if (count($indifacts)==0) {
- echo WT_I18N::translate('There are no Facts for this individual.');
- }
- foreach ($indifacts as $fact) {
- if (in_array($fact->getTag(), WT_Gedcom_Tag::getReferenceFacts())) {
- print_fact($fact, $this->controller->indi);
- }
- $FACT_COUNT++;
+ foreach ($indifacts as $fact) {
+ if (in_array($fact->getTag(), WT_Gedcom_Tag::getReferenceFacts())) {
+ print_fact($fact, $controller->record);
}
+ $FACT_COUNT++;
}
echo '<tr><td><div id="hitcounter">';
diff --git a/modules_v3/family_group_report/module.php b/modules_v3/family_group_report/module.php index 0e7ef0fdbf..2983201c8b 100644 --- a/modules_v3/family_group_report/module.php +++ b/modules_v3/family_group_report/module.php @@ -50,12 +50,12 @@ class family_group_report_WT_Module extends WT_Module implements WT_Module_Repor public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/family_nav/module.php b/modules_v3/family_nav/module.php index be95e41a5a..8f872c9ce7 100644 --- a/modules_v3/family_nav/module.php +++ b/modules_v3/family_nav/module.php @@ -53,30 +53,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { // Implement WT_Module_Sidebar public function getSidebarContent() { - global $WT_IMAGES; - - $out = '<div id="sb_family_nav_content">'; - - if ($this->controller) { - $root = null; - if ($this->controller->pid) { - $root = WT_Person::getInstance($this->controller->pid); - } - else if ($this->controller->famid) { - $fam = WT_Family::getInstance($this->controller->famid); - if ($fam) $root = $fam->getHusband(); - if (!$root) $root = $fam->getWife(); - } - if ($root!=null) { - $this->controller = new WT_Controller_Individual(); - $this->controller->indi=$root; - $this->controller->pid=$root->getXref(); - $this->setController($this->controller); - $out .= $this->getTabContent(); - } - } - $out .= '</div>'; - return $out; + return '<div id="sb_family_nav_content">'.$this->getTabContent().'</div>'; } // Implement WT_Module_Sidebar @@ -87,6 +64,8 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { // TODO: This function isn't part of the WT_Module_Tab interface, as // this module no longer provides a tab. public function getTabContent() { + global $controller; + $out = ''; ob_start(); // ----------------------------------------------------------------------------- @@ -115,12 +94,12 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { global $WT_IMAGES, $spouselinks, $parentlinks, $TEXT_DIRECTION; $personcount=0; - $families = $this->controller->indi->getChildFamilies(); + $families = $controller->record->getChildFamilies(); //-- parent families ------------------------------------------------------------- foreach ($families as $famid=>$family) { - $label = $this->controller->indi->getChildFamilyLabel($family); - $people = $this->controller->buildFamilyList($family, "parents"); + $label = $controller->record->getChildFamilyLabel($family); + $people = $controller->buildFamilyList($family, "parents"); $styleadd = ""; ?> <tr> @@ -145,7 +124,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["husb"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["husb"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["husb"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['husb']->getHtmlUrl()."');\">"; echo $people["husb"]->getFullName(); @@ -169,7 +148,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["wife"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["wife"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["wife"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['wife']->getHtmlUrl()."');\">"; echo $people["wife"]->getFullName(); @@ -203,7 +182,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { } ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($child); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($child); ?> nam"> <?php if ($pid == $child->getXref()) { echo "<a class=\"famnav_link\" href=\"#\">"; @@ -226,9 +205,9 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { } //-- step parents ---------------------------------------------------------------- - foreach ($this->controller->indi->getChildStepFamilies() as $famid=>$family) { - $label = $this->controller->indi->getStepFamilyLabel($family); - $people = $this->controller->buildFamilyList($family, "step-parents"); + foreach ($controller->record->getChildStepFamilies() as $famid=>$family) { + $label = $controller->record->getStepFamilyLabel($family); + $people = $controller->buildFamilyList($family, "step-parents"); if ($people) { echo "<tr><td><br /></td><td></td></tr>"; } @@ -264,7 +243,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["husb"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["husb"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["husb"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['husb']->getHtmlUrl()."');\">"; echo $people["husb"]->getFullName(); @@ -297,7 +276,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["wife"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["wife"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["wife"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['wife']->getHtmlUrl()."');\">"; echo $people["wife"]->getFullName(); @@ -323,7 +302,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($child); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($child); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$child->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$child->getHtmlUrl()."');\">"; echo $child->getFullName(); @@ -339,7 +318,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { } //-- spouse and children -------------------------------------------------- - $families = $this->controller->indi->getSpouseFamilies(); + $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { echo "<tr><td><br /></td><td></td></tr>"; ?> @@ -354,8 +333,8 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { </tr> <?php //$personcount = 0; - $people = $this->controller->buildFamilyList($family, "spouse"); - if (isset($people["husb"]) && $this->controller->indi->equals($people["husb"])) { + $people = $controller->buildFamilyList($family, "spouse"); + if (isset($people["husb"]) && $controller->record->equals($people["husb"])) { $spousetag = 'WIFE'; } else { $spousetag = 'HUSB'; @@ -373,7 +352,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["husb"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["husb"]); ?> nam"> <?php if ($pid == $people["husb"]->getXref()) { echo "<a class=\"famnav_link\" href=\"#\">"; @@ -404,7 +383,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["wife"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["wife"]); ?> nam"> <?php if ($pid == $people["wife"]->getXref()) { echo "<a class=\"famnav_link\" href=\"#\">"; @@ -437,7 +416,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($child); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($child); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$child->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$child->getHtmlUrl()."');\">"; echo $child->getFullName(); @@ -452,9 +431,9 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { } //-- step children ---------------------------------------------------------------- - foreach ($this->controller->indi->getSpouseStepFamilies() as $famid=>$family) { + foreach ($controller->record->getSpouseStepFamilies() as $famid=>$family) { $label = $family->getFullName(); - $people = $this->controller->buildFamilyList($family, "step-children"); + $people = $controller->buildFamilyList($family, "step-children"); if ($people) { echo "<tr><td><br /></td><td></td></tr>"; } @@ -485,7 +464,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["husb"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["husb"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["husb"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['husb']->getHtmlUrl()."');\">"; echo $people["husb"]->getFullName(); @@ -512,7 +491,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($people["wife"]); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($people["wife"]); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$people["wife"]->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$people['wife']->getHtmlUrl()."');\">"; echo $people["wife"]->getFullName(); @@ -538,7 +517,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar { <td class="facts_label<?php echo $styleadd; ?>" nowrap="nowrap" style="width:75px;"> <?php echo $menu->getMenu(); ?> </td> - <td align="center" class="<?php echo $this->controller->getPersonStyle($child); ?> nam"> + <td align="center" class="<?php echo $controller->getPersonStyle($child); ?> nam"> <?php echo "<a class=\"famnav_link\" href=\"".$child->getHtmlUrl()."\" onclick=\"return familyNavLoad('".$child->getHtmlUrl()."');\">"; echo $child->getFullName(); diff --git a/modules_v3/googlemap/googlemap.php b/modules_v3/googlemap/googlemap.php index ead447ea01..049dfabc8e 100644 --- a/modules_v3/googlemap/googlemap.php +++ b/modules_v3/googlemap/googlemap.php @@ -558,7 +558,7 @@ function build_indiv_map($indifacts, $famids) { $gmarks = $markers; global $controller; - $pid=$controller->indi->getXref(); + $pid=$controller->record->getXref(); // === Include css and js files ============================================================ echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet" />'; diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php index 380d4d250a..ceb1b98329 100644 --- a/modules_v3/googlemap/module.php +++ b/modules_v3/googlemap/module.php @@ -98,7 +98,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu // Implement WT_Module_Tab public function getTabContent() { - global $SEARCH_SPIDER, $WT_IMAGES; + global $SEARCH_SPIDER, $WT_IMAGES, $controller; global $GOOGLEMAP_MAP_TYPE, $GOOGLEMAP_MIN_ZOOM, $GOOGLEMAP_MAX_ZOOM, $GEDCOM; global $GOOGLEMAP_XSIZE, $GOOGLEMAP_YSIZE, $SHOW_LIVING_NAMES; global $TEXT_DIRECTION, $GM_DEFAULT_TOP_VALUE, $GOOGLEMAP_COORD, $GOOGLEMAP_PH_CONTROLS; @@ -109,7 +109,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; echo '<table border="0" width="100%"><tr><td>'; - if (!$this->controller->indi->canDisplayName()) { + if (!$controller->record->canDisplayName()) { echo '<table class="facts_table">'; echo '<tr><td class="facts_value">'; print_privacy_error(); @@ -140,13 +140,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu echo '<td valign="top" width="30%">'; echo '<div id="map_content">'; $famids = array(); - $families = $this->controller->indi->getSpouseFamilies(); + $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { $famids[] = $family->getXref(); } - $this->controller->indi->add_family_facts(false); -// create_indiv_buttons(); - build_indiv_map($this->controller->indi->getIndiFacts(), $famids); + $controller->record->add_family_facts(false); + build_indiv_map($controller->record->getIndiFacts(), $famids); echo '</div>'; echo '</td>'; echo '</tr></table>'; diff --git a/modules_v3/googlemap/pedigree_map.php b/modules_v3/googlemap/pedigree_map.php index ab241fa972..2a36491e43 100644 --- a/modules_v3/googlemap/pedigree_map.php +++ b/modules_v3/googlemap/pedigree_map.php @@ -41,8 +41,7 @@ global $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $ $hideflags = safe_GET('hideflags'); $hidelines = safe_GET('hidelines'); -$controller = new WT_Controller_Pedigree(); -$controller->init(); +$controller=new WT_Controller_Pedigree(); // Default of 5 $clustersize = 5; @@ -283,5 +282,3 @@ echo "</div>"; <?php echo '<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>'; require_once WT_ROOT.WT_MODULES_DIR.'googlemap/wt_v3_pedigree_map.js.php'; - -print_footer(); diff --git a/modules_v3/individual_ext_report/module.php b/modules_v3/individual_ext_report/module.php index cbdba2a3bc..5af44efaf4 100644 --- a/modules_v3/individual_ext_report/module.php +++ b/modules_v3/individual_ext_report/module.php @@ -50,12 +50,12 @@ class individual_ext_report_WT_Module extends WT_Module implements WT_Module_Rep public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/individual_report/module.php b/modules_v3/individual_report/module.php index 59ac327bc1..3e05d2e993 100644 --- a/modules_v3/individual_report/module.php +++ b/modules_v3/individual_report/module.php @@ -50,12 +50,12 @@ class individual_report_WT_Module extends WT_Module implements WT_Module_Report public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/lightbox/album.php b/modules_v3/lightbox/album.php index 42e919e11a..b216882073 100644 --- a/modules_v3/lightbox/album.php +++ b/modules_v3/lightbox/album.php @@ -33,7 +33,6 @@ if (!defined('WT_WEBTREES')) { global $edit, $sort_i; $reorder=safe_get('reorder', '1', '0'); -$pid=$this->controller->indi->getXref(); require_once WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lightbox_print_media.php'; require_once WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lightbox_print_media_row.php'; @@ -76,12 +75,12 @@ if ($reorder==1) { </script> <form name="reorder_form" method="post" action="edit_interface.php"> <input type="hidden" name="action" value="al_reorder_media_update" /> - <input type="hidden" name="pid" value="<?php echo $pid; ?>" /> + <input type="hidden" name="pid" value="<?php echo $controller->record->getXref(); ?>" /> <input type="hidden" id="ord2" name="order2" value="" /> <center> <button type="submit" title="<?php echo WT_I18N::translate('Saves the sorted media to the database'); ?>" onclick="saveOrder();" ><?php echo WT_I18N::translate('Save'); ?></button> <button type="submit" title="<?php echo WT_I18N::translate('Reset to the original order'); ?>" onclick="document.reorder_form.action.value='al_reset_media_update'; document.reorder_form.submit();"><?php echo WT_I18N::translate('Reset'); ?></button> - <button type="button" title="<?php echo WT_I18N::translate('Quit and return'); ?>" onClick="location.href='<?php echo WT_SCRIPT_NAME, '?pid=', $pid, '#lightbox'; ?>'"><?php echo WT_I18N::translate('Cancel'); ?></button> + <button type="button" title="<?php echo WT_I18N::translate('Quit and return'); ?>" onClick="location.href='<?php echo WT_SCRIPT_NAME, '?pid=', $controller->record->getXref(), '#lightbox'; ?>'"><?php echo WT_I18N::translate('Cancel'); ?></button> <?php /* // Debug --------------------------------------------------------------------------- @@ -96,10 +95,10 @@ if ($reorder==1) { } echo '<table width="100%" cellpadding="0" border="0"><tr>'; echo '<td width="100%" valign="top" >'; -lightbox_print_media($pid, 0, true, 1); // map, painting, photo, tombstone) -lightbox_print_media($pid, 0, true, 2); // card, certificate, document, magazine, manuscript, newspaper -lightbox_print_media($pid, 0, true, 3); // electronic, fiche, film -lightbox_print_media($pid, 0, true, 4); // audio, book, coat, video, other -lightbox_print_media($pid, 0, true, 5); // footnotes +lightbox_print_media($controller->record->getXref(), 0, true, 1); // map, painting, photo, tombstone) +lightbox_print_media($controller->record->getXref(), 0, true, 2); // card, certificate, document, magazine, manuscript, newspaper +lightbox_print_media($controller->record->getXref(), 0, true, 3); // electronic, fiche, film +lightbox_print_media($controller->record->getXref(), 0, true, 4); // audio, book, coat, video, other +lightbox_print_media($controller->record->getXref(), 0, true, 5); // footnotes echo '</td>'; echo '</tr></table>'; diff --git a/modules_v3/lightbox/functions/lb_head.php b/modules_v3/lightbox/functions/lb_head.php index a1ccde80a2..ccdf674c5f 100644 --- a/modules_v3/lightbox/functions/lb_head.php +++ b/modules_v3/lightbox/functions/lb_head.php @@ -37,17 +37,17 @@ $reorder=safe_get('reorder', '1', '0'); <!-- function reorder_media() { var win02 = window.open( - 'edit_interface.php?action=reorder_media&pid=<?php echo $this->controller->indi->getXref(); ?>&currtab=album', 'win02', 'resizable=1, menubar=0, scrollbars=1, top=20, HEIGHT=840, WIDTH=450 '); + 'edit_interface.php?action=reorder_media&pid=<?php echo $controller->record->getXref(); ?>&currtab=album', 'win02', 'resizable=1, menubar=0, scrollbars=1, top=20, HEIGHT=840, WIDTH=450 '); if (window.focus) {win02.focus();} } function album_add() { win03 = window.open( - 'addmedia.php?action=showmediaform&linktoid=<?php echo $this->controller->indi->getXref(); ?>', 'win03', 'resizable=1, scrollbars=1, top=50, HEIGHT=780, WIDTH=600 '); + 'addmedia.php?action=showmediaform&linktoid=<?php echo $controller->record->getXref(); ?>', 'win03', 'resizable=1, scrollbars=1, top=50, HEIGHT=780, WIDTH=600 '); if (window.focus) {win03.focus();} } function album_link() { win04 = window.open( - 'inverselink.php?linktoid=<?php echo $this->controller->indi->getXref(); ?>&linkto=person', 'win04', 'resizable=1, scrollbars=1, top=50, HEIGHT=300, WIDTH=450 '); + 'inverselink.php?linktoid=<?php echo $controller->record->getXref(); ?>&linkto=person', 'win04', 'resizable=1, scrollbars=1, top=50, HEIGHT=300, WIDTH=450 '); win04.focus() } --> diff --git a/modules_v3/lightbox/module.php b/modules_v3/lightbox/module.php index bf6b6dd0bb..8f3f055932 100644 --- a/modules_v3/lightbox/module.php +++ b/modules_v3/lightbox/module.php @@ -74,11 +74,13 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Config, WT_Modul // Implement WT_Module_Tab public function getTabContent() { + global $controller; + ob_start(); require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_head.php'; $media_found = false; - if (!$this->controller->indi->canDisplayDetails()) { + if (!$controller->record->canDisplayDetails()) { echo '<table class="facts_table" cellpadding="0">'; echo '<tr><td class="facts_value">'; print_privacy_error(); @@ -112,9 +114,11 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Config, WT_Modul protected $mediaCount = null; private function get_media_count() { + global $controller; + if ($this->mediaCount===null) { - $ct = preg_match("/\d OBJE/", $this->controller->indi->getGedcomRecord()); - foreach ($this->controller->indi->getSpouseFamilies() as $sfam) + $ct = preg_match("/\d OBJE/", $controller->record->getGedcomRecord()); + foreach ($controller->record->getSpouseFamilies() as $sfam) $ct += preg_match("/\d OBJE/", $sfam->getGedcomRecord()); $this->mediaCount = $ct; } diff --git a/modules_v3/media/module.php b/modules_v3/media/module.php index 83c715d143..985e1d7ba1 100644 --- a/modules_v3/media/module.php +++ b/modules_v3/media/module.php @@ -58,7 +58,7 @@ class media_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab public function getTabContent() { - global $NAV_MEDIA; + global $NAV_MEDIA, $controller; ob_start(); // For Reorder media ------------------------------------ @@ -72,22 +72,22 @@ class media_WT_Module extends WT_Module implements WT_Module_Tab { <table class="facts_table"> <?php $media_found = false; - if (!$this->controller->indi->canDisplayDetails()) { + if (!$controller->record->canDisplayDetails()) { echo "<tr><td class=\"facts_value\">"; print_privacy_error(); echo "</td></tr>"; } else { - $media_found = print_main_media($this->controller->pid, 0, true); + $media_found = print_main_media($controller->record->getXref(), 0, true); if (!$media_found) echo "<tr><td id=\"no_tab4\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no media objects for this individual.')."</td></tr>"; //-- New Media link - if (WT_USER_CAN_EDIT && $this->controller->indi->canDisplayDetails() && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) { + if (WT_USER_CAN_EDIT && $controller->record->canDisplayDetails() && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add media'), help_link('add_media'); ?></td> <td class="facts_value"> - <a href="javascript:;" onclick="window.open('addmedia.php?action=showmediaform&linktoid=<?php echo $this->controller->pid; ?>', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false;"> <?php echo WT_I18N::translate('Add a new media object'); ?></a><br /> - <a href="javascript:;" onclick="window.open('inverselink.php?linktoid=<?php echo $this->controller->pid; ?>&linkto=person', '_blank', 'top=50,left=50,width=400,height=300,resizable=1,scrollbars=1'); return false;"><?php echo WT_I18N::translate('Link to an existing media object'); ?></a> + <a href="javascript:;" onclick="window.open('addmedia.php?action=showmediaform&linktoid=<?php echo $controller->record->getXref(); ?>', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false;"> <?php echo WT_I18N::translate('Add a new media object'); ?></a><br /> + <a href="javascript:;" onclick="window.open('inverselink.php?linktoid=<?php echo $controller->record->getXref(); ?>&linkto=person', '_blank', 'top=50,left=50,width=400,height=300,resizable=1,scrollbars=1'); return false;"><?php echo WT_I18N::translate('Link to an existing media object'); ?></a> </td> </tr> <?php @@ -105,9 +105,11 @@ class media_WT_Module extends WT_Module implements WT_Module_Tab { * @return int */ function get_media_count() { + global $controller; + if ($this->mediaCount===null) { - $ct = preg_match("/\d OBJE/", $this->controller->indi->getGedcomRecord()); - foreach ($this->controller->indi->getSpouseFamilies() as $sfam) + $ct = preg_match("/\d OBJE/", $controller->record->getGedcomRecord()); + foreach ($controller->record->getSpouseFamilies() as $sfam) $ct += preg_match("/\d OBJE/", $sfam->getGedcomRecord()); $this->mediaCount = $ct; } diff --git a/modules_v3/notes/module.php b/modules_v3/notes/module.php index 0e0a7dd15a..9b010b9678 100644 --- a/modules_v3/notes/module.php +++ b/modules_v3/notes/module.php @@ -48,13 +48,13 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab public function getTabContent() { - global $FACT_COUNT, $SHOW_LEVEL2_NOTES, $NAV_NOTES; + global $FACT_COUNT, $SHOW_LEVEL2_NOTES, $NAV_NOTES, $controller; ob_start(); ?> <table class="facts_table"> <?php - if (!$this->controller->indi->canDisplayDetails()) { + if (!$controller->record->canDisplayDetails()) { echo "<tr><td class=\"facts_value\">"; print_privacy_error(); echo "</td></tr>"; @@ -68,44 +68,44 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab { </td> </tr> <?php - $globalfacts = $this->controller->getGlobalFacts(); + $globalfacts = $controller->getGlobalFacts(); foreach ($globalfacts as $key => $event) { $fact = $event->getTag(); if ($fact=="NAME") { - print_main_notes($event->getGedcomRecord(), 2, $this->controller->pid, $event->getLineNumber(), true); + print_main_notes($event->getGedcomRecord(), 2, $controller->record->getXref(), $event->getLineNumber(), true); } $FACT_COUNT++; } - $otherfacts = $this->controller->getOtherFacts(); + $otherfacts = $controller->getOtherFacts(); foreach ($otherfacts as $key => $event) { $fact = $event->getTag(); if ($fact=="NOTE") { - print_main_notes($event->getGedcomRecord(), 1, $this->controller->pid, $event->getLineNumber()); + print_main_notes($event->getGedcomRecord(), 1, $controller->record->getXref(), $event->getLineNumber()); } $FACT_COUNT++; } // 2nd to 5th level notes/sources - $this->controller->indi->add_family_facts(false); - foreach ($this->controller->getIndiFacts() as $key => $factrec) { + $controller->record->add_family_facts(false); + foreach ($controller->getIndiFacts() as $key => $factrec) { for ($i=2; $i<6; $i++) { - print_main_notes($factrec->getGedcomRecord(), $i, $this->controller->pid, $factrec->getLineNumber(), true); + print_main_notes($factrec->getGedcomRecord(), $i, $controller->record->getXref(), $factrec->getLineNumber(), true); } } if ($this->get_note_count()==0) echo "<tr><td id=\"no_tab2\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no Notes for this individual.')."</td></tr>"; //-- New Note Link - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add Note'), help_link('add_note'); ?></td> <td class="facts_value"><a href="javascript:;" - onclick="add_new_record('<?php echo $this->controller->pid; ?>','NOTE'); return false;"><?php echo WT_I18N::translate('Add a new note'); ?></a> + onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','NOTE'); return false;"><?php echo WT_I18N::translate('Add a new note'); ?></a> <br /> </td> </tr> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add Shared Note'), help_link('add_shared_note'); ?></td> <td class="facts_value"><a href="javascript:;" - onclick="add_new_record('<?php echo $this->controller->pid; ?>','SHARED_NOTE'); return false;"><?php echo WT_I18N::translate('Add a new shared note'); ?></a> + onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','SHARED_NOTE'); return false;"><?php echo WT_I18N::translate('Add a new shared note'); ?></a> <br /> </td> </tr> @@ -123,9 +123,11 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab { } function get_note_count() { + global $controller; + if ($this->noteCount===null) { - $ct = preg_match_all("/\d NOTE /", $this->controller->indi->getGedcomRecord(), $match, PREG_SET_ORDER); - foreach ($this->controller->indi->getSpouseFamilies() as $sfam) + $ct = preg_match_all("/\d NOTE /", $controller->record->getGedcomRecord(), $match, PREG_SET_ORDER); + foreach ($controller->record->getSpouseFamilies() as $sfam) $ct += preg_match("/\d NOTE /", $sfam->getGedcomRecord()); $this->noteCount = $ct; } diff --git a/modules_v3/pedigree_report/module.php b/modules_v3/pedigree_report/module.php index 0ab20838de..e2296cedb0 100644 --- a/modules_v3/pedigree_report/module.php +++ b/modules_v3/pedigree_report/module.php @@ -50,12 +50,12 @@ class pedigree_report_WT_Module extends WT_Module implements WT_Module_Report { public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php index 0ae372e401..ef26a60260 100644 --- a/modules_v3/personal_facts/module.php +++ b/modules_v3/personal_facts/module.php @@ -51,33 +51,33 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab
public function getTabContent() {
- global $FACT_COUNT, $EXPAND_RELATIVES_EVENTS;
+ global $FACT_COUNT, $EXPAND_RELATIVES_EVENTS, $controller;
/*if (isset($_COOKIE['row_rela'])) $EXPAND_RELATIVES_EVENTS = ($_COOKIE['row_rela']);
if (isset($_COOKIE['row_histo'])) $EXPAND_HISTO_EVENTS = ($_COOKIE['row_histo']);
else*/ $EXPAND_HISTO_EVENTS = false;
//-- only need to add family facts on this tab
- if (!isset($this->controller->skipFamilyFacts)) {
- $this->controller->indi->add_family_facts();
+ if (!isset($controller->skipFamilyFacts)) {
+ $controller->record->add_family_facts();
}
ob_start();
?>
<table class="facts_table" style="margin-top:-2px;" cellpadding="0">
- <?php if (!$this->controller->indi->canDisplayDetails()) {
+ <?php if (!$controller->record->canDisplayDetails()) {
echo '<tr><td class="facts_value" colspan="2">';
print_privacy_error();
echo '</td></tr>';
} else {
- $indifacts = $this->controller->getIndiFacts();
+ $indifacts = $controller->getIndiFacts();
if (count($indifacts)==0) { ?>
<tr>
<td id="no_tab1" colspan="2" class="facts_value"><?php echo WT_I18N::translate('There are no Facts for this individual.'); ?>
</td>
</tr>
<?php }
- if (!isset($this->controller->skipFamilyFacts)) {
+ if (!isset($controller->skipFamilyFacts)) {
?>
<tr id="row_top">
<td colspan="2" class="descriptionbox rela">
@@ -93,25 +93,25 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab { }
$yetdied=false;
foreach ($indifacts as $fact) {
- if (strstr(WT_EVENTS_DEAT, $fact->getTag()) && $fact->getParentObject()->getXref()==$this->controller->indi->getXref()) {
+ if (strstr(WT_EVENTS_DEAT, $fact->getTag()) && $fact->getParentObject()->getXref()==$controller->record->getXref()) {
$yetdied = true;
}
if (!is_null($fact->getFamilyId())) {
if (!$yetdied) {
- print_fact($fact, $this->controller->indi);
+ print_fact($fact, $controller->record);
}
} else {
//$reftags = array ('CHAN', 'IDNO', 'RFN', 'AFN', 'REFN', 'RIN', '_UID');// list of tags used in "Extra information" sidebar module
if (!in_array($fact->getTag(), WT_Gedcom_Tag::getReferenceFacts()) || !array_key_exists('extra_info', WT_Module::getActiveSidebars())) {
- print_fact($fact, $this->controller->indi);
+ print_fact($fact, $controller->record);
}
}
$FACT_COUNT++;
}
}
//-- new fact link
- if ($this->controller->indi->canEdit()) {
- print_add_new_fact($this->controller->pid, $indifacts, 'INDI');
+ if ($controller->record->canEdit()) {
+ print_add_new_fact($controller->record->getXref(), $indifacts, 'INDI');
}
echo '</table><br />';
echo WT_JS_START;
diff --git a/modules_v3/relative_ext_report/module.php b/modules_v3/relative_ext_report/module.php index 9bb61237a6..b371623983 100644 --- a/modules_v3/relative_ext_report/module.php +++ b/modules_v3/relative_ext_report/module.php @@ -50,12 +50,12 @@ class relative_ext_report_WT_Module extends WT_Module implements WT_Module_Repor public function getReportMenus() { global $controller; - if ($controller instanceof WT_Controller_Family) { + if ($controller instanceof WT_Controller_Family && $controller->record instanceof WT_Family) { // We are on a family page - $pid='&famid='.$controller->famid; - } elseif ($controller instanceof WT_Controller_Individual) { + $pid='&famid='.$controller->record->getXref(); + } elseif ($controller instanceof WT_Controller_Individual && $controller->record instanceof WT_Individual) { // We are on an individual page - $pid='&pid='.$controller->pid; + $pid='&pid='.$controller->record->getXref(); } elseif ($controller && isset($controller->rootid)) { // We are on a chart page $pid='&pid='.$controller->rootid; diff --git a/modules_v3/relatives/module.php b/modules_v3/relatives/module.php index c39a51df42..71c977d034 100644 --- a/modules_v3/relatives/module.php +++ b/modules_v3/relatives/module.php @@ -69,7 +69,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { * @return html table rows */ function printParentsRows($family, $people, $type) { - global $personcount, $WT_IMAGES, $SHOW_PEDIGREE_PLACES; + global $personcount, $WT_IMAGES, $SHOW_PEDIGREE_PLACES, $controller; $elderdate = ""; //-- new father/husband @@ -79,7 +79,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_labelblue"><?php echo $people["newhusb"]->getLabel(); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($people["newhusb"]); ?>"> + <td class="<?php echo $controller->getPersonStyle($people["newhusb"]); ?>"> <?php print_pedigree_person($people["newhusb"], 2, 0, $personcount++); ?> </td> </tr> @@ -91,7 +91,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"><?php echo $people["husb"]->getLabel(); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($people["husb"]); ?>"> + <td class="<?php echo $controller->getPersonStyle($people["husb"]); ?>"> <?php print_pedigree_person($people["husb"], 2, 0, $personcount++); ?> </td> </tr> @@ -100,18 +100,18 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { } //-- missing father if ($type=="parents" && !isset($people["husb"]) && !isset($people["newhusb"])) { - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add a new father'); ?></td> - <td class="facts_value"><a href="javascript <?php echo WT_I18N::translate('Add a new father'); ?>" onclick="return addnewparentfamily('<?php echo $this->controller->pid; ?>', 'HUSB', '<?php echo $family->getXref(); ?>');"><?php echo WT_I18N::translate('Add a new father'); ?></a><?php echo help_link('edit_add_parent'); ?></td> + <td class="facts_value"><a href="javascript <?php echo WT_I18N::translate('Add a new father'); ?>" onclick="return addnewparentfamily('<?php echo $controller->record->getXref(); ?>', 'HUSB', '<?php echo $family->getXref(); ?>');"><?php echo WT_I18N::translate('Add a new father'); ?></a><?php echo help_link('edit_add_parent'); ?></td> </tr> <?php } } //-- missing husband if ($type=="spouse" && !isset($people["husb"]) && !isset($people["newhusb"])) { - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add husband'); ?></td> @@ -127,7 +127,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_labelblue"><?php echo $people["newwife"]->getLabel($elderdate); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($people["newwife"]); ?>"> + <td class="<?php echo $controller->getPersonStyle($people["newwife"]); ?>"> <?php print_pedigree_person($people["newwife"], 2, 0, $personcount++); ?> </td> </tr> @@ -138,7 +138,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"><?php echo $people["wife"]->getLabel($elderdate); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($people["wife"]); ?>"> + <td class="<?php echo $controller->getPersonStyle($people["wife"]); ?>"> <?php print_pedigree_person($people["wife"], 2, 0, $personcount++); ?> </td> </tr> @@ -146,18 +146,18 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { } //-- missing mother if ($type=="parents" && !isset($people["wife"]) && !isset($people["newwife"])) { - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add a new mother'); ?></td> - <td class="facts_value"><a href="javascript:;" onclick="return addnewparentfamily('<?php echo $this->controller->pid; ?>', 'WIFE', '<?php echo $family->getXref(); ?>');"><?php echo WT_I18N::translate('Add a new mother'); ?></a><?php echo help_link('edit_add_parent'); ?></td> + <td class="facts_value"><a href="javascript:;" onclick="return addnewparentfamily('<?php echo $controller->record->getXref(); ?>', 'WIFE', '<?php echo $family->getXref(); ?>');"><?php echo WT_I18N::translate('Add a new mother'); ?></a><?php echo help_link('edit_add_parent'); ?></td> </tr> <?php } } //-- missing wife if ($type=="spouse" && !isset($people["wife"]) && !isset($people["newwife"])) { - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add wife'); ?></td> @@ -232,7 +232,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { if (empty($wife) && !empty($husb)) echo WT_Gedcom_Tag::getLabel('_NMAR', $husb); else if (empty($husb) && !empty($wife)) echo WT_Gedcom_Tag::getLabel('_NMAR', $wife); else echo WT_Gedcom_Tag::getLabel('_NMAR'); - } else if ($family->getMarriageRecord()=="" && $this->controller->indi->canEdit()) { + } else if ($family->getMarriageRecord()=="" && $controller->record->canEdit()) { echo "<a href=\"#\" onclick=\"return add_new_record('".$famid."', 'MARR');\">".WT_I18N::translate('Add marriage details')."</a>"; } else { $factdetail = explode(' ', trim($family->getMarriageRecord())); @@ -261,7 +261,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { * @return html table rows */ function printChildrenRows($family, $people, $type) { - global $personcount, $WT_IMAGES; + global $personcount, $WT_IMAGES, $controller; $elderdate = $family->getMarriageDate(); $key=0; @@ -271,7 +271,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"><?php if ($styleadd=="red") echo $child->getLabel(); else echo $child->getLabel($elderdate, $key+1); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($child); ?>"> + <td class="<?php echo $controller->getPersonStyle($child); ?>"> <?php print_pedigree_person($child, 2, 0, $personcount++); ?> @@ -287,7 +287,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"><?php if ($styleadd=="red") echo $child->getLabel(); else echo $child->getLabel($elderdate, $key+1); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($child); ?>"> + <td class="<?php echo $controller->getPersonStyle($child); ?>"> <?php print_pedigree_person($child, 2, 0, $personcount++); ?> @@ -303,7 +303,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { ?> <tr> <td class="facts_label<?php echo $styleadd; ?>"><?php if ($styleadd=="red") echo $child->getLabel(); else echo $child->getLabel($elderdate, $key+1); ?></td> - <td class="<?php echo $this->controller->getPersonStyle($child); ?>"> + <td class="<?php echo $controller->getPersonStyle($child); ?>"> <?php print_pedigree_person($child, 2, 0, $personcount++); ?> @@ -313,7 +313,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { $elderdate = $child->getBirthDate(); ++$key; } - if (isset($family) && $this->controller->indi->canEdit()) { + if (isset($family) && $controller->record->canEdit()) { if ($type == "spouse") { $child_u = WT_I18N::translate('Add a son or daughter'); $child_m = WT_I18N::translate('son'); @@ -351,7 +351,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab public function getTabContent() { - global $WT_IMAGES, $SHOW_AGE_DIFF, $GEDCOM, $ABBREVIATE_CHART_LABELS, $show_full, $personcount; + global $WT_IMAGES, $SHOW_AGE_DIFF, $GEDCOM, $ABBREVIATE_CHART_LABELS, $show_full, $personcount, $controller; if (isset($show_full)) $saved_show_full = $show_full; // We always want to see full details here $show_full = 1; @@ -367,16 +367,16 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { </td></tr></table> <?php $personcount=0; - $families = $this->controller->indi->getChildFamilies(); + $families = $controller->record->getChildFamilies(); if (count($families)==0) { - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <table class="facts_table"> <tr> - <td class="facts_value"><a href="javascript:;" onclick="return addnewparent('<?php echo $this->controller->pid; ?>', 'HUSB');"><?php echo WT_I18N::translate('Add a new father'); ?></a><?php echo help_link('edit_add_parent'); ?></td> + <td class="facts_value"><a href="javascript:;" onclick="return addnewparent('<?php echo $controller->record->getXref(); ?>', 'HUSB');"><?php echo WT_I18N::translate('Add a new father'); ?></a><?php echo help_link('edit_add_parent'); ?></td> </tr> <tr> - <td class="facts_value"><a href="javascript:;" onclick="return addnewparent('<?php echo $this->controller->pid; ?>', 'WIFE');"><?php echo WT_I18N::translate('Add a new mother'); ?></a><?php echo help_link('edit_add_parent'); ?></td> + <td class="facts_value"><a href="javascript:;" onclick="return addnewparent('<?php echo $controller->record->getXref(); ?>', 'WIFE');"><?php echo WT_I18N::translate('Add a new mother'); ?></a><?php echo help_link('edit_add_parent'); ?></td> </tr> </table> <?php @@ -385,8 +385,8 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { // parents foreach ($families as $family) { - $people = $this->controller->buildFamilyList($family, "parents"); - $this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getChildFamilyLabel($family)); + $people = $controller->buildFamilyList($family, "parents"); + $this->printFamilyHeader($family->getHtmlUrl(), $controller->record->getChildFamilyLabel($family)); echo '<table class="facts_table">'; $this->printParentsRows($family, $people, "parents"); $this->printChildrenRows($family, $people, "parents"); @@ -394,9 +394,9 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { } // step-parents - foreach ($this->controller->indi->getChildStepFamilies() as $family) { - $people = $this->controller->buildFamilyList($family, "step-parents"); - $this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getStepFamilyLabel($family)); + foreach ($controller->record->getChildStepFamilies() as $family) { + $people = $controller->buildFamilyList($family, "step-parents"); + $this->printFamilyHeader($family->getHtmlUrl(), $controller->record->getStepFamilyLabel($family)); echo '<table class="facts_table">'; $this->printParentsRows($family, $people, "parents"); $this->printChildrenRows($family, $people, "parents"); @@ -404,10 +404,10 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { } // spouses - $families = $this->controller->indi->getSpouseFamilies(); + $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { - $people = $this->controller->buildFamilyList($family, "spouse"); - $this->printFamilyHeader($family->getHtmlUrl(), $this->controller->indi->getSpouseFamilyLabel($family)); + $people = $controller->buildFamilyList($family, "spouse"); + $this->printFamilyHeader($family->getHtmlUrl(), $controller->record->getSpouseFamilyLabel($family)); echo '<table class="facts_table">'; $this->printParentsRows($family, $people, "spouse"); $this->printChildrenRows($family, $people, "spouse"); @@ -415,8 +415,8 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { } // step-children - foreach ($this->controller->indi->getSpouseStepFamilies() as $family) { - $people = $this->controller->buildFamilyList($family, "step-children"); + foreach ($controller->record->getSpouseStepFamilies() as $family) { + $people = $controller->buildFamilyList($family, "step-children"); $this->printFamilyHeader($family->getHtmlUrl(), $family->getFullName()); echo '<table class="facts_table">'; $this->printParentsRows($family, $people, "spouse"); @@ -428,67 +428,67 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab { echo WT_JS_START, "jQuery('DIV.elderdate').toggle();", WT_JS_END; } - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <br/><table class="facts_table"> <?php if (count($families)>1) { ?> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return reorder_families('<?php echo $this->controller->pid; ?>');"><?php echo WT_I18N::translate('Reorder families'); ?></a> + <a href="javascript:;" onclick="return reorder_families('<?php echo $controller->record->getXref(); ?>');"><?php echo WT_I18N::translate('Reorder families'); ?></a> <?php echo help_link('reorder_families'); ?> </td> </tr> <?php } ?> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return add_famc('<?php echo $this->controller->pid; ?>');"><?php echo WT_I18N::translate('Link this person to an existing family as a child'); ?></a> + <a href="javascript:;" onclick="return add_famc('<?php echo $controller->record->getXref(); ?>');"><?php echo WT_I18N::translate('Link this person to an existing family as a child'); ?></a> <?php echo help_link('link_child'); ?> </td> </tr> - <?php if ($this->controller->indi->getSex()!="F") { ?> + <?php if ($controller->record->getSex()!="F") { ?> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return addspouse('<?php echo $this->controller->pid; ?>','WIFE');"><?php echo WT_I18N::translate('Add a new wife'); ?></a> + <a href="javascript:;" onclick="return addspouse('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo WT_I18N::translate('Add a new wife'); ?></a> <?php echo help_link('add_wife'); ?> </td> </tr> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return linkspouse('<?php echo $this->controller->pid; ?>','WIFE');"><?php echo WT_I18N::translate('Add a wife using an existing person'); ?></a> + <a href="javascript:;" onclick="return linkspouse('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo WT_I18N::translate('Add a wife using an existing person'); ?></a> <?php echo help_link('link_new_wife'); ?> </td> </tr> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return add_fams('<?php echo $this->controller->pid; ?>','HUSB');"><?php echo WT_I18N::translate('Link this person to an existing family as a husband'); ?></a> + <a href="javascript:;" onclick="return add_fams('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo WT_I18N::translate('Link this person to an existing family as a husband'); ?></a> <?php echo help_link('link_new_husb'); ?> </td> </tr> <?php } - if ($this->controller->indi->getSex()!="M") { ?> + if ($controller->record->getSex()!="M") { ?> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return addspouse('<?php echo $this->controller->pid; ?>','HUSB');"><?php echo WT_I18N::translate('Add a new husband'); ?></a> + <a href="javascript:;" onclick="return addspouse('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo WT_I18N::translate('Add a new husband'); ?></a> <?php echo help_link('add_husband'); ?> </td> </tr> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return linkspouse('<?php echo $this->controller->pid; ?>','HUSB');"><?php echo WT_I18N::translate('Add a husband using an existing person'); ?></a> + <a href="javascript:;" onclick="return linkspouse('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo WT_I18N::translate('Add a husband using an existing person'); ?></a> <?php echo help_link('link_husband'); ?> </td> </tr> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return add_fams('<?php echo $this->controller->pid; ?>','WIFE');"><?php echo WT_I18N::translate('Link this person to an existing family as a wife'); ?></a> + <a href="javascript:;" onclick="return add_fams('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo WT_I18N::translate('Link this person to an existing family as a wife'); ?></a> <?php echo help_link('link_wife'); ?> </td> </tr> <?php } ?> <tr> <td class="facts_value"> - <a href="javascript:;" onclick="return addopfchild('<?php echo $this->controller->pid; ?>','U');"><?php echo WT_I18N::translate('Add a child to create a one-parent family'); ?></a> + <a href="javascript:;" onclick="return addopfchild('<?php echo $controller->record->getXref(); ?>','U');"><?php echo WT_I18N::translate('Add a child to create a one-parent family'); ?></a> <?php echo help_link('add_opf_child'); ?> </td> </tr> diff --git a/modules_v3/sources_tab/module.php b/modules_v3/sources_tab/module.php index 4832c6f6d3..7c64deac2f 100644 --- a/modules_v3/sources_tab/module.php +++ b/modules_v3/sources_tab/module.php @@ -48,13 +48,13 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab public function getTabContent() { - global $FACT_COUNT, $SHOW_LEVEL2_NOTES, $NAV_SOURCES; + global $FACT_COUNT, $SHOW_LEVEL2_NOTES, $NAV_SOURCES, $controller; ob_start(); ?> <table class="facts_table"> <?php - if (!$this->controller->indi->canDisplayDetails()) { + if (!$controller->record->canDisplayDetails()) { echo "<tr><td class=\"facts_value\">"; print_privacy_error(); echo "</td></tr>"; @@ -67,25 +67,25 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab { </td> </tr> <?php - $otheritems = $this->controller->getOtherFacts(); + $otheritems = $controller->getOtherFacts(); foreach ($otheritems as $key => $event) { - if ($event->getTag()=="SOUR") print_main_sources($event->getGedcomRecord(), 1, $this->controller->pid, $event->getLineNumber()); + if ($event->getTag()=="SOUR") print_main_sources($event->getGedcomRecord(), 1, $controller->record->getXref(), $event->getLineNumber()); $FACT_COUNT++; } } // 2nd level sources [ 1712181 ] - $this->controller->indi->add_family_facts(false); - foreach ($this->controller->getIndiFacts() as $key => $factrec) { - print_main_sources($factrec->getGedcomRecord(), 2, $this->controller->pid, $factrec->getLineNumber(), true); + $controller->record->add_family_facts(false); + foreach ($controller->getIndiFacts() as $key => $factrec) { + print_main_sources($factrec->getGedcomRecord(), 2, $controller->record->getXref(), $factrec->getLineNumber(), true); } if ($this->get_source_count()==0) echo "<tr><td id=\"no_tab3\" colspan=\"2\" class=\"facts_value\">".WT_I18N::translate('There are no Source citations for this individual.')."</td></tr>"; //-- New Source Link - if ($this->controller->indi->canEdit()) { + if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"><?php echo WT_I18N::translate('Add Source Citation'), help_link('add_source'); ?></td> <td class="facts_value"> - <a href="javascript:;" onclick="add_new_record('<?php echo $this->controller->pid; ?>','SOUR'); return false;"><?php echo WT_I18N::translate('Add a new source citation'); ?></a> + <a href="javascript:;" onclick="add_new_record('<?php echo $controller->record->getXref(); ?>','SOUR'); return false;"><?php echo WT_I18N::translate('Add a new source citation'); ?></a> <br /> </td> </tr> @@ -102,9 +102,11 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab { } function get_source_count() { + global $controller; + if ($this->sourceCount===null) { - $ct = preg_match_all("/\d SOUR @(.*)@/", $this->controller->indi->getGedcomRecord(), $match, PREG_SET_ORDER); - foreach ($this->controller->indi->getSpouseFamilies() as $sfam) + $ct = preg_match_all("/\d SOUR @(.*)@/", $controller->record->getGedcomRecord(), $match, PREG_SET_ORDER); + foreach ($controller->record->getSpouseFamilies() as $sfam) $ct += preg_match("/\d SOUR /", $sfam->getGedcomRecord()); $this->sourceCount = $ct; } diff --git a/modules_v3/stories/module.php b/modules_v3/stories/module.php index 6dad53afc9..b7b12e7546 100644 --- a/modules_v3/stories/module.php +++ b/modules_v3/stories/module.php @@ -95,6 +95,8 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ // Implement class WT_Module_Tab public function getTabContent() { + global $controller; + $block_ids= WT_DB::prepare( "SELECT block_id". @@ -104,7 +106,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ " AND gedcom_id=?" )->execute(array( $this->getName(), - $xref=$this->controller->indi->getXref(), + $xref=$controller->record->getXref(), WT_GED_ID ))->fetchOneColumn(); @@ -123,7 +125,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ } if (WT_USER_GEDCOM_ADMIN && !$html) { $html.='<div class="news_title center">'.$this->getTitle().'</div>'; - $html.='<div><a href="module.php?mod='.$this->getName().'&mod_action=admin_edit&xref='.$this->controller->indi->getXref().'">'; + $html.='<div><a href="module.php?mod='.$this->getName().'&mod_action=admin_edit&xref='.$controller->record->getXref().'">'; $html.=WT_I18N::translate('Add story').'</a>'.help_link('add_story', $this->getName()).'</div><br />'; } return $html; @@ -136,6 +138,8 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ // Implement WT_Module_Tab public function isGrayedOut() { + global $controller; + $count_of_stories= WT_DB::prepare( "SELECT COUNT(block_id)". @@ -145,7 +149,7 @@ class stories_WT_Module extends WT_Module implements WT_Module_Block, WT_Module_ " AND gedcom_id=?" )->execute(array( $this->getName(), - $xref=$this->controller->indi->getXref(), + $xref=$controller->record->getXref(), WT_GED_ID ))->fetchOne(); diff --git a/modules_v3/tree/module.php b/modules_v3/tree/module.php index e33b5f9675..f945aff4f7 100644 --- a/modules_v3/tree/module.php +++ b/modules_v3/tree/module.php @@ -71,9 +71,11 @@ class tree_WT_Module extends WT_Module implements WT_Module_Tab { // Implement WT_Module_Tab public function getTabContent() { + global $controller; + require_once WT_MODULES_DIR.$this->getName().'/class_treeview.php'; $tv = new TreeView('tvTab'); - $r = $tv->drawViewport($this->controller->pid, 3, $this->style); + $r = $tv->drawViewport($controller->record->getXref(), 3, $this->style); return $r; } |
