Passed
Push — 1.7 ( 4c1abf...23cbb7 )
by Greg
08:10
created
app/Theme.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -21,75 +21,75 @@
 block discarded – undo
21 21
  * Provide access to the current theme.
22 22
  */
23 23
 class Theme {
24
-	/**
25
-	 * PHP 5.3.2 requires a constructor when there is also a method
26
-	 * called theme()
27
-	 */
28
-	private function __construct() {
29
-	}
24
+    /**
25
+     * PHP 5.3.2 requires a constructor when there is also a method
26
+     * called theme()
27
+     */
28
+    private function __construct() {
29
+    }
30 30
 
31
-	/** @var ThemeInterface The current theme*/
32
-	private static $theme;
31
+    /** @var ThemeInterface The current theme*/
32
+    private static $theme;
33 33
 
34
-	/** @var ThemeInterface[] All currently installed themes */
35
-	private static $installed_themes;
34
+    /** @var ThemeInterface[] All currently installed themes */
35
+    private static $installed_themes;
36 36
 
37
-	/**
38
-	 * Create a list of all themes available on the system, including
39
-	 * any custom themes.
40
-	 *
41
-	 * @return ThemeInterface[]
42
-	 */
43
-	public static function installedThemes() {
44
-		if (self::$installed_themes === null) {
45
-			self::$installed_themes = array();
46
-			foreach (glob(WT_ROOT . '/themes/*/theme.php') as $theme_path) {
47
-				try {
48
-					$theme = include $theme_path;
49
-					// Themes beginning with an underscore are reserved for special use.
50
-					if (substr_compare($theme->themeId(), '_', 0, 1) !== 0) {
51
-						self::$installed_themes[] = $theme;
52
-					}
53
-				} catch (\Exception $ex) {
54
-					// Broken theme? Ignore it.
55
-				}
56
-			}
57
-		}
37
+    /**
38
+     * Create a list of all themes available on the system, including
39
+     * any custom themes.
40
+     *
41
+     * @return ThemeInterface[]
42
+     */
43
+    public static function installedThemes() {
44
+        if (self::$installed_themes === null) {
45
+            self::$installed_themes = array();
46
+            foreach (glob(WT_ROOT . '/themes/*/theme.php') as $theme_path) {
47
+                try {
48
+                    $theme = include $theme_path;
49
+                    // Themes beginning with an underscore are reserved for special use.
50
+                    if (substr_compare($theme->themeId(), '_', 0, 1) !== 0) {
51
+                        self::$installed_themes[] = $theme;
52
+                    }
53
+                } catch (\Exception $ex) {
54
+                    // Broken theme? Ignore it.
55
+                }
56
+            }
57
+        }
58 58
 
59
-		return self::$installed_themes;
60
-	}
59
+        return self::$installed_themes;
60
+    }
61 61
 
62
-	/**
63
-	 * An associative array of theme names, for <select> fields, etc.
64
-	 *
65
-	 * @return string[]
66
-	 */
67
-	public static function themeNames() {
68
-		$theme_names = array();
69
-		foreach (self::installedThemes() as $theme) {
70
-			$theme_names[$theme->themeId()] = $theme->themeName();
71
-		}
62
+    /**
63
+     * An associative array of theme names, for <select> fields, etc.
64
+     *
65
+     * @return string[]
66
+     */
67
+    public static function themeNames() {
68
+        $theme_names = array();
69
+        foreach (self::installedThemes() as $theme) {
70
+            $theme_names[$theme->themeId()] = $theme->themeName();
71
+        }
72 72
 
73
-		return $theme_names;
74
-	}
73
+        return $theme_names;
74
+    }
75 75
 
76
-	/**
77
-	 * The currently active theme
78
-	 *
79
-	 * @param ThemeInterface|null $theme
80
-	 *
81
-	 * @throws \LogicException
82
-	 *
83
-	 * @return ThemeInterface
84
-	 */
85
-	public static function theme(ThemeInterface $theme = null) {
76
+    /**
77
+     * The currently active theme
78
+     *
79
+     * @param ThemeInterface|null $theme
80
+     *
81
+     * @throws \LogicException
82
+     *
83
+     * @return ThemeInterface
84
+     */
85
+    public static function theme(ThemeInterface $theme = null) {
86 86
 
87
-		if ($theme) {
88
-			self::$theme = $theme;
89
-		} elseif (!self::$theme) {
90
-			throw new \LogicException;
91
-		}
87
+        if ($theme) {
88
+            self::$theme = $theme;
89
+        } elseif (!self::$theme) {
90
+            throw new \LogicException;
91
+        }
92 92
 
93
-		return self::$theme;
94
-	}
93
+        return self::$theme;
94
+    }
95 95
 }
Please login to merge, or discard this patch.
app/Module/UserJournalModule.php 1 patch
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -26,116 +26,116 @@
 block discarded – undo
26 26
  * Class UserJournalModule
27 27
  */
28 28
 class UserJournalModule extends AbstractModule implements ModuleBlockInterface {
29
-	/**
30
-	 * Create a new module.
31
-	 *
32
-	 * @param string $directory Where is this module installed
33
-	 */
34
-	public function __construct($directory) {
35
-		parent::__construct($directory);
36
-
37
-		// Create/update the database tables.
38
-		Database::updateSchema('\Fisharebest\Webtrees\Module\FamilyTreeNews\Schema', 'NB_SCHEMA_VERSION', 3);
39
-	}
40
-
41
-	/**
42
-	 * How should this module be labelled on tabs, menus, etc.?
43
-	 *
44
-	 * @return string
45
-	 */
46
-	public function getTitle() {
47
-		return /* I18N: Name of a module */ I18N::translate('Journal');
48
-	}
49
-
50
-	/**
51
-	 * A sentence describing what this module does.
52
-	 *
53
-	 * @return string
54
-	 */
55
-	public function getDescription() {
56
-		return /* I18N: Description of the “Journal” module */ I18N::translate('A private area to record notes or keep a journal.');
57
-	}
58
-
59
-	/**
60
-	 * Generate the HTML content of this block.
61
-	 *
62
-	 * @param int      $block_id
63
-	 * @param bool     $template
64
-	 * @param string[] $cfg
65
-	 *
66
-	 * @return string
67
-	 */
68
-	public function getBlock($block_id, $template = true, $cfg = array()) {
69
-		global $ctype, $WT_TREE;
70
-
71
-		switch (Filter::get('action')) {
72
-		case 'deletenews':
73
-			$news_id = Filter::getInteger('news_id');
74
-			if ($news_id) {
75
-				Database::prepare("DELETE FROM `##news` WHERE news_id = ?")->execute(array($news_id));
76
-			}
77
-			break;
78
-		}
79
-
80
-		$articles = Database::prepare(
81
-			"SELECT news_id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) + :offset AS updated, subject, body FROM `##news` WHERE user_id = :user_id ORDER BY updated DESC"
82
-		)->execute(array(
83
-			'offset'  => WT_TIMESTAMP_OFFSET,
84
-			'user_id' => Auth::id(),
85
-		))->fetchAll();
86
-
87
-		$id      = $this->getName() . $block_id;
88
-		$class   = $this->getName() . '_block';
89
-		$title   = $this->getTitle();
90
-		$content = '';
91
-
92
-		if (empty($articles)) {
93
-			$content .= '<p>' . I18N::translate('You have not created any journal items.') . '</p>';
94
-		}
95
-
96
-		foreach ($articles as $article) {
97
-			$content .= '<div class="journal_box">';
98
-			$content .= '<div class="news_title">' . Filter::escapeHtml($article->subject) . '</div>';
99
-			$content .= '<div class="news_date">' . FunctionsDate::formatTimestamp($article->updated) . '</div>';
100
-			if ($article->body == strip_tags($article->body)) {
101
-				$article->body = nl2br($article->body, false);
102
-			}
103
-			$content .= $article->body;
104
-			$content .= '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $article->news_id . ', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Edit') . '</a>';
105
-			$content .= ' | ';
106
-			$content .= '<a href="index.php?action=deletenews&amp;news_id=' . $article->news_id . '&amp;ctype=' . $ctype . '&amp;ged=' . $WT_TREE->getNameHtml() . '" onclick="return confirm(\'' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeHtml($article->subject)) . "');\">" . I18N::translate('Delete') . '</a><br>';
107
-			$content .= '</div><br>';
108
-		}
109
-
110
-		$content .= '<p><a href="#" onclick="window.open(\'editnews.php?user_id=' . Auth::id() . '\', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Add a journal entry') . '</a></p>';
111
-
112
-		if ($template) {
113
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
114
-		} else {
115
-			return $content;
116
-		}
117
-	}
118
-
119
-	/** {@inheritdoc} */
120
-	public function loadAjax() {
121
-		return false;
122
-	}
123
-
124
-	/** {@inheritdoc} */
125
-	public function isUserBlock() {
126
-		return true;
127
-	}
128
-
129
-	/** {@inheritdoc} */
130
-	public function isGedcomBlock() {
131
-		return false;
132
-	}
133
-
134
-	/**
135
-	 * An HTML form to edit block settings
136
-	 *
137
-	 * @param int $block_id
138
-	 */
139
-	public function configureBlock($block_id) {
140
-	}
29
+    /**
30
+     * Create a new module.
31
+     *
32
+     * @param string $directory Where is this module installed
33
+     */
34
+    public function __construct($directory) {
35
+        parent::__construct($directory);
36
+
37
+        // Create/update the database tables.
38
+        Database::updateSchema('\Fisharebest\Webtrees\Module\FamilyTreeNews\Schema', 'NB_SCHEMA_VERSION', 3);
39
+    }
40
+
41
+    /**
42
+     * How should this module be labelled on tabs, menus, etc.?
43
+     *
44
+     * @return string
45
+     */
46
+    public function getTitle() {
47
+        return /* I18N: Name of a module */ I18N::translate('Journal');
48
+    }
49
+
50
+    /**
51
+     * A sentence describing what this module does.
52
+     *
53
+     * @return string
54
+     */
55
+    public function getDescription() {
56
+        return /* I18N: Description of the “Journal” module */ I18N::translate('A private area to record notes or keep a journal.');
57
+    }
58
+
59
+    /**
60
+     * Generate the HTML content of this block.
61
+     *
62
+     * @param int      $block_id
63
+     * @param bool     $template
64
+     * @param string[] $cfg
65
+     *
66
+     * @return string
67
+     */
68
+    public function getBlock($block_id, $template = true, $cfg = array()) {
69
+        global $ctype, $WT_TREE;
70
+
71
+        switch (Filter::get('action')) {
72
+        case 'deletenews':
73
+            $news_id = Filter::getInteger('news_id');
74
+            if ($news_id) {
75
+                Database::prepare("DELETE FROM `##news` WHERE news_id = ?")->execute(array($news_id));
76
+            }
77
+            break;
78
+        }
79
+
80
+        $articles = Database::prepare(
81
+            "SELECT news_id, user_id, gedcom_id, UNIX_TIMESTAMP(updated) + :offset AS updated, subject, body FROM `##news` WHERE user_id = :user_id ORDER BY updated DESC"
82
+        )->execute(array(
83
+            'offset'  => WT_TIMESTAMP_OFFSET,
84
+            'user_id' => Auth::id(),
85
+        ))->fetchAll();
86
+
87
+        $id      = $this->getName() . $block_id;
88
+        $class   = $this->getName() . '_block';
89
+        $title   = $this->getTitle();
90
+        $content = '';
91
+
92
+        if (empty($articles)) {
93
+            $content .= '<p>' . I18N::translate('You have not created any journal items.') . '</p>';
94
+        }
95
+
96
+        foreach ($articles as $article) {
97
+            $content .= '<div class="journal_box">';
98
+            $content .= '<div class="news_title">' . Filter::escapeHtml($article->subject) . '</div>';
99
+            $content .= '<div class="news_date">' . FunctionsDate::formatTimestamp($article->updated) . '</div>';
100
+            if ($article->body == strip_tags($article->body)) {
101
+                $article->body = nl2br($article->body, false);
102
+            }
103
+            $content .= $article->body;
104
+            $content .= '<a href="#" onclick="window.open(\'editnews.php?news_id=\'+' . $article->news_id . ', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Edit') . '</a>';
105
+            $content .= ' | ';
106
+            $content .= '<a href="index.php?action=deletenews&amp;news_id=' . $article->news_id . '&amp;ctype=' . $ctype . '&amp;ged=' . $WT_TREE->getNameHtml() . '" onclick="return confirm(\'' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeHtml($article->subject)) . "');\">" . I18N::translate('Delete') . '</a><br>';
107
+            $content .= '</div><br>';
108
+        }
109
+
110
+        $content .= '<p><a href="#" onclick="window.open(\'editnews.php?user_id=' . Auth::id() . '\', \'_blank\', indx_window_specs); return false;">' . I18N::translate('Add a journal entry') . '</a></p>';
111
+
112
+        if ($template) {
113
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
114
+        } else {
115
+            return $content;
116
+        }
117
+    }
118
+
119
+    /** {@inheritdoc} */
120
+    public function loadAjax() {
121
+        return false;
122
+    }
123
+
124
+    /** {@inheritdoc} */
125
+    public function isUserBlock() {
126
+        return true;
127
+    }
128
+
129
+    /** {@inheritdoc} */
130
+    public function isGedcomBlock() {
131
+        return false;
132
+    }
133
+
134
+    /**
135
+     * An HTML form to edit block settings
136
+     *
137
+     * @param int $block_id
138
+     */
139
+    public function configureBlock($block_id) {
140
+    }
141 141
 }
