summaryrefslogtreecommitdiff
path: root/modules_v3
diff options
context:
space:
mode:
Diffstat (limited to 'modules_v3')
-rw-r--r--modules_v3/GEDFact_assistant/CENS_ctrl.php12
-rw-r--r--modules_v3/GEDFact_assistant/MEDIA_ctrl.php10
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/addnoteaction_assisted.php100
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php18
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php11
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_3_find.php68
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php824
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/census_5_input.php2
-rw-r--r--modules_v3/GEDFact_assistant/_CENS/js/census_5_input.js.php30
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php52
-rw-r--r--modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php104
-rw-r--r--modules_v3/GEDFact_assistant/module.php40
-rw-r--r--modules_v3/ahnentafel_report/module.php10
-rw-r--r--modules_v3/batch_update/admin_batch_update.php290
-rw-r--r--modules_v3/batch_update/module.php12
-rw-r--r--modules_v3/batch_update/plugins/death_y.php4
-rw-r--r--modules_v3/batch_update/plugins/married_names.php34
-rw-r--r--modules_v3/batch_update/plugins/search_replace.php42
-rw-r--r--modules_v3/bdm_report/module.php10
-rw-r--r--modules_v3/birth_report/module.php10
-rw-r--r--modules_v3/cemetery_report/module.php10
-rw-r--r--modules_v3/change_report/module.php10
-rw-r--r--modules_v3/charts/help_text.php34
-rw-r--r--modules_v3/charts/module.php112
-rw-r--r--modules_v3/ckeditor/module.php2
-rw-r--r--modules_v3/clippings/clippings_ctrl.php169
-rw-r--r--modules_v3/clippings/help_text.php39
-rw-r--r--modules_v3/clippings/module.php237
-rw-r--r--modules_v3/death_report/module.php10
-rw-r--r--modules_v3/descendancy/module.php1
-rw-r--r--modules_v3/descendancy_report/module.php10
-rw-r--r--modules_v3/fact_sources/module.php10
-rw-r--r--modules_v3/families/module.php95
-rw-r--r--modules_v3/family_group_report/module.php10
-rw-r--r--modules_v3/family_nav/module.php11
-rw-r--r--modules_v3/faq/help_text.php68
-rw-r--r--modules_v3/faq/module.php203
-rw-r--r--modules_v3/gedcom_block/module.php21
-rw-r--r--modules_v3/gedcom_favorites/db_schema/db_schema_0_1.php22
-rw-r--r--modules_v3/gedcom_favorites/db_schema/db_schema_1_2.php26
-rw-r--r--modules_v3/gedcom_favorites/db_schema/db_schema_2_3.php8
-rw-r--r--modules_v3/gedcom_favorites/module.php134
-rw-r--r--modules_v3/gedcom_news/db_schema/db_schema_0_1.php16
-rw-r--r--modules_v3/gedcom_news/db_schema/db_schema_1_2.php24
-rw-r--r--modules_v3/gedcom_news/db_schema/db_schema_2_3.php8
-rw-r--r--modules_v3/gedcom_news/module.php33
-rw-r--r--modules_v3/gedcom_stats/module.php401
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_0_1.php30
-rw-r--r--modules_v3/googlemap/db_schema/db_schema_1_2.php14
-rw-r--r--modules_v3/googlemap/help_text.php105
-rw-r--r--modules_v3/googlemap/module.php1233
-rw-r--r--modules_v3/html/help_text.php39
-rw-r--r--modules_v3/html/module.php163
-rw-r--r--modules_v3/individual_ext_report/module.php10
-rw-r--r--modules_v3/individual_report/module.php10
-rw-r--r--modules_v3/individuals/module.php65
-rw-r--r--modules_v3/lightbox/module.php28
-rw-r--r--modules_v3/logged_in/help_text.php29
-rw-r--r--modules_v3/logged_in/module.php11
-rw-r--r--modules_v3/login_block/module.php37
-rw-r--r--modules_v3/marriage_report/module.php10
-rw-r--r--modules_v3/missing_facts_report/module.php10
-rw-r--r--modules_v3/notes/module.php2
-rw-r--r--modules_v3/occupation_report/module.php10
-rw-r--r--modules_v3/pedigree_report/module.php10
-rw-r--r--modules_v3/personal_facts/module.php88
-rw-r--r--modules_v3/random_media/module.php424
-rw-r--r--modules_v3/recent_changes/module.php62
-rw-r--r--modules_v3/relative_ext_report/module.php10
-rw-r--r--modules_v3/relatives/module.php48
-rw-r--r--modules_v3/review_changes/help_text.php39
-rw-r--r--modules_v3/review_changes/module.php133
-rw-r--r--modules_v3/sitemap/module.php19
-rw-r--r--modules_v3/sources_tab/module.php2
-rw-r--r--modules_v3/stories/module.php224
-rw-r--r--modules_v3/theme_select/module.php20
-rw-r--r--modules_v3/todays_events/module.php41
-rw-r--r--modules_v3/todo/help_text.php39
-rw-r--r--modules_v3/todo/module.php89
-rw-r--r--modules_v3/top10_givnnames/module.php70
-rw-r--r--modules_v3/top10_pageviews/module.php55
-rw-r--r--modules_v3/top10_surnames/module.php21
-rw-r--r--modules_v3/tree/class_treeview.php2
-rw-r--r--modules_v3/tree/module.php2
-rw-r--r--modules_v3/upcoming_events/module.php49
-rw-r--r--modules_v3/user_blog/db_schema/db_schema_0_1.php16
-rw-r--r--modules_v3/user_blog/db_schema/db_schema_1_2.php24
-rw-r--r--modules_v3/user_blog/db_schema/db_schema_2_3.php8
-rw-r--r--modules_v3/user_blog/module.php16
-rw-r--r--modules_v3/user_favorites/module.php4
-rw-r--r--modules_v3/user_messages/module.php114
-rw-r--r--modules_v3/user_welcome/module.php20
-rw-r--r--modules_v3/yahrzeit/help_text.php30
-rw-r--r--modules_v3/yahrzeit/module.php145
94 files changed, 3475 insertions, 3562 deletions
diff --git a/modules_v3/GEDFact_assistant/CENS_ctrl.php b/modules_v3/GEDFact_assistant/CENS_ctrl.php
index 0f9475eb26..44569fa6dc 100644
--- a/modules_v3/GEDFact_assistant/CENS_ctrl.php
+++ b/modules_v3/GEDFact_assistant/CENS_ctrl.php
@@ -65,18 +65,18 @@ global $tabno, $linkToID, $SEARCH_SPIDER;
global $SHOW_AGE_DIFF, $GEDCOM;
global $show_full, $famid;
-$summary=$person->format_first_major_fact(WT_EVENTS_BIRT, 2);
+$summary = $person->format_first_major_fact(WT_EVENTS_BIRT, 2);
if (!($person->isDead())) {
// If alive display age
- $bdate=$person->getBirthDate();
+ $bdate = $person->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>";
+ if ($age != "") {
+ $summary .= "<span class=\"label\">" . WT_I18N::translate('Age') . ":</span><span class=\"field\"> " . get_age_at_event($age, true) . "</span>";
}
}
-$summary.=$person->format_first_major_fact(WT_EVENTS_DEAT, 2);
+$summary .= $person->format_first_major_fact(WT_EVENTS_DEAT, 2);
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/census_1_ctrl.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/census_1_ctrl.php';
?>
</form>
diff --git a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
index 1be7456ff1..56ca50ccd5 100644
--- a/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
+++ b/modules_v3/GEDFact_assistant/MEDIA_ctrl.php
@@ -23,9 +23,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-$controller = new WT_Controller_Individual();
+$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">';
+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;
global $SHOW_AGE_DIFF;
@@ -33,8 +33,8 @@ global $GEDCOM;
global $show_full;
global $famid, $censyear, $censdate;
-$summary=
- $controller->record->format_first_major_fact(WT_EVENTS_BIRT, 2).
+$summary =
+ $controller->record->format_first_major_fact(WT_EVENTS_BIRT, 2) .
$controller->record->format_first_major_fact(WT_EVENTS_DEAT, 2);
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_MEDIA/media_1_ctrl.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_MEDIA/media_1_ctrl.php';
diff --git a/modules_v3/GEDFact_assistant/_CENS/addnoteaction_assisted.php b/modules_v3/GEDFact_assistant/_CENS/addnoteaction_assisted.php
index 2ffb3fb03f..2ae8e466a6 100644
--- a/modules_v3/GEDFact_assistant/_CENS/addnoteaction_assisted.php
+++ b/modules_v3/GEDFact_assistant/_CENS/addnoteaction_assisted.php
@@ -25,38 +25,70 @@
//-- create a shared note record from the incoming variables
-$newgedrec = "0 @XREF@ NOTE\n";
+$newgedrec = "0 @XREF@ NOTE\n";
-if (isset($_REQUEST['EVEN'])) $EVEN = $_REQUEST['EVEN'];
-if (!empty($EVEN) && count($EVEN)>0) {
+if (isset($_REQUEST['EVEN'])) {
+ $EVEN = $_REQUEST['EVEN'];
+}
+if (!empty($EVEN) && count($EVEN) > 0) {
$newgedrec .= "1 DATA\n";
- $newgedrec .= "2 EVEN ".implode(",", $EVEN)."\n";
- if (!empty($EVEN_DATE)) $newgedrec .= "3 DATE ".$EVEN_DATE."\n";
- if (!empty($EVEN_PLAC)) $newgedrec .= "3 PLAC ".$EVEN_PLAC."\n";
- if (!empty($AGNC)) $newgedrec .= "2 AGNC ".$AGNC."\n";
+ $newgedrec .= "2 EVEN " . implode(",", $EVEN) . "\n";
+ if (!empty($EVEN_DATE)) {
+ $newgedrec .= "3 DATE " . $EVEN_DATE . "\n";
+ }
+ if (!empty($EVEN_PLAC)) {
+ $newgedrec .= "3 PLAC " . $EVEN_PLAC . "\n";
+ }
+ if (!empty($AGNC)) {
+ $newgedrec .= "2 AGNC " . $AGNC . "\n";
+ }
}
-if (isset($_REQUEST['ABBR'])) $ABBR = $_REQUEST['ABBR'];
-if (isset($_REQUEST['TITL'])) $TITL = $_REQUEST['TITL'];
-if (isset($_REQUEST['DATE'])) $DATE = $_REQUEST['DATE'];
-if (isset($_REQUEST['NOTE'])) $NOTE = $_REQUEST['NOTE'];
-if (isset($_REQUEST['_HEB'])) $_HEB = $_REQUEST['_HEB'];
-if (isset($_REQUEST['ROMN'])) $ROMN = $_REQUEST['ROMN'];
-if (isset($_REQUEST['AUTH'])) $AUTH = $_REQUEST['AUTH'];
-if (isset($_REQUEST['PUBL'])) $PUBL = $_REQUEST['PUBL'];
-if (isset($_REQUEST['REPO'])) $REPO = $_REQUEST['REPO'];
-if (isset($_REQUEST['CALN'])) $CALN = $_REQUEST['CALN'];
-if (isset($_REQUEST['pid_array'])) $pid_array = $_REQUEST['pid_array'];
-if (isset($_REQUEST['pid'])) $pid = $_REQUEST['pid'];
+if (isset($_REQUEST['ABBR'])) {
+ $ABBR = $_REQUEST['ABBR'];
+}
+if (isset($_REQUEST['TITL'])) {
+ $TITL = $_REQUEST['TITL'];
+}
+if (isset($_REQUEST['DATE'])) {
+ $DATE = $_REQUEST['DATE'];
+}
+if (isset($_REQUEST['NOTE'])) {
+ $NOTE = $_REQUEST['NOTE'];
+}
+if (isset($_REQUEST['_HEB'])) {
+ $_HEB = $_REQUEST['_HEB'];
+}
+if (isset($_REQUEST['ROMN'])) {
+ $ROMN = $_REQUEST['ROMN'];
+}
+if (isset($_REQUEST['AUTH'])) {
+ $AUTH = $_REQUEST['AUTH'];
+}
+if (isset($_REQUEST['PUBL'])) {
+ $PUBL = $_REQUEST['PUBL'];
+}
+if (isset($_REQUEST['REPO'])) {
+ $REPO = $_REQUEST['REPO'];
+}
+if (isset($_REQUEST['CALN'])) {
+ $CALN = $_REQUEST['CALN'];
+}
+if (isset($_REQUEST['pid_array'])) {
+ $pid_array = $_REQUEST['pid_array'];
+}
+if (isset($_REQUEST['pid'])) {
+ $pid = $_REQUEST['pid'];
+}
global $pid;
if (!empty($NOTE)) {
$newlines = preg_split("/\r?\n/", $NOTE, -1);
- for ($k=0; $k<count($newlines); $k++) {
- if ($k==0 && count($newlines)>1) {
+ for ($k = 0; $k < count($newlines); $k++) {
+ if ($k == 0 && count($newlines) > 1) {
$newgedrec = "0 @XREF@ NOTE $newlines[$k]\n";
- } else if ($k==0) {
+ } else if ($k == 0) {
$newgedrec = "0 @XREF@ NOTE $newlines[$k]\n1 CONT\n";
} else {
$newgedrec .= "1 CONT $newlines[$k]\n";
@@ -64,16 +96,24 @@ if (!empty($NOTE)) {
}
}
-if (!empty($ABBR)) $newgedrec .= "1 ABBR $ABBR\n";
+if (!empty($ABBR)) {
+ $newgedrec .= "1 ABBR $ABBR\n";
+}
if (!empty($TITL)) {
- if (!empty($_HEB)) $newgedrec .= "2 _HEB $_HEB\n";
- if (!empty($ROMN)) $newgedrec .= "2 ROMN $ROMN\n";
+ if (!empty($_HEB)) {
+ $newgedrec .= "2 _HEB $_HEB\n";
+ }
+ if (!empty($ROMN)) {
+ $newgedrec .= "2 ROMN $ROMN\n";
+ }
+}
+if (!empty($AUTH)) {
+ $newgedrec .= "1 AUTH $AUTH\n";
}
-if (!empty($AUTH)) $newgedrec .= "1 AUTH $AUTH\n";
if (!empty($PUBL)) {
$newlines = preg_split("/\r?\n/", $PUBL, -1, PREG_SPLIT_NO_EMPTY);
foreach ($newlines as $k=>$line) {
- if ($k==0) {
+ if ($k == 0) {
$newgedrec .= "1 PUBL $line\n";
} else {
$newgedrec .= "2 CONT $line\n";
@@ -81,13 +121,15 @@ if (!empty($PUBL)) {
}
}
if (!empty($NOTE)) {
- if (!empty($CALN)) $newgedrec .= "2 CALN $CALN\n";
+ if (!empty($CALN)) {
+ $newgedrec .= "2 CALN $CALN\n";
+ }
}
if ($pid_array != '') {
$record = WT_GedcomRecord::createRecord($newgedrec, WT_GED_ID);
} else {
- $record='';
+ $record = '';
echo '<div class="indent">No individuals entered, close and try again </div>';
}
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php b/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php
index 27f2b19693..b28d9a34af 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_1_ctrl.php
@@ -35,7 +35,7 @@ $censyear = $censdate->date1->y;
$ctry = 'UK';
// === Set $married to "Not married as we only want the Birth name here" ===
-$married=-1;
+$married = -1;
$nam = $person->getAllNames();
if ($person->getDeathYear() == 0) {
@@ -48,9 +48,9 @@ if ($person->getBirthYear() == 0) {
} else {
$BirthYr = $person->getBirthYear();
}
-$fulln = rtrim($nam[0]['givn'],'*')." ".$nam[0]['surname'];
-$fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
-$fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
+$fulln = rtrim($nam[0]['givn'], '*') . " " . $nam[0]['surname'];
+$fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+$fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
$wholename = $fulln;
echo '<script src="', WT_STATIC_URL, WT_MODULES_DIR, 'GEDFact_assistant/_CENS/js/dynamicoptionlist.js"></script>';
@@ -75,18 +75,18 @@ echo '</div>';
//-- Census & Source Information Area =============================================
echo '<div class="cens_container">';
echo '<span >';
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/census_2_source_input.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/census_2_source_input.php';
echo '</span>';
//-- Proposed Census Text Area ================================================
echo '<span>';
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/census_4_text.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/census_4_text.php';
echo '</span>';
echo '</div>';
//-- Search and Add Family Members Area ==========================================
echo '<div class="optionbox cens_search" style="overflow:-moz-scrollbars-horizontal;overflow-x:hidden;overflow-y:scroll;">';
?><!--[if lte IE 7]><style>.cens_search{margin-top:-0.7em;}</style><![EndIf]--><?php
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/census_3_search_add.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/census_3_search_add.php';
echo '</div>';
//-- Census Text Input Area =======================================================
@@ -97,12 +97,12 @@ echo '</div>';
</div>
<div class="cens_textinput_right">
<?php echo WT_I18N::translate('Add'); ?>
- <input type="radio" name="totallyrad" value="0" checked="checked">
+ <input type="radio" name="totallyrad" value="0" checked>
</div>
<?php
//-- Census Add Rows Area =========================================================
echo '<div class="cens_addrows">';
- require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/census_5_input.php';
+ require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/census_5_input.php';
echo '</div>';
?>
</div>
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php b/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php
index 56f16b61ac..78ffb18e96 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_2_source_input.php
@@ -204,7 +204,8 @@ if (!defined('WT_WEBTREES')) {
var cendate = getCenDate(cenyear);
// Get Married Date from Input Fields and re-calculate Marital Condition ============
var tbl = document.getElementById('tblSample');
- for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
+ // start at i=1 because we need to avoid header
+ for (var i=1; i<tbl.rows.length; i++) {
var tr = tbl.rows[i];
for (var j=2; j<tr.cells.length; j++) {
if (j!=4 && j!=15) {
@@ -320,7 +321,8 @@ if (!defined('WT_WEBTREES')) {
var cendate = getCenDate(cenyear);
// Get Children born Array from Input Fields and re-calculate Born Alive Died Condition ============
var tbl = document.getElementById('tblSample');
- for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
+ // start at i=1 because we need to avoid header
+ for (var i=1; i<tbl.rows.length; i++) {
var tr = tbl.rows[i];
for (var j=2; j<tr.cells.length; j++) {
if (j!=73) {
@@ -394,7 +396,8 @@ if (!defined('WT_WEBTREES')) {
// Get Age from Input Fields and re-calculate =======================================
var tbl = document.getElementById('tblSample');
- for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
+ // start at i=1 because we need to avoid header
+ for (var i=1; i<tbl.rows.length; i++) {
var tr = tbl.rows[i];
for (var j=2; j<tr.cells.length; j++) {
if (j!=7 && j!=12) {
@@ -484,7 +487,7 @@ if (!defined('WT_WEBTREES')) {
}
var cens_ctry_a = document.getElementById('censCtry');
var cens_ctry = cens_ctry_a.value;
- document.getElementById('Titl').value = '<?php echo WT_I18N::translate('Census transcript'),' - ', WT_Filter::escapeJs($wholename), ' - ', WT_I18N::translate('Household'); ?>';
+ document.getElementById('Titl').value = '<?php echo WT_I18N::translate('Census transcript'), ' - ', WT_Filter::escapeJs($wholename), ' - ', WT_I18N::translate('Household'); ?>';
var prev = document.getElementById('prevYear');
prev.value = cenyear;
}
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
index 6583849c02..23b5da11b6 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php
@@ -21,7 +21,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-$controller = new WT_Controller_Simple();
+$controller = new WT_Controller_Simple;
$filter = WT_Filter::get('filter');
$action = WT_Filter::get('action');
@@ -66,30 +66,30 @@ echo "</td>";
echo "</table>";
echo "<br>";
-if ($action=="filter") {
+if ($action == "filter") {
$filter = trim($filter);
- $filter_array=explode(' ', preg_replace('/ {2,}/', ' ', $filter));
+ $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter));
// Output Individual for GEDFact Assistant ======================
echo "<table class=\"tabs_table width90\">";
- $myindilist=search_indis_names($filter_array, array(WT_GED_ID), 'AND');
+ $myindilist = search_indis_names($filter_array, array(WT_GED_ID), 'AND');
if ($myindilist) {
echo "<tr><td class=\"list_value_wrap\"><ul>";
usort($myindilist, array('WT_GedcomRecord', 'compare'));
- foreach ($myindilist as $indi ) {
+ foreach ($myindilist as $indi) {
$nam = $indi->getAllNames();
- $wholename = rtrim($nam[0]['givn'],'*')."&nbsp;".$nam[0]['surname'];
- $fulln = rtrim($nam[0]['givn'],'*')."&nbsp;".$nam[0]['surname'];
+ $wholename = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
+ $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
$fulln = str_replace('"', '\'', $fulln); // Replace double quotes
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
if (isset($nam[1])) {
- $fulmn = rtrim($nam[1]['givn'],'*')."&nbsp;".$nam[1]['surname'];
+ $fulmn = rtrim($nam[1]['givn'], '*') . "&nbsp;" . $nam[1]['surname'];
$fulmn = str_replace('"', '\'', $fulmn); // Replace double quotes
- $fulmn = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulmn);
- $fulmn = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulmn);
+ $fulmn = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulmn);
+ $fulmn = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulmn);
$marn = $nam[1]['surname'];
} else {
$fulmn = $fulln;
@@ -112,7 +112,7 @@ if ($action=="filter") {
//-- Build Indi Spouse Family to get marriage Date ----------
foreach ($indi->getSpouseFamilies() as $family) {
$marrdate = $family->getMarriageDate();
- $marrdate = ($marrdate->minJD()+$marrdate->maxJD())/2; // Julian
+ $marrdate = ($marrdate->minJD() + $marrdate->maxJD()) / 2; // Julian
$children = $family->getChildren();
}
if (!isset($marrdate)) { $marrdate = ""; }
@@ -122,19 +122,19 @@ if ($action=="filter") {
if (isset($children)) {
foreach ($children as $key=>$child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); // Child’s Full Name
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
if (!isset($chdob)) { $chdob = ""; }
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
if (!isset($chdod)) { $chdod = ""; }
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
- if ($chBLDarray && $indi->getSex()=="F") {
+ if ($chBLDarray && $indi->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
} else {
$chBLDarray = '';
@@ -145,24 +145,24 @@ if ($action=="filter") {
// NOTES = is equivalent to= function pasterow(id, nam, mnam, label, gend, cond, dom, dob, age, dod, occu, birthpl, fbirthpl, mbirthpl, chilBLD) {
// ==============================================================================================================================
echo "<a href=\"#\" onclick=\"window.opener.insertRowToTable(";
- echo "'".$indi->getXref()."', "; // id - Indi Id
- echo "'".addslashes(strip_tags($fulln))."', "; // nam - Name
- echo "'".addslashes(strip_tags($fulmn))."', "; // mnam - Married Name
+ echo "'" . $indi->getXref() . "', "; // id - Indi Id
+ echo "'" . addslashes(strip_tags($fulln)) . "', "; // nam - Name
+ echo "'" . addslashes(strip_tags($fulmn)) . "', "; // mnam - Married Name
echo "'-', "; // label - Relation to Head of Household
- echo "'".$indi->getSex()."', "; // gend - Sex
+ echo "'" . $indi->getSex() . "', "; // gend - Sex
echo "'S', "; // cond - Marital Condition
- echo "'".$marrdate."', "; // dom - Date of Marriage
- echo "'".(($indi->getBirthDate()->minJD() + $indi->getBirthDate()->maxJD())/2)."' ,"; // dob - Date of Birth
- echo "'".(1901-$indi->getbirthyear())."' ,"; // ~age~ - Census Date minus YOB (Preliminary)
- echo "'".(($indi->getDeathDate()->minJD() + $indi->getDeathDate()->maxJD())/2)."' ,"; // dod - Date of Death
+ echo "'" . $marrdate . "', "; // dom - Date of Marriage
+ echo "'" . (($indi->getBirthDate()->minJD() + $indi->getBirthDate()->maxJD()) / 2) . "' ,"; // dob - Date of Birth
+ echo "'" . (1901 - $indi->getbirthyear()) . "' ,"; // ~age~ - Census Date minus YOB (Preliminary)
+ echo "'" . (($indi->getDeathDate()->minJD() + $indi->getDeathDate()->maxJD()) / 2) . "' ,"; // dod - Date of Death
echo "'', "; // occu - Occupation
- echo "'".WT_Filter::escapeHtml($indi->getbirthplace())."', "; // birthpl - Birthplace
- echo "'".$FBP."', "; // fbirthpl - Father’s Birthplace
- echo "'".$MBP."', "; // mbirthpl - Mother’s Birthplace
- echo "'".$chBLDarray."'"; // chilBLD - Array of Children (name, birthdate, deathdate)
+ echo "'" . WT_Filter::escapeHtml($indi->getbirthplace()) . "', "; // birthpl - Birthplace
+ echo "'" . $FBP . "', "; // fbirthpl - Father’s Birthplace
+ echo "'" . $MBP . "', "; // mbirthpl - Mother’s Birthplace
+ echo "'" . $chBLDarray . "'"; // chilBLD - Array of Children (name, birthdate, deathdate)
echo ");";
echo "return false;\">";
- echo "<b>".$indi->getFullName()."</b>&nbsp;&nbsp;&nbsp;"; // Name Link
+ echo "<b>" . $indi->getFullName() . "</b>&nbsp;&nbsp;&nbsp;"; // Name Link
echo "</span><br><span class=\"list_item\">", WT_Gedcom_Tag::getLabel('BIRT', $indi), " ", $indi->getbirthyear(), "&nbsp;&nbsp;&nbsp;", $indi->getbirthplace(), "</span>";
echo "</a>";
echo "</li>";
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php
index 55df699418..8697e31870 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php
@@ -50,8 +50,8 @@ if (!defined('WT_WEBTREES')) {
</script>
<?php
echo "<input id=personid type=\"text\" size=\"20\" style=\"color: #000000;\" value=\"\">";
- echo "<a href=\"#\" onclick=\"findindi()\">" ;
- echo "&nbsp;&nbsp;".WT_I18N::translate('Search');
+ echo "<a href=\"#\" onclick=\"findindi()\">";
+ echo "&nbsp;&nbsp;" . WT_I18N::translate('Search');
echo '</a>';
?>
</td>
@@ -75,7 +75,7 @@ if (!defined('WT_WEBTREES')) {
<?php
// Header text with "Head" button =================================================
$headImg = '<i class="headimg vmiddle icon-button_head"></i>';
- $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="'.WT_I18N::translate('Click to choose individual as head of family.').'"></i>';
+ $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="' . WT_I18N::translate('Click to choose individual as head of family.') . '"></i>';
echo WT_I18N::translate('Click %s to choose individual as head of family.', $headImg);
?>
</td>
@@ -94,13 +94,13 @@ if (!defined('WT_WEBTREES')) {
$chBLDarray = Array();
foreach ($family->getChildren() as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
@@ -108,7 +108,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getHusband()) {
//-- Parents Husbands Parents --------------------------------------
- $gparent=$family->getHusband();
+ $gparent = $family->getHusband();
foreach ($gparent->getChildFamilies() as $cfamily) {
$phusb = $cfamily->getHusband();
$pwife = $cfamily->getWife();
@@ -119,14 +119,14 @@ if (!defined('WT_WEBTREES')) {
//-- Parents Husbands Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -142,14 +142,14 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value" style="text-decoration:none;" >
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
</td>
<td align="left" class="facts_value nowrap">
<a href='#' onclick='insertRowToTable("<?php
- echo $gparent->getXref() ; // pid = PID
+ echo $gparent->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -167,21 +167,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0) {
+ if ($married >= 0) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -199,13 +199,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Husband Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -217,7 +217,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getWife()) {
//-- Parents Wifes Parent Family ---------------------------
- $gparent=$family->getWife();
+ $gparent = $family->getWife();
$cfamily = null;
foreach ($gparent->getChildFamilies() as $cfamily) {
$phusb = $cfamily->getHusband();
@@ -229,25 +229,25 @@ if (!defined('WT_WEBTREES')) {
//-- Wifes Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
$husbnam = null;
// Get wifes married name if available
if ($cfamily && $cfamily->getHusband()) {
$husbnams = $cfamily->getHusband()->getAllNames();
- if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") {
+ if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") {
// if Husband or his name is not known then use wifes birth name
$husbnam = $nam[0]['surname'];
} else {
$husbnam = $husbnams[0]['surname'];
}
}
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam;
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam;
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -262,7 +262,7 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
@@ -287,21 +287,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0 && isset($nam[1])) {
+ if ($married >= 0 && isset($nam[1])) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -319,13 +319,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Wife Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -339,40 +339,40 @@ if (!defined('WT_WEBTREES')) {
foreach ($family->getChildren() as $child) {
// Get Child’s Children’s Name DOB DOD ----
- $chBLDarray=Array();
+ $chBLDarray = Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name// Child’s Full Name
- $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
// Get child’s marriage status ----
- $married="";
- $marrdate="";
+ $married = "";
+ $marrdate = "";
foreach ($child->getSpouseFamilies() as $childfamily) {
- $marrdate=$childfamily->getMarriageDate();
+ $marrdate = $childfamily->getMarriageDate();
$married = WT_Date::Compare($censdate, $marrdate);
}
$nam = $child->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- $chfulmn=null;
+ $chfulmn = null;
$chnam = $child->getAllNames();
- for ($i=0; $i<count($nam); $i++) {
- if ($chnam[$i]['type']=='_MARNM') {
- $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($chnam[$i]['type'] == '_MARNM') {
+ $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $child);
@@ -388,7 +388,7 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$child->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
@@ -416,21 +416,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $child->getSex(); // gend = Gender
?>", "<?php
- if ($married>0) {
+ if ($married > 0) {
echo "M"; // cond = Condition (Married)
- } else if ($married<0 || ($married=="0") ) {
+ } else if ($married < 0 || ($married == "0")) {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -448,7 +448,7 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $child->getSex()=="F") {
+ if (isset($chBLDarray) && $child->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
@@ -478,13 +478,13 @@ if (!defined('WT_WEBTREES')) {
$chBLDarray = Array();
foreach ($family->getChildren() as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
@@ -492,7 +492,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getHusband()) {
//-- Step Husbands Parent Family --------------------------------------
- $gparent=$family->getHusband();
+ $gparent = $family->getHusband();
foreach ($gparent->getChildFamilies() as $cfamily) {
$phusb = $cfamily->getHusband();
$pwife = $cfamily->getWife();
@@ -503,14 +503,14 @@ if (!defined('WT_WEBTREES')) {
//-- Step Husbands Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -527,7 +527,7 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
@@ -552,21 +552,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0) {
+ if ($married >= 0) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -584,13 +584,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Step Husband Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -602,7 +602,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getWife()) {
//-- Step Wifes Parent Family --------------------------------------
- $gparent=$family->getWife();
+ $gparent = $family->getWife();
$cfamily = null;
foreach ($gparent->getChildFamilies() as $cfamily) {
$phusb = $cfamily->getHusband();
@@ -614,25 +614,25 @@ if (!defined('WT_WEBTREES')) {
//-- Step Wifes Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
$husbnam = null;
// Get wifes married name if available
if ($cfamily && $cfamily->getHusband()) {
$husbnams = $cfamily->getHusband()->getAllNames();
- if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") {
+ if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") {
// if Husband or his name is not known then use wifes birth name
$husbnam = $nam[0]['surname'];
} else {
$husbnam = $husbnams[0]['surname'];
}
}
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam;
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam;
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -649,14 +649,14 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
</td>
<td align="left" class="facts_value nowrap">
<a href='#' onclick='insertRowToTable("<?php
- echo $gparent->getXref() ; // pid = PID
+ echo $gparent->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -666,7 +666,7 @@ if (!defined('WT_WEBTREES')) {
echo WT_Filter::escapeHtml($fulln); // mnam = Full Name
}
?>", "<?php
- if ($person ===$gparent) {
+ if ($person === $gparent) {
echo 'head';
} else {
echo WT_Filter::escapeHtml($label);
@@ -674,21 +674,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0 && isset($nam[1])) {
+ if ($married >= 0 && isset($nam[1])) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -706,13 +706,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Step Wife Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -724,33 +724,33 @@ if (!defined('WT_WEBTREES')) {
foreach ($family->getChildren() as $child) {
// Get Child’s Children
- $chBLDarray=Array();
+ $chBLDarray = Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name
- $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
$nam = $child->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- $chfulmn=null;
+ $chfulmn = null;
$chnam = $child->getAllNames();
- for ($i=0; $i<count($nam); $i++) {
- if ($chnam[$i]['type']=='_MARNM') {
- $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($chnam[$i]['type'] == '_MARNM') {
+ $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $child);
@@ -767,7 +767,7 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$child->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
@@ -777,7 +777,7 @@ if (!defined('WT_WEBTREES')) {
if (($child->canShow())) {
?>
<a href='#' onclick='insertRowToTable("<?php
- echo $child->getXref() ; // pid = PID
+ echo $child->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -798,14 +798,14 @@ if (!defined('WT_WEBTREES')) {
echo ""; // cond = Condition (Married or Single)
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -823,13 +823,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $child->getSex()=="F") {
+ if (isset($chBLDarray) && $child->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $child->getFullName(); // Full Name (Link)
+ echo $child->getFullName(); // Full Name (Link)
?>
</a>
<?php
@@ -853,13 +853,13 @@ if (!defined('WT_WEBTREES')) {
$chBLDarray = Array();
foreach ($family->getChildren() as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
@@ -867,7 +867,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getHusband()) {
//-- Spouse Husbands Parents --------------------------------------
- $gparent=$family->getHusband();
+ $gparent = $family->getHusband();
foreach ($gparent->getChildFamilies() as $cfamily) {
$phusb = $cfamily->getHusband();
$pwife = $cfamily->getWife();
@@ -878,14 +878,14 @@ if (!defined('WT_WEBTREES')) {
//-- Spouse Husbands Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -902,14 +902,14 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
</td>
<td align="left" class="facts_value nowrap">
<a href='#' onclick='insertRowToTable("<?php
- echo $gparent->getXref() ; // pid = PID
+ echo $gparent->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -927,21 +927,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0) {
+ if ($married >= 0) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -959,13 +959,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Husband Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -977,7 +977,7 @@ if (!defined('WT_WEBTREES')) {
if ($family->getWife()) {
//-- Spouse Wifes Parents --------------------------------------
- $gparent=$family->getWife();
+ $gparent = $family->getWife();
$cfamily = null;
foreach ($gparent->getChildFamilies() as $cfamily) {
$husb = $cfamily->getHusband();
@@ -989,25 +989,25 @@ if (!defined('WT_WEBTREES')) {
//-- Spouse Wifes Details --------------------------------------
$married = WT_Date::Compare($censdate, $marrdate);
$nam = $gparent->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
$husbnam = null;
// Get wifes married name if available
if ($cfamily && $cfamily->getHusband()) {
$husbnams = $cfamily->getHusband()->getAllNames();
- if ($husbnams[0]['surname']=="@N.N." || $husbnams[0]['surname']=="") {
+ if ($husbnams[0]['surname'] == "@N.N." || $husbnams[0]['surname'] == "") {
// if Husband or his name is not known then use wifes birth name
$husbnam = $nam[0]['surname'];
} else {
$husbnam = $husbnams[0]['surname'];
}
}
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $husbnam;
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $husbnam;
}
}
$label = get_close_relationship_name($person, $gparent);
@@ -1024,14 +1024,14 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$gparent->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $gparent->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
</td>
<td align="left" class="facts_value nowrap">
<a href='#' onclick='insertRowToTable("<?php
- echo $gparent->getXref() ; // pid = PID
+ echo $gparent->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -1049,21 +1049,21 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $gparent->getSex(); // gend = Gender
?>", "<?php
- if ($married>=0 && isset($nam[1])) {
+ if ($married >= 0 && isset($nam[1])) {
echo "M"; // cond = Condition (Married)
} else {
echo "S"; // cond = Condition (Single)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($gparent->getBirthDate()->minJD()+$gparent->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($gparent->getBirthDate()->minJD() + $gparent->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$gparent->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $gparent->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($gparent->getDeathDate()->minJD()+$gparent->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($gparent->getDeathDate()->minJD() + $gparent->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -1081,13 +1081,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Wife Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $gparent->getSex()=="F") {
+ if (isset($chBLDarray) && $gparent->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $gparent->getFullName(); // Full Name (Link)
+ echo $gparent->getFullName(); // Full Name (Link)
?>
</a>
</td>
@@ -1098,42 +1098,42 @@ if (!defined('WT_WEBTREES')) {
foreach ($family->getChildren() as $child) {
// Get Spouse child’s marriage status
- $married="";
- $marrdate="";
+ $married = "";
+ $marrdate = "";
foreach ($child->getSpouseFamilies() as $childfamily) {
- $marrdate=$childfamily->getMarriageDate();
+ $marrdate = $childfamily->getMarriageDate();
$married = WT_Date::Compare($censdate, $marrdate);
}
// Get Child’s Children
- $chBLDarray=Array();
+ $chBLDarray = Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
$chfulln = WT_Filter::escapeHtml($chfulln); // Child’s Full Name// Child’s Full Name
- $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
// Get Spouse child’s details
$nam = $child->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $givn = rtrim($nam[0]['givn'],'*');
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $givn = rtrim($nam[0]['givn'], '*');
$surn = $nam[0]['surname'];
- $chfulmn=null;
+ $chfulmn = null;
$chnam = $child->getAllNames();
- for ($i=0; $i<count($nam); $i++) {
- if ($chnam[$i]['type']=='_MARNM') {
- $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $chnam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($chnam[$i]['type'] == '_MARNM') {
+ $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $chnam[$i]['surname'];
}
}
$label = get_close_relationship_name($person, $child);
@@ -1148,7 +1148,7 @@ if (!defined('WT_WEBTREES')) {
</td>
<td align="left" class="facts_value">
<?php
- echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=".$child->getXref()."&amp;gedcom=".WT_GEDURL."\">";
+ echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
echo $headImg2;
echo "</a>";
?>
@@ -1158,7 +1158,7 @@ if (!defined('WT_WEBTREES')) {
if (($child->canShow())) {
?>
<a href='#' onclick='insertRowToTable("<?php
- echo $child->getXref() ; // pid = PID
+ echo $child->getXref(); // pid = PID
?>", "<?php
echo WT_Filter::escapeHtml($fulln); // nam = Full Name
?>", "<?php
@@ -1176,23 +1176,23 @@ if (!defined('WT_WEBTREES')) {
?>", "<?php
echo $child->getSex(); // gend = Gender
?>", "<?php
- if ($married>0) {
+ if ($married > 0) {
echo "M"; // cond = Condition (Married)
- } else if ($married<0 || ($married=="0") ) {
+ } else if ($married < 0 || ($married == "0")) {
echo "S"; // cond = Condition (Single)
} else {
echo ""; // cond = Condition (Not Known)
}
?>", "<?php
if ($marrdate) {
- echo ($marrdate->minJD()+$marrdate->maxJD())/2; // dom = Date of Marriage (Julian)
+ echo ($marrdate->minJD() + $marrdate->maxJD()) / 2; // dom = Date of Marriage (Julian)
}
?>", "<?php
- echo ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // dob = Date of Birth (Julian)
+ echo ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // dob = Date of Birth (Julian)
?>", "<?php
- echo $censyear-$child->getbirthyear(); // age = Census Date minus YOB
+ echo $censyear - $child->getbirthyear(); // age = Census Date minus YOB
?>", "<?php
- echo ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // dod = Date of Death (Julian)
+ echo ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // dod = Date of Death (Julian)
?>", "<?php
echo ""; // occu = Occupation
?>", "<?php
@@ -1210,13 +1210,13 @@ if (!defined('WT_WEBTREES')) {
echo 'UNK, UNK, UNK, UNK'; // mbirthpl = Child Mother’s Place of Birth Not known
}
?>", "<?php
- if (isset($chBLDarray) && $child->getSex()=="F") {
+ if (isset($chBLDarray) && $child->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
echo $chBLDarray; // Array of Children (name, birthdate, deathdate)
}
?>");'>
<?php
- echo $child->getFullName(); // Full Name (Link)
+ echo $child->getFullName(); // Full Name (Link)
?>
</a>
<?php
@@ -1253,9 +1253,9 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent;
global $natdad, $natmom, $censyear;
- $person=WT_Individual::getInstance($pid);
+ $person = WT_Individual::getInstance($pid);
- $tmp = array('M'=>'','F'=>'F', 'U'=>'NN');
+ $tmp = array('M'=>'', 'F'=>'F', 'U'=>'NN');
$isF = $tmp[$person->getSex()];
$spouselinks = '';
$parentlinks = '';
@@ -1264,20 +1264,20 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
if ($person->canShowName()) {
//-- draw a box for the family popup
- if ($TEXT_DIRECTION=="rtl") {
+ if ($TEXT_DIRECTION == "rtl") {
$spouselinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" .$person->getFullName(). ")<br>";
+ $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>";
$parentlinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
$step_parentlinks .= "<table class=\"rtlnav person_box$isF\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
} else {
$spouselinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" .$person->getFullName(). ")<br>";
+ $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>";
$parentlinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
$step_parentlinks .= "<table class=\"ltrnav person_box$isF\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
- $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
}
$persons = '';
@@ -1296,13 +1296,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$chBLDarray = Array();
foreach ($children as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2;
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2;
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2;
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2;
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
@@ -1311,7 +1311,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
if ($husb || $children) {
if ($husb) {
// Parent Husbands Parents
- $gparent=WT_Individual::getInstance($husb->getXref());
+ $gparent = WT_Individual::getInstance($husb->getXref());
$parfams = $gparent->getChildFamilies();
foreach ($parfams as $pfamily) {
$phusb = $pfamily->getHusband();
@@ -1324,54 +1324,54 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$person_parent = 'Yes';
if ($husb->canShowName()) {
$nam = $husb->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
- $parentlinks .= "'".$husb->getXref()."',"; // pid = PID
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name
+ $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name
if (isset($fulmn)) {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Married Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Married Name
} else {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name
}
- if ($currpid=="Wife" || $currpid=="Husband") {
+ if ($currpid == "Wife" || $currpid == "Husband") {
$parentlinks .= "'Father in Law',"; // label = 1st Gen Male Relationship
} else {
$parentlinks .= "'Grand-Father',"; // label = 2st Gen Male Relationship
}
- $parentlinks .= "'".$husb->getSex()."',"; // sex = Gender
- $parentlinks .= "''".","; // cond = Condition (Married etc)
+ $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender
+ $parentlinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian)
+ $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian)
}
- $parentlinks .= "'".(($husb->getBirthDate()->minJD()+$husb->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth
- if ($husb->getbirthyear()>=1) {
- $parentlinks .= "'".($censyear-$husb->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $parentlinks .= "'" . (($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth
+ if ($husb->getbirthyear() >= 1) {
+ $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $parentlinks .= "''".","; // age = Undefined
+ $parentlinks .= "''" . ","; // age = Undefined
}
- $parentlinks .= "'".(($husb->getDeathDate()->minJD()+$husb->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $parentlinks .= "''".","; // occu = Occupation
- $parentlinks .= "'".WT_Filter::escapeHtml($husb->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $parentlinks .= "'" . (($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $parentlinks .= "''" . ","; // occu = Occupation
+ $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($pHusbFBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pHusbFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace
}
if (isset($pHusbMBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pHusbMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace
}
- if (isset($chBLDarray) && $husb->getSex()=="F") {
+ if (isset($chBLDarray) && $husb->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$parentlinks .= "''";
}
@@ -1399,59 +1399,59 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
}
// Parent Wifes Details
- $person_parent="Yes";
+ $person_parent = "Yes";
if ($wife->canShowName()) {
$nam = $wife->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
- $parentlinks .= "'".$wife->getXref()."',"; // pid = PID
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',";
+ $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
if (isset($fulmn)) {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',";
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',";
} else {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',";
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
}
- if ($currpid=="Wife" || $currpid=="Husband") {
+ if ($currpid == "Wife" || $currpid == "Husband") {
$parentlinks .= "'Mother in Law',"; // label = 1st Gen Female Relationship
} else {
$parentlinks .= "'Grand-Mother',"; // label = 2st Gen Female Relationship
}
- $parentlinks .= "'".$wife->getSex()."',"; // sex = Gender
- $parentlinks .= "''".","; // cond = Condition (Married etc)
+ $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender
+ $parentlinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian)
+ $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian)
}
- $parentlinks .= "'".(($wife->getBirthDate()->minJD()+$wife->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth
- if ($wife->getbirthyear()>=1) {
- $parentlinks .= "'".($censyear-$wife->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth
+ if ($wife->getbirthyear() >= 1) {
+ $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $parentlinks .= "''".","; // age = Undefined
+ $parentlinks .= "''" . ","; // age = Undefined
}
- $parentlinks .= "'".(($wife->getDeathDate()->minJD()+$wife->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $parentlinks .= "''".","; // occu = Occupation
- $parentlinks .= "'".WT_Filter::escapeHtml($wife->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $parentlinks .= "''" . ","; // occu = Occupation
+ $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($pWifeFBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pWifeFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known
}
if (isset($pWifeMBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pWifeMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known
}
- if (isset($chBLDarray) && $wife->getSex()=="F") {
+ if (isset($chBLDarray) && $wife->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$parentlinks .= "''";
}
@@ -1478,13 +1478,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$chBLDarray = Array();
foreach ($children as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2;
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2;
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2;
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2;
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
@@ -1495,7 +1495,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
if (($husb || $children) && $husb !== $person) {
if ($husb) {
// Step Husbands Parents
- $gparent=WT_Individual::getInstance($husb->getXref());
+ $gparent = WT_Individual::getInstance($husb->getXref());
$parfams = $gparent->getChildFamilies();
foreach ($parfams as $pfamily) {
$phusb = $pfamily->getHusband();
@@ -1507,54 +1507,54 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$person_step = 'Yes';
if ($husb->canShowName()) {
$nam = $husb->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
- $parentlinks .= "'".$husb->getXref()."',"; // pid = PID
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name
+ $parentlinks .= "'" . $husb->getXref() . "',"; // pid = PID
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name
if (isset($fulmn)) {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Married Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Married Name
} else {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name
}
- if ($currpid=="Wife" || $currpid=="Husband") {
+ if ($currpid == "Wife" || $currpid == "Husband") {
$parentlinks .= "'Step Father-in-Law',"; // label = 1st Gen Male Relationship
} else {
$parentlinks .= "'Step Grand-Father',"; // label = 2st Gen Male Relationship
}
- $parentlinks .= "'".$husb->getSex()."',"; // sex = Gender
- $parentlinks .= "''".","; // cond = Condition (Married etc)
+ $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender
+ $parentlinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian)
+ $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian)
}
- $parentlinks .= "'".(($husb->getBirthDate()->minJD()+$husb->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth
- if ($husb->getbirthyear()>=1) {
- $parentlinks .= "'".($censyear-$husb->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $parentlinks .= "'" . (($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth
+ if ($husb->getbirthyear() >= 1) {
+ $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $parentlinks .= "''".","; // age = Undefined
+ $parentlinks .= "''" . ","; // age = Undefined
}
- $parentlinks .= "'".(($husb->getDeathDate()->minJD()+$husb->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $parentlinks .= "''".","; // occu = Occupation
- $parentlinks .= "'".WT_Filter::escapeHtml($husb->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $parentlinks .= "'" . (($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $parentlinks .= "''" . ","; // occu = Occupation
+ $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($pHusbFBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pHusbFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace
}
if (isset($pHusbMBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pHusbMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace
}
- if (isset($chBLDarray) && $husb->getSex()=="F") {
+ if (isset($chBLDarray) && $husb->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$parentlinks .= "''";
}
@@ -1575,7 +1575,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
if ($wife || $children) {
if ($wife) {
// Step Wifes Parents
- $gparent=WT_Individual::getInstance($wife->getXref());
+ $gparent = WT_Individual::getInstance($wife->getXref());
$parfams = $gparent->getChildFamilies();
foreach ($parfams as $pfamily) {
$pwhusb = $pfamily->getHusband();
@@ -1587,56 +1587,56 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$person_step = 'Yes';
if ($wife->canShowName()) {
$nam = $wife->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM') {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM') {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
}
}
$parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
- $parentlinks .= "'".$wife->getXref()."',"; // pid = PID
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name
+ $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name
if (isset($fulmn)) {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',"; // mnam = Full Married Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',"; // mnam = Full Married Name
} else {
- $parentlinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name
+ $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name
}
- if ($currpid=="Wife" || $currpid=="Husband") {
+ if ($currpid == "Wife" || $currpid == "Husband") {
$parentlinks .= "'Step Mother-in-Law',"; // label = 1st Gen Female Relationship
} else {
$parentlinks .= "'Step Grand-Mother',"; // label = 2st Gen Female Relationship
}
- $parentlinks .= "'".$wife->getSex()."',"; // sex = Gender
- $parentlinks .= "''".","; // cond = Condition (Married etc)
+ $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender
+ $parentlinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $parentlinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian)
+ $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian)
}
- $parentlinks .= "'".(($wife->getBirthDate()->minJD()+$wife->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth
- if ($wife->getbirthyear()>=1) {
- $parentlinks .= "'".($censyear-$wife->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth
+ if ($wife->getbirthyear() >= 1) {
+ $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $parentlinks .= "''".","; // age = Undefined
+ $parentlinks .= "''" . ","; // age = Undefined
}
- $parentlinks .= "'".(($wife->getDeathDate()->minJD()+$wife->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $parentlinks .= "''".","; // occu = Occupation
- $parentlinks .= "'".WT_Filter::escapeHtml($wife->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $parentlinks .= "''" . ","; // occu = Occupation
+ $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($pWifeFBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pWifeFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known
}
if (isset($pWifeMBP)) {
- $parentlinks .= "'".WT_Filter::escapeHtml($pWifeMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $parentlinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known
+ $parentlinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known
}
- if (isset($chBLDarray) && $wife->getSex()=="F") {
+ if (isset($chBLDarray) && $wife->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $parentlinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $parentlinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$parentlinks .= "''";
}
@@ -1663,13 +1663,13 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$chBLDarray = Array();
foreach ($children as $child) {
$chnam = $child->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); // Child’s Full Name
- $chdob = ($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name
+ $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
@@ -1679,7 +1679,7 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
if ($spouse) {
// Spouse Parents
- $gparent=WT_Individual::getInstance($spouse->getXref());
+ $gparent = WT_Individual::getInstance($spouse->getXref());
$spousefams = $gparent->getChildFamilies();
foreach ($spousefams as $pfamily) {
$phusb = $pfamily->getHusband();
@@ -1691,67 +1691,67 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
// Spouse Details
if ($spouse->canShowName()) {
$nam = $spouse->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
// If spouse is a wife, then get her married name or default to her birth name
- for ($i=0; $i<count($nam); $i++) {
- if ($nam[$i]['type']=='_MARNM' && $is_wife) {
- $fulmn = rtrim($nam[$i]['givn'],'*') . ' ' . $nam[$i]['surname'];
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($nam[$i]['type'] == '_MARNM' && $is_wife) {
+ $fulmn = rtrim($nam[$i]['givn'], '*') . ' ' . $nam[$i]['surname'];
} else {
$fulmn = $fulln;
}
}
$spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable(";
- $spouselinks .= "'".$spouse->getXref()."',"; // pid = PID
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',";
+ $spouselinks .= "'" . $spouse->getXref() . "',"; // pid = PID
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
if (isset($fulmn)) {
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulmn))."',";
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',";
} else {
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',";
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
}
- if ($currpid=="Son" || $currpid=="Daughter") {
- if ($spouse->getSex()=="M") {
+ if ($currpid == "Son" || $currpid == "Daughter") {
+ if ($spouse->getSex() == "M") {
$spouselinks .= "'Son in Law',"; // label = Male Relationship
} else {
$spouselinks .= "'Daughter in Law',"; // label = Female Relationship
}
} else {
- if ($spouse->getSex()=="M") {
+ if ($spouse->getSex() == "M") {
$spouselinks .= "'Brother in Law',"; // label = Male Relationship
} else {
$spouselinks .= "'Sister in Law',"; // label = Female Relationship
}
}
- $spouselinks .= "'".$spouse->getSex()."',"; // sex = Gender
- $spouselinks .= "''".","; // cond = Condition (Married etc)
+ $spouselinks .= "'" . $spouse->getSex() . "',"; // sex = Gender
+ $spouselinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $spouselinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',";
+ $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',";
}
- $spouselinks .= "'".(($spouse->getBirthDate()->minJD()+$spouse->getBirthDate()->maxJD())/2)."',";
- if ($spouse->getbirthyear()>=1) {
- $spouselinks .= "'".($censyear-$spouse->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $spouselinks .= "'" . (($spouse->getBirthDate()->minJD() + $spouse->getBirthDate()->maxJD()) / 2) . "',";
+ if ($spouse->getbirthyear() >= 1) {
+ $spouselinks .= "'" . ($censyear - $spouse->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $spouselinks .= "''".","; // age = Undefined
+ $spouselinks .= "''" . ","; // age = Undefined
}
- $spouselinks .= "'".(($spouse->getDeathDate()->minJD()+$spouse->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $spouselinks .= "''".","; // occu = Occupation
- $spouselinks .= "'".WT_Filter::escapeHtml($spouse->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $spouselinks .= "'" . (($spouse->getDeathDate()->minJD() + $spouse->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $spouselinks .= "''" . ","; // occu = Occupation
+ $spouselinks .= "'" . WT_Filter::escapeHtml($spouse->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($pSpouseFBP)) {
- $spouselinks .= "'".WT_Filter::escapeHtml($pSpouseFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known
+ $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known
}
if (isset($pSpouseMBP)) {
- $spouselinks .= "'".WT_Filter::escapeHtml($pSpouseMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known
+ $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known
}
- if (isset($chBLDarray) && $spouse->getSex()=="F") {
+ if (isset($chBLDarray) && $spouse->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $spouselinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$spouselinks .= "''";
}
@@ -1771,10 +1771,10 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
// Children
$spouselinks .= "<ul class=\"clist\">";
foreach ($children as $child) {
- $persons="Yes";
+ $persons = "Yes";
// Child’s Parents
- $gparent=WT_Individual::getInstance($child->getXref());
+ $gparent = WT_Individual::getInstance($child->getXref());
foreach ($gparent->getChildFamilies() as $family) {
$husb = $family->getHusband();
$wife = $family->getWife();
@@ -1783,18 +1783,18 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
}
// Child’s Children
- $chBLDarray=Array();
+ $chBLDarray = Array();
foreach ($child->getSpouseFamilies() as $childfamily) {
$chchildren = $childfamily->getChildren();
foreach ($chchildren as $chchild) {
$chnam = $chchild->getAllNames();
- $chfulln = rtrim($chnam[0]['givn'],'*')." ".$chnam[0]['surname'];
+ $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
$chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here
- $chfulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $chfulln);
- $chfulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $chfulln); // Child’s Full Name
- $chdob = ($chchild->getBirthDate()->minJD()+$chchild->getBirthDate()->maxJD())/2; // Child’s Date of Birth (Julian)
- $chdod = ($chchild->getDeathDate()->minJD()+$chchild->getDeathDate()->maxJD())/2; // Child’s Date of Death (Julian)
- $chBLD = ($chfulln.", ".$chdob.", ".$chdod);
+ $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
+ $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name
+ $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian)
+ $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian)
+ $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod);
array_push($chBLDarray, $chBLD);
}
}
@@ -1812,75 +1812,75 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) {
$spouselinks .= '<li>';
if ($child->canShowName()) {
$nam = $child->getAllNames();
- $fulln = rtrim($nam[0]['givn'],'*') . ' ' . $nam[0]['surname'];
- $fulln = str_replace("@N.N.", "(".WT_I18N::translate('unknown').")", $fulln);
- $fulln = str_replace("@P.N.", "(".WT_I18N::translate('unknown').")", $fulln);
+ $fulln = rtrim($nam[0]['givn'], '*') . ' ' . $nam[0]['surname'];
+ $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
+ $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
// Get childs married name if available
- $chfulmn=null;
+ $chfulmn = null;
$chnam = $child->getAllNames();
- if ($chhusbnam[0]['surname']=="@N.N." || $chhusbnam[0]['surname']=="") {
+ if ($chhusbnam[0]['surname'] == "@N.N." || $chhusbnam[0]['surname'] == "") {
// if Husband or his name is not known then use wifes birth name
$husbnam = $nam[0]['surname'];
} else {
$husbnam = $chhusbnam[0]['surname'];
}
- for ($i=0; $i<count($nam); $i++) {
- if ($chnam[$i]['type']=='_MARNM') {
- $chfulmn = rtrim($chnam[$i]['givn'],'*') . ' ' . $husbnam;
+ for ($i = 0; $i < count($nam); $i++) {
+ if ($chnam[$i]['type'] == '_MARNM') {
+ $chfulmn = rtrim($chnam[$i]['givn'], '*') . ' ' . $husbnam;
}
}
$spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable(";
- $spouselinks .= "'".$child->getXref()."',";
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // nam = Name
+ $spouselinks .= "'" . $child->getXref() . "',";
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // nam = Name
if (isset($chfulmn)) {
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($chfulmn))."',"; // mnam = Full Married Name
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($chfulmn)) . "',"; // mnam = Full Married Name
} else {
- $spouselinks .= "'".WT_Filter::escapeHtml(strip_tags($fulln))."',"; // mnam = Full Name
+ $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',"; // mnam = Full Name
}
- if ($currpid=="Son" || $currpid=="Daughter") {
- if ($child->getSex()=="M") {
+ if ($currpid == "Son" || $currpid == "Daughter") {
+ if ($child->getSex() == "M") {
$spouselinks .= "'Grand-Son',"; // label = Male Relationship
} else {
$spouselinks .= "'Grand-Daughter',"; // label = Female Relationship
}
} else {
- if ($child->getSex()=="M") {
+ if ($child->getSex() == "M") {
$spouselinks .= "'Nephew',"; // label = Male Relationship
} else {
$spouselinks .= "'Niece',"; // label = Female Relationship
}
}
- $spouselinks .= "'".$child->getSex()."',"; // sex = Gender
- $spouselinks .= "''".","; // cond = Condition (Married etc)
+ $spouselinks .= "'" . $child->getSex() . "',"; // sex = Gender
+ $spouselinks .= "''" . ","; // cond = Condition (Married etc)
if ($marrdate) {
- $spouselinks .= "'".(($marrdate->minJD()+$marrdate->maxJD())/2)."',"; // dom = Date of Marriage (Julian)
+ $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian)
} else {
- $spouselinks .= "'nm'".",";
+ $spouselinks .= "'nm'" . ",";
}
- $spouselinks .= "'".(($child->getBirthDate()->minJD()+$child->getBirthDate()->maxJD())/2)."',"; // dob = Date of Birth
- if ($child->getbirthyear()>=1) {
- $spouselinks .= "'".($censyear-$child->getbirthyear())."',"; // age = Census Year - Year of Birth
+ $spouselinks .= "'" . (($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth
+ if ($child->getbirthyear() >= 1) {
+ $spouselinks .= "'" . ($censyear - $child->getbirthyear()) . "',"; // age = Census Year - Year of Birth
} else {
- $spouselinks .= "''".","; // age = Undefined
+ $spouselinks .= "''" . ","; // age = Undefined
}
- $spouselinks .= "'".(($child->getDeathDate()->minJD()+$child->getDeathDate()->maxJD())/2)."',"; // dod = Date of Death
- $spouselinks .= "''".","; // occu = Occupation
- $spouselinks .= "'".WT_Filter::escapeHtml($child->getBirthPlace())."'".","; // birthpl = Individuals Birthplace
+ $spouselinks .= "'" . (($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death
+ $spouselinks .= "''" . ","; // occu = Occupation
+ $spouselinks .= "'" . WT_Filter::escapeHtml($child->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace
if (isset($ChildFBP)) {
- $spouselinks .= "'".WT_Filter::escapeHtml($ChildFBP)."'".","; // fbirthpl = Fathers Birthplace
+ $spouselinks .= "'" . WT_Filter::escapeHtml($ChildFBP) . "'" . ","; // fbirthpl = Fathers Birthplace
} else {
- $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // fbirthpl = Fathers Birthplace Not Known
+ $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // fbirthpl = Fathers Birthplace Not Known
}
if (isset($ChildMBP)) {
- $spouselinks .= "'".WT_Filter::escapeHtml($ChildMBP)."'".","; // mbirthpl = Mothers Birthplace
+ $spouselinks .= "'" . WT_Filter::escapeHtml($ChildMBP) . "'" . ","; // mbirthpl = Mothers Birthplace
} else {
- $spouselinks .= "'UNK, UNK, UNK, UNK'".","; // mbirthpl = Mothers Birthplace Not Known
+ $spouselinks .= "'UNK, UNK, UNK, UNK'" . ","; // mbirthpl = Mothers Birthplace Not Known
}
- if (isset($chBLDarray) && $child->getSex()=="F") {
+ if (isset($chBLDarray) && $child->getSex() == "F") {
$chBLDarray = implode("::", $chBLDarray);
- $spouselinks .= "'".$chBLDarray."'"; // Array of Children (name, birthdate, deathdate)
+ $spouselinks .= "'" . $chBLDarray . "'"; // Array of Children (name, birthdate, deathdate)
} else {
$spouselinks .= "''";
}
diff --git a/modules_v3/GEDFact_assistant/_CENS/census_5_input.php b/modules_v3/GEDFact_assistant/_CENS/census_5_input.php
index e28664b75a..ff2de42f3e 100644
--- a/modules_v3/GEDFact_assistant/_CENS/census_5_input.php
+++ b/modules_v3/GEDFact_assistant/_CENS/census_5_input.php
@@ -23,7 +23,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-require WT_ROOT.WT_MODULES_DIR.'GEDFact_assistant/_CENS/js/census_5_input.js.php';
+require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_CENS/js/census_5_input.js.php';
?>
<div class="cens_data">
diff --git a/modules_v3/GEDFact_assistant/_CENS/js/census_5_input.js.php b/modules_v3/GEDFact_assistant/_CENS/js/census_5_input.js.php
index ca47ba8df2..5557c2ddbd 100644
--- a/modules_v3/GEDFact_assistant/_CENS/js/census_5_input.js.php
+++ b/modules_v3/GEDFact_assistant/_CENS/js/census_5_input.js.php
@@ -219,7 +219,7 @@ function preview() {
}
// UK 1901 ===============
} else if (NoteYear.value=="1901") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (j==5 || j==6 || j==8 || (j>=10 && j<=34) || j==36 || j==37 || (j>=39 && j<=41) || (j>=43 && j<=49) || (j>=51 && j<=62) || (j>=64 && j<=73)) {
continue;
} else {
@@ -232,7 +232,7 @@ function preview() {
}
// UK 1891 ===============
} else if (NoteYear.value=="1891") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (j==5 || j==6 || j==8 || (j>=10 && j<=34) || (j>=36 && j<=38) || j==41 || j==42 || (j>=44 && j<=49) || (j>=51 && j<=62) || (j>=64 && j<=73)) {
continue;
} else {
@@ -245,7 +245,7 @@ function preview() {
}
// UK 1951-1881 ============
} else if (NoteYear.value=="1851" || NoteYear.value=="1861" || NoteYear.value=="1871" || NoteYear.value=="1881") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (j==5 || j==6 || j==8 || (j>=10 && j<=34) || (j>=36 && j<=49) || (j>=51 && j<=62) || (j>=64 && j<=73)) {
continue;
} else {
@@ -258,7 +258,7 @@ function preview() {
}
// UK 1841 ===============
} else if (NoteYear.value=="1841") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=3 && j<=6) || j==8 || (j>=10 && j<=34) || (j>=36 && j<=51) || (j>=54 && j<=73)) {
continue;
} else {
@@ -274,7 +274,7 @@ function preview() {
} else if (NoteCtry.value=="USA") {
// USA 1940 ===============
if (NoteYear.value=="1940") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ( (j>=4 && j<=8) || j==11 || (j>=13 && j<=50) || (j>=52 && j<=59) || j>=62 && j<=73) {
continue;
} else {
@@ -289,7 +289,7 @@ function preview() {
// USA 1930 ===============
else if (NoteYear.value=="1930") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (j==4 || j==5 || j==7 || j==8 || j==11 || j==13 || j==14 || (j>=16 && j<=19) || (j>=21 && j<=45) || (j>=47 && j<=50) || j==52 || j==53 || j==63 || j==64 || j>=67 && j<=73) {
continue;
} else {
@@ -304,7 +304,7 @@ function preview() {
// USA 1920 ===============
else if (NoteYear.value=="1920") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (j==4 || (j>=6 && j<=8) || j==11 || j==13 || j==14 || (j>=16 && j<=30) || (j>=34 && j<=45) || (j>=47 && j<=50) || j==52 || j==53 || j==57 || j==58 || (j>=63 && j<=73)) {
continue;
} else {
@@ -319,7 +319,7 @@ function preview() {
// USA 1910 ===============
else if (NoteYear.value=="1910") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=4 && j<=8) || j==11 || j==13 || j==14 || (j>=19 && j<=26) || j==30 || j==33 || j==36 || (j>=39 && j<=42) || j==45 || j==47 || j==48 || (j>=50 && j<=64) || j==66 || j>=68 && j<=73) {
continue;
} else {
@@ -333,7 +333,7 @@ function preview() {
}
// USA 1900 ===============
else if (NoteYear.value=="1900") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=4 && j<=7) || j==10 || j==13 || j==14 || (j>=19 && j<=26) || j==33 || j==34 || (j>=36 && j<=44) || j==47 || (j>=50 && j<=73)) {
continue;
} else {
@@ -347,7 +347,7 @@ function preview() {
}
// USA 1890 ===============
else if (NoteYear.value=="1890") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=4 && j<=7) || j==10 || j==11 || j==13 || j==14 || (j>=19 && j<=26) || j==31 || j==33 || j==34 || j==36 || j==37 || j==39 || j==40 || (j>=42 && j<=45) || j==47 || (j>=49 && j<=63) || (j>=65 && j<=73)) {
continue;
} else {
@@ -361,7 +361,7 @@ function preview() {
}
// USA 1880 ===============
else if (NoteYear.value=="1880") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=3 && j<=7) || j==10 || j==11 || (j>=17 && j<=34) || (j>=37 && j<=44) || (j>=40 && j<=42) || j==46 || j==49 || j==50 || j==52 || j==53 || (j>=56 && j<=73)) {
continue;
} else {
@@ -375,7 +375,7 @@ function preview() {
}
// USA 1870 ===============
else if (NoteYear.value=="1870") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=3 && j<=6) || j==8 || (j>=11 && j<=20) || (j>=27 && j<=46) || (j>=48 && j<=62) || (j>=64 && j<=73)) {
continue;
} else {
@@ -389,7 +389,7 @@ function preview() {
}
// USA 1860 or 1850 ===============
else if (NoteYear.value=="1860" || NoteYear.value=="1850") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ((j>=3 && j<=6) || j==8 || (j>=11 && j<=20) || j==24 || j==25 || (j>=27 && j<=46) || (j>=48 && j<=62) || (j>=64 && j<=73)) {
continue;
} else {
@@ -406,7 +406,7 @@ function preview() {
// FR ==========Modele FR AD 2012=====
// Faire figurer les champs qui ne doivent pas apparaitre dans la zone texte
if (NoteYear.value !="1930") {
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if ( j==5 || j==6 || j==8 || j==10 || j==11 || (j>=12 && j<16) || (j>=17 && j<21) || (j>=22 && j<=29) || (j>=30 && j<33)|| (j>=34 && j<46) || (j>=47 && j<49)|| (j>=50 && j<=73) ) {
continue;
} else {
@@ -428,7 +428,7 @@ function preview() {
}
// Reset/Check the Pink Highlighting of the Name field and Age fields for any person not born ------------------
- for (var j=2; j<tr.cells.length-3; j++) { // == j=2 means miss out cols 0 and 1 (# and pid), cells.length-3 means miss out del, ins and item #
+ for (var j=2; j<tr.cells.length-3; j++) {
if (i==0) {
// Do nothing as this is the header row.
} else {
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
index 3e5cbf3512..bfab8d6761 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_0_inverselink.php
@@ -4,7 +4,7 @@
// Media Link information about an individual
//
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2009 PGV Development Team.
@@ -34,11 +34,13 @@ $gid = WT_Filter::get('gid', WT_REGEX_XREF);
$update_CHAN = WT_Filter::get('preserve_last_changed');
$controller
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
-$paramok = true;
-if (!empty($linktoid)) $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow();
+$paramok = true;
+if (!empty($linktoid)) {
+ $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow();
+}
if ($action == 'choose' && $paramok) {
@@ -77,7 +79,7 @@ if ($action == 'choose' && $paramok) {
echo '<td class="optionbox wrap">';
if (!empty($mediaid)) {
//-- Get the title of this existing Media item
- $title=
+ $title =
WT_DB::prepare("SELECT m_titl FROM `##media` where m_id=? AND m_file=?")
->execute(array($mediaid, WT_GED_ID))
->fetchOne();
@@ -88,11 +90,11 @@ if ($action == 'choose' && $paramok) {
}
echo '<table><tr><td>';
//-- Get the filename of this existing Media item
- $filename=
+ $filename =
WT_DB::prepare("SELECT m_filename FROM `##media` where m_id=? AND m_file=?")
->execute(array($mediaid, WT_GED_ID))
->fetchOne();
- $media=WT_Media::getInstance($mediaid);
+ $media = WT_Media::getInstance($mediaid);
echo $media->displayImage();
echo '</td></tr></table>';
echo '</td></tr>';
@@ -113,10 +115,10 @@ if ($action == 'choose' && $paramok) {
$media->linkedIndividuals('OBJE'),
$media->linkedFamilies('OBJE'),
$media->linkedSources('OBJE'),
- $media->linkedNotes('OBJE'), // Invalid GEDCOM - you cannot link a NOTE to an OBJE
+ $media->linkedNotes('OBJE'), // Invalid GEDCOM - you cannot link a NOTE to an OBJE
$media->linkedRepositories('OBJE') // Invalid GEDCOM - you cannot link a REPO to an OBJE
);
- $i=1;
+ $i = 1;
foreach ($links as $record) {
echo "<tr ><td>";
echo $i++;
@@ -134,11 +136,11 @@ if ($action == 'choose' && $paramok) {
<?php
} elseif ($record instanceof WT_Family) {
if ($record->getHusband()) {
- $head=$record->getHusband()->getXref();
+ $head = $record->getHusband()->getXref();
} elseif ($record->getWife()) {
- $head=$record->getWife()->getXref();
+ $head = $record->getWife()->getXref();
} else {
- $head='';
+ $head = '';
}
?>
<td align="center"><a href="#" class="icon-button_family" title="<?php echo WT_I18N::translate('Family navigator'); ?>" name="family_'<?php echo $record->getXref(); ?>'" onclick="openFamNav('<?php echo $head; ?>');"></a></td>
@@ -159,21 +161,17 @@ if ($action == 'choose' && $paramok) {
echo '<tr><td class="descriptionbox wrap">';
echo WT_I18N::translate('Add links');
echo '<td class="optionbox wrap ">';
- if ($linktoid=="") {
+ if ($linktoid == "") {
// ----
} else {
- $record=WT_Individual::getInstance($linktoid);
+ $record = WT_Individual::getInstance($linktoid);
echo '<b>', $record->getFullName(), '</b>';
}
echo '<table><tr><td>';
echo '<input type="text" data-autocomplete-type="IFS" name="gid" id="gid" size="6" value="">';
echo '</td><td style="padding-bottom: 2px; vertical-align: middle;">';
echo '&nbsp;';
- if (isset($WT_IMAGES["add"])) {
- echo '<img style="border-style:none;" src="', $WT_IMAGES["add"], '" alt="', WT_I18N::translate('Add'), ' " title="', WT_I18N::translate('Add'), '" align="middle" name="addLink" value="" onclick="blankwin(); return false;">';
- } else {
- echo '<button name="addLink" value="" type="button" onclick="blankwin(); return false;">', WT_I18N::translate('Add'), '</button>';
- }
+ echo '<img style="border-style:none;" src="', Theme::theme()->parameter('add'), '" alt="', WT_I18N::translate('Add'), ' " title="', WT_I18N::translate('Add'), '" align="middle" name="addLink" value="" onclick="blankwin(); return false;">';
echo ' ', print_findindi_link('gid');
echo ' ', print_findfamily_link('gid');
echo ' ', print_findsource_link('gid');
@@ -209,8 +207,8 @@ if ($action == 'choose' && $paramok) {
var ifamily = "<?php echo WT_I18N::translate('Family navigator'); ?>";
var remove = "<?php echo WT_I18N::translate('Remove'); ?>";
/* ===icons === */
- var removeLinkIcon = "<?php echo $WT_IMAGES['remove']; ?>";
- var familyNavIcon = "<?php echo $WT_IMAGES['button_family']; ?>";
+ var removeLinkIcon = "<?php echo Theme::theme()->parameter('remove'); ?>";
+ var familyNavIcon = "<?php echo Theme::theme()->parameter('button_family'); ?>";
var INPUT_NAME_PREFIX = 'InputCell_'; // this is being set via script
@@ -519,7 +517,8 @@ function parseAddLinks() {
var str = document.getElementById('gid').value;
// Add in the "keep" IDs.
var tbl = document.getElementById('addlinkQueue');
- for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
+ // start at i=1 because we need to avoid header
+ for (var i=1; i<tbl.rows.length; i++) {
var tr = tbl.rows[i];
if (typeof tr.cells[1].childNodes[0].textContent !== "undefined") {
str += (str==''?'':',') + tr.cells[1].childNodes[0].textContent;
@@ -533,7 +532,8 @@ function parseAddLinks() {
function parseRemLinks() {
var remstr = "";
var tbl = document.getElementById('existLinkTbl');
- for (var i=1; i<tbl.rows.length; i++) { // start at i=1 because we need to avoid header
+ // start at i=1 because we need to avoid header
+ for (var i=1; i<tbl.rows.length; i++) {
var remtr = tbl.rows[i];
if (remtr.cells[4].childNodes[0].checked) {
remstr += (remstr==''?'':',') + remtr.cells[4].childNodes[0].name;
@@ -573,7 +573,7 @@ function shiftlinks() {
echo "<tr><td class=\"descriptionbox wrap width25\">";
echo WT_Gedcom_Tag::getLabel('CHAN'), "</td><td class=\"optionbox wrap\">";
if ($NO_UPDATE_CHAN) {
- echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\">";
+ echo "<input type=\"checkbox\" checked name=\"preserve_last_changed\">";
} else {
echo "<input type=\"checkbox\" name=\"preserve_last_changed\">";
}
@@ -595,7 +595,7 @@ function shiftlinks() {
if ($exist_links) {
foreach (explode(',', $exist_links) as $remLinkId) {
$indi = WT_GedcomRecord::getInstance($remLinkId);
- $indi->removeLinks($mediaid, $update_CHAN!='no_change');
+ $indi->removeLinks($mediaid, $update_CHAN != 'no_change');
}
}
// Add new Links ====================================
@@ -604,7 +604,7 @@ function shiftlinks() {
// when it is also in the list.
foreach (array_unique(explode(',', $more_links)) as $addLinkId) {
$indi = WT_GedcomRecord::getInstance($addLinkId);
- $indi->createFact('1 OBJE @' . $mediaid . '@', $update_CHAN!='no_change');
+ $indi->createFact('1 OBJE @' . $mediaid . '@', $update_CHAN != 'no_change');
}
}
$controller->addInlineJavascript('closePopupAndReloadParent();');
diff --git a/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php b/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php
index 3217a2c693..b0c63f7030 100644
--- a/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php
+++ b/modules_v3/GEDFact_assistant/_MEDIA/media_1_ctrl.php
@@ -29,13 +29,13 @@ if (!defined('WT_WEBTREES')) {
}
// Test to see if Base pid is filled in ============================
-if ($pid=="") {
+if ($pid == "") {
echo "<br><br>";
echo "<b>YOU MUST enter a Base individual ID to be able to \"ADD\" Individual Links</b>";
echo "<br><br>";
} else {
- $person=WT_Individual::getInstance($pid);
+ $person = WT_Individual::getInstance($pid);
if ($person->getDeathYear() == 0) { $DeathYr = ""; } else { $DeathYr = $person->getDeathYear(); }
if ($person->getBirthYear() == 0) { $BirthYr = ""; } else { $BirthYr = $person->getBirthYear(); }
@@ -89,7 +89,7 @@ if ($pid=="") {
<?php
// Header text with "Head" button =================================================
$headImg = '<i class="headimg vmiddle icon-button_head"></i>';
- $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="'.WT_I18N::translate('Click to choose individual as head of family.').'"></i>';
+ $headImg2 = '<i class="headimg2 vmiddle icon-button_head" title="' . WT_I18N::translate('Click to choose individual as head of family.') . '"></i>';
echo WT_I18N::translate('Click %s to choose individual as head of family.', $headImg);
?>
<br><br>
@@ -109,7 +109,7 @@ if ($pid=="") {
foreach ($families as $family) {
$label = $person->getChildFamilyLabel($family);
- $people=array(
+ $people = array(
'husb' =>$family->getHusband(),
'wife' =>$family->getWife(),
'children'=>$family->getChildren(),
@@ -120,7 +120,7 @@ if ($pid=="") {
// Husband -------------------
if ($people["husb"]) {
$fulln = strip_tags($people['husb']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["husb"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["husb"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["husb"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -138,7 +138,7 @@ if ($pid=="") {
if (($people["husb"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["husb"]->getXref() ; // pid = PID
+ echo $people["husb"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'><?php
@@ -156,8 +156,8 @@ if ($pid=="") {
}
if ($people["wife"]) {
- $fulln =strip_tags($people['wife']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["wife"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($people['wife']->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["wife"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["wife"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -172,7 +172,7 @@ if ($pid=="") {
if (($people["wife"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["wife"]->getXref() ; // pid = PID
+ echo $people["wife"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -193,14 +193,14 @@ if ($pid=="") {
if ($people["children"]) {
$elderdate = $family->getMarriageDate();
foreach ($people["children"] as $key=>$child) {
- $fulln =strip_tags($child->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$child->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($child->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($child->getXref());
$slabel = $spouselinks;
$submenu = new WT_Menu($slabel);
$menu->addSubmenu($submenu);
- if ($child->getXref()==$pid) {
+ if ($child->getXref() == $pid) {
//Only print Head of Family in Immediate Family Block
} else {
?>
@@ -213,7 +213,7 @@ if ($pid=="") {
if (($child->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $child->getXref() ; // pid = PID
+ echo $child->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'><?php
@@ -238,7 +238,7 @@ if ($pid=="") {
foreach ($person->getChildStepFamilies() as $family) {
$label = $person->getStepFamilyLabel($family);
- $people=array(
+ $people = array(
'husb' =>$family->getHusband(),
'wife' =>$family->getWife(),
'children'=>$family->getChildren(),
@@ -252,8 +252,8 @@ if ($pid=="") {
// Husband -----------------------------
$elderdate = "";
if ($people["husb"]) {
- $fulln =strip_tags($people['husb']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["husb"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($people['husb']->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["husb"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["husb"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -270,7 +270,7 @@ if ($pid=="") {
if (($people["husb"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["husb"]->getXref() ; // pid = PID
+ echo $people["husb"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -290,8 +290,8 @@ if ($pid=="") {
// Wife -------------------
if ($people["wife"]) {
- $fulln =strip_tags($people['wife']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["wife"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($people['wife']->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["wife"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["wife"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -308,7 +308,7 @@ if ($pid=="") {
if (($people["wife"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["wife"]->getXref() ; // pid = PID
+ echo $people["wife"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -330,8 +330,8 @@ if ($pid=="") {
if ($people["children"]) {
$elderdate = $family->getMarriageDate();
foreach ($people["children"] as $key=>$child) {
- $fulln =strip_tags($child->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$child->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($child->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($child->getXref());
$slabel = $spouselinks;
$submenu = new WT_Menu($slabel);
@@ -347,7 +347,7 @@ if ($pid=="") {
if (($child->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $child->getXref() ; // pid = PID
+ echo $child->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -373,7 +373,7 @@ if ($pid=="") {
$families = $person->getSpouseFamilies();
foreach ($families as $family) {
- $people=array(
+ $people = array(
'husb' =>$family->getHusband(),
'wife' =>$family->getWife(),
'children'=>$family->getChildren(),
@@ -383,8 +383,8 @@ if ($pid=="") {
// Husband -------------------
if ($people["husb"]) {
- $fulln =strip_tags($people['husb']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["husb"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($people['husb']->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["husb"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["husb"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -401,7 +401,7 @@ if ($pid=="") {
if (($people["husb"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["husb"]->getXref() ; // pid = PID
+ echo $people["husb"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -422,8 +422,8 @@ if ($pid=="") {
// Wife -------------------
if ($people["wife"]) {
- $fulln =strip_tags($people['wife']->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$people["wife"]->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($people['wife']->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $people["wife"]->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($people["wife"]->getXref());
$slabel = $parentlinks;
$submenu = new WT_Menu($slabel);
@@ -440,7 +440,7 @@ if ($pid=="") {
if (($people["wife"]->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $people["wife"]->getXref() ; // pid = PID
+ echo $people["wife"]->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln);
?>", "", "", "", "", "", "", "", "");'>
@@ -459,8 +459,8 @@ if ($pid=="") {
// Children
foreach ($people["children"] as $key=>$child) {
- $fulln =strip_tags($child->getFullName());
- $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=".$child->getXref()."&amp;gedcom=".WT_GEDURL);
+ $fulln = strip_tags($child->getFullName());
+ $menu = new WT_Menu($headImg, "edit_interface.php?action=addmedia_links&amp;noteid=newnote&amp;pid=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL);
print_pedigree_person_nav_media($child->getXref());
$slabel = $spouselinks;
$submenu = new WT_Menu($slabel);
@@ -475,7 +475,7 @@ if ($pid=="") {
if (($child->canShow())) {
?>
<a href='#' onclick='opener.insertRowToTable("<?php
- echo $child->getXref() ; // pid = PID
+ echo $child->getXref(); // pid = PID
?>", "<?php
echo htmlentities($fulln); // nam = Full Name
?>", "", "", "", "", "", "", "", "");'>
@@ -503,7 +503,7 @@ if ($pid=="") {
echo '</td>';
echo '</tr>';
echo '</table>';
- echo '</div>';// close "media-links"
+ echo '</div>'; // close "media-links"
} // End IF test for Base pid
@@ -520,9 +520,9 @@ function print_pedigree_person_nav_media($pid) {
global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent;
global $natdad, $natmom;
- $person=WT_Individual::getInstance($pid);
+ $person = WT_Individual::getInstance($pid);
- $tmp = array('M'=>'','F'=>'F', 'U'=>'NN');
+ $tmp = array('M'=>'', 'F'=>'F', 'U'=>'NN');
$isF = $tmp[$person->getSex()];
$spouselinks = '';
$parentlinks = '';
@@ -532,11 +532,11 @@ function print_pedigree_person_nav_media($pid) {
//-- draw a box for the family popup
$spouselinks .= "<table id=\"flyoutFam\" class=\"person_box$isF\"><tr><td class=\"name2 ltr\">";
- $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" .$person->getFullName(). ")<br>";
+ $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>";
$parentlinks .= "<table id=\"flyoutPar\" class=\"person_box$isF\"><tr><td class=\"name2 ltr\">";
- $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
$step_parentlinks .= "<table id=\"flyoutStep\" class=\"person_box$isF\"><tr><td class=\"name2 ltr\">";
- $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" .$person->getFullName(). ")<br>";
+ $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
$persons = '';
$person_parent = '';
@@ -554,10 +554,10 @@ function print_pedigree_person_nav_media($pid) {
// Parent Husbands Details
$person_parent = 'Yes';
if ($husb->canShowName()) {
- $fulln =strip_tags($husb->getFullName());
+ $fulln = strip_tags($husb->getFullName());
$parentlinks .= "<a href=\"#\" onclick=\"opener.insertRowToTable(";
- $parentlinks .= "'".$husb->getXref()."', "; // pid = PID
- $parentlinks .= "'".htmlentities($fulln)."', "; // nam = Name
+ $parentlinks .= "'" . $husb->getXref() . "', "; // pid = PID
+ $parentlinks .= "'" . htmlentities($fulln) . "', "; // nam = Name
$parentlinks .= "'',";
$parentlinks .= "'',";
$parentlinks .= "'',";
@@ -581,12 +581,12 @@ function print_pedigree_person_nav_media($pid) {
if ($wife || $children) {
if ($wife) {
// Parent Wifes Details
- $person_parent="Yes";
+ $person_parent = "Yes";
if ($wife->canShowName()) {
$fulln = strip_tags($wife->getFullName());
$parentlinks .= "<a href=\"#\" onclick=\"opener.insertRowToTable(";
- $parentlinks .= "'".$wife->getXref()."',"; // pid = PID
- $parentlinks .= "'".htmlentities($fulln)."',";
+ $parentlinks .= "'" . $wife->getXref() . "',"; // pid = PID
+ $parentlinks .= "'" . htmlentities($fulln) . "',";
$parentlinks .= "'',";
$parentlinks .= "'',";
$parentlinks .= "'',";
@@ -622,7 +622,7 @@ function print_pedigree_person_nav_media($pid) {
//-- Step Husband Details ------------------------------
$person_step = 'Yes';
if ($husb->canShowName()) {
- $parentlinks .= "<a href=\"individual.php?pid=" . $husb->getXref() . "&amp;&amp;gedcom=".WT_GEDURL."\">";
+ $parentlinks .= "<a href=\"individual.php?pid=" . $husb->getXref() . "&amp;&amp;gedcom=" . WT_GEDURL . "\">";
$parentlinks .= $husb->getFullName();
$parentlinks .= "</a>";
} else {
@@ -660,8 +660,8 @@ function print_pedigree_person_nav_media($pid) {
// Spouse
if ($spouse && $spouse->canShowName()) {
$spouselinks .= "<a href=\"#\" onclick=\"opener.insertRowToTable(";
- $spouselinks .= "'".$spouse->getXref()."',"; // pid = PID
- $spouselinks .= "'".strip_tags($spouse->getFullName())."',";
+ $spouselinks .= "'" . $spouse->getXref() . "',"; // pid = PID
+ $spouselinks .= "'" . strip_tags($spouse->getFullName()) . "',";
$spouselinks .= "'',";
$spouselinks .= "'',";
$spouselinks .= "'',";
@@ -685,13 +685,13 @@ function print_pedigree_person_nav_media($pid) {
$spouselinks .= "<div id='spouseFam'>";
$spouselinks .= "<ul class=\"clist\">";
foreach ($children as $child) {
- $persons="Yes";
+ $persons = "Yes";
if ($child->canShowName()) {
- $fulln =strip_tags($child->getFullName());
+ $fulln = strip_tags($child->getFullName());
$spouselinks .= "<li>";
$spouselinks .= "<a href=\"#\" onclick=\"opener.insertRowToTable(";
- $spouselinks .= "'".$child->getXref()."',";
- $spouselinks .= "'".htmlentities($fulln)."',"; // nam = Name
+ $spouselinks .= "'" . $child->getXref() . "',";
+ $spouselinks .= "'" . htmlentities($fulln) . "',"; // nam = Name
$spouselinks .= "'',";
$spouselinks .= "'',";
$spouselinks .= "'',";
diff --git a/modules_v3/GEDFact_assistant/module.php b/modules_v3/GEDFact_assistant/module.php
index 3699f97388..933e59a61b 100644
--- a/modules_v3/GEDFact_assistant/module.php
+++ b/modules_v3/GEDFact_assistant/module.php
@@ -35,10 +35,10 @@ class GEDFact_assistant_WT_Module extends WT_Module {
/** {@inheritdoc} */
public function modAction($mod_action) {
- switch($mod_action) {
+ switch ($mod_action) {
case '_CENS/census_3_find':
// TODO: this file should be a method in this class
- require WT_ROOT.WT_MODULES_DIR.$this->getName().'/_CENS/census_3_find.php';
+ require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/_CENS/census_3_find.php';
break;
case 'media_3_find':
self::media_3_find();
@@ -56,7 +56,7 @@ class GEDFact_assistant_WT_Module extends WT_Module {
* ...
*/
private static function media_3_find() {
- $controller = new WT_Controller_Simple();
+ $controller = new WT_Controller_Simple;
$filter = WT_Filter::get('filter');
$multiple = WT_Filter::getBool('multiple');
@@ -127,24 +127,24 @@ class GEDFact_assistant_WT_Module extends WT_Module {
echo "<br>";
$filter = trim($filter);
- $filter_array=explode(' ', preg_replace('/ {2,}/', ' ', $filter));
+ $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter));
echo "<table class=\"tabs_table width90\"><tr>";
- $myindilist=search_indis_names($filter_array, array(WT_GED_ID), 'AND');
+ $myindilist = search_indis_names($filter_array, array(WT_GED_ID), 'AND');
if ($myindilist) {
echo "<td class=\"list_value_wrap\"><ul>";
usort($myindilist, array('WT_GedcomRecord', 'compare'));
foreach ($myindilist as $indi) {
$nam = WT_Filter::escapeHtml($indi->getFullName());
echo "<li><a href=\"#\" onclick=\"pasterow(
- '".$indi->getXref()."' ,
- '".$nam."' ,
- '".$indi->getSex()."' ,
- '".$indi->getbirthyear()."' ,
- '".(1901-$indi->getbirthyear())."' ,
- '".$indi->getbirthplace()."'); return false;\">
- <b>".$indi->getFullName()."</b>&nbsp;&nbsp;&nbsp;";
+ '".$indi->getXref() . "' ,
+ '".$nam . "' ,
+ '".$indi->getSex() . "' ,
+ '".$indi->getbirthyear() . "' ,
+ '".(1901 - $indi->getbirthyear()) . "' ,
+ '".$indi->getbirthplace() . "'); return false;\">
+ <b>".$indi->getFullName() . "</b>&nbsp;&nbsp;&nbsp;";
- $born=WT_Gedcom_Tag::getLabel('BIRT');
+ $born = WT_Gedcom_Tag::getLabel('BIRT');
echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getbirthyear(), "&nbsp;&nbsp;&nbsp;", $indi->getbirthplace(), "</span></a></li>";
echo "<hr>";
}
@@ -164,19 +164,19 @@ class GEDFact_assistant_WT_Module extends WT_Module {
private static function media_query_3a() {
$iid2 = WT_Filter::get('iid', WT_REGEX_XREF);
- $controller = new WT_Controller_Simple();
+ $controller = new WT_Controller_Simple;
$controller
->setPageTitle(WT_I18N::translate('Link to an existing media object'))
->pageHeader();
- $record=WT_GedcomRecord::getInstance($iid2);
+ $record = WT_GedcomRecord::getInstance($iid2);
if ($record) {
- $headjs='';
+ $headjs = '';
if ($record instanceof WT_Family) {
if ($record->getHusband()) {
- $headjs=$record->getHusband()->getXref();
+ $headjs = $record->getHusband()->getXref();
} elseif ($record->getWife()) {
- $headjs=$record->getWife()->getXref();
+ $headjs = $record->getWife()->getXref();
}
}
?>
@@ -297,8 +297,8 @@ class GEDFact_assistant_WT_Module extends WT_Module {
$title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link
'<p>' . $preamble . '</p>' .
'<table class="table-census-assistant">' .
- '<thead>' . $thead . '</thead>' .
- '<tbody>' . $tbody . '</tbody>' .
+ '<thead>' . $thead . '</thead>' .
+ '<tbody>' . $tbody . '</tbody>' .
'</table>' .
'<p>' . $postamble . '</p>';
} else {
diff --git a/modules_v3/ahnentafel_report/module.php b/modules_v3/ahnentafel_report/module.php
index cb207720e3..01caeca753 100644
--- a/modules_v3/ahnentafel_report/module.php
+++ b/modules_v3/ahnentafel_report/module.php
@@ -44,13 +44,13 @@ class ahnentafel_report_WT_Module extends WT_Module implements WT_Module_Report
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/batch_update/admin_batch_update.php b/modules_v3/batch_update/admin_batch_update.php
index f7cb3b5ac0..18fb89e747 100644
--- a/modules_v3/batch_update/admin_batch_update.php
+++ b/modules_v3/batch_update/admin_batch_update.php
@@ -24,17 +24,17 @@ require_once WT_ROOT . 'includes/functions/functions_edit.php';
* Class batch_update
*/
class batch_update {
- var $plugin =null; // Form parameter: chosen plugin
- var $xref =null; // Form parameter: record to update
- var $action =null; // Form parameter: how to update record
- var $data =null; // Form parameter: additional details for $action
- var $plugins =null; // Array of available plugins
- var $PLUGIN =null; // An instance of a plugin object
- var $all_xrefs=null; // An array of all xrefs that might need to be updated
- var $prev_xref=null; // The previous xref to process
- var $curr_xref=null; // The xref to process
- var $next_xref=null; // The next xref to process
- var $record =null; // A GedcomRecord object corresponding to $curr_xref
+ var $plugin = null; // Form parameter: chosen plugin
+ var $xref = null; // Form parameter: record to update
+ var $action = null; // Form parameter: how to update record
+ var $data = null; // Form parameter: additional details for $action
+ var $plugins = null; // Array of available plugins
+ var $PLUGIN = null; // An instance of a plugin object
+ var $all_xrefs = null; // An array of all xrefs that might need to be updated
+ var $prev_xref = null; // The previous xref to process
+ var $curr_xref = null; // The xref to process
+ var $next_xref = null; // The next xref to process
+ var $record = null; // A GedcomRecord object corresponding to $curr_xref
/**
* What is the name of this plugin?
@@ -52,63 +52,64 @@ class batch_update {
*/
function main() {
// HTML common to all pages
- $html=
- self::getJavascript().
- '<form id="batch_update_form" action="module.php" method="get">'.
- '<input type="hidden" name="mod" value="batch_update">'.
- '<input type="hidden" name="mod_action" value="admin_batch_update">'.
- '<input type="hidden" name="xref" value="'.$this->xref.'">'.
- '<input type="hidden" name="action" value="">'. // will be set by javascript for next update
- '<input type="hidden" name="data" value="">'. // will be set by javascript for next update
- '<table id="batch_update"><tr>'.
- '<th>'.WT_I18N::translate('Family tree').'</th>'.
- '<td>'.select_edit_control('ged', WT_Tree::getNameList(), '', WT_GEDCOM, 'onchange="reset_reload();"').
- '</td></tr><tr><th>'.WT_I18N::translate('Batch update').'</th><td><select name="plugin" onchange="reset_reload();">';
+ $html =
+ self::getJavascript() .
+ '<form id="batch_update_form" action="module.php" method="get">' .
+ '<input type="hidden" name="mod" value="batch_update">' .
+ '<input type="hidden" name="mod_action" value="admin_batch_update">' .
+ '<input type="hidden" name="xref" value="' . $this->xref . '">' .
+ '<input type="hidden" name="action" value="">' . // will be set by javascript for next update
+ '<input type="hidden" name="data" value="">' . // will be set by javascript for next update
+ '<table id="batch_update"><tr>' .
+ '<th>' . WT_I18N::translate('Family tree') . '</th>' .
+ '<td>' . select_edit_control('ged', WT_Tree::getNameList(), '', WT_GEDCOM, 'onchange="reset_reload();"') .
+ '</td></tr><tr><th>' . WT_I18N::translate('Batch update') . '</th><td><select name="plugin" onchange="reset_reload();">';
if (!$this->plugin) {
- $html.='<option value="" selected="selected"></option>';
+ $html .= '<option value="" selected></option>';
}
foreach ($this->plugins as $class=>$plugin) {
- $html.='<option value="'.$class.'"'.($this->plugin==$class ? ' selected="selected"' : '').'>'.$plugin->getName().'</option>';
+ $html .= '<option value="' . $class . '" ' . ($this->plugin == $class ? 'selected' : '') . '>' . $plugin->getName() . '</option>';
}
- $html.='</select>';
+ $html .= '</select>';
if ($this->PLUGIN) {
- $html.='<br><em>'.$this->PLUGIN->getDescription().'</em>';
+ $html .= '<br><em>' . $this->PLUGIN->getDescription() . '</em>';
}
- $html.='</td></tr>';
+ $html .= '</td></tr>';
- if (!Auth::user()->getPreference('auto_accept'))
- $html.='<tr><td colspan="2" class="warning">'.WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.').'</td></tr>';
+ if (!Auth::user()->getPreference('auto_accept')) {
+ $html .= '<tr><td colspan="2" class="warning">' . WT_I18N::translate('Your user account does not have “automatically approve changes” enabled. You will only be able to change one record at a time.') . '</td></tr>';
+ }
// If a plugin is selected, display the details
if ($this->PLUGIN) {
- $html.=$this->PLUGIN->getOptionsForm();
- if (substr($this->action, -4)=='_all') {
+ $html .= $this->PLUGIN->getOptionsForm();
+ if (substr($this->action, -4) == '_all') {
// Reset - otherwise we might "undo all changes", which refreshes the
// page, which makes them all again!
- $html.='<script>reset_reload();</script>';
+ $html .= '<script>reset_reload();</script>';
} else {
if ($this->curr_xref) {
// Create an object, so we can get the latest version of the name.
- $this->record=WT_GedcomRecord::getInstance($this->curr_xref);
+ $this->record = WT_GedcomRecord::getInstance($this->curr_xref);
- $html.=
- '</table><table id="batch_update2"><tr><td>'.
- self::createSubmitButton(WT_I18N::translate('previous'), $this->prev_xref).
- self::createSubmitButton(WT_I18N::translate('next'), $this->next_xref).
- '</td><th><a href="'.$this->record->getHtmlUrl().'">'.$this->record->getFullName().'</a>'.
- '</th>'.
- '</tr><tr><td valign="top">'.
- '<br>'.implode('<br>',$this->PLUGIN->getActionButtons($this->curr_xref, $this->record)).'<br>'.
- '</td><td dir="ltr" align="left">'.
+ $html .=
+ '</table><table id="batch_update2"><tr><td>' .
+ self::createSubmitButton(WT_I18N::translate('previous'), $this->prev_xref) .
+ self::createSubmitButton(WT_I18N::translate('next'), $this->next_xref) .
+ '</td><th><a href="' . $this->record->getHtmlUrl() . '">' . $this->record->getFullName() . '</a>' .
+ '</th>' .
+ '</tr><tr><td valign="top">' .
+ '<br>' . implode('<br>', $this->PLUGIN->getActionButtons($this->curr_xref, $this->record)) . '<br>' .
+ '</td><td dir="ltr" align="left">' .
$this->PLUGIN->getActionPreview($this->record) .
'</td></tr>';
} else {
- $html.='<tr><td class="accepted" colspan=2>'.WT_I18N::translate('Nothing found.').'</td></tr>';
+ $html .= '<tr><td class="accepted" colspan=2>' . WT_I18N::translate('Nothing found.') . '</td></tr>';
}
}
}
- $html.='</table></form>';
+ $html .= '</table></form>';
return $html;
}
@@ -117,24 +118,24 @@ class batch_update {
* Constructor - initialise variables and validate user-input
*/
public function __construct() {
- $this->plugins=self::getPluginList(); // List of available plugins
- $this->plugin =WT_Filter::get('plugin'); // User parameters
- $this->xref =WT_Filter::get('xref', WT_REGEX_XREF);
- $this->action =WT_Filter::get('action');
- $this->data =WT_Filter::get('data');
+ $this->plugins = self::getPluginList(); // List of available plugins
+ $this->plugin = WT_Filter::get('plugin'); // User parameters
+ $this->xref = WT_Filter::get('xref', WT_REGEX_XREF);
+ $this->action = WT_Filter::get('action');
+ $this->data = WT_Filter::get('data');
// Don't do any processing until a plugin is chosen.
if ($this->plugin && array_key_exists($this->plugin, $this->plugins)) {
- $this->PLUGIN=new $this->plugin;
+ $this->PLUGIN = new $this->plugin;
$this->PLUGIN->getOptions();
$this->getAllXrefs();
switch ($this->action) {
case 'update':
- $record=self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]);
+ $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]);
if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) {
- $newrecord=$this->PLUGIN->updateRecord($this->xref, $record);
- if ($newrecord!=$record) {
+ $newrecord = $this->PLUGIN->updateRecord($this->xref, $record);
+ if ($newrecord != $record) {
if ($newrecord) {
WT_GedcomRecord::getInstance($this->xref)->updateRecord($newrecord, $this->PLUGIN->chan);
} else {
@@ -142,14 +143,14 @@ class batch_update {
}
}
}
- $this->xref=$this->findNextXref($this->xref);
+ $this->xref = $this->findNextXref($this->xref);
break;
case 'update_all':
foreach ($this->all_xrefs as $xref=>$type) {
- $record=self::getLatestRecord($xref, $type);
+ $record = self::getLatestRecord($xref, $type);
if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) {
- $newrecord=$this->PLUGIN->updateRecord($xref, $record);
- if ($newrecord!=$record) {
+ $newrecord = $this->PLUGIN->updateRecord($xref, $record);
+ if ($newrecord != $record) {
if ($newrecord) {
WT_GedcomRecord::getInstance($this->xref)->updateRecord($newrecord, $this->PLUGIN->chan);
} else {
@@ -158,7 +159,7 @@ class batch_update {
}
}
}
- $this->xref='';
+ $this->xref = '';
return;
default:
break;
@@ -169,20 +170,20 @@ class batch_update {
// been specified at all.
if (array_key_exists($this->xref, $this->all_xrefs) &&
$this->PLUGIN->doesRecordNeedUpdate($this->xref, self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]))) {
- $this->curr_xref=$this->xref;
+ $this->curr_xref = $this->xref;
}
// The requested record doesn't need updating - find one that does
if (!$this->curr_xref) {
- $this->curr_xref=$this->findNextXref($this->xref);
+ $this->curr_xref = $this->findNextXref($this->xref);
}
if (!$this->curr_xref) {
- $this->curr_xref=$this->findPrevXref($this->xref);
+ $this->curr_xref = $this->findPrevXref($this->xref);
}
// If we've found a record to update, get details and look for the next/prev
if ($this->curr_xref) {
- $this->record=self::getLatestRecord($this->curr_xref, $this->all_xrefs[$this->curr_xref]);
- $this->prev_xref=$this->findPrevXref($this->curr_xref);
- $this->next_xref=$this->findNextXref($this->curr_xref);
+ $this->record = self::getLatestRecord($this->curr_xref, $this->all_xrefs[$this->curr_xref]);
+ $this->prev_xref = $this->findPrevXref($this->curr_xref);
+ $this->next_xref = $this->findNextXref($this->curr_xref);
}
}
}
@@ -196,8 +197,8 @@ class batch_update {
*/
function findNextXref($xref) {
foreach (array_keys($this->all_xrefs) as $key) {
- if ($key>$xref) {
- $record=self::getLatestRecord($key, $this->all_xrefs[$key]);
+ if ($key > $xref) {
+ $record = self::getLatestRecord($key, $this->all_xrefs[$key]);
if ($this->PLUGIN->doesRecordNeedUpdate($key, $record)) {
return $key;
}
@@ -215,8 +216,8 @@ class batch_update {
*/
function findPrevXref($xref) {
foreach (array_reverse(array_keys($this->all_xrefs)) as $key) {
- if ($key<$xref) {
- $record=self::getLatestRecord($key, $this->all_xrefs[$key]);
+ if ($key < $xref) {
+ $record = self::getLatestRecord($key, $this->all_xrefs[$key]);
if ($this->PLUGIN->doesRecordNeedUpdate($key, $record)) {
return $key;
}
@@ -229,36 +230,36 @@ class batch_update {
* Generate a list of all XREFs.
*/
function getAllXrefs() {
- $sql=array();
- $vars=array();
+ $sql = array();
+ $vars = array();
foreach ($this->PLUGIN->getRecordTypesToUpdate() as $type) {
switch ($type) {
case 'INDI':
- $sql[]="SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?";
- $vars[]=WT_GED_ID;
+ $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?";
+ $vars[] = WT_GED_ID;
break;
case 'FAM':
- $sql[]="SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?";
- $vars[]=WT_GED_ID;
+ $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?";
+ $vars[] = WT_GED_ID;
break;
case 'SOUR':
- $sql[]="SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?";
- $vars[]=WT_GED_ID;
+ $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?";
+ $vars[] = WT_GED_ID;
break;
case 'OBJE':
- $sql[]="SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?";
- $vars[]=WT_GED_ID;
+ $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?";
+ $vars[] = WT_GED_ID;
break;
default:
- $sql[]="SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?";
- $vars[]=$type;
- $vars[]=$type;
- $vars[]=WT_GED_ID;
+ $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?";
+ $vars[] = $type;
+ $vars[] = $type;
+ $vars[] = WT_GED_ID;
break;
}
}
- $this->all_xrefs=
- WT_DB::prepare(implode(' UNION ', $sql).' ORDER BY 1 ASC')
+ $this->all_xrefs =
+ WT_DB::prepare(implode(' UNION ', $sql) . ' ORDER BY 1 ASC')
->execute($vars)
->fetchAssoc();
}
@@ -269,14 +270,14 @@ class batch_update {
* @return base_plugin[]
*/
static function getPluginList() {
- $array=array();
- $dir=dirname(__FILE__).'/plugins/';
- $dir_handle=opendir($dir);
- while ($file=readdir($dir_handle)) {
- if (substr($file, -4)=='.php') {
- require dirname(__FILE__).'/plugins/'.$file;
- $class=basename($file, '.php').'_bu_plugin';
- $array[$class]=new $class;
+ $array = array();
+ $dir = dirname(__FILE__) . '/plugins/';
+ $dir_handle = opendir($dir);
+ while ($file = readdir($dir_handle)) {
+ if (substr($file, -4) == '.php') {
+ require dirname(__FILE__) . '/plugins/' . $file;
+ $class = basename($file, '.php') . '_bu_plugin';
+ $array[$class] = new $class;
}
}
closedir($dir_handle);
@@ -291,15 +292,14 @@ class batch_update {
*/
static function getJavascript() {
return
- '<script>'.
- 'function reset_reload() {'.
- ' var bu_form=document.getElementById("batch_update_form");'.
- ' bu_form.xref.value="";'.
- ' bu_form.action.value="";'.
- ' bu_form.data.value="";'.
- ' bu_form.submit();'.
- '}</script>'
- ;
+ '<script>' .
+ 'function reset_reload() {' .
+ ' var bu_form=document.getElementById("batch_update_form");' .
+ ' bu_form.xref.value="";' .
+ ' bu_form.action.value="";' .
+ ' bu_form.data.value="";' .
+ ' bu_form.submit();' .
+ '}</script>';
}
/**
@@ -312,14 +312,14 @@ class batch_update {
*
* @return string
*/
- static function createSubmitButton($text, $xref, $action='', $data='') {
+ static function createSubmitButton($text, $xref, $action = '', $data = '') {
return
- '<input type="submit" value="'.$text.'" onclick="'.
- 'this.form.xref.value=\''.WT_Filter::escapeHtml($xref).'\';'.
- 'this.form.action.value=\''.WT_Filter::escapeHtml($action).'\';'.
- 'this.form.data.value=\''.WT_Filter::escapeHtml($data).'\';'.
- 'return true;"'.
- ($xref ? '' : ' disabled').'>';
+ '<input type="submit" value="' . $text . '" onclick="' .
+ 'this.form.xref.value=\'' . WT_Filter::escapeHtml($xref) . '\';' .
+ 'this.form.action.value=\'' . WT_Filter::escapeHtml($action) . '\';' .
+ 'this.form.data.value=\'' . WT_Filter::escapeHtml($data) . '\';' .
+ 'return true;"' .
+ ($xref ? '' : ' disabled') . '>';
}
/**
@@ -360,7 +360,7 @@ class batch_update {
* string updateRecord($xref, $gedrec)
*/
class base_plugin {
- var $chan=false; // User option; update change record
+ var $chan = false; // User option; update change record
/**
* Default is to operate on INDI records
@@ -375,7 +375,7 @@ class base_plugin {
* Default option is just the "don't update CHAN record"
*/
function getOptions() {
- $this->chan=WT_Filter::getBool('chan');
+ $this->chan = WT_Filter::getBool('chan');
}
/**
@@ -385,10 +385,10 @@ class base_plugin {
*/
function getOptionsForm() {
return
- '<tr><th>'.WT_I18N::translate('Do not update the “last change” record').'</th>'.
- '<td><select name="chan" onchange="this.form.submit();">'.
- '<option value="0"' . ($this->chan ? '' : ' selected="selected"') . '>'.WT_I18N::translate('yes') .'</option>'.
- '<option value="1"' . ($this->chan ? ' selected="selected"' : '') . '>'.WT_I18N::translate('no').'</option>'.
+ '<tr><th>' . WT_I18N::translate('Do not update the “last change” record') . '</th>' .
+ '<td><select name="chan" onchange="this.form.submit();">' .
+ '<option value="0" ' . ($this->chan ? '' : 'selected') . '>' . WT_I18N::translate('yes') . '</option>' .
+ '<option value="1" ' . ($this->chan ? 'selected' : '') . '>' . WT_I18N::translate('no') . '</option>' .
'</select></td></tr>';
}
@@ -402,12 +402,12 @@ class base_plugin {
function getActionButtons($xref) {
if (Auth::user()->getPreference('auto_accept')) {
return array(
- batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'),
+ batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update'),
batch_update::createSubmitButton(WT_I18N::translate('Update all'), $xref, 'update_all')
);
} else {
return array(
- batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update')
+ batch_update::createSubmitButton(WT_I18N::translate('Update'), $xref, 'update')
);
}
}
@@ -420,34 +420,34 @@ class base_plugin {
* @return string
*/
function getActionPreview(WT_GedcomRecord $record) {
- $old_lines=preg_split('/[\n]+/', $record->getGedcom());
- $new_lines=preg_split('/[\n]+/', $this->updateRecord($record->getXref(), $record->getGedcom()));
+ $old_lines = preg_split('/[\n]+/', $record->getGedcom());
+ $new_lines = preg_split('/[\n]+/', $this->updateRecord($record->getXref(), $record->getGedcom()));
// Find matching lines using longest-common-subsequence algorithm.
- $lcs=self::LongestCommonSubsequence($old_lines, $new_lines, 0, count($old_lines)-1, 0, count($new_lines)-1);
+ $lcs = self::LongestCommonSubsequence($old_lines, $new_lines, 0, count($old_lines) - 1, 0, count($new_lines) - 1);
- $diff_lines=array();
- $last_old=-1;
- $last_new=-1;
+ $diff_lines = array();
+ $last_old = -1;
+ $last_new = -1;
while ($lcs) {
- list($old, $new)=array_shift($lcs);
- while ($last_old<$old-1) {
- $diff_lines[]=self::decorateDeletedText($old_lines[++$last_old]);
+ list($old, $new) = array_shift($lcs);
+ while ($last_old < $old - 1) {
+ $diff_lines[] = self::decorateDeletedText($old_lines[++$last_old]);
}
- while ($last_new<$new-1) {
- $diff_lines[]=self::decorateInsertedText($new_lines[++$last_new]);
+ while ($last_new < $new - 1) {
+ $diff_lines[] = self::decorateInsertedText($new_lines[++$last_new]);
}
- $diff_lines[]=$new_lines[$new];
- $last_old=$old;
- $last_new=$new;
+ $diff_lines[] = $new_lines[$new];
+ $last_old = $old;
+ $last_new = $new;
}
- while ($last_old<count($old_lines)-1) {
- $diff_lines[]=self::decorateDeletedText($old_lines[++$last_old]);
+ while ($last_old < count($old_lines) - 1) {
+ $diff_lines[] = self::decorateDeletedText($old_lines[++$last_old]);
}
- while ($last_new<count($new_lines)-1) {
- $diff_lines[]=self::decorateInsertedText($new_lines[++$last_new]);
+ while ($last_new < count($new_lines) - 1) {
+ $diff_lines[] = self::decorateInsertedText($new_lines[++$last_new]);
}
- return '<pre>'.self::createEditLinks(implode("\n", $diff_lines)).'</pre>';
+ return '<pre>' . self::createEditLinks(implode("\n", $diff_lines)) . '</pre>';
}
/**
@@ -463,21 +463,21 @@ class base_plugin {
* @return array
*/
private static function LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2) {
- if ($x2-$x1>=0 && $y2-$y1>=0) {
- if ($X[$x1]==$Y[$y1]) {
+ if ($x2 - $x1 >= 0 && $y2 - $y1 >= 0) {
+ if ($X[$x1] == $Y[$y1]) {
// Match at start of sequence
- $tmp=self::LongestCommonSubsequence($X, $Y, $x1+1, $x2, $y1+1, $y2);
+ $tmp = self::LongestCommonSubsequence($X, $Y, $x1 + 1, $x2, $y1 + 1, $y2);
array_unshift($tmp, array($x1, $y1));
return $tmp;
- } elseif ($X[$x2]==$Y[$y2]) {
+ } elseif ($X[$x2] == $Y[$y2]) {
// Match at end of sequence
- $tmp=self::LongestCommonSubsequence($X, $Y, $x1, $x2-1, $y1, $y2-1);
+ $tmp = self::LongestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2 - 1);
array_push($tmp, array($x2, $y2));
return $tmp;
} else {
// No match. Look for subsequences
- $tmp1=self::LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2-1);
- $tmp2=self::LongestCommonSubsequence($X, $Y, $x1, $x2-1, $y1, $y2);
+ $tmp1 = self::LongestCommonSubsequence($X, $Y, $x1, $x2, $y1, $y2 - 1);
+ $tmp2 = self::LongestCommonSubsequence($X, $Y, $x1, $x2 - 1, $y1, $y2);
return count($tmp1) > count($tmp2) ? $tmp1 : $tmp2;
}
} else {
@@ -494,7 +494,7 @@ class base_plugin {
* @return string
*/
static function decorateInsertedText($text) {
- return '<span class="added_text">'.$text.'</span>';
+ return '<span class="added_text">' . $text . '</span>';
}
/**
@@ -505,7 +505,7 @@ class base_plugin {
* @return string
*/
static function decorateDeletedText($text) {
- return '<span class="deleted_text">'.$text.'</span>';
+ return '<span class="deleted_text">' . $text . '</span>';
}
/**
diff --git a/modules_v3/batch_update/module.php b/modules_v3/batch_update/module.php
index 7db578946a..b2715ae39e 100644
--- a/modules_v3/batch_update/module.php
+++ b/modules_v3/batch_update/module.php
@@ -21,7 +21,7 @@ use WT\Auth;
/**
* Class batch_update_WT_Module
*/
-class batch_update_WT_Module extends WT_Module implements WT_Module_Config{
+class batch_update_WT_Module extends WT_Module implements WT_Module_Config {
/** {@inheritdoc} */
public function getTitle() {
return /* I18N: Name of a module */ WT_I18N::translate('Batch update');
@@ -34,17 +34,17 @@ class batch_update_WT_Module extends WT_Module implements WT_Module_Config{
/** {@inheritdoc} */
public function modAction($mod_action) {
- switch($mod_action) {
+ switch ($mod_action) {
case 'admin_batch_update':
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->setPageTitle(WT_I18N::translate('Batch update'))
->restrictAccess(Auth::isAdmin())
->pageHeader();
// TODO: these files should be methods in this class
- require WT_ROOT.WT_MODULES_DIR.$this->getName().'/'.$mod_action.'.php';
- $mod=new batch_update;
+ require WT_ROOT . WT_MODULES_DIR . $this->getName() . '/' . $mod_action . '.php';
+ $mod = new batch_update;
echo $mod->main();
break;
default:
@@ -54,6 +54,6 @@ class batch_update_WT_Module extends WT_Module implements WT_Module_Config{
/** {@inheritdoc} */
public function getConfigLink() {
- return 'module.php?mod='.$this->getName().'&amp;mod_action=admin_batch_update';
+ return 'module.php?mod=' . $this->getName() . '&amp;mod_action=admin_batch_update';
}
}
diff --git a/modules_v3/batch_update/plugins/death_y.php b/modules_v3/batch_update/plugins/death_y.php
index 5d7fd2716e..a961075939 100644
--- a/modules_v3/batch_update/plugins/death_y.php
+++ b/modules_v3/batch_update/plugins/death_y.php
@@ -47,7 +47,7 @@ class death_y_bu_plugin extends base_plugin {
* @return boolean
*/
public function doesRecordNeedUpdate($xref, $gedrec) {
- return !preg_match('/\n1 ('.WT_EVENTS_DEAT.')/', $gedrec) && WT_Individual::getInstance($xref)->isDead();
+ return !preg_match('/\n1 (' . WT_EVENTS_DEAT . ')/', $gedrec) && WT_Individual::getInstance($xref)->isDead();
}
/**
@@ -59,6 +59,6 @@ class death_y_bu_plugin extends base_plugin {
* @return string
*/
public function updateRecord($xref, $gedrec) {
- return $gedrec."\n1 DEAT Y";
+ return $gedrec . "\n1 DEAT Y";
}
}
diff --git a/modules_v3/batch_update/plugins/married_names.php b/modules_v3/batch_update/plugins/married_names.php
index 77dbc71f6e..ffce70ffe8 100644
--- a/modules_v3/batch_update/plugins/married_names.php
+++ b/modules_v3/batch_update/plugins/married_names.php
@@ -67,22 +67,22 @@ class married_names_bu_plugin extends base_plugin {
$SURNAME_TRADITION = $WT_TREE->getPreference('SURNAME_TRADITION');
preg_match('/^1 NAME (.*)/m', $gedrec, $match);
- $wife_name=$match[1];
- $married_names=array();
+ $wife_name = $match[1];
+ $married_names = array();
foreach (self::surnamesToAdd($xref, $gedrec) as $surname) {
switch ($this->surname) {
case 'add':
- $married_names[]="\n2 _MARNM ".str_replace('/', '', $wife_name).' /'.$surname.'/';
+ $married_names[] = "\n2 _MARNM " . str_replace('/', '', $wife_name) . ' /' . $surname . '/';
break;
case 'replace':
if ($SURNAME_TRADITION === 'polish') {
- $surname=preg_replace(array('/ski$/','/cki$/','/dzki$/'), array('ska', 'cka', 'dzka'), $surname);
+ $surname = preg_replace(array('/ski$/', '/cki$/', '/dzki$/'), array('ska', 'cka', 'dzka'), $surname);
}
- $married_names[]="\n2 _MARNM ".preg_replace('!/.*/!', '/'.$surname.'/', $wife_name);
+ $married_names[] = "\n2 _MARNM " . preg_replace('!/.*/!', '/' . $surname . '/', $wife_name);
break;
}
}
- return preg_replace('/(^1 NAME .*([\r\n]+[2-9].*)*)/m', '\\1'.implode('', $married_names), $gedrec, 1);
+ return preg_replace('/(^1 NAME .*([\r\n]+[2-9].*)*)/m', '\\1' . implode('', $married_names), $gedrec, 1);
}
/**
@@ -92,20 +92,20 @@ class married_names_bu_plugin extends base_plugin {
* @return string[]
*/
private function surnamesToAdd($xref, $gedrec) {
- $wife_surnames=self::surnames($xref, $gedrec);
- $husb_surnames=array();
- $missing_surnames=array();
+ $wife_surnames = self::surnames($xref, $gedrec);
+ $husb_surnames = array();
+ $missing_surnames = array();
preg_match_all('/^1 FAMS @(.+)@/m', $gedrec, $fmatch);
foreach ($fmatch[1] as $famid) {
- $famrec=batch_update::getLatestRecord($famid, 'FAM');
+ $famrec = batch_update::getLatestRecord($famid, 'FAM');
if (preg_match('/^1 MARR/m', $famrec) && preg_match('/^1 HUSB @(.+)@/m', $famrec, $hmatch)) {
- $husbrec=batch_update::getLatestRecord($hmatch[1], 'INDI');
- $husb_surnames=array_unique(array_merge($husb_surnames, self::surnames($hmatch[1], $husbrec)));
+ $husbrec = batch_update::getLatestRecord($hmatch[1], 'INDI');
+ $husb_surnames = array_unique(array_merge($husb_surnames, self::surnames($hmatch[1], $husbrec)));
}
}
foreach ($husb_surnames as $husb_surname) {
if (!in_array($husb_surname, $wife_surnames)) {
- $missing_surnames[]=$husb_surname;
+ $missing_surnames[] = $husb_surname;
}
}
@@ -143,10 +143,10 @@ class married_names_bu_plugin extends base_plugin {
return
parent::getOptionsForm() .
'<tr valign="top"><th>' . WT_I18N::translate('Surname option') . '</th>' .
- '<td class="optionbox"><select name="surname" onchange="reset_reload();"><option value="replace"' .
- ($this->surname=='replace' ? ' selected="selected"' : '') .
- '">' . WT_I18N::translate('Wife’s surname replaced by husband’s surname') . '</option><option value="add"' .
- ($this->surname=='add' ? ' selected="selected"' : '') .
+ '<td class="optionbox"><select name="surname" onchange="reset_reload();"><option value="replace" ' .
+ ($this->surname == 'replace' ? 'selected' : '') .
+ '">' . WT_I18N::translate('Wife’s surname replaced by husband’s surname') . '</option><option value="add" ' .
+ ($this->surname == 'add' ? 'selected' : '') .
'">' . WT_I18N::translate('Wife’s maiden surname becomes new given name') . '</option></select></td></tr>';
}
}
diff --git a/modules_v3/batch_update/plugins/search_replace.php b/modules_v3/batch_update/plugins/search_replace.php
index 7f47a24c6a..fea3a30158 100644
--- a/modules_v3/batch_update/plugins/search_replace.php
+++ b/modules_v3/batch_update/plugins/search_replace.php
@@ -20,12 +20,12 @@
* Class search_replace_bu_plugin Batch Update plugin: search/replace
*/
class search_replace_bu_plugin extends base_plugin {
- var $search =null; // Search string
- var $replace=null; // Replace string
- var $method =null; // simple/wildcards/regex
- var $regex =null; // Search string, converted to a regex
- var $case =null; // "i" for case insensitive, "" for case sensitive
- var $error =null; // Message for bad user parameters
+ var $search = null; // Search string
+ var $replace = null; // Replace string
+ var $method = null; // simple/wildcards/regex
+ var $regex = null; // Search string, converted to a regex
+ var $case = null; // "i" for case insensitive, "" for case sensitive
+ var $error = null; // Message for bad user parameters
/**
* User-friendly name for this plugin.
@@ -63,7 +63,7 @@ class search_replace_bu_plugin extends base_plugin {
* @return boolean
*/
public function doesRecordNeedUpdate($xref, $gedrec) {
- return !$this->error && preg_match('/(?:'.$this->regex.')/mu'.$this->case, $gedrec);
+ return !$this->error && preg_match('/(?:' . $this->regex . ')/mu' . $this->case, $gedrec);
}
/**
@@ -77,7 +77,7 @@ class search_replace_bu_plugin extends base_plugin {
public function updateRecord($xref, $gedrec) {
// Allow "\n" to indicate a line-feed in replacement text.
// Back-references such as $1, $2 are handled automatically.
- return preg_replace('/'.$this->regex.'/mu'.$this->case, str_replace('\n', "\n", $this->replace), $gedrec);
+ return preg_replace('/' . $this->regex . '/mu' . $this->case, str_replace('\n', "\n", $this->replace), $gedrec);
}
/**
@@ -90,24 +90,24 @@ class search_replace_bu_plugin extends base_plugin {
$this->method = WT_Filter::get('method', 'exact|words|wildcards|regex', 'exact');
$this->case = WT_Filter::get('case', 'i');
- $this->error='';
+ $this->error = '';
switch ($this->method) {
case 'exact':
- $this->regex=preg_quote($this->search, '/');
+ $this->regex = preg_quote($this->search, '/');
break;
case 'words':
- $this->regex='\b'.preg_quote($this->search, '/').'\b';
+ $this->regex = '\b' . preg_quote($this->search, '/') . '\b';
break;
case 'wildcards':
- $this->regex='\b'.str_replace(array('\*', '\?'), array('.*', '.'), preg_quote($this->search, '/')).'\b';
+ $this->regex = '\b' . str_replace(array('\*', '\?'), array('.*', '.'), preg_quote($this->search, '/')) . '\b';
break;
case 'regex':
- $this->regex=$this->search;
+ $this->regex = $this->search;
// Check for invalid regular expressions.
// A valid regex on a null string returns zero.
// An invalid regex on a null string returns false (and throws a warning).
- if (@preg_match('/'.$this->search.'/', null) === false) {
- $this->error='<br><span class="error">'.WT_I18N::translate('The regex appears to contain an error. It can’t be used.').'</span>';
+ if (@preg_match('/' . $this->search . '/', null) === false) {
+ $this->error = '<br><span class="error">' . WT_I18N::translate('The regex appears to contain an error. It can’t be used.') . '</span>';
}
break;
}
@@ -119,7 +119,7 @@ class search_replace_bu_plugin extends base_plugin {
* @return string
*/
public function getOptionsForm() {
- $descriptions=array(
+ $descriptions = array(
'exact' => WT_I18N::translate('Match the exact text, even if it occurs in the middle of a word.'),
'words' => WT_I18N::translate('Match the exact text, unless it occurs in the middle of a word.'),
'wildcards' => WT_I18N::translate('Use a “?” to match a single character, use “*” to match zero or more characters.'),
@@ -137,14 +137,14 @@ class search_replace_bu_plugin extends base_plugin {
'" onchange="this.form.submit();"></td></tr>' .
'<tr><th>' . WT_I18N::translate('Search method') . '</th>' .
'<td><select name="method" onchange="this.form.submit();">' .
- '<option value="exact"' . ($this->method == 'exact' ? ' selected="selected"' : '') . '>' . WT_I18N::translate('Exact text') . '</option>' .
- '<option value="words"' . ($this->method == 'words' ? ' selected="selected"' : '') . '>' . WT_I18N::translate('Whole words only') . '</option>' .
- '<option value="wildcards"' . ($this->method == 'wildcards' ? ' selected="selected"' : '') . '>' . WT_I18N::translate('Wildcards') . '</option>' .
- '<option value="regex"' . ($this->method == 'regex' ? ' selected="selected"' : '') . '>' . WT_I18N::translate('Regular expression') . '</option>' .
+ '<option value="exact" ' . ($this->method == 'exact' ? 'selected' : '') . '>' . WT_I18N::translate('Exact text') . '</option>' .
+ '<option value="words" ' . ($this->method == 'words' ? 'selected' : '') . '>' . WT_I18N::translate('Whole words only') . '</option>' .
+ '<option value="wildcards" ' . ($this->method == 'wildcards' ? 'selected' : '') . '>' . WT_I18N::translate('Wildcards') . '</option>' .
+ '<option value="regex" ' . ($this->method == 'regex' ? 'selected' : '') . '>' . WT_I18N::translate('Regular expression') . '</option>' .
'</select><br><em>' . $descriptions[$this->method] . '</em>' . $this->error . '</td></tr>' .
'<tr><th>' . WT_I18N::translate('Case insensitive') . '</th>' .
'<td>' .
- '<input type="checkbox" name="case" value="i" ' . ($this->case == 'i' ? 'checked="checked"' : '') . '" onchange="this.form.submit();">' .
+ '<input type="checkbox" name="case" value="i" ' . ($this->case == 'i' ? 'checked' : '') . '" onchange="this.form.submit();">' .
'<br><em>' . WT_I18N::translate('Tick this box to match both upper and lower case letters.') . '</em></td></tr>' .
parent::getOptionsForm();
}
diff --git a/modules_v3/bdm_report/module.php b/modules_v3/bdm_report/module.php
index 54b465fed7..128cf06ea5 100644
--- a/modules_v3/bdm_report/module.php
+++ b/modules_v3/bdm_report/module.php
@@ -42,13 +42,13 @@ class bdm_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/birth_report/module.php b/modules_v3/birth_report/module.php
index b8694ae301..9b6912a503 100644
--- a/modules_v3/birth_report/module.php
+++ b/modules_v3/birth_report/module.php
@@ -42,13 +42,13 @@ class birth_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/cemetery_report/module.php b/modules_v3/cemetery_report/module.php
index dc0aefbc32..fab4576e5e 100644
--- a/modules_v3/cemetery_report/module.php
+++ b/modules_v3/cemetery_report/module.php
@@ -42,13 +42,13 @@ class cemetery_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/change_report/module.php b/modules_v3/change_report/module.php
index 81c4201225..eee0c40d8b 100644
--- a/modules_v3/change_report/module.php
+++ b/modules_v3/change_report/module.php
@@ -42,13 +42,13 @@ class change_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/charts/help_text.php b/modules_v3/charts/help_text.php
deleted file mode 100644
index 412f1fc2fd..0000000000
--- a/modules_v3/charts/help_text.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'index_charts':
- $title=WT_I18N::translate('Charts');
- $text=WT_I18N::translate('This block allows a pedigree, descendancy, or hourglass chart to appear on your “My page” or the “Home page”. Because of space limitations, the charts should be placed only on the left side of the page.<br><br>When this block appears on the “Home page”, the root individual and the type of chart to be displayed are determined by the administrator. When this block appears on the user’s “My page”, these options are determined by the user.<br><br>The behavior of these charts is identical to their behavior when they are called up from the menus. Click on the box of an individual to see more details about them.');
- break;
-}
diff --git a/modules_v3/charts/module.php b/modules_v3/charts/module.php
index cd74732edb..245e8dedad 100644
--- a/modules_v3/charts/module.php
+++ b/modules_v3/charts/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class charts_WT_Module
@@ -36,14 +37,15 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $WT_TREE, $ctype, $PEDIGREE_FULL_DETAILS, $show_full, $controller;
$PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID');
- $details = get_block_setting($block_id, 'details', false);
+ $details = get_block_setting($block_id, 'details', '0');
$type = get_block_setting($block_id, 'type', 'pedigree');
$pid = get_block_setting($block_id, 'pid', Auth::check() ? (WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
+
if ($cfg) {
foreach (array('details', 'type', 'pid', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
@@ -73,46 +75,46 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
$person = WT_Individual::getInstance($pid);
}
- if ($type!='treenav' && $person) {
+ if ($type != 'treenav' && $person) {
$chartController = new WT_Controller_Hourglass($person->getXref(), 0, false);
$controller->addInlineJavascript($chartController->setupJavascript());
}
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && Auth::check()) {
- $title='<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && Auth::check()) {
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
- $title='';
+ $title = '';
}
if ($person) {
- switch($type) {
- case 'pedigree':
- $title .= WT_I18N::translate('Pedigree of %s', $person->getFullName());
- break;
- case 'descendants':
- $title .= WT_I18N::translate('Descendants of %s', $person->getFullName());
- break;
- case 'hourglass':
- $title .= WT_I18N::translate('Hourglass chart of %s', $person->getFullName());
- break;
- case 'treenav':
- $title .= WT_I18N::translate('Interactive tree of %s', $person->getFullName());
- break;
+ switch ($type) {
+ case 'pedigree':
+ $title .= WT_I18N::translate('Pedigree of %s', $person->getFullName());
+ break;
+ case 'descendants':
+ $title .= WT_I18N::translate('Descendants of %s', $person->getFullName());
+ break;
+ case 'hourglass':
+ $title .= WT_I18N::translate('Hourglass chart of %s', $person->getFullName());
+ break;
+ case 'treenav':
+ $title .= WT_I18N::translate('Interactive tree of %s', $person->getFullName());
+ break;
}
$title .= help_link('index_charts', $this->getName());
$content = '<table cellspacing="0" cellpadding="0" border="0"><tr>';
- if ($type=='descendants' || $type=='hourglass') {
+ if ($type == 'descendants' || $type == 'hourglass') {
$content .= "<td valign=\"middle\">";
ob_start();
$chartController->printDescendency($person, 1, false);
$content .= ob_get_clean();
$content .= "</td>";
}
- if ($type=='pedigree' || $type=='hourglass') {
+ if ($type == 'pedigree' || $type == 'hourglass') {
//-- print out the root person
- if ($type!='hourglass') {
+ if ($type != 'hourglass') {
$content .= "<td valign=\"middle\">";
ob_start();
print_pedigree_person($person);
@@ -125,22 +127,22 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
$content .= ob_get_clean();
$content .= "</td>";
}
- if ($type=='treenav') {
- require_once WT_MODULES_DIR.'tree/module.php';
- require_once WT_MODULES_DIR.'tree/class_treeview.php';
- $mod=new tree_WT_Module;
- $tv=new TreeView;
+ if ($type == 'treenav') {
+ require_once WT_MODULES_DIR . 'tree/module.php';
+ require_once WT_MODULES_DIR . 'tree/class_treeview.php';
+ $mod = new tree_WT_Module;
+ $tv = new TreeView;
$content .= '<td>';
- $content .= '<script>jQuery("head").append(\'<link rel="stylesheet" href="'.$mod->css().'" type="text/css" />\');</script>';
- $content .= '<script src="'.$mod->js().'"></script>';
+ $content .= '<script>jQuery("head").append(\'<link rel="stylesheet" href="' . $mod->css() . '" type="text/css" />\');</script>';
+ $content .= '<script src="' . $mod->js() . '"></script>';
list($html, $js) = $tv->drawViewport($person, 2);
- $content .= $html.'<script>'.$js.'</script>';
+ $content .= $html . '<script>' . $js . '</script>';
$content .= '</td>';
}
$content .= "</tr></table>";
} else {
- $content=WT_I18N::translate('You must select an individual and chart type in the block configuration settings.');
+ $content = WT_I18N::translate('You must select an individual and chart type in the block configuration settings.');
}
// Restore GEDCOM configuration
@@ -151,7 +153,7 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
$PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -175,35 +177,41 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
global $WT_TREE, $controller;
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
$PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID');
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
set_block_setting($block_id, 'details', WT_Filter::postBool('details'));
- set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
- set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF));
- exit;
+ set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
+ set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF));
}
- $details = get_block_setting($block_id, 'details', false);
+ $details = get_block_setting($block_id, 'details', '0');
$type = get_block_setting($block_id, 'type', 'pedigree');
$pid = get_block_setting($block_id, 'pid', Auth::check() ? (WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
$controller
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
?>
- <tr><td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Chart type'); ?></td>
- <td class="optionbox">
- <?php echo select_edit_control('type',
- array(
- 'pedigree' => WT_I18N::translate('Pedigree'),
- 'descendants' => WT_I18N::translate('Descendants'),
- 'hourglass' => WT_I18N::translate('Hourglass chart'),
- 'treenav' => WT_I18N::translate('Interactive tree')),
- null, $type); ?>
- </td></tr>
+ <tr>
+ <td colspan="2">
+ <?php echo WT_I18N::translate('This block allows a pedigree, descendancy, or hourglass chart to appear on your “My page” or the “Home page”. Because of space limitations, the charts should be placed only on the left side of the page.<br><br>When this block appears on the “Home page”, the root individual and the type of chart to be displayed are determined by the administrator. When this block appears on the user’s “My page”, these options are determined by the user.<br><br>The behavior of these charts is identical to their behavior when they are called up from the menus. Click on the box of an individual to see more details about them.'); ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Chart type'); ?></td>
+ <td class="optionbox">
+ <?php echo select_edit_control('type',
+ array(
+ 'pedigree' => WT_I18N::translate('Pedigree'),
+ 'descendants' => WT_I18N::translate('Descendants'),
+ 'hourglass' => WT_I18N::translate('Hourglass chart'),
+ 'treenav' => WT_I18N::translate('Interactive tree')),
+ null, $type); ?>
+ </td>
+ </tr>
<tr>
<td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Show details'); ?></td>
<td class="optionbox">
@@ -216,7 +224,7 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
<input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php echo $pid; ?>" size="5">
<?php
echo print_findindi_link('pid');
- $root=WT_Individual::getInstance($pid);
+ $root = WT_Individual::getInstance($pid);
if ($root) {
echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>';
}
diff --git a/modules_v3/ckeditor/module.php b/modules_v3/ckeditor/module.php
index 11570f37c1..9b3ee497fd 100644
--- a/modules_v3/ckeditor/module.php
+++ b/modules_v3/ckeditor/module.php
@@ -56,7 +56,7 @@ class ckeditor_WT_Module extends WT_Module {
)
// Activate the editor
->addInlineJavascript('jQuery(".html-edit").ckeditor(function(){}, {
- language: "' . str_replace('_','-',strtolower(WT_LOCALE)) . '"
+ language: "' . str_replace('_', '-', strtolower(WT_LOCALE)) . '"
});');
}
}
diff --git a/modules_v3/clippings/clippings_ctrl.php b/modules_v3/clippings/clippings_ctrl.php
index 3a7afb4145..45ca60271e 100644
--- a/modules_v3/clippings/clippings_ctrl.php
+++ b/modules_v3/clippings/clippings_ctrl.php
@@ -25,13 +25,8 @@
use WT\User;
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-require_once WT_ROOT.'includes/functions/functions_export.php';
-require_once WT_ROOT.'library/pclzip.lib.php';
+require_once WT_ROOT . 'includes/functions/functions_export.php';
+require_once WT_ROOT . 'library/pclzip.lib.php';
/**
* Main controller class for the Clippings page.
@@ -48,7 +43,7 @@ class WT_Controller_Clippings {
var $conv_path;
var $privatize_export;
var $Zip;
- var $level1; // number of levels of ancestors
+ var $level1; // number of levels of ancestors
var $level2;
var $level3; // number of levels of descendents
@@ -99,11 +94,12 @@ class WT_Controller_Clippings {
} elseif (empty($this->id)) {
$this->action = '';
}
- if (!empty($this->id) && $this->type != 'FAM' && $this->type != 'INDI' && $this->type != 'SOUR')
- $this->action = 'add1';
+ if (!empty($this->id) && $this->type !== 'FAM' && $this->type !== 'INDI' && $this->type !== 'SOUR') {
+ $this->action = 'add1';
+ }
}
- if ($this->action == 'add1') {
+ if ($this->action === 'add1') {
$obj = WT_GedcomRecord::getInstance($this->id);
$this->addClipping($obj);
if ($this->type === 'SOUR') {
@@ -117,28 +113,28 @@ class WT_Controller_Clippings {
}
}
if ($this->type === 'FAM') {
- if ($others == 'parents') {
+ if ($others === 'parents') {
$this->addClipping($obj->getHusband());
$this->addClipping($obj->getWife());
- } elseif ($others == "members") {
+ } elseif ($others === "members") {
$this->addFamilyMembers(WT_Family::getInstance($this->id));
- } elseif ($others == "descendants") {
+ } elseif ($others === "descendants") {
$this->addFamilyDescendancy(WT_Family::getInstance($this->id));
}
} elseif ($this->type === 'INDI') {
- if ($others == 'parents') {
+ if ($others === 'parents') {
foreach (WT_Individual::getInstance($this->id)->getChildFamilies() as $family) {
$this->addFamilyMembers($family);
}
- } elseif ($others == 'ancestors') {
+ } elseif ($others === 'ancestors') {
$this->addAncestorsToCart(WT_Individual::getInstance($this->id), $this->level1);
- } elseif ($others == 'ancestorsfamilies') {
+ } elseif ($others === 'ancestorsfamilies') {
$this->addAncestorsToCartFamilies(WT_Individual::getInstance($this->id), $this->level2);
- } elseif ($others == 'members') {
+ } elseif ($others === 'members') {
foreach (WT_Individual::getInstance($this->id)->getSpouseFamilies() as $family) {
$this->addFamilyMembers($family);
}
- } elseif ($others == 'descendants') {
+ } elseif ($others === 'descendants') {
foreach (WT_Individual::getInstance($this->id)->getSpouseFamilies() as $family) {
$this->addClipping($family);
$this->addFamilyDescendancy($family, $this->level3);
@@ -146,12 +142,12 @@ class WT_Controller_Clippings {
}
uksort($WT_SESSION->cart[WT_GED_ID], array('WT_Controller_Clippings', 'compareClippings'));
}
- } elseif ($this->action == 'remove') {
+ } elseif ($this->action === 'remove') {
unset ($WT_SESSION->cart[WT_GED_ID][$this->id]);
- } elseif ($this->action == 'empty') {
- $WT_SESSION->cart[WT_GED_ID]=array();
- } elseif ($this->action == 'download') {
- $media = array ();
+ } elseif ($this->action === 'empty') {
+ $WT_SESSION->cart[WT_GED_ID] = array();
+ } elseif ($this->action === 'download') {
+ $media = array();
$mediacount = 0;
$filetext = gedcom_header(WT_GEDCOM);
// Include SUBM/SUBN records, if they exist
@@ -160,21 +156,21 @@ class WT_Controller_Clippings {
->execute(array('SUBN', WT_GED_ID))
->fetchOne();
if ($subn) {
- $filetext .= $subn."\n";
+ $filetext .= $subn . "\n";
}
$subm =
WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_type=? AND o_file=?")
->execute(array('SUBM', WT_GED_ID))
->fetchOne();
if ($subm) {
- $filetext .= $subm."\n";
+ $filetext .= $subm . "\n";
}
- if ($convert == "yes") {
+ if ($convert === "yes") {
$filetext = str_replace("UTF-8", "ANSI", $filetext);
$filetext = utf8_decode($filetext);
}
- switch($this->privatize_export) {
+ switch ($this->privatize_export) {
case 'gedadmin':
$access_level = WT_PRIV_NONE;
break;
@@ -191,22 +187,23 @@ class WT_Controller_Clippings {
foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
$object = WT_GedcomRecord::getInstance($xref);
- if ($object) { // The object may have been deleted since we added it to the cart....
+ // The object may have been deleted since we added it to the cart....
+ if ($object) {
$record = $object->privatizeGedcom($access_level);
// Remove links to objects that aren't in the cart
- preg_match_all('/\n1 '.WT_REGEX_TAG.' @('.WT_REGEX_XREF.')@(\n[2-9].*)*/', $record, $matches, PREG_SET_ORDER);
+ preg_match_all('/\n1 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\n[2-9].*)*/', $record, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
$record = str_replace($match[0], '', $record);
}
}
- preg_match_all('/\n2 '.WT_REGEX_TAG.' @('.WT_REGEX_XREF.')@(\n[3-9].*)*/', $record, $matches, PREG_SET_ORDER);
+ preg_match_all('/\n2 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\n[3-9].*)*/', $record, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
$record = str_replace($match[0], '', $record);
}
}
- preg_match_all('/\n3 '.WT_REGEX_TAG.' @('.WT_REGEX_XREF.')@(\n[4-9].*)*/', $record, $matches, PREG_SET_ORDER);
+ preg_match_all('/\n3 ' . WT_REGEX_TAG . ' @(' . WT_REGEX_XREF . ')@(\n[4-9].*)*/', $record, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
if (!array_key_exists($match[1], $WT_SESSION->cart[WT_GED_ID])) {
$record = str_replace($match[0], '', $record);
@@ -219,27 +216,27 @@ class WT_Controller_Clippings {
}
switch ($object::RECORD_TYPE) {
case 'INDI':
- $filetext .= $record."\n";
+ $filetext .= $record . "\n";
$filetext .= "1 SOUR @WEBTREES@\n";
- $filetext .= "2 PAGE ".WT_SERVER_NAME.WT_SCRIPT_PATH.$object->getRawUrl()."\n";
+ $filetext .= "2 PAGE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
break;
case 'FAM':
- $filetext .= $record."\n";
+ $filetext .= $record . "\n";
$filetext .= "1 SOUR @WEBTREES@\n";
- $filetext .= "2 PAGE ".WT_SERVER_NAME.WT_SCRIPT_PATH.$object->getRawUrl()."\n";
+ $filetext .= "2 PAGE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
break;
case 'SOUR':
- $filetext .= $record."\n";
- $filetext .= "1 NOTE ".WT_SERVER_NAME.WT_SCRIPT_PATH.$object->getRawUrl()."\n";
+ $filetext .= $record . "\n";
+ $filetext .= "1 NOTE " . WT_SERVER_NAME . WT_SCRIPT_PATH . $object->getRawUrl() . "\n";
break;
default:
$ft = preg_match_all("/\n\d FILE (.+)/", $savedRecord, $match, PREG_SET_ORDER);
for ($k = 0; $k < $ft; $k++) {
// Skip external files and non-existant files
if (file_exists(WT_DATA_DIR . $MEDIA_DIRECTORY . $match[$k][1])) {
- $media[$mediacount] = array (
+ $media[$mediacount] = array(
PCLZIP_ATT_FILE_NAME => WT_DATA_DIR . $MEDIA_DIRECTORY . $match[$k][1],
- PCLZIP_ATT_FILE_NEW_FULL_NAME => $match[$k][1],
+ PCLZIP_ATT_FILE_NEW_FULL_NAME => $match[$k][1],
);
$mediacount++;
}
@@ -250,10 +247,10 @@ class WT_Controller_Clippings {
}
}
- if ($this->IncludeMedia == "yes") {
+ if ($this->IncludeMedia === "yes") {
$this->media_list = $media;
}
- $filetext .= "0 @WEBTREES@ SOUR\n1 TITL ".WT_SERVER_NAME.WT_SCRIPT_PATH."\n";
+ $filetext .= "0 @WEBTREES@ SOUR\n1 TITL " . WT_SERVER_NAME . WT_SCRIPT_PATH . "\n";
if ($user_id = $WT_TREE->getPreference('CONTACT_EMAIL')) {
$user = User::find($user_id);
$filetext .= "1 AUTH " . $user->getRealName() . "\n";
@@ -270,31 +267,31 @@ class WT_Controller_Clippings {
* Loads everything in the clippings cart into a zip file.
*/
function zipCart() {
- $tempFileName = 'clipping'.rand().'.ged';
- $fp = fopen(WT_DATA_DIR.$tempFileName, "wb");
+ $tempFileName = 'clipping' . rand() . '.ged';
+ $fp = fopen(WT_DATA_DIR . $tempFileName, "wb");
if ($fp) {
- flock($fp,LOCK_EX);
- fwrite($fp,$this->download_data);
- flock($fp,LOCK_UN);
+ flock($fp, LOCK_EX);
+ fwrite($fp, $this->download_data);
+ flock($fp, LOCK_UN);
fclose($fp);
- $zipName = "clippings".rand(0, 1500).".zip";
- $fname = WT_DATA_DIR.$zipName;
- $comment = "Created by ".WT_WEBTREES." ".WT_VERSION." on ".date("d M Y").".";
+ $zipName = "clippings" . rand(0, 1500) . ".zip";
+ $fname = WT_DATA_DIR . $zipName;
+ $comment = "Created by " . WT_WEBTREES . " " . WT_VERSION . " on " . date("d M Y") . ".";
$archive = new PclZip($fname);
// add the ged file to the root of the zip file (strip off the data folder)
- $this->media_list[]= array (PCLZIP_ATT_FILE_NAME => WT_DATA_DIR.$tempFileName, PCLZIP_ATT_FILE_NEW_FULL_NAME => $tempFileName);
+ $this->media_list[] = array(PCLZIP_ATT_FILE_NAME => WT_DATA_DIR . $tempFileName, PCLZIP_ATT_FILE_NEW_FULL_NAME => $tempFileName);
$v_list = $archive->create($this->media_list, PCLZIP_OPT_COMMENT, $comment);
if ($v_list == 0) {
- echo "Error : ".$archive->errorInfo(true)."</td></tr>";
+ echo "Error : " . $archive->errorInfo(true) . "</td></tr>";
} else {
- $openedFile = fopen($fname,"rb");
- $this->download_data = fread($openedFile,filesize($fname));
+ $openedFile = fopen($fname, "rb");
+ $this->download_data = fread($openedFile, filesize($fname));
fclose($openedFile);
unlink($fname);
}
- unlink(WT_DATA_DIR.$tempFileName);
+ unlink(WT_DATA_DIR . $tempFileName);
} else {
- echo WT_I18N::translate('Cannot create')." ".WT_DATA_DIR."$tempFileName ".WT_I18N::translate('Check access rights on this directory.')."<br><br>";
+ echo WT_I18N::translate('Cannot create') . " " . WT_DATA_DIR . "$tempFileName " . WT_I18N::translate('Check access rights on this directory.') . "<br><br>";
}
}
@@ -305,7 +302,7 @@ class WT_Controller_Clippings {
function downloadClipping() {
Zend_Session::writeClose();
- if ($this->IncludeMedia == 'yes' || $this->Zip == 'yes') {
+ if ($this->IncludeMedia === 'yes' || $this->Zip === 'yes') {
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="clipping.zip"');
$this->zipCart();
@@ -328,11 +325,11 @@ class WT_Controller_Clippings {
global $WT_SESSION;
if ($record->canShowName()) {
- $WT_SESSION->cart[WT_GED_ID][$record->getXref()]=true;
+ $WT_SESSION->cart[WT_GED_ID][$record->getXref()] = true;
// Add directly linked records
- preg_match_all('/\n\d (?:OBJE|NOTE|SOUR|REPO) @('.WT_REGEX_XREF.')@/', $record->getGedcom(), $matches);
+ preg_match_all('/\n\d (?:OBJE|NOTE|SOUR|REPO) @(' . WT_REGEX_XREF . ')@/', $record->getGedcom(), $matches);
foreach ($matches[1] as $match) {
- $WT_SESSION->cart[WT_GED_ID][$match]=true;
+ $WT_SESSION->cart[WT_GED_ID][$match] = true;
}
}
}
@@ -354,8 +351,8 @@ class WT_Controller_Clippings {
$this->addClipping($child);
foreach ($child->getSpouseFamilies() as $child_family) {
$this->addClipping($child_family);
- if ($level>0) {
- $this->addFamilyDescendancy($child_family, $level-1); // recurse on the childs family
+ if ($level > 0) {
+ $this->addFamilyDescendancy($child_family, $level - 1); // recurse on the childs family
}
}
}
@@ -390,11 +387,11 @@ class WT_Controller_Clippings {
return;
}
$this->addClipping($person);
- if ($level>0) {
+ if ($level > 0) {
foreach ($person->getChildFamilies() as $family) {
$this->addClipping($family);
- $this->addAncestorsToCart($family->getHusband(), $level-1);
- $this->addAncestorsToCart($family->getWife(), $level-1);
+ $this->addAncestorsToCart($family->getHusband(), $level - 1);
+ $this->addAncestorsToCart($family->getWife(), $level - 1);
}
}
}
@@ -409,11 +406,11 @@ class WT_Controller_Clippings {
if (!$person) {
return;
}
- if ($level>0) {
+ if ($level > 0) {
foreach ($person->getChildFamilies() as $family) {
$this->addFamilyMembers($family);
- $this->addAncestorsToCartFamilies($family->getHusband(), $level-1);
- $this->addAncestorsToCartFamilies($family->getWife(), $level-1);
+ $this->addAncestorsToCartFamilies($family->getHusband(), $level - 1);
+ $this->addAncestorsToCartFamilies($family->getWife(), $level - 1);
}
}
}
@@ -427,29 +424,29 @@ class WT_Controller_Clippings {
* @return integer
*/
static function compareClippings($a, $b) {
- $a=WT_GedcomRecord::getInstance($a);
- $b=WT_GedcomRecord::getInstance($b);
+ $a = WT_GedcomRecord::getInstance($a);
+ $b = WT_GedcomRecord::getInstance($b);
if ($a && $b) {
switch ($a::RECORD_TYPE) {
- case 'INDI': $t1=1; break;
- case 'FAM': $t1=2; break;
- case 'SOUR': $t1=3; break;
- case 'REPO': $t1=4; break;
- case 'OBJE': $t1=5; break;
- case 'NOTE': $t1=6; break;
- default: $t1=7; break;
+ case 'INDI': $t1 = 1; break;
+ case 'FAM': $t1 = 2; break;
+ case 'SOUR': $t1 = 3; break;
+ case 'REPO': $t1 = 4; break;
+ case 'OBJE': $t1 = 5; break;
+ case 'NOTE': $t1 = 6; break;
+ default: $t1 = 7; break;
}
switch ($b::RECORD_TYPE) {
- case 'INDI': $t2=1; break;
- case 'FAM': $t2=2; break;
- case 'SOUR': $t2=3; break;
- case 'REPO': $t2=4; break;
- case 'OBJE': $t2=5; break;
- case 'NOTE': $t2=6; break;
- default: $t2=7; break;
+ case 'INDI': $t2 = 1; break;
+ case 'FAM': $t2 = 2; break;
+ case 'SOUR': $t2 = 3; break;
+ case 'REPO': $t2 = 4; break;
+ case 'OBJE': $t2 = 5; break;
+ case 'NOTE': $t2 = 6; break;
+ default: $t2 = 7; break;
}
- if ($t1!=$t2) {
- return $t1-$t2;
+ if ($t1 != $t2) {
+ return $t1 - $t2;
} else {
return WT_GedcomRecord::compare($a, $b);
}
diff --git a/modules_v3/clippings/help_text.php b/modules_v3/clippings/help_text.php
deleted file mode 100644
index fa0f20ca47..0000000000
--- a/modules_v3/clippings/help_text.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'add_by_id':
- $title=WT_I18N::translate('Add by ID');
- $text=WT_I18N::translate('This input box lets you enter an individual’s ID number so he can be added to the clippings cart. Once added you’ll be offered options to link that individual’s relations to your clippings cart.<br><br>If you do not know an individual’s ID number, you can perform a search by name by pressing the individual icon next to the “Add” button.');
- break;
-
-case 'empty_cart':
- $title=WT_I18N::translate('Empty the clippings cart');
- $text=WT_I18N::translate('When you click this link your clippings cart will be totally emptied.<br><br>If you don’t want to remove all individuals, families, etc. from the clippings cart, you can remove items individually by clicking the <b>Remove</b> link in the name boxes. There is <u>no</u> confirmation dialog when you click either of these links; the requested deletion takes place immediately.');
- break;
-}
diff --git a/modules_v3/clippings/module.php b/modules_v3/clippings/module.php
index 5022345b49..f4fb498f19 100644
--- a/modules_v3/clippings/module.php
+++ b/modules_v3/clippings/module.php
@@ -40,9 +40,9 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
/** {@inheritdoc} */
public function modAction($mod_action) {
- switch($mod_action) {
+ switch ($mod_action) {
case 'ajax':
- $html=$this->getSidebarAjaxContent();
+ $html = $this->getSidebarAjaxContent();
Zend_Session::writeClose();
header('Content-Type: text/html; charset=UTF-8');
echo $html;
@@ -50,16 +50,16 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
case 'index':
global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $GEDCOM_MEDIA_PATH;
- require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php';
- require_once WT_ROOT.'includes/functions/functions_export.php';
+ require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
+ require_once WT_ROOT . 'includes/functions/functions_export.php';
- $clip_ctrl=new WT_Controller_Clippings();
+ $clip_ctrl = new WT_Controller_Clippings;
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->setPageTitle($this->getTitle())
->PageHeader()
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
echo '<script>';
@@ -70,9 +70,9 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
echo '<h2>', WT_I18N::translate('Family tree clippings cart'), '</h2>';
}
- if ($clip_ctrl->action=='add') {
+ if ($clip_ctrl->action == 'add') {
$person = WT_GedcomRecord::getInstance($clip_ctrl->id);
- echo '<h3><a href="', $person->getHtmlUrl(), '">'.$person->getFullName(), '</a></h3>';
+ echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>';
if ($clip_ctrl->type === 'FAM') { ?>
<form action="module.php" method="get">
<input type="hidden" name="mod" value="clippings">
@@ -111,7 +111,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?>">
</table>
</form>
- <?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
+ <?php } elseif ($clip_ctrl->type === 'SOUR') { ?>
<form action="module.php" method="get">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
@@ -128,12 +128,12 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<?php }
}
- if ($clip_ctrl->privCount>0) {
- echo "<span class=\"error\">".WT_I18N::translate('Some items could not be added due to privacy restrictions')."</span><br><br>";
+ if ($clip_ctrl->privCount > 0) {
+ echo "<span class=\"error\">" . WT_I18N::translate('Some items could not be added due to privacy restrictions') . "</span><br><br>";
}
if (!$WT_SESSION->cart[WT_GED_ID]) {
- if ($clip_ctrl->action!='add') {
+ if ($clip_ctrl->action != 'add') {
echo WT_I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.</li></ul>');
?>
@@ -143,7 +143,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<table>
<tr>
<td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?>
+ <?php echo WT_I18N::translate('Enter an individual, family, or source ID'); ?>
</td>
</tr>
<tr>
@@ -169,7 +169,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
} else {
// Keep track of the INDI from the parent page, otherwise it will
// get lost after ajax updates
- $pid=WT_Filter::get('pid', WT_REGEX_XREF);
+ $pid = WT_Filter::get('pid', WT_REGEX_XREF);
if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?>
<table><tr><td class="width33" valign="top" rowspan="3">
@@ -189,7 +189,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<?php if (WT_USER_GEDCOM_ADMIN) { ?>
<tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?></td>
<td class="optionbox">
- <input type="radio" name="privatize_export" value="none" checked="checked"> <?php echo WT_I18N::translate('None'); ?><br>
+ <input type="radio" name="privatize_export" value="none" checked> <?php echo WT_I18N::translate('None'); ?><br>
<input type="radio" name="privatize_export" value="gedadmin"> <?php echo WT_I18N::translate('Manager'); ?><br>
<input type="radio" name="privatize_export" value="user"> <?php echo WT_I18N::translate('Member'); ?><br>
<input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?>
@@ -197,7 +197,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<?php } elseif (WT_USER_CAN_ACCESS) { ?>
<tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?></td>
<td class="optionbox">
- <input type="radio" name="privatize_export" value="user" checked="checked"> <?php echo WT_I18N::translate('Member'); ?><br>
+ <input type="radio" name="privatize_export" value="user" checked> <?php echo WT_I18N::translate('Member'); ?><br>
<input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?>
</td></tr>
<?php } ?>
@@ -226,7 +226,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<table>
<tr>
<td colspan="2" class="topbottombar" style="text-align:center; ">
- <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?>
+ <?php echo WT_I18N::translate('Enter an individual, family, or source ID'); ?>
</td>
</tr>
<tr>
@@ -247,7 +247,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
<?php } ?>
- <br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo WT_I18N::translate('Empty the clippings cart'); ?></a><?php echo help_link('empty_cart', $this->getName()); ?>
+ <br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php echo WT_I18N::translate('Empty the clippings cart'); ?></a>
</td></tr>
<tr><td class="topbottombar"><h2><?php echo WT_I18N::translate('Family tree clippings cart'); ?></h2></td></tr>
@@ -260,16 +260,16 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
</tr>
<?php
foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
- $record=WT_GedcomRecord::getInstance($xref);
+ $record = WT_GedcomRecord::getInstance($xref);
if ($record) {
switch ($record::RECORD_TYPE) {
- case 'INDI': $icon='icon-indis'; break;
- case 'FAM': $icon='icon-sfamily'; break;
- case 'SOUR': $icon='icon-source'; break;
- case 'REPO': $icon='icon-repository'; break;
- case 'NOTE': $icon='icon-note'; break;
- case 'OBJE': $icon='icon-media'; break;
- default: $icon='icon-clippings'; break;
+ case 'INDI': $icon = 'icon-indis'; break;
+ case 'FAM': $icon = 'icon-sfamily'; break;
+ case 'SOUR': $icon = 'icon-source'; break;
+ case 'REPO': $icon = 'icon-repository'; break;
+ case 'NOTE': $icon = 'icon-note'; break;
+ case 'OBJE': $icon = 'icon-media'; break;
+ default: $icon = 'icon-clippings'; break;
}
?>
<tr><td class="list_value">
@@ -308,13 +308,13 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
return null;
}
//-- main clippings menu item
- $menu = new WT_Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged='.WT_GEDURL, 'menu-clippings');
+ $menu = new WT_Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . WT_GEDURL, 'menu-clippings');
if (isset($controller->record)) {
- $submenu = new WT_Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged='.WT_GEDURL, 'menu-clippingscart');
+ $submenu = new WT_Menu($this->getTitle(), 'module.php?mod=clippings&amp;mod_action=index&amp;ged=' . WT_GEDURL, 'menu-clippingscart');
$menu->addSubmenu($submenu);
}
if (!empty($controller->record) && $controller->record->canShow()) {
- $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id='.$controller->record->getXref(), 'menu-clippingsadd');
+ $submenu = new WT_Menu(WT_I18N::translate('Add to clippings cart'), 'module.php?mod=clippings&amp;mod_action=index&amp;action=add&amp;id=' . $controller->record->getXref(), 'menu-clippingsadd');
$menu->addSubmenu($submenu);
}
return $menu;
@@ -332,10 +332,10 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
if ($SEARCH_SPIDER) {
return false;
} else {
- require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php';
+ require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
// Creating a controller has the side effect of initialising the cart
- new WT_Controller_Clippings();
+ new WT_Controller_Clippings;
return true;
}
@@ -352,16 +352,16 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
});
');
- return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
+ return '<div id="sb_clippings_content">' . $this->getCartList() . '</div>';
}
/** {@inheritdoc} */
public function getSidebarAjaxContent() {
- require_once WT_ROOT.WT_MODULES_DIR.'clippings/clippings_ctrl.php';
+ require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
global $WT_SESSION;
- $clip_ctrl = new WT_Controller_Clippings();
+ $clip_ctrl = new WT_Controller_Clippings;
$add = WT_Filter::get('add', WT_REGEX_XREF);
$add1 = WT_Filter::get('add1', WT_REGEX_XREF);
@@ -406,7 +406,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
} elseif ($remove) {
unset ($WT_SESSION->cart[WT_GED_ID][$remove]);
} elseif (isset($_REQUEST['empty'])) {
- $WT_SESSION->cart[WT_GED_ID] = array ();
+ $WT_SESSION->cart[WT_GED_ID] = array();
} elseif (isset($_REQUEST['download'])) {
return $this->downloadForm($clip_ctrl);
}
@@ -423,52 +423,52 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
// Keep track of the INDI from the parent page, otherwise it will
// get lost after ajax updates
- $pid=WT_Filter::get('pid', WT_REGEX_XREF);
+ $pid = WT_Filter::get('pid', WT_REGEX_XREF);
if (!$WT_SESSION->cart[WT_GED_ID]) {
- $out=WT_I18N::translate('Your clippings cart is empty.');
+ $out = WT_I18N::translate('Your clippings cart is empty.');
} else {
- $out='<ul>';
+ $out = '<ul>';
foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
- $record=WT_GedcomRecord::getInstance($xref);
- if ($record && ($record::RECORD_TYPE=='INDI' || $record::RECORD_TYPE=='FAM')) { // Just show INDI/FAM in the sidbar
+ $record = WT_GedcomRecord::getInstance($xref);
+ if ($record && ($record::RECORD_TYPE == 'INDI' || $record::RECORD_TYPE == 'FAM')) {
switch ($record::RECORD_TYPE) {
- case 'INDI': $icon='icon-indis'; break;
- case 'FAM': $icon='icon-sfamily'; break;
+ case 'INDI': $icon = 'icon-indis'; break;
+ case 'FAM': $icon = 'icon-sfamily'; break;
}
$out .= '<li>';
if (!empty($icon)) {
- $out .= '<i class="'.$icon.'"></i>';
+ $out .= '<i class="' . $icon . '"></i>';
}
- $out .= '<a href="'.$record->getHtmlUrl().'">';
+ $out .= '<a href="' . $record->getHtmlUrl() . '">';
if ($record::RECORD_TYPE == 'INDI') {
- $out .=$record->getSexImage();
+ $out .= $record->getSexImage();
}
- $out .= ' '.$record->getFullName().' ';
+ $out .= ' ' . $record->getFullName() . ' ';
if ($record::RECORD_TYPE == 'INDI' && $record->canShow()) {
- $out .= ' ('.$record->getLifeSpan().')';
+ $out .= ' (' . $record->getLifeSpan() . ')';
}
$out .= '</a>';
- $out .= '<a class="icon-remove remove_cart" href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove='.$xref.'&amp;pid='.$pid.'" title="'.WT_I18N::translate('Remove').'"></a>';
- $out .='</li>';
+ $out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . WT_I18N::translate('Remove') . '"></a>';
+ $out .= '</li>';
}
}
- $out.='</ul>';
+ $out .= '</ul>';
}
if ($WT_SESSION->cart[WT_GED_ID]) {
- $out.=
- '<br><a href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid='.$pid.'" class="remove_cart">'.
- WT_I18N::translate('Empty the clippings cart').
- '</a>'.help_link('empty_cart', $this->getName()).
- '<br>'.
- '<a href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid='.$pid.'" class="add_cart">'.
- WT_I18N::translate('Download').
+ $out .=
+ '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' .
+ WT_I18N::translate('Empty the clippings cart') .
+ '</a>' .
+ '<br>' .
+ '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' .
+ WT_I18N::translate('Download') .
'</a>';
}
- $record=WT_Individual::getInstance($pid);
+ $record = WT_Individual::getInstance($pid);
if ($record && !array_key_exists($record->getXref(), $WT_SESSION->cart[WT_GED_ID])) {
- $out .= '<br><a href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=clippings&amp;add='.$pid.'&amp;pid='.$pid.'" class="add_cart"><i class="icon-clippings"></i> '.WT_I18N::translate('Add %s to the clippings cart', $record->getFullName()).'</a>';
+ $out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;add=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . WT_I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
}
return $out;
}
@@ -481,68 +481,69 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
public function askAddOptions(WT_Individual $person) {
global $MAX_PEDIGREE_GENERATIONS;
- $out = '<h3><a href="'.$person->getHtmlUrl().'">'.$person->getFullName().'</a></h3>';
+ $out = '<h3><a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a></h3>';
$out .= '<script>';
$out .= 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}
function continueAjax(frm) {
var others = jQuery("input[name=\'others\']:checked").val();
- var link = "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
+ var link = "module.php?mod='.$this->getName() . '&mod_action=ajax&sb_action=clippings&add1="+frm.pid.value+"&others="+others+"&level1="+frm.level1.value+"&level2="+frm.level2.value+"&level3="+frm.level3.value;
jQuery("#sb_clippings_content").load(link);
}';
$out .= '</script>';
- if ($person::RECORD_TYPE=='FAM') {
+ if ($person::RECORD_TYPE == 'FAM') {
$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
<table>
- <tr><td class="topbottombar">'.WT_I18N::translate('Which other links from this family would you like to add?').'
- <input type="hidden" name="pid" value="'.$person->getXref().'">
- <input type="hidden" name="type" value="'.$person::RECORD_TYPE.'">
+ <tr><td class="topbottombar">'.WT_I18N::translate('Which other links from this family would you like to add?') . '
+ <input type="hidden" name="pid" value="'.$person->getXref() . '">
+ <input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
<input type="hidden" name="action" value="add1"></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this family record.').'</td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="parents">'.WT_I18N::translate('Add parents’ records together with this family record.').'</td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="members">'.WT_I18N::translate('Add parents’ and children’s records together with this family record.').'</td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="descendants">'.WT_I18N::translate('Add parents’ and all descendants’ records together with this family record.').'</td></tr>
- <tr><td class="topbottombar"><input type="submit" value="'.WT_I18N::translate('Continue adding').'"></td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this family record.') . '</td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="parents">'.WT_I18N::translate('Add parents’ records together with this family record.') . '</td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="members">'.WT_I18N::translate('Add parents’ and children’s records together with this family record.') . '</td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="descendants">'.WT_I18N::translate('Add parents’ and all descendants’ records together with this family record.') . '</td></tr>
+ <tr><td class="topbottombar"><input type="submit" value="'.WT_I18N::translate('Continue adding') . '"></td></tr>
</table>
</form>';
- } elseif ($person::RECORD_TYPE=='INDI') {
+ } elseif ($person::RECORD_TYPE == 'INDI') {
$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
- '.WT_I18N::translate('Which links from this individual would you also like to add?').'
- <input type="hidden" name="pid" value="'.$person->getXref().'">
- <input type="hidden" name="type" value="'.$person::RECORD_TYPE.'">
+ '.WT_I18N::translate('Which links from this individual would you also like to add?') . '
+ <input type="hidden" name="pid" value="'.$person->getXref() . '">
+ <input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
<input type="hidden" name="action" value="add1">
<ul>
- <li><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this individual.').'</li>
- <li><input type="radio" name="others" value="parents">'.WT_I18N::translate('Add this individual, his parents, and siblings.').'</li>
- <li><input type="radio" name="others" value="ancestors" id="ancestors">'.WT_I18N::translate('Add this individual and his direct line ancestors.').'<br>
- '.WT_I18N::translate('Number of generations:').'<input type="text" size="4" name="level1" value="'.$MAX_PEDIGREE_GENERATIONS.'" onfocus="radAncestors(\'ancestors\');"></li>
- <li><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">'.WT_I18N::translate('Add this individual, his direct line ancestors, and their families.').'<br>
- '.WT_I18N::translate('Number of generations:').' <input type="text" size="4" name="level2" value="'. $MAX_PEDIGREE_GENERATIONS.'" onfocus="radAncestors(\'ancestorsfamilies\');"></li>
- <li><input type="radio" name="others" value="members">'.WT_I18N::translate('Add this individual, his spouse, and children.').'</li>
- <li><input type="radio" name="others" value="descendants" id="descendants">'.WT_I18N::translate('Add this individual, his spouse, and all descendants.').'<br >
- '.WT_I18N::translate('Number of generations:').' <input type="text" size="4" name="level3" value="'.$MAX_PEDIGREE_GENERATIONS.'" onfocus="radAncestors(\'descendants\');"></li>
+ <li><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this individual.') . '</li>
+ <li><input type="radio" name="others" value="parents">'.WT_I18N::translate('Add this individual, his parents, and siblings.') . '</li>
+ <li><input type="radio" name="others" value="ancestors" id="ancestors">'.WT_I18N::translate('Add this individual and his direct line ancestors.') . '<br>
+ '.WT_I18N::translate('Number of generations:') . '<input type="text" size="4" name="level1" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestors\');"></li>
+ <li><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">'.WT_I18N::translate('Add this individual, his direct line ancestors, and their families.') . '<br>
+ '.WT_I18N::translate('Number of generations:') . ' <input type="text" size="4" name="level2" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'ancestorsfamilies\');"></li>
+ <li><input type="radio" name="others" value="members">'.WT_I18N::translate('Add this individual, his spouse, and children.') . '</li>
+ <li><input type="radio" name="others" value="descendants" id="descendants">'.WT_I18N::translate('Add this individual, his spouse, and all descendants.') . '<br >
+ '.WT_I18N::translate('Number of generations:') . ' <input type="text" size="4" name="level3" value="' . $MAX_PEDIGREE_GENERATIONS . '" onfocus="radAncestors(\'descendants\');"></li>
</ul>
- <input type="submit" value="'.WT_I18N::translate('Continue adding').'">
+ <input type="submit" value="'.WT_I18N::translate('Continue adding') . '">
</form>';
- } else if ($person::RECORD_TYPE == 'SOUR') {
+ } else if ($person::RECORD_TYPE == 'SOUR') {
$out .= '<form action="module.php" method="get" onsubmit="continueAjax(this); return false;">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
<table>
- <tr><td class="topbottombar">'.WT_I18N::translate('Which records linked to this source should be added?').'
- <input type="hidden" name="pid" value="'.$person->getXref().'">
- <input type="hidden" name="type" value="'.$person::RECORD_TYPE.'">
+ <tr><td class="topbottombar">'.WT_I18N::translate('Which records linked to this source should be added?') . '
+ <input type="hidden" name="pid" value="'.$person->getXref() . '">
+ <input type="hidden" name="type" value="'.$person::RECORD_TYPE . '">
<input type="hidden" name="action" value="add1"></td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this source.').'</td></tr>
- <tr><td class="optionbox"><input type="radio" name="others" value="linked">'.WT_I18N::translate('Add this source and families/individuals linked to it.').'</td></tr>
- <tr><td class="topbottombar"><input type="submit" value="'.WT_I18N::translate('Continue adding').'">
+ <tr><td class="optionbox"><input type="radio" name="others" checked value="none">'.WT_I18N::translate('Add just this source.') . '</td></tr>
+ <tr><td class="optionbox"><input type="radio" name="others" value="linked">'.WT_I18N::translate('Add this source and families/individuals linked to it.') . '</td></tr>
+ <tr><td class="topbottombar"><input type="submit" value="'.WT_I18N::translate('Continue adding') . '">
</table>
</form>';
+ } else {
+ return $this->getSidebarContent();
}
- else return $this->getSidebarContent();
return $out;
}
@@ -553,7 +554,7 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
*/
public function downloadForm(WT_Controller_Clippings $clip_ctrl) {
global $GEDCOM_MEDIA_PATH;
- $pid=WT_Filter::get('pid', WT_REGEX_XREF);
+ $pid = WT_Filter::get('pid', WT_REGEX_XREF);
$out = '<script>';
$out .= 'function cancelDownload() {
@@ -564,53 +565,53 @@ class clippings_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module
$out .= '<form method="get" action="module.php">
<input type="hidden" name="mod" value="clippings">
<input type="hidden" name="mod_action" value="index">
- <input type="hidden" name="pid" value="'.$pid.'">
+ <input type="hidden" name="pid" value="'.$pid . '">
<input type="hidden" name="action" value="download">
<table>
- <tr><td colspan="2" class="topbottombar"><h2>'.WT_I18N::translate('Download').'</h2></td></tr>
- <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Zip file(s)').help_link('zip').'</td>
- <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked="checked"></td></tr>
+ <tr><td colspan="2" class="topbottombar"><h2>'.WT_I18N::translate('Download') . '</h2></td></tr>
+ <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Zip file(s)') . help_link('zip') . '</td>
+ <td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked></td></tr>
- <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Include media (automatically zips files)').help_link('include_media').'</td>
- <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked="checked"></td></tr>
+ <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Include media (automatically zips files)') . help_link('include_media') . '</td>
+ <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked></td></tr>
';
if (WT_USER_GEDCOM_ADMIN) {
- $out.=
- '<tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Apply privacy settings?').help_link('apply_privacy').'</td>'.
- '<td class="optionbox">'.
- ' <input type="radio" name="privatize_export" value="none" checked="checked"> '.WT_I18N::translate('None').'<br>'.
- ' <input type="radio" name="privatize_export" value="gedadmin"> '.WT_I18N::translate('Manager').'<br>'.
- ' <input type="radio" name="privatize_export" value="user"> '.WT_I18N::translate('Member').'<br>'.
- ' <input type="radio" name="privatize_export" value="visitor"> '.WT_I18N::translate('Visitor').
+ $out .=
+ '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' .
+ '<td class="optionbox">' .
+ ' <input type="radio" name="privatize_export" value="none" checked> ' . WT_I18N::translate('None') . '<br>' .
+ ' <input type="radio" name="privatize_export" value="gedadmin"> ' . WT_I18N::translate('Manager') . '<br>' .
+ ' <input type="radio" name="privatize_export" value="user"> ' . WT_I18N::translate('Member') . '<br>' .
+ ' <input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') .
'</td></tr>';
} elseif (WT_USER_CAN_ACCESS) {
- $out.=
- '<tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Apply privacy settings?').help_link('apply_privacy').'</td>'.
- '<td class="list_value">'.
- ' <input type="radio" name="privatize_export" value="user" checked="checked"> '.WT_I18N::translate('Member').'<br>'.
- ' <input type="radio" name="privatize_export" value="visitor"> '.WT_I18N::translate('Visitor').
+ $out .=
+ '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' .
+ '<td class="list_value">' .
+ ' <input type="radio" name="privatize_export" value="user" checked> ' . WT_I18N::translate('Member') . '<br>' .
+ ' <input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') .
'</td></tr>';
}
- $out .='
- <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)').help_link('utf8_ansi').'</td>
+ $out .= '
+ <tr><td class="descriptionbox width50 wrap">'.WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)') . help_link('utf8_ansi') . '</td>
<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>
<tr>
- <td class="descriptionbox width50 wrap">'.WT_I18N::translate('Add the GEDCOM media path to filenames').help_link('GEDCOM_MEDIA_PATH').'</td>
+ <td class="descriptionbox width50 wrap">'.WT_I18N::translate('Add the GEDCOM media path to filenames') . help_link('GEDCOM_MEDIA_PATH') . '</td>
<td class="optionbox">
<input type="checkbox" name="conv_path" value="' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '">
<span dir="auto">' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '</span></td>
</tr>
- <input type="hidden" name="conv_path" value="'.$clip_ctrl->conv_path.'">
+ <input type="hidden" name="conv_path" value="'.$clip_ctrl->conv_path . '">
</td></tr>
<tr><td class="topbottombar" colspan="2">
- <input type="button" value="'.WT_I18N::translate('Cancel').'" onclick="cancelDownload();">
- <input type="submit" value="'.WT_I18N::translate('Download').'">
+ <input type="button" value="'.WT_I18N::translate('Cancel') . '" onclick="cancelDownload();">
+ <input type="submit" value="'.WT_I18N::translate('Download') . '">
</form>';
return $out;
diff --git a/modules_v3/death_report/module.php b/modules_v3/death_report/module.php
index d33554f85b..360b29d10b 100644
--- a/modules_v3/death_report/module.php
+++ b/modules_v3/death_report/module.php
@@ -44,13 +44,13 @@ class death_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/descendancy/module.php b/modules_v3/descendancy/module.php
index 6e138323ec..0e625b56e3 100644
--- a/modules_v3/descendancy/module.php
+++ b/modules_v3/descendancy/module.php
@@ -55,7 +55,6 @@ class descendancy_WT_Module extends WT_Module implements WT_Module_Sidebar {
header('HTTP/1.0 404 Not Found');
break;
}
- exit;
}
/** {@inheritdoc} */
diff --git a/modules_v3/descendancy_report/module.php b/modules_v3/descendancy_report/module.php
index f68720f97d..19a3cfe4bb 100644
--- a/modules_v3/descendancy_report/module.php
+++ b/modules_v3/descendancy_report/module.php
@@ -44,13 +44,13 @@ class descendancy_report_WT_Module extends WT_Module implements WT_Module_Report
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/fact_sources/module.php b/modules_v3/fact_sources/module.php
index 0102ed802a..fa5bd08361 100644
--- a/modules_v3/fact_sources/module.php
+++ b/modules_v3/fact_sources/module.php
@@ -42,13 +42,13 @@ class fact_sources_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/families/module.php b/modules_v3/families/module.php
index 2b1487527a..1903cb8c76 100644
--- a/modules_v3/families/module.php
+++ b/modules_v3/families/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -19,6 +19,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Theme;
+
/**
* Class families_WT_Module
*/
@@ -45,7 +47,6 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
header('HTTP/1.0 404 Not Found');
break;
}
- exit;
}
/** {@inheritdoc} */
@@ -68,7 +69,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
if ($search) {
return $this->search($search);
- } elseif ($alpha=='@' || $alpha==',' || $surname) {
+ } elseif ($alpha == '@' || $alpha == ',' || $surname) {
return $this->getSurnameFams($alpha, $surname);
} elseif ($alpha) {
return $this->getAlphaSurnames($alpha, $surname);
@@ -79,7 +80,7 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
/** {@inheritdoc} */
public function getSidebarContent() {
- global $WT_IMAGES, $UNKNOWN_NN, $controller;
+ global $UNKNOWN_NN, $controller;
// Fetch a list of the initial letters of all surnames in the database
$initials = WT_Query_Name::surnameAlpha(true, false, WT_GED_ID, false);
@@ -109,12 +110,12 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
if (!famloadedNames[surname]) {
jQuery.ajax({
- url: "module.php?mod='.$this->getName().'&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname,
+ url: "module.php?mod='.$this->getName() . '&mod_action=ajax&sb_action=families&alpha="+alpha+"&surname="+surname,
cache: false,
success: function(html) {
jQuery("#sb_fam_"+surname+" div").html(html);
jQuery("#sb_fam_"+surname+" div").show();
- jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['minus'].')");
+ jQuery("#sb_fam_"+surname).css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
famloadedNames[surname]=2;
}
});
@@ -122,37 +123,37 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
else if (famloadedNames[surname]==1) {
famloadedNames[surname]=2;
jQuery("#sb_fam_"+surname+" div").show();
- jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['minus'].')");
+ jQuery("#sb_fam_"+surname).css("list-style-image", "url(' . Theme::theme()->parameter('image-minus') . ')");
}
else {
famloadedNames[surname]=1;
jQuery("#sb_fam_"+surname+" div").hide();
- jQuery("#sb_fam_"+surname).css("list-style-image", "url('.$WT_IMAGES['plus'].')");
+ jQuery("#sb_fam_"+surname).css("list-style-image", "url(' . Theme::theme()->parameter('image-plus') . ')");
}
return false;
});
');
- $out=
- '<form method="post" action="module.php?mod='.$this->getName().'&amp;mod_action=ajax" onsubmit="return false;">'.
- '<input type="search" name="sb_fam_name" id="sb_fam_name" placeholder="'.WT_I18N::translate('Search').'">'.
+ $out =
+ '<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax" onsubmit="return false;">' .
+ '<input type="search" name="sb_fam_name" id="sb_fam_name" placeholder="' . WT_I18N::translate('Search') . '">' .
'<p>';
foreach ($initials as $letter=>$count) {
switch ($letter) {
- case '@':
- $html=$UNKNOWN_NN;
- break;
- case ',':
- $html=WT_I18N::translate('None');
- break;
- case ' ':
- $html='&nbsp;';
- break;
- default:
- $html=$letter;
- break;
+ case '@':
+ $html = $UNKNOWN_NN;
+ break;
+ case ',':
+ $html = WT_I18N::translate('None');
+ break;
+ case ' ':
+ $html = '&nbsp;';
+ break;
+ default:
+ $html = $letter;
+ break;
}
- $html='<a href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=families&amp;alpha='.urlencode($letter).'" class="sb_fam_letter">'.$html.'</a>';
- $out .= $html." ";
+ $html = '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=families&amp;alpha=' . urlencode($letter) . '" class="sb_fam_letter">' . $html . '</a>';
+ $out .= $html . " ";
}
$out .= '</p>';
@@ -167,12 +168,12 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
*
* @return string
*/
- public function getAlphaSurnames($alpha, $surname1='') {
+ public function getAlphaSurnames($alpha, $surname1 = '') {
$surnames = WT_Query_Name::surnames('', $alpha, true, true, WT_GED_ID);
$out = '<ul>';
foreach (array_keys($surnames) as $surname) {
$out .= '<li id="sb_fam_' . $surname . '" class="sb_fam_surname_li"><a href="' . $surname . '" title="' . $surname . '" alt="' . $alpha . '" class="sb_fam_surname">' . $surname . '</a>';
- if (!empty($surname1) && $surname1==$surname) {
+ if (!empty($surname1) && $surname1 == $surname) {
$out .= '<div class="name_tree_div_visible">';
$out .= $this->getSurnameFams($alpha, $surname1);
$out .= '</div>';
@@ -192,15 +193,15 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
* @return string
*/
public function getSurnameFams($alpha, $surname) {
- $families=WT_Query_Name::families($surname, $alpha, '', true, WT_GED_ID);
+ $families = WT_Query_Name::families($surname, $alpha, '', true, WT_GED_ID);
$out = '<ul>';
foreach ($families as $family) {
if ($family->canShowName()) {
- $out .= '<li><a href="'.$family->getHtmlUrl().'">'.$family->getFullName().' ';
+ $out .= '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . ' ';
if ($family->canShow()) {
- $marriage_year=$family->getMarriageYear();
+ $marriage_year = $family->getMarriageYear();
if ($marriage_year) {
- $out.=' ('.$marriage_year.')';
+ $out .= ' (' . $marriage_year . ')';
}
}
$out .= '</a></li>';
@@ -216,16 +217,16 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
* @return string
*/
public function search($query) {
- if (strlen($query)<2) {
+ if (strlen($query) < 2) {
return '';
}
//-- search for INDI names
- $rows=WT_DB::prepare(
- "SELECT i_id AS xref".
- " FROM `##individuals`, `##name`".
- " WHERE (i_id LIKE ? OR n_sort LIKE ?)".
- " AND i_id=n_id AND i_file=n_file AND i_file=?".
+ $rows = WT_DB::prepare(
+ "SELECT i_id AS xref" .
+ " FROM `##individuals`, `##name`" .
+ " WHERE (i_id LIKE ? OR n_sort LIKE ?)" .
+ " AND i_id=n_id AND i_file=n_file AND i_file=?" .
" ORDER BY n_sort"
)
->execute(array("%{$query}%", "%{$query}%", WT_GED_ID))
@@ -235,32 +236,32 @@ class families_WT_Module extends WT_Module implements WT_Module_Sidebar {
$ids[] = $row->xref;
}
- $vars=array();
+ $vars = array();
if (empty($ids)) {
//-- no match : search for FAM id
$where = "f_id LIKE ?";
- $vars[]="%{$query}%";
+ $vars[] = "%{$query}%";
} else {
//-- search for spouses
- $qs=implode(',', array_fill(0, count($ids), '?'));
+ $qs = implode(',', array_fill(0, count($ids), '?'));
$where = "(f_husb IN ($qs) OR f_wife IN ($qs))";
- $vars=array_merge($vars, $ids, $ids);
+ $vars = array_merge($vars, $ids, $ids);
}
- $vars[]=WT_GED_ID;
- $rows=WT_DB::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom FROM `##families` WHERE {$where} AND f_file=?")
+ $vars[] = WT_GED_ID;
+ $rows = WT_DB::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom FROM `##families` WHERE {$where} AND f_file=?")
->execute($vars)
->fetchAll();
$out = '<ul>';
foreach ($rows as $row) {
- $family=WT_Family::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
+ $family = WT_Family::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
if ($family->canShowName()) {
- $out .= '<li><a href="'.$family->getHtmlUrl().'">'.$family->getFullName().' ';
+ $out .= '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . ' ';
if ($family->canShow()) {
- $marriage_year=$family->getMarriageYear();
+ $marriage_year = $family->getMarriageYear();
if ($marriage_year) {
- $out.=' ('.$marriage_year.')';
+ $out .= ' (' . $marriage_year . ')';
}
}
$out .= '</a></li>';
diff --git a/modules_v3/family_group_report/module.php b/modules_v3/family_group_report/module.php
index 54f6efc41e..e4ebba8bb6 100644
--- a/modules_v3/family_group_report/module.php
+++ b/modules_v3/family_group_report/module.php
@@ -44,13 +44,13 @@ class family_group_report_WT_Module extends WT_Module implements WT_Module_Repor
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;famid='.$controller->getSignificantFamily()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;famid=' . $controller->getSignificantFamily()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/family_nav/module.php b/modules_v3/family_nav/module.php
index 1a25477986..992cc7c87e 100644
--- a/modules_v3/family_nav/module.php
+++ b/modules_v3/family_nav/module.php
@@ -128,7 +128,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
<?php
$access_level = $SHOW_PRIVATE_RELATIONSHIPS ? WT_PRIV_HIDE : WT_USER_ACCESS_LEVEL;
$facts = array_merge($family->getFacts('HUSB', false, $access_level), $family->getFacts('WIFE', false, $access_level));
- foreach($facts as $fact) {
+ foreach ($facts as $fact) {
$spouse = $fact->getTarget();
if ($this->isPerson($spouse)) {
$menu = new WT_Menu(get_close_relationship_name($controller->record, $spouse));
@@ -183,7 +183,7 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
*
* @return string
*/
- private function getHTML($person, $showUnknown=false) {
+ private function getHTML($person, $showUnknown = false) {
if ($this->isPerson($person)) {
return sprintf(self::LNK, $person->getHtmlUrl(), $person->getFullName());
} elseif ($showUnknown) {
@@ -221,15 +221,14 @@ class family_nav_WT_Module extends WT_Module implements WT_Module_Sidebar {
$stepParents .= $this->getHTML($family->getWife());
}
}
- if($stepParents) {
+ if ($stepParents) {
$relationship = $this->isPerson($father) ?
- WT_I18N::translate_c("father’s wife", "step-mother") :
- WT_I18N::translate_c("mother’s husband", "step-father");
+ WT_I18N::translate_c("father’s wife", "step-mother") : WT_I18N::translate_c("mother’s husband", "step-father");
$html .= sprintf(self::TTL, $relationship) . $stepParents;
}
}
}
- if(!($this->isPerson($father) || $this->isPerson($mother))) {
+ if (!($this->isPerson($father) || $this->isPerson($mother))) {
$html .= sprintf(self::MSG, WT_I18N::translate_c('unknown family', 'unknown'));
}
return $html;
diff --git a/modules_v3/faq/help_text.php b/modules_v3/faq/help_text.php
deleted file mode 100644
index b779c4618a..0000000000
--- a/modules_v3/faq/help_text.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'add_faq_item':
- $title=WT_I18N::translate('Frequently asked questions');
- $text=
- WT_I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors. Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.').
- '<br><br>'.
- WT_I18N::translate('You may use HTML to format the answer and to add links to other websites.');
- break;
-
-case 'add_faq_order':
- $title=WT_I18N::translate('FAQ position');
- $text=WT_I18N::translate('This field controls the order in which the FAQ items are displayed.<br><br>You do not have to enter the numbers sequentially. If you leave holes in the numbering scheme, you can insert other items later. For example, if you use the numbers 1, 6, 11, 16, you can later insert items with the missing sequence numbers. Negative numbers and zero are allowed, and can be used to insert items in front of the first one.<br><br>When more than one FAQ item has the same position number, only one of these items will be visible.');
- break;
-
-case 'add_faq_visibility':
- $title=WT_I18N::translate('FAQ visibility');
- $text=WT_I18N::translate('A FAQ item can be displayed on just one of the family trees, or on all the family trees.');
- break;
-
-case 'delete_faq_item':
- $title=WT_I18N::translate('Delete FAQ item');
- $text=WT_I18N::translate('This option will let you delete an item from the FAQ page');
- break;
-
-case 'edit_faq_item':
- $title=WT_I18N::translate('Edit FAQ item');
- $text=WT_I18N::translate('This option will let you edit an item on the FAQ page.');
- break;
-
-case 'movedown_faq_item':
- $title=WT_I18N::translate('Move FAQ item down');
- $text=WT_I18N::translate('This option will let you move an item downwards on the FAQ page.<br><br>Each time you use this option, the FAQ position number of this item is increased by one. You can achieve the same effect by editing the item in question and changing the FAQ position field. When more than one FAQ item has the same position number, only one of these items will be visible.');
- break;
-
-case 'moveup_faq_item':
- $title=WT_I18N::translate('Move FAQ item up');
- $text=WT_I18N::translate('This option will let you move an item upwards on the FAQ page.<br><br>Each time you use this option, the FAQ position number of this item is reduced by one. You can achieve the same effect by editing the item in question and changing the FAQ position field. When more than one FAQ item has the same position number, only one of these items will be visible.');
- break;
-
-}
diff --git a/modules_v3/faq/module.php b/modules_v3/faq/module.php
index da72ef2cc6..789e57a7ed 100644
--- a/modules_v3/faq/module.php
+++ b/modules_v3/faq/module.php
@@ -77,52 +77,48 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
$block_id = WT_Filter::postInteger('block_id');
if ($block_id) {
WT_DB::prepare(
- "UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?"
+ "UPDATE `##block` SET gedcom_id = NULLIF(:tree_id, '0'), block_order = :block_order WHERE block_id = :block_id"
)->execute(array(
- WT_Filter::postInteger('gedcom_id'),
- WT_Filter::postInteger('block_order'),
- $block_id
+ 'tree_id' => WT_Filter::postInteger('gedcom_id'),
+ 'block_order' => WT_Filter::postInteger('block_order'),
+ 'block_id' => $block_id
));
} else {
WT_DB::prepare(
- "INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)"
+ "INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(:tree_id, '0'), :module_name, :block_order)"
)->execute(array(
- WT_Filter::postInteger('gedcom_id'),
- $this->getName(),
- WT_Filter::postInteger('block_order')
+ 'tree_id' => WT_Filter::postInteger('gedcom_id'),
+ 'module_name' => $this->getName(),
+ 'block_order' => WT_Filter::postInteger('block_order'),
));
$block_id = WT_DB::getInstance()->lastInsertId();
}
set_block_setting($block_id, 'header', WT_Filter::post('header'));
set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody'));
- $languages = array();
- foreach (WT_I18N::installed_languages() as $code => $name) {
- if (WT_Filter::postBool('lang_' . $code)) {
- $languages[] = $code;
- }
- }
+
+ $languages = WT_Filter::postArray('lang', null, array_keys(WT_I18N::installed_languages()));
set_block_setting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = WT_Filter::getInteger('block_id');
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
if ($block_id) {
$controller->setPageTitle(WT_I18N::translate('Edit FAQ item'));
$header = get_block_setting($block_id, 'header');
$faqbody = get_block_setting($block_id, 'faqbody');
$block_order = WT_DB::prepare(
- "SELECT block_order FROM `##block` WHERE block_id=?"
- )->execute(array($block_id))->fetchOne();
+ "SELECT block_order FROM `##block` WHERE block_id = :block_id"
+ )->execute(array('block_id' => $block_id))->fetchOne();
$gedcom_id = WT_DB::prepare(
- "SELECT gedcom_id FROM `##block` WHERE block_id=?"
- )->execute(array($block_id))->fetchOne();
+ "SELECT gedcom_id FROM `##block` WHERE block_id = :block_id"
+ )->execute(array('block_id' => $block_id))->fetchOne();
} else {
$controller->setPageTitle(WT_I18N::translate('Add an FAQ item'));
$header = '';
$faqbody = '';
$block_order = WT_DB::prepare(
- "SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?"
- )->execute(array($this->getName()))->fetchOne();
+ "SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name = :module_name"
+ )->execute(array('module_name' => $this->getName()))->fetchOne();
$gedcom_id = WT_GED_ID;
}
$controller->pageHeader();
@@ -130,8 +126,16 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
ckeditor_WT_Module::enableEditor($controller);
}
- // "Help for this page" link
- echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>';
+ ?>
+ <ol class="breadcrumb small">
+ <li><a href="admin.php"><?php echo WT_I18N::translate('Administration'); ?></a></li>
+ <li><a href="admin_modules.php"><?php echo WT_I18N::translate('Module administration'); ?></a></li>
+ <li><a href="module.php?mod=<?php echo $this->getName(); ?>&mod_action=admin_config"><?php echo WT_I18N::translate('Frequently asked questions'); ?></a></li>
+ <li class="active"><?php echo $controller->getPageTitle(); ?></li>
+ </ol>
+ <h2><?php echo $controller->getPageTitle(); ?></h2>
+ <?php
+
echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
echo WT_Filter::getCsrf();
echo '<input type="hidden" name="save" value="1">';
@@ -148,12 +152,12 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
echo '</table><table id="faq_module2">';
echo '<tr>';
echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
- echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>';
- echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>';
+ echo '<th>', WT_I18N::translate('FAQ position'), '</th>';
+ echo '<th>', WT_I18N::translate('FAQ visibility'), '<br><small>', WT_I18N::translate('A FAQ item can be displayed on just one of the family trees, or on all the family trees.'), '</small></th>';
echo '</tr><tr>';
echo '<td>';
- $languages = get_block_setting($block_id, 'languages');
- echo edit_language_checkboxes('lang_', $languages);
+ $languages = explode(',', get_block_setting($block_id, 'languages'));
+ echo edit_language_checkboxes('lang', $languages);
echo '</td><td>';
echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>';
echo '</td><td>';
@@ -163,7 +167,6 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
echo '</form>';
- exit;
}
}
@@ -174,12 +177,12 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
$block_id = WT_Filter::getInteger('block_id');
WT_DB::prepare(
- "DELETE FROM `##block_setting` WHERE block_id=?"
- )->execute(array($block_id));
+ "DELETE FROM `##block_setting` WHERE block_id = :block_id"
+ )->execute(array('block_id' => $block_id));
WT_DB::prepare(
- "DELETE FROM `##block` WHERE block_id=?"
- )->execute(array($block_id));
+ "DELETE FROM `##block` WHERE block_id = :block_id"
+ )->execute(array('block_id' => $block_id));
}
/**
@@ -189,24 +192,34 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
$block_id = WT_Filter::getInteger('block_id');
$block_order = WT_DB::prepare(
- "SELECT block_order FROM `##block` WHERE block_id=?"
- )->execute(array($block_id))->fetchOne();
+ "SELECT block_order FROM `##block` WHERE block_id = :block_id"
+ )->execute(array('block_id' => $block_id))->fetchOne();
$swap_block = WT_DB::prepare(
- "SELECT block_order, block_id".
- " FROM `##block`".
- " WHERE block_order=(".
- " SELECT MAX(block_order) FROM `##block` WHERE block_order < ? AND module_name=?".
- " ) AND module_name=?".
+ "SELECT block_order, block_id" .
+ " FROM `##block`" .
+ " WHERE block_order = (" .
+ " SELECT MAX(block_order) FROM `##block` WHERE block_order < :block_order AND module_name = :module_name_1" .
+ " ) AND module_name = :module_name_2" .
" LIMIT 1"
- )->execute(array($block_order, $this->getName(), $this->getName()))->fetchOneRow();
+ )->execute(array(
+ 'block_order' => $block_order,
+ 'module_name_1' => $this->getName(),
+ 'module_name_2' => $this->getName()
+ ))->fetchOneRow();
if ($swap_block) {
WT_DB::prepare(
- "UPDATE `##block` SET block_order=? WHERE block_id=?"
- )->execute(array($swap_block->block_order, $block_id));
+ "UPDATE `##block` SET block_order = :block_order WHERE block_id = :block_id"
+ )->execute(array(
+ 'block_order' => $swap_block->block_order,
+ 'block_id' => $block_id,
+ ));
WT_DB::prepare(
- "UPDATE `##block` SET block_order=? WHERE block_id=?"
- )->execute(array($block_order, $swap_block->block_id));
+ "UPDATE `##block` SET block_order = :block_order WHERE block_id = :block_id"
+ )->execute(array(
+ 'block_order' => $block_order,
+ 'block_id' => $swap_block->block_id,
+ ));
}
}
@@ -217,24 +230,36 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
$block_id = WT_Filter::get('block_id');
$block_order = WT_DB::prepare(
- "SELECT block_order FROM `##block` WHERE block_id=?"
- )->execute(array($block_id))->fetchOne();
+ "SELECT block_order FROM `##block` WHERE block_id = :block_id"
+ )->execute(array(
+ 'block_id' => $block_id,
+ ))->fetchOne();
$swap_block = WT_DB::prepare(
- "SELECT block_order, block_id".
- " FROM `##block`".
- " WHERE block_order=(".
- " SELECT MIN(block_order) FROM `##block` WHERE block_order>? AND module_name=?".
- " ) AND module_name=?".
+ "SELECT block_order, block_id" .
+ " FROM `##block`" .
+ " WHERE block_order=(" .
+ " SELECT MIN(block_order) FROM `##block` WHERE block_order > :block_order AND module_name = :module_name_1" .
+ " ) AND module_name = :module_name_2" .
" LIMIT 1"
- )->execute(array($block_order, $this->getName(), $this->getName()))->fetchOneRow();
+ )->execute(array(
+ 'block_order' => $block_order,
+ 'module_name_1' => $this->getName(),
+ 'module_name_2' => $this->getName(),
+ ))->fetchOneRow();
if ($swap_block) {
WT_DB::prepare(
- "UPDATE `##block` SET block_order=? WHERE block_id=?"
- )->execute(array($swap_block->block_order, $block_id));
+ "UPDATE `##block` SET block_order = :block_order WHERE block_id = :block_id"
+ )->execute(array(
+ 'block_order' => $swap_block->block_order,
+ 'block_id' => $block_id,
+ ));
WT_DB::prepare(
- "UPDATE `##block` SET block_order=? WHERE block_id=?"
- )->execute(array($block_order, $swap_block->block_id));
+ "UPDATE `##block` SET block_order = :block_order WHERE block_id = :block_id"
+ )->execute(array(
+ 'block_order' => $block_order,
+ 'block_id' => $swap_block->block_id,
+ ));
}
}
@@ -243,9 +268,9 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
*/
private function show() {
global $controller;
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
- ->setPageTitle($this->getTitle())
+ ->setPageTitle(WT_I18N::translate('Frequently asked questions'))
->pageHeader();
$faqs = WT_DB::prepare(
@@ -254,13 +279,17 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
" JOIN `##block_setting` bs1 USING (block_id)" .
" JOIN `##block_setting` bs2 USING (block_id)" .
" JOIN `##block_setting` bs3 USING (block_id)" .
- " WHERE module_name=?" .
- " AND bs1.setting_name='header'" .
- " AND bs2.setting_name='faqbody'" .
- " AND bs3.setting_name='languages'" .
- " AND IFNULL(gedcom_id, ?)=?" .
+ " WHERE module_name = :module_name" .
+ " AND bs1.setting_name = 'header'" .
+ " AND bs2.setting_name = 'faqbody'" .
+ " AND bs3.setting_name = 'languages'" .
+ " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" .
" ORDER BY block_order"
- )->execute(array($this->getName(), WT_GED_ID, WT_GED_ID))->fetchAll();
+ )->execute(array(
+ 'module_name' => $this->getName(),
+ 'tree_id_1' => WT_GED_ID,
+ 'tree_id_2' => WT_GED_ID,
+ ))->fetchAll();
// Define your colors for the alternating rows
echo '<h2 class="center">', WT_I18N::translate('Frequently asked questions'), '</h2>';
@@ -289,7 +318,7 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
if (!$faq->languages || in_array(WT_LOCALE, explode(',', $faq->languages))) {
echo '<div class="faq_title" id="faq', $id, '">', $faq->header;
echo '<div class="faq_top faq_italic">';
- echo '<a href="#body">', WT_I18N::translate('back to top'), '</a>';
+ echo '<a href="#content">', WT_I18N::translate('back to top'), '</a>';
echo '</div>';
echo '</div>';
echo '<div class="faq_body">', substr($faq->body, 0, 1) == '<' ? $faq->body : nl2br($faq->body, false), '</div>';
@@ -304,9 +333,9 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
private function config() {
require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
- ->setPageTitle($this->getTitle())
+ ->setPageTitle(WT_I18N::translate('Frequently asked questions'))
->pageHeader();
$faqs = WT_DB::prepare(
@@ -314,12 +343,16 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
" FROM `##block` b" .
" JOIN `##block_setting` bs1 USING (block_id)" .
" JOIN `##block_setting` bs2 USING (block_id)" .
- " WHERE module_name = ?" .
+ " WHERE module_name = :module_name" .
" AND bs1.setting_name = 'header'" .
" AND bs2.setting_name = 'faqbody'" .
- " AND IFNULL(gedcom_id, ?) = ?" .
+ " AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2" .
" ORDER BY block_order"
- )->execute(array($this->getName(), WT_GED_ID, WT_GED_ID))->fetchAll();
+ )->execute(array(
+ 'module_name' => $this->getName(),
+ 'tree_id_1' => WT_GED_ID,
+ 'tree_id_2' => WT_GED_ID,
+ ))->fetchAll();
$min_block_order = WT_DB::prepare(
"SELECT MIN(block_order) FROM `##block` WHERE module_name=?"
@@ -329,17 +362,29 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
"SELECT MAX(block_order) FROM `##block` WHERE module_name=?"
)->execute(array($this->getName()))->fetchOne();
+ ?>
+ <ol class="breadcrumb small">
+ <li><a href="admin.php"><?php echo WT_I18N::translate('Administration'); ?></a></li>
+ <li><a href="admin_modules.php"><?php echo WT_I18N::translate('Module administration'); ?></a></li>
+ <li class="active"><?php echo $controller->getPageTitle(); ?></li>
+ </ol>
+ <h2><?php echo $controller->getPageTitle(); ?></h2>
+ <p>
+ <?php echo WT_I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors. Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.'); ?>
+ <?php echo WT_I18N::translate('You may use HTML to format the answer and to add links to other websites.'); ?>
+ </p>
+ <?php
+
echo
- '<p><form method="get" action="', WT_SCRIPT_NAME ,'">',
+ '<p><form>',
WT_I18N::translate('Family tree'), ' ',
'<input type="hidden" name="mod", value="', $this->getName(), '">',
- '<input type="hidden" name="mod_action", value="admin_config">',
+ '<input type="hidden" name="mod_action" value="admin_config">',
select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM),
'<input type="submit" value="', WT_I18N::translate('show'), '">',
'</form></p>';
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">', WT_I18N::translate('Add an FAQ item'), '</a>';
- echo help_link('add_faq_item', $this->getName());
echo '<table id="faq_edit">';
if (empty($faqs)) {
@@ -362,21 +407,17 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
echo '&nbsp;';
} else {
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_moveup&amp;block_id=', $faq->block_id, '" class="icon-uarrow"></a>';
- echo help_link('moveup_faq_item', $this->getName());
}
echo '</td><td>';
if ($faq->block_order == $max_block_order) {
echo '&nbsp;';
} else {
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_movedown&amp;block_id=', $faq->block_id, '" class="icon-darrow"></a>';
- echo help_link('movedown_faq_item', $this->getName());
}
echo '</td><td>';
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit&amp;block_id=', $faq->block_id, '">', WT_I18N::translate('Edit'), '</a>';
- echo help_link('edit_faq_item', $this->getName());
echo '</td><td>';
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_delete&amp;block_id=', $faq->block_id, '" onclick="return confirm(\'', WT_I18N::translate('Are you sure you want to delete this FAQ entry?'), '\');">', WT_I18N::translate('Delete'), '</a>';
- echo help_link('delete_faq_item', $this->getName());
echo '</td></tr>';
// NOTE: Print the title text of the current item
echo '<tr><td colspan="5">';
@@ -403,8 +444,12 @@ class faq_WT_Module extends WT_Module implements WT_Module_Menu, WT_Module_Confi
}
$faqs = WT_DB::prepare(
- "SELECT block_id FROM `##block` b WHERE module_name=? AND IFNULL(gedcom_id, ?)=?"
- )->execute(array($this->getName(), WT_GED_ID, WT_GED_ID))->fetchAll();
+ "SELECT block_id FROM `##block` WHERE module_name = :module_name AND IFNULL(gedcom_id, :tree_id_1) = :tree_id_2"
+ )->execute(array(
+ 'module_name' => $this->getName(),
+ 'tree_id_1' => WT_GED_ID,
+ 'tree_id_2' => WT_GED_ID,
+ ))->fetchAll();
if (!$faqs) {
return null;
diff --git a/modules_v3/gedcom_block/module.php b/modules_v3/gedcom_block/module.php
index 309bea0c62..d498877f98 100644
--- a/modules_v3/gedcom_block/module.php
+++ b/modules_v3/gedcom_block/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class gedcom_block_WT_Module
@@ -36,24 +37,24 @@ class gedcom_block_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $controller;
- $indi_xref=$controller->getSignificantIndividual()->getXref();
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- $title='<span dir="auto">'.WT_TREE_TITLE.'</span>';
+ $indi_xref = $controller->getSignificantIndividual()->getXref();
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ $title = '<span dir="auto">' . WT_TREE_TITLE . '</span>';
$content = '<table><tr>';
- $content .= '<td><a href="pedigree.php?rootid='.$indi_xref.'&amp;ged='.WT_GEDURL.'"><i class="icon-pedigree"></i><br>'.WT_I18N::translate('Default chart').'</a></td>';
- $content .= '<td><a href="individual.php?pid='.$indi_xref.'&amp;ged='.WT_GEDURL.'"><i class="icon-indis"></i><br>'.WT_I18N::translate('Default individual').'</a></td>';
+ $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&amp;ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('Default chart') . '</a></td>';
+ $content .= '<td><a href="individual.php?pid=' . $indi_xref . '&amp;ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('Default individual') . '</a></td>';
if (WT_Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) {
- $content .= '<td><a href="'.WT_LOGIN_URL.'?action=register"><i class="icon-user_add"></i><br>'.WT_I18N::translate('Request new user account').'</a></td>';
+ $content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . WT_I18N::translate('Request new user account') . '</a></td>';
}
$content .= "</tr>";
$content .= "</table>";
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/gedcom_favorites/db_schema/db_schema_0_1.php b/modules_v3/gedcom_favorites/db_schema/db_schema_0_1.php
index 82dacab5f7..067ed16519 100644
--- a/modules_v3/gedcom_favorites/db_schema/db_schema_0_1.php
+++ b/modules_v3/gedcom_favorites/db_schema/db_schema_0_1.php
@@ -32,17 +32,17 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
WT_DB::exec(
- "CREATE TABLE IF NOT EXISTS `##favorites` (".
- " fv_id INTEGER AUTO_INCREMENT NOT NULL,".
- " fv_username VARCHAR(32) NOT NULL,".
- " fv_gid VARCHAR(20) NULL,".
- " fv_type VARCHAR(15) NULL,".
- " fv_file VARCHAR(100) NULL,".
- " fv_url VARCHAR(255) NULL,".
- " fv_title VARCHAR(255) NULL,".
- " fv_note TEXT NULL,".
- " PRIMARY KEY (fv_id),".
- " KEY ix1 (fv_username)".
+ "CREATE TABLE IF NOT EXISTS `##favorites` (" .
+ " fv_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " fv_username VARCHAR(32) NOT NULL," .
+ " fv_gid VARCHAR(20) NULL," .
+ " fv_type VARCHAR(15) NULL," .
+ " fv_file VARCHAR(100) NULL," .
+ " fv_url VARCHAR(255) NULL," .
+ " fv_title VARCHAR(255) NULL," .
+ " fv_note TEXT NULL," .
+ " PRIMARY KEY (fv_id)," .
+ " KEY ix1 (fv_username)" .
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
diff --git a/modules_v3/gedcom_favorites/db_schema/db_schema_1_2.php b/modules_v3/gedcom_favorites/db_schema/db_schema_1_2.php
index 5706534f21..7cb8f54c7f 100644
--- a/modules_v3/gedcom_favorites/db_schema/db_schema_1_2.php
+++ b/modules_v3/gedcom_favorites/db_schema/db_schema_1_2.php
@@ -28,16 +28,16 @@
// Add the new columns
try {
WT_DB::exec(
- "ALTER TABLE `##favorites`".
- " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL,".
- " CHANGE fv_gid xref VARCHAR(20) NULL,".
- " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL,".
- " CHANGE fv_url url VARCHAR(255) NULL,".
- " CHANGE fv_title title VARCHAR(255) NULL,".
- " CHANGE fv_note note VARCHAR(1000) NULL,".
- " ADD user_id INTEGER NULL AFTER favorite_id,".
- " ADD gedcom_id INTEGER NOT NULL AFTER user_id,".
- " DROP KEY ix1,".
+ "ALTER TABLE `##favorites`" .
+ " CHANGE fv_id favorite_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " CHANGE fv_gid xref VARCHAR(20) NULL," .
+ " CHANGE fv_type favorite_type ENUM('INDI', 'FAM', 'SOUR', 'REPO', 'OBJE', 'NOTE', 'URL') NOT NULL," .
+ " CHANGE fv_url url VARCHAR(255) NULL," .
+ " CHANGE fv_title title VARCHAR(255) NULL," .
+ " CHANGE fv_note note VARCHAR(1000) NULL," .
+ " ADD user_id INTEGER NULL AFTER favorite_id," .
+ " ADD gedcom_id INTEGER NOT NULL AFTER user_id," .
+ " DROP KEY ix1," .
" ADD KEY news_ix1 (gedcom_id, user_id)"
);
} catch (PDOException $ex) {
@@ -47,9 +47,9 @@ try {
// Migrate data from the old columns to the new ones
try {
WT_DB::exec(
- "UPDATE `##favorites` f".
- " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)".
- " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)".
+ "UPDATE `##favorites` f" .
+ " LEFT JOIN `##gedcom` g ON (f.fv_file =g.gedcom_name)" .
+ " LEFT JOIN `##user` u ON (f.fv_username=u.user_name)" .
" SET f.gedcom_id=g.gedcom_id, f.user_id=u.user_id"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/gedcom_favorites/db_schema/db_schema_2_3.php b/modules_v3/gedcom_favorites/db_schema/db_schema_2_3.php
index a86d1f4447..3ecfe21b95 100644
--- a/modules_v3/gedcom_favorites/db_schema/db_schema_2_3.php
+++ b/modules_v3/gedcom_favorites/db_schema/db_schema_2_3.php
@@ -28,16 +28,16 @@
// Delete any data that might violate the new constraints
WT_DB::exec(
- "DELETE FROM `##favorite`".
- " WHERE user_id NOT IN (SELECT user_id FROM `##user` )".
+ "DELETE FROM `##favorite`" .
+ " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" .
" OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)"
);
// Add the new constraints
try {
WT_DB::exec(
- "ALTER TABLE `##favorite`".
- " ADD FOREIGN KEY favorite_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE,".
+ "ALTER TABLE `##favorite`" .
+ " ADD FOREIGN KEY favorite_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," .
" ADD FOREIGN KEY favorite_fk2 (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/gedcom_favorites/module.php b/modules_v3/gedcom_favorites/module.php
index a984f6a047..b1193c73bd 100644
--- a/modules_v3/gedcom_favorites/module.php
+++ b/modules_v3/gedcom_favorites/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -21,6 +21,7 @@
use Rhumsaa\Uuid\Uuid;
use WT\Auth;
+use WT\Theme;
/**
* Class gedcom_favorites_WT_Module
@@ -40,7 +41,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller;
self::updateSchema(); // make sure the favorites table has been created
@@ -86,7 +87,8 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
break;
}
- $block = get_block_setting($block_id, 'block', false);
+ $block = get_block_setting($block_id, 'block', '0');
+
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
@@ -96,7 +98,9 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
}
// Override GEDCOM configuration temporarily
- if (isset($show_full)) $saveShowFull = $show_full;
+ if (isset($show_full)) {
+ $saveShowFull = $show_full;
+ }
$savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
$show_full = 1;
$PEDIGREE_FULL_DETAILS = 1;
@@ -106,33 +110,36 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$userfavs = array();
}
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- $title=$this->getTitle();
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ $title = $this->getTitle();
if (Auth::check()) {
$controller
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
}
$content = '';
- $style = 2; // 1 means "regular box", 2 means "wide box"
if ($userfavs) {
foreach ($userfavs as $key=>$favorite) {
- if (isset($favorite['id'])) $key=$favorite['id'];
- $removeFavourite = '<a class="font9" href="index.php?ctype='.$ctype.'&amp;action=deletefav&amp;favorite_id='.$key.'" onclick="return confirm(\''.WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?').'\');">'.WT_I18N::translate('Remove').'</a> ';
- if ($favorite['type']=='URL') {
- $content .= '<div id="boxurl'.$key.'.0" class="person_box">';
- if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
- $content .= '<a href="'.$favorite['url'].'"><b>'.$favorite['title'].'</b></a>';
- $content .= '<br>'.$favorite['note'];
+ if (isset($favorite['id'])) {
+ $key = $favorite['id'];
+ }
+ $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&amp;action=deletefav&amp;favorite_id=' . $key . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . WT_I18N::translate('Remove') . '</a> ';
+ if ($favorite['type'] == 'URL') {
+ $content .= '<div id="boxurl' . $key . '.0" class="person_box">';
+ if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
+ $content .= $removeFavourite;
+ }
+ $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>';
+ $content .= '<br>' . $favorite['note'];
$content .= '</div>';
} else {
- $record=WT_GedcomRecord::getInstance($favorite['gid']);
+ $record = WT_GedcomRecord::getInstance($favorite['gid']);
if ($record && $record->canShow()) {
if ($record instanceof WT_Individual) {
- $content .= '<div id="box'.$favorite["gid"].'.0" class="person_box action_header';
+ $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header';
switch ($record->getsex()) {
case 'M':
break;
@@ -144,54 +151,54 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
break;
}
$content .= '">';
- if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
- ob_start();
- print_pedigree_person($record, $style);
- $content .= ob_get_clean();
+ if ($ctype == "user" || WT_USER_GEDCOM_ADMIN) {
+ $content .= $removeFavourite;
+ }
+ $content .= Theme::theme()->individualBoxLarge($record);
$content .= $favorite['note'];
$content .= '</div>';
} else {
- $content .= '<div id="box'.$favorite['gid'].'.0" class="person_box">';
- if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) {
+ $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">';
+ if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
$content .= $removeFavourite;
}
$content .= $record->format_list('span');
- $content .= '<br>'.$favorite['note'];
+ $content .= '<br>' . $favorite['note'];
$content .= '</div>';
}
}
}
}
}
- if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) {
+ if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
$uniqueID = Uuid::uuid4(); // This block can theoretically appear multiple times, so use a unique ID.
$content .= '<div class="add_fav_head">';
- $content .= '<a href="#" onclick="return expand_layer(\'add_fav'.$uniqueID.'\');">'.WT_I18N::translate('Add a new favorite').'<i id="add_fav'.$uniqueID.'_img" class="icon-plus"></i></a>';
+ $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . WT_I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>';
$content .= '</div>';
- $content .= '<div id="add_fav'.$uniqueID.'" style="display: none;">';
+ $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">';
$content .= '<form name="addfavform" method="get" action="index.php">';
$content .= '<input type="hidden" name="action" value="addfav">';
- $content .= '<input type="hidden" name="ctype" value="'.$ctype.'">';
- $content .= '<input type="hidden" name="ged" value="'.WT_GEDCOM.'">';
+ $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">';
+ $content .= '<input type="hidden" name="ged" value="' . WT_GEDCOM . '">';
$content .= '<div class="add_fav_ref">';
- $content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid'.$uniqueID.'\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">';
- $content .= '<label for="gid'.$uniqueID.'">'.WT_I18N::translate('Enter an individual, family, or source ID').'</label>';
- $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid'.$uniqueID.'" size="5" value="">';
- $content .= ' '.print_findindi_link('gid'.$uniqueID);
- $content .= ' '.print_findfamily_link('gid'.$uniqueID);
- $content .= ' '.print_findsource_link('gid'.$uniqueID);
- $content .= ' '.print_findrepository_link('gid'.$uniqueID);
- $content .= ' '.print_findnote_link('gid'.$uniqueID);
- $content .= ' '.print_findmedia_link('gid'.$uniqueID);
+ $content .= '<input type="radio" name="fav_category" value="record" checked onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">';
+ $content .= '<label for="gid' . $uniqueID . '">' . WT_I18N::translate('Enter an individual, family, or source ID') . '</label>';
+ $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">';
+ $content .= ' ' . print_findindi_link('gid' . $uniqueID);
+ $content .= ' ' . print_findfamily_link('gid' . $uniqueID);
+ $content .= ' ' . print_findsource_link('gid' . $uniqueID);
+ $content .= ' ' . print_findrepository_link('gid' . $uniqueID);
+ $content .= ' ' . print_findnote_link('gid' . $uniqueID);
+ $content .= ' ' . print_findmedia_link('gid' . $uniqueID);
$content .= '</div>';
$content .= '<div class="add_fav_url">';
- $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid'.$uniqueID.'\').attr(\'disabled\',\'disabled\').val(\'\');">';
- $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="'.WT_Gedcom_Tag::getLabel('URL').'" disabled="disabled"> ';
- $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="'.WT_I18N::translate('Title').'" disabled="disabled">';
- $content .= '<p>'.WT_I18N::translate('Enter an optional note about this favorite').'</p>';
+ $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">';
+ $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . WT_Gedcom_Tag::getLabel('URL') . '" disabled> ';
+ $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . WT_I18N::translate('Title') . '" disabled>';
+ $content .= '<p>' . WT_I18N::translate('Enter an optional note about this favorite') . '</p>';
$content .= '<textarea name="favnote" rows="6" cols="50"></textarea>';
$content .= '</div>';
- $content .= '<input type="submit" value="'.WT_I18N::translate('Add').'">';
+ $content .= '<input type="submit" value="' . WT_I18N::translate('Add') . '">';
$content .= '</form></div>';
}
@@ -204,10 +211,9 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -231,13 +237,13 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $block = get_block_setting($block_id, 'block', '0');
- $block=get_block_setting($block_id, 'block', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
@@ -274,19 +280,19 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
//-- make sure this is not a duplicate entry
$sql = "SELECT SQL_NO_CACHE 1 FROM `##favorite` WHERE";
if (!empty($favorite['gid'])) {
- $sql.=" xref=?";
- $vars=array($favorite['gid']);
+ $sql .= " xref=?";
+ $vars = array($favorite['gid']);
} else {
- $sql.=" url=?";
- $vars=array($favorite['url']);
+ $sql .= " url=?";
+ $vars = array($favorite['url']);
}
- $sql.=" AND gedcom_id=?";
- $vars[]=$favorite['gedcom_id'];
+ $sql .= " AND gedcom_id=?";
+ $vars[] = $favorite['gedcom_id'];
if ($favorite['user_id']) {
- $sql.=" AND user_id=?";
- $vars[]=$favorite['user_id'];
+ $sql .= " AND user_id=?";
+ $vars[] = $favorite['user_id'];
} else {
- $sql.=" AND user_id IS NULL";
+ $sql .= " AND user_id IS NULL";
}
if (WT_DB::prepare($sql)->execute($vars)->fetchOne()) {
@@ -311,7 +317,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
return
WT_DB::prepare(
- "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title, note, url".
+ "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title, note, url" .
" FROM `##favorite` WHERE gedcom_id=? AND user_id IS NULL")
->execute(array($gedcom_id))
->fetchAll(PDO::FETCH_ASSOC);
@@ -323,10 +329,12 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
protected static function updateSchema() {
// Create tables, if not already present
try {
- WT_DB::updateSchema(WT_ROOT.WT_MODULES_DIR.'gedcom_favorites/db_schema/', 'FV_SCHEMA_VERSION', 4);
+ WT_DB::updateSchema(WT_ROOT . WT_MODULES_DIR . 'gedcom_favorites/db_schema/', 'FV_SCHEMA_VERSION', 4);
} catch (PDOException $ex) {
// The schema update scripts should never fail. If they do, there is no clean recovery.
- die($ex);
+ WT_FlashMessages::addMessage($ex->getMessage(), 'danger');
+ header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'site-unavailable.php');
+ throw $ex;
}
}
}
diff --git a/modules_v3/gedcom_news/db_schema/db_schema_0_1.php b/modules_v3/gedcom_news/db_schema/db_schema_0_1.php
index 873ce7f8fa..22ad81f088 100644
--- a/modules_v3/gedcom_news/db_schema/db_schema_0_1.php
+++ b/modules_v3/gedcom_news/db_schema/db_schema_0_1.php
@@ -29,14 +29,14 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
WT_DB::exec(
- "CREATE TABLE IF NOT EXISTS `##news` (".
- " n_id INTEGER AUTO_INCREMENT NOT NULL,".
- " n_username VARCHAR(100) NOT NULL,".
- " n_date INTEGER NOT NULL,".
- " n_title VARCHAR(255) NOT NULL,".
- " n_text TEXT NOT NULL,".
- " PRIMARY KEY (n_id),".
- " KEY ix1 (n_username)".
+ "CREATE TABLE IF NOT EXISTS `##news` (" .
+ " n_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " n_username VARCHAR(100) NOT NULL," .
+ " n_date INTEGER NOT NULL," .
+ " n_title VARCHAR(255) NOT NULL," .
+ " n_text TEXT NOT NULL," .
+ " PRIMARY KEY (n_id)," .
+ " KEY ix1 (n_username)" .
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
diff --git a/modules_v3/gedcom_news/db_schema/db_schema_1_2.php b/modules_v3/gedcom_news/db_schema/db_schema_1_2.php
index ce0ed30d8b..c90e6d845b 100644
--- a/modules_v3/gedcom_news/db_schema/db_schema_1_2.php
+++ b/modules_v3/gedcom_news/db_schema/db_schema_1_2.php
@@ -28,11 +28,11 @@
// Add new columns
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " ADD user_id INTEGER NULL AFTER n_id,".
- " ADD gedcom_id INTEGER NULL AFTER user_id,".
- " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,".
- " ADD KEY news_ix1 (user_id, updated),".
+ "ALTER TABLE `##news`" .
+ " ADD user_id INTEGER NULL AFTER n_id," .
+ " ADD gedcom_id INTEGER NULL AFTER user_id," .
+ " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," .
+ " ADD KEY news_ix1 (user_id, updated)," .
" ADD KEY news_ix2 (gedcom_id, updated)"
);
} catch (PDOException $ex) {
@@ -42,9 +42,9 @@ try {
// Migrate data from the old columns to the new ones
try {
WT_DB::exec(
- "UPDATE `##news` n".
- " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)".
- " LEFT JOIN `##user` u ON (n.n_username=u.user_name)".
+ "UPDATE `##news` n" .
+ " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" .
+ " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" .
" SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)"
);
} catch (PDOException $ex) {
@@ -63,10 +63,10 @@ try {
// Delete/rename old columns
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " DROP n_username, DROP n_date,".
- " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT,".
- " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci,".
+ "ALTER TABLE `##news`" .
+ " DROP n_username, DROP n_date," .
+ " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," .
+ " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," .
" CHANGE n_text body TEXT COLLATE utf8_unicode_ci"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/gedcom_news/db_schema/db_schema_2_3.php b/modules_v3/gedcom_news/db_schema/db_schema_2_3.php
index ac0162503f..8136ba7661 100644
--- a/modules_v3/gedcom_news/db_schema/db_schema_2_3.php
+++ b/modules_v3/gedcom_news/db_schema/db_schema_2_3.php
@@ -28,16 +28,16 @@
// Delete any data that might violate the new constraints
WT_DB::exec(
- "DELETE FROM `##news`".
- " WHERE user_id NOT IN (SELECT user_id FROM `##user` )".
+ "DELETE FROM `##news`" .
+ " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" .
" OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)"
);
// Add the new constraints
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE,".
+ "ALTER TABLE `##news`" .
+ " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," .
" ADD FOREIGN KEY news_fk2 (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/gedcom_news/module.php b/modules_v3/gedcom_news/module.php
index 313f4a6389..b8e34859cb 100644
--- a/modules_v3/gedcom_news/module.php
+++ b/modules_v3/gedcom_news/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,13 +20,16 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
// Create tables, if not already present
try {
WT_DB::updateSchema(WT_ROOT . WT_MODULES_DIR . 'gedcom_news/db_schema/', 'NB_SCHEMA_VERSION', 3);
} catch (PDOException $ex) {
// The schema update scripts should never fail. If they do, there is no clean recovery.
- die($ex);
+ WT_FlashMessages::addMessage($ex->getMessage(), 'danger');
+ header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'site-unavailable.php');
+ throw $ex;
}
/**
@@ -58,10 +61,10 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
if (isset($_REQUEST['gedcom_news_archive'])) {
$limit = 'nolimit';
- $flag = 0;
+ $flag = '0';
} else {
$flag = get_block_setting($block_id, 'flag', 0);
- if ($flag == 0) {
+ if ($flag === '0') {
$limit = 'nolimit';
} else {
$limit = get_block_setting($block_id, 'limit', 'nolimit');
@@ -100,7 +103,7 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
$c++;
}
if ($limit == 'date') {
- if ((int)((WT_TIMESTAMP - $news->updated) / 86400) > $flag) {
+ if ((int) ((WT_TIMESTAMP - $news->updated) / 86400) > $flag) {
break;
}
}
@@ -113,7 +116,7 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
$content .= $news->body;
// Print Admin options for this News item
if (WT_USER_GEDCOM_ADMIN) {
- $content .= '<hr>' . '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $news->news_id . ', \'_blank\', news_window_specs); return false;">' . WT_I18N::translate('Edit') . '</a> | ' . '<a href="index.php?action=deletenews&amp;news_id=' . $news->news_id . '&amp;ctype=' . $ctype .'" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this news article?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>';
+ $content .= '<hr>' . '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $news->news_id . ', \'_blank\', news_window_specs); return false;">' . WT_I18N::translate('Edit') . '</a> | ' . '<a href="index.php?action=deletenews&amp;news_id=' . $news->news_id . '&amp;ctype=' . $ctype . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this news article?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>';
}
$content .= '</div>';
}
@@ -126,12 +129,12 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
if ($printedAddLink) {
$content .= '&nbsp;&nbsp;|&nbsp;&nbsp;';
}
- $content .= '<a href="index.php?gedcom_news_archive=yes&amp;ctype=' . $ctype .'">' . WT_I18N::translate('View archive') . "</a>";
+ $content .= '<a href="index.php?gedcom_news_archive=yes&amp;ctype=' . $ctype . '">' . WT_I18N::translate('View archive') . "</a>";
$content .= help_link('gedcom_news_archive') . '<br>';
}
if ($template) {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -157,25 +160,23 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
set_block_setting($block_id, 'limit', WT_Filter::post('limit'));
set_block_setting($block_id, 'flag', WT_Filter::post('flag'));
- exit;
}
require_once WT_ROOT . 'includes/functions/functions_edit.php';
- // Limit Type
$limit = get_block_setting($block_id, 'limit', 'nolimit');
+ $flag = get_block_setting($block_id, 'flag', 0);
+
echo
'<tr><td class="descriptionbox wrap width33">',
WT_I18N::translate('Limit display by:'), help_link('gedcom_news_limit'),
- '</td><td class="optionbox"><select name="limit"><option value="nolimit"',
- ($limit == 'nolimit' ? ' selected="selected"' : '') . ">",
+ '</td><td class="optionbox"><select name="limit"><option value="nolimit" ',
+ ($limit == 'nolimit' ? 'selected' : '') . ">",
WT_I18N::translate('No limit') . "</option>",
- '<option value="date"' . ($limit == 'date' ? ' selected="selected"' : '') . ">" . WT_I18N::translate('Age of item') . "</option>",
- '<option value="count"' . ($limit == 'count' ? ' selected="selected"' : '') . ">" . WT_I18N::translate('Number of items') . "</option>",
+ '<option value="date" ' . ($limit == 'date' ? 'selected' : '') . ">" . WT_I18N::translate('Age of item') . "</option>",
+ '<option value="count" ' . ($limit == 'count' ? 'selected' : '') . ">" . WT_I18N::translate('Number of items') . "</option>",
'</select></td></tr>';
- // Flag to look for
- $flag = get_block_setting($block_id, 'flag', 0);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Limit:'), help_link('gedcom_news_flag');
echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="' . $flag . '"></td></tr>';
diff --git a/modules_v3/gedcom_stats/module.php b/modules_v3/gedcom_stats/module.php
index c258221d64..c5e1a35903 100644
--- a/modules_v3/gedcom_stats/module.php
+++ b/modules_v3/gedcom_stats/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class gedcom_stats_WT_Module
@@ -36,82 +37,85 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $WT_TREE, $ctype;
- $show_last_update =get_block_setting($block_id, 'show_last_update', true);
- $show_common_surnames=get_block_setting($block_id, 'show_common_surnames', true);
- $stat_indi =get_block_setting($block_id, 'stat_indi', true);
- $stat_fam =get_block_setting($block_id, 'stat_fam', true);
- $stat_sour =get_block_setting($block_id, 'stat_sour', true);
- $stat_media =get_block_setting($block_id, 'stat_media', true);
- $stat_repo =get_block_setting($block_id, 'stat_repo', true);
- $stat_surname =get_block_setting($block_id, 'stat_surname', true);
- $stat_events =get_block_setting($block_id, 'stat_events', true);
- $stat_users =get_block_setting($block_id, 'stat_users', true);
- $stat_first_birth =get_block_setting($block_id, 'stat_first_birth', true);
- $stat_last_birth =get_block_setting($block_id, 'stat_last_birth', true);
- $stat_first_death =get_block_setting($block_id, 'stat_first_death', true);
- $stat_last_death =get_block_setting($block_id, 'stat_last_death', true);
- $stat_long_life =get_block_setting($block_id, 'stat_long_life', true);
- $stat_avg_life =get_block_setting($block_id, 'stat_avg_life', true);
- $stat_most_chil =get_block_setting($block_id, 'stat_most_chil', true);
- $stat_avg_chil =get_block_setting($block_id, 'stat_avg_chil', true);
- $stat_link =get_block_setting($block_id, 'stat_link', true);
- $block =get_block_setting($block_id, 'block', false);
+ $show_last_update = get_block_setting($block_id, 'show_last_update', '1');
+ $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
+ $stat_indi = get_block_setting($block_id, 'stat_indi', '1');
+ $stat_fam = get_block_setting($block_id, 'stat_fam', '1');
+ $stat_sour = get_block_setting($block_id, 'stat_sour', '1');
+ $stat_media = get_block_setting($block_id, 'stat_media', '1');
+ $stat_repo = get_block_setting($block_id, 'stat_repo', '1');
+ $stat_surname = get_block_setting($block_id, 'stat_surname', '1');
+ $stat_events = get_block_setting($block_id, 'stat_events', '1');
+ $stat_users = get_block_setting($block_id, 'stat_users', '1');
+ $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1');
+ $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1');
+ $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1');
+ $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1');
+ $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1');
+ $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1');
+ $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1');
+ $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1');
+
+ // This can be overriden when embedding in an HTML block
+ $block = '0';
+ $stat_link = '1';
+
if ($cfg) {
foreach (array('show_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'stat_link', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title='<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
- $title='';
+ $title = '';
}
- $title.=$this->getTitle();
+ $title .= $this->getTitle();
- $stats=new WT_Stats(WT_GEDCOM);
+ $stats = new WT_Stats(WT_GEDCOM);
- $content = '<b>'.WT_TREE_TITLE.'</b><br>';
+ $content = '<b>' . WT_TREE_TITLE . '</b><br>';
if ($show_last_update) {
- $content .= '<div>'./* I18N: %s is a date */ WT_I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())).'</div>';
+ $content .= '<div>' . /* I18N: %s is a date */ WT_I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>';
}
$content .= '<table><tr><td class="width20"><table class="facts_table">';
if ($stat_indi) {
- $content.='<tr><td class="facts_label">'.WT_I18N::translate('Individuals').'</td><td class="facts_value stats_value"><a href="'."indilist.php?surname_sublist=no&amp;ged=".WT_GEDURL.'">'.$stats->totalIndividuals().'</a></td></tr>';
- $content.='<tr><td class="facts_label">'.WT_I18N::translate('Males').'</td><td class="facts_value stats_value">'.$stats->totalSexMales().'<br>'.$stats->totalSexMalesPercentage().'</td></tr>';
- $content.='<tr><td class="facts_label">'.WT_I18N::translate('Females').'</td><td class="facts_value stats_value">'.$stats->totalSexFemales().'<br>'.$stats->totalSexFemalesPercentage().'</td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Individuals') . '</td><td class="facts_value stats_value"><a href="' . "indilist.php?surname_sublist=no&amp;ged=" . WT_GEDURL . '">' . $stats->totalIndividuals() . '</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Males') . '</td><td class="facts_value stats_value">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Females') . '</td><td class="facts_value stats_value">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</td></tr>';
}
if ($stat_surname) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Total surnames').'</td><td class="facts_value stats_value"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged='.WT_GEDURL.'">'.$stats->totalSurnames().'</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td><td class="facts_value stats_value"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . WT_GEDURL . '">' . $stats->totalSurnames() . '</a></td></tr>';
}
if ($stat_fam) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Families').'</td><td class="facts_value stats_value"><a href="famlist.php?ged='.WT_GEDURL.'">'.$stats->totalFamilies().'</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Families') . '</td><td class="facts_value stats_value"><a href="famlist.php?ged=' . WT_GEDURL . '">' . $stats->totalFamilies() . '</a></td></tr>';
}
if ($stat_sour) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Sources').'</td><td class="facts_value stats_value"><a href="sourcelist.php?ged='.WT_GEDURL.'">'.$stats->totalSources().'</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Sources') . '</td><td class="facts_value stats_value"><a href="sourcelist.php?ged=' . WT_GEDURL . '">' . $stats->totalSources() . '</a></td></tr>';
}
if ($stat_media) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Media objects').'</td><td class="facts_value stats_value"><a href="medialist.php?ged='.WT_GEDURL.'">'.$stats->totalMedia().'</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Media objects') . '</td><td class="facts_value stats_value"><a href="medialist.php?ged=' . WT_GEDURL . '">' . $stats->totalMedia() . '</a></td></tr>';
}
if ($stat_repo) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Repositories').'</td><td class="facts_value stats_value"><a href="repolist.php?ged='.WT_GEDURL.'">'.$stats->totalRepositories().'</a></td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Repositories') . '</td><td class="facts_value stats_value"><a href="repolist.php?ged=' . WT_GEDURL . '">' . $stats->totalRepositories() . '</a></td></tr>';
}
if ($stat_events) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Total events').'</td><td class="facts_value stats_value">'.$stats->totalEvents().'</td></tr>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total events') . '</td><td class="facts_value stats_value">' . $stats->totalEvents() . '</td></tr>';
}
if ($stat_users) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Total users').'</td><td class="facts_value stats_value">';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total users') . '</td><td class="facts_value stats_value">';
if (WT_USER_GEDCOM_ADMIN) {
- $content .= '<a href="admin_users.php">'.$stats->totalUsers().'</a>';
+ $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>';
} else {
$content .= $stats->totalUsers();
}
@@ -121,81 +125,81 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block {
$content .= '</table></td><td><table class="facts_table">';
}
if ($stat_first_birth) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Earliest birth year').'</td><td class="facts_value stats_value">'.$stats->firstBirthYear().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td><td class="facts_value stats_value">' . $stats->firstBirthYear() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->firstBirth().'</td>';
+ $content .= '<td class="facts_value">' . $stats->firstBirth() . '</td>';
}
$content .= '</tr>';
}
if ($stat_last_birth) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Latest birth year').'</td><td class="facts_value stats_value">'.$stats->lastBirthYear().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td><td class="facts_value stats_value">' . $stats->lastBirthYear() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->lastBirth().'</td>';
+ $content .= '<td class="facts_value">' . $stats->lastBirth() . '</td>';
}
$content .= '</tr>';
}
if ($stat_first_death) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Earliest death year').'</td><td class="facts_value stats_value">'.$stats->firstDeathYear().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td><td class="facts_value stats_value">' . $stats->firstDeathYear() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->firstDeath().'</td>';
+ $content .= '<td class="facts_value">' . $stats->firstDeath() . '</td>';
}
$content .= '</tr>';
}
if ($stat_last_death) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Latest death year').'</td><td class="facts_value stats_value">'.$stats->lastDeathYear().'
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td><td class="facts_value stats_value">' . $stats->lastDeathYear() . '
</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->lastDeath().'</td>';
+ $content .= '<td class="facts_value">' . $stats->lastDeath() . '</td>';
}
- $content .='</tr>';
+ $content .= '</tr>';
}
if ($stat_long_life) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Individual who lived the longest').'</td><td class="facts_value stats_value">'.$stats->LongestLifeAge().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td><td class="facts_value stats_value">' . $stats->LongestLifeAge() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->LongestLife().'</td>';
+ $content .= '<td class="facts_value">' . $stats->LongestLife() . '</td>';
}
$content .= '</tr>';
}
if ($stat_avg_life) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Average age at death').'</td><td class="facts_value stats_value">'.$stats->averageLifespan().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td><td class="facts_value stats_value">' . $stats->averageLifespan() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.WT_I18N::translate('Males').':&nbsp;'.$stats->averageLifespanMale();
- $content .= '&nbsp;&nbsp;&nbsp;'.WT_I18N::translate('Females').':&nbsp;'.$stats->averageLifespanFemale().'</td>';
+ $content .= '<td class="facts_value">' . WT_I18N::translate('Males') . ':&nbsp;' . $stats->averageLifespanMale();
+ $content .= '&nbsp;&nbsp;&nbsp;' . WT_I18N::translate('Females') . ':&nbsp;' . $stats->averageLifespanFemale() . '</td>';
}
$content .= '</tr>';
}
if ($stat_most_chil && !$block) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Family with the most children').'</td><td class="facts_value stats_value">'.$stats->largestFamilySize().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td><td class="facts_value stats_value">' . $stats->largestFamilySize() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">'.$stats->largestFamily().'</td>';
+ $content .= '<td class="facts_value">' . $stats->largestFamily() . '</td>';
}
$content .= '</tr>';
}
if ($stat_avg_chil) {
- $content .= '<tr><td class="facts_label">'.WT_I18N::translate('Average number of children per family').'</td><td class="facts_value stats_value">'.$stats->averageChildren().'</td>';
+ $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td><td class="facts_value stats_value">' . $stats->averageChildren() . '</td>';
if (!$block) {
- $content .= '<td class="facts_value">&nbsp;</td>';
+ $content .= '<td class="facts_value"></td>';
}
$content .= '</tr>';
}
$content .= '</table></td></tr></table>';
if ($stat_link) {
- $content .= '<a href="statistics.php?ged='.WT_GEDURL.'"><b>'.WT_I18N::translate('View statistics as graphs').'</b></a><br>';
+ $content .= '<a href="statistics.php?ged=' . WT_GEDURL . '"><b>' . WT_I18N::translate('View statistics as graphs') . '</b></a><br>';
}
// NOTE: Print the most common surnames
if ($show_common_surnames) {
$surnames = get_common_surnames($WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'));
- if (count($surnames)>0) {
- $content .= '<p><b>'.WT_I18N::translate('Most common surnames').'</b></p>';
+ if (count($surnames) > 0) {
+ $content .= '<p><b>' . WT_I18N::translate('Most common surnames') . '</b></p>';
$content .= '<div class="common_surnames">';
- $i=0;
+ $i = 0;
foreach ($surnames as $indexval => $surname) {
- if (stristr($surname['name'], '@N.N')===false) {
- if ($i>0) {
+ if (stristr($surname['name'], '@N.N') === false) {
+ if ($i > 0) {
$content .= ', ';
}
- $content .= '<a href="'."indilist.php?ged=".WT_GEDURL."&amp;surname=".rawurlencode($surname['name']).'">'.$surname['name'].'</a>';
+ $content .= '<a href="' . "indilist.php?ged=" . WT_GEDURL . "&amp;surname=" . rawurlencode($surname['name']) . '">' . $surname['name'] . '</a>';
$i++;
}
}
@@ -204,7 +208,7 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block {
}
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -228,136 +232,179 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'show_last_update', WT_Filter::postBool('show_last_update'));
+ set_block_setting($block_id, 'show_last_update', WT_Filter::postBool('show_last_update'));
set_block_setting($block_id, 'show_common_surnames', WT_Filter::postBool('show_common_surnames'));
- set_block_setting($block_id, 'stat_indi', WT_Filter::postBool('stat_indi'));
- set_block_setting($block_id, 'stat_fam', WT_Filter::postBool('stat_fam'));
- set_block_setting($block_id, 'stat_sour', WT_Filter::postBool('stat_sour'));
- set_block_setting($block_id, 'stat_other', WT_Filter::postBool('stat_other'));
- set_block_setting($block_id, 'stat_media', WT_Filter::postBool('stat_media'));
- set_block_setting($block_id, 'stat_repo', WT_Filter::postBool('stat_repo'));
- set_block_setting($block_id, 'stat_surname', WT_Filter::postBool('stat_surname'));
- set_block_setting($block_id, 'stat_events', WT_Filter::postBool('stat_events'));
- set_block_setting($block_id, 'stat_users', WT_Filter::postBool('stat_users'));
- set_block_setting($block_id, 'stat_first_birth', WT_Filter::postBool('stat_first_birth'));
- set_block_setting($block_id, 'stat_last_birth', WT_Filter::postBool('stat_last_birth'));
- set_block_setting($block_id, 'stat_first_death', WT_Filter::postBool('stat_first_death'));
- set_block_setting($block_id, 'stat_last_death', WT_Filter::postBool('stat_last_death'));
- set_block_setting($block_id, 'stat_long_life', WT_Filter::postBool('stat_long_life'));
- set_block_setting($block_id, 'stat_avg_life', WT_Filter::postBool('stat_avg_life'));
- set_block_setting($block_id, 'stat_most_chil', WT_Filter::postBool('stat_most_chil'));
- set_block_setting($block_id, 'stat_avg_chil', WT_Filter::postBool('stat_avg_chil'));
- exit;
+ set_block_setting($block_id, 'stat_indi', WT_Filter::postBool('stat_indi'));
+ set_block_setting($block_id, 'stat_fam', WT_Filter::postBool('stat_fam'));
+ set_block_setting($block_id, 'stat_sour', WT_Filter::postBool('stat_sour'));
+ set_block_setting($block_id, 'stat_other', WT_Filter::postBool('stat_other'));
+ set_block_setting($block_id, 'stat_media', WT_Filter::postBool('stat_media'));
+ set_block_setting($block_id, 'stat_repo', WT_Filter::postBool('stat_repo'));
+ set_block_setting($block_id, 'stat_surname', WT_Filter::postBool('stat_surname'));
+ set_block_setting($block_id, 'stat_events', WT_Filter::postBool('stat_events'));
+ set_block_setting($block_id, 'stat_users', WT_Filter::postBool('stat_users'));
+ set_block_setting($block_id, 'stat_first_birth', WT_Filter::postBool('stat_first_birth'));
+ set_block_setting($block_id, 'stat_last_birth', WT_Filter::postBool('stat_last_birth'));
+ set_block_setting($block_id, 'stat_first_death', WT_Filter::postBool('stat_first_death'));
+ set_block_setting($block_id, 'stat_last_death', WT_Filter::postBool('stat_last_death'));
+ set_block_setting($block_id, 'stat_long_life', WT_Filter::postBool('stat_long_life'));
+ set_block_setting($block_id, 'stat_avg_life', WT_Filter::postBool('stat_avg_life'));
+ set_block_setting($block_id, 'stat_most_chil', WT_Filter::postBool('stat_most_chil'));
+ set_block_setting($block_id, 'stat_avg_chil', WT_Filter::postBool('stat_avg_chil'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $show_last_update = get_block_setting($block_id, 'show_last_update', '1');
+ $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
+ $stat_indi = get_block_setting($block_id, 'stat_indi', '1');
+ $stat_fam = get_block_setting($block_id, 'stat_fam', '1');
+ $stat_sour = get_block_setting($block_id, 'stat_sour', '1');
+ $stat_media = get_block_setting($block_id, 'stat_media', '1');
+ $stat_repo = get_block_setting($block_id, 'stat_repo', '1');
+ $stat_surname = get_block_setting($block_id, 'stat_surname', '1');
+ $stat_events = get_block_setting($block_id, 'stat_events', '1');
+ $stat_users = get_block_setting($block_id, 'stat_users', '1');
+ $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1');
+ $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1');
+ $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1');
+ $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1');
+ $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1');
+ $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1');
+ $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1');
+ $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1');
- $show_last_update=get_block_setting($block_id, 'show_last_update', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for yes/no option */ WT_I18N::translate('Show date of last update?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('show_last_update', $show_last_update);
echo '</td></tr>';
- $show_common_surnames=get_block_setting($block_id, 'show_common_surnames', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show common surnames?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('show_common_surnames', $show_common_surnames);
echo '</td></tr>';
- $stat_indi =get_block_setting($block_id, 'stat_indi', true);
- $stat_fam =get_block_setting($block_id, 'stat_fam', true);
- $stat_sour =get_block_setting($block_id, 'stat_sour', true);
- $stat_other =get_block_setting($block_id, 'stat_other', true);
- $stat_media =get_block_setting($block_id, 'stat_media', true);
- $stat_repo =get_block_setting($block_id, 'stat_repo', true);
- $stat_surname =get_block_setting($block_id, 'stat_surname', true);
- $stat_events =get_block_setting($block_id, 'stat_events', true);
- $stat_users =get_block_setting($block_id, 'stat_users', true);
- $stat_first_birth =get_block_setting($block_id, 'stat_first_birth', true);
- $stat_last_birth =get_block_setting($block_id, 'stat_last_birth', true);
- $stat_first_death =get_block_setting($block_id, 'stat_first_death', true);
- $stat_last_death =get_block_setting($block_id, 'stat_last_death', true);
- $stat_long_life =get_block_setting($block_id, 'stat_long_life', true);
- $stat_avg_life =get_block_setting($block_id, 'stat_avg_life', true);
- $stat_most_chil =get_block_setting($block_id, 'stat_most_chil', true);
- $stat_avg_chil =get_block_setting($block_id, 'stat_avg_chil', true);
?>
<tr>
<td class="descriptionbox wrap width33"><?php echo WT_I18N::translate('Select the stats to show in this block'); ?></td>
<td class="optionbox">
<table>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_indi"
- <?php if ($stat_indi) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Individuals'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_first_birth"
- <?php if ($stat_first_birth) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Earliest birth year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_surname"
- <?php if ($stat_surname) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Total surnames'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_last_birth"
- <?php if ($stat_last_birth) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Latest birth year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_fam"
- <?php if ($stat_fam) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Families'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_first_death"
- <?php if ($stat_first_death) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Earliest death year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_sour"
- <?php if ($stat_sour) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Sources'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_last_death"
- <?php if ($stat_last_death) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Latest death year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_media"
- <?php if ($stat_media) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Media objects'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_long_life"
- <?php if ($stat_long_life) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Individual who lived the longest'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_repo"
- <?php if ($stat_repo) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Repositories'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_avg_life"
- <?php if ($stat_avg_life) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Average age at death'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_other"
- <?php if ($stat_other) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Other records'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_most_chil"
- <?php if ($stat_most_chil) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Family with the most children'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_events"
- <?php if ($stat_events) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Total events'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_avg_chil"
- <?php if ($stat_avg_chil) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Average number of children per family'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_users"
- <?php if ($stat_users) echo ' checked="checked"'; ?>>
- <?php echo WT_I18N::translate('Total users'); ?></td>
- <td>&nbsp;</td>
- </tr>
+ <tbody>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_indi" <?php echo $stat_indi ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Individuals'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_first_birth" <?php echo $stat_first_birth ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Earliest birth year'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_surname" <?php echo $stat_surname ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Total surnames'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_last_birth" <?php echo $stat_last_birth ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Latest birth year'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_fam" <?php echo $stat_fam ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Families'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_first_death" <?php echo $stat_first_death ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Earliest death year'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_sour" <?php echo $stat_sour ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Sources'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_last_death" <?php echo $stat_last_death ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Latest death year'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_media" <?php echo $stat_media ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Media objects'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_long_life" <?php echo $stat_long_life ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Individual who lived the longest'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_repo" <?php echo $stat_repo ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Repositories'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_avg_life" <?php echo $stat_avg_life ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Average age at death'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_events" <?php echo $stat_events ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Total events'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_most_chil" <?php echo $stat_most_chil ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Family with the most children'); ?>
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_users" <?php echo $stat_users ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Total users'); ?>
+ </label>
+ </td>
+ <td>
+ <label>
+ <input type="checkbox" value="yes" name="stat_avg_chil" <?php echo $stat_avg_chil ? 'checked' : ''; ?>>
+ <?php echo WT_I18N::translate('Average number of children per family'); ?>
+ </label>
+ </td>
+ </tr>
+ </tbody>
</table>
</td>
</tr>
diff --git a/modules_v3/googlemap/db_schema/db_schema_0_1.php b/modules_v3/googlemap/db_schema/db_schema_0_1.php
index b718f63392..e4954a0331 100644
--- a/modules_v3/googlemap/db_schema/db_schema_0_1.php
+++ b/modules_v3/googlemap/db_schema/db_schema_0_1.php
@@ -30,21 +30,21 @@
// Create all of the tables needed for this module
WT_DB::exec(
- "CREATE TABLE IF NOT EXISTS `##placelocation` (".
- " pl_id INTEGER NOT NULL,".
- " pl_parent_id INTEGER NULL,".
- " pl_level INTEGER NULL,".
- " pl_place VARCHAR(255) NULL,".
- " pl_long VARCHAR(30) NULL,".
- " pl_lati VARCHAR(30) NULL,".
- " pl_zoom INTEGER NULL,".
- " pl_icon VARCHAR(255) NULL,".
- " PRIMARY KEY (pl_id),".
- " KEY ix1 (pl_level),".
- " KEY ix2 (pl_long),".
- " KEY ix3 (pl_lati),".
- " KEY ix4 (pl_place),".
- " KEY ix5 (pl_parent_id)".
+ "CREATE TABLE IF NOT EXISTS `##placelocation` (" .
+ " pl_id INTEGER NOT NULL," .
+ " pl_parent_id INTEGER NULL," .
+ " pl_level INTEGER NULL," .
+ " pl_place VARCHAR(255) NULL," .
+ " pl_long VARCHAR(30) NULL," .
+ " pl_lati VARCHAR(30) NULL," .
+ " pl_zoom INTEGER NULL," .
+ " pl_icon VARCHAR(255) NULL," .
+ " PRIMARY KEY (pl_id)," .
+ " KEY ix1 (pl_level)," .
+ " KEY ix2 (pl_long)," .
+ " KEY ix3 (pl_lati)," .
+ " KEY ix4 (pl_place)," .
+ " KEY ix5 (pl_parent_id)" .
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
diff --git a/modules_v3/googlemap/db_schema/db_schema_1_2.php b/modules_v3/googlemap/db_schema/db_schema_1_2.php
index 15592381dd..3576a0d5cb 100644
--- a/modules_v3/googlemap/db_schema/db_schema_1_2.php
+++ b/modules_v3/googlemap/db_schema/db_schema_1_2.php
@@ -32,13 +32,13 @@
// Create all of the tables needed for this module
try {
WT_DB::exec(
- "ALTER TABLE `##placelocation` ADD (".
- " pl_media VARCHAR(60) NULL,".
- " sv_long FLOAT NOT NULL DEFAULT 0,".
- " sv_lati FLOAT NOT NULL DEFAULT 0,".
- " sv_bearing FLOAT NOT NULL DEFAULT 0,".
- " sv_elevation FLOAT NOT NULL DEFAULT 0,".
- " sv_zoom FLOAT NOT NULL DEFAULT 1".
+ "ALTER TABLE `##placelocation` ADD (" .
+ " pl_media VARCHAR(60) NULL," .
+ " sv_long FLOAT NOT NULL DEFAULT 0," .
+ " sv_lati FLOAT NOT NULL DEFAULT 0," .
+ " sv_bearing FLOAT NOT NULL DEFAULT 0," .
+ " sv_elevation FLOAT NOT NULL DEFAULT 0," .
+ " sv_zoom FLOAT NOT NULL DEFAULT 1" .
")"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/googlemap/help_text.php b/modules_v3/googlemap/help_text.php
deleted file mode 100644
index 8438a11dec..0000000000
--- a/modules_v3/googlemap/help_text.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-// Googlemap Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'GM_MAP_ZOOM':
- $title=WT_I18N::translate('Zoom level of map');
- $text=WT_I18N::translate('Minimum and maximum zoom level for the Google map. 1 is the full map, 15 is single house. Note that 15 is only available in certain areas.');
- break;
-
-case 'GM_PRECISION':
- $title=WT_I18N::translate('Precision of the latitude and longitude');
- $text=WT_I18N::translate('This specifies the precision of the different levels when entering new geographic locations. For example a country will be specified with precision 0 (=0 digits after the decimal point), while a town needs 3 or 4 digits.');
- break;
-
-case 'GM_NAME_PREFIX_SUFFIX':
- $title=WT_I18N::translate('Optional prefixes and suffixes');
- $text=WT_I18N::translate('Some place names may be written with optional prefixes and suffixes. For example “Orange” versus “Orange County”. If the family tree contains the full place names, but the geographic database contains the short place names, then you should specify a list of the prefixes and suffixes to be disregarded. Multiple options should be separated with semicolons. For example “County;County of” or “Township;Twp;Twp.”.');
- break;
-
-case 'GM_COORD':
- $title=WT_I18N::translate('Display map coordinates');
- $text=WT_I18N::translate('This options sets whether latitude and longitude are displayed on the pop-up window attached to map markers.');
- break;
-
-// Help texts for places_edit.php
-
-case 'PLE_PRECISION':
- $title=WT_I18N::translate('Enter precision');
- $text=WT_I18N::translate('Here you can enter the precision. Based on this setting the number of digits that will be used in the latitude and longitude is determined.');
- break;
-
-case 'PLE_ZOOM':
- $title=WT_I18N::translate('Enter zoom level');
- $text=WT_I18N::translate('Here the zoom level can be entered. This value will be used as the minimal value when displaying this geographic location on a map.');
- break;
-
-case 'PLE_ICON':
- $title=WT_I18N::translate('Select an icon');
- $text=WT_I18N::translate('Here an icon can be set or removed. Using this link a flag can be selected. When this geographic location is shown, this flag will be displayed.');
- break;
-
-case 'PLE_FLAGS':
- $title=WT_I18N::translate('Select flag');
- $text=WT_I18N::translate('Using the pull down menu it is possible to select a country, of which a flag can be selected. If no flags are shown, then there are no flags defined for this country.');
- break;
-
-case 'PLIF_LOCALFILE':
- $title=WT_I18N::translate('Enter filename');
- $text=WT_I18N::translate('Select a file from the list of files already on the server which contains the place locations in CSV format.');
- break;
-
-case 'PLE_ACTIVE':
- $title=WT_I18N::translate('Show inactive places');
- $text=
- '<p>'.
- WT_I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.').
- '</p><p class="warning">'.
- WT_I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.').
- '</p>';
- break;
-
-// Help text for Place Hierarchy display
-
-case 'GM_DISP_SHORT_PLACE':
- $title=WT_I18N::translate('Display short placenames');
- $text=WT_I18N::translate('Here you can choose between two types of displaying places names in hierarchy. If set Yes the place has short name or actual level name, if No - full name.<br><b>Examples:<br>Full name: </b>Chicago, Illinois, USA<br><b>Short name: </b>Chicago<br><b>Full name: </b>Illinois, USA<br><b>Short name: </b>Illinois');
- break;
-
-// Pedigree map
-
-case 'PEDIGREE_MAP_hidelines':
- $title=WT_I18N::translate('Hide lines');
- $text=WT_I18N::translate('Hide the lines connecting the child to each parent if they exist on the map.');
- break;
-
-case 'PEDIGREE_MAP_hideflags':
- $title=WT_I18N::translate('Hide flags');
- $text=WT_I18N::translate('Hide the flags that are configured in the googlemap module. Usually these are for countries and states. This serves as a visual cue that the markers around the flag are from the general area, and not the specific spot.');
- break;
-}
diff --git a/modules_v3/googlemap/module.php b/modules_v3/googlemap/module.php
index 74143bee05..b307ab1794 100644
--- a/modules_v3/googlemap/module.php
+++ b/modules_v3/googlemap/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -21,6 +21,7 @@
use WT\Auth;
use WT\Log;
+use WT\Theme;
/**
* Class googlemap_WT_Module
@@ -46,30 +47,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// Create GM tables, if not already present
try {
- WT_DB::updateSchema(WT_ROOT.WT_MODULES_DIR.'/googlemap/db_schema/', 'GM_SCHEMA_VERSION', 5);
+ WT_DB::updateSchema(WT_ROOT . WT_MODULES_DIR . '/googlemap/db_schema/', 'GM_SCHEMA_VERSION', 5);
} catch (PDOException $ex) {
// The schema update scripts should never fail. If they do, there is no clean recovery.
- die($ex);
+ WT_FlashMessages::addMessage($ex->getMessage(), 'danger');
+ header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'site-unavailable.php');
+ throw $ex;
}
// Set default values
try {
// TODO: do this once only, in a db_schema upgrade script?
- $this->setSetting('GM_MAP_TYPE', $this->getSetting('GM_MAP_TYPE', 'G_NORMAL_MAP')); // G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP
- $this->setSetting('GM_MAX_ZOOM', $this->getSetting('GM_MAX_ZOOM', '20')); // max zoom level
- $this->setSetting('GM_MIN_ZOOM', $this->getSetting('GM_MIN_ZOOM', '2')); // min zoom level
- $this->setSetting('GM_PRECISION_0', $this->getSetting('GM_PRECISION_0', '0')); // Country level
- $this->setSetting('GM_PRECISION_1', $this->getSetting('GM_PRECISION_1', '1')); // State level
- $this->setSetting('GM_PRECISION_2', $this->getSetting('GM_PRECISION_2', '2')); // City level
- $this->setSetting('GM_PRECISION_3', $this->getSetting('GM_PRECISION_3', '3')); // Neighborhood level
- $this->setSetting('GM_PRECISION_4', $this->getSetting('GM_PRECISION_4', '4')); // House level
- $this->setSetting('GM_PRECISION_5', $this->getSetting('GM_PRECISION_5', '5')); // Max prcision level
- $this->setSetting('GM_XSIZE', $this->getSetting('GM_XSIZE', '600')); // X-size of Google map
- $this->setSetting('GM_YSIZE', $this->getSetting('GM_YSIZE', '400')); // Y-size of Google map
- $this->setSetting('GM_PH_XSIZE', $this->getSetting('GM_PH_XSIZE', '500')); // X-size of Place Hierarchy Google map
- $this->setSetting('GM_PH_YSIZE', $this->getSetting('GM_PH_YSIZE', '350')); // Y-size of Place Hierarchy Google map
- $this->setSetting('GM_PH_MARKER', $this->getSetting('GM_PH_MARKER', 'G_FLAG')); // Possible values: G_FLAG = Flag, G_DEFAULT_ICON = Standard icon
- $this->setSetting('GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE', '0')); // Display full place name or only the actual level name
+ $this->setSetting('GM_MAP_TYPE', $this->getSetting('GM_MAP_TYPE', 'G_NORMAL_MAP')); // G_PHYSICAL_MAP, G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP
+ $this->setSetting('GM_MAX_ZOOM', $this->getSetting('GM_MAX_ZOOM', '20')); // max zoom level
+ $this->setSetting('GM_MIN_ZOOM', $this->getSetting('GM_MIN_ZOOM', '2')); // min zoom level
+ $this->setSetting('GM_PRECISION_0', $this->getSetting('GM_PRECISION_0', '0')); // Country level
+ $this->setSetting('GM_PRECISION_1', $this->getSetting('GM_PRECISION_1', '1')); // State level
+ $this->setSetting('GM_PRECISION_2', $this->getSetting('GM_PRECISION_2', '2')); // City level
+ $this->setSetting('GM_PRECISION_3', $this->getSetting('GM_PRECISION_3', '3')); // Neighborhood level
+ $this->setSetting('GM_PRECISION_4', $this->getSetting('GM_PRECISION_4', '4')); // House level
+ $this->setSetting('GM_PRECISION_5', $this->getSetting('GM_PRECISION_5', '5')); // Max prcision level
+ $this->setSetting('GM_XSIZE', $this->getSetting('GM_XSIZE', '600')); // X-size of Google map
+ $this->setSetting('GM_YSIZE', $this->getSetting('GM_YSIZE', '400')); // Y-size of Google map
+ $this->setSetting('GM_PH_XSIZE', $this->getSetting('GM_PH_XSIZE', '500')); // X-size of Place Hierarchy Google map
+ $this->setSetting('GM_PH_YSIZE', $this->getSetting('GM_PH_YSIZE', '350')); // Y-size of Place Hierarchy Google map
+ $this->setSetting('GM_PH_MARKER', $this->getSetting('GM_PH_MARKER', 'G_FLAG')); // Possible values: G_FLAG = Flag, G_DEFAULT_ICON = Standard icon
+ $this->setSetting('GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE', '0')); // Display full place name or only the actual level name
} catch (Exception $ex) {
// Perhaps the module hasn't been installed yet (no entry in wt_modules)
}
@@ -87,7 +90,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
/** {@inheritdoc} */
public function modAction($mod_action) {
- switch($mod_action) {
+ switch ($mod_action) {
case 'admin_config':
$this->config();
break;
@@ -117,7 +120,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
/** {@inheritdoc} */
public function getConfigLink() {
- return 'module.php?mod='.$this->getName().'&amp;mod_action=admin_config';
+ return 'module.php?mod=' . $this->getName() . '&amp;mod_action=admin_config';
}
/** {@inheritdoc} */
@@ -146,7 +149,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
/** {@inheritdoc} */
public function getTabContent() {
- global $WT_IMAGES, $controller;
+ global $controller;
if ($this->checkMapData()) {
ob_start();
@@ -164,7 +167,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_places">', WT_I18N::translate('Geographic data'), '</a>';
echo '</td>';
echo '<td width="25%" align="right">';
- echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place check'),'</a>';
+ echo '<a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place check'), '</a>';
echo '</td>';
echo '</tr></table>';
}
@@ -192,19 +195,19 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '</td>';
echo '</tr></table>';
// start
- echo '<img src="', $WT_IMAGES['spacer'], '" id="marker6" width="1" height="1" alt="">';
+ echo '<img src="', Theme::theme()->parameter('image-spacer'), '" id="marker6" width="1" height="1" alt="">';
// end
echo '</td></tr></table>';
echo '<script>loadMap();</script>';
- return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
+ return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
} else {
- $html='<table class="facts_table">';
- $html.='<tr><td colspan="2" class="facts_value">'.WT_I18N::translate('No map data for this person');
- $html.='</td></tr>';
+ $html = '<table class="facts_table">';
+ $html .= '<tr><td colspan="2" class="facts_value">' . WT_I18N::translate('No map data for this person');
+ $html .= '</td></tr>';
if (Auth::isAdmin()) {
- $html.='<tr><td class="center" colspan="2">';
- $html.='<a href="module.php?mod=googlemap&amp;mod_action=admin_config">'.WT_I18N::translate('Google Maps™ preferences'). '</a>';
- $html.='</td></tr>';
+ $html .= '<tr><td class="center" colspan="2">';
+ $html .= '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">' . WT_I18N::translate('Google Maps™ preferences') . '</a>';
+ $html .= '</td></tr>';
}
return $html;
}
@@ -226,39 +229,39 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* A form to edit the module configuration.
*/
private function config() {
- require WT_ROOT.'includes/functions/functions_edit.php';
+ require WT_ROOT . 'includes/functions/functions_edit.php';
$action = WT_Filter::post('action');
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Google Maps™'))
->pageHeader()
->addInlineJavascript('jQuery("#tabs").tabs();');
- if ($action=='update') {
- $this->setSetting('GM_MAP_TYPE', WT_Filter::post('NEW_GM_MAP_TYPE'));
- $this->setSetting('GM_USE_STREETVIEW', WT_Filter::post('NEW_GM_USE_STREETVIEW'));
- $this->setSetting('GM_MIN_ZOOM', WT_Filter::post('NEW_GM_MIN_ZOOM'));
- $this->setSetting('GM_MAX_ZOOM', WT_Filter::post('NEW_GM_MAX_ZOOM'));
- $this->setSetting('GM_XSIZE', WT_Filter::post('NEW_GM_XSIZE'));
- $this->setSetting('GM_YSIZE', WT_Filter::post('NEW_GM_YSIZE'));
- $this->setSetting('GM_PRECISION_0', WT_Filter::post('NEW_GM_PRECISION_0'));
- $this->setSetting('GM_PRECISION_1', WT_Filter::post('NEW_GM_PRECISION_1'));
- $this->setSetting('GM_PRECISION_2', WT_Filter::post('NEW_GM_PRECISION_2'));
- $this->setSetting('GM_PRECISION_3', WT_Filter::post('NEW_GM_PRECISION_3'));
- $this->setSetting('GM_PRECISION_4', WT_Filter::post('NEW_GM_PRECISION_4'));
- $this->setSetting('GM_PRECISION_5', WT_Filter::post('NEW_GM_PRECISION_5'));
- $this->setSetting('GM_COORD', WT_Filter::post('NEW_GM_COORD'));
- $this->setSetting('GM_PLACE_HIERARCHY', WT_Filter::post('NEW_GM_PLACE_HIERARCHY'));
- $this->setSetting('GM_PH_XSIZE', WT_Filter::post('NEW_GM_PH_XSIZE'));
- $this->setSetting('GM_PH_YSIZE', WT_Filter::post('NEW_GM_PH_YSIZE'));
- $this->setSetting('GM_PH_MARKER', WT_Filter::post('NEW_GM_PH_MARKER'));
- $this->setSetting('GM_DISP_SHORT_PLACE', WT_Filter::post('NEW_GM_DISP_SHORT_PLACE'));
+ if ($action == 'update') {
+ $this->setSetting('GM_MAP_TYPE', WT_Filter::post('NEW_GM_MAP_TYPE'));
+ $this->setSetting('GM_USE_STREETVIEW', WT_Filter::post('NEW_GM_USE_STREETVIEW'));
+ $this->setSetting('GM_MIN_ZOOM', WT_Filter::post('NEW_GM_MIN_ZOOM'));
+ $this->setSetting('GM_MAX_ZOOM', WT_Filter::post('NEW_GM_MAX_ZOOM'));
+ $this->setSetting('GM_XSIZE', WT_Filter::post('NEW_GM_XSIZE'));
+ $this->setSetting('GM_YSIZE', WT_Filter::post('NEW_GM_YSIZE'));
+ $this->setSetting('GM_PRECISION_0', WT_Filter::post('NEW_GM_PRECISION_0'));
+ $this->setSetting('GM_PRECISION_1', WT_Filter::post('NEW_GM_PRECISION_1'));
+ $this->setSetting('GM_PRECISION_2', WT_Filter::post('NEW_GM_PRECISION_2'));
+ $this->setSetting('GM_PRECISION_3', WT_Filter::post('NEW_GM_PRECISION_3'));
+ $this->setSetting('GM_PRECISION_4', WT_Filter::post('NEW_GM_PRECISION_4'));
+ $this->setSetting('GM_PRECISION_5', WT_Filter::post('NEW_GM_PRECISION_5'));
+ $this->setSetting('GM_COORD', WT_Filter::post('NEW_GM_COORD'));
+ $this->setSetting('GM_PLACE_HIERARCHY', WT_Filter::post('NEW_GM_PLACE_HIERARCHY'));
+ $this->setSetting('GM_PH_XSIZE', WT_Filter::post('NEW_GM_PH_XSIZE'));
+ $this->setSetting('GM_PH_YSIZE', WT_Filter::post('NEW_GM_PH_YSIZE'));
+ $this->setSetting('GM_PH_MARKER', WT_Filter::post('NEW_GM_PH_MARKER'));
+ $this->setSetting('GM_DISP_SHORT_PLACE', WT_Filter::post('NEW_GM_DISP_SHORT_PLACE'));
- for ($i=1; $i<=9; $i++) {
- $this->setSetting('GM_PREFIX_' . $i, WT_Filter::post('NEW_GM_PREFIX_' . $i));
+ for ($i = 1; $i <= 9; $i++) {
+ $this->setSetting('GM_PREFIX_' . $i, WT_Filter::post('NEW_GM_PREFIX_' . $i));
$this->setSetting('GM_POSTFIX_' . $i, WT_Filter::post('NEW_GM_POSTFIX_' . $i));
}
@@ -300,16 +303,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<th><?php echo WT_I18N::translate('Default map type'); ?></th>
<td>
<select name="NEW_GM_MAP_TYPE">
- <option value="ROADMAP" <?php if ($this->getSetting('GM_MAP_TYPE') == 'ROADMAP') echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Map'); ?></option>
- <option value="SATELLITE" <?php if ($this->getSetting('GM_MAP_TYPE') == 'SATELLITE') echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Satellite'); ?></option>
- <option value="HYBRID" <?php if ($this->getSetting('GM_MAP_TYPE') == 'HYBRID') echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Hybrid'); ?></option>
- <option value="TERRAIN" <?php if ($this->getSetting('GM_MAP_TYPE') == 'TERRAIN') echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Terrain'); ?></option>
+ <option value="ROADMAP" <?php if ($this->getSetting('GM_MAP_TYPE') === 'ROADMAP') echo "selected"; ?>><?php echo WT_I18N::translate('Map'); ?></option>
+ <option value="SATELLITE" <?php if ($this->getSetting('GM_MAP_TYPE') === 'SATELLITE') echo "selected"; ?>><?php echo WT_I18N::translate('Satellite'); ?></option>
+ <option value="HYBRID" <?php if ($this->getSetting('GM_MAP_TYPE') === 'HYBRID') echo "selected"; ?>><?php echo WT_I18N::translate('Hybrid'); ?></option>
+ <option value="TERRAIN" <?php if ($this->getSetting('GM_MAP_TYPE') === 'TERRAIN') echo "selected"; ?>><?php echo WT_I18N::translate('Terrain'); ?></option>
</select>
</td>
</tr>
<tr>
<th><?php echo /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ WT_I18N::translate('Google Street View™'); ?></th>
- <td><?php echo radio_buttons('NEW_GM_USE_STREETVIEW', array(false=>WT_I18N::translate('hide'),true=>WT_I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW')); ?></td>
+ <td><?php echo radio_buttons('NEW_GM_USE_STREETVIEW', array(false=>WT_I18N::translate('hide'), true=>WT_I18N::translate('show')), $this->getSetting('GM_USE_STREETVIEW')); ?></td>
</tr>
<tr>
<th><?php echo WT_I18N::translate('Size of map (in pixels)'); ?></th>
@@ -321,18 +324,21 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
</td>
</tr>
<tr>
- <th><?php echo WT_I18N::translate('Zoom level of map'), help_link('GM_MAP_ZOOM','googlemap'); ?></th>
+ <th><?php echo WT_I18N::translate('Zoom level of map'); ?></th>
<td>
<?php echo WT_I18N::translate('minimum'); ?>: <select name="NEW_GM_MIN_ZOOM">
- <?php for ($j=1; $j < 15; $j++) { ?>
- <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MIN_ZOOM')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 1; $j < 15; $j++) { ?>
+ <option value="<?php echo $j, "\" "; if ($this->getSetting('GM_MIN_ZOOM') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>
<?php echo WT_I18N::translate('maximum'); ?>: <select name="NEW_GM_MAX_ZOOM">
- <?php for ($j=1; $j < 21; $j++) { ?>
- <option value="<?php echo $j, "\""; if ($this->getSetting('GM_MAX_ZOOM')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 1; $j < 21; $j++) { ?>
+ <option value="<?php echo $j, "\" "; if ($this->getSetting('GM_MAX_ZOOM') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>
+ <p>
+ <?php echo WT_I18N::translate('Minimum and maximum zoom level for the Google map. 1 is the full map, 15 is single house. Note that 15 is only available in certain areas.'); ?>
+ </p>
</td>
</tr>
</table>
@@ -341,14 +347,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<div id="gm_advanced">
<table class="gm_edit_config">
<tr>
- <th colspan="2"><?php echo WT_I18N::translate('Precision of the latitude and longitude'), help_link('GM_PRECISION','googlemap'); ?></th>
+ <th colspan="2">
+ <?php echo WT_I18N::translate('Precision of the latitude and longitude'); ?>
+ </th>
<td>
<table>
<tr>
<td><?php echo WT_I18N::translate('Country'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_0">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_0')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_0') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
@@ -356,8 +364,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<tr>
<td><?php echo WT_I18N::translate('State'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_1">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_1')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_1') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
@@ -365,59 +373,73 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<tr>
<td><?php echo WT_I18N::translate('City'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_2">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_2')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_2') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
</tr>
<tr><td><?php echo WT_I18N::translate('Neighborhood'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_3">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_3')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_3') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
</tr>
<tr><td><?php echo WT_I18N::translate('House'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_4">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_4')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_4') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
</tr>
<tr><td><?php echo WT_I18N::translate('Max'); ?>&nbsp;&nbsp;</td>
<td><select name="NEW_GM_PRECISION_5">
- <?php for ($j=0; $j < 10; $j++) { ?>
- <option value="<?php echo $j; ?>"<?php if ($this->getSetting('GM_PRECISION_5')==$j) echo " selected=\"selected\""; echo ">", $j; ?></option>
+ <?php for ($j = 0; $j < 10; $j++) { ?>
+ <option value="<?php echo $j; ?>" <?php if ($this->getSetting('GM_PRECISION_5') == $j) echo "selected"; echo ">", $j; ?></option>
<?php } ?>
</select>&nbsp;&nbsp;<?php echo WT_I18N::translate('digits'); ?>
</td>
</tr>
</table>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('This specifies the precision of the different levels when entering new geographic locations. For example a country will be specified with precision 0 (=0 digits after the decimal point), while a town needs 3 or 4 digits.'); ?>
+ </p>
</td>
- <td>&nbsp;</td>
+ <td></td>
</tr>
- <th class="gm_prefix" colspan="3"><?php echo WT_I18N::translate('Optional prefixes and suffixes'), help_link('GM_NAME_PREFIX_SUFFIX','googlemap');?></th>
+ <th class="gm_prefix">
+ <?php echo WT_I18N::translate('Optional prefixes and suffixes'); ?>
+ </th>
+ <td colspan="2">
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Some place names may be written with optional prefixes and suffixes. For example “Orange” versus “Orange County”. If the family tree contains the full place names, but the geographic database contains the short place names, then you should specify a list of the prefixes and suffixes to be disregarded. Multiple options should be separated with semicolons. For example “County;County of” or “Township;Twp;Twp.”.'); ?>
+ </p>
+ </td>
</tr>
<tr id="gm_level_titles">
- <th>&nbsp;</th>
+ <th></th>
<th><?php echo WT_I18N::translate('Prefixes'); ?></th>
<th><?php echo WT_I18N::translate('Suffixes'); ?></th>
- <?php for ($level=1; $level < 10; $level++) { ?>
+ <?php for ($level = 1; $level < 10; $level++) { ?>
<tr class="gm_levels">
<th>
<?php
- if ($level==1) {
+ if ($level == 1) {
echo WT_I18N::translate('Country');
} else {
echo WT_I18N::translate('Level'), " ", $level;
}
?>
</th>
- <td><input type="text" size="30" name="NEW_GM_PREFIX_<?php echo $level; ?>" value="<?php echo $this->getSetting('GM_PREFIX_' . $level); ?>"></td>
- <td><input type="text" size="30" name="NEW_GM_POSTFIX_<?php echo $level; ?>" value="<?php echo $this->getSetting('GM_POSTFIX_' . $level); ?>"></td>
+ <td>
+ <input type="text" size="30" name="NEW_GM_PREFIX_<?php echo $level; ?>" value="<?php echo $this->getSetting('GM_PREFIX_' . $level); ?>">
+ </td>
+ <td>
+ <input type="text" size="30" name="NEW_GM_POSTFIX_<?php echo $level; ?>" value="<?php echo $this->getSetting('GM_POSTFIX_' . $level); ?>">
+ </td>
</tr>
<?php } ?>
</table>
@@ -442,18 +464,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<th><?php echo WT_I18N::translate('Type of place markers in Place Hierarchy'); ?></th>
<td>
<select name="NEW_GM_PH_MARKER">
- <option value="G_DEFAULT_ICON" <?php if ($this->getSetting('GM_PH_MARKER')=="G_DEFAULT_ICON") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Standard'); ?></option>
- <option value="G_FLAG" <?php if ($this->getSetting('GM_PH_MARKER')=="G_FLAG") echo "selected=\"selected\""; ?>><?php echo WT_I18N::translate('Flag'); ?></option>
+ <option value="G_DEFAULT_ICON" <?php if ($this->getSetting('GM_PH_MARKER') == "G_DEFAULT_ICON") echo "selected"; ?>><?php echo WT_I18N::translate('Standard'); ?></option>
+ <option value="G_FLAG" <?php if ($this->getSetting('GM_PH_MARKER') == "G_FLAG") echo "selected"; ?>><?php echo WT_I18N::translate('Flag'); ?></option>
</select>
</td>
</tr>
<tr>
- <th><?php echo WT_I18N::translate('Display short placenames'), help_link('GM_DISP_SHORT_PLACE','googlemap'); ?></th>
- <td><?php echo edit_field_yes_no('NEW_GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE')); ?></td>
+ <th>
+ <?php echo WT_I18N::translate('Display short placenames'), help_link('GM_DISP_SHORT_PLACE', 'googlemap'); ?>
+ </th>
+ <td>
+ <?php echo edit_field_yes_no('NEW_GM_DISP_SHORT_PLACE', $this->getSetting('GM_DISP_SHORT_PLACE')); ?>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Hide the flags that are configured in the googlemap module. Usually these are for countries and states. This serves as a visual cue that the markers around the flag are from the general area, and not the specific spot.'); ?>
+ </p>
+ </td>
</tr>
<tr>
- <th><?php echo WT_I18N::translate('Display map coordinates'), help_link('GM_COORD','googlemap'); ?></th>
- <td><?php echo edit_field_yes_no('NEW_GM_COORD', $this->getSetting('GM_COORD')); ?></td>
+ <th>
+ <?php echo WT_I18N::translate('Display map coordinates'); ?>
+ </th>
+ <td>
+ <?php echo edit_field_yes_no('NEW_GM_COORD', $this->getSetting('GM_COORD')); ?>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('This options sets whether latitude and longitude are displayed on the pop-up window attached to map markers.'); ?>
+ </p>
+ </td>
</tr>
</table>
</div>
@@ -480,7 +516,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
private function flags() {
require WT_ROOT . 'includes/functions/functions_edit.php';
- $controller = new WT_Controller_Simple();
+ $controller = new WT_Controller_Simple;
$controller
->setPageTitle(WT_I18N::translate('Select flag'))
->pageHeader();
@@ -490,7 +526,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$action = WT_Filter::post('action');
$countrySelected = WT_Filter::get('countrySelected', null, 'Countries');
- $stateSelected = WT_Filter::get('stateSelected', null, 'States');
+ $stateSelected = WT_Filter::get('stateSelected', null, 'States');
$country = array();
if (is_dir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/flags')) {
@@ -524,7 +560,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$rep = opendir(WT_ROOT . WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $stateSelected);
while ($file = readdir($rep)) {
if (stristr($file, '.png')) {
- $flags_s[] = substr($file, 0, strlen($file)-4);
+ $flags_s[] = substr($file, 0, strlen($file) - 4);
}
}
closedir($rep);
@@ -537,7 +573,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<?php if ($_POST['selcountry'] == 'Countries') { ?>
window.opener.document.editplaces.icon.value = 'places/flags/<?php echo $flags[$_POST['FLAGS']]; ?>.png';
window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?>googlemap/places/flags/<?php echo $country[$_POST['FLAGS']]; ?>.png\">&nbsp;&nbsp;<a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;<a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>";
- <?php } elseif ($_POST['selstate'] != "States"){ ?>
+ <?php } elseif ($_POST['selstate'] != "States") { ?>
window.opener.document.editplaces.icon.value = 'places/<?php echo $countrySelected, '/flags/', $_POST['selstate'], '/', $flags_s[$_POST['FLAGS']]; ?>.png';
window.opener.document.getElementById('flagsDiv').innerHTML = "<img src=\"<?php echo WT_STATIC_URL, WT_MODULES_DIR; ?>googlemap/places/<?php echo $countrySelected, "/flags/", $_POST['selstate'], "/", $flags_s[$_POST['FLAGS']]; ?>.png\">&nbsp;&nbsp;<a href=\"#\" onclick=\"change_icon();return false;\"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;<a href=\"#\" onclick=\"remove_icon();return false;\"><?php echo WT_I18N::translate('Remove flag'); ?></a>";
<?php } else { ?>
@@ -565,10 +601,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<?php
}
$countryList = array();
- $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/');
+ $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/');
for ($i = 0; $i < count($country); $i++) {
- if (count(preg_grep('/'.$country[$i].'/', $placesDir)) != 0) {
- $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$country[$i].'/');
+ if (count(preg_grep('/' . $country[$i] . '/', $placesDir)) != 0) {
+ $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $country[$i] . '/');
while ($file = readdir($rep)) {
if (stristr($file, 'flags')) {
if (isset($countries[$country[$i]])) {
@@ -584,10 +620,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
asort($countryList);
$stateList = array();
if ($countrySelected != 'Countries') {
- $placesDir = scandir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/');
+ $placesDir = scandir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/');
for ($i = 0; $i < count($flags); $i++) {
if (in_array($flags[$i], $placesDir)) {
- $rep = opendir(WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$flags[$i].'/');
+ $rep = opendir(WT_MODULES_DIR . 'googlemap/places/' . $countrySelected . '/flags/' . $flags[$i] . '/');
while ($file = readdir($rep)) {
$stateList[$flags[$i]] = $flags[$i];
}
@@ -598,6 +634,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
?>
<h4><?php echo WT_I18N::translate('Change flag'); ?></h4>
+
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Using the pull down menu it is possible to select a country, of which a flag can be selected. If no flags are shown, then there are no flags defined for this country.'); ?>
+ </p>
+
<form method="post" id="flags" name="flags" action="module.php?mod=googlemap&amp;mod_action=flags&amp;countrySelected=<?php echo $countrySelected; ?>&amp;stateSelected=<?php echo $stateSelected; ?>">
<input type="hidden" name="action" value="ChangeFlag">
<input type="hidden" name="selcountry" value="<?php echo $countrySelected; ?>">
@@ -605,12 +646,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<table class="facts_table">
<tr>
<td class="optionbox" colspan="4">
- <?php echo help_link('PLE_FLAGS','googlemap'); ?>
<select name="COUNTRYSELECT" dir="ltr" onchange="selectCountry()">
<option value="Countries"><?php echo WT_I18N::translate('Countries'); ?></option>
<?php foreach ($countryList as $country_key=>$country_name) {
- echo '<option value="', $country_key, '"';
- if ($countrySelected == $country_key) echo ' selected="selected" ';
+ echo '<option value="', $country_key, '" ';
+ if ($countrySelected == $country_key) {
+ echo 'selected';
+ }
echo '>', $country_name, '</option>';
} ?>
</select>
@@ -621,15 +663,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$j = 1;
for ($i = 0; $i < count($flags); $i++) {
if ($countrySelected == 'Countries') {
- $tempstr = '<td><input type="radio" dir="ltr" name="FLAGS" value="'.$i.'"><img src="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/places/flags/'.$flags[$i].'.png" alt="'.$flags[$i].'" title="';
- if ($flags[$i]!='blank') {
+ $tempstr = '<td><input type="radio" dir="ltr" name="FLAGS" value="' . $i . '"><img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/places/flags/' . $flags[$i] . '.png" alt="' . $flags[$i] . '" title="';
+ if ($flags[$i] != 'blank') {
if (isset($countries[$flags[$i]])) {
- $tempstr.=$countries[$flags[$i]];
+ $tempstr .= $countries[$flags[$i]];
} else {
- $tempstr.=$flags[$i];
+ $tempstr .= $flags[$i];
}
} else {
- $tempstr.=$countries['???'];
+ $tempstr .= $countries['???'];
}
echo $tempstr, '">&nbsp;&nbsp;', $flags[$i], '</input></td>';
} else {
@@ -642,18 +684,19 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$j++;
}
echo '</tr><tr';
- if ($countrySelected == 'Countries' || count($stateList)==0) {
+ if ($countrySelected == 'Countries' || count($stateList) == 0) {
echo ' style=" visibility: hidden"';
}
echo '>';
?>
<td class="optionbox" colspan="4">
- <?php echo help_link('PLE_FLAGS','googlemap'); ?>
<select name="STATESELECT" dir="ltr" onchange="selectCountry()">
<option value="States"><?php echo /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'); ?></option>
<?php foreach ($stateList as $state_key=>$state_name) {
- echo '<option value="', $state_key, '"';
- if ($stateSelected == $state_key) echo ' selected="selected"';
+ echo '<option value="', $state_key, '" ';
+ if ($stateSelected == $state_key) {
+ echo 'selected';
+ }
echo '>', $state_name, '</option>';
} ?>
</select>
@@ -664,7 +707,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$j = 1;
for ($i = 0; $i < count($flags_s); $i++) {
if ($stateSelected != 'States') {
- echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL.WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flags_s[$i], '.png">&nbsp;&nbsp;', $flags_s[$i], '</input></td>';
+ echo '<td><input type="radio" dir="ltr" name="FLAGS" value="', $i, '"><img src="', WT_STATIC_URL . WT_MODULES_DIR, 'googlemap/places/', $countrySelected, '/flags/', $stateSelected, '/', $flags_s[$i], '.png">&nbsp;&nbsp;', $flags_s[$i], '</input></td>';
}
if ($j == 4) {
echo '</tr><tr>';
@@ -693,7 +736,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$hideflags = WT_Filter::getBool('hideflags');
$hidelines = WT_Filter::getBool('hidelines');
- $controller = new WT_Controller_Pedigree();
+ $controller = new WT_Controller_Pedigree;
// Start of internal configuration variables
// Limit this to match available number of icons.
@@ -704,7 +747,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$controller
->setPageTitle(/* I18N: %s is an individual’s name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()))
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
@@ -726,10 +769,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<?php echo WT_I18N::translate('Generations'); ?>
</td>
<td class="descriptionbox wrap">
- <?php echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags','googlemap'); ?>
+ <?php echo WT_I18N::translate('Hide flags'); ?>
</td>
<td class="descriptionbox wrap">
- <?php echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines','googlemap'); ?>
+ <?php echo WT_I18N::translate('Hide lines'); ?>
</td>
</tr>
<tr>
@@ -740,33 +783,35 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<td class="optionbox">
<select name="PEDIGREE_GENERATIONS">
<?php
- for ($p=3; $p<=$MAX_PEDIGREE_GENERATIONS; $p++) {
+ for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) {
echo '<option value="', $p, '" ';
if ($p == $controller->PEDIGREE_GENERATIONS) {
- echo 'selected="selected"';
+ echo 'selected';
}
echo '>', $p, '</option>';
}
?>
</select>
</td>
- <td class="optionbox">
+ <td class="optionbox wrap">
<?php
- echo '<input name="hideflags" type="checkbox" value="1"';
- if ($hideflags) {
- echo ' checked="checked"';
- }
+ echo '<input name="hideflags" type="checkbox" value="1" ';
+ echo $hideflags ? 'checked' : '';
echo '>';
?>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Hide the flags that are configured in the googlemap module. Usually these are for countries and states. This serves as a visual cue that the markers around the flag are from the general area, and not the specific spot.'); ?>
+ </p>
</td>
- <td class="optionbox">
+ <td class="optionbox wrap">
<?php
- echo '<input name="hidelines" type="checkbox" value="1"';
- if ($hidelines) {
- echo ' checked="checked"';
- }
+ echo '<input name="hidelines" type="checkbox" value="1" ';
+ echo $hidelines ? 'checked' : '';
echo '>';
?>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Hide the lines connecting the child to each parent if they exist on the map.'); ?>
+ </p>
</td>
</tr>
<tr>
@@ -780,18 +825,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<!-- count records by type -->
<?php
- $curgen=1;
- $priv=0;
- $count=0;
- $miscount=0;
+ $curgen = 1;
+ $priv = 0;
+ $count = 0;
+ $miscount = 0;
$missing = '';
$latlongval = array();
$lat = array();
$lon = array();
- for ($i=0; $i<($controller->treesize); $i++) {
+ for ($i = 0; $i < ($controller->treesize); $i++) {
// -- check to see if we have moved to the next generation
- if ($i+1 >= pow(2, $curgen)) {$curgen++;}
+ if ($i + 1 >= pow(2, $curgen)) {$curgen++; }
$person = $controller->ancestors[$i];
if (!empty($person)) {
$name = $person->getFullName();
@@ -807,7 +852,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
if (($lat[$i] != null) && ($lon[$i] != null)) {
$count++;
- } else { // The place is in the table but has empty values
+ } else {
+ // The place is in the table but has empty values
if ($name) {
if ($missing) {
$missing .= ', ';
@@ -816,7 +862,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$miscount++;
}
}
- } else { // There was no place, or not listed in the map table
+ } else {
+ // There was no place, or not listed in the map table
if ($name) {
if ($missing) {
$missing .= ', ';
@@ -848,7 +895,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '</td></tr>';
echo '</table>';
}
- echo '</td><td width="15px">&nbsp;</td>';
+ echo '</td><td width="15px"></td>';
echo '<td width="310px" valign="top">';
echo '<div id="side_bar" style="width:300px; font-size:0.9em; overflow:auto; overflow-x:hidden; overflow-y:auto; height:', $this->getSetting('GM_YSIZE'), 'px;"></div></td>';
echo '</tr>';
@@ -860,7 +907,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<td valign="top">';
// print summary statistics
if (isset($curgen)) {
- $total=pow(2,$curgen)-1;
+ $total = pow(2, $curgen) - 1;
echo WT_I18N::plural(
'%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.',
'%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.',
@@ -874,7 +921,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($priv) {
echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>';
}
- if ($count+$priv != $total) {
+ if ($count + $priv != $total) {
if ($miscount == 0) {
echo WT_I18N::translate('No ancestors in the database.'), "<br>";
} else {
@@ -889,8 +936,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '</td>';
echo '</tr>';
echo '</table>';
- echo '</div>';// close #pedigreemap_chart
- echo '</div>';// close #pedigreemap-page
+ echo '</div>'; // close #pedigreemap_chart
+ echo '</div>'; // close #pedigreemap-page
?>
<!-- end of map display -->
<!-- Start of map scripts -->
@@ -909,7 +956,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
global $controller, $SHOW_HIGHLIGHT_IMAGES, $PEDIGREE_GENERATIONS;
// The HomeControl returns the map to the original position and style
- $js='function HomeControl(controlDiv, pm_map) {'.
+ $js = 'function HomeControl(controlDiv, pm_map) {' .
// Set CSS styles for the DIV containing the control
// Setting padding to 5 px will offset the control from the edge of the map
'controlDiv.style.paddingTop = "5px";
@@ -932,7 +979,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
controlText.style.fontSize = "12px";
controlText.style.paddingLeft = "15px";
controlText.style.paddingRight = "15px";
- controlText.innerHTML = "<b>'.WT_I18N::translate('Redraw map').'<\/b>";
+ controlText.innerHTML = "<b>'.WT_I18N::translate('Redraw map') . '<\/b>";
controlUI.appendChild(controlText);'.
// Setup the click event listeners: simply set the map to original LatLng
'google.maps.event.addDomListener(controlUI, "click", function() {
@@ -953,7 +1000,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
google.maps.event.trigger(gmarkers[i], "click");
}'.
// this variable will collect the html which will eventually be placed in the side_bar
- 'var side_bar_html = "";'.
+ 'var side_bar_html = "";' .
// arrays to hold copies of the markers and html used by the side_bar
// because the function closure trick doesnt work there
'var gmarkers = [];
@@ -1243,7 +1290,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
lastlinkid=linkid;
});'.
// save the info we need to use later for the side_bar
- 'gmarkers[i] = marker;'.
+ 'gmarkers[i] = marker;' .
// add a line to the side_bar html
'side_bar_html += "<br><div id=\'"+linkid+"\' onclick=\'myclick(" + i + ")\'>" + html +"<br></div>";
i++;
@@ -1302,14 +1349,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$name = $person->getFullName();
// -- check to see if we have moved to the next generation
- if ($i+1 >= pow(2, $curgen)) {
+ if ($i + 1 >= pow(2, $curgen)) {
$curgen++;
}
$relationship = get_close_relationship_name($controller->root, $person);
- $event = '<img src="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/sq'.$curgen.'.png" width="10" height="10"> '.
- '<strong>'.$relationship.'</strong>';
+ $event = '<img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/sq' . $curgen . '.png" width="10" height="10"> ' .
+ '<strong>' . $relationship . '</strong>';
// add thumbnail image
if ($SHOW_HIGHLIGHT_IMAGES) {
$image = $person->displayImage();
@@ -1319,18 +1366,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// end of add image
$dataleft = WT_Filter::escapeJs($image . $event . ' — ' . $name);
- $datamid = WT_Filter::escapeJs(' <span><a href="' . $person->getHtmlUrl() . '">('.WT_I18N::translate('View person').')</a></span>');
- $dataright = WT_Filter::escapeJs('<br><strong>'. WT_I18N::translate('Birth:') . '&nbsp;</strong>' . $person->getBirthDate()->display() . ' — ' . $person->getBirthPlace());
+ $datamid = WT_Filter::escapeJs(' <span><a href="' . $person->getHtmlUrl() . '">(' . WT_I18N::translate('View person') . ')</a></span>');
+ $dataright = WT_Filter::escapeJs('<br><strong>' . WT_I18N::translate('Birth:') . '&nbsp;</strong>' . $person->getBirthDate()->display() . ' — ' . $person->getBirthPlace());
$latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
if ($latlongval[$i]) {
- $lat[$i] = (double)str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
- $lon[$i] = (double)str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
+ $lat[$i] = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
+ $lon[$i] = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
if ($lat[$i] || $lon[$i]) {
if (!$hideflags && $latlongval[$i]->pl_icon) {
$flags[$i] = $latlongval[$i]->pl_icon;
$ffile = strrchr($latlongval[$i]->pl_icon, '/');
- $ffile = substr($ffile,1, strpos($ffile, '.')-1);
+ $ffile = substr($ffile, 1, strpos($ffile, '.') - 1);
if (empty($flags[$ffile])) {
$flags[$ffile] = $i; // Only generate the flag once
$js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');';
@@ -1383,14 +1430,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$js .= "' title='" . WT_I18N::translate('Pedigree map') . "'>" . $dataleft . "</a>" . $datamid . $dataright . "</div>\", \"" . $marker_number . "\");";
// Construct the polygon lines
if (!$hidelines) {
- $to_child = (intval(($i-1)/2)); // Draw a line from parent to child
- if (array_key_exists($to_child, $lat) && $lat[$to_child]!=0 && $lon[$to_child]!=0) {
- $js.='
+ $to_child = (intval(($i - 1) / 2)); // Draw a line from parent to child
+ if (array_key_exists($to_child, $lat) && $lat[$to_child] != 0 && $lon[$to_child] != 0) {
+ $js .= '
var linecolor;
var plines;
- var lines = [new google.maps.LatLng('.$lat[$i].','.$lon[$i].'),
- new google.maps.LatLng('.$lat[$to_child].','.$lon[$to_child].')];
- linecolor = "'.$colored_line[$curgen].'";
+ var lines = [new google.maps.LatLng('.$lat[$i] . ',' . $lon[$i] . '),
+ new google.maps.LatLng('.$lat[$to_child] . ',' . $lon[$to_child] . ')];
+ linecolor = "'.$colored_line[$curgen] . '";
plines = new google.maps.Polygon({
paths: lines,
strokeColor: linecolor,
@@ -1403,8 +1450,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
}
// Extend and fit marker bounds
- $js.='bounds.extend(point);';
- $js.='pm_map.fitBounds(bounds);';
+ $js .= 'bounds.extend(point);';
+ $js .= 'pm_map.fitBounds(bounds);';
$count++;
}
}
@@ -1412,23 +1459,23 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$latlongval[$i] = null;
}
}
- $js.='pm_map.setCenter(bounds.getCenter());'.
+ $js .= 'pm_map.setCenter(bounds.getCenter());' .
// Close the sidebar highlight when the infowindow is closed
'google.maps.event.addListener(infowindow, "closeclick", function() {
document.getElementById(lastlinkid).className = "person_box:target";
});'.
// put the assembled side_bar_html contents into the side_bar div
- 'document.getElementById("side_bar").innerHTML = side_bar_html;'.
+ 'document.getElementById("side_bar").innerHTML = side_bar_html;' .
// create the context menu div
'var contextmenu = document.createElement("div");
contextmenu.style.visibility="hidden";
- contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom in').'&nbsp;&nbsp;</div></a>"
- + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom out').'&nbsp;&nbsp;</div></a>"
- + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom in here').'</div></a>"
- + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom out here').'&nbsp;&nbsp;</div></a>"
- + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Center map here').'&nbsp;&nbsp;</div></a>";'.
+ contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom in') . '&nbsp;&nbsp;</div></a>"
+ + "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom out') . '&nbsp;&nbsp;</div></a>"
+ + "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom in here') . '</div></a>"
+ + "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Zoom out here') . '&nbsp;&nbsp;</div></a>"
+ + "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;'.WT_I18N::translate('Center map here') . '&nbsp;&nbsp;</div></a>";' .
// listen for singlerightclick
- 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {'.
+ 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {' .
// store the "pixel" info in case we need it later
// adjust the context menu location if near an egde
// create a GControlPosition
@@ -1444,15 +1491,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
});
'.
// functions that perform the context menu options
- 'function zoomIn() {'.
+ 'function zoomIn() {' .
// perform the requested operation
- 'pm_map.zoomIn();'.
+ 'pm_map.zoomIn();' .
// hide the context menu now that it has been used
'contextmenu.style.visibility="hidden";
}
function zoomOut() {'.
// perform the requested operation
- 'pm_map.zoomOut();'.
+ 'pm_map.zoomOut();' .
// hide the context menu now that it has been used
'contextmenu.style.visibility="hidden";
}
@@ -1490,15 +1537,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* ...
*/
private function adminPlaceCheck() {
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $action = WT_Filter::get('action', '','go');
+ $action = WT_Filter::get('action', '', 'go');
$gedcom_id = WT_Filter::get('gedcom_id', null, WT_GED_ID);
$country = WT_Filter::get('country', '.+', 'XYZ');
$state = WT_Filter::get('state', '.+', 'XYZ');
$matching = WT_Filter::getBool('matching');
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Google Maps™'))
@@ -1508,16 +1555,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<table id="gm_config">
<tr>
<th>
- <a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'),'</a>
+ <a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>
</th>
<th>
<a href="module.php?mod=googlemap&amp;mod_action=admin_places">
- ', WT_I18N::translate('Geographic data'),'
+ ', WT_I18N::translate('Geographic data'), '
</a>
</th>
<th>
<a class="current" href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">
- ', WT_I18N::translate('Place check'),'
+ ', WT_I18N::translate('Place check'), '
</a>
</th>
</tr>
@@ -1533,95 +1580,93 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo select_edit_control('gedcom_id', WT_Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();"');
echo '<label>', WT_I18N::translate('Country'), '</label>
<select name="country" onchange="this.form.submit();">
- <option value="XYZ" selected="selected">', /* I18N: first/default option in a drop-down listbox */ WT_I18N::translate('&lt;select&gt;'), '</option>
+ <option value="XYZ" selected>', /* I18N: first/default option in a drop-down listbox */ WT_I18N::translate('&lt;select&gt;'), '</option>
<option value="XYZ">', WT_I18N::translate('All'), '</option>';
- $rows=WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")
+ $rows = WT_DB::prepare("SELECT pl_id, pl_place FROM `##placelocation` WHERE pl_level=0 ORDER BY pl_place")
->fetchAssoc();
foreach ($rows as $id=>$place) {
- echo '<option value="', WT_Filter::escapeHtml($place), '"';
- if ($place==$country) {
- echo ' selected="selected"';
- $par_id=$id;
+ echo '<option value="', WT_Filter::escapeHtml($place), '" ';
+ if ($place == $country) {
+ echo 'selected';
+ $par_id = $id;
}
echo '>', WT_Filter::escapeHtml($place), '</option>';
}
echo '</select>';
- if ($country!='XYZ') {
+ if ($country != 'XYZ') {
echo '<label>', /* I18N: Part of a country, state/region/county */ WT_I18N::translate('Subdivision'), '</label>
<select name="state" onchange="this.form.submit();">
- <option value="XYZ" selected="selected">', WT_I18N::translate('&lt;select&gt;'), '</option>
+ <option value="XYZ" selected>', WT_I18N::translate('&lt;select&gt;'), '</option>
<option value="XYZ">', WT_I18N::translate('All'), '</option>';
- $places=WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")
+ $places = WT_DB::prepare("SELECT pl_place FROM `##placelocation` WHERE pl_parent_id=? ORDER BY pl_place")
->execute(array($par_id))
->fetchOneColumn();
foreach ($places as $place) {
- echo '<option value="', WT_Filter::escapeHtml($place), '"', $place==$state?' selected="selected"':'', '>', WT_Filter::escapeHtml($place), '</option>';
+ echo '<option value="', WT_Filter::escapeHtml($place), '" ', $place == $state ? 'selected' : '', '>', WT_Filter::escapeHtml($place), '</option>';
}
echo '</select>';
}
echo '<label>', WT_I18N::translate('Include fully matched places: '), '</label>';
- echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();"';
- if ($matching) {
- echo ' checked="checked"';
- }
+ echo '<input type="checkbox" name="matching" value="1" onchange="this.form.submit();" ';
+ echo $matching ? 'checked' : '';
echo '>';
- echo '</div>';// close div gm_check
+ echo '</div>'; // close div gm_check
echo '<input type="hidden" name="action" value="go">';
- echo '</form>';//close form placecheck
+ echo '</form>'; //close form placecheck
echo '<hr>';
switch ($action) {
case 'go':
//Identify gedcom file
- $trees=WT_Tree::getAll();
+ $trees = WT_Tree::getAll();
echo '<div id="gm_check_title">', $trees[$gedcom_id]->tree_title_html, '</div>';
//Select all '2 PLAC ' tags in the file and create array
- $place_list=array();
- $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")
+ $place_list = array();
+ $ged_data = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?")
->execute(array("%\n2 PLAC %", $gedcom_id))
->fetchOneColumn();
foreach ($ged_data as $ged_datum) {
preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
foreach ($matches[1] as $match) {
- $place_list[$match]=true;
+ $place_list[$match] = true;
}
}
- $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?")
+ $ged_data = WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?")
->execute(array("%\n2 PLAC %", $gedcom_id))
->fetchOneColumn();
foreach ($ged_data as $ged_datum) {
preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches);
foreach ($matches[1] as $match) {
- $place_list[$match]=true;
+ $place_list[$match] = true;
}
}
// Unique list of places
- $place_list=array_keys($place_list);
+ $place_list = array_keys($place_list);
// Apply_filter
- if ($country=='XYZ') {
- $filter='.*$';
+ if ($country == 'XYZ') {
+ $filter = '.*$';
} else {
- $filter=preg_quote($country).'$';
- if ($state!='XYZ') {
- $filter=preg_quote($state).', '.$filter;
+ $filter = preg_quote($country) . '$';
+ if ($state != 'XYZ') {
+ $filter = preg_quote($state) . ', ' . $filter;
}
}
- $place_list=preg_grep('/'.$filter.'/', $place_list);
+ $place_list = preg_grep('/' . $filter . '/', $place_list);
//sort the array, limit to unique values, and count them
usort($place_list, array('WT_I18N', 'strcasecmp'));
- $i=count($place_list);
+ $i = count($place_list);
//calculate maximum no. of levels to display
- $x=0;
- $max=0;
- while ($x<$i) {
- $levels=explode(",", $place_list[$x]);
- $parts=count($levels);
- if ($parts>$max) $max=$parts;
- $x++;}
- $x=0;
+ $x = 0;
+ $max = 0;
+ while ($x < $i) {
+ $levels = explode(",", $place_list[$x]);
+ $parts = count($levels);
+ if ($parts > $max) $max = $parts;
+ $x++; }
+ $x = 0;
//scripts for edit, add and refresh
?>
@@ -1639,122 +1684,122 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<?php
//start to produce the display table
- $cols=0;
- $span=$max*3+3;
+ $cols = 0;
+ $span = $max * 3 + 3;
echo '<div class="gm_check_details">';
echo '<table class="gm_check_details"><tr>';
echo '<th rowspan="3">', WT_I18N::translate('Place'), '</th>';
echo '<th colspan="', $span, '">', WT_I18N::translate('Geographic data'), '</th></tr>';
echo '<tr>';
- while ($cols<$max) {
+ while ($cols < $max) {
if ($cols == 0) {
echo '<th colspan="3">', WT_I18N::translate('Country'), '</th>';
} else {
- echo '<th colspan="3">', WT_I18N::translate('Level'), '&nbsp;', $cols+1, '</th>';
+ echo '<th colspan="3">', WT_I18N::translate('Level'), '&nbsp;', $cols + 1, '</th>';
}
$cols++;
}
echo '</tr><tr>';
- $cols=0;
- while ($cols<$max) {
+ $cols = 0;
+ while ($cols < $max) {
echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th><th>', WT_I18N::translate('Latitude'), '</th><th>', WT_I18N::translate('Longitude'), '</th>';
$cols++;
}
echo '</tr>';
- $countrows=0;
+ $countrows = 0;
$matched = array();
- while ($x<$i) {
- $placestr="";
- $levels=explode(",", $place_list[$x]);
- $parts=count($levels);
- $levels=array_reverse($levels);
- $placestr.="<a href=\"placelist.php?action=show";
+ while ($x < $i) {
+ $placestr = "";
+ $levels = explode(",", $place_list[$x]);
+ $parts = count($levels);
+ $levels = array_reverse($levels);
+ $placestr .= "<a href=\"placelist.php?action=show";
foreach ($levels as $pindex=>$ppart) {
- $ppart=urlencode(trim($ppart));
- $placestr.="&amp;parent[$pindex]=".$ppart."";
+ $ppart = urlencode(trim($ppart));
+ $placestr .= "&amp;parent[$pindex]=" . $ppart . "";
}
- $placestr.="\">".$place_list[$x]."</a>";
- $gedplace="<tr><td>".$placestr."</td>";
- $z=0;
- $id=0;
- $level=0;
- $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels
- $mapstr_edit="<a href=\"#\" onclick=\"edit_place_location('";
- $mapstr_add="<a href=\"#\" onclick=\"add_place_location('";
- $mapstr3="";
- $mapstr4="";
- $mapstr5="')\" title='";
- $mapstr6="' >";
- $mapstr7="')\">";
- $mapstr8="</a>";
+ $placestr .= "\">" . $place_list[$x] . "</a>";
+ $gedplace = "<tr><td>" . $placestr . "</td>";
+ $z = 0;
+ $id = 0;
+ $level = 0;
+ $matched[$x] = 0; // used to exclude places where the gedcom place is matched at all levels
+ $mapstr_edit = "<a href=\"#\" onclick=\"edit_place_location('";
+ $mapstr_add = "<a href=\"#\" onclick=\"add_place_location('";
+ $mapstr3 = "";
+ $mapstr4 = "";
+ $mapstr5 = "')\" title='";
+ $mapstr6 = "' >";
+ $mapstr7 = "')\">";
+ $mapstr8 = "</a>";
$plac = array();
$lati = array();
$long = array();
- while ($z<$parts) {
- if ($levels[$z]==' ' || $levels[$z]=='')
- $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , ,
+ while ($z < $parts) {
+ if ($levels[$z] == ' ' || $levels[$z] == '')
+ $levels[$z] = "unknown"; // GoogleMap module uses "unknown" while GEDCOM uses , ,
- $levels[$z]=rtrim(ltrim($levels[$z]));
+ $levels[$z] = rtrim(ltrim($levels[$z]));
- $placelist = $this->createPossiblePlaceNames($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name
+ $placelist = $this->createPossiblePlaceNames($levels[$z], $z + 1); // add the necessary prefix/postfix values to the place name
foreach ($placelist as $key=>$placename) {
- $row=
+ $row =
WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
->execute(array($z, $id, $placename))
->fetchOneRow(PDO::FETCH_ASSOC);
if (!empty($row['pl_id'])) {
- $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db
+ $row['pl_placerequested'] = $levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db
break;
}
}
- if ($row['pl_id']!='') {
- $id=$row['pl_id'];
+ if ($row['pl_id'] != '') {
+ $id = $row['pl_id'];
}
- if ($row['pl_place']!='') {
- $placestr2=$mapstr_edit.$id."&amp;level=".$level.$mapstr3.$mapstr5.WT_I18N::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8;
- if ($row['pl_place']=='unknown')
+ if ($row['pl_place'] != '') {
+ $placestr2 = $mapstr_edit . $id . "&amp;level=" . $level . $mapstr3 . $mapstr5 . WT_I18N::translate('Zoom=') . $row['pl_zoom'] . $mapstr6 . $row['pl_placerequested'] . $mapstr8;
+ if ($row['pl_place'] == 'unknown')
$matched[$x]++;
} else {
- if ($levels[$z]=="unknown") {
- $placestr2=$mapstr_add.$id."&amp;level=".$level.$mapstr3.$mapstr7."<strong>".rtrim(ltrim(WT_I18N::translate('unknown')))."</strong>".$mapstr8;$matched[$x]++;
+ if ($levels[$z] == "unknown") {
+ $placestr2 = $mapstr_add . $id . "&amp;level=" . $level . $mapstr3 . $mapstr7 . "<strong>" . rtrim(ltrim(WT_I18N::translate('unknown'))) . "</strong>" . $mapstr8; $matched[$x]++;
} else {
- $placestr2=$mapstr_add.$id."&amp;place_name=".urlencode($levels[$z])."&amp;level=".$level.$mapstr3.$mapstr7.'<span class="error">'.rtrim(ltrim($levels[$z])).'</span>'.$mapstr8;$matched[$x]++;
+ $placestr2 = $mapstr_add . $id . "&amp;place_name=" . urlencode($levels[$z]) . "&amp;level=" . $level . $mapstr3 . $mapstr7 . '<span class="error">' . rtrim(ltrim($levels[$z])) . '</span>' . $mapstr8; $matched[$x]++;
}
}
- $plac[$z]="<td>".$placestr2."</td>\n";
- if ($row['pl_lati']=='0') {
- $lati[$z]="<td class='error'><strong>".$row['pl_lati']."</strong></td>";
- } elseif ($row['pl_lati']!='') {
- $lati[$z]="<td>".$row['pl_lati']."</td>";
+ $plac[$z] = "<td>" . $placestr2 . "</td>\n";
+ if ($row['pl_lati'] == '0') {
+ $lati[$z] = "<td class='error'><strong>" . $row['pl_lati'] . "</strong></td>";
+ } elseif ($row['pl_lati'] != '') {
+ $lati[$z] = "<td>" . $row['pl_lati'] . "</td>";
} else {
- $lati[$z]="<td class='error center'><strong>X</strong></td>";$matched[$x]++;
+ $lati[$z] = "<td class='error center'><strong>X</strong></td>"; $matched[$x]++;
}
- if ($row['pl_long']=='0') {
- $long[$z]="<td class='error'><strong>".$row['pl_long']."</strong></td>";
- } elseif ($row['pl_long']!='') {
- $long[$z]="<td>".$row['pl_long']."</td>";
+ if ($row['pl_long'] == '0') {
+ $long[$z] = "<td class='error'><strong>" . $row['pl_long'] . "</strong></td>";
+ } elseif ($row['pl_long'] != '') {
+ $long[$z] = "<td>" . $row['pl_long'] . "</td>";
} else {
- $long[$z]="<td class='error center'><strong>X</strong></td>";$matched[$x]++;
+ $long[$z] = "<td class='error center'><strong>X</strong></td>"; $matched[$x]++;
}
$level++;
- $mapstr3=$mapstr3."&amp;parent[".$z."]=".WT_Filter::escapeJs($row['pl_placerequested']);
- $mapstr4=$mapstr4."&amp;parent[".$z."]=".WT_Filter::escapeJs($levels[$z]);
+ $mapstr3 = $mapstr3 . "&amp;parent[" . $z . "]=" . WT_Filter::escapeJs($row['pl_placerequested']);
+ $mapstr4 = $mapstr4 . "&amp;parent[" . $z . "]=" . WT_Filter::escapeJs($levels[$z]);
$z++;
}
if ($matching) {
- $matched[$x]=1;
+ $matched[$x] = 1;
}
- if ($matched[$x]!=0) {
+ if ($matched[$x] != 0) {
echo $gedplace;
- $z=0;
- while ($z<$max) {
- if ($z<$parts) {
+ $z = 0;
+ while ($z < $max) {
+ if ($z < $parts) {
echo $plac[$z];
echo $lati[$z];
echo $long[$z];
} else {
- echo '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';
+ echo '<td></td><td></td><td></td>';
}
$z++;
}
@@ -1929,14 +1974,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
if ($ctla && $ctlo) {
$i++;
- $gmarks[$i]=array(
+ $gmarks[$i] = array(
'class' => 'optionbox',
'date' => $fact->getDate()->display(true),
'fact_label' => $fact->getLabel(),
- 'image' => $spouse ? $spouse->displayImage() : $fact->icon(),
+ 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact),
'info' => $fact->getValue(),
- 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.') , $match1[1]),
- 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.') , $match2[1]),
+ 'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]),
+ 'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]),
'name' => $spouse ? '<a href="' . $spouse->getHtmlUrl() . '"' . $spouse->getFullName() . '</a>' : '',
'pl_icon' => '',
'place' => $fact->getPlace()->getFullName(),
@@ -1955,7 +2000,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
'class' => 'optionbox',
'date' => $fact->getDate()->display(true),
'fact_label' => $fact->getLabel(),
- 'image' => $spouse ? $spouse->displayImage() : $fact->icon(),
+ 'image' => $spouse ? $spouse->displayImage() : Theme::theme()->icon($fact),
'info' => $fact->getValue(),
'lat' => str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval->pl_lati),
'lng' => str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval->pl_long),
@@ -1989,7 +2034,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$ctlo = preg_match('/\n4 LONG (.+)/', $birthrec, $match2);
if ($ctla && $ctlo) {
$i++;
- $gmarks[$i]=array(
+ $gmarks[$i] = array(
'date' => $birth->getDate()->display(true),
'image' => $child->displayImage(),
'info' => '',
@@ -2327,24 +2372,24 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// Add the markers to the map from the $gmarks array
var locations = [
- <?php foreach($gmarks as $n=>$gmark) { ?>
+ <?php foreach ($gmarks as $n=>$gmark) { ?>
<?php echo $n ? ',' : ''; ?>
{
- "event": "<?php echo WT_Filter::escapeJs($gmark['fact_label'] ); ?>",
- "lat": "<?php echo WT_Filter::escapeJs($gmark['lat'] ); ?>",
- "lng": "<?php echo WT_Filter::escapeJs($gmark['lng'] ); ?>",
- "date": "<?php echo WT_Filter::escapeJs($gmark['date'] ); ?>",
- "info": "<?php echo WT_Filter::escapeJs($gmark['info'] ); ?>",
- "name": "<?php echo WT_Filter::escapeJs($gmark['name'] ); ?>",
- "place": "<?php echo WT_Filter::escapeJs($gmark['place'] ); ?>",
- "tooltip": "<?php echo WT_Filter::escapeJs($gmark['tooltip'] ); ?>",
- "image": "<?php echo WT_Filter::escapeJs($gmark['image'] ); ?>",
- "pl_icon": "<?php echo WT_Filter::escapeJs($gmark['pl_icon'] ); ?>",
- "sv_lati": "<?php echo WT_Filter::escapeJs($gmark['sv_lati'] ); ?>",
- "sv_long": "<?php echo WT_Filter::escapeJs($gmark['sv_long'] ); ?>",
- "sv_bearing": "<?php echo WT_Filter::escapeJs($gmark['sv_bearing'] ); ?>",
+ "event": "<?php echo WT_Filter::escapeJs($gmark['fact_label']); ?>",
+ "lat": "<?php echo WT_Filter::escapeJs($gmark['lat']); ?>",
+ "lng": "<?php echo WT_Filter::escapeJs($gmark['lng']); ?>",
+ "date": "<?php echo WT_Filter::escapeJs($gmark['date']); ?>",
+ "info": "<?php echo WT_Filter::escapeJs($gmark['info']); ?>",
+ "name": "<?php echo WT_Filter::escapeJs($gmark['name']); ?>",
+ "place": "<?php echo WT_Filter::escapeJs($gmark['place']); ?>",
+ "tooltip": "<?php echo WT_Filter::escapeJs($gmark['tooltip']); ?>",
+ "image": "<?php echo WT_Filter::escapeJs($gmark['image']); ?>",
+ "pl_icon": "<?php echo WT_Filter::escapeJs($gmark['pl_icon']); ?>",
+ "sv_lati": "<?php echo WT_Filter::escapeJs($gmark['sv_lati']); ?>",
+ "sv_long": "<?php echo WT_Filter::escapeJs($gmark['sv_long']); ?>",
+ "sv_bearing": "<?php echo WT_Filter::escapeJs($gmark['sv_bearing']); ?>",
"sv_elevation": "<?php echo WT_Filter::escapeJs($gmark['sv_elevation']); ?>",
- "sv_zoom": "<?php echo WT_Filter::escapeJs($gmark['sv_zoom'] ); ?>"
+ "sv_zoom": "<?php echo WT_Filter::escapeJs($gmark['sv_zoom']); ?>"
}
<?php } ?>
];
@@ -2478,6 +2523,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$par = explode(',', strip_tags($place));
$par = array_reverse($par);
$place_id = 0;
+ $pl_id = 0;
+
for ($i = 0; $i < count($par); $i++) {
$par[$i] = trim($par[$i]);
if (empty($par[$i])) {
@@ -2485,14 +2532,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
foreach ($placelist as $key => $placename) {
- $pl_id = WT_DB::prepare(
- "SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place"
- )->execute(array($i, $place_id, $placename))->fetchOne();
- if (!empty($pl_id)) {
+ $pl_id = (int) WT_DB::prepare(
+ "SELECT pl_id FROM `##placelocation` WHERE pl_level = :level AND pl_parent_id = :parent_id AND pl_place LIKE :placename"
+ )->execute(array(
+ 'level' => $i,
+ 'parent_id' => $place_id,
+ 'placename' => $placename,
+ ))->fetchOne();
+ if ($pl_id) {
break;
}
}
- if (empty($pl_id)) {
+ if (!$pl_id) {
break;
}
$place_id = $pl_id;
@@ -2510,18 +2561,24 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$par = explode(',', $place);
$par = array_reverse($par);
$place_id = 0;
+ $pl_id = 0;
+
for ($i = 0; $i < count($par); $i++) {
$par[$i] = trim($par[$i]);
$placelist = $this->createPossiblePlaceNames($par[$i], $i + 1);
- foreach ($placelist as $key => $placename) {
- $pl_id = WT_DB::prepare(
- "SELECT p_id FROM `##places` WHERE p_parent_id=? AND p_file=? AND p_place LIKE ? ORDER BY p_place"
- )->execute(array($place_id, WT_GED_ID, $placename))->fetchOne();
- if (!empty($pl_id)) {
+ foreach ($placelist as $placename) {
+ $pl_id = (int) WT_DB::prepare(
+ "SELECT p_id FROM `##places` WHERE p_parent_id = :place_id AND p_file = :tree_id AND p_place = :placename"
+ )->execute(array(
+ 'place_id' => $place_id,
+ 'tree_id' => WT_GED_ID,
+ 'placename' => $placename,
+ ))->fetchOne();
+ if ($pl_id) {
break;
}
}
- if (empty($pl_id)) {
+ if (!$pl_id) {
break;
}
$place_id = $pl_id;
@@ -2596,7 +2653,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")
->execute(array($levelm))
->fetch(PDO::FETCH_ASSOC);
- if ($STREETVIEW && $level!=0 ) {
+ if ($STREETVIEW && $level != 0) {
echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; ';
} else {
echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; ';
@@ -2605,33 +2662,33 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '</td>';
echo '<script src="', $this->googleMapsScript(), '"></script>';
- $plzoom = $latlng['pl_zoom']; // Map zoom level
+ $plzoom = $latlng['pl_zoom']; // Map zoom level
if (Auth::isAdmin()) {
$placecheck_url = 'module.php?mod=googlemap&amp;mod_action=admin_placecheck';
- if ($parent && isset($parent[0]) ) {
- $placecheck_url .= '&amp;country='.$parent[0];
+ if ($parent && isset($parent[0])) {
+ $placecheck_url .= '&amp;country=' . $parent[0];
if (isset($parent[1])) {
- $placecheck_url .= '&amp;state='.$parent[1];
+ $placecheck_url .= '&amp;state=' . $parent[1];
}
}
$adminplaces_url = 'module.php?mod=googlemap&amp;mod_action=admin_places';
if ($latlng && isset($latlng['pl_id'])) {
- $adminplaces_url .= '&amp;parent='.$latlng['pl_id'];
+ $adminplaces_url .= '&amp;parent=' . $latlng['pl_id'];
}
echo '</tr><tr><td>';
echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>';
echo '&nbsp;|&nbsp;';
- echo '<a href="'.$adminplaces_url.'">', WT_I18N::translate('Geographic data'), '</a>';
+ echo '<a href="' . $adminplaces_url . '">', WT_I18N::translate('Geographic data'), '</a>';
echo '&nbsp;|&nbsp;';
- echo '<a href="'.$placecheck_url.'">', WT_I18N::translate('Place check'), '</a>';
+ echo '<a href="' . $placecheck_url . '">', WT_I18N::translate('Place check'), '</a>';
if (array_key_exists('batch_update', WT_Module::getActiveModules())) {
- $placelevels=preg_replace('/, '.WT_I18N::translate('unknown').'/', ', ', $placelevels); // replace ", unknown" with ", "
- $placelevels=substr($placelevels, 2); // remove the leading ", "
+ $placelevels = preg_replace('/, ' . WT_I18N::translate('unknown') . '/', ', ', $placelevels); // replace ", unknown" with ", "
+ $placelevels = substr($placelevels, 2); // remove the leading ", "
if ($placelevels) {
- $batchupdate_url='module.php?mod=batch_update&amp;mod_action=admin_batch_update&amp;plugin=search_replace_bu_plugin&amp;method=exact&amp;ged='.WT_GEDCOM.'&amp;search='.urlencode($placelevels); // exact match
+ $batchupdate_url = 'module.php?mod=batch_update&amp;mod_action=admin_batch_update&amp;plugin=search_replace_bu_plugin&amp;method=exact&amp;ged=' . WT_GEDCOM . '&amp;search=' . urlencode($placelevels); // exact match
echo '&nbsp;|&nbsp;';
- echo '<a href="'.$batchupdate_url.'">', WT_I18N::translate('Batch update'), '</a>';
+ echo '<a href="' . $batchupdate_url . '">', WT_I18N::translate('Batch update'), '</a>';
}
}
}
@@ -2653,32 +2710,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
');
global $pl_lati, $pl_long;
- if ($level>=1) {
- $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati
- $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long
+ if ($level >= 1) {
+ $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati
+ $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long
// Check if Streetview location parameters are stored in database
- $placeid = $latlng['pl_id']; // Placelocation place id
- $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude
- $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude
- $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North)
- $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
- $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3)
+ $placeid = $latlng['pl_id']; // Placelocation place id
+ $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude
+ $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude
+ $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North)
+ $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up)
+ $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3)
// Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------
- if (($latlng['sv_lati']==null && $latlng['sv_long']==null) || ($latlng['sv_lati']==0 && $latlng['sv_long']==0)) {
+ if (($latlng['sv_lati'] == null && $latlng['sv_long'] == null) || ($latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0)) {
$sv_lat = $pl_lati;
$sv_lng = $pl_long;
}
// Set Street View parameters to numeric value if NULL (avoids problem with Google Street View™ Pane not rendering)
- if ($sv_dir==null) {
- $sv_dir=0;
+ if ($sv_dir == null) {
+ $sv_dir = 0;
}
- if ($sv_pitch==null) {
- $sv_pitch=0;
+ if ($sv_pitch == null) {
+ $sv_pitch = 0;
}
- if ($sv_zoom==null) {
- $sv_zoom=1;
+ if ($sv_zoom == null) {
+ $sv_zoom = 1;
}
?>
@@ -2688,11 +2745,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<?php
$list_latlon = (
- WT_Gedcom_Tag::getLabel('LATI')."<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lat."'>".
- WT_Gedcom_Tag::getLabel('LONG')."<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='".$sv_lng."'>".
- /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing')."<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='".$sv_dir."'>".
- /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation')."<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='".$sv_pitch."'>".
- WT_I18N::translate('Zoom')."<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='".$sv_zoom."'>
+ WT_Gedcom_Tag::getLabel('LATI') . "<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lat . "'>" .
+ WT_Gedcom_Tag::getLabel('LONG') . "<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lng . "'>" .
+ /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing') . "<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='" . $sv_dir . "'>" .
+ /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation') . "<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_pitch . "'>" .
+ WT_I18N::translate('Zoom') . "<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_zoom . "'>
");
if (Auth::isAdmin()) {
echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">";
@@ -2763,8 +2820,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* @param string $placelevels
* @param boolean $lastlevel
*/
- private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel=false) {
- if (($place2['lati'] == NULL) || ($place2['long'] == NULL) || (($place2['lati'] == '0') && ($place2['long'] == '0'))) {
+ private function printGoogleMapMarkers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel = false) {
+ if (($place2['lati'] == null) || ($place2['long'] == null) || (($place2['lati'] == '0') && ($place2['long'] == '0'))) {
echo 'var icon_type = new google.maps.MarkerImage();';
echo 'icon_type.image = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png";';
echo 'icon_type.shadow = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png";';
@@ -2778,7 +2835,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($place2['place'] == "Unknown") echo "'><br>";
else echo addslashes($place2['place']), "'><br>";
}
- if (($place2['icon'] != NULL) && ($place2['icon'] != '')) {
+ if (($place2['icon'] !== null) && ($place2['icon'] !== '')) {
echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\">&nbsp;&nbsp;';
}
if ($lastlevel) {
@@ -2798,13 +2855,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
} else {
if ($place2['place'] == 'Unknown') {
if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes(WT_I18N::translate('unknown').$placelevels);
+ echo addslashes(WT_I18N::translate('unknown') . $placelevels);
} else {
echo WT_I18N::translate('unknown');
}
} else {
if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes($place2['place'].$placelevels);
+ echo addslashes($place2['place'] . $placelevels);
} else {
echo addslashes($place2['place']);
}
@@ -2814,8 +2871,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($lastlevel) {
$this->printHowManyPeople($level, $parent);
} else {
- $parent[$level]=$place2['place'];
- $this->printHowManyPeople($level+1, $parent);
+ $parent[$level] = $place2['place'];
+ $this->printHowManyPeople($level + 1, $parent);
}
echo '<br>', WT_I18N::translate('This place has no coordinates');
if (Auth::isAdmin())
@@ -2828,64 +2885,59 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($lati >= 0) {
$lati = abs($lati);
} elseif ($lati < 0) {
- $lati = '-'.abs($lati);
+ $lati = '-' . abs($lati);
}
if ($long >= 0) {
$long = abs($long);
} elseif ($long < 0) {
- $long = '-'.abs($long);
+ $long = '-' . abs($long);
}
- // flags by kiwi3685 ---
- if (($place2['icon'] == NULL) || ($place2['icon'] == '') || ($this->getSetting('GM_PH_MARKER') != 'G_FLAG')) {
- echo 'var icon_type = new google.maps.MarkerImage();';
- } else {
- echo 'var icon_type = new google.maps.MarkerImage();';
+ echo 'var icon_type = new google.maps.MarkerImage();';
+ if ($place2['icon'] !== null && $place2['icon'] !== '' && $this->getSetting('GM_PH_MARKER') === 'G_FLAG') {
echo ' icon_type.image = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '";';
echo ' icon_type.shadow = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png";';
echo ' icon_type.iconSize = new google.maps.Size(25, 15);';
echo ' icon_type.shadowSize = new google.maps.Size(35, 45);';
}
- echo "var point = new google.maps.LatLng({$lati}, {$long});";
- if ($lastlevel) {
- echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?action=find", $linklevels, "'><br>";
- } else {
- echo "var marker = createMarker(point, \"<div class='iwstyle' style='width: 250px;'><a href='?action=find", $linklevels, "&amp;parent[{$level}]=";
- if ($place2['place'] == 'Unknown') {
- echo "'><br>";
- } else {
- echo addslashes($place2['place']), "'><br>";
+ echo 'var point = new google.maps.LatLng(', $lati, ', ', $long, ');';
+ echo 'var marker = createMarker(point, "<div class=\"iwstyle\" style=\"width: 250px;\"><a href=\"?action=find', $linklevels;
+ if (!$lastlevel) {
+ echo '&amp;parent[', $level, ']=';
+ if ($place2['place'] !== 'Unknown') {
+ echo WT_Filter::escapeJs($place2['place']);
}
}
- if (($place2['icon'] != NULL) && ($place2['icon'] != "")) {
+ echo '\"><br>';
+ if ($place2['icon'] !== null && $place2['icon'] !== '') {
echo '<img src=\"', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '\">&nbsp;&nbsp;';
}
if ($lastlevel) {
- if ($place2['place'] == 'Unknown') {
- if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes(substr($placelevels, 2));
- } else {
+ if ($place2['place'] === 'Unknown') {
+ if ($this->getSetting('GM_DISP_SHORT_PLACE')) {
echo WT_I18N::translate('unknown');
+ } else {
+ echo WT_Filter::escapeJs(substr($placelevels, 2));
}
} else {
- if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes(substr($placelevels, 2));
+ if ($this->getSetting('GM_DISP_SHORT_PLACE')) {
+ echo WT_Filter::escapeJs($place2['place']);
} else {
- echo addslashes($place2['place']);
+ echo WT_Filter::escapeJs(substr($placelevels, 2));
}
}
} else {
- if ($place2['place'] == 'Unknown') {
- if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes(WT_I18N::translate('unknown').$placelevels);
- } else {
+ if ($place2['place'] === 'Unknown') {
+ if ($this->getSetting('GM_DISP_SHORT_PLACE')) {
echo WT_I18N::translate('unknown');
+ } else {
+ echo WT_Filter::escapeJs(WT_I18N::translate('unknown') . $placelevels);
}
} else {
- if (!$this->getSetting('GM_DISP_SHORT_PLACE')) {
- echo addslashes($place2['place'].$placelevels);
+ if ($this->getSetting('GM_DISP_SHORT_PLACE')) {
+ echo WT_Filter::escapeJs($place2['place']);
} else {
- echo addslashes($place2['place']);
+ echo WT_Filter::escapeJs($place2['place'] . $placelevels);
}
}
}
@@ -2893,16 +2945,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($lastlevel) {
$this->printHowManyPeople($level, $parent);
} else {
- $parent[$level]=$place2['place'];
- $this->printHowManyPeople($level+1, $parent);
+ $parent[$level] = $place2['place'];
+ $this->printHowManyPeople($level + 1, $parent);
}
- $temp=addslashes($place2['place']);
- $temp=str_replace(array('&lrm;', '&rlm;'), array(WT_UTF8_LRM, WT_UTF8_RLM), $temp);
- if (!$this->getSetting('GM_COORD')) {
- echo "<br><br></div>\", icon_type, \"", $temp, "\");";
- } else {
- echo "<br><br>", $place2['lati'], ", ", $place2['long'], "</div>\", icon_type, \"", $temp, "\");";
+ echo '<br><br>';
+ if ($this->getSetting('GM_COORD')) {
+ echo '', $place2['lati'], ', ', $place2['long'];
}
+ echo '</div>", icon_type, "', WT_Filter::escapeJs($place2['place']), '");';
}
}
@@ -2969,13 +3019,13 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// Creates a marker whose info window displays the given name
function createMarker(point, html, icon, name) {
// Choose icon and shadow ============
- if (icon.image && '.$level.'<=3) {
- if (icon.image!="'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/marker_yellow.png") {
+ if (icon.image && '.$level . '<=3) {
+ if (icon.image!="'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/marker_yellow.png") {
var iconImage = new google.maps.MarkerImage(icon.image,
new google.maps.Size(25, 15),
new google.maps.Point(0,0),
new google.maps.Point(1, 45));
- var iconShadow = new google.maps.MarkerImage("'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/flag_shadow.png",
+ var iconShadow = new google.maps.MarkerImage("'.WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/flag_shadow.png",
new google.maps.Size(35, 45),
new google.maps.Point(0,0),
new google.maps.Point(1, 45));
@@ -3042,21 +3092,21 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
');
$levelm = $this->setLevelMap($level, $parent);
- if (isset($levelo[0])) $levelo[0]=0;
- $numls = count($parent)-1;
+ if (isset($levelo[0])) $levelo[0] = 0;
+ $numls = count($parent) - 1;
$levelo = $this->checkWhereAmI($numls, $levelm);
- if ($numfound<2 && ($level==1 || !isset($levelo[$level-1]))) {
+ if ($numfound < 2 && ($level == 1 || !isset($levelo[$level - 1]))) {
$controller->addInlineJavascript('map.maxZoom=6;');
- } elseif ($numfound<2 && !isset($levelo[$level-2])) {
- } elseif ($level==2) {
+ } elseif ($numfound < 2 && !isset($levelo[$level - 2])) {
+ } elseif ($level == 2) {
$controller->addInlineJavascript('map.maxZoom=10;');
}
//create markers
ob_start(); // TODO: rewrite print_gm_markers, and the functions called therein, to either return text or add JS directly.
- if ($numfound==0 && $level>0) {
- if (isset($levelo[($level-1)])) { // ** BH not sure yet what this if statement is for ... TODO **
+ if ($numfound == 0 && $level > 0) {
+ if (isset($levelo[($level - 1)])) { // ** BH not sure yet what this if statement is for ... TODO **
// show the current place on the map
$place = WT_DB::prepare("SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id=?")
@@ -3067,10 +3117,10 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// re-calculate the hierarchy information required to display the current place
$thisloc = $parent;
array_pop($thisloc);
- $thislevel = $level-1 ;
- $thislinklevels = substr($linklevels,0,strrpos($linklevels,'&amp;'));
- if (strpos($placelevels,',',1)) {
- $thisplacelevels = substr($placelevels,strpos($placelevels,',',1));
+ $thislevel = $level - 1;
+ $thislinklevels = substr($linklevels, 0, strrpos($linklevels, '&amp;'));
+ if (strpos($placelevels, ',', 1)) {
+ $thisplacelevels = substr($placelevels, strpos($placelevels, ',', 1));
} else {
// this is the top level, remove everything
$thisplacelevels = '';
@@ -3082,27 +3132,29 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
// display any sub-places
- $placeidlist=array();
+ $placeidlist = array();
foreach ($place_names as $placename) {
$thisloc = $parent;
$thisloc[] = $placename;
- $this_levelm = $this->setLevelMap($level+1, $thisloc);
+ $this_levelm = $this->setLevelMap($level + 1, $thisloc);
if ($this_levelm) $placeidlist[] = $this_levelm;
}
if ($placeidlist) {
// flip the array (thus removing duplicates)
- $placeidlist=array_flip($placeidlist);
+ $placeidlist = array_flip($placeidlist);
// remove entry for parent location
unset($placeidlist[$levelm]);
}
if ($placeidlist) {
// the keys are all we care about (this reverses the earlier array_flip, and ensures there are no "holes" in the array)
- $placeidlist=array_keys($placeidlist);
+ $placeidlist = array_keys($placeidlist);
// note: this implode/array_fill code generates one '?' for each entry in the $placeidlist array
$placelist =
- WT_DB::prepare('SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon FROM `##placelocation` WHERE pl_id IN ('.implode(',', array_fill(0, count($placeidlist), '?')).')')
- ->execute($placeidlist)
+ WT_DB::prepare(
+ "SELECT pl_id as place_id, pl_place as place, pl_lati as lati, pl_long as `long`, pl_zoom as zoom, pl_icon as icon" .
+ " FROM `##placelocation` WHERE pl_id IN (" . implode(',', array_fill(0, count($placeidlist), '?')) . ')'
+ )->execute($placeidlist)
->fetchAll(PDO::FETCH_ASSOC);
foreach ($placelist as $place) {
@@ -3139,14 +3191,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* @return int
*/
private function getHighestIndex() {
- return (int)WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne();
+ return (int) WT_DB::prepare("SELECT MAX(pl_id) FROM `##placelocation`")->fetchOne();
}
/**
* @return int
*/
private function getHighestLevel() {
- return (int)WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne();
+ return (int) WT_DB::prepare("SELECT MAX(pl_level) FROM `##placelocation`")->fetchOne();
}
/**
@@ -3170,9 +3222,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
))->fetchAll();
} else {
$rows = WT_DB::prepare(
- "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon".
- " FROM `##placelocation`".
- " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place".
+ "SELECT DISTINCT pl_id, pl_place, pl_lati, pl_long, pl_zoom, pl_icon" .
+ " FROM `##placelocation`" .
+ " INNER JOIN `##places` ON `##placelocation`.pl_place=`##places`.p_place" .
" WHERE pl_parent_id = :parent_id" .
" ORDER BY pl_place COLLATE :collation"
)->execute(array(
@@ -3234,7 +3286,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if (file_exists($path)) {
$dir = dir($path);
while (false !== ($entry = $dir->read())) {
- if ($entry != '.' && $entry != '..' && $entry != '.svn') {
+ if ($entry !== '.' && $entry !== '..') {
if (is_dir($path . '/' . $entry)) {
$this->findFiles($path . '/' . $entry);
} elseif (strstr($entry, '.csv') !== false) {
@@ -3250,32 +3302,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* ...
*/
private function placesEdit() {
- require WT_ROOT.'includes/functions/functions_edit.php';
+ require WT_ROOT . 'includes/functions/functions_edit.php';
$GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
- $action = WT_Filter::post('action', null, WT_Filter::get('action'));
- $placeid = WT_Filter::post('placeid', null, WT_Filter::get('placeid'));
+ $action = WT_Filter::post('action', null, WT_Filter::get('action'));
+ $placeid = WT_Filter::post('placeid', null, WT_Filter::get('placeid'));
$place_name = WT_Filter::post('place_name', null, WT_Filter::get('place_name'));
- $controller = new WT_Controller_Simple();
+ $controller = new WT_Controller_Simple;
$controller
->restrictAccess(Auth::isAdmin())
->setPageTitle(WT_I18N::translate('Geographic data'))
->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");')
->pageHeader();
- $where_am_i=$this->placeIdToHierarchy($placeid);
- $level=count($where_am_i);
+ $where_am_i = $this->placeIdToHierarchy($placeid);
+ $level = count($where_am_i);
- if ($action=='addrecord' && Auth::isAdmin()) {
- $statement=
+ if ($action == 'addrecord' && Auth::isAdmin()) {
+ $statement =
WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) {
- $statement->execute(array($this->getHighestIndex()+1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
+ $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
} else {
- $statement->execute(array($this->getHighestIndex()+1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
+ $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
}
// autoclose window when update successful unless debug on
@@ -3286,14 +3338,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
exit;
}
- if ($action=='updaterecord' && Auth::isAdmin()) {
- $statement=
+ if ($action == 'updaterecord' && Auth::isAdmin()) {
+ $statement =
WT_DB::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
if (($_POST['LONG_CONTROL'] == '') || ($_POST['NEW_PLACE_LONG'] == '') || ($_POST['NEW_PLACE_LATI'] == '')) {
$statement->execute(array($_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
} else {
- $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3].$_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3].$_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
+ $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
}
// autoclose window when update successful unless debug on
@@ -3321,16 +3373,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
exit;
}
- if ($action=="update") {
+ if ($action == "update") {
// --- find the place in the file
- $row=
+ $row =
WT_DB::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?")
->execute(array($placeid))
->fetchOneRow();
$place_name = $row->pl_place;
$place_icon = $row->pl_icon;
$selected_country = explode("/", $place_icon);
- if (isset($selected_country[1]) && $selected_country[1]!="flags")
+ if (isset($selected_country[1]) && $selected_country[1] != "flags")
$selected_country = $selected_country[1];
else
$selected_country = "Countries";
@@ -3339,9 +3391,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$zoomfactor = $row->pl_zoom;
$parent_lati = "0.0";
$parent_long = "0.0";
- if ($row->pl_lati!==null && $row->pl_long!==null) {
- $place_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati));
- $place_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long));
+ if ($row->pl_lati !== null && $row->pl_long !== null) {
+ $place_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati));
+ $place_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long));
} else {
$place_lati = null;
$place_long = null;
@@ -3349,57 +3401,57 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
do {
- $row=
+ $row =
WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?")
->execute(array($parent_id))
->fetchOneRow();
if (!$row) {
break;
}
- if ($row->pl_lati!==null && $row->pl_long!==null) {
- $parent_lati = (float)(str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati));
- $parent_long = (float)(str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long));
+ if ($row->pl_lati !== null && $row->pl_long !== null) {
+ $parent_lati = (float) (str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati));
+ $parent_long = (float) (str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long));
if ($zoomfactor == 1) {
$zoomfactor = $row->pl_zoom;
}
}
$parent_id = $row->pl_parent_id;
}
- while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null);
+ while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
echo '<b>', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
}
- if ($action=='add') {
+ if ($action == 'add') {
// --- find the parent place in the file
if ($placeid != 0) {
- if (!isset($place_name)) $place_name = '';
+ if (!isset($place_name)) $place_name = '';
$place_lati = null;
$place_long = null;
$zoomfactor = 1;
$parent_lati = '0.0';
$parent_long = '0.0';
$place_icon = '';
- $parent_id=$placeid;
+ $parent_id = $placeid;
do {
- $row=
+ $row =
WT_DB::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?")
->execute(array($parent_id))
->fetchOneRow();
- if ($row->pl_lati!==null && $row->pl_long!==null) {
- $parent_lati=str_replace(array('N', 'S', ','), array('', '-', '.') , $row->pl_lati);
- $parent_long=str_replace(array('E', 'W', ','), array('', '-', '.') , $row->pl_long);
- $zoomfactor=$row->pl_zoom;
- if ($zoomfactor>$GM_MAX_ZOOM) {
- $zoomfactor=$GM_MAX_ZOOM;
+ if ($row->pl_lati !== null && $row->pl_long !== null) {
+ $parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
+ $parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
+ $zoomfactor = $row->pl_zoom;
+ if ($zoomfactor > $GM_MAX_ZOOM) {
+ $zoomfactor = $GM_MAX_ZOOM;
}
- $level=$row->pl_level+1;
+ $level = $row->pl_level + 1;
}
$parent_id = $row->pl_parent_id;
- } while ($row->pl_parent_id!=0 && $row->pl_lati===null && $row->pl_long===null);
+ } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
}
else {
- if (!isset($place_name)) $place_name = '';
+ if (!isset($place_name)) $place_name = '';
$place_lati = null;
$place_long = null;
$parent_lati = "0.0";
@@ -3411,9 +3463,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
$selected_country = 'Countries';
- if (!isset($place_name) || $place_name=="") echo '<b>', WT_I18N::translate('unknown');
+ if (!isset($place_name) || $place_name == "") echo '<b>', WT_I18N::translate('unknown');
else echo '<b>', $place_name;
- if (count($where_am_i)>0)
+ if (count($where_am_i) > 0)
echo ', ', WT_Filter::escapeHtml(str_replace('Unknown', WT_I18N::translate('unknown'), implode(WT_I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
echo '</b><br>';
}
@@ -3738,15 +3790,15 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
// Create the Main Location Marker
<?php
if ($level < 3 && $place_icon != '') {
- echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/',$place_icon,'",';
- echo 'new google.maps.Size(25, 15),'; // Image size
- echo 'new google.maps.Point(0, 0),'; // Image origin
- echo 'new google.maps.Point(0, 44)'; // Image anchor
+ echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon, '",';
+ echo 'new google.maps.Size(25, 15),'; // Image size
+ echo 'new google.maps.Point(0, 0),'; // Image origin
+ echo 'new google.maps.Point(0, 44)'; // Image anchor
echo ');';
echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",';
- echo 'new google.maps.Size(35, 45),'; // Shadow size
- echo 'new google.maps.Point(0,0),'; // Shadow origin
- echo 'new google.maps.Point(1, 45)'; // Shadow anchor is base of flagpole
+ echo 'new google.maps.Size(35, 45),'; // Shadow size
+ echo 'new google.maps.Point(0,0),'; // Shadow origin
+ echo 'new google.maps.Point(1, 45)'; // Shadow anchor is base of flagpole
echo ');';
echo 'marker = new google.maps.Marker({';
echo 'icon: image,';
@@ -3844,14 +3896,14 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
var contentString = '<div id="iwcontent_edit">'+name+'<\/div>';
<?php
echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png",';
- echo 'new google.maps.Size(20, 34),'; // Image size
- echo 'new google.maps.Point(0, 0),'; // Image origin
- echo 'new google.maps.Point(10, 34)'; // Image anchor
+ echo 'new google.maps.Size(20, 34),'; // Image size
+ echo 'new google.maps.Point(0, 0),'; // Image origin
+ echo 'new google.maps.Point(10, 34)'; // Image anchor
echo ');';
echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png",';
- echo 'new google.maps.Size(37, 34),'; // Shadow size
- echo 'new google.maps.Point(0, 0),'; // Shadow origin
- echo 'new google.maps.Point(10, 34)'; // Shadow anchor is base of image
+ echo 'new google.maps.Size(37, 34),'; // Shadow size
+ echo 'new google.maps.Point(0, 0),'; // Shadow origin
+ echo 'new google.maps.Point(10, 34)'; // Shadow anchor is base of image
echo ');';
?>
var marker = new google.maps.Marker({
@@ -3928,7 +3980,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
function showLocation_level(address) {
- address += '<?php if ($level>0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))); ?>';
+ address += '<?php if ($level > 0) echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true))); ?>';
geocoder.geocode({'address': address}, addAddressToMap);
}
@@ -3972,7 +4024,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
</td>
</tr>
<tr>
- <td class="descriptionbox"><?php echo WT_I18N::translate('Precision'), help_link('PLE_PRECISION','googlemap'); ?></td>
+ <td class="descriptionbox">
+ <?php echo WT_I18N::translate('Precision'); ?>
+ </td>
<?php
$exp = explode(".", $place_lati);
if (isset($exp[1])) {
@@ -3987,24 +4041,27 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$precision2 = -1;
}
($precision1 > $precision2) ? ($precision = $precision1) : ($precision = $precision2);
- if ($precision == -1 ) ($level > 3) ? ($precision = 3) : ($precision = $level);
+ if ($precision == -1) ($level > 3) ? ($precision = 3) : ($precision = $level);
elseif ($precision > 5) {
$precision = 5;
}
?>
<td class="optionbox" colspan="2">
- <input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_0')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>">
+ <input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_0')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_0'); ?>">
<label for="new_prec_0"><?php echo WT_I18N::translate('Country'); ?></label>
- <input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_1')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>">
+ <input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_1')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_1'); ?>">
<label for="new_prec_1"><?php echo WT_I18N::translate('State'); ?></label>
- <input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_2')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>">
+ <input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_2')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_2'); ?>">
<label for="new_prec_2"><?php echo WT_I18N::translate('City'); ?></label>
- <input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_3')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>">
+ <input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_3')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_3'); ?>">
<label for="new_prec_3"><?php echo WT_I18N::translate('Neighborhood'); ?></label>
- <input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision==$this->getSetting('GM_PRECISION_4')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>">
+ <input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision == $this->getSetting('GM_PRECISION_4')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_4'); ?>">
<label for="new_prec_4"><?php echo WT_I18N::translate('House'); ?></label>
- <input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision>=$this->getSetting('GM_PRECISION_5')) echo "checked=\"checked\""; ?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>">
+ <input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php if ($precision >= $this->getSetting('GM_PRECISION_5')) echo 'checked'; ?> value="<?php echo $this->getSetting('GM_PRECISION_5'); ?>">
<label for="new_prec_5"><?php echo WT_I18N::translate('Max'); ?></label>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Here you can enter the precision. Based on this setting the number of digits that will be used in the latitude and longitude is determined.'); ?>
+ </p>
</td>
</tr>
<tr>
@@ -4012,8 +4069,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<td class="optionbox" colspan="2">
<input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" placeholder="<?php echo /* I18N: Measure of latitude/longitude */ WT_I18N::translate('degrees') ?>" value="<?php if ($place_lati != null) echo abs($place_lati); ?>" size="20" onchange="updateMap();">
<select name="LATI_CONTROL" onchange="updateMap();">
- <option value="PL_N" <?php if ($place_lati > 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate('north'); ?></option>
- <option value="PL_S" <?php if ($place_lati < 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate('south'); ?></option>
+ <option value="PL_N" <?php if ($place_lati > 0) echo "selected"; echo ">", WT_I18N::translate('north'); ?></option>
+ <option value="PL_S" <?php if ($place_lati < 0) echo "selected"; echo ">", WT_I18N::translate('south'); ?></option>
</select>
</td>
</tr>
@@ -4022,22 +4079,30 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<td class="optionbox" colspan="2">
<input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" placeholder="<?php echo WT_I18N::translate('degrees') ?>" value="<?php if ($place_long != null) echo abs($place_long); ?>" size="20" onchange="updateMap();">
<select name="LONG_CONTROL" onchange="updateMap();">
- <option value="PL_E" <?php if ($place_long > 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate('east'); ?></option>
- <option value="PL_W" <?php if ($place_long < 0) echo " selected=\"selected\""; echo ">", WT_I18N::translate('west'); ?></option>
+ <option value="PL_E" <?php if ($place_long > 0) echo "selected"; echo ">", WT_I18N::translate('east'); ?></option>
+ <option value="PL_W" <?php if ($place_long < 0) echo "selected"; echo ">", WT_I18N::translate('west'); ?></option>
</select>
</td>
</tr>
<tr>
- <td class="descriptionbox"><?php echo WT_I18N::translate('Zoom level'), help_link('PLE_ZOOM','googlemap'); ?></td>
+ <td class="descriptionbox">
+ <?php echo WT_I18N::translate('Zoom level'); ?>
+ </td>
<td class="optionbox" colspan="2">
- <input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php echo $zoomfactor; ?>" size="20" onchange="updateMap();"></td>
+ <input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php echo $zoomfactor; ?>" size="20" onchange="updateMap();">
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Here the zoom level can be entered. This value will be used as the minimal value when displaying this geographic location on a map.'); ?>
+ </p>
+ </td>
</tr>
<tr>
- <td class="descriptionbox"><?php echo WT_I18N::translate('Flag'), help_link('PLE_ICON','googlemap'); ?></td>
+ <td class="descriptionbox">
+ <?php echo WT_I18N::translate('Flag'); ?>
+ </td>
<td class="optionbox" colspan="2">
<div id="flagsDiv">
<?php
- if (($place_icon == NULL) || ($place_icon == "")) { ?>
+ if (($place_icon == null) || ($place_icon == "")) { ?>
<a href="#" onclick="change_icon();return false;"><?php echo WT_I18N::translate('Change flag'); ?></a>
<?php }
else { ?>
@@ -4045,7 +4110,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<a href="#" onclick="change_icon();return false;"><?php echo WT_I18N::translate('Change flag'); ?></a>&nbsp;&nbsp;
<a href="#" onclick="remove_icon();return false;"><?php echo WT_I18N::translate('Remove flag'); ?></a>
<?php } ?>
- </div></td>
+ </div>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Here an icon can be set or removed. Using this link a flag can be selected. When this geographic location is shown, this flag will be displayed.'); ?>
+ </p>
+ </td>
</tr>
</table>
<p id="save-cancel">
@@ -4060,7 +4129,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
* ...
*/
private function adminPlaces() {
- require WT_ROOT.'includes/functions/functions_edit.php';
+ require WT_ROOT . 'includes/functions/functions_edit.php';
$action = WT_Filter::get('action');
$parent = WT_Filter::get('parent');
@@ -4068,30 +4137,30 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$deleteRecord = WT_Filter::get('deleteRecord');
if (!isset($parent)) {
- $parent=0;
+ $parent = 0;
}
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller->restrictAccess(Auth::isAdmin());
- if ($action=='ExportFile' && Auth::isAdmin()) {
+ if ($action == 'ExportFile' && Auth::isAdmin()) {
Zend_Session::writeClose();
$tmp = $this->placeIdToHierarchy($parent);
$maxLevel = $this->getHighestLevel();
- if ($maxLevel>8) $maxLevel=8;
+ if ($maxLevel > 8) $maxLevel = 8;
$tmp[0] = 'places';
- $outputFileName=preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)).'.csv';
+ $outputFileName = preg_replace('/[:;\/\\\(\)\{\}\[\] $]/', '_', implode('-', $tmp)) . '.csv';
header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="'.$outputFileName.'"');
+ header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
- if ($maxLevel>0) echo '"', WT_I18N::translate('State'), '";';
- if ($maxLevel>1) echo '"', WT_I18N::translate('County'), '";';
- if ($maxLevel>2) echo '"', WT_I18N::translate('City'), '";';
- if ($maxLevel>3) echo '"', WT_I18N::translate('Place'), '";';
- if ($maxLevel>4) echo '"', WT_I18N::translate('Place'), '";';
- if ($maxLevel>5) echo '"', WT_I18N::translate('Place'), '";';
- if ($maxLevel>6) echo '"', WT_I18N::translate('Place'), '";';
- if ($maxLevel>7) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel > 0) echo '"', WT_I18N::translate('State'), '";';
+ if ($maxLevel > 1) echo '"', WT_I18N::translate('County'), '";';
+ if ($maxLevel > 2) echo '"', WT_I18N::translate('City'), '";';
+ if ($maxLevel > 3) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel > 4) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel > 5) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel > 6) echo '"', WT_I18N::translate('Place'), '";';
+ if ($maxLevel > 7) echo '"', WT_I18N::translate('Place'), '";';
echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
$this->outputLevel($parent);
@@ -4124,9 +4193,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
</table>
<?php
- if ($action=='ImportGedcom') {
- $placelist=array();
- $j=0;
+ if ($action == 'ImportGedcom') {
+ $placelist = array();
+ $j = 0;
$gedcom_records =
WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")
->execute(array(WT_GED_ID, WT_GED_ID))
@@ -4144,22 +4213,22 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if ($placelist[$j]['lati'] < 0) {
$placelist[$j]['lati'][0] = 'S';
} else {
- $placelist[$j]['lati'] = 'N'.$placelist[$j]['lati'];
+ $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
}
}
}
- else $placelist[$j]['lati'] = NULL;
+ else $placelist[$j]['lati'] = null;
if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
$placelist[$j]['long'] = trim($match[1]);
if (($placelist[$j]['long'][0] != 'E') && ($placelist[$j]['long'][0] != 'W')) {
if ($placelist[$j]['long'] < 0) {
$placelist[$j]['long'][0] = 'W';
} else {
- $placelist[$j]['long'] = 'E'.$placelist[$j]['long'];
+ $placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
}
}
}
- else $placelist[$j]['long'] = NULL;
+ else $placelist[$j]['long'] = null;
$j = $j + 1;
}
$i = $i + 1;
@@ -4181,9 +4250,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$placelistUniq[$j]['long'] = $place['long'];
$j = $j + 1;
} elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) {
- if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) {
- $placelistUniq[$j-1]['lati'] = $place['lati'];
- $placelistUniq[$j-1]['long'] = $place['long'];
+ if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) {
+ $placelistUniq[$j - 1]['lati'] = $place['lati'];
+ $placelistUniq[$j - 1]['long'] = $place['long'];
} elseif (($place['lati'] != '0') || ($place['long'] != '0')) {
echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
}
@@ -4195,32 +4264,32 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$highestIndex = $this->getHighestIndex();
- $default_zoom_level=array(4, 7, 10, 12);
+ $default_zoom_level = array(4, 7, 10, 12);
foreach ($placelistUniq as $k=>$place) {
- $parent=preg_split('/ *, */', $place['place']);
- $parent=array_reverse($parent);
- $parent_id=0;
- for ($i=0; $i<count($parent); $i++) {
+ $parent = preg_split('/ *, */', $place['place']);
+ $parent = array_reverse($parent);
+ $parent_id = 0;
+ for ($i = 0; $i < count($parent); $i++) {
if (!isset($default_zoom_level[$i]))
- $default_zoom_level[$i]=$default_zoom_level[$i-1];
- $escparent=$parent[$i];
+ $default_zoom_level[$i] = $default_zoom_level[$i - 1];
+ $escparent = $parent[$i];
if ($escparent == '') {
$escparent = 'Unknown';
}
- $row=
+ $row =
WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")
->execute(array($i, $parent_id, $escparent))
->fetchOneRow();
- if ($i < count($parent)-1) {
+ if ($i < count($parent) - 1) {
// Create higher-level places, if necessary
if (empty($row)) {
$highestIndex++;
WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")
->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i]));
echo WT_Filter::escapeHtml($escparent), '<br>';
- $parent_id=$highestIndex;
+ $parent_id = $highestIndex;
} else {
- $parent_id=$row->pl_id;
+ $parent_id = $row->pl_id;
}
} else {
// Create lowest-level place, if necessary
@@ -4230,7 +4299,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i]));
echo WT_Filter::escapeHtml($escparent), '<br>';
} else {
- if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati']!='0' && $place['long']!='0') {
+ if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') {
WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")
->execute(array($place['lati'], $place['long'], $row->pl_id));
echo WT_Filter::escapeHtml($escparent), '<br>';
@@ -4239,12 +4308,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
}
}
- $parent=0;
+ $parent = 0;
}
- if ($action=='ImportFile') {
+ if ($action == 'ImportFile') {
$placefiles = array();
- $this->findFiles(WT_MODULES_DIR.'googlemap/extra');
+ $this->findFiles(WT_MODULES_DIR . 'googlemap/extra');
sort($placefiles);
?>
<form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&amp;mod_action=admin_places&amp;action=ImportFile2">
@@ -4253,18 +4322,23 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
<th><?php echo WT_I18N::translate('File containing places (CSV)'); ?></th>
<td><input type="file" name="placesfile" size="50"></td>
</tr>
- <?php if (count($placefiles)>0) { ?>
+ <?php if (count($placefiles) > 0) { ?>
<tr>
- <th><?php echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE','googlemap'); ?></th>
+ <th>
+ <?php echo WT_I18N::translate('Server file containing places (CSV)'); ?>
+ </th>
<td>
<select name="localfile">
<option></option>
<?php foreach ($placefiles as $p=>$placefile) { ?>
<option value="<?php echo WT_Filter::escapeHtml($placefile); ?>"><?php
- if (substr($placefile, 0, 1)=="/") echo substr($placefile, 1);
+ if (substr($placefile, 0, 1) == "/") echo substr($placefile, 1);
else echo $placefile; ?></option>
<?php } ?>
</select>
+ <p class="small text-muted">
+ <?php echo WT_I18N::translate('Select a file from the list of files already on the server which contains the place locations in CSV format.'); ?>
+ </p>
</td>
</tr>
<?php } ?>
@@ -4287,10 +4361,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
exit;
}
- if ($action=='ImportFile2') {
- $country_names=array();
- foreach (WT_Stats::iso3166() as $key=>$value) {
- $country_names[$key]=WT_I18N::translate($key);
+ if ($action === 'ImportFile2') {
+ $country_names = array();
+ $stats = new WT_Stats(WT_GEDCOM);
+ foreach ($stats->iso3166() as $key=>$value) {
+ $country_names[$key] = WT_I18N::translate($key);
}
if (isset($_POST['cleardatabase'])) {
WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1");
@@ -4298,10 +4373,12 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
if (!empty($_FILES['placesfile']['tmp_name'])) {
$lines = file($_FILES['placesfile']['tmp_name']);
} elseif (!empty($_REQUEST['localfile'])) {
- $lines = file(WT_MODULES_DIR.'googlemap/extra'.$_REQUEST['localfile']);
+ $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']);
}
// Strip BYTE-ORDER-MARK, if present
- if (!empty($lines[0]) && substr($lines[0], 0, 3)==WT_UTF8_BOM) $lines[0]=substr($lines[0], 3);
+ if (!empty($lines[0]) && substr($lines[0], 0, 3) === WT_UTF8_BOM) {
+ $lines[0] = substr($lines[0], 3);
+ }
asort($lines);
$highestIndex = $this->getHighestIndex();
$placelist = array();
@@ -4313,16 +4390,16 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
$fields = count($fieldrec);
$set_icon = true;
- if (!is_dir(WT_MODULES_DIR.'googlemap/places/flags/')) {
+ if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) {
$set_icon = false;
}
foreach ($lines as $p => $placerec) {
$fieldrec = explode(';', $placerec);
- if (is_numeric($fieldrec[0]) && $fieldrec[0]<=$maxLevel) {
+ if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) {
$placelist[$j] = array();
$placelist[$j]['place'] = '';
- for ($ii=$fields-4; $ii>1; $ii--) {
- if ($fieldrec[0] > $ii-2) $placelist[$j]['place'] .= $fieldrec[$ii].',';
+ for ($ii = $fields - 4; $ii > 1; $ii--) {
+ if ($fieldrec[0] > $ii - 2) $placelist[$j]['place'] .= $fieldrec[$ii] . ',';
}
foreach ($country_names as $countrycode => $countryname) {
if ($countrycode == strtoupper($fieldrec[1])) {
@@ -4331,11 +4408,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
}
$placelist[$j]['place'] .= $fieldrec[1];
- $placelist[$j]['long'] = $fieldrec[$fields-4];
- $placelist[$j]['lati'] = $fieldrec[$fields-3];
- $placelist[$j]['zoom'] = $fieldrec[$fields-2];
- if($set_icon) {
- $placelist[$j]['icon'] = trim($fieldrec[$fields-1]);
+ $placelist[$j]['long'] = $fieldrec[$fields - 4];
+ $placelist[$j]['lati'] = $fieldrec[$fields - 3];
+ $placelist[$j]['zoom'] = $fieldrec[$fields - 2];
+ if ($set_icon) {
+ $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]);
} else {
$placelist[$j]['icon'] = '';
}
@@ -4358,11 +4435,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
$placelistUniq[$j]['icon'] = $place['icon'];
$j = $j + 1;
} elseif (($place['place'] == $prevPlace) && (($place['lati'] != $prevLati) || ($place['long'] != $prevLong))) {
- if (($placelistUniq[$j-1]['lati'] == 0) || ($placelistUniq[$j-1]['long'] == 0)) {
- $placelistUniq[$j-1]['lati'] = $place['lati'];
- $placelistUniq[$j-1]['long'] = $place['long'];
- $placelistUniq[$j-1]['zoom'] = $place['zoom'];
- $placelistUniq[$j-1]['icon'] = $place['icon'];
+ if (($placelistUniq[$j - 1]['lati'] == 0) || ($placelistUniq[$j - 1]['long'] == 0)) {
+ $placelistUniq[$j - 1]['lati'] = $place['lati'];
+ $placelistUniq[$j - 1]['long'] = $place['long'];
+ $placelistUniq[$j - 1]['zoom'] = $place['zoom'];
+ $placelistUniq[$j - 1]['icon'] = $place['icon'];
} elseif (($place['lati'] != '0') || ($place['long'] != '0')) {
echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
}
@@ -4380,42 +4457,42 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
foreach ($placelistUniq as $k=>$place) {
$parent = explode(',', $place['place']);
$parent = array_reverse($parent);
- $parent_id=0;
- for ($i=0; $i<count($parent); $i++) {
- $escparent=$parent[$i];
+ $parent_id = 0;
+ for ($i = 0; $i < count($parent); $i++) {
+ $escparent = $parent[$i];
if ($escparent == '') {
$escparent = 'Unknown';
}
- $row=
+ $row =
WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")
->execute(array($i, $parent_id, $escparent))
->fetchOneRow();
if (empty($row)) { // this name does not yet exist: create entry
if (!isset($_POST['updateonly'])) {
$highestIndex = $highestIndex + 1;
- if (($i+1) == count($parent)) {
+ if (($i + 1) == count($parent)) {
$zoomlevel = $place['zoom'];
} elseif (isset($default_zoom_level[$i])) {
$zoomlevel = $default_zoom_level[$i];
} else {
$zoomlevel = $this->getSetting('GM_MAX_ZOOM');
}
- if (($place['lati'] == '0') || ($place['long'] == '0') || (($i+1) < count($parent))) {
+ if (($place['lati'] == '0') || ($place['long'] == '0') || (($i + 1) < count($parent))) {
WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")
->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon']));
} else {
//delete leading zero
- $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.') , $place['lati']);
- $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.') , $place['long']);
+ $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']);
+ $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']);
if ($pl_lati >= 0) {
- $place['lati'] = 'N'.abs($pl_lati);
+ $place['lati'] = 'N' . abs($pl_lati);
} elseif ($pl_lati < 0) {
- $place['lati'] = 'S'.abs($pl_lati);
+ $place['lati'] = 'S' . abs($pl_lati);
}
if ($pl_long >= 0) {
- $place['long'] = 'E'.abs($pl_long);
+ $place['long'] = 'E' . abs($pl_long);
} elseif ($pl_long < 0) {
- $place['long'] = 'W'.abs($pl_long);
+ $place['long'] = 'W' . abs($pl_long);
}
WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon']));
@@ -4424,7 +4501,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
} else {
$parent_id = $row->pl_id;
- if ((isset($_POST['overwritedata'])) && ($i+1 == count($parent))) {
+ if ((isset($_POST['overwritedata'])) && ($i + 1 == count($parent))) {
WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")
->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id));
} else {
@@ -4440,11 +4517,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
}
}
- $parent=0;
+ $parent = 0;
}
- if ($action=='DeleteRecord') {
- $exists=
+ if ($action == 'DeleteRecord') {
+ $exists =
WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")
->execute(array($deleteRecord))
->fetchOne();
@@ -4460,7 +4537,7 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
?>
<script>
function updateList(inactive) {
- window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri=strstr($_SERVER['REQUEST_URI'], '&inactive', true);} else { $uri=$_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?>'+inactive;
+ window.location.href='<?php if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) { $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true); } else { $uri = $_SERVER['REQUEST_URI']; } echo $uri, '&inactive='; ?>'+inactive;
}
function edit_place_location(placeid) {
@@ -4482,9 +4559,9 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
</script>
<?php
echo '<div id="gm_breadcrumb">';
- $where_am_i=$this->placeIdToHierarchy($parent);
+ $where_am_i = $this->placeIdToHierarchy($parent);
foreach (array_reverse($where_am_i, true) as $id=>$place) {
- if ($id==$parent) {
+ if ($id == $parent) {
if ($place != 'Unknown') {
echo WT_Filter::escapeHtml($place);
} else {
@@ -4503,12 +4580,18 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top level'), '</a></div>';
echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">';
echo '<label for="inactive">', WT_I18N::translate('Show inactive places'), '</label>';
- echo '<input type="checkbox" name="inactive" id="inactive"';
- if ($inactive) echo ' checked="checked"';
+ echo '<input type="checkbox" name="inactive" id="inactive" ';
+ echo $inactive ? 'checked' : '';
echo ' onclick="updateList(this.checked)"';
- echo '>', help_link('PLE_ACTIVE','googlemap'), '</div></form>';
+ echo '></div>';
+ echo '<p class="small text-muted">';
+ echo WT_I18N::translate('By default, the list shows only those places which can be found in your family trees. You may have details for other places, such as those imported in bulk from an external file. Selecting this option will show all places, including ones that are not currently used.');
+ echo ' ';
+ echo WT_I18N::translate('If you have a large number of inactive places, it can be slow to generate the list.');
+ echo '</p>';
+ echo '</form>';
- $placelist=$this->getPlaceListLocation($parent, $inactive);
+ $placelist = $this->getPlaceListLocation($parent, $inactive);
echo '<div class="gm_plac_edit">';
echo '<table class="gm_plac_edit"><tr>';
echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>';
@@ -4530,8 +4613,8 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
echo '<td>', $place['long'], '</td>';
echo '<td>', $place['zoom'], '</td>';
echo '<td>';
- if (($place['icon'] == NULL) || ($place['icon'] == '')) {
- if (($place['lati'] == NULL) || ($place['long'] == NULL) || (($place['lati'] == '0') && ($place['long'] == '0'))) {
+ if (($place['icon'] == null) || ($place['icon'] == '')) {
+ if (($place['lati'] == null) || ($place['long'] == null) || (($place['lati'] == '0') && ($place['long'] == '0'))) {
echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">';
}
else {
@@ -4542,11 +4625,11 @@ class googlemap_WT_Module extends WT_Module implements WT_Module_Config, WT_Modu
}
echo '</td>';
echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>';
- $noRows=
+ $noRows =
WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")
->execute(array($place['place_id']))
->fetchOne();
- if ($noRows==0) { ?>
+ if ($noRows == 0) { ?>
<td><a href="#" onclick="delete_place(<?php echo $place['place_id']?>);return false;" class="icon-delete" title="<?php echo WT_I18N::translate('Remove'); ?>"></a></td>
<?php } else { ?>
<td><i class="icon-delete-grey"></i></td>
diff --git a/modules_v3/html/help_text.php b/modules_v3/html/help_text.php
deleted file mode 100644
index b5245c8e30..0000000000
--- a/modules_v3/html/help_text.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-// Help text for the HTML block.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'block_html_content':
- $title=WT_I18N::translate('Content');
- $text=WT_I18N::translate('As well as using the toolbar to apply HTML formatting, you can insert database fields which are updated automatically. These special fields are marked with <b>#</b> characters. For example <b>#totalFamilies#</b> will be replaced with the actual number of families in the database. Advanced users may wish to apply CSS classes to their text, so that the formatting matches the currently selected theme.');
- break;
-
-case 'block_html_template':
- $title=WT_I18N::translate('Templates');
- $text=WT_I18N::translate('To assist you in getting started with this block, we have created several standard templates. When you select one of these templates, the text area will contain a copy that you can then alter to suit your site’s requirements.');
- break;
-}
diff --git a/modules_v3/html/module.php b/modules_v3/html/module.php
index 6e4ddd2efd..a7157f9f9e 100644
--- a/modules_v3/html/module.php
+++ b/modules_v3/html/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class html_WT_Module
@@ -36,11 +37,16 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $GEDCOM;
+ $title = get_block_setting($block_id, 'title');
+ $html = get_block_setting($block_id, 'html');
+ $gedcom = get_block_setting($block_id, 'gedcom');
+ $show_timestamp = get_block_setting($block_id, 'show_timestamp', '0');
+ $languages = get_block_setting($block_id, 'languages');
+
// Only show this block for certain languages
- $languages=get_block_setting($block_id, 'languages');
if ($languages && !in_array(WT_LOCALE, explode(',', $languages))) {
return;
}
@@ -48,17 +54,16 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
/*
* Select GEDCOM
*/
- $gedcom=get_block_setting($block_id, 'gedcom');
- switch($gedcom) {
+ switch ($gedcom) {
case '__current__':
break;
case '':
break;
case '__default__':
- $GEDCOM=WT_Site::getPreference('DEFAULT_GEDCOM');
+ $GEDCOM = WT_Site::getPreference('DEFAULT_GEDCOM');
if (!$GEDCOM) {
foreach (WT_Tree::getAll() as $tree) {
- $GEDCOM=$tree->tree_name;
+ $GEDCOM = $tree->tree_name;
break;
}
}
@@ -71,12 +76,9 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
/*
* Retrieve text, process embedded variables
*/
- $title_tmp = get_block_setting($block_id, 'title');
- $html = get_block_setting($block_id, 'html');
-
- if ( (strpos($title_tmp, '#')!==false) || (strpos($html, '#')!==false) ) {
+ if ((strpos($title, '#') !== false) || (strpos($html, '#') !== false)) {
$stats = new WT_Stats($GEDCOM);
- $title_tmp = $stats->embedTags($title_tmp);
+ $title = $stats->embedTags($title);
$html = $stats->embedTags($html);
}
@@ -88,27 +90,20 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
/*
* Start Of Output
*/
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title='<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
- } else {
- $title='';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>' . $title;
}
- $title.=$title_tmp;
$content = $html;
- if (get_block_setting($block_id, 'show_timestamp', false)) {
- $content.='<br>'.format_timestamp(get_block_setting($block_id, 'timestamp', WT_TIMESTAMP));
+ if ($show_timestamp) {
+ $content .= '<br>' . format_timestamp(get_block_setting($block_id, 'timestamp', WT_TIMESTAMP));
}
if ($template) {
- if (get_block_setting($block_id, 'block', false)) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
- }
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -132,24 +127,18 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom'));
- set_block_setting($block_id, 'title', WT_Filter::post('title'));
- set_block_setting($block_id, 'html', WT_Filter::post('html'));
+ set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom'));
+ set_block_setting($block_id, 'title', WT_Filter::post('title'));
+ set_block_setting($block_id, 'html', WT_Filter::post('html'));
set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp'));
- set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp'));
- $languages=array();
- foreach (WT_I18N::installed_languages() as $code=>$name) {
- if (WT_Filter::postBool('lang_'.$code)) {
- $languages[]=$code;
- }
- }
+ set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp'));
+ $languages = WT_Filter::postArray('lang', null, array_keys(WT_I18N::installed_languages()));
set_block_setting($block_id, 'languages', implode(',', $languages));
- exit;
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $templates=array(
+ $templates = array(
WT_I18N::translate('Keyword examples')=>
'#getAllTagsTable#',
@@ -165,43 +154,43 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
<td valign="top" class="width20">
<table cellspacing="1" cellpadding="0">
<tr>
- <td class="facts_label">'.WT_I18N::translate('Individuals').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Individuals') . '</td>
<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Males').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Males') . '</td>
<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Females').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Females') . '</td>
<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Total surnames').'</td>
- <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged='.WT_GEDURL.'">#totalSurnames#</a></td>
+ <td class="facts_label">'.WT_I18N::translate('Total surnames') . '</td>
+ <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged='.WT_GEDURL . '">#totalSurnames#</a></td>
</tr>
<tr>
- <td class="facts_label">'. WT_I18N::translate('Families').'</td>
- <td class="facts_value" align="right"><a href="famlist.php?ged='.WT_GEDURL.'">#totalFamilies#</a></td>
+ <td class="facts_label">'. WT_I18N::translate('Families') . '</td>
+ <td class="facts_value" align="right"><a href="famlist.php?ged='.WT_GEDURL . '">#totalFamilies#</a></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Sources').'</td>
- <td class="facts_value" align="right"><a href="sourcelist.php?ged='.WT_GEDURL.'">#totalSources#</a></td>
+ <td class="facts_label">'.WT_I18N::translate('Sources') . '</td>
+ <td class="facts_value" align="right"><a href="sourcelist.php?ged='.WT_GEDURL . '">#totalSources#</a></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Media objects').'</td>
- <td class="facts_value" align="right"><a href="medialist.php?ged='.WT_GEDURL.'">#totalMedia#</a></td>
+ <td class="facts_label">'.WT_I18N::translate('Media objects') . '</td>
+ <td class="facts_value" align="right"><a href="medialist.php?ged='.WT_GEDURL . '">#totalMedia#</a></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Repositories').'</td>
- <td class="facts_value" align="right"><a href="repolist.php?ged='.WT_GEDURL.'">#totalRepositories#</a></td>
+ <td class="facts_label">'.WT_I18N::translate('Repositories') . '</td>
+ <td class="facts_value" align="right"><a href="repolist.php?ged='.WT_GEDURL . '">#totalRepositories#</a></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Total events').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Total events') . '</td>
<td class="facts_value" align="right">#totalEvents#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Total users').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Total users') . '</td>
<td class="facts_value" align="right">#totalUsers#</td>
</tr>
</table>
@@ -210,42 +199,42 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
<td valign="top">
<table cellspacing="1" cellpadding="0" border="0">
<tr>
- <td class="facts_label">'.WT_I18N::translate('Earliest birth year').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Earliest birth year') . '</td>
<td class="facts_value" align="right">#firstBirthYear#</td>
<td class="facts_value">#firstBirth#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Latest birth year').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Latest birth year') . '</td>
<td class="facts_value" align="right">#lastBirthYear#</td>
<td class="facts_value">#lastBirth#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Earliest death year').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Earliest death year') . '</td>
<td class="facts_value" align="right">#firstDeathYear#</td>
<td class="facts_value">#firstDeath#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Latest death year').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Latest death year') . '</td>
<td class="facts_value" align="right">#lastDeathYear#</td>
<td class="facts_value">#lastDeath#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Individual who lived the longest').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Individual who lived the longest') . '</td>
<td class="facts_value" align="right">#longestLifeAge#</td>
<td class="facts_value">#longestLife#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Average age at death').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Average age at death') . '</td>
<td class="facts_value" align="right">#averageLifespan#</td>
<td class="facts_value"></td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Family with the most children').'</td>
+ <td class="facts_label">'.WT_I18N::translate('Family with the most children') . '</td>
<td class="facts_value" align="right">#largestFamilySize#</td>
<td class="facts_value">#largestFamily#</td>
</tr>
<tr>
- <td class="facts_label">'.WT_I18N::translate('Average number of children per family'). '</td>
+ <td class="facts_label">'.WT_I18N::translate('Average number of children per family') . '</td>
<td class="facts_value" align="right">#averageChildren#</td>
<td class="facts_value"></td>
</tr>
@@ -253,14 +242,17 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
</td>
</tr>
</table><br>
- <span style="font-weight: bold;">' .WT_I18N::translate('Most common surnames').'</span><br>
+ <span style="font-weight: bold;">' .WT_I18N::translate('Most common surnames') . '</span><br>
#commonSurnames#
</div>'
);
- $title=get_block_setting($block_id, 'title');
- $html=get_block_setting($block_id, 'html');
- // title
+ $title = get_block_setting($block_id, 'title');
+ $html = get_block_setting($block_id, 'html');
+ $gedcom = get_block_setting($block_id, 'gedcom');
+ $show_timestamp = get_block_setting($block_id, 'show_timestamp', '0');
+ $languages = explode(',', get_block_setting($block_id, 'languages'));
+
echo '<tr><td class="descriptionbox wrap">',
WT_Gedcom_Tag::getLabel('TITL'),
'</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>';
@@ -268,49 +260,53 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
// templates
echo '<tr><td class="descriptionbox wrap">',
WT_I18N::translate('Templates'),
- help_link('block_html_template', $this->getName()),
- '</td><td class="optionbox">';
+ '</td><td class="optionbox wrap">';
// The CK editor needs lots of help to load/save data :-(
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
- $ckeditor_onchange='CKEDITOR.instances.html.setData(document.block.html.value);';
+ $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);';
} else {
- $ckeditor_onchange='';
+ $ckeditor_onchange = '';
}
echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">';
echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>';
foreach ($templates as $title=>$template) {
echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>';
}
- echo '</select></td></tr>';
+ echo '</select>';
+ if (!$html) {
+ echo '<p>', WT_I18N::translate('To assist you in getting started with this block, we have created several standard templates. When you select one of these templates, the text area will contain a copy that you can then alter to suit your site’s requirements.'), '</p>';
+ }
+ echo '</td></tr>';
- // gedcom
- $gedcom=get_block_setting($block_id, 'gedcom');
if (count(WT_Tree::getAll()) > 1) {
- if ($gedcom == '__current__') {$sel_current = ' selected="selected"';} else {$sel_current = '';}
- if ($gedcom == '__default__') {$sel_default = ' selected="selected"';} else {$sel_default = '';}
+ if ($gedcom == '__current__') {$sel_current = 'selected'; } else {$sel_current = ''; }
+ if ($gedcom == '__default__') {$sel_default = 'selected'; } else {$sel_default = ''; }
echo '<tr><td class="descriptionbox wrap">',
WT_I18N::translate('Family tree'),
'</td><td class="optionbox">',
'<select name="gedcom">',
- '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>',
- '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
+ '<option value="__current__" ', $sel_current, '>', WT_I18N::translate('Current'), '</option>',
+ '<option value="__default__" ', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
foreach (WT_Tree::getAll() as $tree) {
- if ($tree->tree_name == $gedcom) {$sel = ' selected="selected"';} else {$sel = '';}
- echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
+ if ($tree->tree_name == $gedcom) {$sel = 'selected'; } else {$sel = ''; }
+ echo '<option value="', $tree->tree_name, '" ', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
}
- echo '</select></td></tr>';
+ echo '</select>';
+ echo '</td></tr>';
}
// html
echo '<tr><td colspan="2" class="descriptionbox">',
- WT_I18N::translate('Content'),
- help_link('block_html_content', $this->getName()),
+ WT_I18N::translate('Content');
+ if (!$html) {
+ echo '<p>', WT_I18N::translate('As well as using the toolbar to apply HTML formatting, you can insert database fields which are updated automatically. These special fields are marked with <b>#</b> characters. For example <b>#totalFamilies#</b> will be replaced with the actual number of families in the database. Advanced users may wish to apply CSS classes to their text, so that the formatting matches the currently selected theme.'), '</p>';
+ }
+ echo
'</td></tr><tr>',
'<td colspan="2" class="optionbox">';
echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>';
echo '</td></tr>';
- $show_timestamp=get_block_setting($block_id, 'show_timestamp', false);
echo '<tr><td class="descriptionbox wrap">';
echo WT_I18N::translate('Show the date and time of update');
echo '</td><td class="optionbox">';
@@ -318,11 +314,10 @@ class html_WT_Module extends WT_Module implements WT_Module_Block {
echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">';
echo '</td></tr>';
- $languages=get_block_setting($block_id, 'languages');
echo '<tr><td class="descriptionbox wrap">';
echo WT_I18N::translate('Show this block for which languages?');
echo '</td><td class="optionbox">';
- echo edit_language_checkboxes('lang_', $languages);
+ echo edit_language_checkboxes('lang', $languages);
echo '</td></tr>';
}
}
diff --git a/modules_v3/individual_ext_report/module.php b/modules_v3/individual_ext_report/module.php
index 683fced21b..62d5cc20c0 100644
--- a/modules_v3/individual_ext_report/module.php
+++ b/modules_v3/individual_ext_report/module.php
@@ -44,13 +44,13 @@ class individual_ext_report_WT_Module extends WT_Module implements WT_Module_Rep
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/individual_report/module.php b/modules_v3/individual_report/module.php
index ab7354786d..d74d8007a9 100644
--- a/modules_v3/individual_report/module.php
+++ b/modules_v3/individual_report/module.php
@@ -44,13 +44,13 @@ class individual_report_WT_Module extends WT_Module implements WT_Module_Report
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/individuals/module.php b/modules_v3/individuals/module.php
index 915b0a6f6c..dd79ec3580 100644
--- a/modules_v3/individuals/module.php
+++ b/modules_v3/individuals/module.php
@@ -45,7 +45,6 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
header('HTTP/1.0 404 Not Found');
break;
}
- exit;
}
/** {@inheritdoc} */
@@ -68,7 +67,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
if ($search) {
return $this->search($search);
- } elseif ($alpha=='@' || $alpha==',' || $surname) {
+ } elseif ($alpha == '@' || $alpha == ',' || $surname) {
return $this->getSurnameIndis($alpha, $surname);
} elseif ($alpha) {
return $this->getAlphaSurnames($alpha, $surname);
@@ -82,7 +81,7 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
global $WT_IMAGES, $UNKNOWN_NN, $controller;
// Fetch a list of the initial letters of all surnames in the database
- $initials=WT_Query_Name::surnameAlpha(true, false, WT_GED_ID, false);
+ $initials = WT_Query_Name::surnameAlpha(true, false, WT_GED_ID, false);
$controller->addInlineJavascript('
var loadedNames = new Array();
@@ -134,24 +133,24 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
');
- $out='<form method="post" action="module.php?mod='.$this->getName().'&amp;mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_indi_name" id="sb_indi_name" placeholder="'.WT_I18N::translate('Search').'"><p>';
+ $out = '<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax" onsubmit="return false;"><input type="search" name="sb_indi_name" id="sb_indi_name" placeholder="' . WT_I18N::translate('Search') . '"><p>';
foreach ($initials as $letter=>$count) {
switch ($letter) {
- case '@':
- $html=$UNKNOWN_NN;
- break;
- case ',':
- $html=WT_I18N::translate('None');
- break;
- case ' ':
- $html='&nbsp;';
- break;
- default:
- $html=$letter;
- break;
+ case '@':
+ $html = $UNKNOWN_NN;
+ break;
+ case ',':
+ $html = WT_I18N::translate('None');
+ break;
+ case ' ':
+ $html = '&nbsp;';
+ break;
+ default:
+ $html = $letter;
+ break;
}
- $html='<a href="module.php?mod='.$this->getName().'&amp;mod_action=ajax&amp;sb_action=individuals&amp;alpha='.urlencode($letter).'" class="sb_indi_letter">'.$html.'</a>';
- $out .= $html." ";
+ $html = '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=individuals&amp;alpha=' . urlencode($letter) . '" class="sb_indi_letter">' . $html . '</a>';
+ $out .= $html . " ";
}
$out .= '</p>';
@@ -167,12 +166,12 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
*
* @return string
*/
- public function getAlphaSurnames($alpha, $surname1='') {
+ public function getAlphaSurnames($alpha, $surname1 = '') {
$surnames = WT_Query_Name::surnames('', $alpha, true, false, WT_GED_ID);
$out = '<ul>';
foreach (array_keys($surnames) as $surname) {
$out .= '<li id="sb_indi_' . $surname . '" class="sb_indi_surname_li"><a href="' . $surname . '" title="' . $surname . '" alt="' . $alpha . '" class="sb_indi_surname">' . $surname . '</a>';
- if (!empty($surname1) && $surname1==$surname) {
+ if (!empty($surname1) && $surname1 == $surname) {
$out .= '<div class="name_tree_div_visible">';
$out .= $this->getSurnameIndis($alpha, $surname1);
$out .= '</div>';
@@ -193,15 +192,15 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
* @return string
*/
public function getSurnameIndis($alpha, $surname) {
- $indis=WT_Query_Name::individuals($surname, $alpha, '', true, false, WT_GED_ID);
+ $indis = WT_Query_Name::individuals($surname, $alpha, '', true, false, WT_GED_ID);
$out = '<ul>';
foreach ($indis as $person) {
if ($person->canShowName()) {
- $out .= '<li><a href="'.$person->getHtmlUrl().'">'.$person->getSexImage().' '.$person->getFullName().' ';
+ $out .= '<li><a href="' . $person->getHtmlUrl() . '">' . $person->getSexImage() . ' ' . $person->getFullName() . ' ';
if ($person->canShow()) {
$bd = $person->getLifeSpan();
if (!empty($bd)) {
- $out .= ' ('.$bd.')';
+ $out .= ' (' . $bd . ')';
}
}
$out .= '</a></li>';
@@ -218,16 +217,16 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
* @return string
*/
public function search($query) {
- if (strlen($query)<2) {
+ if (strlen($query) < 2) {
return '';
}
- $rows=
+ $rows =
WT_DB::prepare(
- "SELECT i_id AS xref, i_file AS gedcom_id, i_gedcom AS gedcom".
- " FROM `##individuals`, `##name`".
- " WHERE (i_id LIKE ? OR n_sort LIKE ?)".
- " AND i_id=n_id AND i_file=n_file AND i_file=?".
- " ORDER BY n_sort COLLATE '".WT_I18N::$collation."'".
+ "SELECT i_id AS xref, i_file AS gedcom_id, i_gedcom AS gedcom" .
+ " FROM `##individuals`, `##name`" .
+ " WHERE (i_id LIKE ? OR n_sort LIKE ?)" .
+ " AND i_id=n_id AND i_file=n_file AND i_file=?" .
+ " ORDER BY n_sort COLLATE '" . WT_I18N::$collation . "'" .
" LIMIT 50"
)
->execute(array("%{$query}%", "%{$query}%", WT_GED_ID))
@@ -237,10 +236,12 @@ class individuals_WT_Module extends WT_Module implements WT_Module_Sidebar {
foreach ($rows as $row) {
$person = WT_Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
if ($person->canShowName()) {
- $out .= '<li><a href="'.$person->getHtmlUrl().'">'.$person->getSexImage().' '.$person->getFullName().' ';
+ $out .= '<li><a href="' . $person->getHtmlUrl() . '">' . $person->getSexImage() . ' ' . $person->getFullName() . ' ';
if ($person->canShow()) {
$bd = $person->getLifeSpan();
- if (!empty($bd)) $out .= ' ('.$bd.')';
+ if (!empty($bd)) {
+ $out .= ' (' . $bd . ')';
+ }
}
$out .= '</a></li>';
}
diff --git a/modules_v3/lightbox/module.php b/modules_v3/lightbox/module.php
index 5c49174ff9..dac8f8698d 100644
--- a/modules_v3/lightbox/module.php
+++ b/modules_v3/lightbox/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class lightbox_WT_Module
@@ -57,26 +58,26 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Tab {
public function getTabContent() {
global $WT_TREE, $controller;
- $html='<div id="' . $this->getName() . '_content">';
+ $html = '<div id="' . $this->getName() . '_content">';
//Show Lightbox-Album header Links
if (WT_USER_CAN_EDIT) {
- $html.='<table class="facts_table"><tr><td class="descriptionbox rela">';
+ $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
// Add a new media object
if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
- $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid='.$controller->record->getXref().'\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
- $html .= '<img src="'.WT_CSS_URL.'images/image_add.png" id="head_icon" class="icon" title="'.WT_I18N::translate('Add a new media object').'" alt="'.WT_I18N::translate('Add a new media object').'">';
+ $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
+ $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Add a new media object') . '" alt="' . WT_I18N::translate('Add a new media object') . '">';
$html .= WT_I18N::translate('Add a new media object');
$html .= '</a></span>';
// Link to an existing item
- $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid='.$controller->record->getXref().'&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
- $html .= '<img src="'.WT_CSS_URL.'images/image_link.png" id="head_icon" class="icon" title="'.WT_I18N::translate('Link to an existing media object').'" alt="'.WT_I18N::translate('Link to an existing media object').'">';
+ $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
+ $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Link to an existing media object') . '" alt="' . WT_I18N::translate('Link to an existing media object') . '">';
$html .= WT_I18N::translate('Link to an existing media object');
$html .= '</a></span>';
}
if (WT_USER_GEDCOM_ADMIN && $this->get_media()) {
// Popup Reorder Media
- $html .= '<span><a href="#" onclick="reorder_media(\''.$controller->record->getXref().'\')">';
- $html .= '<img src="'.WT_CSS_URL.'images/images.png" id="head_icon" class="icon" title="'.WT_I18N::translate('Re-order media').'" alt="'.WT_I18N::translate('Re-order media').'">';
+ $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
+ $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Re-order media') . '" alt="' . WT_I18N::translate('Re-order media') . '">';
$html .= WT_I18N::translate('Re-order media');
$html .= '</a></span>';
}
@@ -104,7 +105,7 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Tab {
if (strpos($media->getGedcom(), "\n1 NOTE")) {
$submenu = new WT_Menu(WT_I18N::translate('View notes'));
// Notes Tooltip ----------------------------------------------------
- $submenu->setOnclick("modalNotes('". WT_Filter::escapeJs($notes) . "','". WT_I18N::translate('View notes') . "'); return false;");
+ $submenu->setOnclick("modalNotes('" . WT_Filter::escapeJs($notes) . "','" . WT_I18N::translate('View notes') . "'); return false;");
$submenu->addClass("submenuitem");
$menu->addSubmenu($submenu);
}
@@ -126,13 +127,13 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Tab {
if (WT_USER_CAN_EDIT) {
// Edit Media
$submenu = new WT_Menu(WT_I18N::translate('Edit media'));
- $submenu->setOnclick("return window.open('addmedia.php?action=editmedia&amp;pid=".$media->getXref()."', '_blank', edit_window_specs);");
+ $submenu->setOnclick("return window.open('addmedia.php?action=editmedia&amp;pid=" . $media->getXref() . "', '_blank', edit_window_specs);");
$submenu->addClass("submenuitem");
$menu->addSubmenu($submenu);
if (Auth::isAdmin()) {
if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
$submenu = new WT_Menu(WT_I18N::translate('Manage links'));
- $submenu->setOnclick("return window.open('inverselink.php?mediaid=".$media->getXref()."&amp;linkto=manage', '_blank', find_window_specs);");
+ $submenu->setOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&amp;linkto=manage', '_blank', find_window_specs);");
$submenu->addClass("submenuitem");
$menu->addSubmenu($submenu);
} else {
@@ -186,7 +187,8 @@ class lightbox_WT_Module extends WT_Module implements WT_Module_Tab {
// Use all media from each fact
$this->media_list = array();
foreach ($facts as $fact) {
- if (!$fact->isPendingDeletion()) { // Don't show pending edits, as the user just sees duplicates
+ // Don't show pending edits, as the user just sees duplicates
+ if (!$fact->isPendingDeletion()) {
preg_match_all('/(?:^1|\n\d) OBJE @(' . WT_REGEX_XREF . ')@/', $fact->getGedcom(), $matches);
foreach ($matches[1] as $match) {
$media = WT_Media::getInstance($match);
diff --git a/modules_v3/logged_in/help_text.php b/modules_v3/logged_in/help_text.php
deleted file mode 100644
index 494fa37950..0000000000
--- a/modules_v3/logged_in/help_text.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-switch ($help) {
-}
diff --git a/modules_v3/logged_in/module.php b/modules_v3/logged_in/module.php
index 3df59b1a48..d408388010 100644
--- a/modules_v3/logged_in/module.php
+++ b/modules_v3/logged_in/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
use WT\User;
/**
@@ -37,7 +38,7 @@ class logged_in_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = $this->getTitle();
@@ -56,7 +57,7 @@ class logged_in_WT_Module extends WT_Module implements WT_Module_Block {
if ($anonymous) {
$content .= WT_I18N::plural('%d anonymous logged-in user', '%d anonymous logged-in users', $anonymous, $anonymous);
if ($count_logged_in) {
- $content .= '&nbsp;|&nbsp;';
+ $content .= '&nbsp;|&nbsp;';
}
}
if ($count_logged_in) {
@@ -69,7 +70,7 @@ class logged_in_WT_Module extends WT_Module implements WT_Module_Block {
$content .= '<div class="logged_in_name">';
$content .= WT_Filter::escapeHtml($user->getRealName()) . ' - ' . WT_Filter::escapeHtml($user->getUserName());
if (Auth::id() != $user->getUserId() && $user->getPreference('contactmethod') != 'none') {
- $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . WT_Filter::escapeJs($user->getUserName()) . '\', \'\', \'' . WT_Filter::escapeJs(get_query_url()) . '\');" title="' . WT_I18N::translate('Send a message').'"></a>';
+ $content .= ' <a class="icon-email" href="#" onclick="return message(\'' . WT_Filter::escapeJs($user->getUserName()) . '\', \'\', \'' . WT_Filter::escapeJs(get_query_url()) . '\');" title="' . WT_I18N::translate('Send a message') . '"></a>';
}
$content .= '</div>';
}
@@ -81,7 +82,7 @@ class logged_in_WT_Module extends WT_Module implements WT_Module_Block {
}
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/login_block/module.php b/modules_v3/login_block/module.php
index fb8f4bf442..625299246f 100644
--- a/modules_v3/login_block/module.php
+++ b/modules_v3/login_block/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class login_block_WT_Module
@@ -36,10 +37,10 @@ class login_block_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $controller;
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
$controller->addInlineJavascript('
jQuery("#new_passwd").hide();
jQuery("#passwd_click").click(function() {
@@ -53,56 +54,56 @@ class login_block_WT_Module extends WT_Module implements WT_Module_Block {
if (Auth::check()) {
$title = WT_I18N::translate('Logout');
$content = '<div class="center"><form method="post" action="logout.php" name="logoutform" onsubmit="return true;">';
- $content .= '<br><a href="edituser.php" class="name2">'.WT_I18N::translate('Logged in as ') . ' ' . WT_Filter::escapeHtml(Auth::user()->getRealName()) . '</a><br><br>';
+ $content .= '<br><a href="edituser.php" class="name2">' . WT_I18N::translate('Logged in as ') . ' ' . WT_Filter::escapeHtml(Auth::user()->getRealName()) . '</a><br><br>';
$content .= '<input type="submit" value="' . WT_I18N::translate('Logout') . '">';
$content .= '<br><br></form></div>';
} else {
$title = WT_I18N::translate('Login');
$content = '<div id="login-box">
- <form id="login-form" name="login-form" method="post" action="'. WT_LOGIN_URL. '" onsubmit="d=new Date(); this.timediff.value=d.getTimezoneOffset()*60;">
+ <form id="login-form" name="login-form" method="post" action="'. WT_LOGIN_URL . '" onsubmit="d=new Date(); this.timediff.value=d.getTimezoneOffset()*60;">
<input type="hidden" name="action" value="login">
<input type="hidden" name="timediff" value="">';
- $content.= '<div>
- <label for="username">'. WT_I18N::translate('Username').
+ $content .= '<div>
+ <label for="username">'. WT_I18N::translate('Username') .
'<input type="text" id="username" name="username" class="formField">
</label>
</div>
<div>
- <label for="password">'. WT_I18N::translate('Password').
+ <label for="password">'. WT_I18N::translate('Password') .
'<input type="password" id="password" name="password" class="formField">
</label>
</div>
<div>
- <input type="submit" value="'. WT_I18N::translate('Login'). '">
+ <input type="submit" value="'. WT_I18N::translate('Login') . '">
</div>
<div>
- <a href="#" id="passwd_click">'. WT_I18N::translate('Request new password').'</a>
+ <a href="#" id="passwd_click">'. WT_I18N::translate('Request new password') . '</a>
</div>';
if (WT_Site::getPreference('USE_REGISTRATION_MODULE')) {
- $content .= '<div><a href="'.WT_LOGIN_URL.'?action=register">'. WT_I18N::translate('Request new user account').'</a></div>';
+ $content .= '<div><a href="' . WT_LOGIN_URL . '?action=register">' . WT_I18N::translate('Request new user account') . '</a></div>';
}
$content .= '</form>'; // close "login-form"
// hidden New Password block
$content .= '<div id="new_passwd">
- <form id="new_passwd_form" name="new_passwd_form" action="'.WT_LOGIN_URL.'" method="post">
+ <form id="new_passwd_form" name="new_passwd_form" action="'.WT_LOGIN_URL . '" method="post">
<input type="hidden" name="time" value="">
<input type="hidden" name="action" value="requestpw">
- <h4>'. WT_I18N::translate('Lost password request').'</h4>
+ <h4>'. WT_I18N::translate('Lost password request') . '</h4>
<div>
- <label for="new_passwd_username">'. WT_I18N::translate('Username or email address').
+ <label for="new_passwd_username">'. WT_I18N::translate('Username or email address') .
'<input type="text" id="new_passwd_username" name="new_passwd_username" value="">
</label>
</div>
- <div><input type="submit" value="'. WT_I18N::translate('continue'). '"></div>
+ <div><input type="submit" value="'. WT_I18N::translate('continue') . '"></div>
</form>
</div>'; //"new_passwd"
- $content .= '</div>';//"login-box"
+ $content .= '</div>'; //"login-box"
}
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/marriage_report/module.php b/modules_v3/marriage_report/module.php
index 81008ba0c1..c6ea539351 100644
--- a/modules_v3/marriage_report/module.php
+++ b/modules_v3/marriage_report/module.php
@@ -42,13 +42,13 @@ class marriage_report_WT_Module extends WT_Module implements WT_Module_Report {
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/missing_facts_report/module.php b/modules_v3/missing_facts_report/module.php
index e4c98303be..b9115368d9 100644
--- a/modules_v3/missing_facts_report/module.php
+++ b/modules_v3/missing_facts_report/module.php
@@ -42,13 +42,13 @@ class missing_facts_report_WT_Module extends WT_Module implements WT_Module_Repo
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/notes/module.php b/modules_v3/notes/module.php
index df8744bde6..fd461a77d7 100644
--- a/modules_v3/notes/module.php
+++ b/modules_v3/notes/module.php
@@ -59,7 +59,7 @@ class notes_WT_Module extends WT_Module implements WT_Module_Tab {
?>
<tr>
<td colspan="2" class="descriptionbox rela">
- <input id="checkbox_note2" type="checkbox" <?php if ($SHOW_LEVEL2_NOTES) echo ' checked="checked"'; ?> onclick="jQuery('tr.row_note2').toggle();">
+ <input id="checkbox_note2" type="checkbox" <?php echo $SHOW_LEVEL2_NOTES ? 'checked' : ''; ?> onclick="jQuery('tr.row_note2').toggle();">
<label for="checkbox_note2"><?php echo WT_I18N::translate('Show all notes'); ?></label>
<?php echo help_link('show_fact_sources'); ?>
</td>
diff --git a/modules_v3/occupation_report/module.php b/modules_v3/occupation_report/module.php
index c15aecc8e3..f71257d22c 100644
--- a/modules_v3/occupation_report/module.php
+++ b/modules_v3/occupation_report/module.php
@@ -42,13 +42,13 @@ class occupation_report_WT_Module extends WT_Module implements WT_Module_Report
/** {@inheritdoc} */
public function getReportMenus() {
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml',
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/pedigree_report/module.php b/modules_v3/pedigree_report/module.php
index 2899f75907..96543327c8 100644
--- a/modules_v3/pedigree_report/module.php
+++ b/modules_v3/pedigree_report/module.php
@@ -44,13 +44,13 @@ class pedigree_report_WT_Module extends WT_Module implements WT_Module_Report {
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php
index 55b8130c41..00575d0d5f 100644
--- a/modules_v3/personal_facts/module.php
+++ b/modules_v3/personal_facts/module.php
@@ -118,16 +118,12 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
echo '<tr><td colspan="2" class="facts_value">', WT_I18N::translate('There are no facts for this individual.'), '</td></tr>';
}
- echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox"';
- if ($EXPAND_RELATIVES_EVENTS) {
- echo ' checked="checked"';
- }
+ echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
+ echo $EXPAND_RELATIVES_EVENTS ? 'checked' : '';
echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', WT_I18N::translate('Events of close relatives'), '</label>';
- if (file_exists(WT_Site::getPreference('INDEX_DIRECTORY').'histo.'.WT_LOCALE.'.php')) {
- echo ' <input id="checkbox_histo" type="checkbox"';
- if ($EXPAND_HISTO_EVENTS) {
- echo ' checked="checked"';
- }
+ if (file_exists(WT_Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
+ echo ' <input id="checkbox_histo" type="checkbox" ';
+ echo $EXPAND_HISTO_EVENTS ? 'checked' : '';
echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', WT_I18N::translate('Historical facts'), '</label>';
}
echo '</form></td></tr>';
@@ -151,7 +147,7 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
- return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
+ return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
}
/** {@inheritdoc} */
@@ -191,10 +187,10 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
foreach ($spouse->getFacts(WT_EVENTS_DEAT) as $fact) {
$fact_date = $fact->getDate();
- if ($fact_date->isOK() && WT_Date::Compare($birt_date, $fact_date)<=0 && WT_Date::Compare($fact_date, $deat_date)<=0) {
+ if ($fact_date->isOK() && WT_Date::Compare($birt_date, $fact_date) <= 0 && WT_Date::Compare($fact_date, $deat_date) <= 0) {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_SPOU');
+ $rela_fact->setTag('_' . $fact->getTag() . '_SPOU');
$facts[] = $rela_fact;
}
}
@@ -252,22 +248,22 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
// For each child in the family
foreach ($family->getChildren() as $child) {
- if ($child->getXref()==$person->getXref()) {
+ if ($child->getXref() == $person->getXref()) {
// We are not our own sibling!
continue;
}
// add child’s birth
- if (strpos($SHOW_RELATIVES_EVENTS, '_BIRT'.str_replace('_HSIB', '_SIBL', $option))!==false) {
+ if (strpos($SHOW_RELATIVES_EVENTS, '_BIRT' . str_replace('_HSIB', '_SIBL', $option)) !== false) {
foreach ($child->getFacts(WT_EVENTS_BIRT) as $fact) {
- $sgdate=$fact->getDate();
+ $sgdate = $fact->getDate();
// Always show _BIRT_CHIL, even if the dates are not known
- if ($option=='_CHIL' || $sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate)<=0 && WT_Date::Compare($sgdate, $deat_date)<=0) {
- if ($option=='_GCHI' && $relation=='dau') {
+ if ($option == '_CHIL' || $sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate) <= 0 && WT_Date::Compare($sgdate, $deat_date) <= 0) {
+ if ($option == '_GCHI' && $relation == 'dau') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
$facts[] = $rela_fact;
- } elseif ($option=='_GCHI' && $relation=='son') {
+ } elseif ($option == '_GCHI' && $relation == 'son') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
@@ -282,16 +278,16 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
// add child’s death
- if (strpos($SHOW_RELATIVES_EVENTS, '_DEAT'.str_replace('_HSIB', '_SIBL', $option))!==false) {
+ if (strpos($SHOW_RELATIVES_EVENTS, '_DEAT' . str_replace('_HSIB', '_SIBL', $option)) !== false) {
foreach ($child->getFacts(WT_EVENTS_DEAT) as $fact) {
- $sgdate=$fact->getDate();
- if ($sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate)<=0 && WT_Date::Compare($sgdate, $deat_date)<=0) {
- if ($option=='_GCHI' && $relation=='dau') {
+ $sgdate = $fact->getDate();
+ if ($sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate) <= 0 && WT_Date::Compare($sgdate, $deat_date) <= 0) {
+ if ($option == '_GCHI' && $relation == 'dau') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
$facts[] = $rela_fact;
- } elseif ($option=='_GCHI' && $relation=='son') {
+ } elseif ($option == '_GCHI' && $relation == 'son') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
@@ -306,17 +302,17 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
// add child’s marriage
- if (strstr($SHOW_RELATIVES_EVENTS, '_MARR'.str_replace('_HSIB', '_SIBL', $option))) {
+ if (strstr($SHOW_RELATIVES_EVENTS, '_MARR' . str_replace('_HSIB', '_SIBL', $option))) {
foreach ($child->getSpouseFamilies() as $sfamily) {
foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
- $sgdate=$fact->getDate();
- if ($sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate)<=0 && WT_Date::Compare($sgdate, $deat_date)<=0) {
- if ($option=='_GCHI' && $relation=='dau') {
+ $sgdate = $fact->getDate();
+ if ($sgdate->isOK() && WT_Date::Compare($birt_date, $sgdate) <= 0 && WT_Date::Compare($sgdate, $deat_date) <= 0) {
+ if ($option == '_GCHI' && $relation == 'dau') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH1');
$facts[] = $rela_fact;
- } elseif ($option=='_GCHI' && $relation=='son') {
+ } elseif ($option == '_GCHI' && $relation == 'son') {
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
$rela_fact->setTag('_' . $fact->getTag() . '_GCH2');
@@ -369,7 +365,7 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
}
// Add grandparents
- foreach (self::parentFacts($spouse, $spouse->getSex()=='F' ? 3 : 2) as $fact) {
+ foreach (self::parentFacts($spouse, $spouse->getSex() == 'F' ? 3 : 2) as $fact) {
$facts[] = $fact;
}
}
@@ -379,21 +375,21 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
// add father/mother marriages
foreach ($person->getChildFamilies() as $sfamily) {
foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
- if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
+ if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate()) <= 0 && WT_Date::Compare($fact->getDate(), $deat_date) <= 0) {
// marriage of parents (to each other)
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_FAMC');
+ $rela_fact->setTag('_' . $fact->getTag() . '_FAMC');
$facts[] = $rela_fact;
}
}
}
foreach ($person->getChildStepFamilies() as $sfamily) {
foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) {
- if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
+ if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate()) <= 0 && WT_Date::Compare($fact->getDate(), $deat_date) <= 0) {
// marriage of a parent (to another spouse)
// Convert the event to a close relatives event
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_PARE');
+ $rela_fact->setTag('_' . $fact->getTag() . '_PARE');
$facts[] = $rela_fact;
}
}
@@ -403,26 +399,26 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
foreach ($person->getChildFamilies() as $family) {
foreach ($family->getSpouses() as $parent) {
- if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT'.($sosa==1 ? '_PARE' : '_GPAR'))) {
+ if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT' . ($sosa == 1 ? '_PARE' : '_GPAR'))) {
foreach ($parent->getFacts(WT_EVENTS_DEAT) as $fact) {
- if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate())<=0 && WT_Date::Compare($fact->getDate(), $deat_date)<=0) {
+ if ($fact->getDate()->isOK() && WT_Date::Compare($birt_date, $fact->getDate()) <= 0 && WT_Date::Compare($fact->getDate(), $deat_date) <= 0) {
switch ($sosa) {
case 1:
// Convert the event to a close relatives event.
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_PARE');
+ $rela_fact->setTag('_' . $fact->getTag() . '_PARE');
$facts[] = $rela_fact;
break;
case 2:
// Convert the event to a close relatives event
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_GPA1');
+ $rela_fact->setTag('_' . $fact->getTag() . '_GPA1');
$facts[] = $rela_fact;
break;
case 3:
// Convert the event to a close relatives event
$rela_fact = clone($fact);
- $rela_fact->setTag('_'.$fact->getTag().'_GPA2');
+ $rela_fact->setTag('_' . $fact->getTag() . '_GPA2');
$facts[] = $rela_fact;
break;
}
@@ -461,7 +457,7 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
$fact = new WT_Fact($hist, $person, 'histo');
$sdate = $fact->getDate();
- if ($sdate->isOK() && WT_Date::Compare($birt_date, $sdate)<=0 && WT_Date::Compare($sdate, $deat_date)<=0) {
+ if ($sdate->isOK() && WT_Date::Compare($birt_date, $sdate) <= 0 && WT_Date::Compare($sdate, $deat_date) <= 0) {
$facts[] = $fact;
}
}
@@ -481,7 +477,7 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
private static function associateFacts(WT_Individual $person) {
$facts = array();
- $associates=array_merge(
+ $associates = array_merge(
$person->linkedIndividuals('ASSO'),
$person->linkedIndividuals('_ASSO'),
$person->linkedFamilies('ASSO'),
@@ -495,21 +491,21 @@ class personal_facts_WT_Module extends WT_Module implements WT_Module_Tab {
}
if ($arec && trim($arec, '@') === $person->getXref()) {
// Extract the important details from the fact
- $factrec='1 '.$fact->getTag();
+ $factrec = '1 ' . $fact->getTag();
if (preg_match('/\n2 DATE .*/', $fact->getGedcom(), $match)) {
- $factrec.=$match[0];
+ $factrec .= $match[0];
}
if (preg_match('/\n2 PLAC .*/', $fact->getGedcom(), $match)) {
- $factrec.=$match[0];
+ $factrec .= $match[0];
}
if ($associate instanceof WT_Family) {
foreach ($associate->getSpouses() as $spouse) {
- $factrec.="\n2 _ASSO @".$spouse->getXref().'@';
+ $factrec .= "\n2 _ASSO @" . $spouse->getXref() . '@';
}
} else {
- $factrec.="\n2 _ASSO @".$associate->getXref().'@';
+ $factrec .= "\n2 _ASSO @" . $associate->getXref() . '@';
// CHR/BAPM events are commonly used. Generate the reverse relationship
- if (preg_match('/^(?:BAPM|CHR)$/', $fact->getTag()) && preg_match('/2 _?ASSO @('.$person->getXref().')@\n3 RELA god(?:parent|mother|father)/', $fact->getGedcom())) {
+ if (preg_match('/^(?:BAPM|CHR)$/', $fact->getTag()) && preg_match('/2 _?ASSO @(' . $person->getXref() . ')@\n3 RELA god(?:parent|mother|father)/', $fact->getGedcom())) {
switch ($associate->getSex()) {
case 'M':
$factrec .= "\n3 RELA godson";
diff --git a/modules_v3/random_media/module.php b/modules_v3/random_media/module.php
index 94f8d68438..b54f336004 100644
--- a/modules_v3/random_media/module.php
+++ b/modules_v3/random_media/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class random_media_WT_Module
@@ -36,70 +37,69 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- $filter =get_block_setting($block_id, 'filter', 'all');
- $controls=get_block_setting($block_id, 'controls', true);
- $start =get_block_setting($block_id, 'start', false) || WT_Filter::getBool('start');
- $block =get_block_setting($block_id, 'block', true);
+ $filter = get_block_setting($block_id, 'filter', 'all');
+ $controls = get_block_setting($block_id, 'controls', '1');
+ $start = get_block_setting($block_id, 'start', '0') || WT_Filter::getBool('start');
// We can apply the filters using SQL
// Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead.
- $all_media=WT_DB::prepare(
+ $all_media = WT_DB::prepare(
"SELECT m_id FROM `##media`" .
" WHERE m_file = ?" .
" AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" .
" AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')"
)->execute(array(
WT_GED_ID,
- get_block_setting($block_id, 'filter_avi', false) ? 'avi' : NULL,
- get_block_setting($block_id, 'filter_bmp', true ) ? 'bmp' : NULL,
- get_block_setting($block_id, 'filter_gif', true ) ? 'gif' : NULL,
- get_block_setting($block_id, 'filter_jpeg', true ) ? 'jpg' : NULL,
- get_block_setting($block_id, 'filter_jpeg', true ) ? 'jpeg' : NULL,
- get_block_setting($block_id, 'filter_mp3', false) ? 'mp3' : NULL,
- get_block_setting($block_id, 'filter_ole', true ) ? 'ole' : NULL,
- get_block_setting($block_id, 'filter_pcx', true ) ? 'pcx' : NULL,
- get_block_setting($block_id, 'filter_pdf', false) ? 'pdf' : NULL,
- get_block_setting($block_id, 'filter_png', true ) ? 'png' : NULL,
- get_block_setting($block_id, 'filter_tiff', true ) ? 'tiff' : NULL,
- get_block_setting($block_id, 'filter_wav', false) ? 'wav' : NULL,
- get_block_setting($block_id, 'filter_audio', false) ? 'audio' : NULL,
- get_block_setting($block_id, 'filter_book', true ) ? 'book' : NULL,
- get_block_setting($block_id, 'filter_card', true ) ? 'card' : NULL,
- get_block_setting($block_id, 'filter_certificate', true ) ? 'certificate' : NULL,
- get_block_setting($block_id, 'filter_coat', true ) ? 'coat' : NULL,
- get_block_setting($block_id, 'filter_document', true ) ? 'document' : NULL,
- get_block_setting($block_id, 'filter_electronic', true ) ? 'electronic' : NULL,
- get_block_setting($block_id, 'filter_fiche', true ) ? 'fiche' : NULL,
- get_block_setting($block_id, 'filter_film', true ) ? 'film' : NULL,
- get_block_setting($block_id, 'filter_magazine', true ) ? 'magazine' : NULL,
- get_block_setting($block_id, 'filter_manuscript', true ) ? 'manuscript' : NULL,
- get_block_setting($block_id, 'filter_map', true ) ? 'map' : NULL,
- get_block_setting($block_id, 'filter_newspaper', true ) ? 'newspaper' : NULL,
- get_block_setting($block_id, 'filter_other', true ) ? 'other' : NULL,
- get_block_setting($block_id, 'filter_painting', true ) ? 'painting' : NULL,
- get_block_setting($block_id, 'filter_photo', true ) ? 'photo' : NULL,
- get_block_setting($block_id, 'filter_tombstone', true ) ? 'tombstone' : NULL,
- get_block_setting($block_id, 'filter_video', false) ? 'video' : NULL,
+ get_block_setting($block_id, 'filter_avi', '0') ? 'avi' : null,
+ get_block_setting($block_id, 'filter_bmp', '1') ? 'bmp' : null,
+ get_block_setting($block_id, 'filter_gif', '1') ? 'gif' : null,
+ get_block_setting($block_id, 'filter_jpeg', '1') ? 'jpg' : null,
+ get_block_setting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null,
+ get_block_setting($block_id, 'filter_mp3', '0') ? 'mp3' : null,
+ get_block_setting($block_id, 'filter_ole', '1') ? 'ole' : null,
+ get_block_setting($block_id, 'filter_pcx', '1') ? 'pcx' : null,
+ get_block_setting($block_id, 'filter_pdf', '0') ? 'pdf' : null,
+ get_block_setting($block_id, 'filter_png', '1') ? 'png' : null,
+ get_block_setting($block_id, 'filter_tiff', '1') ? 'tiff' : null,
+ get_block_setting($block_id, 'filter_wav', '0') ? 'wav' : null,
+ get_block_setting($block_id, 'filter_audio', '0') ? 'audio' : null,
+ get_block_setting($block_id, 'filter_book', '1') ? 'book' : null,
+ get_block_setting($block_id, 'filter_card', '1') ? 'card' : null,
+ get_block_setting($block_id, 'filter_certificate', '1') ? 'certificate' : null,
+ get_block_setting($block_id, 'filter_coat', '1') ? 'coat' : null,
+ get_block_setting($block_id, 'filter_document', '1') ? 'document' : null,
+ get_block_setting($block_id, 'filter_electronic', '1') ? 'electronic' : null,
+ get_block_setting($block_id, 'filter_fiche', '1') ? 'fiche' : null,
+ get_block_setting($block_id, 'filter_film', '1') ? 'film' : null,
+ get_block_setting($block_id, 'filter_magazine', '1') ? 'magazine' : null,
+ get_block_setting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null,
+ get_block_setting($block_id, 'filter_map', '1') ? 'map' : null,
+ get_block_setting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null,
+ get_block_setting($block_id, 'filter_other', '1') ? 'other' : null,
+ get_block_setting($block_id, 'filter_painting', '1') ? 'painting' : null,
+ get_block_setting($block_id, 'filter_photo', '1') ? 'photo' : null,
+ get_block_setting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null,
+ get_block_setting($block_id, 'filter_video', '0') ? 'video' : null,
))->fetchOneColumn();
// Keep looking through the media until a suitable one is found.
- $random_media=null;
+ $random_media = null;
while ($all_media) {
- $n=array_rand($all_media);
- $media=WT_Media::getInstance($all_media[$n]);
+ $n = array_rand($all_media);
+ $media = WT_Media::getInstance($all_media[$n]);
if ($media->canShow() && !$media->isExternal()) {
// Check if it is linked to a suitable individual
foreach ($media->linkedIndividuals('OBJE') as $indi) {
if (
$filter === 'all' ||
- $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !==false ||
- $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !==false
+ $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false ||
+ $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false
) {
// Found one :-)
- $random_media=$media;
+ $random_media = $media;
break 2;
}
}
@@ -107,14 +107,14 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
unset($all_media[$n]);
};
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title='<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
- $title='';
+ $title = '';
}
- $title.=$this->getTitle();
+ $title .= $this->getTitle();
if ($random_media) {
$content = "<div id=\"random_picture_container$block_id\">";
@@ -124,9 +124,9 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
} else {
$icon_class = 'icon-media-play';
}
- $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id .'"><br>';
- $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"".$icon_class."\" title=\"".WT_I18N::translate('Play')."/".WT_I18N::translate('Stop').'"></a>';
- $content .= '<a href="#" onclick="jQuery(\'#block_'.$block_id.'\').load(\'index.php?ctype='.$ctype.'&amp;action=ajax&amp;block_id='.$block_id.'\');return false;" title="'.WT_I18N::translate('Next image').'" class="icon-media-next"></a>';
+ $content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>';
+ $content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . WT_I18N::translate('Play') . "/" . WT_I18N::translate('Stop') . '"></a>';
+ $content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&amp;action=ajax&amp;block_id=' . $block_id . '\');return false;" title="' . WT_I18N::translate('Next image') . '" class="icon-media-next"></a>';
$content .= '</div><script>
var play = false;
function togglePlay() {
@@ -148,7 +148,7 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
}
function reload_image() {
if (play) {
- jQuery("#block_'.$block_id.'").load("index.php?ctype='.$ctype.'&action=ajax&block_id='.$block_id.'&start=1");
+ jQuery("#block_'.$block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1");
}
}
</script>';
@@ -156,31 +156,20 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
if ($start) {
$content .= '<script>togglePlay();</script>';
}
- $content .= '<div class="center" id="random_picture_content'.$block_id.'">';
- $content .= '<table id="random_picture_box"><tr><td';
-
- if ($block) {
- $content .= ' class="details1"';
- } else {
- $content .= ' class="details2"';
- }
- $content .= ' >';
+ $content .= '<div class="center" id="random_picture_content' . $block_id . '">';
+ $content .= '<table id="random_picture_box"><tr><td class="details1">';
$content .= $random_media->displayImage();
- if ($block) {
- $content .= '<br>';
- } else {
- $content .= '</td><td class="details2">';
- }
- $content .= '<a href="'.$random_media->getHtmlUrl().'"><b>'. $random_media->getFullName() .'</b></a><br>';
+ $content .= '<br>';
+ $content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
foreach ($random_media->linkedIndividuals('OBJE') as $individual) {
- $content .= '<a href="' . $individual->getHtmlUrl() . '">' . WT_I18N::translate('View person') . ' — ' . $individual->getFullname().'</a><br>';
+ $content .= '<a href="' . $individual->getHtmlUrl() . '">' . WT_I18N::translate('View person') . ' — ' . $individual->getFullname() . '</a><br>';
}
foreach ($random_media->linkedFamilies('OBJE') as $family) {
- $content .= '<a href="' . $family->getHtmlUrl() . '">' . WT_I18N::translate('View family') . ' — ' . $family->getFullname().'</a><br>';
+ $content .= '<a href="' . $family->getHtmlUrl() . '">' . WT_I18N::translate('View family') . ' — ' . $family->getFullname() . '</a><br>';
}
foreach ($random_media->linkedSources('OBJE') as $source) {
- $content .= '<a href="' . $source->getHtmlUrl() . '">' . WT_I18N::translate('View source') . ' — ' . $source->getFullname().'</a><br>';
+ $content .= '<a href="' . $source->getHtmlUrl() . '">' . WT_I18N::translate('View source') . ' — ' . $source->getFullname() . '</a><br>';
}
$content .= '<br><div class="indent">';
$content .= print_fact_notes($random_media->getGedcom(), "1", false);
@@ -192,7 +181,7 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
$content = WT_I18N::translate('This family tree has no images to display.');
}
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ echo Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -216,166 +205,199 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'filter', WT_Filter::post('filter', 'indi|event|all', 'all'));
- set_block_setting($block_id, 'controls', WT_Filter::postBool('controls'));
- set_block_setting($block_id, 'start', WT_Filter::postBool('start'));
- set_block_setting($block_id, 'filter_avi', WT_Filter::postBool('filter_avi'));
- set_block_setting($block_id, 'filter_bmp', WT_Filter::postBool('filter_bmp'));
- set_block_setting($block_id, 'filter_gif', WT_Filter::postBool('filter_gif'));
- set_block_setting($block_id, 'filter_jpeg', WT_Filter::postBool('filter_jpeg'));
- set_block_setting($block_id, 'filter_mp3', WT_Filter::postBool('filter_mp3'));
- set_block_setting($block_id, 'filter_ole', WT_Filter::postBool('filter_ole'));
- set_block_setting($block_id, 'filter_pcx', WT_Filter::postBool('filter_pcx'));
- set_block_setting($block_id, 'filter_pdf', WT_Filter::postBool('filter_pdf'));
- set_block_setting($block_id, 'filter_png', WT_Filter::postBool('filter_png'));
- set_block_setting($block_id, 'filter_tiff', WT_Filter::postBool('filter_tiff'));
- set_block_setting($block_id, 'filter_wav', WT_Filter::postBool('filter_wav'));
- set_block_setting($block_id, 'filter_audio', WT_Filter::postBool('filter_audio'));
- set_block_setting($block_id, 'filter_book', WT_Filter::postBool('filter_book'));
- set_block_setting($block_id, 'filter_card', WT_Filter::postBool('filter_card'));
+ set_block_setting($block_id, 'filter', WT_Filter::post('filter', 'indi|event|all', 'all'));
+ set_block_setting($block_id, 'controls', WT_Filter::postBool('controls'));
+ set_block_setting($block_id, 'start', WT_Filter::postBool('start'));
+ set_block_setting($block_id, 'filter_avi', WT_Filter::postBool('filter_avi'));
+ set_block_setting($block_id, 'filter_bmp', WT_Filter::postBool('filter_bmp'));
+ set_block_setting($block_id, 'filter_gif', WT_Filter::postBool('filter_gif'));
+ set_block_setting($block_id, 'filter_jpeg', WT_Filter::postBool('filter_jpeg'));
+ set_block_setting($block_id, 'filter_mp3', WT_Filter::postBool('filter_mp3'));
+ set_block_setting($block_id, 'filter_ole', WT_Filter::postBool('filter_ole'));
+ set_block_setting($block_id, 'filter_pcx', WT_Filter::postBool('filter_pcx'));
+ set_block_setting($block_id, 'filter_pdf', WT_Filter::postBool('filter_pdf'));
+ set_block_setting($block_id, 'filter_png', WT_Filter::postBool('filter_png'));
+ set_block_setting($block_id, 'filter_tiff', WT_Filter::postBool('filter_tiff'));
+ set_block_setting($block_id, 'filter_wav', WT_Filter::postBool('filter_wav'));
+ set_block_setting($block_id, 'filter_audio', WT_Filter::postBool('filter_audio'));
+ set_block_setting($block_id, 'filter_book', WT_Filter::postBool('filter_book'));
+ set_block_setting($block_id, 'filter_card', WT_Filter::postBool('filter_card'));
set_block_setting($block_id, 'filter_certificate', WT_Filter::postBool('filter_certificate'));
- set_block_setting($block_id, 'filter_coat', WT_Filter::postBool('filter_coat'));
- set_block_setting($block_id, 'filter_document', WT_Filter::postBool('filter_document'));
- set_block_setting($block_id, 'filter_electronic', WT_Filter::postBool('filter_electronic'));
- set_block_setting($block_id, 'filter_fiche', WT_Filter::postBool('filter_fiche'));
- set_block_setting($block_id, 'filter_film', WT_Filter::postBool('filter_film'));
- set_block_setting($block_id, 'filter_magazine', WT_Filter::postBool('filter_magazine'));
- set_block_setting($block_id, 'filter_manuscript', WT_Filter::postBool('filter_manuscript'));
- set_block_setting($block_id, 'filter_map', WT_Filter::postBool('filter_map'));
- set_block_setting($block_id, 'filter_newspaper', WT_Filter::postBool('filter_newspaper'));
- set_block_setting($block_id, 'filter_other', WT_Filter::postBool('filter_other'));
- set_block_setting($block_id, 'filter_painting', WT_Filter::postBool('filter_painting'));
- set_block_setting($block_id, 'filter_photo', WT_Filter::postBool('filter_photo'));
- set_block_setting($block_id, 'filter_tombstone', WT_Filter::postBool('filter_tombstone'));
- set_block_setting($block_id, 'filter_video', WT_Filter::postBool('filter_video'));
- exit;
+ set_block_setting($block_id, 'filter_coat', WT_Filter::postBool('filter_coat'));
+ set_block_setting($block_id, 'filter_document', WT_Filter::postBool('filter_document'));
+ set_block_setting($block_id, 'filter_electronic', WT_Filter::postBool('filter_electronic'));
+ set_block_setting($block_id, 'filter_fiche', WT_Filter::postBool('filter_fiche'));
+ set_block_setting($block_id, 'filter_film', WT_Filter::postBool('filter_film'));
+ set_block_setting($block_id, 'filter_magazine', WT_Filter::postBool('filter_magazine'));
+ set_block_setting($block_id, 'filter_manuscript', WT_Filter::postBool('filter_manuscript'));
+ set_block_setting($block_id, 'filter_map', WT_Filter::postBool('filter_map'));
+ set_block_setting($block_id, 'filter_newspaper', WT_Filter::postBool('filter_newspaper'));
+ set_block_setting($block_id, 'filter_other', WT_Filter::postBool('filter_other'));
+ set_block_setting($block_id, 'filter_painting', WT_Filter::postBool('filter_painting'));
+ set_block_setting($block_id, 'filter_photo', WT_Filter::postBool('filter_photo'));
+ set_block_setting($block_id, 'filter_tombstone', WT_Filter::postBool('filter_tombstone'));
+ set_block_setting($block_id, 'filter_video', WT_Filter::postBool('filter_video'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+
+ $filter = get_block_setting($block_id, 'filter', 'all');
+ $controls = get_block_setting($block_id, 'controls', '1');
+ $start = get_block_setting($block_id, 'start', '0') || WT_Filter::getBool('start');
- $filter=get_block_setting($block_id, 'filter', 'all');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show only individuals, events, or all?');
echo '</td><td class="optionbox">';
echo select_edit_control('filter', array('indi'=>WT_I18N::translate('Individuals'), 'event'=>WT_I18N::translate('Facts and events'), 'all'=>WT_I18N::translate('All')), null, $filter, '');
echo '</td></tr>';
- $filters=array(
- 'avi' =>get_block_setting($block_id, 'filter_avi', false),
- 'bmp' =>get_block_setting($block_id, 'filter_bmp', true),
- 'gif' =>get_block_setting($block_id, 'filter_gif', true),
- 'jpeg' =>get_block_setting($block_id, 'filter_jpeg', true),
- 'mp3' =>get_block_setting($block_id, 'filter_mp3', false),
- 'ole' =>get_block_setting($block_id, 'filter_ole', true),
- 'pcx' =>get_block_setting($block_id, 'filter_pcx', true),
- 'pdf' =>get_block_setting($block_id, 'filter_pdf', false),
- 'png' =>get_block_setting($block_id, 'filter_png', true),
- 'tiff' =>get_block_setting($block_id, 'filter_tiff', true),
- 'wav' =>get_block_setting($block_id, 'filter_wav', false),
- 'audio' =>get_block_setting($block_id, 'filter_audio', false),
- 'book' =>get_block_setting($block_id, 'filter_book', true),
- 'card' =>get_block_setting($block_id, 'filter_card', true),
- 'certificate'=>get_block_setting($block_id, 'filter_certificate', true),
- 'coat' =>get_block_setting($block_id, 'filter_coat', true),
- 'document' =>get_block_setting($block_id, 'filter_document', true),
- 'electronic' =>get_block_setting($block_id, 'filter_electronic', true),
- 'fiche' =>get_block_setting($block_id, 'filter_fiche', true),
- 'film' =>get_block_setting($block_id, 'filter_film', true),
- 'magazine' =>get_block_setting($block_id, 'filter_magazine', true),
- 'manuscript' =>get_block_setting($block_id, 'filter_manuscript', true),
- 'map' =>get_block_setting($block_id, 'filter_map', true),
- 'newspaper' =>get_block_setting($block_id, 'filter_newspaper', true),
- 'other' =>get_block_setting($block_id, 'filter_other', true),
- 'painting' =>get_block_setting($block_id, 'filter_painting', true),
- 'photo' =>get_block_setting($block_id, 'filter_photo', true),
- 'tombstone' =>get_block_setting($block_id, 'filter_tombstone', true),
- 'video' =>get_block_setting($block_id, 'filter_video', false),
+ $filters = array(
+ 'avi' =>get_block_setting($block_id, 'filter_avi', '0'),
+ 'bmp' =>get_block_setting($block_id, 'filter_bmp', '1'),
+ 'gif' =>get_block_setting($block_id, 'filter_gif', '1'),
+ 'jpeg' =>get_block_setting($block_id, 'filter_jpeg', '1'),
+ 'mp3' =>get_block_setting($block_id, 'filter_mp3', '0'),
+ 'ole' =>get_block_setting($block_id, 'filter_ole', '1'),
+ 'pcx' =>get_block_setting($block_id, 'filter_pcx', '1'),
+ 'pdf' =>get_block_setting($block_id, 'filter_pdf', '0'),
+ 'png' =>get_block_setting($block_id, 'filter_png', '1'),
+ 'tiff' =>get_block_setting($block_id, 'filter_tiff', '1'),
+ 'wav' =>get_block_setting($block_id, 'filter_wav', '0'),
+ 'audio' =>get_block_setting($block_id, 'filter_audio', '0'),
+ 'book' =>get_block_setting($block_id, 'filter_book', '1'),
+ 'card' =>get_block_setting($block_id, 'filter_card', '1'),
+ 'certificate'=>get_block_setting($block_id, 'filter_certificate', '1'),
+ 'coat' =>get_block_setting($block_id, 'filter_coat', '1'),
+ 'document' =>get_block_setting($block_id, 'filter_document', '1'),
+ 'electronic' =>get_block_setting($block_id, 'filter_electronic', '1'),
+ 'fiche' =>get_block_setting($block_id, 'filter_fiche', '1'),
+ 'film' =>get_block_setting($block_id, 'filter_film', '1'),
+ 'magazine' =>get_block_setting($block_id, 'filter_magazine', '1'),
+ 'manuscript' =>get_block_setting($block_id, 'filter_manuscript', '1'),
+ 'map' =>get_block_setting($block_id, 'filter_map', '1'),
+ 'newspaper' =>get_block_setting($block_id, 'filter_newspaper', '1'),
+ 'other' =>get_block_setting($block_id, 'filter_other', '1'),
+ 'painting' =>get_block_setting($block_id, 'filter_painting', '1'),
+ 'photo' =>get_block_setting($block_id, 'filter_photo', '1'),
+ 'tombstone' =>get_block_setting($block_id, 'filter_tombstone', '1'),
+ 'video' =>get_block_setting($block_id, 'filter_video', '0'),
);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Filter');
-?>
+ ?>
</td>
- <td class="optionbox">
- <center><b><?php echo WT_Gedcom_Tag::getLabel('FORM'); ?></b></center>
- <table class="width100">
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_avi"
- <?php if ($filters['avi']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;avi&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_bmp"
- <?php if ($filters['bmp']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;bmp&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_gif"
- <?php if ($filters['gif']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;gif&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_jpeg"
- <?php if ($filters['jpeg']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;jpeg&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_mp3"
- <?php if ($filters['mp3']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;mp3&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_ole"
- <?php if ($filters['ole']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;ole&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_pcx"
- <?php if ($filters['pcx']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;pcx&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_pdf"
- <?php if ($filters['pdf']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;pdf&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_png"
- <?php if ($filters['png']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;png&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_tiff"
- <?php if ($filters['tiff']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;tiff&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_wav"
- <?php if ($filters['wav']) echo " checked=\"checked\""; ?>>&nbsp;&nbsp;wav&nbsp;&nbsp;</td>
- <td class="width33">&nbsp;</td>
- <td class="width33">&nbsp;</td>
- </tr>
- </table>
+ <td class="optionbox">
+ <center><b><?php echo WT_Gedcom_Tag::getLabel('FORM'); ?></b></center>
+ <table class="width100">
+ <tr>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_avi" <?php echo $filters['avi'] ? 'checked' : ''; ?>>
+ avi
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_bmp" <?php echo $filters['bmp'] ? 'checked' : ''; ?>>
+ bmp
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_gif" <?php echo $filters['gif'] ? 'checked' : ''; ?>>
+ gif
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_jpeg" <?php echo $filters['jpeg'] ? 'checked' : ''; ?>>
+ jpeg
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_mp3" <?php echo $filters['mp3'] ? 'checked' : ''; ?>>
+ mp3
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_ole" <?php echo $filters['ole'] ? 'checked' : ''; ?>>
+ ole
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_pcx" <?php echo $filters['pcx'] ? 'checked' : ''; ?>>
+ pcx
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_pdf" <?php echo $filters['pdf'] ? 'checked' : ''; ?>>
+ pdf
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_png" <?php echo $filters['png'] ? 'checked' : ''; ?>>
+ png
+ </label>
+ </td>
+ </tr>
+ <tr>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_tiff" <?php echo $filters['tiff'] ? 'checked' : ''; ?>>
+ tiff
+ </label>
+ </td>
+ <td class="width33">
+ <label>
+ <input type="checkbox" value="yes" name="filter_wav" <?php echo $filters['wav'] ? 'checked' : ''; ?>>
+ wav
+ </label>
+ </td>
+ <td class="width33"></td>
+ <td class="width33"></td>
+ </tr>
+ </table>
<br>
<center><b><?php echo WT_Gedcom_Tag::getLabel('TYPE'); ?></b></center>
- <table class="width100">
- <tr>
- <?php
- //-- Build the list of checkboxes
- $i = 0;
- foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) {
- $i++;
- if ($i > 3) {
- $i = 1;
- echo "</tr><tr>";
+ <table class="width100">
+ <tr>
+ <?php
+ //-- Build the list of checkboxes
+ $i = 0;
+ foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) {
+ $i++;
+ if ($i > 3) {
+ $i = 1;
+ echo '</tr><tr>';
+ }
+ echo '<td class="width33"><label><input type="checkbox" value="yes" name="filter_' . $typeName . '" ';
+ echo ($filters[$typeName]) ? 'checked' : '';
+ echo '> ' . $typeValue . '</label></td>';
}
- echo "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_".$typeName."\"";
- if ($filters[$typeName]) echo " checked=\"checked\"";
- echo ">&nbsp;&nbsp;".$typeValue."&nbsp;&nbsp;</td>";
- }
- ?>
+ ?>
</tr>
</table>
- </td>
+ </td>
</tr>
<?php
- $controls=get_block_setting($block_id, 'controls', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show slide show controls?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('controls', $controls);
echo '</td></tr>';
- $start=get_block_setting($block_id, 'start', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Start slide show on page load?');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/recent_changes/module.php b/modules_v3/recent_changes/module.php
index edca0c13bd..4028db55ae 100644
--- a/modules_v3/recent_changes/module.php
+++ b/modules_v3/recent_changes/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class recent_changes_WT_Module
@@ -39,17 +40,19 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+ require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
+
+ $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
+ $block = get_block_setting($block_id, 'block', '1');
+ $hide_empty = get_block_setting($block_id, 'hide_empty', '0');
+
- $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
- $hide_empty = get_block_setting($block_id, 'hide_empty', false);
- $block = get_block_setting($block_id, 'block', true);
if ($cfg) {
- foreach (array('days', 'infoStyle', 'show_parents', 'sortStyle', 'hide_empty', 'block') as $name) {
+ foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
$$name = $cfg[$name];
}
@@ -65,7 +68,7 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
@@ -78,23 +81,22 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
} else {
ob_start();
switch ($infoStyle) {
- case 'list':
- $content .= print_changes_list($found_facts, $sortStyle);
- break;
- case 'table':
- // sortable table
- $content .= print_changes_table($found_facts, $sortStyle);
- break;
+ case 'list':
+ $content .= print_changes_list($found_facts, $sortStyle);
+ break;
+ case 'table':
+ // sortable table
+ $content .= print_changes_table($found_facts, $sortStyle);
+ break;
}
$content .= ob_get_clean();
}
if ($template) {
if ($block) {
- require WT_THEME_DIR . 'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -118,17 +120,21 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
- set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
+ set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, self::MAX_DAYS, self::DEFAULT_DAYS));
+ set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
+ set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'name|date_asc|date_desc', 'date_desc'));
set_block_setting($block_id, 'hide_empty', WT_Filter::postBool('hide_empty'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
+ $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS);
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc');
+ $block = get_block_setting($block_id, 'block', '1');
+ $hide_empty = get_block_setting($block_id, 'hide_empty', '0');
+
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of days to show');
echo '</td><td class="optionbox">';
@@ -136,14 +142,12 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', self::MAX_DAYS, self::MAX_DAYS), '</em>';
echo '</td></tr>';
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('list'), 'table' => WT_I18N::translate('table')), null, $infoStyle, '');
echo '</td></tr>';
- $sortStyle = get_block_setting($block_id, 'sortStyle', 'date');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Sort order');
echo '</td><td class="optionbox">';
@@ -154,14 +158,12 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
), null, $sortStyle, '');
echo '</td></tr>';
- $block = get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('block', $block);
echo '</td></tr>';
- $hide_empty = get_block_setting($block_id, 'hide_empty', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Should this block be hidden when it is empty?');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/relative_ext_report/module.php b/modules_v3/relative_ext_report/module.php
index fb3a525398..9de2668dfb 100644
--- a/modules_v3/relative_ext_report/module.php
+++ b/modules_v3/relative_ext_report/module.php
@@ -44,13 +44,13 @@ class relative_ext_report_WT_Module extends WT_Module implements WT_Module_Repor
public function getReportMenus() {
global $controller;
- $menus=array();
- $menu=new WT_Menu(
+ $menus = array();
+ $menu = new WT_Menu(
$this->getTitle(),
- 'reportengine.php?ged='.WT_GEDURL.'&amp;action=setup&amp;report='.WT_MODULES_DIR.$this->getName().'/report.xml&amp;pid='.$controller->getSignificantIndividual()->getXref(),
- 'menu-report-'.$this->getName()
+ 'reportengine.php?ged=' . WT_GEDURL . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
+ 'menu-report-' . $this->getName()
);
- $menus[]=$menu;
+ $menus[] = $menu;
return $menus;
}
diff --git a/modules_v3/relatives/module.php b/modules_v3/relatives/module.php
index 94202be3cf..ef40d7f864 100644
--- a/modules_v3/relatives/module.php
+++ b/modules_v3/relatives/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -18,6 +18,7 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Theme;
/**
* Class relatives_WT_Module
@@ -45,13 +46,13 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
*
* @return string
*/
- static function ageDifference(WT_Date $prev, WT_Date $next, $child_number=0) {
+ static function ageDifference(WT_Date $prev, WT_Date $next, $child_number = 0) {
if ($prev->isOK() && $next->isOK()) {
$days = $next->MaxJD() - $prev->MinJD();
- if ($days<0) {
+ if ($days < 0) {
// Show warning triangle if dates in reverse order
$diff = '<i class="icon-warning"></i> ';
- } elseif ($child_number>1 && $days>1 && $days<240) {
+ } elseif ($child_number > 1 && $days > 1 && $days < 240) {
// Show warning triangle if children born too close together
$diff = '<i class="icon-warning"></i> ';
} else {
@@ -59,9 +60,9 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
}
$months = round($days * 12 / 365.25); // Approximate - we do not know the calendar
- if (abs($months)==12 || abs($months)>=24) {
+ if (abs($months) == 12 || abs($months) >= 24) {
$diff .= WT_I18N::plural('%d year', '%d years', round($months / 12), round($months / 12));
- } elseif ($months!=0) {
+ } elseif ($months != 0) {
$diff .= WT_I18N::plural('%d month', '%d months', $months, $months);
}
@@ -95,7 +96,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
</td>
<td>
<span class="subheaders"> <?php echo $label; ?> </span> -
- <a href="<?php echo $family->getHtmlUrl() ; ?>"><?php echo WT_I18N::translate('View family'); ?></a>
+ <a href="<?php echo $family->getHtmlUrl(); ?>"><?php echo WT_I18N::translate('View family'); ?></a>
</td>
</tr>
</table>
@@ -121,7 +122,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
<?php echo get_close_relationship_name($controller->record, $person); ?>
</td>
<td class="<?php echo $controller->getPersonStyle($person); ?>">
- <?php print_pedigree_person($person, 2); ?>
+ <?php echo Theme::theme()->individualBoxLarge($person); ?>
</td>
</tr>
<?php
@@ -130,7 +131,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
if (!$found && $family->canEdit()) {
?>
<tr>
- <td class="facts_label">&nbsp;</td>
+ <td class="facts_label"></td>
<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'HUSB');"><?php echo WT_I18N::translate('Add a husband to this family'); ?></a></td>
</tr>
<?php
@@ -155,7 +156,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
<?php echo get_close_relationship_name($controller->record, $person); ?>
</td>
<td class="<?php echo $controller->getPersonStyle($person); ?>">
- <?php print_pedigree_person($person, 2); ?>
+ <?php echo Theme::theme()->individualBoxLarge($person); ?>
</td>
</tr>
<?php
@@ -164,7 +165,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
if (!$found && $family->canEdit()) {
?>
<tr>
- <td class="facts_label">&nbsp;</td>
+ <td class="facts_label"></td>
<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'WIFE');"><?php echo WT_I18N::translate('Add a wife to this family'); ?></a></td>
</tr>
<?php
@@ -229,7 +230,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
$next = new WT_Date('');
foreach ($person->getFacts(WT_EVENTS_BIRT) as $bfact) {
if ($bfact->getDate()->isOK()) {
- $next=$bfact->getDate();
+ $next = $bfact->getDate();
break;
}
}
@@ -240,7 +241,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
<?php echo get_close_relationship_name($controller->record, $person); ?>
</td>
<td class="<?php echo $controller->getPersonStyle($person); ?>">
- <?php print_pedigree_person($person, 2); ?>
+ <?php echo Theme::theme()->individualBoxLarge($person); ?>
</td>
</tr>
<?php
@@ -257,7 +258,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
?>
<tr>
<td class="facts_label">
- <?php if (count($family->getChildren())>1) { ?>
+ <?php if (count($family->getChildren()) > 1) { ?>
<a href="#" onclick="reorder_children('<?php echo $family->getXref(); ?>');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php echo WT_I18N::translate('Re-order children'); ?></a>
<?php } ?>
</td>
@@ -281,13 +282,16 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
public function getTabContent() {
global $SHOW_AGE_DIFF, $show_full, $controller;
- if (isset($show_full)) $saved_show_full = $show_full; // We always want to see full details here
+ if (isset($show_full)) {
+ $saved_show_full = $show_full;
+ }
+ // We always want to see full details here
$show_full = 1;
ob_start();
?>
<table class="facts_table"><tr><td class="descriptionbox rela">
- <input id="checkbox_elder" type="checkbox" onclick="jQuery('div.elderdate').toggle();" <?php if ($SHOW_AGE_DIFF) echo "checked=\"checked\""; ?>>
+ <input id="checkbox_elder" type="checkbox" onclick="jQuery('div.elderdate').toggle();" <?php echo $SHOW_AGE_DIFF ? 'checked' : ''; ?>>
<label for="checkbox_elder"><?php echo WT_I18N::translate('Show date differences'); ?></label>
</td></tr></table>
<?php
@@ -334,7 +338,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
?>
<br><table class="facts_table">
<?php
- if (count($families)>1) { ?>
+ if (count($families) > 1) { ?>
<tr>
<td class="facts_value">
<a href="#" onclick="return reorder_families('<?php echo $controller->record->getXref(); ?>');"><?php echo WT_I18N::translate('Re-order families'); ?></a>
@@ -346,7 +350,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
<a href="#" onclick="return add_famc('<?php echo $controller->record->getXref(); ?>');"><?php echo WT_I18N::translate('Link this individual to an existing family as a child'); ?></a>
</td>
</tr>
- <?php if ($controller->record->getSex()!="F") { ?>
+ <?php if ($controller->record->getSex() != "F") { ?>
<tr>
<td class="facts_value">
<a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo WT_I18N::translate('Add a new wife'); ?></a>
@@ -358,7 +362,7 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
</td>
</tr>
<?php }
- if ($controller->record->getSex()!="M") { ?>
+ if ($controller->record->getSex() != "M") { ?>
<tr>
<td class="facts_value">
<a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo WT_I18N::translate('Add a new husband'); ?></a>
@@ -381,9 +385,11 @@ class relatives_WT_Module extends WT_Module implements WT_Module_Tab {
<?php
unset($show_full);
- if (isset($saved_show_full)) $show_full = $saved_show_full;
+ if (isset($saved_show_full)) {
+ $show_full = $saved_show_full;
+ }
- return '<div id="'.$this->getName().'_content">'.ob_get_clean().'</div>';
+ return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
}
/** {@inheritdoc} */
diff --git a/modules_v3/review_changes/help_text.php b/modules_v3/review_changes/help_text.php
deleted file mode 100644
index 8d11aa34c6..0000000000
--- a/modules_v3/review_changes/help_text.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'review_changes':
- $title=WT_I18N::translate('Pending Changes block');
- $text=WT_I18N::translate('This block will show editors a list of records with pending changes that need to be approved by a moderator. It also generates daily emails to moderators whenever pending changes exist.');
-
- // TODO: Other options of this block
-
- $text.='</li></ul>';
- break;
-}
-
diff --git a/modules_v3/review_changes/module.php b/modules_v3/review_changes/module.php
index 2a205a9fe3..3c414d7150 100644
--- a/modules_v3/review_changes/module.php
+++ b/modules_v3/review_changes/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
use WT\User;
/**
@@ -37,30 +38,31 @@ class review_changes_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- $changes=WT_DB::prepare(
- "SELECT 1".
- " FROM `##change`".
- " WHERE status='pending'".
- " LIMIT 1"
- )->fetchOne();
+ $sendmail = get_block_setting($block_id, 'sendmail', '1');
+ $days = get_block_setting($block_id, 'days', '1');
+ $block = get_block_setting($block_id, 'block', '1');
- $days =get_block_setting($block_id, 'days', 1);
- $sendmail=get_block_setting($block_id, 'sendmail', true);
- $block =get_block_setting($block_id, 'block', true);
if ($cfg) {
foreach (array('days', 'sendmail', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
- if ($changes && $sendmail=='yes') {
+ $changes = WT_DB::prepare(
+ "SELECT 1" .
+ " FROM `##change`" .
+ " WHERE status='pending'" .
+ " LIMIT 1"
+ )->fetchOne();
+
+ if ($changes && $sendmail == 'yes') {
// There are pending changes - tell moderators/managers/administrators about them.
- if (WT_TIMESTAMP - WT_Site::getPreference('LAST_CHANGE_EMAIL') > (60*60*24*$days)) {
+ if (WT_TIMESTAMP - WT_Site::getPreference('LAST_CHANGE_EMAIL') > (60 * 60 * 24 * $days)) {
// Which users have pending changes?
foreach (User::all() as $user) {
if ($user->getPreference('contactmethod') !== 'none') {
@@ -82,50 +84,49 @@ class review_changes_WT_Module extends WT_Module implements WT_Module_Block {
}
WT_Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP);
}
- if (WT_USER_CAN_EDIT) {
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title='<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
- } else {
- $title='';
- }
- $title.=$this->getTitle().help_link('review_changes', $this->getName());
+ }
+ if (WT_USER_CAN_EDIT) {
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
+ } else {
+ $title = '';
+ }
+ $title .= $this->getTitle();
- $content = '';
- if (WT_USER_CAN_ACCEPT) {
- $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">".WT_I18N::translate('There are pending changes for you to moderate.')."</a><br>";
- }
- if ($sendmail=="yes") {
- $content .= WT_I18N::translate('Last email reminder was sent ').format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL'))."<br>";
- $content .= WT_I18N::translate('Next email reminder will be sent after ').format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL')+(60*60*24*$days))."<br><br>";
- }
- $changes=WT_DB::prepare(
- "SELECT xref".
- " FROM `##change`".
- " WHERE status='pending'".
- " AND gedcom_id=?".
- " GROUP BY xref"
- )->execute(array(WT_GED_ID))->fetchAll();
- foreach ($changes as $change) {
- $record=WT_GedcomRecord::getInstance($change->xref);
- if ($record->canShow()) {
- $content.='<b>'.$record->getFullName().'</b>';
- $content.=$block ? '<br>' : ' ';
- $content.='<a href="'.$record->getHtmlUrl().'">'.WT_I18N::translate('View the changes').'</a>';
- $content.='<br>';
- }
+ $content = '';
+ if (WT_USER_CAN_ACCEPT) {
+ $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . WT_I18N::translate('There are pending changes for you to moderate.') . "</a><br>";
+ }
+ if ($sendmail == "yes") {
+ $content .= WT_I18N::translate('Last email reminder was sent ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>";
+ $content .= WT_I18N::translate('Next email reminder will be sent after ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL') + (60 * 60 * 24 * $days)) . "<br><br>";
+ }
+ $changes = WT_DB::prepare(
+ "SELECT xref" .
+ " FROM `##change`" .
+ " WHERE status='pending'" .
+ " AND gedcom_id=?" .
+ " GROUP BY xref"
+ )->execute(array(WT_GED_ID))->fetchAll();
+ foreach ($changes as $change) {
+ $record = WT_GedcomRecord::getInstance($change->xref);
+ if ($record->canShow()) {
+ $content .= '<b>' . $record->getFullName() . '</b>';
+ $content .= $block ? '<br>' : ' ';
+ $content .= '<a href="' . $record->getHtmlUrl() . '">' . WT_I18N::translate('View the changes') . '</a>';
+ $content .= '<br>';
}
+ }
- if ($template) {
- if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
- }
- } else {
- return $content;
+ if ($template) {
+ if ($block) {
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
+ } else {
+ return $content;
}
}
}
@@ -148,25 +149,33 @@ class review_changes_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', WT_Filter::postInteger('num', 1, 180, 7));
+ set_block_setting($block_id, 'days', WT_Filter::postInteger('num', 1, 180, 1));
set_block_setting($block_id, 'sendmail', WT_Filter::postBool('sendmail'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $sendmail = get_block_setting($block_id, 'sendmail', '1');
+ $days = get_block_setting($block_id, 'days', '1');
+ $block = get_block_setting($block_id, 'block', '1');
+
+ ?>
+ <tr>
+ <td colspan="2">
+ <?php echo WT_I18N::translate('This block will show editors a list of records with pending changes that need to be approved by a moderator. It also generates daily emails to moderators whenever pending changes exist.'); ?>
+ </td>
+ </tr>
- $sendmail=get_block_setting($block_id, 'sendmail', true);
- $days=get_block_setting($block_id, 'days', 7);
+ <?php
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Send out reminder emails?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('sendmail', $sendmail);
echo '<br>';
- echo WT_I18N::translate('Reminder email frequency (days)')."&nbsp;<input type='text' name='days' value='".$days."' size='2'>";
+ echo WT_I18N::translate('Reminder email frequency (days)') . "&nbsp;<input type='text' name='days' value='" . $days . "' size='2'>";
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/sitemap/module.php b/modules_v3/sitemap/module.php
index 2e8fd55785..619fa1d585 100644
--- a/modules_v3/sitemap/module.php
+++ b/modules_v3/sitemap/module.php
@@ -22,7 +22,7 @@ use WT\Auth;
* Class sitemap_WT_Module
*/
class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
- const RECORDS_PER_VOLUME = 500; // Keep sitemap files small, for memory, CPU and max_allowed_packet limits.
+ const RECORDS_PER_VOLUME = 500; // Keep sitemap files small, for memory, CPU and max_allowed_packet limits.
const CACHE_LIFE = 1209600; // Two weeks
/** {@inheritdoc} */
@@ -257,7 +257,7 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
* Edit the configuration
*/
private function admin() {
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->restrictAccess(Auth::isAdmin())
->setPageTitle($this->getTitle())
@@ -275,8 +275,17 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
}
$include_any = false;
+
+ ?>
+ <ol class="breadcrumb small">
+ <li><a href="admin.php"><?php echo WT_I18N::translate('Administration'); ?></a></li>
+ <li><a href="admin_modules.php"><?php echo WT_I18N::translate('Module administration'); ?></a></li>
+ <li class="active"><?php echo $controller->getPageTitle(); ?></li>
+ </ol>
+ <h2><?php echo $controller->getPageTitle(); ?></h2>
+ <?php
+
echo
- '<h3>', $this->getTitle(), '</h3>',
'<p>',
/* I18N: The www.sitemaps.org site is translated into many languages (e.g. http://www.sitemaps.org/fr/) - choose an appropriate URL. */
WT_I18N::translate('Sitemaps are a way for webmasters to tell search engines about the pages on a website that are available for crawling. All major search engines support sitemaps. For more information, see <a href="http://www.sitemaps.org/">www.sitemaps.org</a>.') .
@@ -285,9 +294,9 @@ class sitemap_WT_Module extends WT_Module implements WT_Module_Config {
'<form method="post" action="module.php?mod=' . $this->getName() . '&amp;mod_action=admin">',
'<input type="hidden" name="action" value="save">';
foreach (WT_Tree::getAll() as $tree) {
- echo '<p><input type="checkbox" name="include', $tree->tree_id, '"';
+ echo '<p><input type="checkbox" name="include', $tree->tree_id, '" ';
if ($tree->getPreference('include_in_sitemap')) {
- echo ' checked="checked"';
+ echo 'checked';
$include_any = true;
}
echo '>', $tree->tree_title_html, '</p>';
diff --git a/modules_v3/sources_tab/module.php b/modules_v3/sources_tab/module.php
index d68e131ef3..913183edcb 100644
--- a/modules_v3/sources_tab/module.php
+++ b/modules_v3/sources_tab/module.php
@@ -59,7 +59,7 @@ class sources_tab_WT_Module extends WT_Module implements WT_Module_Tab {
<table class="facts_table">
<tr>
<td colspan="2" class="descriptionbox rela">
- <input id="checkbox_sour2" type="checkbox" <?php if ($SHOW_LEVEL2_NOTES) echo " checked=\"checked\""; ?> onclick="jQuery('tr.row_sour2').toggle();">
+ <input id="checkbox_sour2" type="checkbox" <?php echo $SHOW_LEVEL2_NOTES ? 'checked' : ''; ?> onclick="jQuery('tr.row_sour2').toggle();">
<label for="checkbox_sour2"><?php echo WT_I18N::translate('Show all sources'), help_link('show_fact_sources'); ?></label>
</td>
</tr>
diff --git a/modules_v3/stories/module.php b/modules_v3/stories/module.php
index 86693f84c1..0cd8f3be37 100644
--- a/modules_v3/stories/module.php
+++ b/modules_v3/stories/module.php
@@ -70,10 +70,10 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
$block_ids =
WT_DB::prepare(
- "SELECT block_id".
- " FROM `##block`".
- " WHERE module_name=?".
- " AND xref=?".
+ "SELECT block_id" .
+ " FROM `##block`" .
+ " WHERE module_name=?" .
+ " AND xref=?" .
" AND gedcom_id=?"
)->execute(array(
$this->getName(),
@@ -114,10 +114,10 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
$count_of_stories =
WT_DB::prepare(
- "SELECT COUNT(block_id)".
- " FROM `##block`".
- " WHERE module_name=?".
- " AND xref=?".
+ "SELECT COUNT(block_id)" .
+ " FROM `##block`" .
+ " WHERE module_name=?" .
+ " AND xref=?" .
" AND gedcom_id=?"
)->execute(array(
$this->getName(),
@@ -164,18 +164,13 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
}
set_block_setting($block_id, 'title', WT_Filter::post('title'));
set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
- $languages = array();
- foreach (WT_I18N::installed_languages() as $code => $name) {
- if (WT_Filter::postBool('lang_' . $code)) {
- $languages[] = $code;
- }
- }
+ $languages = WT_Filter::postArray('lang', null, array_keys(WT_I18N::installed_languages()));
set_block_setting($block_id, 'languages', implode(',', $languages));
$this->config();
} else {
$block_id = WT_Filter::getInteger('block_id');
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
if ($block_id) {
$controller->setPageTitle(WT_I18N::translate('Edit story'));
$title = get_block_setting($block_id, 'title');
@@ -191,12 +186,22 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
}
$controller
->pageHeader()
- ->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')
+ ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
ckeditor_WT_Module::enableEditor($controller);
}
+ ?>
+ <ol class="breadcrumb small">
+ <li><a href="admin.php"><?php echo WT_I18N::translate('Administration'); ?></a></li>
+ <li><a href="admin_modules.php"><?php echo WT_I18N::translate('Module administration'); ?></a></li>
+ <li><a href="module.php?mod=<?php echo $this->getName(); ?>&mod_action=admin_config"><?php echo $this->getTitle(); ?></a></li>
+ <li class="active"><?php echo $controller->getPageTitle(); ?></li>
+ </ol>
+ <h2><?php echo $controller->getPageTitle(); ?></h2>
+ <?php
+
echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
echo WT_Filter::getCsrf();
echo '<input type="hidden" name="save" value="1">';
@@ -227,19 +232,16 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
}
}
echo '</td>';
- $languages = get_block_setting($block_id, 'languages');
+ $languages = explode(',', get_block_setting($block_id, 'languages'));
echo '<td class="optionbox">';
- echo edit_language_checkboxes('lang_', $languages);
+ echo edit_language_checkboxes('lang', $languages);
echo '</td></tr></table>';
echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
echo '</p>';
echo '</form>';
-
- exit;
}
} else {
header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
- exit;
}
}
@@ -268,80 +270,108 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
*/
private function config() {
require_once WT_ROOT . 'includes/functions/functions_edit.php';
- if (WT_USER_GEDCOM_ADMIN) {
- $controller = new WT_Controller_Page();
- $controller
- ->setPageTitle($this->getTitle())
- ->pageHeader()
- ->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
- ->addInlineJavascript('
- jQuery("#story_table").dataTable({
- dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
- ' . WT_I18N::datatablesI18N() . ',
- autoWidth: false,
- paging: true,
- pagingType: "full_numbers",
- lengthChange: true,
- filter: true,
- info: true,
- jQueryUI: true,
- sorting: [[0,"asc"]],
- columns: [
- /* 0-name */ null,
- /* 1-NAME */ null,
- /* 2-NAME */ { sortable:false },
- /* 3-NAME */ { sortable:false }
- ]
- });
- ');
+ $controller = new WT_Controller_Page;
+ $controller
+ ->restrictAccess(WT_USER_GEDCOM_ADMIN)
+ ->setPageTitle($this->getTitle())
+ ->pageHeader()
+ ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
+ ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
+ ->addInlineJavascript('
+ jQuery("#story_table").dataTable({
+ ' . WT_I18N::datatablesI18N() . ',
+ autoWidth: false,
+ paging: true,
+ pagingType: "full_numbers",
+ lengthChange: true,
+ filter: true,
+ info: true,
+ sorting: [[0,"asc"]],
+ columns: [
+ /* 0-name */ null,
+ /* 1-NAME */ null,
+ /* 2-NAME */ { sortable:false },
+ /* 3-NAME */ { sortable:false }
+ ]
+ });
+ ');
+
+ $stories = WT_DB::prepare(
+ "SELECT block_id, xref" .
+ " FROM `##block` b" .
+ " WHERE module_name=?" .
+ " AND gedcom_id=?" .
+ " ORDER BY xref"
+ )->execute(array($this->getName(), WT_GED_ID))->fetchAll();
- $stories = WT_DB::prepare(
- "SELECT block_id, xref".
- " FROM `##block` b".
- " WHERE module_name=?".
- " AND gedcom_id=?".
- " ORDER BY xref"
- )->execute(array($this->getName(), WT_GED_ID))->fetchAll();
+ ?>
+ <ol class="breadcrumb small">
+ <li><a href="admin.php"><?php echo WT_I18N::translate('Administration'); ?></a></li>
+ <li><a href="admin_modules.php"><?php echo WT_I18N::translate('Module administration'); ?></a></li>
+ <li class="active"><?php echo $controller->getPageTitle(); ?></li>
+ </ol>
+ <h2><?php echo $controller->getPageTitle(); ?></h2>
- echo
- '<form method="get" action="', WT_SCRIPT_NAME, '">',
- WT_I18N::translate('Family tree'), ' ',
- '<input type="hidden" name="mod" value="', $this->getName(), '">',
- '<input type="hidden" name="mod_action" value="admin_config">',
- select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM),
- '<input type="submit" value="', WT_I18N::translate('show'), '">',
- '</form>';
+ <form class="form form-inline">
+ <label for="ged" class="sr-only">
+ <?php echo WT_I18N::translate('Family tree'); ?>
+ </label>
+ <input type="hidden" name="mod" value="<?php echo $this->getName(); ?>">
+ <input type="hidden" name="mod_action" value="admin_config">
+ <?php echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM, 'class="form-control"'); ?>
+ <input type="submit" class="btn btn-primary" value="<?php echo WT_I18N::translate('show'); ?>">
+ </form>
- echo '<h3><a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">', WT_I18N::translate('Add a story'), '</a></h3>';
- if (count($stories) > 0) {
- echo '<table id="story_table">';
- echo '<thead><tr>
- <th>', WT_I18N::translate('Story title'), '</th>
- <th>', WT_I18N::translate('Individual'), '</th>
- <th>&nbsp;</th>
- <th>&nbsp;</th>
- </tr></thead>';
- }
- echo '<tbody>';
- foreach ($stories as $story) {
- $story_title = get_block_setting($story->block_id, 'title');
- $indi = WT_Individual::getInstance($story->xref);
- if ($indi) {
- echo '<tr><td><a href="', $indi->getHtmlUrl() . '#stories">', $story_title, '</a></td>
- <td><a href="', $indi->getHtmlUrl() . '#stories">' . $indi->getFullName(), '</a></td>';
- } else {
- echo '<tr><td>', $story_title, '</td><td class="error">', $story->xref, '</td>';
- }
- echo '<td><a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit&amp;block_id=', $story->block_id, '"><div class="icon-edit">&nbsp;</div></a></td>
- <td><a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_delete&amp;block_id=', $story->block_id, '" onclick="return confirm(\'', WT_I18N::translate('Are you sure you want to delete this story?'), '\');"><div class="icon-delete">&nbsp;</div></a></td>
- </tr>';
- }
- echo '</tbody></table>';
- } else {
- header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
- exit;
- }
+ <p>
+ <a href="module.php?mod=<?php echo $this->getName(); ?>&amp;mod_action=admin_edit" class="btn btn-default">
+ <i class="fa fa-plus"></i>
+ <?php echo WT_I18N::translate('Add a story'); ?>
+ </a>
+ </p>
+
+ <table class="table table-bordered table-condensed">
+ <thead>
+ <tr>
+ <th><?php echo WT_I18N::translate('Story title'); ?></th>
+ <th><?php echo WT_I18N::translate('Individual'); ?></th>
+ <th><?php echo WT_I18N::translate('Edit'); ?></th>
+ <th><?php echo WT_I18N::translate('Delete'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($stories as $story): ?>
+ <tr>
+ <td>
+ <?php echo WT_Filter::escapeHtml(get_block_setting($story->block_id, 'title')); ?>
+ </td>
+ <td>
+ <?php if ($indi = WT_Individual::getInstance($story->xref)): ?>
+ <a href="<?php echo $indi->getHtmlUrl(); ?>#stories">
+ <?php echo $indi->getFullName(); ?>
+ </a>
+ <?php else: ?>
+ <?php echo $story->xref; ?>
+ <?php endif; ?>
+ </td>
+ <td>
+ <a href="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit&amp;block_id=', $story->block_id, '">
+ <div class="icon-edit">&nbsp;</div>
+ </a>
+ </td>
+ <td>
+ <a
+ href="module.php?mod=<?php echo $this->getName(); ?>&amp;mod_action=admin_delete&amp;block_id=<?php echo $story->block_id; ?>"
+ onclick="return confirm('<?php echo WT_I18N::translate('Are you sure you want to delete this story?'); ?>');"
+ >
+ <div class="icon-delete">&nbsp;</div>
+ </a>
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+ <?php
}
/**
@@ -350,11 +380,11 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
private function showList() {
global $controller;
- $controller = new WT_Controller_Page();
+ $controller = new WT_Controller_Page;
$controller
->setPageTitle($this->getTitle())
->pageHeader()
- ->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
+ ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
->addInlineJavascript('
jQuery("#story_table").dataTable({
dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
@@ -375,10 +405,10 @@ class stories_WT_Module extends WT_Module implements WT_Module_Tab, WT_Module_Co
');
$stories = WT_DB::prepare(
- "SELECT block_id, xref".
- " FROM `##block` b".
- " WHERE module_name=?".
- " AND gedcom_id=?".
+ "SELECT block_id, xref" .
+ " FROM `##block` b" .
+ " WHERE module_name=?" .
+ " AND gedcom_id=?" .
" ORDER BY xref"
)->execute(array($this->getName(), WT_GED_ID))->fetchAll();
diff --git a/modules_v3/theme_select/module.php b/modules_v3/theme_select/module.php
index f82c70fb9f..ae9634c11c 100644
--- a/modules_v3/theme_select/module.php
+++ b/modules_v3/theme_select/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -19,6 +19,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+use WT\Theme;
+
/**
* Class theme_select_WT_Module
*/
@@ -34,16 +36,18 @@ class theme_select_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- $title=$this->getTitle();
- $menu=WT_MenuBar::getThemeMenu();
+ public function getBlock($block_id, $template = true, $cfg = null) {
+ /** @var \WT\Theme\BaseTheme */
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ $title = $this->getTitle();
+ $menu = Theme::theme()->menuThemes();
+
if ($menu) {
- $content='<div class="center theme_form">'.WT_MenuBar::getThemeMenu().'</div><br>';
+ $content = '<div class="center theme_form">' . $menu . '</div><br>';
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/todays_events/module.php b/modules_v3/todays_events/module.php
index ade06ed20c..f1cf7ca71a 100644
--- a/modules_v3/todays_events/module.php
+++ b/modules_v3/todays_events/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class todays_events_WT_Module
@@ -36,20 +37,21 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+ require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
- $filter = get_block_setting($block_id, 'filter', true);
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', true);
+ $filter = get_block_setting($block_id, 'filter', '1');
+ $onlyBDM = get_block_setting($block_id, 'onlyBDM', '1');
$infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
$sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', true);
+ $block = get_block_setting($block_id, 'block', '1');
+
if ($cfg) {
foreach (array('filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -81,10 +83,9 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR . 'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -108,38 +109,39 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
- set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
+ set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
+ set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $filter = get_block_setting($block_id, 'filter', '1');
+ $onlyBDM = get_block_setting($block_id, 'onlyBDM', '1');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
+ $block = get_block_setting($block_id, 'block', '1');
- $filter=get_block_setting($block_id, 'filter', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show only events of living individuals?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('filter', $filter);
echo '</td></tr>';
- $onlyBDM=get_block_setting($block_id, 'onlyBDM', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show only births, deaths, and marriages?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('onlyBDM', $onlyBDM);
echo '</td></tr>';
- $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, '');
echo '</td></tr>';
- $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Sort order');
echo '</td><td class="optionbox">';
@@ -149,7 +151,6 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block {
), null, $sortStyle, '');
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/todo/help_text.php b/modules_v3/todo/help_text.php
deleted file mode 100644
index 4613b0da65..0000000000
--- a/modules_v3/todo/help_text.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-case 'todo':
- $title=WT_I18N::translate('Research tasks');
- $text=WT_I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.').
- '</p><p class="ui-state-highlight">'.
- WT_I18N::translate('To create new research tasks, you must first add “research task” to the list of facts and events in the family tree’s preferences.').
- '</p><p class="ui-state-highlight">'.
- WT_I18N::translate('Research tasks are stored using the custom GEDCOM tag “_TODO”. Other genealogy applications may not recognize this tag.').
- '</p>';
- break;
-}
diff --git a/modules_v3/todo/module.php b/modules_v3/todo/module.php
index 7318044e5c..f0377ac844 100644
--- a/modules_v3/todo/module.php
+++ b/modules_v3/todo/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -21,6 +21,7 @@
use Rhumsaa\Uuid\Uuid;
use WT\Auth;
+use WT\Theme;
/**
* Class todo_WT_Module
@@ -37,17 +38,18 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $controller;
- $show_unassigned=get_block_setting($block_id, 'show_unassigned', true);
- $show_other =get_block_setting($block_id, 'show_other', true);
- $show_future =get_block_setting($block_id, 'show_future', true);
- $block =get_block_setting($block_id, 'block', true);
+ $show_other = get_block_setting($block_id, 'show_other', '1');
+ $show_unassigned = get_block_setting($block_id, 'show_unassigned', '1');
+ $show_future = get_block_setting($block_id, 'show_future', '1');
+ $block = get_block_setting($block_id, 'block', '1');
+
if ($cfg) {
foreach (array('show_unassigned', 'show_other', 'show_future', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -55,20 +57,20 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
- $title .= $this->getTitle().help_link('todo', $this->getName());
+ $title .= $this->getTitle();
$table_id = Uuid::uuid4(); // create a unique ID
$controller
- ->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
+ ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
->addInlineJavascript('
jQuery("#' . $table_id . '").dataTable({
dom: \'t\',
- '.WT_I18N::datatablesI18N().',
+ ' . WT_I18N::datatablesI18N() . ',
autoWidth: false,
paginate: false,
lengthChange: false,
@@ -87,53 +89,52 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block {
jQuery(".loading-image").css("display", "none");
');
- $content='';
+ $content = '';
$content .= '<div class="loading-image">&nbsp;</div>';
- $content .= '<table id="'.$table_id.'" style="visibility:hidden;">';
+ $content .= '<table id="' . $table_id . '" style="visibility:hidden;">';
$content .= '<thead><tr>';
$content .= '<th>DATE</th>'; //hidden by datables code
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('DATE').'</th>';
- $content .= '<th>'.WT_I18N::translate('Record').'</th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('DATE') . '</th>';
+ $content .= '<th>' . WT_I18N::translate('Record') . '</th>';
if ($show_unassigned || $show_other) {
- $content .= '<th>'.WT_I18N::translate('Username').'</th>';
+ $content .= '<th>' . WT_I18N::translate('Username') . '</th>';
}
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('TEXT').'</th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('TEXT') . '</th>';
$content .= '</tr></thead><tbody>';
- $found=false;
- $end_jd=$show_future ? 99999999 : WT_CLIENT_JD;
+ $found = false;
+ $end_jd = $show_future ? 99999999 : WT_CLIENT_JD;
foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $fact) {
$record = $fact->getParent();
$user_name = $fact->getAttribute('_WT_USER');
if ($user_name === Auth::user()->getUserName() || !$user_name && $show_unassigned || $user_name && $show_other) {
- $content.='<tr>';
+ $content .= '<tr>';
//-- Event date (sortable)
$content .= '<td>'; //hidden by datables code
$content .= $fact->getDate()->JD();
$content .= '</td>';
- $content.='<td class="wrap">'. $fact->getDate()->display(empty($SEARCH_SPIDER)).'</td>';
- $content.='<td class="wrap"><a href="'.$record->getHtmlUrl().'">'.$record->getFullName().'</a></td>';
+ $content .= '<td class="wrap">' . $fact->getDate()->display(empty($SEARCH_SPIDER)) . '</td>';
+ $content .= '<td class="wrap"><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
if ($show_unassigned || $show_other) {
- $content.='<td class="wrap">'.$user_name.'</td>';
+ $content .= '<td class="wrap">' . $user_name . '</td>';
}
$text = $fact->getValue();
- $content.='<td class="wrap">'.$text.'</td>';
- $content.='</tr>';
- $found=true;
+ $content .= '<td class="wrap">' . $text . '</td>';
+ $content .= '</tr>';
+ $found = true;
}
}
$content .= '</tbody></table>';
if (!$found) {
- $content.='<p>'.WT_I18N::translate('There are no research tasks in this family tree.').'</p>';
+ $content .= '<p>' . WT_I18N::translate('There are no research tasks in this family tree.') . '</p>';
}
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -157,37 +158,47 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'show_other', WT_Filter::postBool('show_other'));
+ set_block_setting($block_id, 'show_other', WT_Filter::postBool('show_other'));
set_block_setting($block_id, 'show_unassigned', WT_Filter::postBool('show_unassigned'));
- set_block_setting($block_id, 'show_future', WT_Filter::postBool('show_future'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'show_future', WT_Filter::postBool('show_future'));
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $show_other = get_block_setting($block_id, 'show_other', '1');
+ $show_unassigned = get_block_setting($block_id, 'show_unassigned', '1');
+ $show_future = get_block_setting($block_id, 'show_future', '1');
+ $block = get_block_setting($block_id, 'block', '1');
+
+ ?>
+ <tr>
+ <td colspan="2">
+ <?php echo WT_I18N::translate('Research tasks are special events, added to individuals in your family tree, which identify the need for further research. You can use them as a reminder to check facts against more reliable sources, to obtain documents or photographs, to resolve conflicting information, etc.'); ?>
+ <?php echo WT_I18N::translate('To create new research tasks, you must first add “research task” to the list of facts and events in the family tree’s preferences.'); ?>
+ <?php echo WT_I18N::translate('Research tasks are stored using the custom GEDCOM tag “_TODO”. Other genealogy applications may not recognize this tag.'); ?>
+ </td>
+ </tr>
+ <?php
- $show_other=get_block_setting($block_id, 'show_other', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show research tasks that are assigned to other users');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('show_other', $show_other);
echo '</td></tr>';
- $show_unassigned=get_block_setting($block_id, 'show_unassigned', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show research tasks that are not assigned to any user');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('show_unassigned', $show_unassigned);
echo '</td></tr>';
- $show_future=get_block_setting($block_id, 'show_future', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show research tasks that have a date in the future');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('show_future', $show_future);
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/top10_givnnames/module.php b/modules_v3/top10_givnnames/module.php
index 341253df1a..5d9ee0a144 100644
--- a/modules_v3/top10_givnnames/module.php
+++ b/modules_v3/top10_givnnames/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class top10_givnnames_WT_Module
@@ -36,72 +37,75 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $TEXT_DIRECTION, $ctype;
- $num=get_block_setting($block_id, 'num', 10);
- $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
- $block=get_block_setting($block_id, 'block', false);
+ $num = get_block_setting($block_id, 'num', '10');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $block = get_block_setting($block_id, 'block', '0');
+
if ($cfg) {
foreach (array('num', 'infoStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
- $stats=new WT_Stats(WT_GEDCOM);
+ $stats = new WT_Stats(WT_GEDCOM);
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
if ($num == 1) {
// I18N: i.e. most popular given name.
- $title.=WT_I18N::translate('Top given name');
+ $title .= WT_I18N::translate('Top given name');
} else {
// I18N: Title for a list of the most common given names, %s is a number. Note that a separate translation exists when %s is 1
- $title.=WT_I18N::plural('Top %s given name', 'Top %s given names', $num, WT_I18N::number($num));
+ $title .= WT_I18N::plural('Top %s given name', 'Top %s given names', $num, WT_I18N::number($num));
}
$content = '<div class="normal_inner_block">';
//Select List or Table
switch ($infoStyle) {
case "list": // Output style 1: Simple list style. Better suited to left side of page.
- if ($TEXT_DIRECTION=='ltr') $padding = 'padding-left: 15px';
- else $padding = 'padding-right: 15px';
- $params=array(1,$num,'rcount');
+ if ($TEXT_DIRECTION == 'ltr') {
+ $padding = 'padding-left: 15px';
+ } else {
+ $padding = 'padding-right: 15px';
+ }
+ $params = array(1, $num, 'rcount');
//List Female names
- $totals=$stats->commonGivenFemaleTotals($params);
+ $totals = $stats->commonGivenFemaleTotals($params);
if ($totals) {
- $content.='<b>'.WT_I18N::translate('Females').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br>';
+ $content .= '<b>' . WT_I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
}
//List Male names
- $totals=$stats->commonGivenMaleTotals($params);
+ $totals = $stats->commonGivenMaleTotals($params);
if ($totals) {
- $content.='<b>'.WT_I18N::translate('Males').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br>';
+ $content .= '<b>' . WT_I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
}
break;
case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
- $params=array(1,$num,'rcount');
- $content.='<table style="margin:auto;">
+ $params = array(1, $num, 'rcount');
+ $content .= '<table style="margin:auto;">
<tr valign="top">
- <td>'.$stats->commonGivenFemaleTable($params).'</td>
- <td>'.$stats->commonGivenMaleTable($params).'</td>';
- $content.='</tr></table>';
+ <td>'.$stats->commonGivenFemaleTable($params) . '</td>
+ <td>'.$stats->commonGivenMaleTable($params) . '</td>';
+ $content .= '</tr></table>';
break;
}
- $content .= "</div>";
+ $content .= "</div>";
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -125,29 +129,29 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
+ set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $num = get_block_setting($block_id, 'num', '10');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $block = get_block_setting($block_id, 'block', '0');
- $num=get_block_setting($block_id, 'num', 10);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of items to show');
echo '</td><td class="optionbox">';
echo '<input type="text" name="num" size="2" value="', $num, '">';
echo '</td></tr>';
- $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, '');
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/top10_pageviews/module.php b/modules_v3/top10_pageviews/module.php
index 0f38a3c6b9..8378dd4ea9 100644
--- a/modules_v3/top10_pageviews/module.php
+++ b/modules_v3/top10_pageviews/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class top10_pageviews_WT_Module
@@ -36,16 +37,17 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- $count_placement=get_block_setting($block_id, 'count_placement', 'before');
- $num=(int)get_block_setting($block_id, 'num', 10);
- $block=get_block_setting($block_id, 'block', false);
+ $num = get_block_setting($block_id, 'num', '10');
+ $count_placement = get_block_setting($block_id, 'count_placement', 'before');
+ $block = get_block_setting($block_id, 'block', '0');
+
if ($cfg) {
foreach (array('count_placement', 'num', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -53,7 +55,7 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
@@ -61,10 +63,10 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
$content = "";
// load the lines from the file
- $top10=WT_DB::prepare(
- "SELECT page_parameter, page_count".
- " FROM `##hit_counter`".
- " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')".
+ $top10 = WT_DB::prepare(
+ "SELECT page_parameter, page_count" .
+ " FROM `##hit_counter`" .
+ " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" .
" ORDER BY page_count DESC LIMIT :limit"
)->execute(array(
'tree_id' => WT_GED_ID,
@@ -78,15 +80,15 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
$content .= "<table>";
}
foreach ($top10 as $id=>$count) {
- $record=WT_GedcomRecord::getInstance($id);
+ $record = WT_GedcomRecord::getInstance($id);
if ($record && $record->canShow()) {
$content .= '<tr valign="top">';
- if ($count_placement=='before') {
- $content .= '<td dir="ltr" align="right">['.$count.']</td>';
+ if ($count_placement == 'before') {
+ $content .= '<td dir="ltr" align="right">[' . $count . ']</td>';
}
- $content .= '<td class="name2" ><a href="'.$record->getHtmlUrl().'">'.$record->getFullName().'</a></td>';
- if ($count_placement=='after') {
- $content .= '<td dir="ltr" align="right">['.$count.']</td>';
+ $content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
+ if ($count_placement == 'after') {
+ $content .= '<td dir="ltr" align="right">[' . $count . ']</td>';
}
$content .= '</tr>';
}
@@ -95,10 +97,9 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -122,28 +123,28 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
+ set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
set_block_setting($block_id, 'count_placement', WT_Filter::post('count_placement', 'before|after', 'before'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $num = get_block_setting($block_id, 'num', '10');
+ $count_placement = get_block_setting($block_id, 'count_placement', 'before');
+ $block = get_block_setting($block_id, 'block', '0');
- $num=get_block_setting($block_id, 'num', 10);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of items to show');
echo '</td><td class="optionbox">';
echo '<input type="text" name="num" size="2" value="', $num, '">';
echo '</td></tr>';
- $count_placement=get_block_setting($block_id, 'count_placement', 'left');
echo "<tr><td class=\"descriptionbox wrap width33\">";
echo WT_I18N::translate('Place counts before or after name?');
echo "</td><td class=\"optionbox\">";
echo select_edit_control('count_placement', array('before'=>WT_I18N::translate('before'), 'after'=>WT_I18N::translate('after')), null, $count_placement, '');
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/top10_surnames/module.php b/modules_v3/top10_surnames/module.php
index d22c8097a3..001faa4b87 100644
--- a/modules_v3/top10_surnames/module.php
+++ b/modules_v3/top10_surnames/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class top10_surnames_WT_Module
@@ -44,9 +45,10 @@ class top10_surnames_WT_Module extends WT_Module implements WT_Module_Block {
$COMMON_NAMES_REMOVE = $WT_TREE->getPreference('COMMON_NAMES_REMOVE');
$COMMON_NAMES_THRESHOLD = $WT_TREE->getPreference('COMMON_NAMES_THRESHOLD');
- $num = get_block_setting($block_id, 'num', 10);
+ $num = get_block_setting($block_id, 'num', '10');
$infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $block = get_block_setting($block_id, 'block', false);
+ $block = get_block_setting($block_id, 'block', '0');
+
if ($cfg) {
foreach (array('num', 'infoStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
@@ -115,10 +117,9 @@ class top10_surnames_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR . 'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
@@ -146,26 +147,26 @@ class top10_surnames_WT_Module extends WT_Module implements WT_Module_Block {
set_block_setting($block_id, 'num', WT_Filter::postInteger('num', 1, 10000, 10));
set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|array|table|tagcloud', 'table'));
set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
}
require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $num = get_block_setting($block_id, 'num', 10);
+ $num = get_block_setting($block_id, 'num', '10');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $block = get_block_setting($block_id, 'block', '0');
+
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of items to show');
echo '</td><td class="optionbox">';
echo '<input type="text" name="num" size="2" value="', $num, '">';
echo '</td></tr>';
- $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list' => WT_I18N::translate('bullet list'), 'array' => WT_I18N::translate('compact list'), 'table' => WT_I18N::translate('table'), 'tagcloud' => WT_I18N::translate('tag cloud')), null, $infoStyle, '');
echo '</td></tr>';
- $block = get_block_setting($block_id, 'block', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/tree/class_treeview.php b/modules_v3/tree/class_treeview.php
index 71fe0bdb57..86df05ede1 100644
--- a/modules_v3/tree/class_treeview.php
+++ b/modules_v3/tree/class_treeview.php
@@ -61,7 +61,7 @@ class TreeView {
</div>
<h2 id="tree-title">' . WT_I18N::translate('Interactive tree of %s', $root_person->getFullName()) . '</h2>
<div id="' . $this->name . '_in" class="tv_in" dir="ltr">
- ' . $this->drawPerson($root_person, $generations, 0, null, null, true) .'
+ ' . $this->drawPerson($root_person, $generations, 0, null, null, true) . '
</div>
</div>
';
diff --git a/modules_v3/tree/module.php b/modules_v3/tree/module.php
index e7c8c4f8e5..0b27516a59 100644
--- a/modules_v3/tree/module.php
+++ b/modules_v3/tree/module.php
@@ -91,7 +91,7 @@ class tree_WT_Module extends WT_Module implements WT_Module_Tab {
switch ($mod_action) {
case 'treeview':
global $controller;
- $controller = new WT_Controller_Chart();
+ $controller = new WT_Controller_Chart;
$tv = new TreeView('tv');
ob_start();
diff --git a/modules_v3/upcoming_events/module.php b/modules_v3/upcoming_events/module.php
index f01c895f89..ec13a19c71 100644
--- a/modules_v3/upcoming_events/module.php
+++ b/modules_v3/upcoming_events/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class upcoming_events_WT_Module
@@ -36,21 +37,22 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype;
- require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+ require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
- $days = get_block_setting($block_id, 'days', 7);
- $filter = get_block_setting($block_id, 'filter', true);
- $onlyBDM = get_block_setting($block_id, 'onlyBDM', false);
+ $days = get_block_setting($block_id, 'days', '7');
+ $filter = get_block_setting($block_id, 'filter', '1');
+ $onlyBDM = get_block_setting($block_id, 'onlyBDM', '0');
$infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
$sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
- $block = get_block_setting($block_id, 'block', true);
+ $block = get_block_setting($block_id, 'block', '1');
+
if ($cfg) {
foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -83,10 +85,9 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR . 'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -110,47 +111,48 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
- set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
- set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
+ set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
+ set_block_setting($block_id, 'filter', WT_Filter::postBool('filter'));
+ set_block_setting($block_id, 'onlyBDM', WT_Filter::postBool('onlyBDM'));
set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
set_block_setting($block_id, 'sortStyle', WT_Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $days = get_block_setting($block_id, 'days', '7');
+ $filter = get_block_setting($block_id, 'filter', '1');
+ $onlyBDM = get_block_setting($block_id, 'onlyBDM', '0');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
+ $block = get_block_setting($block_id, 'block', '1');
- $days=get_block_setting($block_id, 'days', 7);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of days to show');
echo '</td><td class="optionbox">';
echo '<input type="text" name="days" size="2" value="', $days, '">';
- echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30) ,'</em>';
+ echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
echo '</td></tr>';
- $filter=get_block_setting($block_id, 'filter', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show only events of living individuals?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('filter', $filter);
echo '</td></tr>';
- $onlyBDM=get_block_setting($block_id, 'onlyBDM', false);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Show only births, deaths, and marriages?');
echo '</td><td class="optionbox">';
echo edit_field_yes_no('onlyBDM', $onlyBDM);
echo '</td></tr>';
- $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, '');
echo '</td></tr>';
- $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Sort order');
echo '</td><td class="optionbox">';
@@ -160,7 +162,6 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
), null, $sortStyle, '');
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/user_blog/db_schema/db_schema_0_1.php b/modules_v3/user_blog/db_schema/db_schema_0_1.php
index 77926052e4..2da9c187d6 100644
--- a/modules_v3/user_blog/db_schema/db_schema_0_1.php
+++ b/modules_v3/user_blog/db_schema/db_schema_0_1.php
@@ -29,14 +29,14 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
WT_DB::exec(
- "CREATE TABLE IF NOT EXISTS `##news` (".
- " n_id INTEGER AUTO_INCREMENT NOT NULL,".
- " n_username VARCHAR(100) NOT NULL,".
- " n_date INTEGER NOT NULL,".
- " n_title VARCHAR(255) NOT NULL,".
- " n_text TEXT NOT NULL,".
- " PRIMARY KEY (n_id),".
- " KEY ix1 (n_username)".
+ "CREATE TABLE IF NOT EXISTS `##news` (" .
+ " n_id INTEGER AUTO_INCREMENT NOT NULL," .
+ " n_username VARCHAR(100) NOT NULL," .
+ " n_date INTEGER NOT NULL," .
+ " n_title VARCHAR(255) NOT NULL," .
+ " n_text TEXT NOT NULL," .
+ " PRIMARY KEY (n_id)," .
+ " KEY ix1 (n_username)" .
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
diff --git a/modules_v3/user_blog/db_schema/db_schema_1_2.php b/modules_v3/user_blog/db_schema/db_schema_1_2.php
index 8645cb333d..49ff47cc47 100644
--- a/modules_v3/user_blog/db_schema/db_schema_1_2.php
+++ b/modules_v3/user_blog/db_schema/db_schema_1_2.php
@@ -28,11 +28,11 @@
// Add new columns
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " ADD user_id INTEGER NULL AFTER n_id,".
- " ADD gedcom_id INTEGER NULL AFTER user_id,".
- " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP,".
- " ADD KEY news_ix1 (user_id, updated),".
+ "ALTER TABLE `##news`" .
+ " ADD user_id INTEGER NULL AFTER n_id," .
+ " ADD gedcom_id INTEGER NULL AFTER user_id," .
+ " ADD updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP," .
+ " ADD KEY news_ix1 (user_id, updated)," .
" ADD KEY news_ix2 (gedcom_id, updated)"
);
} catch (PDOException $ex) {
@@ -42,9 +42,9 @@ try {
// Migrate data from the old columns to the new ones
try {
WT_DB::exec(
- "UPDATE `##news` n".
- " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)".
- " LEFT JOIN `##user` u ON (n.n_username=u.user_name)".
+ "UPDATE `##news` n" .
+ " LEFT JOIN `##gedcom` g ON (n.n_username=g.gedcom_name)" .
+ " LEFT JOIN `##user` u ON (n.n_username=u.user_name)" .
" SET n.gedcom_id=g.gedcom_id, n.user_id=u.user_id, updated=FROM_UNIXTIME(n_date)"
);
} catch (PDOException $ex) {
@@ -63,10 +63,10 @@ try {
// Delete/rename old columns
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " DROP n_username, DROP n_date,".
- " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT,".
- " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci,".
+ "ALTER TABLE `##news`" .
+ " DROP n_username, DROP n_date," .
+ " CHANGE n_id news_id INTEGER NOT NULL AUTO_INCREMENT," .
+ " CHANGE n_title subject VARCHAR(255) COLLATE utf8_unicode_ci," .
" CHANGE n_text body TEXT COLLATE utf8_unicode_ci"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/user_blog/db_schema/db_schema_2_3.php b/modules_v3/user_blog/db_schema/db_schema_2_3.php
index ac0162503f..8136ba7661 100644
--- a/modules_v3/user_blog/db_schema/db_schema_2_3.php
+++ b/modules_v3/user_blog/db_schema/db_schema_2_3.php
@@ -28,16 +28,16 @@
// Delete any data that might violate the new constraints
WT_DB::exec(
- "DELETE FROM `##news`".
- " WHERE user_id NOT IN (SELECT user_id FROM `##user` )".
+ "DELETE FROM `##news`" .
+ " WHERE user_id NOT IN (SELECT user_id FROM `##user` )" .
" OR gedcom_id NOT IN (SELECT gedcom_id FROM `##gedcom`)"
);
// Add the new constraints
try {
WT_DB::exec(
- "ALTER TABLE `##news`".
- " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE,".
+ "ALTER TABLE `##news`" .
+ " ADD FOREIGN KEY news_fk1 (user_id ) REFERENCES `##user` (user_id) ON DELETE CASCADE," .
" ADD FOREIGN KEY news_fk2 (gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE"
);
} catch (PDOException $ex) {
diff --git a/modules_v3/user_blog/module.php b/modules_v3/user_blog/module.php
index 1659f63a65..9eaba9ff9c 100644
--- a/modules_v3/user_blog/module.php
+++ b/modules_v3/user_blog/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,13 +20,16 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use \WT\Auth;
+use WT\Theme;
// Create tables, if not already present
try {
WT_DB::updateSchema(WT_MODULES_DIR . 'user_blog/db_schema/', 'NB_SCHEMA_VERSION', 3);
} catch (PDOException $ex) {
// The schema update scripts should never fail. If they do, there is no clean recovery.
- die($ex);
+ WT_FlashMessages::addMessage($ex->getMessage(), 'danger');
+ header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'site-unavailable.php');
+ throw $ex;
}
/**
@@ -55,7 +58,7 @@ class user_blog_WT_Module extends WT_Module implements WT_Module_Block {
}
break;
}
- $block = get_block_setting($block_id, 'block', true);
+ $block = get_block_setting($block_id, 'block', '1');
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
@@ -85,17 +88,16 @@ class user_blog_WT_Module extends WT_Module implements WT_Module_Block {
}
$content .= $news->body . '<br><br>';
$content .= '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $news->news_id . ', \'_blank\', indx_window_specs); return false;">' . WT_I18N::translate('Edit') . '</a> | ';
- $content .= '<a href="index.php?action=deletenews&amp;news_id=' . $news->news_id . '&amp;ctype=' . $ctype .'" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>';
+ $content .= '<a href="index.php?action=deletenews&amp;news_id=' . $news->news_id . '&amp;ctype=' . $ctype . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this journal entry?') . "');\">" . WT_I18N::translate('Delete') . '</a><br>';
$content .= "</div><br>";
}
$content .= '<br><a href="#" onclick="window.open(\'editnews.php?user_id=' . Auth::id() . '\', \'_blank\', indx_window_specs); return false;">' . WT_I18N::translate('Add a new journal entry') . '</a>';
if ($template) {
if ($block) {
- require WT_THEME_DIR . 'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR . 'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/user_favorites/module.php b/modules_v3/user_favorites/module.php
index 26fe380f5a..bbc081ac68 100644
--- a/modules_v3/user_favorites/module.php
+++ b/modules_v3/user_favorites/module.php
@@ -55,7 +55,7 @@ class user_favorites_WT_Module extends gedcom_favorites_WT_Module {
return
WT_DB::prepare(
- "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title AS title, note AS note, url AS url".
+ "SELECT SQL_CACHE favorite_id AS id, user_id, gedcom_id, xref AS gid, favorite_type AS type, title AS title, note AS note, url AS url" .
" FROM `##favorite` WHERE user_id=? AND gedcom_id=?")
->execute(array($user_id, WT_GED_ID))
->fetchAll(PDO::FETCH_ASSOC);
@@ -63,7 +63,7 @@ class user_favorites_WT_Module extends gedcom_favorites_WT_Module {
/** {@inheritdoc} */
public function modAction($modAction) {
- switch($modAction) {
+ switch ($modAction) {
case 'menu-add-favorite':
// Process the "add to user favorites" menu item on indi/fam/etc. pages
$record = WT_GedcomRecord::getInstance(WT_Filter::post('xref', WT_REGEX_XREF));
diff --git a/modules_v3/user_messages/module.php b/modules_v3/user_messages/module.php
index 3cb5ac28b5..dc62f8cebf 100644
--- a/modules_v3/user_messages/module.php
+++ b/modules_v3/user_messages/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
use WT\User;
/**
@@ -37,22 +38,22 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
- require_once WT_ROOT.'includes/functions/functions_print_facts.php';
+ public function getBlock($block_id, $template = true, $cfg = null) {
+ require_once WT_ROOT . 'includes/functions/functions_print_facts.php';
// Block actions
- $action = WT_Filter::post('action');
+ $action = WT_Filter::post('action');
$message_ids = WT_Filter::postArray('message_id');
- if ($action=='deletemessage') {
+ if ($action === 'deletemessage') {
foreach ($message_ids as $message_id) {
WT_DB::prepare("DELETE FROM `##message` WHERE message_id=?")->execute(array($message_id));
}
}
- $block=get_block_setting($block_id, 'block', true);
+ $block = get_block_setting($block_id, 'block', '1');
if ($cfg) {
foreach (array('block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -60,68 +61,68 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
->execute(array(Auth::id()))
->fetchAll();
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
- $title=WT_I18N::plural('%s message', '%s messages',count($messages), WT_I18N::number(count($messages)));
- $content='<form name="messageform" method="post" onsubmit="return confirm(\''.WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.').'\');">';
- if (count(User::all()) > 1) {
- $content.='<br>'.WT_I18N::translate('Send a message')." <select name=\"touser\">";
- $content.='<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
- foreach (User::all() as $user) {
- if ($user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none') {
- $content.='<option value="' . WT_Filter::escapeHtml($user->getUserName()) . '">';
- $content.='<span dir="auto">'.WT_Filter::escapeHtml($user->getRealName()).'</span> - <span dir="auto">' . WT_Filter::escapeHtml($user->getUserName()) . '</span>';
- $content.='</option>';
- }
+ $count = count($messages);
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
+ $title = WT_I18N::plural('%s message', '%s messages', $count, WT_I18N::number($count));
+ $users = array_filter(User::all(), function(User $user) {
+ return $user->getUserId() !== Auth::id() && $user->getPreference('verified_by_admin') && $user->getPreference('contactmethod') !== 'none';
+ });
+
+ $content = '<form name="messageform" method="post" onsubmit="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\');">';
+ if ($users) {
+ $content .= '<label for="touser">' . WT_I18N::translate('Send a message') . '</label>';
+ $content .= '<select id="touser" name="touser">';
+ $content .= '<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
+ foreach ($users as $user) {
+ $content .= sprintf('<option value="%1$s">%2$s - %1$s</option>', WT_Filter::escapeHtml($user->getUserName()), WT_Filter::escapeHtml($user->getRealName()));
}
- $content.='</select> <input type="button" value="'.WT_I18N::translate('Send').'" onclick="message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\'); return false;"><br><br>';
+ $content .= '</select>';
+ $content .= '<input type="button" value="' . WT_I18N::translate('Send') . '" onclick="message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\'); return false;"><br><br>';
}
- if (count($messages)==0) {
- $content.=WT_I18N::translate('You have no pending messages.')."<br>";
- } else {
- $content.='<input type="hidden" name="action" value="deletemessage">';
- $content.='<table class="list_table"><tr>';
- $content.='<td class="list_label">'.WT_I18N::translate('Delete').'<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">'.WT_I18N::translate('All').'</a></td>';
- $content.='<td class="list_label">'.WT_I18N::translate('Subject:').'</td>';
- $content.='<td class="list_label">'.WT_I18N::translate('Date sent:').'</td>';
- $content.='<td class="list_label">'.WT_I18N::translate('Email address:').'</td>';
- $content.='</tr>';
+ if ($messages) {
+ $content .= '<input type="hidden" name="action" value="deletemessage">';
+ $content .= '<table class="list_table"><tr>';
+ $content .= '<th class="list_label">' . WT_I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . WT_I18N::translate('All') . '</a></th>';
+ $content .= '<th class="list_label">' . WT_I18N::translate('Subject:') . '</th>';
+ $content .= '<th class="list_label">' . WT_I18N::translate('Date sent:') . '</th>';
+ $content .= '<th class="list_label">' . WT_I18N::translate('Email address:') . '</th>';
+ $content .= '</tr>';
foreach ($messages as $message) {
- $content.='<tr>';
- $content.='<td class="list_value_wrap"><input type="checkbox" id="cb_message'.$message->message_id.'" name="message_id[]" value="'.$message->message_id.'"></td>';
- $content.='<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message'.$message->message_id.'\');"><i id="message'.$message->message_id.'_img" class="icon-plus"></i> <b dir="auto">'.WT_Filter::escapeHtml($message->subject).'</b></a></td>';
- $content.='<td class="list_value_wrap">'.format_timestamp($message->created).'</td>';
- $content.='<td class="list_value_wrap">';
+ $content .= '<tr>';
+ $content .= '<td class="list_value_wrap"><input type="checkbox" id="cb_message' . $message->message_id . '" name="message_id[]" value="' . $message->message_id . '"></td>';
+ $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . WT_Filter::escapeHtml($message->subject) . '</b></a></td>';
+ $content .= '<td class="list_value_wrap">' . format_timestamp($message->created) . '</td>';
+ $content .= '<td class="list_value_wrap">';
$user = User::findByIdentifier($message->sender);
if ($user) {
- $content.='<span dir="auto">' . $user->getRealName() . '</span>';
- $content.=' - <span dir="auto">' . $user->getEmail() . '</span>';
+ $content .= '<span dir="auto">' . $user->getRealName() . '</span>';
+ $content .= ' - <span dir="auto">' . $user->getEmail() . '</span>';
} else {
- $content.='<a href="mailto:'.WT_Filter::escapeHtml($message->sender).'">'.WT_Filter::escapeHtml($message->sender).'</a>';
+ $content .= '<a href="mailto:' . WT_Filter::escapeHtml($message->sender) . '">' . WT_Filter::escapeHtml($message->sender) . '</a>';
}
- $content.='</td>';
- $content.='</tr>';
- $content.='<tr><td class="list_value_wrap" colspan="5"><div id="message'.$message->message_id.'" style="display:none;">';
- $content.='<div dir="auto" style="white-space: pre-wrap;">' . WT_Filter::expandUrls($message->body) . '</div><br>';
- if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ WT_I18N::translate('RE: '))!==0) {
- $message->subject= WT_I18N::translate('RE: ').$message->subject;
+ $content .= '</td>';
+ $content .= '</tr>';
+ $content .= '<tr><td class="list_value_wrap" colspan="4"><div id="message' . $message->message_id . '" style="display:none;">';
+ $content .= '<div dir="auto" style="white-space: pre-wrap;">' . WT_Filter::expandUrls($message->body) . '</div><br>';
+ if (strpos($message->subject, /* I18N: When replying to an email, the subject becomes “RE: <subject>” */ WT_I18N::translate('RE: ')) !== 0) {
+ $message->subject = WT_I18N::translate('RE: ') . $message->subject;
}
if ($user) {
- $content.='<a href="#" onclick="reply(\''.WT_Filter::escapeJs($message->sender).'\', \''.WT_Filter::escapeJs($message->subject).'\'); return false;">'.WT_I18N::translate('Reply').'</a> | ';
+ $content .= '<a href="#" onclick="reply(\'' . WT_Filter::escapeJs($message->sender) . '\', \'' . WT_Filter::escapeJs($message->subject) . '\'); return false;">' . WT_I18N::translate('Reply') . '</a> | ';
}
- $content.='<a href="index.php?action=deletemessage&amp;message_id[]='.$message->message_id.'" onclick="return confirm(\''.WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.').'\');">'.WT_I18N::translate('Delete').'</a></div></td></tr>';
+ $content .= '<a href="index.php?action=deletemessage&amp;message_id%5B%5D=' . $message->message_id . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message? It cannot be retrieved later.') . '\');">' . WT_I18N::translate('Delete') . '</a></div></td></tr>';
}
- $content.='</table>';
- $content.='<input type="submit" value="'.WT_I18N::translate('Delete selected messages').'"><br>';
+ $content .= '</table>';
+ $content .= '<input type="submit" value="' . WT_I18N::translate('Delete selected messages') . '"><br>';
}
- $content.='</form>';
+ $content .= '</form>';
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -145,13 +146,12 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
- $block=get_block_setting($block_id, 'block', true);
+ $block = get_block_setting($block_id, 'block', '1');
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';
diff --git a/modules_v3/user_welcome/module.php b/modules_v3/user_welcome/module.php
index 2eb5a59a53..580d3ad5d9 100644
--- a/modules_v3/user_welcome/module.php
+++ b/modules_v3/user_welcome/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -20,6 +20,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
+use WT\Theme;
/**
* Class user_welcome_WT_Module
@@ -36,22 +37,21 @@ class user_welcome_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
- $id=$this->getName().$block_id;
- $class=$this->getName().'_block';
+ public function getBlock($block_id, $template = true, $cfg = null) {
+ $id = $this->getName() . $block_id;
+ $class = $this->getName() . '_block';
$title = '<span dir="auto">' . /* I18N: A greeting; %s is the user’s name */ WT_I18N::translate('Welcome %s', Auth::user()->getRealName()) . '</span>';
$content = '<table><tr>';
- if (Auth::user()->getPreference('editaccount')) {
- $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>'.WT_I18N::translate('My account').'</a></td>';
- }
+ $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . WT_I18N::translate('My account') . '</a></td>';
+
if (WT_USER_GEDCOM_ID) {
- $content .= '<td><a href="pedigree.php?rootid='.WT_USER_GEDCOM_ID.'&amp;ged='.WT_GEDURL.'"><i class="icon-pedigree"></i><br>'.WT_I18N::translate('My pedigree').'</a></td>';
- $content .= '<td><a href="individual.php?pid='.WT_USER_GEDCOM_ID.'&amp;ged='.WT_GEDURL.'"><i class="icon-indis"></i><br>'.WT_I18N::translate('My individual record').'</a></td>';
+ $content .= '<td><a href="pedigree.php?rootid=' . WT_USER_GEDCOM_ID . '&amp;ged=' . WT_GEDURL . '"><i class="icon-pedigree"></i><br>' . WT_I18N::translate('My pedigree') . '</a></td>';
+ $content .= '<td><a href="individual.php?pid=' . WT_USER_GEDCOM_ID . '&amp;ged=' . WT_GEDURL . '"><i class="icon-indis"></i><br>' . WT_I18N::translate('My individual record') . '</a></td>';
}
$content .= '</tr></table>';
if ($template) {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
diff --git a/modules_v3/yahrzeit/help_text.php b/modules_v3/yahrzeit/help_text.php
deleted file mode 100644
index 3c9d9e39a2..0000000000
--- a/modules_v3/yahrzeit/help_text.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-// Module help text.
-//
-// This file is included from the application help_text.php script.
-// It simply needs to set $title and $text for the help topic $help_topic
-//
-// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-if (!defined('WT_WEBTREES') || !defined('WT_SCRIPT_NAME') || WT_SCRIPT_NAME!='help_text.php') {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-switch ($help) {
-}
diff --git a/modules_v3/yahrzeit/module.php b/modules_v3/yahrzeit/module.php
index d4fe803b44..c99881e32e 100644
--- a/modules_v3/yahrzeit/module.php
+++ b/modules_v3/yahrzeit/module.php
@@ -1,6 +1,6 @@
<?php
// webtrees: Web based Family History software
-// Copyright (C) 2014 webtrees development team.
+// Copyright (C) 2015 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2010 John Finlay
@@ -22,6 +22,7 @@
use Fisharebest\ExtCalendar\JewishCalendar;
use Rhumsaa\Uuid\Uuid;
use WT\Auth;
+use WT\Theme;
/**
* Class yahrzeit_WT_Module
@@ -38,18 +39,18 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
}
/** {@inheritdoc} */
- public function getBlock($block_id, $template=true, $cfg=null) {
+ public function getBlock($block_id, $template = true, $cfg = null) {
global $ctype, $controller;
- $days = get_block_setting($block_id, 'days', 7);
+ $days = get_block_setting($block_id, 'days', '7');
$infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
- $calendar = get_block_setting($block_id, 'calendar', 'jewish');
- $block = get_block_setting($block_id, 'block', true);
+ $calendar = get_block_setting($block_id, 'calendar', 'jewish');
+ $block = get_block_setting($block_id, 'block', '1');
if ($cfg) {
foreach (array('days', 'infoStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
+ $$name = $cfg[$name];
}
}
}
@@ -60,24 +61,24 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) {
- $title = '<i class="icon-admin" title="'.WT_I18N::translate('Configure').'" onclick="modalDialog(\'block_edit.php?block_id='.$block_id.'\', \''.$this->getTitle().'\');"></i>';
+ $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
} else {
$title = '';
}
$title .= $this->getTitle();
- $content='';
+ $content = '';
// The standard anniversary rules cover most of the Yahrzeit rules, we just
// need to handle a few special cases.
// Fetch normal anniversaries...
- $yahrzeits=array();
- for ($jd=$startjd-1; $jd<=$endjd+$days; ++$jd) {
+ $yahrzeits = array();
+ for ($jd = $startjd - 1; $jd <= $endjd + $days; ++$jd) {
foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
// Exact hebrew dates only
$date = $fact->getDate();
- if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD()==$date->MaxJD()) {
+ if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD() == $date->MaxJD()) {
$fact->jd = $jd;
- $yahrzeits[]=$fact;
+ $yahrzeits[] = $fact;
}
}
}
@@ -86,48 +87,49 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
$jewish_calendar = new JewishCalendar;
foreach ($yahrzeits as $yahrzeit) {
- if ($yahrzeit->getTag() == 'DEAT') { // Just DEAT, not _YART
- $today=new WT_Date_Jewish($yahrzeit->jd);
- $hd=$yahrzeit->getDate()->MinDate();
- $hd1=new WT_Date_Jewish($hd);
- $hd1->y+=1;
+ if ($yahrzeit->getTag() === 'DEAT') {
+ $today = new WT_Date_Jewish($yahrzeit->jd);
+ $hd = $yahrzeit->getDate()->MinDate();
+ $hd1 = new WT_Date_Jewish($hd);
+ $hd1->y += 1;
$hd1->setJdFromYmd();
// Special rules. See http://www.hebcal.com/help/anniv.html
// Everything else is taken care of by our standard anniversary rules.
- if ($hd->d==30 && $hd->m==2 && $hd->y!=0 && $hd1->daysInMonth()<30) { // 30 CSH
- // Last day in CSH
- $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1)-1;
- } elseif ($hd->d==30 && $hd->m==3 && $hd->y!=0 && $hd1->daysInMonth()<30) { // 30 KSL
- // Last day in KSL
- $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1)-1;
- } elseif ($hd->d==30 && $hd->m==6 && $hd->y!=0 && $today->daysInMonth()<30 && !$today->isLeapYear()) { // 30 ADR
- // Last day in SHV
- $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1)-1;
+ if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
+ // 30 CSH - Last day in CSH
+ $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1;
+ } elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
+ // 30 KSL - Last day in KSL
+ $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1;
+ } elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) {
+ // 30 ADR - Last day in SHV
+ $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1;
}
}
}
switch ($infoStyle) {
case 'list':
- foreach ($yahrzeits as $yahrzeit)
- if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd+$days) {
- $ind=$yahrzeit->getParent();
- $content .= "<a href=\"".$ind->getHtmlUrl()."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage();
+ foreach ($yahrzeits as $yahrzeit) {
+ if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
+ $ind = $yahrzeit->getParent();
+ $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
$content .= "<div class=\"indent\">";
$content .= $yahrzeit->getDate()->Display(true);
- $content .= ', '.WT_I18N::translate('%s year anniversary', $yahrzeit->anniv);
+ $content .= ', ' . WT_I18N::translate('%s year anniversary', $yahrzeit->anniv);
$content .= "</div>";
}
+ }
break;
case 'table':
default:
$table_id = Uuid::uuid4(); // table requires a unique ID
$controller
- ->addExternalJavascript(WT_JQUERY_DATATABLES_URL)
+ ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
->addInlineJavascript('
- jQuery("#'.$table_id.'").dataTable({
+ jQuery("#'.$table_id . '").dataTable({
dom: \'t\',
- '.WT_I18N::datatablesI18N().',
+ ' . WT_I18N::datatablesI18N() . ',
autoWidth: false,
paginate: false,
lengthChange: false,
@@ -145,59 +147,59 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
/* 6-YART */ { visible: false }
]
});
- jQuery("#'.$table_id.'").css("visibility", "visible");
+ jQuery("#'.$table_id . '").css("visibility", "visible");
jQuery(".loading-image").css("display", "none");
');
- $content='';
+ $content = '';
$content .= '<div class="loading-image">&nbsp;</div>';
- $content .= '<table id="'.$table_id.'" class="width100" style="visibility:hidden;">';
+ $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
$content .= '<thead><tr>';
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('NAME').'</th>';
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('NAME').'</th>';
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('DEAT').'</th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('DEAT') . '</th>';
$content .= '<th>DEAT</th>';
- $content .= '<th><i class="icon-reminder" title="'.WT_I18N::translate('Anniversary').'"></i></th>';
- $content .= '<th>'.WT_Gedcom_Tag::getLabel('_YART').'</th>';
+ $content .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>';
+ $content .= '<th>' . WT_Gedcom_Tag::getLabel('_YART') . '</th>';
$content .= '<th>_YART</th>';
$content .= '</tr></thead><tbody>';
foreach ($yahrzeits as $yahrzeit) {
- if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd+$days) {
+ if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
$content .= '<tr>';
- $ind=$yahrzeit->getParent();
+ $ind = $yahrzeit->getParent();
// Individual name(s)
- $name=$ind->getFullName();
- $url=$ind->getHtmlUrl();
+ $name = $ind->getFullName();
+ $url = $ind->getHtmlUrl();
$content .= '<td>';
- $content .= '<a href="'.$url.'">'.$name.'</a>';
+ $content .= '<a href="' . $url . '">' . $name . '</a>';
$content .= $ind->getSexImage();
- $addname=$ind->getAddName();
+ $addname = $ind->getAddName();
if ($addname) {
- $content .= '<br><a href="'.$url.'">'.$addname.'</a>';
+ $content .= '<br><a href="' . $url . '">' . $addname . '</a>';
}
$content .= '</td>';
- $content .= '<td>'.$ind->getSortName().'</td>';
+ $content .= '<td>' . $ind->getSortName() . '</td>';
// death/yahrzeit event date
- $content .= '<td>'.$yahrzeit->getDate()->Display().'</td>';
- $content .= '<td>'.$yahrzeit->getDate()->minJD().'</td>';// sortable date
+ $content .= '<td>' . $yahrzeit->getDate()->Display() . '</td>';
+ $content .= '<td>' . $yahrzeit->getDate()->minJD() . '</td>'; // sortable date
// Anniversary
- $content .= '<td>'.$yahrzeit->anniv.'</td>';
+ $content .= '<td>' . $yahrzeit->anniv . '</td>';
// upcomming yahrzeit dates
switch ($calendar) {
case 'gregorian':
- $today=new WT_Date_Gregorian($yahrzeit->jd);
+ $today = new WT_Date_Gregorian($yahrzeit->jd);
break;
case 'jewish':
default:
- $today=new WT_Date_Jewish($yahrzeit->jd);
+ $today = new WT_Date_Jewish($yahrzeit->jd);
break;
}
- $td=new WT_Date($today->format('%@ %A %O %E'));
- $content .= '<td>'.$td->display().'</td>';
- $content .= '<td>'.$td->minJD().'</td>';// sortable date
+ $td = new WT_Date($today->format('%@ %A %O %E'));
+ $content .= '<td>' . $td->display() . '</td>';
+ $content .= '<td>' . $td->minJD() . '</td>'; // sortable date
$content .= '</tr>';
}
@@ -209,10 +211,9 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
if ($template) {
if ($block) {
- require WT_THEME_DIR.'templates/block_small_temp.php';
- } else {
- require WT_THEME_DIR.'templates/block_main_temp.php';
+ $class .= ' small_inner_block';
}
+ return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
@@ -236,31 +237,32 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
/** {@inheritdoc} */
public function configureBlock($block_id) {
if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
- set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
+ set_block_setting($block_id, 'days', WT_Filter::postInteger('days', 1, 30, 7));
set_block_setting($block_id, 'infoStyle', WT_Filter::post('infoStyle', 'list|table', 'table'));
- set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish'));
- set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
- exit;
+ set_block_setting($block_id, 'calendar', WT_Filter::post('calendar', 'jewish|gregorian', 'jewish'));
+ set_block_setting($block_id, 'block', WT_Filter::postBool('block'));
}
- require_once WT_ROOT.'includes/functions/functions_edit.php';
+ require_once WT_ROOT . 'includes/functions/functions_edit.php';
+
+ $days = get_block_setting($block_id, 'days', '7');
+ $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
+ $calendar = get_block_setting($block_id, 'calendar', 'jewish');
+ $block = get_block_setting($block_id, 'block', '1');
- $days=get_block_setting($block_id, 'days', 7);
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Number of days to show');
echo '</td><td class="optionbox">';
- echo '<input type="text" name="days" size="2" value="'.$days.'">';
- echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30) ,'</em>';
+ echo '<input type="text" name="days" size="2" value="' . $days . '">';
+ echo ' <em>', WT_I18N::plural('maximum %d day', 'maximum %d days', 30, 30), '</em>';
echo '</td></tr>';
- $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Presentation style');
echo '</td><td class="optionbox">';
echo select_edit_control('infoStyle', array('list'=>WT_I18N::translate('list'), 'table'=>WT_I18N::translate('table')), null, $infoStyle, '');
echo '</td></tr>';
- $calendar=get_block_setting($block_id, 'calendar');
echo '<tr><td class="descriptionbox wrap width33">';
echo WT_I18N::translate('Calendar');
echo '</td><td class="optionbox">';
@@ -270,7 +272,6 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
), null, $calendar, '');
echo '</td></tr>';
- $block=get_block_setting($block_id, 'block', true);
echo '<tr><td class="descriptionbox wrap width33">';
echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
echo '</td><td class="optionbox">';