Completed
Push — master ( 15d977...8c59e5 )
by Jonathan
07:24
created
src/Webtrees/Module/PatronymicLineage/LineageController.php 2 patches
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -27,162 +27,162 @@
 block discarded – undo
27 27
 class LineageController extends MvcController
28 28
 {   
29 29
     
30
-    /**
31
-     * Generate the patronymic lineage for this surname
32
-     * @var string $surname Reference surname
33
-     */
34
-    private $surname;   
30
+	/**
31
+	 * Generate the patronymic lineage for this surname
32
+	 * @var string $surname Reference surname
33
+	 */
34
+	private $surname;   
35 35
     
36
-    /**
37
-     * Initial letter
38
-     * @var string $alpha
39
-     */
40
-    private $alpha;
36
+	/**
37
+	 * Initial letter
38
+	 * @var string $alpha
39
+	 */
40
+	private $alpha;
41 41
     
42
-    /**
43
-     * Show all names (values: yes|no)
44
-     * @var bool $show
45
-     */
46
-    private $show_all;
42
+	/**
43
+	 * Show all names (values: yes|no)
44
+	 * @var bool $show
45
+	 */
46
+	private $show_all;
47 47
     
48
-    /**
49
-     * Page to display (values: surn|lineage)
50
-     * @var unknown $show
51
-     */
52
-    private $show;
48
+	/**
49
+	 * Page to display (values: surn|lineage)
50
+	 * @var unknown $show
51
+	 */
52
+	private $show;
53 53
     
54
-    /**
55
-     * Page title
56
-     * @var string $legend
57
-     */
58
-    private $legend;
54
+	/**
55
+	 * Page title
56
+	 * @var string $legend
57
+	 */
58
+	private $legend;
59 59
     
60
-    /**
61
-     * {@inheritDoc}
62
-     * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
63
-     */
64
-    public function __construct(AbstractModule $module) {        
65
-        parent::__construct($module);
60
+	/**
61
+	 * {@inheritDoc}
62
+	 * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module)
63
+	 */
64
+	public function __construct(AbstractModule $module) {        
65
+		parent::__construct($module);
66 66
         
67
-        $this->surname     = Filter::get('surname');
68
-        $this->alpha       = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none
69
-        $this->show_all    = Filter::get('show_all', 'no|yes', 'no'); // All indis
70
-        // Make sure selections are consistent.
71
-        // i.e. can’t specify show_all and surname at the same time.
72
-        if ($this->show_all === 'yes') {
73
-            $this->alpha   = '';
74
-            $this->surname = '';
75
-            $this->legend  = I18N::translate('All');
76
-            $this->show    = Filter::get('show', 'surn|lineage', 'surn');
77
-        } elseif ($this->surname) {
78
-            $this->alpha    = QueryName::initialLetter($this->surname); // so we can highlight the initial letter
79
-            $this->show_all = 'no';
80
-            if ($this->surname === '@N.N.') {
81
-                $this->legend = I18N::translateContext('Unknown surname', '…');
82
-            } else {
83
-                $this->legend = Filter::escapeHtml($this->surname);
84
-                // The surname parameter is a root/canonical form.
85
-                // Display it as the actual surname
86
-                foreach (QueryName::surnames(Globals::getTree(), $this->surname, $this->alpha, false, false) as $details) {
87
-                    $this->legend = implode('/', array_keys($details));
88
-                }                
89
-            }
90
-            $this->show = 'lineage'; // SURN list makes no sense here
91
-        } elseif ($this->alpha === '@') {
92
-            $this->show_all = 'no';
93
-            $this->legend   = I18N::translateContext('Unknown surname', '…');
94
-            $this->show     = 'lineage'; // SURN list makes no sense here
95
-        } elseif ($this->alpha === ',') {
96
-            $this->show_all = 'no';
97
-            $this->legend   = I18N::translate('None');
98
-            $this->show     = 'lineage'; // SURN list makes no sense here
99
-        } elseif ($this->alpha) {
100
-            $this->show_all = 'no';
101
-            $this->legend   = Filter::escapeHtml($this->alpha) . '…';
102
-            $this->show     = Filter::get('show', 'surn|lineage', 'surn');
103
-        } else {
104
-            $this->show_all = 'no';
105
-            $this->legend   = '…';
106
-            $this->show     = 'none'; // Don't show lists until something is chosen
107
-        }
108
-        $this->legend = '<span dir="auto">' . $this->legend . '</span>';
67
+		$this->surname     = Filter::get('surname');
68
+		$this->alpha       = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none
69
+		$this->show_all    = Filter::get('show_all', 'no|yes', 'no'); // All indis
70
+		// Make sure selections are consistent.
71
+		// i.e. can’t specify show_all and surname at the same time.
72
+		if ($this->show_all === 'yes') {
73
+			$this->alpha   = '';
74
+			$this->surname = '';
75
+			$this->legend  = I18N::translate('All');
76
+			$this->show    = Filter::get('show', 'surn|lineage', 'surn');
77
+		} elseif ($this->surname) {
78
+			$this->alpha    = QueryName::initialLetter($this->surname); // so we can highlight the initial letter
79
+			$this->show_all = 'no';
80
+			if ($this->surname === '@N.N.') {
81
+				$this->legend = I18N::translateContext('Unknown surname', '…');
82
+			} else {
83
+				$this->legend = Filter::escapeHtml($this->surname);
84
+				// The surname parameter is a root/canonical form.
85
+				// Display it as the actual surname
86
+				foreach (QueryName::surnames(Globals::getTree(), $this->surname, $this->alpha, false, false) as $details) {
87
+					$this->legend = implode('/', array_keys($details));
88
+				}                
89
+			}
90
+			$this->show = 'lineage'; // SURN list makes no sense here
91
+		} elseif ($this->alpha === '@') {
92
+			$this->show_all = 'no';
93
+			$this->legend   = I18N::translateContext('Unknown surname', '…');
94
+			$this->show     = 'lineage'; // SURN list makes no sense here
95
+		} elseif ($this->alpha === ',') {
96
+			$this->show_all = 'no';
97
+			$this->legend   = I18N::translate('None');
98
+			$this->show     = 'lineage'; // SURN list makes no sense here
99
+		} elseif ($this->alpha) {
100
+			$this->show_all = 'no';
101
+			$this->legend   = Filter::escapeHtml($this->alpha) . '…';
102
+			$this->show     = Filter::get('show', 'surn|lineage', 'surn');
103
+		} else {
104
+			$this->show_all = 'no';
105
+			$this->legend   = '…';
106
+			$this->show     = 'none'; // Don't show lists until something is chosen
107
+		}
108
+		$this->legend = '<span dir="auto">' . $this->legend . '</span>';
109 109
           
110
-    }
110
+	}
111 111
     
112
-    /**
113
-     * Indicates whether the list of surname should be displayed
114
-     * @return bool
115
-     */
116
-    protected function isShowingSurnames() {
117
-        return $this->show === 'surn';
118
-    }
112
+	/**
113
+	 * Indicates whether the list of surname should be displayed
114
+	 * @return bool
115
+	 */
116
+	protected function isShowingSurnames() {
117
+		return $this->show === 'surn';
118
+	}
119 119
     
120
-    /**
121
-     * Indicates whether the lineages should be displayed
122
-     * @return bool
123
-     */
124
-    protected function isShowingLineages() {
125
-        return $this->show === 'lineage';
126
-    } 
120
+	/**
121
+	 * Indicates whether the lineages should be displayed
122
+	 * @return bool
123
+	 */
124
+	protected function isShowingLineages() {
125
+		return $this->show === 'lineage';
126
+	} 
127 127
     
128
-    /**
129
-     * Get list of surnames, starting with the specified initial
130
-     * @return array
131
-     */
132
-    protected function getSurnamesList() {        
133
-        return QueryName::surnames(Globals::getTree(), $this->surname, $this->alpha, false, false);
134
-    }
128
+	/**
129
+	 * Get list of surnames, starting with the specified initial
130
+	 * @return array
131
+	 */
132
+	protected function getSurnamesList() {        
133
+		return QueryName::surnames(Globals::getTree(), $this->surname, $this->alpha, false, false);
134
+	}
135 135
     
136
-    /**
137
-     * Get the lineages for the controller's specified surname
138
-     */
139
-    protected function getLineages() {		
140
-        $builder = new LineageBuilder($this->surname, Globals::getTree());
136
+	/**
137
+	 * Get the lineages for the controller's specified surname
138
+	 */
139
+	protected function getLineages() {		
140
+		$builder = new LineageBuilder($this->surname, Globals::getTree());
141 141
 		$lineages = $builder->buildLineages();
142 142
 		
143
-    	return $lineages;
144
-    }    
143
+		return $lineages;
144
+	}    
145 145
     
146
-    /**
147
-     * Pages
148
-     */
146
+	/**
147
+	 * Pages
148
+	 */
149 149
     
150
-    /**
151
-     * Lineage@index
152
-     */
153
-    public function index() {
154
-        $controller = new PageController();
155
-        $controller->setPageTitle(
156
-            $this->show === 'none' ?
157
-            I18N::translate('Patronymic Lineages') :
158
-            I18N::translate('Patronymic Lineages') . ' : ' . $this->legend
159
-        );
150
+	/**
151
+	 * Lineage@index
152
+	 */
153
+	public function index() {
154
+		$controller = new PageController();
155
+		$controller->setPageTitle(
156
+			$this->show === 'none' ?
157
+			I18N::translate('Patronymic Lineages') :
158
+			I18N::translate('Patronymic Lineages') . ' : ' . $this->legend
159
+		);
160 160
         
161
-        $view_bag = new ViewBag();
162
-        $view_bag->set('title', $controller->getPageTitle());
163
-        $view_bag->set('tree', Globals::getTree());
164
-        $view_bag->set('alpha', $this->alpha);
165
-        $view_bag->set('surname', $this->surname);
166
-        $view_bag->set('legend', $this->legend);
167
-        $view_bag->set('show_all', $this->show_all);
168
-        if($this->isShowingSurnames()) {
169
-            $view_bag->set('issurnames', true);
170
-            $view_bag->set('surnameslist', $this->getSurnamesList());
171
-        }
172
-        if($this->isShowingLineages()) {
173
-            $view_bag->set('islineages', true);
174
-            $view_bag->set('lineages', $this->getLineages());
161
+		$view_bag = new ViewBag();
162
+		$view_bag->set('title', $controller->getPageTitle());
163
+		$view_bag->set('tree', Globals::getTree());
164
+		$view_bag->set('alpha', $this->alpha);
165
+		$view_bag->set('surname', $this->surname);
166
+		$view_bag->set('legend', $this->legend);
167
+		$view_bag->set('show_all', $this->show_all);
168
+		if($this->isShowingSurnames()) {
169
+			$view_bag->set('issurnames', true);
170
+			$view_bag->set('surnameslist', $this->getSurnamesList());
171
+		}
172
+		if($this->isShowingLineages()) {
173
+			$view_bag->set('islineages', true);
174
+			$view_bag->set('lineages', $this->getLineages());
175 175
 
176
-            if ($this->show_all==='no') {
177
-            	$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
178
-            }
179
-            else {
180
-            	$view_bag->set('table_title', I18N::translate('All lineages'));
181
-            }
182
-        }
176
+			if ($this->show_all==='no') {
177
+				$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
178
+			}
179
+			else {
180
+				$view_bag->set('table_title', I18N::translate('All lineages'));
181
+			}
182
+		}
183 183
         
184
-        ViewFactory::make('Lineage', $this, $controller, $view_bag)->render();   
185
-    }
184
+		ViewFactory::make('Lineage', $this, $controller, $view_bag)->render();   
185
+	}
186 186
     
187 187
     
188 188
     
Please login to merge, or discard this patch.
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
             $this->show     = 'lineage'; // SURN list makes no sense here
99 99
         } elseif ($this->alpha) {
100 100
             $this->show_all = 'no';
101
-            $this->legend   = Filter::escapeHtml($this->alpha) . '…';
101
+            $this->legend   = Filter::escapeHtml($this->alpha).'…';
102 102
             $this->show     = Filter::get('show', 'surn|lineage', 'surn');
103 103
         } else {
104 104
             $this->show_all = 'no';
105 105
             $this->legend   = '…';
106 106
             $this->show     = 'none'; // Don't show lists until something is chosen
107 107
         }