Please login to merge, or discard this patch.
app/Module/DeathReportModule.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
  * Class DeathReportModule
24 24
  */
25 25
 class DeathReportModule extends AbstractModule implements ModuleReportInterface {
26
-	/** {@inheritdoc} */
27
-	public function getTitle() {
28
-		// This text also appears in the .XML file - update both together
29
-		return /* I18N: Name of a module/report */ I18N::translate('Deaths');
30
-	}
26
+    /** {@inheritdoc} */
27
+    public function getTitle() {
28
+        // This text also appears in the .XML file - update both together
29
+        return /* I18N: Name of a module/report */ I18N::translate('Deaths');
30
+    }
31 31
 
32
-	/** {@inheritdoc} */
33
-	public function getDescription() {
34
-		// This text also appears in the .XML file - update both together
35
-		return /* I18N: Description of the “Deaths” module */ I18N::translate('A report of individuals who died in a given time or place.');
36
-	}
32
+    /** {@inheritdoc} */
33
+    public function getDescription() {
34
+        // This text also appears in the .XML file - update both together
35
+        return /* I18N: Description of the “Deaths” module */ I18N::translate('A report of individuals who died in a given time or place.');
36
+    }
37 37
 
38
-	/**
39
-	 * What is the default access level for this module?
40
-	 *
41
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function defaultAccessLevel() {
46
-		return Auth::PRIV_PRIVATE;
47
-	}
38
+    /**
39
+     * What is the default access level for this module?
40
+     *
41
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
42
+     *
43
+     * @return int
44
+     */
45
+    public function defaultAccessLevel() {
46
+        return Auth::PRIV_PRIVATE;
47
+    }
48 48
 
49
-	/**
50
-	 * Return a menu item for this report.
51
-	 *
52
-	 * @return Menu
53
-	 */
54
-	public function getReportMenu() {
55
-		global $WT_TREE;
49
+    /**
50
+     * Return a menu item for this report.
51
+     *
52
+     * @return Menu
53
+     */
54
+    public function getReportMenu() {
55
+        global $WT_TREE;
56 56
 
57
-		return new Menu(
58
-			$this->getTitle(),
59
-			'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
60
-			'menu-report-' . $this->getName(),
61
-			array('rel' => 'nofollow')
62
-		);
63
-	}
57
+        return new Menu(
58
+            $this->getTitle(),
59
+            'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml',
60
+            'menu-report-' . $this->getName(),
61
+            array('rel' => 'nofollow')
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
app/Module/InteractiveTreeModule.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -28,78 +28,78 @@  discard block
 block discarded – undo
28 28
  * Tip : you could change the number of generations loaded before ajax calls both in individual page and in treeview page to optimize speed and server load
29 29
  */
30 30
 class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface {
31
-	/** {@inheritdoc} */
32
-	public function getTitle() {
33
-		return /* I18N: Name of a module */ I18N::translate('Interactive tree');
34
-	}
35
-
36
-	/** {@inheritdoc} */
37
-	public function getDescription() {
38
-		return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.');
39
-	}
40
-
41
-	/** {@inheritdoc} */
42
-	public function defaultTabOrder() {
43
-		return 68;
44
-	}
45
-
46
-	/** {@inheritdoc} */
47
-	public function getTabContent() {
48
-		global $controller;
49
-
50
-		$tv              = new TreeView('tvTab');
51
-		list($html, $js) = $tv->drawViewport($controller->record, 3);
52
-
53
-		return
54
-			'<script src="' . $this->js() . '"></script>' .
55
-			'<script src="' . WT_JQUERYUI_TOUCH_PUNCH_URL . '"></script>' .
56
-			'<script>' . $js . '</script>' .
57
-			$html;
58
-	}
59
-
60
-	/** {@inheritdoc} */
61
-	public function hasTabContent() {
62
-		return !Auth::isSearchEngine();
63
-	}
64
-
65
-	/** {@inheritdoc} */
66
-	public function isGrayedOut() {
67
-		return false;
68
-	}
69
-
70
-	/** {@inheritdoc} */
71
-	public function canLoadAjax() {
72
-		return true;
73
-	}
74
-
75
-	/**
76
-	 * Return a menu item for this chart.
77
-	 *
78
-	 * @return Menu|null
79
-	 */
80
-	public function getChartMenu(Individual $individual) {
81
-		return new Menu(
82
-			$this->getTitle(),
83
-			'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
84
-			'menu-chart-tree',
85
-			array('rel' => 'nofollow')
86
-		);
87
-	}
88
-
89
-	/**
90
-	 * Return a menu item for this chart - for use in individual boxes.
91
-	 *
92
-	 * @return Menu|null
93
-	 */
94
-	public function getBoxChartMenu(Individual $individual) {
95
-		return $this->getChartMenu($individual);
96
-	}
97
-
98
-	/** {@inheritdoc} */
99
-	public function getPreLoadContent() {
100
-		// We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time
101
-		return
102
-			'<script>
31
+    /** {@inheritdoc} */
32
+    public function getTitle() {
33
+        return /* I18N: Name of a module */ I18N::translate('Interactive tree');
34
+    }
35
+
36
+    /** {@inheritdoc} */
37
+    public function getDescription() {
38
+        return /* I18N: Description of the “Interactive tree” module */ I18N::translate('An interactive tree, showing all the ancestors and descendants of an individual.');
39
+    }
40
+
41
+    /** {@inheritdoc} */
42
+    public function defaultTabOrder() {
43
+        return 68;
44
+    }
45
+
46
+    /** {@inheritdoc} */
47
+    public function getTabContent() {
48
+        global $controller;
49
+
50
+        $tv              = new TreeView('tvTab');
51
+        list($html, $js) = $tv->drawViewport($controller->record, 3);
52
+
53
+        return
54
+            '<script src="' . $this->js() . '"></script>' .
55
+            '<script src="' . WT_JQUERYUI_TOUCH_PUNCH_URL . '"></script>' .
56
+            '<script>' . $js . '</script>' .
57
+            $html;
58
+    }
59
+
60
+    /** {@inheritdoc} */
61
+    public function hasTabContent() {
62
+        return !Auth::isSearchEngine();
63
+    }
64
+
65
+    /** {@inheritdoc} */
66
+    public function isGrayedOut() {
67
+        return false;
68
+    }
69
+
70
+    /** {@inheritdoc} */
71
+    public function canLoadAjax() {
72
+        return true;
73
+    }
74
+
75
+    /**
76
+     * Return a menu item for this chart.
77
+     *
78
+     * @return Menu|null
79
+     */
80
+    public function getChartMenu(Individual $individual) {
81
+        return new Menu(
82
+            $this->getTitle(),
83
+            'module.php?mod=tree&amp;mod_action=treeview&amp;rootid=' . $individual->getXref() . '&amp;ged=' . $individual->getTree()->getNameUrl(),
84
+            'menu-chart-tree',
85
+            array('rel' => 'nofollow')
86
+        );
87
+    }
88
+
89
+    /**
90
+     * Return a menu item for this chart - for use in individual boxes.
91
+     *
92
+     * @return Menu|null
93
+     */
94
+    public function getBoxChartMenu(Individual $individual) {
95
+        return $this->getChartMenu($individual);
96
+    }
97
+
98
+    /** {@inheritdoc} */
99
+    public function getPreLoadContent() {
100
+        // We cannot use jQuery("head").append(<link rel="stylesheet" ...as jQuery is not loaded at this time
101
+        return
102
+            '<script>
103 103
 			if (document.createStyleSheet) {
104 104
 				document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
105 105
 			} else {
@@ -110,83 +110,83 @@  discard block
 block discarded – undo
110 110
 				document.getElementsByTagName("head")[0].appendChild(newSheet);
111 111
 			}
112 112
 			</script>';
113
-	}
114
-
115
-	/**
116
-	 * This is a general purpose hook, allowing modules to respond to routes
117
-	 * of the form module.php?mod=FOO&mod_action=BAR
118
-	 *
119
-	 * @param string $mod_action
120
-	 */
121
-	public function modAction($mod_action) {
122
-		global $controller, $WT_TREE;
123
-
124
-		switch ($mod_action) {
125
-		case 'treeview':
126
-			$controller = new ChartController;
127
-			$tv         = new TreeView('tv');
128
-			ob_start();
129
-
130
-			$person = $controller->getSignificantIndividual();
131
-
132
-			list($html, $js) = $tv->drawViewport($person, 4);
133
-
134
-			$controller
135
-				->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
-				->pageHeader()
137
-				->addExternalJavascript($this->js())
138
-				->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
-				->addInlineJavascript($js)
140
-				->addInlineJavascript('
113
+    }
114
+
115
+    /**
116
+     * This is a general purpose hook, allowing modules to respond to routes
117
+     * of the form module.php?mod=FOO&mod_action=BAR
118
+     *
119
+     * @param string $mod_action
120
+     */
121
+    public function modAction($mod_action) {
122
+        global $controller, $WT_TREE;
123
+
124
+        switch ($mod_action) {
125
+        case 'treeview':
126
+            $controller = new ChartController;
127
+            $tv         = new TreeView('tv');
128
+            ob_start();
129
+
130
+            $person = $controller->getSignificantIndividual();
131
+
132
+            list($html, $js) = $tv->drawViewport($person, 4);
133
+
134
+            $controller
135
+                ->setPageTitle(I18N::translate('Interactive tree of %s', $person->getFullName()))
136
+                ->pageHeader()
137
+                ->addExternalJavascript($this->js())
138
+                ->addExternalJavascript(WT_JQUERYUI_TOUCH_PUNCH_URL)
139
+                ->addInlineJavascript($js)
140
+                ->addInlineJavascript('
141 141
 					if (document.createStyleSheet) {
142 142
 						document.createStyleSheet("' . $this->css() . '"); // For Internet Explorer
143 143
 					} else {
144 144
 						jQuery("head").append(\'<link rel="stylesheet" type="text/css" href="' . $this->css() . '">\');
145 145
 					}
146 146
 				');
147
-			echo $html;
148
-			break;
149
-
150
-		case 'getDetails':
151
-			header('Content-Type: text/html; charset=UTF-8');
152
-			$pid        = Filter::get('pid', WT_REGEX_XREF);
153
-			$i          = Filter::get('instance');
154
-			$tv         = new TreeView($i);
155
-			$individual = Individual::getInstance($pid, $WT_TREE);
156
-			if ($individual) {
157
-				echo $tv->getDetails($individual);
158
-			}
159
-			break;
160
-
161
-		case 'getPersons':
162
-			header('Content-Type: text/html; charset=UTF-8');
163
-			$q  = Filter::get('q');
164
-			$i  = Filter::get('instance');
165
-			$tv = new TreeView($i);
166
-			echo $tv->getPersons($q);
167
-			break;
168
-
169
-		default:
170
-			http_response_code(404);
171
-			break;
172
-		}
173
-	}
174
-
175
-	/**
176
-	 * URL for our style sheet.
177
-	 *
178
-	 * @return string
179
-	 */
180
-	public function css() {
181
-		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css';
182
-	}
183
-
184
-	/**
185
-	 * URL for our JavaScript.
186
-	 *
187
-	 * @return string
188
-	 */
189
-	public function js() {
190
-		return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js';
191
-	}
147
+            echo $html;
148
+            break;
149
+
150
+        case 'getDetails':
151
+            header('Content-Type: text/html; charset=UTF-8');
152
+            $pid        = Filter::get('pid', WT_REGEX_XREF);
153
+            $i          = Filter::get('instance');
154
+            $tv         = new TreeView($i);
155
+            $individual = Individual::getInstance($pid, $WT_TREE);
156
+            if ($individual) {
157
+                echo $tv->getDetails($individual);
158
+            }
159
+            break;
160
+
161
+        case 'getPersons':
162
+            header('Content-Type: text/html; charset=UTF-8');
163
+            $q  = Filter::get('q');
164
+            $i  = Filter::get('instance');
165
+            $tv = new TreeView($i);
166
+            echo $tv->getPersons($q);
167
+            break;
168
+
169
+        default:
170
+            http_response_code(404);
171
+            break;
172
+        }
173
+    }
174
+
175
+    /**
176
+     * URL for our style sheet.
177
+     *
178
+     * @return string
179
+     */
180
+    public function css() {
181
+        return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/css/treeview.css';
182
+    }
183
+
184
+    /**
185
+     * URL for our JavaScript.
186
+     *
187
+     * @return string
188
+     */
189
+    public function js() {
190
+        return WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/treeview.js';
191
+    }
192 192
 }
Please login to merge, or discard this patch.
app/Module/RecentChangesModule.php 1 patch
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -31,273 +31,273 @@  discard block
 block discarded – undo
31 31
  * Class RecentChangesModule
32 32
  */
33 33
 class RecentChangesModule extends AbstractModule implements ModuleBlockInterface {
34
-	const DEFAULT_BLOCK      = '1';
35
-	const DEFAULT_DAYS       = 7;
36
-	const DEFAULT_HIDE_EMPTY = '0';
37
-	const DEFAULT_SHOW_USER  = '1';
38
-	const DEFAULT_SORT_STYLE = 'date_desc';
39
-	const DEFAULT_INFO_STYLE = 'table';
40
-	const MAX_DAYS           = 90;
41
-
42
-	/** {@inheritdoc} */
43
-	public function getTitle() {
44
-		return /* I18N: Name of a module */ I18N::translate('Recent changes');
45
-	}
46
-
47
-	/** {@inheritdoc} */
48
-	public function getDescription() {
49
-		return /* I18N: Description of the “Recent changes” module */ I18N::translate('A list of records that have been updated recently.');
50
-	}
51
-
52
-	/** {@inheritdoc} */
53
-	public function getBlock($block_id, $template = true, $cfg = array()) {
54
-		global $ctype, $WT_TREE;
55
-
56
-		$days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
57
-		$infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
58
-		$sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
59
-		$show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
60
-		$block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
61
-		$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
62
-
63
-		foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
64
-			if (array_key_exists($name, $cfg)) {
65
-				$$name = $cfg[$name];
66
-			}
67
-		}
68
-
69
-		$records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
70
-
71
-		if (empty($records) && $hide_empty) {
72
-			return '';
73
-		}
74
-
75
-		// Print block header
76
-		$id    = $this->getName() . $block_id;
77
-		$class = $this->getName() . '_block';
78
-
79
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
80
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
81
-		} else {
82
-			$title = '';
83
-		}
84
-		$title .= /* I18N: title for list of recent changes */ I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
85
-
86
-		$content = '';
87
-		// Print block content
88
-		if (count($records) == 0) {
89
-			$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
90
-		} else {
91
-			switch ($infoStyle) {
92
-			case 'list':
93
-				$content .= $this->changesList($records, $sortStyle, $show_user);
94
-				break;
95
-			case 'table':
96
-				$content .= $this->changesTable($records, $sortStyle, $show_user);
97
-				break;
98
-			}
99
-		}
100
-
101
-		if ($template) {
102
-			if ($block) {
103
-				$class .= ' small_inner_block';
104
-			}
105
-
106
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
107
-		} else {
108
-			return $content;
109
-		}
110
-	}
111
-
112
-	/** {@inheritdoc} */
113
-	public function loadAjax() {
114
-		return true;
115
-	}
116
-
117
-	/** {@inheritdoc} */
118
-	public function isUserBlock() {
119
-		return true;
120
-	}
121
-
122
-	/** {@inheritdoc} */
123
-	public function isGedcomBlock() {
124
-		return true;
125
-	}
126
-
127
-	/** {@inheritdoc} */
128
-	public function configureBlock($block_id) {
129
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
130
-			$this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
131
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
132
-			$this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
133
-			$this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
134
-			$this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
135
-			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
136
-		}
137
-
138
-		$days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
139
-		$infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
140
-		$sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
141
-		$show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
142
-		$block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
143
-		$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
144
-
145
-		echo '<tr><td class="descriptionbox wrap width33">';
146
-		echo I18N::translate('Number of days to show');
147
-		echo '</td><td class="optionbox">';
148
-		echo '<input type="text" name="days" size="2" value="', $days, '">';
149
-		echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
150
-		echo '</td></tr>';
151
-
152
-		echo '<tr><td class="descriptionbox wrap width33">';
153
-		echo I18N::translate('Presentation style');
154
-		echo '</td><td class="optionbox">';
155
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
156
-		echo '</td></tr>';
157
-
158
-		echo '<tr><td class="descriptionbox wrap width33">';
159
-		echo I18N::translate('Sort order');
160
-		echo '</td><td class="optionbox">';
161
-		echo FunctionsEdit::selectEditControl('sortStyle', array(
162
-			'name'      => /* I18N: An option in a list-box */ I18N::translate('sort by name'),
163
-			'date_asc'  => /* I18N: An option in a list-box */ I18N::translate('sort by date, oldest first'),
164
-			'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first'),
165
-		), null, $sortStyle, '');
166
-		echo '</td></tr>';
167
-
168
-		echo '<tr><td class="descriptionbox wrap width33">';
169
-		echo /* I18N: label for a yes/no option */ I18N::translate('Show the user who made the change');
170
-		echo '</td><td class="optionbox">';
171
-		echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
172
-		echo '</td></tr>';
173
-
174
-		echo '<tr><td class="descriptionbox wrap width33">';
175
-		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
176
-		echo '</td><td class="optionbox">';
177
-		echo FunctionsEdit::editFieldYesNo('block', $block);
178
-		echo '</td></tr>';
179
-
180
-		echo '<tr><td class="descriptionbox wrap width33">';
181
-		echo I18N::translate('Should this block be hidden when it is empty');
182
-		echo '</td><td class="optionbox">';
183
-		echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
184
-		echo '</td></tr>';
185
-		echo '<tr><td colspan="2" class="optionbox wrap">';
186
-		echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
187
-		echo '</td></tr>';
188
-	}
189
-
190
-	/**
191
-	 * Find records that have changed since a given julian day
192
-	 *
193
-	 * @param Tree $tree Changes for which tree
194
-	 * @param int  $jd   Julian day
195
-	 *
196
-	 * @return GedcomRecord[] List of records with changes
197
-	 */
198
-	private function getRecentChanges(Tree $tree, $jd) {
199
-		$sql =
200
-			"SELECT d_gid FROM `##dates`" .
201
-			" WHERE d_fact='CHAN' AND d_julianday1 >= :jd AND d_file = :tree_id";
202
-
203
-		$vars = array(
204
-			'jd'      => $jd,
205
-			'tree_id' => $tree->getTreeId(),
206
-		);
207
-
208
-		$xrefs = Database::prepare($sql)->execute($vars)->fetchOneColumn();
209
-
210
-		$records = array();
211
-		foreach ($xrefs as $xref) {
212
-			$record = GedcomRecord::getInstance($xref, $tree);
213
-			if ($record->canShow()) {
214
-				$records[] = $record;
215
-			}
216
-		}
217
-
218
-		return $records;
219
-	}
220
-
221
-	/**
222
-	 * Format a table of events
223
-	 *
224
-	 * @param GedcomRecord[] $records
225
-	 * @param string         $sort
226
-	 * @param bool           $show_user
227
-	 *
228
-	 * @return string
229
-	 */
230
-	private function changesList(array $records, $sort, $show_user) {
231
-		switch ($sort) {
232
-		case 'name':
233
-			uasort($records, array('self', 'sortByNameAndChangeDate'));
234
-			break;
235
-		case 'date_asc':
236
-			uasort($records, array('self', 'sortByChangeDateAndName'));
237
-			$records = array_reverse($records);
238
-			break;
239
-		case 'date_desc':
240
-			uasort($records, array('self', 'sortByChangeDateAndName'));
241
-		}
242
-
243
-		$html = '';
244
-		foreach ($records as $record) {
245
-			$html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
246
-			$html .= '<div class="indent" style="margin-bottom: 5px;">';
247
-			if ($record instanceof Individual) {
248
-				if ($record->getAddName()) {
249
-					$html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item">' . $record->getAddName() . '</a>';
250
-				}
251
-			}
252
-
253
-			// The timestamp may be missing or private.
254
-			$timestamp = $record->lastChangeTimestamp();
255
-			if ($timestamp !== '') {
256
-				if ($show_user) {
257
-					$html .= /* I18N: [a record was] Changed on <date/time> by <user> */
258
-						I18N::translate('Changed on %1$s by %2$s', $timestamp, Filter::escapeHtml($record->lastChangeUser()));
259
-				} else {
260
-					$html .= /* I18N: [a record was] Changed on <date/time> */
261
-						I18N::translate('Changed on %1$s', $timestamp);
262
-				}
263
-			}
264
-			$html .= '</div>';
265
-		}
266
-
267
-		return $html;
268
-	}
269
-
270
-	/**
271
-	 * Format a table of events
272
-	 *
273
-	 * @param GedcomRecord[] $records
274
-	 * @param string         $sort
275
-	 * @param bool           $show_user
276
-	 *
277
-	 * @return string
278
-	 */
279
-	private function changesTable($records, $sort, $show_user) {
280
-		global $controller;
281
-
282
-		$table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
283
-
284
-		switch ($sort) {
285
-		case 'name':
286
-		default:
287
-			$aaSorting = "[1,'asc'], [2,'desc']";
288
-			break;
289
-		case 'date_asc':
290
-			$aaSorting = "[2,'asc'], [1,'asc']";
291
-			break;
292
-		case 'date_desc':
293
-			$aaSorting = "[2,'desc'], [1,'asc']";
294
-			break;
295
-		}
296
-
297
-		$html = '';
298
-		$controller
299
-			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
300
-			->addInlineJavascript('
34
+    const DEFAULT_BLOCK      = '1';
35
+    const DEFAULT_DAYS       = 7;
36
+    const DEFAULT_HIDE_EMPTY = '0';
37
+    const DEFAULT_SHOW_USER  = '1';
38
+    const DEFAULT_SORT_STYLE = 'date_desc';
39
+    const DEFAULT_INFO_STYLE = 'table';
40
+    const MAX_DAYS           = 90;
41
+
42
+    /** {@inheritdoc} */
43
+    public function getTitle() {
44
+        return /* I18N: Name of a module */ I18N::translate('Recent changes');
45
+    }
46
+
47
+    /** {@inheritdoc} */
48
+    public function getDescription() {
49
+        return /* I18N: Description of the “Recent changes” module */ I18N::translate('A list of records that have been updated recently.');
50
+    }
51
+
52
+    /** {@inheritdoc} */
53
+    public function getBlock($block_id, $template = true, $cfg = array()) {
54
+        global $ctype, $WT_TREE;
55
+
56
+        $days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
57
+        $infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
58
+        $sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
59
+        $show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
60
+        $block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
61
+        $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
62
+
63
+        foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
64
+            if (array_key_exists($name, $cfg)) {
65
+                $$name = $cfg[$name];
66
+            }
67
+        }
68
+
69
+        $records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
70
+
71
+        if (empty($records) && $hide_empty) {
72
+            return '';
73
+        }
74
+
75
+        // Print block header
76
+        $id    = $this->getName() . $block_id;
77
+        $class = $this->getName() . '_block';
78
+
79
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
80
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
81
+        } else {
82
+            $title = '';
83
+        }
84
+        $title .= /* I18N: title for list of recent changes */ I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
85
+
86
+        $content = '';
87
+        // Print block content
88
+        if (count($records) == 0) {
89
+            $content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
90
+        } else {
91
+            switch ($infoStyle) {
92
+            case 'list':
93
+                $content .= $this->changesList($records, $sortStyle, $show_user);
94
+                break;
95
+            case 'table':
96
+                $content .= $this->changesTable($records, $sortStyle, $show_user);
97
+                break;
98
+            }
99
+        }
100
+
101
+        if ($template) {
102
+            if ($block) {
103
+                $class .= ' small_inner_block';
104
+            }
105
+
106
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
107
+        } else {
108
+            return $content;
109
+        }
110
+    }
111
+
112
+    /** {@inheritdoc} */
113
+    public function loadAjax() {
114
+        return true;
115
+    }
116
+
117
+    /** {@inheritdoc} */
118
+    public function isUserBlock() {
119
+        return true;
120
+    }
121
+
122
+    /** {@inheritdoc} */
123
+    public function isGedcomBlock() {
124
+        return true;
125
+    }
126
+
127
+    /** {@inheritdoc} */
128
+    public function configureBlock($block_id) {
129
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
130
+            $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, self::MAX_DAYS));
131
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table'));
132
+            $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'name|date_asc|date_desc'));
133
+            $this->setBlockSetting($block_id, 'show_user', Filter::postBool('show_user'));
134
+            $this->setBlockSetting($block_id, 'hide_empty', Filter::postBool('hide_empty'));
135
+            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
136
+        }
137
+
138
+        $days       = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
139
+        $infoStyle  = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
140
+        $sortStyle  = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
141
+        $show_user  = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
142
+        $block      = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
143
+        $hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
144
+
145
+        echo '<tr><td class="descriptionbox wrap width33">';
146
+        echo I18N::translate('Number of days to show');
147
+        echo '</td><td class="optionbox">';
148
+        echo '<input type="text" name="days" size="2" value="', $days, '">';
149
+        echo ' <em>', I18N::plural('maximum %s day', 'maximum %s days', I18N::number(self::MAX_DAYS), I18N::number(self::MAX_DAYS)), '</em>';
150
+        echo '</td></tr>';
151
+
152
+        echo '<tr><td class="descriptionbox wrap width33">';
153
+        echo I18N::translate('Presentation style');
154
+        echo '</td><td class="optionbox">';
155
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
156
+        echo '</td></tr>';
157
+
158
+        echo '<tr><td class="descriptionbox wrap width33">';
159
+        echo I18N::translate('Sort order');
160
+        echo '</td><td class="optionbox">';
161
+        echo FunctionsEdit::selectEditControl('sortStyle', array(
162
+            'name'      => /* I18N: An option in a list-box */ I18N::translate('sort by name'),
163
+            'date_asc'  => /* I18N: An option in a list-box */ I18N::translate('sort by date, oldest first'),
164
+            'date_desc' => /* I18N: An option in a list-box */ I18N::translate('sort by date, newest first'),
165
+        ), null, $sortStyle, '');
166
+        echo '</td></tr>';
167
+
168
+        echo '<tr><td class="descriptionbox wrap width33">';
169
+        echo /* I18N: label for a yes/no option */ I18N::translate('Show the user who made the change');
170
+        echo '</td><td class="optionbox">';
171
+        echo FunctionsEdit::editFieldYesNo('show_user', $show_user);
172
+        echo '</td></tr>';
173
+
174
+        echo '<tr><td class="descriptionbox wrap width33">';
175
+        echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
176
+        echo '</td><td class="optionbox">';
177
+        echo FunctionsEdit::editFieldYesNo('block', $block);
178
+        echo '</td></tr>';
179
+
180
+        echo '<tr><td class="descriptionbox wrap width33">';
181
+        echo I18N::translate('Should this block be hidden when it is empty');
182
+        echo '</td><td class="optionbox">';
183
+        echo FunctionsEdit::editFieldYesNo('hide_empty', $hide_empty);
184
+        echo '</td></tr>';
185
+        echo '<tr><td colspan="2" class="optionbox wrap">';
186
+        echo '<span class="error">', I18N::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
187
+        echo '</td></tr>';
188
+    }
189
+
190
+    /**
191
+     * Find records that have changed since a given julian day
192
+     *
193
+     * @param Tree $tree Changes for which tree
194
+     * @param int  $jd   Julian day
195
+     *
196
+     * @return GedcomRecord[] List of records with changes
197
+     */
198
+    private function getRecentChanges(Tree $tree, $jd) {
199
+        $sql =
200
+            "SELECT d_gid FROM `##dates`" .
201
+            " WHERE d_fact='CHAN' AND d_julianday1 >= :jd AND d_file = :tree_id";
202
+
203
+        $vars = array(
204
+            'jd'      => $jd,
205
+            'tree_id' => $tree->getTreeId(),
206
+        );
207
+
208
+        $xrefs = Database::prepare($sql)->execute($vars)->fetchOneColumn();
209
+
210
+        $records = array();
211
+        foreach ($xrefs as $xref) {
212
+            $record = GedcomRecord::getInstance($xref, $tree);
213
+            if ($record->canShow()) {
214
+                $records[] = $record;
215
+            }
216
+        }
217
+
218
+        return $records;
219
+    }
220
+
221
+    /**
222
+     * Format a table of events
223
+     *
224
+     * @param GedcomRecord[] $records
225
+     * @param string         $sort
226
+     * @param bool           $show_user
227
+     *
228
+     * @return string
229
+     */
230
+    private function changesList(array $records, $sort, $show_user) {
231
+        switch ($sort) {
232
+        case 'name':
233
+            uasort($records, array('self', 'sortByNameAndChangeDate'));
234
+            break;
235
+        case 'date_asc':
236
+            uasort($records, array('self', 'sortByChangeDateAndName'));
237
+            $records = array_reverse($records);
238
+            break;
239
+        case 'date_desc':
240
+            uasort($records, array('self', 'sortByChangeDateAndName'));
241
+        }
242
+
243
+        $html = '';
244
+        foreach ($records as $record) {
245
+            $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item name2">' . $record->getFullName() . '</a>';
246
+            $html .= '<div class="indent" style="margin-bottom: 5px;">';
247
+            if ($record instanceof Individual) {
248
+                if ($record->getAddName()) {
249
+                    $html .= '<a href="' . $record->getHtmlUrl() . '" class="list_item">' . $record->getAddName() . '</a>';
250
+                }
251
+            }
252
+
253
+            // The timestamp may be missing or private.
254
+            $timestamp = $record->lastChangeTimestamp();
255
+            if ($timestamp !== '') {
256
+                if ($show_user) {
257
+                    $html .= /* I18N: [a record was] Changed on <date/time> by <user> */
258
+                        I18N::translate('Changed on %1$s by %2$s', $timestamp, Filter::escapeHtml($record->lastChangeUser()));
259
+                } else {
260
+                    $html .= /* I18N: [a record was] Changed on <date/time> */
261
+                        I18N::translate('Changed on %1$s', $timestamp);
262
+                }
263
+            }
264
+            $html .= '</div>';
265
+        }
266
+
267
+        return $html;
268
+    }
269
+
270
+    /**
271
+     * Format a table of events
272
+     *
273
+     * @param GedcomRecord[] $records
274
+     * @param string         $sort
275
+     * @param bool           $show_user
276
+     *
277
+     * @return string
278
+     */
279
+    private function changesTable($records, $sort, $show_user) {
280
+        global $controller;
281
+
282
+        $table_id = 'table-chan-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page
283
+
284
+        switch ($sort) {
285
+        case 'name':
286
+        default:
287
+            $aaSorting = "[1,'asc'], [2,'desc']";
288
+            break;
289
+        case 'date_asc':
290
+            $aaSorting = "[2,'asc'], [1,'asc']";
291
+            break;
292
+        case 'date_desc':
293
+            $aaSorting = "[2,'desc'], [1,'asc']";
294
+            break;
295
+        }
296
+
297
+        $html = '';
298
+        $controller
299
+            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
300
+            ->addInlineJavascript('
301 301
 				jQuery("#' . $table_id . '").dataTable({
302 302
 					dom: \'t\',
303 303
 					paging: false,
@@ -316,75 +316,75 @@  discard block
 block discarded – undo
316 316
 				});
317 317
 			');
318 318
 
319
-		$html .= '<table id="' . $table_id . '" class="width100">';
320
-		$html .= '<thead><tr>';
321
-		$html .= '<th></th>';
322
-		$html .= '<th>' . I18N::translate('Record') . '</th>';
323
-		$html .= '<th>' . GedcomTag::getLabel('CHAN') . '</th>';
324
-		$html .= '<th>' . GedcomTag::getLabel('_WT_USER') . '</th>';
325
-		$html .= '</tr></thead><tbody>';
326
-
327
-		foreach ($records as $record) {
328
-			$html .= '<tr><td>';
329
-			switch ($record::RECORD_TYPE) {
330
-			case 'INDI':
331
-				$html .= $record->getSexImage('small');
332
-				break;
333
-			case 'FAM':
334
-				$html .= '<i class="icon-button_family"></i>';
335
-				break;
336
-			case 'OBJE':
337
-				$html .= '<i class="icon-button_media"></i>';
338
-				break;
339
-			case 'NOTE':
340
-				$html .= '<i class="icon-button_note"></i>';
341
-				break;
342
-			case 'SOUR':
343
-				$html .= '<i class="icon-button_source"></i>';
344
-				break;
345
-			case 'REPO':
346
-				$html .= '<i class="icon-button_repository"></i>';
347
-				break;
348
-			}
349
-			$html .= '</td>';
350
-			$html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">';
351
-			$html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>';
352
-			$addname = $record->getAddName();
353
-			if ($addname) {
354
-				$html .= '<div class="indent"><a href="' . $record->getHtmlUrl() . '">' . $addname . '</a></div>';
355
-			}
356
-			$html .= '</td>';
357
-			$html .= '<td data-sort="' . $record->lastChangeTimestamp(true) . '">' . $record->lastChangeTimestamp() . '</td>';
358
-			$html .= '<td>' . Filter::escapeHtml($record->lastChangeUser()) . '</td>';
359
-			$html .= '</tr>';
360
-		}
361
-
362
-		$html .= '</tbody></table>';
363
-
364
-		return $html;
365
-	}
366
-
367
-	/**
368
-	 * Sort the records by (1) last change date and (2) name
369
-	 *
370
-	 * @param GedcomRecord $a
371
-	 * @param GedcomRecord $b
372
-	 *
373
-	 * @return int
374
-	 */
375
-	private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b) {
376
-		return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
377
-	}
378
-
379
-	/**
380
-	 * Sort the records by (1) name and (2) last change date
381
-	 *
382
-	 * @param GedcomRecord $a
383
-	 * @param GedcomRecord $b
384
-	 *
385
-	 * @return int
386
-	 */
387
-	private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b) {
388
-		return GedcomRecord::compare($a, $b) ?: $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true);
389
-	}
319
+        $html .= '<table id="' . $table_id . '" class="width100">';
320
+        $html .= '<thead><tr>';
321
+        $html .= '<th></th>';
322
+        $html .= '<th>' . I18N::translate('Record') . '</th>';
323
+        $html .= '<th>' . GedcomTag::getLabel('CHAN') . '</th>';
324
+        $html .= '<th>' . GedcomTag::getLabel('_WT_USER') . '</th>';
325
+        $html .= '</tr></thead><tbody>';
326
+
327
+        foreach ($records as $record) {
328
+            $html .= '<tr><td>';
329
+            switch ($record::RECORD_TYPE) {
330
+            case 'INDI':
331
+                $html .= $record->getSexImage('small');
332
+                break;
333
+            case 'FAM':
334
+                $html .= '<i class="icon-button_family"></i>';
335
+                break;
336
+            case 'OBJE':
337
+                $html .= '<i class="icon-button_media"></i>';
338
+                break;
339
+            case 'NOTE':
340
+                $html .= '<i class="icon-button_note"></i>';
341
+                break;
342
+            case 'SOUR':
343
+                $html .= '<i class="icon-button_source"></i>';
344
+                break;
345
+            case 'REPO':
346
+                $html .= '<i class="icon-button_repository"></i>';
347
+                break;
348
+            }
349
+            $html .= '</td>';
350
+            $html .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '">';
351
+            $html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>';
352
+            $addname = $record->getAddName();
353
+            if ($addname) {
354
+                $html .= '<div class="indent"><a href="' . $record->getHtmlUrl() . '">' . $addname . '</a></div>';
355
+            }
356
+            $html .= '</td>';
357
+            $html .= '<td data-sort="' . $record->lastChangeTimestamp(true) . '">' . $record->lastChangeTimestamp() . '</td>';
358
+            $html .= '<td>' . Filter::escapeHtml($record->lastChangeUser()) . '</td>';
359
+            $html .= '</tr>';
360
+        }
361
+
362
+        $html .= '</tbody></table>';
363
+
364
+        return $html;
365
+    }
366
+
367
+    /**
368
+     * Sort the records by (1) last change date and (2) name
369
+     *
370
+     * @param GedcomRecord $a
371
+     * @param GedcomRecord $b
372
+     *
373
+     * @return int
374
+     */
375
+    private static function sortByChangeDateAndName(GedcomRecord $a, GedcomRecord $b) {
376
+        return $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true) ?: GedcomRecord::compare($a, $b);
377
+    }
378
+
379
+    /**
380
+     * Sort the records by (1) name and (2) last change date
381
+     *
382
+     * @param GedcomRecord $a
383
+     * @param GedcomRecord $b
384
+     *
385
+     * @return int
386
+     */
387
+    private static function sortByNameAndChangeDate(GedcomRecord $a, GedcomRecord $b) {
388
+        return GedcomRecord::compare($a, $b) ?: $b->lastChangeTimestamp(true) - $a->lastChangeTimestamp(true);
389
+    }
390 390
 }
