summaryrefslogtreecommitdiff
path: root/app/Controller/HourglassController.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2017-03-07 12:02:25 +0000
committerGreg Roach <fisharebest@gmail.com>2017-06-17 16:17:44 +0100
commit15d603e7c7c15d20f055d3d9c38d6b133453c5be (patch)
tree14cd348cd8d2cbb465626429334a9558c0bf5a43 /app/Controller/HourglassController.php
parent95664b44addad5559917902d85518988a3ea7bc4 (diff)
downloadwebtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.tar.gz
webtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.tar.bz2
webtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.zip
jQuery-3, Bootstrap-4, FontAwesome-4.7, Select2-4, remove popup windows
Diffstat (limited to 'app/Controller/HourglassController.php')
-rw-r--r--app/Controller/HourglassController.php54
1 files changed, 21 insertions, 33 deletions
diff --git a/app/Controller/HourglassController.php b/app/Controller/HourglassController.php
index 27c6fa04ca..899439c3d0 100644
--- a/app/Controller/HourglassController.php
+++ b/app/Controller/HourglassController.php
@@ -43,29 +43,21 @@ class HourglassController extends ChartController {
/** @var string An arrow that points to the end of the line. */
private $right_arrow;
- /** @var bool Can the Javascript be loaded by the controller. */
- private $canLoadJS;
-
- const LINK = "<a class='%s' href='%s' data-parms='%s-%s-%s'></a>";
- const SWITCH_LINK = "<a href='hourglass.php?rootid=%s&amp;show_spouse=%s&amp;show_full=%s&amp;generations=%s' class='name1'>%s</a>";
+ const LINK = "<a class='%s' href='%s' data-parms='%s-%s'></a>";
+ const SWITCH_LINK = "<a href='hourglass.php?rootid=%s&amp;show_spouse=%s&amp;generations=%s' class='name1'>%s</a>";
/**
* Create the hourglass controller.
*
* @param string $rootid
- * @param bool $show_full
- * @param bool $loadJS
*/
- public function __construct($rootid = '', $show_full = true, $loadJS = true) {
-
+ public function __construct($rootid = '') {
parent::__construct();
// Extract parameters from
$this->show_spouse = Filter::getInteger('show_spouse', 0, 1, 0);
$this->generations = Filter::getInteger('generations', 2, $this->tree()->getPreference('MAX_DESCENDANCY_GENERATIONS'), 3);
- $this->canLoadJS = $loadJS;
-
//-- flip the arrows for RTL languages
if (I18N::direction() === 'ltr') {
$this->left_arrow = 'icon-larrow';
@@ -123,7 +115,7 @@ class HourglassController extends ChartController {
echo '<td><img class="line4" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3"></td>';
echo '<td>';
//-- print the father box
- FunctionsPrint::printPedigreePerson($family->getHusband(), $this->showFull());
+ FunctionsPrint::printPedigreePerson($family->getHusband());
echo '</td>';
if ($family->getHusband()) {
$ARID = $family->getHusband()->getXref();
@@ -131,7 +123,7 @@ class HourglassController extends ChartController {
//-- print an Ajax arrow on the last generation of the adult male
if ($count == $this->generations - 1 && $family->getHusband()->getChildFamilies()) {
- printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->showFull(), $this->show_spouse);
+ printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->show_spouse);
}
//-- recursively get the father’s family
$this->printPersonPedigree($family->getHusband(), $count + 1);
@@ -155,7 +147,7 @@ class HourglassController extends ChartController {
'<td><img class="line4" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3"></td>',
'<td>';
//-- print the mother box
- FunctionsPrint::printPedigreePerson($family->getWife(), $this->showFull());
+ FunctionsPrint::printPedigreePerson($family->getWife());
echo '</td>';
if ($family->getWife()) {
$ARID = $family->getWife()->getXref();
@@ -163,7 +155,7 @@ class HourglassController extends ChartController {
//-- print an ajax arrow on the last generation of the adult female
if ($count == $this->generations - 1 && $family->getWife()->getChildFamilies()) {
- printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->showFull(), $this->show_spouse);
+ printf(self::LINK, $this->right_arrow, $ARID, 'asc', $this->show_spouse);
}
//-- recursively print the mother’s family
$this->printPersonPedigree($family->getWife(), $count + 1);
@@ -181,7 +173,7 @@ class HourglassController extends ChartController {
*/
private function printEmptyBox() {
- return $this->showFull() ? Theme::theme()->individualBoxEmpty() : Theme::theme()->individualBoxSmallEmpty();
+ return Theme::theme()->individualBoxEmpty();
}
/**
@@ -277,7 +269,7 @@ class HourglassController extends ChartController {
if ($kcount == 0) {
echo "</td><td style='width:", $this->getBoxDimensions()->width, "px'>";
} else {
- printf(self::LINK, $this->left_arrow, $pid, 'desc', $this->showFull(), $this->show_spouse);
+ printf(self::LINK, $this->left_arrow, $pid, 'desc', $this->show_spouse);
//-- move the arrow up to line up with the correct box
if ($this->show_spouse) {
echo str_repeat('<br><br><br>', count($families));
@@ -287,14 +279,14 @@ class HourglassController extends ChartController {
}
echo '<table id="table2_' . $pid . '"><tr><td>';
- FunctionsPrint::printPedigreePerson($person, $this->showFull());
+ FunctionsPrint::printPedigreePerson($person);
echo '</td><td><img class="line2" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3">';
//----- Print the spouse
if ($this->show_spouse) {
foreach ($families as $family) {
echo "</td></tr><tr><td style='text-align:$otablealign'>";
- FunctionsPrint::printPedigreePerson($family->getSpouse($person), $this->showFull());
+ FunctionsPrint::printPedigreePerson($family->getSpouse($person));
$numkids++;
echo '</td><td></td>';
}
@@ -326,10 +318,10 @@ class HourglassController extends ChartController {
echo "<span class='name1'>" . I18N::translate('Family') . '</span>';
$spouse = $family->getSpouse($person);
if ($spouse) {
- printf(self::SWITCH_LINK, $spouse->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $spouse->getFullName());
+ printf(self::SWITCH_LINK, $spouse->getXref(), $this->show_spouse, $this->generations, $spouse->getFullName());
}
foreach ($family->getChildren() as $child) {
- printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName());
+ printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->generations, $child->getFullName());
}
}
@@ -339,11 +331,11 @@ class HourglassController extends ChartController {
echo "<span class='name1'>" . I18N::translate('Parents') . '</span>';
$husb = $family->getHusband();
if ($husb) {
- printf(self::SWITCH_LINK, $husb->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $husb->getFullName());
+ printf(self::SWITCH_LINK, $husb->getXref(), $this->show_spouse, $this->generations, $husb->getFullName());
}
$wife = $family->getWife();
if ($wife) {
- printf(self::SWITCH_LINK, $wife->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $wife->getFullName());
+ printf(self::SWITCH_LINK, $wife->getXref(), $this->show_spouse, $this->generations, $wife->getFullName());
}
}
@@ -357,7 +349,7 @@ class HourglassController extends ChartController {
echo $num > 1 ? I18N::translate('Siblings') : I18N::translate('Sibling');
echo '</span>';
foreach ($siblings as $child) {
- printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName());
+ printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->generations, $child->getFullName());
}
}
}
@@ -407,10 +399,12 @@ class HourglassController extends ChartController {
/**
* setup all of the javascript that is needed for the hourglass chart
+ *
+ * @return string
*/
public function setupJavascript() {
- $js = "
- var WT_HOURGLASS_CHART = (function() {
+ return "
+ (function() {
function sizeLines() {
$('.tvertline').each(function(i,e) {
var pid = e.id.split('_').pop();
@@ -438,7 +432,7 @@ class HourglassController extends ChartController {
var self = $(this),
parms = self.data('parms').split('-'),
id = self.attr('href');
- jQuery('#td_'+id).load('hourglass_ajax.php?rootid='+ id +'&generations=1&type='+parms[0]+'&show_full='+(parseInt(parms[1]) ? 1:0) +'&show_spouse='+(parseInt(parms[2]) ? 1:0), function(){
+ $('#td_'+id).load('hourglass_ajax.php?rootid='+ id +'&generations=1&type='+parms[0]+'&show_spouse='+(parseInt(parms[1]) ? 1:0), function(){
sizeLines();
});
});
@@ -446,11 +440,5 @@ class HourglassController extends ChartController {
sizeLines();
})();
";
-
- if ($this->canLoadJS) {
- $this->addInlineJavascript($js);
- } else {
- return $js;
- }
}
}