108
-        $this->legend = '<span dir="auto">' . $this->legend . '</span>';
108
+        $this->legend = '<span dir="auto">'.$this->legend.'</span>';
109 109
           
110 110
     }
111 111
     
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
         $controller = new PageController();
155 155
         $controller->setPageTitle(
156 156
             $this->show === 'none' ?
157
-            I18N::translate('Patronymic Lineages') :
158
-            I18N::translate('Patronymic Lineages') . ' : ' . $this->legend
157
+            I18N::translate('Patronymic Lineages') : I18N::translate('Patronymic Lineages').' : '.$this->legend
159 158
         );
160 159
         
161 160
         $view_bag = new ViewBag();
@@ -165,15 +164,15 @@  discard block
 block discarded – undo
165 164
         $view_bag->set('surname', $this->surname);
166 165
         $view_bag->set('legend', $this->legend);
167 166
         $view_bag->set('show_all', $this->show_all);
168
-        if($this->isShowingSurnames()) {
167
+        if ($this->isShowingSurnames()) {
169 168
             $view_bag->set('issurnames', true);
170 169
             $view_bag->set('surnameslist', $this->getSurnamesList());
171 170
         }
172
-        if($this->isShowingLineages()) {
171
+        if ($this->isShowingLineages()) {
173 172
             $view_bag->set('islineages', true);
174 173
             $view_bag->set('lineages', $this->getLineages());
175 174
 
176
-            if ($this->show_all==='no') {
175
+            if ($this->show_all === 'no') {
177 176
             	$view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend));
178 177
             }
179 178
             else {
Please login to merge, or discard this patch.