Please login to merge, or discard this patch.
app/Module/TopGivenNamesModule.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -26,132 +26,132 @@
 block discarded – undo
26 26
  * Class TopGivenNamesModule
27 27
  */
28 28
 class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface {
29
-	/** {@inheritdoc} */
30
-	public function getTitle() {
31
-		return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
32
-	}
33
-
34
-	/** {@inheritdoc} */
35
-	public function getDescription() {
36
-		return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.');
37
-	}
38
-
39
-	/**
40
-	 * Generate the HTML content of this block.
41
-	 *
42
-	 * @param int      $block_id
43
-	 * @param bool     $template
44
-	 * @param string[] $cfg
45
-	 *
46
-	 * @return string
47
-	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
49
-		global $ctype, $WT_TREE;
50
-
51
-		$num       = $this->getBlockSetting($block_id, 'num', '10');
52
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
-
54
-		foreach (array('num', 'infoStyle') as $name) {
55
-			if (array_key_exists($name, $cfg)) {
56
-				$$name = $cfg[$name];
57
-			}
58
-		}
59
-
60
-		$stats = new Stats($WT_TREE);
61
-
62
-		$id    = $this->getName() . $block_id;
63
-		$class = $this->getName() . '_block';
64
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
65
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
66
-		} else {
67
-			$title = '';
68
-		}
69
-		if ($num == 1) {
70
-			// I18N: i.e. most popular given name.
71
-			$title .= I18N::translate('Top given name');
72
-		} else {
73
-			// 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
74
-			$title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
75
-		}
76
-
77
-		$content = '<div class="normal_inner_block">';
78
-		//Select List or Table
79
-		switch ($infoStyle) {
80
-		case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
-			if (I18N::direction() === 'ltr') {
82
-				$padding = 'padding-left: 15px';
83
-			} else {
84
-				$padding = 'padding-right: 15px';
85
-			}
86
-			$params = array(1, $num, 'rcount');
87
-			// List Female names
88
-			$totals = $stats->commonGivenFemaleTotals($params);
89
-			if ($totals) {
90
-				$content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
-			}
92
-			// List Male names
93
-			$totals = $stats->commonGivenMaleTotals($params);
94
-			if ($totals) {
95
-				$content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
-			}
97
-			break;
98
-		case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
-			$params = array(1, $num, 'rcount');
100
-			$content .= '<table style="margin:auto;">
29
+    /** {@inheritdoc} */
30
+    public function getTitle() {
31
+        return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names');
32
+    }
33
+
34
+    /** {@inheritdoc} */
35
+    public function getDescription() {
36
+        return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.');
37
+    }
38
+
39
+    /**
40
+     * Generate the HTML content of this block.
41
+     *
42
+     * @param int      $block_id
43
+     * @param bool     $template
44
+     * @param string[] $cfg
45
+     *
46
+     * @return string
47
+     */
48
+    public function getBlock($block_id, $template = true, $cfg = array()) {
49
+        global $ctype, $WT_TREE;
50
+
51
+        $num       = $this->getBlockSetting($block_id, 'num', '10');
52
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
+
54
+        foreach (array('num', 'infoStyle') as $name) {
55
+            if (array_key_exists($name, $cfg)) {
56
+                $$name = $cfg[$name];
57
+            }
58
+        }
59
+
60
+        $stats = new Stats($WT_TREE);
61
+
62
+        $id    = $this->getName() . $block_id;
63
+        $class = $this->getName() . '_block';
64
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
65
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
66
+        } else {
67
+            $title = '';
68
+        }
69
+        if ($num == 1) {
70
+            // I18N: i.e. most popular given name.
71
+            $title .= I18N::translate('Top given name');
72
+        } else {
73
+            // 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
74
+            $title .= I18N::plural('Top %s given name', 'Top %s given names', $num, I18N::number($num));
75
+        }
76
+
77
+        $content = '<div class="normal_inner_block">';
78
+        //Select List or Table
79
+        switch ($infoStyle) {
80
+        case "list": // Output style 1:  Simple list style. Better suited to left side of page.
81
+            if (I18N::direction() === 'ltr') {
82
+                $padding = 'padding-left: 15px';
83
+            } else {
84
+                $padding = 'padding-right: 15px';
85
+            }
86
+            $params = array(1, $num, 'rcount');
87
+            // List Female names
88
+            $totals = $stats->commonGivenFemaleTotals($params);
89
+            if ($totals) {
90
+                $content .= '<b>' . I18N::translate('Females') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
91
+            }
92
+            // List Male names
93
+            $totals = $stats->commonGivenMaleTotals($params);
94
+            if ($totals) {
95
+                $content .= '<b>' . I18N::translate('Males') . '</b><div class="wrap" style="' . $padding . '">' . $totals . '</div><br>';
96
+            }
97
+            break;
98
+        case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
99
+            $params = array(1, $num, 'rcount');
100
+            $content .= '<table style="margin:auto;">
101 101
 						<tr>
102 102
 						<td>' . $stats->commonGivenFemaleTable($params) . '</td>
103 103
 						<td>' . $stats->commonGivenMaleTable($params) . '</td>';
104
-			$content .= '</tr></table>';
105
-			break;
106
-		}
107
-		$content .= "</div>";
108
-
109
-		if ($template) {
110
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
111
-		} else {
112
-			return $content;
113
-		}
114
-	}
115
-
116
-	/** {@inheritdoc} */
117
-	public function loadAjax() {
118
-		return true;
119
-	}
120
-
121
-	/** {@inheritdoc} */
122
-	public function isUserBlock() {
123
-		return true;
124
-	}
125
-
126
-	/** {@inheritdoc} */
127
-	public function isGedcomBlock() {
128
-		return true;
129
-	}
130
-
131
-	/**
132
-	 * An HTML form to edit block settings
133
-	 *
134
-	 * @param int $block_id
135
-	 */
136
-	public function configureBlock($block_id) {
137
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
138
-			$this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
139
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
140
-		}
141
-
142
-		$num       = $this->getBlockSetting($block_id, 'num', '10');
143
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
144
-
145
-		echo '<tr><td class="descriptionbox wrap width33">';
146
-		echo /* I18N: ... to show in a list */ I18N::translate('Number of given names');
147
-		echo '</td><td class="optionbox">';
148
-		echo '<input type="text" name="num" size="2" value="', $num, '">';
149
-		echo '</td></tr>';
150
-
151
-		echo '<tr><td class="descriptionbox wrap width33">';
152
-		echo I18N::translate('Presentation style');
153
-		echo '</td><td class="optionbox">';
154
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
155
-		echo '</td></tr>';
156
-	}
104
+            $content .= '</tr></table>';
105
+            break;
106
+        }
107
+        $content .= "</div>";
108
+
109
+        if ($template) {
110
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
111
+        } else {
112
+            return $content;
113
+        }
114
+    }
115
+
116
+    /** {@inheritdoc} */
117
+    public function loadAjax() {
118
+        return true;
119
+    }
120
+
121
+    /** {@inheritdoc} */
122
+    public function isUserBlock() {
123
+        return true;
124
+    }
125
+
126
+    /** {@inheritdoc} */
127
+    public function isGedcomBlock() {
128
+        return true;
129
+    }
130
+
131
+    /**
132
+     * An HTML form to edit block settings
133
+     *
134
+     * @param int $block_id
135
+     */
136
+    public function configureBlock($block_id) {
137
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
138
+            $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10));
139
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
140
+        }
141
+
142
+        $num       = $this->getBlockSetting($block_id, 'num', '10');
143
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
144
+
145
+        echo '<tr><td class="descriptionbox wrap width33">';
146
+        echo /* I18N: ... to show in a list */ I18N::translate('Number of given names');
147
+        echo '</td><td class="optionbox">';
148
+        echo '<input type="text" name="num" size="2" value="', $num, '">';
149
+        echo '</td></tr>';
150
+
151
+        echo '<tr><td class="descriptionbox wrap width33">';
152
+        echo I18N::translate('Presentation style');
153
+        echo '</td><td class="optionbox">';
154
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
155
+        echo '</td></tr>';
156
+    }
157 157
 }
