Completed
Push — master ( b40ea8...2ebfe4 )
by Jonathan
05:27
created
src/Webtrees/Constants.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 * @return string $WT_RAPHAEL_JS_URL
62 62
 	 */
63 63
 	public static function WT_RAPHAEL_JS_URL() {
64
-	    return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js';
64
+	    return WT_STATIC_URL.'packages/raphael-2.1.4/raphael-min.js';
65 65
 	}
66 66
 		
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasksModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getConfigLink() {
68 68
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
69 69
         
70
-        return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
70
+        return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig';
71 71
     }
72 72
     
73 73
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
130 130
 	 */
131 131
     public function getProvider() {        
132
-        if(!$this->provider) {
132
+        if (!$this->provider) {
133 133
             $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
134 134
         }
135 135
         return $this->provider;
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/TaskProvider.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
      */
43 43
 	protected function loadTask($task_name) {
44 44
 		try {
45
-			if (file_exists($this->root_path . $task_name .'.php')) {
46
-				$task = include $this->root_path . $task_name .'.php';
47
-				if($task instanceof AbstractTask) {
45
+			if (file_exists($this->root_path.$task_name.'.php')) {
46
+				$task = include $this->root_path.$task_name.'.php';
47
+				if ($task instanceof AbstractTask) {
48 48
 				    $task->setProvider($this);
49 49
 					return $task;
50 50
 				}
51 51
 			}
52 52
 		}
53
-		catch(\Exception $ex) { }
53
+		catch (\Exception $ex) { }
54 54
 		
55 55
 		return null;
56 56
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     protected function loadTaskFromRow($row) {
73 73
         $task = $this->loadTask($row['majat_name']);
74 74
         
75
-		if($task) {
75
+		if ($task) {
76 76
 			$task->setParameters(
77 77
 				$row['majat_status'] == 'enabled',
78 78
 				new \DateTime($row['majat_last_run']), 
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
      * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96 96
      */
97 97
     public function getTask($task_name, $only_enabled = true) {
98
-        $args = array (
98
+        $args = array(
99 99
             'task_name' => $task_name
100 100
         );
101 101
     
102
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
-            ' FROM `##maj_admintasks`' .
102
+        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running'.
103
+            ' FROM `##maj_admintasks`'.
104 104
             ' WHERE majat_name = :task_name';
105
-        if($only_enabled) {
105
+        if ($only_enabled) {
106 106
             $sql .= ' AND majat_status = :status';
107 107
             $args['status'] = 'enabled';
108 108
         }
109 109
     
110 110
         $task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
111 111
     
112
-        if($task_array) {
112
+        if ($task_array) {
113 113
             return $this->loadTaskFromRow($task_array);
114 114
         }
115 115
     
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::updateTask()
137 137
     */
138 138
     public function updateTask(AbstractTask $task) {        
139
-        try{
139
+        try {
140 140
             Database::prepare(
141 141
                 'UPDATE `##maj_admintasks`'.
142 142
                 ' SET majat_status = :status,'.
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
     public function getTasksCount() {
171 171
         return Database::prepare(
172
-            'SELECT COUNT(majat_name)' .
172
+            'SELECT COUNT(majat_name)'.
173 173
             ' FROM `##maj_admintasks`'
174 174
             )->execute()->fetchOne();
175 175
     }
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 			'time_out' => AbstractTask::TASK_TIME_OUT		
195 195
 		);
196 196
 		
197
-		if(!$force) {
197
+		if (!$force) {
198 198
 			$sql .= ' AND (DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW() OR majat_last_result = 0)';
199 199
 		}
200 200
 		
201
-		if($task_name) {
201
+		if ($task_name) {
202 202
 			$sql .= ' AND majat_name = :task_name';
203 203
 			$args['task_name'] = $task_name;
204 204
 		}
205 205
 		
206 206
 		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
207 207
 		
208
-		foreach($data as $task_row) {
208
+		foreach ($data as $task_row) {
209 209
             $task = $this->loadTaskFromRow($task_row);
210
-			if($task)
210
+			if ($task)
211 211
 			{
212 212
 				$res[] = $task;
213 213
 			} 
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	 * {@inheritDoc}
221 221
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getFilteredTasksList()
222 222
 	 */
223
-    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
223
+    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null) {
224 224
         $res = array();
225 225
             
226
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
226
+        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running'.
227 227
             ' FROM `##maj_admintasks`';
228 228
         
229 229
         $args = array();
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                 
239 239
                 switch ($value['dir']) {
240 240
                     case 'asc':
241
-                        $sql .= $value['column'] . ' ASC ';
241
+                        $sql .= $value['column'].' ASC ';
242 242
                         break;
243 243
                     case 'desc':
244
-                        $sql .= $value['column'] . ' DESC ';
244
+                        $sql .= $value['column'].' DESC ';
245 245
                         break;
246 246
                 }
247 247
                 $i++;
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
             
259 259
         $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
260 260
 
261
-        foreach($data as $ga) {
261
+        foreach ($data as $ga) {
262 262
             $task = $this->loadTaskFromRow($ga);
263
-			if($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
263
+			if ($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
264 264
 			{
265 265
 				$res[] = $task;
266 266
 			}
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
      * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276 276
      */
277 277
 	public function getInstalledTasks() {
278
-		$tasks=array();
279
-		$dir=opendir($this->root_path);
280
-		while (($file=readdir($dir))!==false){ 
278
+		$tasks = array();
279
+		$dir = opendir($this->root_path);
280
+		while (($file = readdir($dir)) !== false) { 
281 281
 			try {
282
-			    if($file == '.' || $file == '..') continue;
283
-				$task = include $this->root_path . $file;
284
-				if($task ) {
282
+			    if ($file == '.' || $file == '..') continue;
283
+				$task = include $this->root_path.$file;
284
+				if ($task) {
285 285
 				    $task->setProvider($this);
286 286
 					Database::prepare(
287 287
 						'INSERT IGNORE INTO `##maj_admintasks`'.
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 				}
301 301
 			}
302 302
 			catch (\Exception $ex) {
303
-				Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage());
303
+				Log::addErrorLog('An error occured while trying to load the task in file '.$file.'. Exception: '.$ex->getMessage());
304 304
 			}
305 305
 		}
306 306
 		return $tasks;
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 	 * {inhericDoc}
312 312
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::deleteTask()
313 313
 	 */
314
-	public function deleteTask($task_name){
315
-		try{
314
+	public function deleteTask($task_name) {
315
+		try {
316 316
 			Database::beginTransaction();
317 317
 			
318 318
 			Database::prepare('DELETE FROM  `##maj_admintasks` WHERE majat_name= :task_name')
319 319
 				->execute(array('task_name' => $task_name));
320 320
 			Database::prepare('DELETE FROM  `##gedcom_setting` WHERE setting_name LIKE :setting_name')
321
-				->execute(array('setting_name' => 'MAJ_AT_' . $task_name .'%'));
321
+				->execute(array('setting_name' => 'MAJ_AT_'.$task_name.'%'));
322 322
 				
323 323
 			Database::commit();
324 324
 			
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 			
327 327
 			return true;
328 328
 		}
329
-		catch(\Exception $ex) {
329
+		catch (\Exception $ex) {
330 330
 			Database::rollback();
331 331
 		
332
-			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage());
332
+			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '.$ex->getMessage());
333 333
 			return false;
334 334
 		}
335 335
 	}
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/AdminConfigController.php 1 patch
Spacing   +22 added lines, -25 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ->setPageTitle($this->module->getTitle());
69 69
 			
70 70
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
71
-		if(is_null($token)) {
71
+		if (is_null($token)) {
72 72
 			$token = Functions::generateRandomToken();
73 73
 			$this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token);
74 74
 		}
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
         $data = new ViewBag();
77 77
         $data->set('title', $controller->getPageTitle());
78 78
         
79
-        $table_id = 'table-admintasks-' . Uuid::uuid4();
79
+        $table_id = 'table-admintasks-'.Uuid::uuid4();
80 80
         $data->set('table_id', $table_id);
81 81
 		
82 82
 		$data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger');
83 83
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
84
-		if(is_null($token)) {
84
+		if (is_null($token)) {
85 85
 			$token = Functions::generateRandomToken();
86 86
 			$this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token);
87 87
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     processing: true,
107 107
                     serverSide : true,
108 108
 					ajax : {
109
-						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='. $WT_TREE->getNameUrl().'",
109
+						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='.$WT_TREE->getNameUrl().'",
110 110
                         type : "POST"
111 111
 					},
112 112
                     columns: [
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
                             url: "module.php", 
144 144
                             type: "GET",
145 145
                             data: {
146
-                			    mod: "' . $this->module->getName() .'",
146
+                			    mod: "' . $this->module->getName().'",
147 147
                                 mod_action:  "Task@setStatus",
148 148
                 			    task: task,
149 149
                                 status: status
150 150
                             },
151 151
                             error: function(result, stat, error) {
152 152
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
153
-                                alert("' . I18N::translate('An error occured while editing this task:') . '" + err);
153
+                                alert("' . I18N::translate('An error occured while editing this task:').'" + err);
154 154
                             },
155 155
                             complete: function(result, stat) {
156 156
                                 adminTasksTable.ajax.reload(null, false);
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
     
188 188
         // Generate an AJAX/JSON response for datatables to load a block of rows
189 189
         $search = Filter::postArray('search');
190
-        if($search) $search = $search['value'];
190
+        if ($search) $search = $search['value'];
191 191
         $start  = Filter::postInteger('start');
192 192
         $length = Filter::postInteger('length');
193 193
         $order  = Filter::postArray('order');
194 194
     
195 195
 		$order_by_name = false;
196
-        foreach($order as $key => &$value) {
197
-            switch($value['column']) {
196
+        foreach ($order as $key => &$value) {
197
+            switch ($value['column']) {
198 198
                 case 3:
199 199
 					$order_by_name = true;
200 200
                     unset($order[$key]);
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
         }
212 212
     
213 213
         $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
214
-		if($order_by_name) {
214
+		if ($order_by_name) {
215 215
 			usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); });
216 216
 		}
217 217
         $recordsFiltered = count($list);
218 218
         $recordsTotal = $this->provider->getTasksCount();
219 219
     
220 220
         $data = array();
221
-        foreach($list as $task) {    
221
+        foreach ($list as $task) {    
222 222
             $datum = array();
223 223
 			
224 224
             $datum[0] = '
@@ -229,37 +229,34 @@  discard block
 block discarded – undo
229 229
                     <ul class="dropdown-menu" role="menu">
230 230
                        <li>
231 231
                             <a href="#" onclick="return set_admintask_status(\''. $task->getName().'\', '.($task->isEnabled() ? 'false' : 'true').');">
232
-                                <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
232
+                                <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).'
233 233
                             </a>
234 234
                        </li>
235 235
                         <li>
236
-                            <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='. $task->getName().'">
237
-                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
236
+                            <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName().'">
237
+                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').'
238 238
                             </a>
239 239
                        </li>
240 240
                     </ul>
241 241
                 </div>';
242 242
             $datum[1] = $task->getName();
243 243
             $datum[2] = $task->isEnabled() ? 
244
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
245
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
244
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
246 245
             $datum[3] = $task->getTitle();
247
-            $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
246
+            $date_format = str_replace('%', '', I18N::dateFormat()).' H:i:s';
248 247
 			$datum[4] = $task->getLastUpdated()->format($date_format);
249 248
             $datum[5] = $task->isLastRunSuccess() ? 
250
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
251
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
249
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
252 250
             $dtF = new \DateTime('@0');
253
-            $dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
251
+            $dtT = new \DateTime('@'.($task->getFrequency() * 60));            
254 252
             $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
255 253
 			$datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
256 254
 			$datum[8] = $task->isRunning() ? 
257
-				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : 
258
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
259
-			if($task->isEnabled() && !$task->isRunning()) {
255
+				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
256
+			if ($task->isEnabled() && !$task->isRunning()) {
260 257
 			    $datum[9] = '
261
-    			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
262
-    			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
258
+    			    <button id="bt_runtask_'. $task->getName().'" class="btn btn-primary" href="#" onclick="return run_admintask(\''.$task->getName().'\')">
259
+    			         <div id="bt_runtasktext_'. $task->getName().'"><i class="fa fa-cog fa-fw" ></i>'.I18N::translate('Run').'</div>
263 260
     			    </button>';
264 261
 			}
265 262
 			else {
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/TaskEditView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
     			</div>
105 105
     		</div>
106 106
 			
107
-			<?php if($task instanceof ConfigurableTaskInterface) { ?>
107
+			<?php if ($task instanceof ConfigurableTaskInterface) { ?>
108 108
 			
109 109
 			<h3><?php echo I18N::translate('Options for “%s”', $task->getTitle()); ?></h3>
110 110
 			
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/AdminConfigView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 			<?php echo I18N::translate('In order to do so, use the following URL, with the optional parameter <em>%s</em> if you only want to force the execution of one task: ', 'task'); ?>
41 41
 		</p>
42 42
 		<p>
43
-			<code><?php echo $this->data->get('trigger_url_root') .'&force=<span id="token_url">'. $this->data->get('trigger_token') .'</span>[&task='. I18N::translate('task_name').']'; ?></code>
43
+			<code><?php echo $this->data->get('trigger_url_root').'&force=<span id="token_url">'.$this->data->get('trigger_token').'</span>[&task='.I18N::translate('task_name').']'; ?></code>
44 44
 		</p>
45 45
 		<p>
46 46
 			<button id="bt_genforcetoken" class="bt bt-primary" onClick="generate_force_token();">
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/SosaConfigController.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41 41
         return Auth::check() && 
42 42
             ( 
43
-                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
43
+                $user_id == Auth::user()->getUserId() || // Allow update for yourself
44 44
                 ($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45 45
              );
46 46
     }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function update(BaseController $controller) {
55 55
         global $WT_TREE;          
56
-        if($this->canUpdate() && Filter::checkCsrf()) 
56
+        if ($this->canUpdate() && Filter::checkCsrf()) 
57 57
         {            
58 58
             $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59 59
             $user = User::find(Filter::postInteger('userid', -1));
60 60
             
61
-            if($user  && $indi) {
61
+            if ($user && $indi) {
62 62
                 $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63 63
                 $controller->addInlineJavascript('
64 64
                     $( document ).ready(function() {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             
98 98
             function majComputeSosa(user_id) {
99 99
                 jQuery("#bt_sosa_compute").prop( "disabled", true );
100
-                jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i>&nbsp;'. I18N::translate('Computing...') .'");
100
+                jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i>&nbsp;'. I18N::translate('Computing...').'");
101 101
                 jQuery("#bt_sosa_computing").load(
102 102
 		          "module.php?mod='.$this->module->getName().'&mod_action=SosaConfig@computeAll&ged='.$WT_TREE->getNameUrl().'&userid=" + user_id,
103 103
 		          function() {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             }');
107 107
         
108 108
         $action = Filter::post('action');
109
-        if($action === 'update') $this->update($controller);
109
+        if ($action === 'update') $this->update($controller);
110 110
         
111 111
         $view_bag = new ViewBag();
112 112
         $view_bag->set('title', $controller->getPageTitle());
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
         
116 116
         $users_root = array();
117 117
         $users_js_array = 'var users_array = [];';
118
-        if(Auth::check()) {
118
+        if (Auth::check()) {
119 119
             $root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
120
-            $users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id);
121
-            $users_js_array .=  'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";';
120
+            $users_root[] = array('user' => Auth::user(), 'rootid' => $root_id);
121
+            $users_js_array .= 'users_array["'.Auth::user()->getUserId().'"] = "'.$root_id.'";';
122 122
             
123
-            if(Auth::isManager($WT_TREE)) {
123
+            if (Auth::isManager($WT_TREE)) {
124 124
                 $default_user = User::find(-1);
125 125
                 $default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID');
126
-                $users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id);
127
-                $users_js_array .=  'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";';
126
+                $users_root[] = array('user' => $default_user, 'rootid' => $default_root_id);
127
+                $users_js_array .= 'users_array["'.$default_user->getUserId().'"] = "'.$default_root_id.'";';
128 128
             }
129 129
         }
130 130
         $view_bag->set('users_settings', $users_root);       
131 131
         
132
-        $controller->addInlineJavascript($users_js_array . '            
132
+        $controller->addInlineJavascript($users_js_array.'            
133 133
                 $("#maj-sosa-config-select").change(function() {
134 134
                     $("#rootid").val(users_array[this.value]);
135 135
                 });
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $view_bag->set('is_success', false);
152 152
         
153 153
         $user = User::find(Filter::getInteger('userid', -1));
154
-        if($user) {
154
+        if ($user) {
155 155
             $calculator = new SosaCalculator($WT_TREE, $user);
156
-            if($calculator->computeAll()) $view_bag->set('is_success', true);
156
+            if ($calculator->computeAll()) $view_bag->set('is_success', true);
157 157
         }
158 158
         ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159 159
     }
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         $user = User::find(Filter::getInteger('userid', -1));
174 174
         $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
175 175
         
176
-        if($user && $indi) {
176
+        if ($user && $indi) {
177 177
             $calculator = new SosaCalculator($WT_TREE, $user);
178
-            if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
178
+            if ($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179 179
         }
180 180
         else {
181 181
             $view_bag->set('error', I18N::translate('Non existing individual'));
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Schema/Migration0.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
 	public function upgrade() {
23 23
 
24 24
 		Database::exec(
25
-		    'CREATE TABLE IF NOT EXISTS `##maj_sosa` (' .
26
-	        ' majs_gedcom_id      INTEGER 	        NOT NULL,' .
27
-		    ' majs_user_id        INTEGER           NOT NULL DEFAULT -1,' . 
28
-		    ' majs_sosa           BIGINT UNSIGNED 	NOT NULL,' . // Allow to calculate sosa on 64 generations
29
-            ' majs_i_id           VARCHAR(20)	    NOT NULL,' .	
30
-            ' majs_gen            TINYINT			NULL,' .
31
-            ' majs_birth_year	  SMALLINT			NULL,' .
32
-            ' majs_death_year	  SMALLINT			NULL,' .
33
-            ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),' .
34
-		    ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,' .
35
-		    ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE' .			
25
+		    'CREATE TABLE IF NOT EXISTS `##maj_sosa` ('.
26
+	        ' majs_gedcom_id      INTEGER 	        NOT NULL,'.
27
+		    ' majs_user_id        INTEGER           NOT NULL DEFAULT -1,'. 
28
+		    ' majs_sosa           BIGINT UNSIGNED 	NOT NULL,'.// Allow to calculate sosa on 64 generations
29
+            ' majs_i_id           VARCHAR(20)	    NOT NULL,'.	
30
+            ' majs_gen            TINYINT			NULL,'.
31
+            ' majs_birth_year	  SMALLINT			NULL,'.
32
+            ' majs_death_year	  SMALLINT			NULL,'.
33
+            ' PRIMARY KEY (majs_gedcom_id, majs_user_id, majs_sosa),'.
34
+		    ' FOREIGN KEY `##gedcom_id_fk1` (majs_gedcom_id) REFERENCES `##gedcom` (gedcom_id) ON DELETE CASCADE,'.
35
+		    ' FOREIGN KEY `##user_id_fk1` (majs_user_id) REFERENCES `##user` (user_id) ON DELETE CASCADE'.			
36 36
 		    ') COLLATE utf8_unicode_ci ENGINE=InnoDB'
37 37
 		);
38 38
 	}
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListView.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         <div id="maj-sosa-list-page" class="center">
29 29
 			<h2><?php echo $this->data->get('title'); ?></h2>
30 30
 			
31
-			<?php  if($this->data->get('is_setup')) { 
31
+			<?php  if ($this->data->get('is_setup')) { 
32 32
 			    $selectedgen = $this->data->get('generation');
33 33
 			    $this->renderSosaHeader();
34
-			    if($this->data->get('has_sosa') ) {
35
-			         if($selectedgen > 0) {
34
+			    if ($this->data->get('has_sosa')) {
35
+			         if ($selectedgen > 0) {
36 36
 			        ?>
37 37
 			<div id="sosalist-tabs">
38 38
 				<ul>
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         ?>
76 76
         
77 77
     	<form method="get" name="setgen" action="module.php">
78
-			<input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>">
79
-			<input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action');?>">
80
-			<input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged');?>">
78
+			<input type="hidden" name="mod" value="<?php echo $this->data->get('url_module'); ?>">
79
+			<input type="hidden" name="mod_action" value="<?php echo $this->data->get('url_action'); ?>">
80
+			<input type="hidden" name="ged" value="<?php echo $this->data->get('url_ged'); ?>">
81 81
 			<div class="maj-table">
82 82
 				<div class="maj-row">
83 83
 					<div class="label"><?php echo I18N::translate('Choose generation') ?></div>
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 				<div class="maj-row">
86 86
 					<div class="value">
87 87
 						<select name="gen">							
88
-						<?php for($i=$this->data->get('min_gen'); $i <= $max_gen;$i++) {?>
88
+						<?php for ($i = $this->data->get('min_gen'); $i <= $max_gen; $i++) {?>
89 89
 							<option value="<?php echo $i; ?>"
90
-							<?php if($selectedgen && $selectedgen==$i) { ?> selected="true" <?php } ?>
90
+							<?php if ($selectedgen && $selectedgen == $i) { ?> selected="true" <?php } ?>
91 91
                 			><?php echo I18N::translate('Generation %d', $i); ?>
92 92
                 			</option>
93 93
                 		<?php } ?>
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
                 	</div>
96 96
                 </div>
97 97
       		</div>
98
-      		<input type="submit" value="<?php echo I18N::translate('Show');?>" />
98
+      		<input type="submit" value="<?php echo I18N::translate('Show'); ?>" />
99 99
       		<br />
100 100
       	</form>
101
-      	<?php if($selectedgen > 0) { ?>
101
+      	<?php if ($selectedgen > 0) { ?>
102 102
 		<h4>
103
-			<?php if($selectedgen > $this->data->get('min_gen')) { ?>
104
-			<a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen-1; ?>">
103
+			<?php if ($selectedgen > $this->data->get('min_gen')) { ?>
104
+			<a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen - 1; ?>">
105 105
 				<i class="icon-ldarrow" title="<?php echo I18N::translate('Previous generation'); ?>" ></i>
106 106
 			</a>
107 107
 			&nbsp;&nbsp;
108 108
 			<?php } ?>
109 109
 			<?php echo I18N::translate('Generation %d', $selectedgen); ?>
110
-			<?php if($selectedgen < $max_gen) { ?>
110
+			<?php if ($selectedgen < $max_gen) { ?>
111 111
 			&nbsp;&nbsp;
112
-			<a href="module.php?mod=<?php echo $this->data->get('url_module');?>&mod_action=<?php echo $this->data->get('url_action');?>&ged=<?php echo $this->data->get('url_ged');?>&gen=<?php echo $selectedgen+1; ?>">
112
+			<a href="module.php?mod=<?php echo $this->data->get('url_module'); ?>&mod_action=<?php echo $this->data->get('url_action'); ?>&ged=<?php echo $this->data->get('url_ged'); ?>&gen=<?php echo $selectedgen + 1; ?>">
113 113
 				<i class="icon-rdarrow" title="<?php echo I18N::translate('Next generation'); ?>" ></i>
114 114
 			</a>
115 115
 			<?php } ?>
Please login to merge, or discard this patch.