Please login to merge, or discard this patch.
app/Module/DescendancyReportModule.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
  * Class DescendancyReportModule
24 24
  */
25 25
 class DescendancyReportModule extends AbstractModule implements ModuleReportInterface {
26
-	/** {@inheritdoc} */
27
-	public function getTitle() {
28
-		// This text also appears in the .XML file - update both together
29
-		return /* I18N: Name of a module/report */ I18N::translate('Descendants');
30
-	}
26
+    /** {@inheritdoc} */
27
+    public function getTitle() {
28
+        // This text also appears in the .XML file - update both together
29
+        return /* I18N: Name of a module/report */ I18N::translate('Descendants');
30
+    }
31 31
 
32
-	/** {@inheritdoc} */
33
-	public function getDescription() {
34
-		// This text also appears in the .XML file - update both together
35
-		return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.');
36
-	}
32
+    /** {@inheritdoc} */
33
+    public function getDescription() {
34
+        // This text also appears in the .XML file - update both together
35
+        return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.');
36
+    }
37 37
 
38
-	/**
39
-	 * What is the default access level for this module?
40
-	 *
41
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function defaultAccessLevel() {
46
-		return Auth::PRIV_PRIVATE;
47
-	}
38
+    /**
39
+     * What is the default access level for this module?
40
+     *
41
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
42
+     *
43
+     * @return int
44
+     */
45
+    public function defaultAccessLevel() {
46
+        return Auth::PRIV_PRIVATE;
47
+    }
48 48
 
49
-	/**
50
-	 * Return a menu item for this report.
51
-	 *
52
-	 * @return Menu
53
-	 */
54
-	public function getReportMenu() {
55
-		global $controller, $WT_TREE;
49
+    /**
50
+     * Return a menu item for this report.
51
+     *
52
+     * @return Menu
53
+     */
54
+    public function getReportMenu() {
55
+        global $controller, $WT_TREE;
56 56
 
57
-		return new Menu(
58
-			$this->getTitle(),
59
-			'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
-			'menu-report-' . $this->getName(),
61
-			array('rel' => 'nofollow')
62
-		);
63
-	}
57
+        return new Menu(
58
+            $this->getTitle(),
59
+            'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
+            'menu-report-' . $this->getName(),
61
+            array('rel' => 'nofollow')
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
app/Module/IndividualFamiliesReportModule.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,42 +23,42 @@
 block discarded – undo
23 23
  * Class IndividualFamiliesReportModule
24 24
  */
25 25
 class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface {
26
-	/** {@inheritdoc} */
27
-	public function getTitle() {
28
-		// This text also appears in the .XML file - update both together
29
-		return /* I18N: Name of a module/report */ I18N::translate('Related families');
30
-	}
26
+    /** {@inheritdoc} */
27
+    public function getTitle() {
28
+        // This text also appears in the .XML file - update both together
29
+        return /* I18N: Name of a module/report */ I18N::translate('Related families');
30
+    }
31 31
 
32
-	/** {@inheritdoc} */
33
-	public function getDescription() {
34
-		// This text also appears in the .XML file - update both together
35
-		return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.');
36
-	}
32
+    /** {@inheritdoc} */
33
+    public function getDescription() {
34
+        // This text also appears in the .XML file - update both together
35
+        return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.');
36
+    }
37 37
 
38
-	/**
39
-	 * What is the default access level for this module?
40
-	 *
41
-	 * Some modules are aimed at admins or managers, and are not generally shown to users.
42
-	 *
43
-	 * @return int
44
-	 */
45
-	public function defaultAccessLevel() {
46
-		return Auth::PRIV_USER;
47
-	}
38
+    /**
39
+     * What is the default access level for this module?
40
+     *
41
+     * Some modules are aimed at admins or managers, and are not generally shown to users.
42
+     *
43
+     * @return int
44
+     */
45
+    public function defaultAccessLevel() {
46
+        return Auth::PRIV_USER;
47
+    }
48 48
 
49
-	/**
50
-	 * Return a menu item for this report.
51
-	 *
52
-	 * @return Menu
53
-	 */
54
-	public function getReportMenu() {
55
-		global $controller, $WT_TREE;
49
+    /**
50
+     * Return a menu item for this report.
51
+     *
52
+     * @return Menu
53
+     */
54
+    public function getReportMenu() {
55
+        global $controller, $WT_TREE;
56 56
 
57
-		return new Menu(
58
-			$this->getTitle(),
59
-			'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
-			'menu-report-' . $this->getName(),
61
-			array('rel' => 'nofollow')
62
-		);
63
-	}
57
+        return new Menu(
58
+            $this->getTitle(),
59
+            'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&amp;action=setup&amp;report=' . WT_MODULES_DIR . $this->getName() . '/report.xml&amp;pid=' . $controller->getSignificantIndividual()->getXref(),
60
+            'menu-report-' . $this->getName(),
61
+            array('rel' => 'nofollow')
62
+        );
63
+    }
64 64
 }
Please login to merge, or discard this patch.
app/Module/OnThisDayModule.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -26,137 +26,137 @@
 block discarded – undo
26 26
  * Class OnThisDayModule
27 27
  */
28 28
 class OnThisDayModule extends AbstractModule implements ModuleBlockInterface {
29
-	/** {@inheritdoc} */
30
-	public function getTitle() {
31
-		return /* I18N: Name of a module */ I18N::translate('On this day');
32
-	}
33
-
34
-	/** {@inheritdoc} */
35
-	public function getDescription() {
36
-		return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.');
37
-	}
38
-
39
-	/**
40
-	 * Generate the HTML content of this block.
41
-	 *
42
-	 * @param int      $block_id
43
-	 * @param bool     $template
44
-	 * @param string[] $cfg
45
-	 *
46
-	 * @return string
47
-	 */
48
-	public function getBlock($block_id, $template = true, $cfg = array()) {
49
-		global $ctype, $WT_TREE;
50
-
51
-		$filter    = $this->getBlockSetting($block_id, 'filter', '1');
52
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
-		$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
54
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
55
-
56
-		foreach (array('filter', 'infoStyle', 'sortStyle', 'block') as $name) {
57
-			if (array_key_exists($name, $cfg)) {
58
-				$$name = $cfg[$name];
59
-			}
60
-		}
61
-
62
-		$todayjd = WT_CLIENT_JD;
63
-
64
-		$id    = $this->getName() . $block_id;
65
-		$class = $this->getName() . '_block';
66
-		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
67
-			$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
68
-		} else {
69
-			$title = '';
70
-		}
71
-		$title .= $this->getTitle();
72
-
73
-		$content = '';
74
-
75
-		// If we are only showing living individuals, then we don't need to search for DEAT events.
76
-		$tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
77
-
78
-		switch ($infoStyle) {
79
-		case 'list':
80
-			// Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
-			$content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
-			break;
83
-		case 'table':
84
-			// Style 2: New format, tables, big text, etc. Not too good on right side of page
85
-			ob_start();
86
-			$content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
-			$content .= ob_get_clean();
88
-			break;
89
-		}
90
-
91
-		if ($template) {
92
-			if ($block) {
93
-				$class .= ' small_inner_block';
94
-			}
95
-
96
-			return Theme::theme()->formatBlock($id, $title, $class, $content);
97
-		} else {
98
-			return $content;
99
-		}
100
-	}
101
-
102
-	/** {@inheritdoc} */
103
-	public function loadAjax() {
104
-		return true;
105
-	}
106
-
107
-	/** {@inheritdoc} */
108
-	public function isUserBlock() {
109
-		return true;
110
-	}
111
-
112
-	/** {@inheritdoc} */
113
-	public function isGedcomBlock() {
114
-		return true;
115
-	}
116
-
117
-	/**
118
-	 * An HTML form to edit block settings
119
-	 *
120
-	 * @param int $block_id
121
-	 */
122
-	public function configureBlock($block_id) {
123
-		if (Filter::postBool('save') && Filter::checkCsrf()) {
124
-			$this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
125
-			$this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
126
-			$this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
127
-			$this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
128
-		}
129
-
130
-		$filter    = $this->getBlockSetting($block_id, 'filter', '1');
131
-		$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
132
-		$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
133
-		$block     = $this->getBlockSetting($block_id, 'block', '1');
134
-
135
-		echo '<tr><td class="descriptionbox wrap width33">';
136
-		echo /* I18N: Label for a configuration option */ I18N::translate('Show only events of living individuals');
137
-		echo '</td><td class="optionbox">';
138
-		echo FunctionsEdit::editFieldYesNo('filter', $filter);
139
-		echo '</td></tr>';
140
-
141
-		echo '<tr><td class="descriptionbox wrap width33">';
142
-		echo /* I18N: Label for a configuration option */ I18N::translate('Presentation style');
143
-		echo '</td><td class="optionbox">';
144
-		echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
145
-		echo '</td></tr>';
146
-
147
-		echo '<tr><td class="descriptionbox wrap width33">';
148
-		echo /* I18N: Label for a configuration option */ I18N::translate('Sort order');
149
-		echo '</td><td class="optionbox">';
150
-		echo FunctionsEdit::selectEditControl('sortStyle', array(
151
-			/* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'),
152
-			/* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'),
153
-		), null, $sortStyle, '');
154
-		echo '</td></tr>';
155
-
156
-		echo '<tr><td class="descriptionbox wrap width33">';
157
-		echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
158
-		echo '</td><td class="optionbox">';
159
-		echo FunctionsEdit::editFieldYesNo('block', $block);
160
-		echo '</td></tr>';
161
-	}
29
+    /** {@inheritdoc} */
30
+    public function getTitle() {
31
+        return /* I18N: Name of a module */ I18N::translate('On this day');
32
+    }
33
+
34
+    /** {@inheritdoc} */
35
+    public function getDescription() {
36
+        return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.');
37
+    }
38
+
39
+    /**
40
+     * Generate the HTML content of this block.
41
+     *
42
+     * @param int      $block_id
43
+     * @param bool     $template
44
+     * @param string[] $cfg
45
+     *
46
+     * @return string
47
+     */
48
+    public function getBlock($block_id, $template = true, $cfg = array()) {
49
+        global $ctype, $WT_TREE;
50
+
51
+        $filter    = $this->getBlockSetting($block_id, 'filter', '1');
52
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
53
+        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
54
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
55
+
56
+        foreach (array('filter', 'infoStyle', 'sortStyle', 'block') as $name) {
57
+            if (array_key_exists($name, $cfg)) {
58
+                $$name = $cfg[$name];
59
+            }
60
+        }
61
+
62
+        $todayjd = WT_CLIENT_JD;
63
+
64
+        $id    = $this->getName() . $block_id;
65
+        $class = $this->getName() . '_block';
66
+        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
67
+            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
68
+        } else {
69
+            $title = '';
70
+        }
71
+        $title .= $this->getTitle();
72
+
73
+        $content = '';
74
+
75
+        // If we are only showing living individuals, then we don't need to search for DEAT events.
76
+        $tags = $filter ? 'BIRT MARR' : 'BIRT MARR DEAT';
77
+
78
+        switch ($infoStyle) {
79
+        case 'list':
80
+            // Output style 1:  Old format, no visible tables, much smaller text. Better suited to right side of page.
81
+            $content .= FunctionsPrintLists::eventsList($todayjd, $todayjd, $tags, $filter, $sortStyle);
82
+            break;
83
+        case 'table':
84
+            // Style 2: New format, tables, big text, etc. Not too good on right side of page
85
+            ob_start();
86
+            $content .= FunctionsPrintLists::eventsTable($todayjd, $todayjd, $tags, $filter, $sortStyle);
87
+            $content .= ob_get_clean();
88
+            break;
89
+        }
90
+
91
+        if ($template) {
92
+            if ($block) {
93
+                $class .= ' small_inner_block';
94
+            }
95
+
96
+            return Theme::theme()->formatBlock($id, $title, $class, $content);
97
+        } else {
98
+            return $content;
99
+        }
100
+    }
101
+
102
+    /** {@inheritdoc} */
103
+    public function loadAjax() {
104
+        return true;
105
+    }
106
+
107
+    /** {@inheritdoc} */
108
+    public function isUserBlock() {
109
+        return true;
110
+    }
111
+
112
+    /** {@inheritdoc} */
113
+    public function isGedcomBlock() {
114
+        return true;
115
+    }
116
+
117
+    /**
118
+     * An HTML form to edit block settings
119
+     *
120
+     * @param int $block_id
121
+     */
122
+    public function configureBlock($block_id) {
123
+        if (Filter::postBool('save') && Filter::checkCsrf()) {
124
+            $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter'));
125
+            $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table'));
126
+            $this->setBlockSetting($block_id, 'sortStyle', Filter::post('sortStyle', 'alpha|anniv', 'alpha'));
127
+            $this->setBlockSetting($block_id, 'block', Filter::postBool('block'));
128
+        }
129
+
130
+        $filter    = $this->getBlockSetting($block_id, 'filter', '1');
131
+        $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
132
+        $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
133
+        $block     = $this->getBlockSetting($block_id, 'block', '1');
134
+
135
+        echo '<tr><td class="descriptionbox wrap width33">';
136
+        echo /* I18N: Label for a configuration option */ I18N::translate('Show only events of living individuals');
137
+        echo '</td><td class="optionbox">';
138
+        echo FunctionsEdit::editFieldYesNo('filter', $filter);
139
+        echo '</td></tr>';
140
+
141
+        echo '<tr><td class="descriptionbox wrap width33">';
142
+        echo /* I18N: Label for a configuration option */ I18N::translate('Presentation style');
143
+        echo '</td><td class="optionbox">';
144
+        echo FunctionsEdit::selectEditControl('infoStyle', array('list' => I18N::translate('list'), 'table' => I18N::translate('table')), null, $infoStyle, '');
145
+        echo '</td></tr>';
146
+
147
+        echo '<tr><td class="descriptionbox wrap width33">';
148
+        echo /* I18N: Label for a configuration option */ I18N::translate('Sort order');
149
+        echo '</td><td class="optionbox">';
150
+        echo FunctionsEdit::selectEditControl('sortStyle', array(
151
+            /* I18N: An option in a list-box */ 'alpha' => I18N::translate('sort by name'),
152
+            /* I18N: An option in a list-box */ 'anniv' => I18N::translate('sort by date'),
153
+        ), null, $sortStyle, '');
154
+        echo '</td></tr>';
155
+
156
+        echo '<tr><td class="descriptionbox wrap width33">';
157
+        echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow');
158
+        echo '</td><td class="optionbox">';
159
+        echo FunctionsEdit::editFieldYesNo('block', $block);
160
+        echo '</td></tr>';
161
+    }
162 162
 }
Please login to merge, or discard this patch.