Completed
Push — feature/code-analysis ( 1158f1...5e4834 )
by Jonathan
03:51
created
src/Webtrees/Module/Sosa/SosaConfigController.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,66 +29,66 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class SosaConfigController extends MvcController
31 31
 {      
32
-    /**
33
-     * Check if the user can update the sosa ancestors list
34
-     * 
35
-     * @return bool
36
-     */
37
-    protected function canUpdate() {
38
-        global $WT_TREE;
32
+	/**
33
+	 * Check if the user can update the sosa ancestors list
34
+	 * 
35
+	 * @return bool
36
+	 */
37
+	protected function canUpdate() {
38
+		global $WT_TREE;
39 39
         
40
-        $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41
-        return Auth::check() && 
42
-            ( 
43
-                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
44
-                ($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45
-             );
46
-    }
40
+		$user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41
+		return Auth::check() && 
42
+			( 
43
+				$user_id == Auth::user()->getUserId() ||        // Allow update for yourself
44
+				($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45
+			 );
46
+	}
47 47
     
48
-    /**
49
-     * Saves Sosa's user preferences (root individual for the user).
50
-     * 
51
-     * @param BaseController $controller
52
-     * @return bool True is saving successfull
53
-     */
54
-    protected function update(BaseController $controller) {
55
-        global $WT_TREE;          
56
-        if($this->canUpdate() && Filter::checkCsrf()) 
57
-        {            
58
-            $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59
-            $user = User::find(Filter::postInteger('userid', -1));
48
+	/**
49
+	 * Saves Sosa's user preferences (root individual for the user).
50
+	 * 
51
+	 * @param BaseController $controller
52
+	 * @return bool True is saving successfull
53
+	 */
54
+	protected function update(BaseController $controller) {
55
+		global $WT_TREE;          
56
+		if($this->canUpdate() && Filter::checkCsrf()) 
57
+		{            
58
+			$indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59
+			$user = User::find(Filter::postInteger('userid', -1));
60 60
             
61
-            if($user  && $indi) {
62
-                $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63
-                $controller->addInlineJavascript('
61
+			if($user  && $indi) {
62
+				$WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63
+				$controller->addInlineJavascript('
64 64
                     $( document ).ready(function() {
65 65
                         majComputeSosa('.$user->getUserId().');
66 66
                     });');
67
-                FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
68
-                return true;
69
-            }
70
-        }
71
-        FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
72
-        return false;
73
-    }
67
+				FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
68
+				return true;
69
+			}
70
+		}
71
+		FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
72
+		return false;
73
+	}
74 74
     
75
-    /**
76
-     * Pages
77
-     */
75
+	/**
76
+	 * Pages
77
+	 */
78 78
     
79
-    /**
80
-     * SosaConfig@index
81
-     */
82
-    public function index() {
83
-        global $WT_TREE;
79
+	/**
80
+	 * SosaConfig@index
81
+	 */
82
+	public function index() {
83
+		global $WT_TREE;
84 84
         
85
-        $controller = new PageController();
86
-        $controller
87
-        ->setPageTitle(I18N::translate('Sosa Configuration'))
88
-        ->restrictAccess(Auth::check())
89
-        ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
90
-        ->addInlineJavascript('autocomplete();')
91
-        ->addInlineJavascript('
85
+		$controller = new PageController();
86
+		$controller
87
+		->setPageTitle(I18N::translate('Sosa Configuration'))
88
+		->restrictAccess(Auth::check())
89
+		->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
90
+		->addInlineJavascript('autocomplete();')
91
+		->addInlineJavascript('
92 92
             $( document ).ready(function() {
93 93
                 $("#bt_sosa_compute").click(function() {
94 94
                     majComputeSosa($("#maj_sosa_input_userid, #maj-sosa-config-select option:selected").val());
@@ -105,83 +105,83 @@  discard block
 block discarded – undo
105 105
                   });
106 106
             }');
107 107
         
108
-        $action = Filter::post('action');
109
-        if($action === 'update') $this->update($controller);
108
+		$action = Filter::post('action');
109
+		if($action === 'update') $this->update($controller);
110 110
         
111
-        $view_bag = new ViewBag();
112
-        $view_bag->set('title', $controller->getPageTitle());
113
-        $view_bag->set('tree', $WT_TREE);
114
-        $view_bag->set('form_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaConfig&ged='.$WT_TREE->getNameUrl());
111
+		$view_bag = new ViewBag();
112
+		$view_bag->set('title', $controller->getPageTitle());
113
+		$view_bag->set('tree', $WT_TREE);
114
+		$view_bag->set('form_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaConfig&ged='.$WT_TREE->getNameUrl());
115 115
         
116
-        $users_root = array();
117
-        $users_js_array = 'var users_array = [];';
118
-        if(Auth::check()) {
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 . '";';
116
+		$users_root = array();
117
+		$users_js_array = 'var users_array = [];';
118
+		if(Auth::check()) {
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 . '";';
122 122
             
123
-            if(Auth::isManager($WT_TREE)) {
124
-                $default_user = User::find(-1);
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 . '";';
128
-            }
129
-        }
130
-        $view_bag->set('users_settings', $users_root);       
123
+			if(Auth::isManager($WT_TREE)) {
124
+				$default_user = User::find(-1);
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 . '";';
128
+			}
129
+		}
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
                 });
136 136
              ');
137 137
         
138
-        ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render();   
139
-    }
138
+		ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render();   
139
+	}
140 140
     
141
-    /**
142
-     * SosaConfig@computeAll
143
-     */
144
-    public function computeAll() {
145
-        global $WT_TREE;
141
+	/**
142
+	 * SosaConfig@computeAll
143
+	 */
144
+	public function computeAll() {
145
+		global $WT_TREE;
146 146
         
147
-        $controller = new AjaxController();
148
-        $controller->restrictAccess($this->canUpdate());
147
+		$controller = new AjaxController();
148
+		$controller->restrictAccess($this->canUpdate());
149 149
         
150
-        $view_bag = new ViewBag();
151
-        $view_bag->set('is_success', false);
150
+		$view_bag = new ViewBag();
151
+		$view_bag->set('is_success', false);
152 152
         
153
-        $user = User::find(Filter::getInteger('userid', -1));
154
-        if($user) {
155
-            $calculator = new SosaCalculator($WT_TREE, $user);
156
-            if($calculator->computeAll()) $view_bag->set('is_success', true);
157
-        }
158
-        ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159
-    }
153
+		$user = User::find(Filter::getInteger('userid', -1));
154
+		if($user) {
155
+			$calculator = new SosaCalculator($WT_TREE, $user);
156
+			if($calculator->computeAll()) $view_bag->set('is_success', true);
157
+		}
158
+		ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159
+	}
160 160
     
161
-    /**
162
-     * SosaConfig@computePartial
163
-     */
164
-    public function computePartial() {
165
-        global $WT_TREE;
161
+	/**
162
+	 * SosaConfig@computePartial
163
+	 */
164
+	public function computePartial() {
165
+		global $WT_TREE;
166 166
     
167
-        $controller = new AjaxController();
168
-        $controller->restrictAccess($this->canUpdate());
167
+		$controller = new AjaxController();
168
+		$controller->restrictAccess($this->canUpdate());
169 169
     
170
-        $view_bag = new ViewBag();
171
-        $view_bag->set('is_success', false);
170
+		$view_bag = new ViewBag();
171
+		$view_bag->set('is_success', false);
172 172
     
173
-        $user = User::find(Filter::getInteger('userid', -1));
174
-        $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
173
+		$user = User::find(Filter::getInteger('userid', -1));
174
+		$indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
175 175
         
176
-        if($user && $indi) {
177
-            $calculator = new SosaCalculator($WT_TREE, $user);
178
-            if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179
-        }
180
-        else {
181
-            $view_bag->set('error', I18N::translate('Non existing individual'));
182
-        }
176
+		if($user && $indi) {
177
+			$calculator = new SosaCalculator($WT_TREE, $user);
178
+			if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179
+		}
180
+		else {
181
+			$view_bag->set('error', I18N::translate('Non existing individual'));
182
+		}
183 183
             
184
-        ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
185
-    }
184
+		ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
185
+	}
186 186
     
187 187
 }
188 188
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Model/SosaProvider.php 1 patch
Indentation   +549 added lines, -549 removed lines patch added patch discarded remove patch
@@ -22,378 +22,378 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class SosaProvider {
24 24
     
25
-    /**
26
-     * Maximum number of generation the database is able to hold.
27
-     * @var int MAX_DB_GENERATIONS
28
-     */
29
-    const MAX_DB_GENERATIONS = 64;
30
-    
31
-    /**
32
-     * System's default user (ID -1 in the database
33
-     * @var User $default_user
34
-     */
35
-    protected static $default_user;
36
-    
37
-    /**
38
-     * Reference user
39
-     * @var User $user
40
-     */
41
-    protected $user;
42
-    
43
-    /**
44
-     * Reference tree
45
-     * @var Tree $tree
46
-     */
47
-    protected $tree;
48
-    
49
-    /**
50
-     * Cached list of Sosa Individuals by generation
51
-     * Format: key = generation, value = array ( sosa => Individual ID)
52
-     * @var array $sosa_list_by_gen
53
-     */
54
-    protected $sosa_list_by_gen;
55
-    
56
-    /**
57
-     * Cached list of Sosa Families by generation
58
-     * Format: key = generation, value = array ( sosa => Family ID)
59
-     * @var unknown $sosa_fam_list_by_gen
60
-     */
61
-    protected $sosa_fam_list_by_gen;
62
-    
63
-    /**
64
-     * Cached array of statistics by generation
65
-     * Format:  key = generation, 
66
-     *          value = array(
67
-     *              sosaCount, sosaTotalCount, diffSosaTotalCount, firstBirth, lastBirth, avgBirth
68
-     *           )
69
-     * @var array $statistics_tab
70
-     */
71
-    protected $statistics_tab;
72
-    
73
-    /**
74
-     * Has the provider's initialisation completed
75
-     * @var bool $is_setup
76
-     */
77
-    protected $is_setup;
78
-    
79
-    /**
80
-     * Constructor for Sosa Provider.
81
-     * A provider is defined in relation to a specific tree and reference user.
82
-     * 
83
-     * @param Tree $tree
84
-     * @param User $user
85
-     */
86
-    public function __construct(Tree $tree, User $user = null) {
87
-        if(self::$default_user === null) 
88
-            self::$default_user = User::find(-1);
25
+	/**
26
+	 * Maximum number of generation the database is able to hold.
27
+	 * @var int MAX_DB_GENERATIONS
28
+	 */
29
+	const MAX_DB_GENERATIONS = 64;
30
+    
31
+	/**
32
+	 * System's default user (ID -1 in the database
33
+	 * @var User $default_user
34
+	 */
35
+	protected static $default_user;
36
+    
37
+	/**
38
+	 * Reference user
39
+	 * @var User $user
40
+	 */
41
+	protected $user;
42
+    
43
+	/**
44
+	 * Reference tree
45
+	 * @var Tree $tree
46
+	 */
47
+	protected $tree;
48
+    
49
+	/**
50
+	 * Cached list of Sosa Individuals by generation
51
+	 * Format: key = generation, value = array ( sosa => Individual ID)
52
+	 * @var array $sosa_list_by_gen
53
+	 */
54
+	protected $sosa_list_by_gen;
55
+    
56
+	/**
57
+	 * Cached list of Sosa Families by generation
58
+	 * Format: key = generation, value = array ( sosa => Family ID)
59
+	 * @var unknown $sosa_fam_list_by_gen
60
+	 */
61
+	protected $sosa_fam_list_by_gen;
62
+    
63
+	/**
64
+	 * Cached array of statistics by generation
65
+	 * Format:  key = generation, 
66
+	 *          value = array(
67
+	 *              sosaCount, sosaTotalCount, diffSosaTotalCount, firstBirth, lastBirth, avgBirth
68
+	 *           )
69
+	 * @var array $statistics_tab
70
+	 */
71
+	protected $statistics_tab;
72
+    
73
+	/**
74
+	 * Has the provider's initialisation completed
75
+	 * @var bool $is_setup
76
+	 */
77
+	protected $is_setup;
78
+    
79
+	/**
80
+	 * Constructor for Sosa Provider.
81
+	 * A provider is defined in relation to a specific tree and reference user.
82
+	 * 
83
+	 * @param Tree $tree
84
+	 * @param User $user
85
+	 */
86
+	public function __construct(Tree $tree, User $user = null) {
87
+		if(self::$default_user === null) 
88
+			self::$default_user = User::find(-1);
89 89
         
90
-        $this->tree = $tree;
91
-        $this->user = $user;
92
-        $this->is_setup = true;
93
-        if($this->user === null) $this->user = Auth::user();
94
-        if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user;
90
+		$this->tree = $tree;
91
+		$this->user = $user;
92
+		$this->is_setup = true;
93
+		if($this->user === null) $this->user = Auth::user();
94
+		if(strlen($this->user->getUserId()) == 0) $this->user = self::$default_user;
95 95
         
96
-        // Check if the user, or the default user, has a root already setup;
97
-        if(!$this->getRootIndi()) {
98
-            if($this->user == self::$default_user) {  // If the default user is not setup
99
-                $this->is_setup = false;
100
-            }
101
-            else {
102
-                $this->user = self::$default_user;
103
-                $this->is_setup = $this->getRootIndi() === null;
104
-            }            
105
-        }
106
-    }
107
-    
108
-    /**
109
-     * Returns is the Provider has been successfully set up
110
-     * @return bool
111
-     */
112
-    public function isSetup() {
113
-        return $this->is_setup;
114
-    }
115
-    
116
-    /**
117
-     * Return the root individual for the reference tree and user.
118
-     * @return string Individual ID
119
-     */
120
-    public function getRootIndi() {
121
-        return $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');
122
-    }
96
+		// Check if the user, or the default user, has a root already setup;
97
+		if(!$this->getRootIndi()) {
98
+			if($this->user == self::$default_user) {  // If the default user is not setup
99
+				$this->is_setup = false;
100
+			}
101
+			else {
102
+				$this->user = self::$default_user;
103
+				$this->is_setup = $this->getRootIndi() === null;
104
+			}            
105
+		}
106
+	}
107
+    
108
+	/**
109
+	 * Returns is the Provider has been successfully set up
110
+	 * @return bool
111
+	 */
112
+	public function isSetup() {
113
+		return $this->is_setup;
114
+	}
115
+    
116
+	/**
117
+	 * Return the root individual for the reference tree and user.
118
+	 * @return string Individual ID
119
+	 */
120
+	public function getRootIndi() {
121
+		return $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID');
122
+	}
123 123
        
124
-    /*****************
124
+	/*****************
125 125
      * DATA CRUD LAYER
126 126
      *****************/
127 127
     
128
-    /**
129
-     * Remove all Sosa entries related to the gedcom file and user
130
-     */
131
-    public function deleteAll() {
132
-        if(!$this->is_setup) return;
133
-        Database::prepare(
134
-            'DELETE FROM `##maj_sosa`'.
135
-            ' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
136
-            ->execute(array(
137
-                'tree_id' => $this->tree->getTreeId(), 
138
-                'user_id' => $this->user->getUserId()                
139
-            ));
140
-    }
141
-    
142
-    /**
143
-     * Remove all ancestors of a sosa number
144
-     * 
145
-     * @param int $sosa
146
-     */
147
-    public function deleteAncestors($sosa) {
148
-        if(!$this->is_setup) return;
149
-        $gen = Functions::getGeneration($sosa);
150
-        Database::prepare(
151
-            'DELETE FROM `##maj_sosa`'.
152
-            ' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' .
153
-            ' AND majs_gen >= :gen' .
154
-            ' AND FLOOR(majs_sosa / (POW(2, (majs_gen - :gen)))) = :sosa'
155
-        )->execute(array(
156
-            'tree_id' => $this->tree->getTreeId(), 
157
-            'user_id' => $this->user->getUserId(),
158
-            'gen' => $gen,
159
-            'sosa' => $sosa
160
-        ));
161
-    }    
162
-    
163
-    /**
164
-     * Insert (or update if already existing) a list of Sosa individuals
165
-     * @param array $sosa_records
166
-     */
167
-    public function insertOrUpdate($sosa_records) {
168
-        if(!$this->is_setup) return;
128
+	/**
129
+	 * Remove all Sosa entries related to the gedcom file and user
130
+	 */
131
+	public function deleteAll() {
132
+		if(!$this->is_setup) return;
133
+		Database::prepare(
134
+			'DELETE FROM `##maj_sosa`'.
135
+			' WHERE majs_gedcom_id= :tree_id and majs_user_id = :user_id ')
136
+			->execute(array(
137
+				'tree_id' => $this->tree->getTreeId(), 
138
+				'user_id' => $this->user->getUserId()                
139
+			));
140
+	}
141
+    
142
+	/**
143
+	 * Remove all ancestors of a sosa number
144
+	 * 
145
+	 * @param int $sosa
146
+	 */
147
+	public function deleteAncestors($sosa) {
148
+		if(!$this->is_setup) return;
149
+		$gen = Functions::getGeneration($sosa);
150
+		Database::prepare(
151
+			'DELETE FROM `##maj_sosa`'.
152
+			' WHERE majs_gedcom_id=:tree_id and majs_user_id = :user_id' .
153
+			' AND majs_gen >= :gen' .
154
+			' AND FLOOR(majs_sosa / (POW(2, (majs_gen - :gen)))) = :sosa'
155
+		)->execute(array(
156
+			'tree_id' => $this->tree->getTreeId(), 
157
+			'user_id' => $this->user->getUserId(),
158
+			'gen' => $gen,
159
+			'sosa' => $sosa
160
+		));
161
+	}    
162
+    
163
+	/**
164
+	 * Insert (or update if already existing) a list of Sosa individuals
165
+	 * @param array $sosa_records
166
+	 */
167
+	public function insertOrUpdate($sosa_records) {
168
+		if(!$this->is_setup) return;
169 169
         
170
-        $treeid = $this->tree->getTreeId();
171
-        $userid = $this->user->getUserId();
172
-        $questionmarks_table = array();
173
-        $values_table = array();
170
+		$treeid = $this->tree->getTreeId();
171
+		$userid = $this->user->getUserId();
172
+		$questionmarks_table = array();
173
+		$values_table = array();
174 174
         
175
-        $i = 0;
176
-        foreach  ($sosa_records as $row) {
177
-            $gen = Functions::getGeneration($row['sosa']);
178
-            if($gen <= self::MAX_DB_GENERATIONS) {
179
-                $questionmarks_table[] = 
180
-                    '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.', :indi_id'.$i.', :gen'.$i.', :byear'.$i.', :dyear'.$i.')';
181
-                $values_table = array_merge(
182
-                    $values_table, 
183
-                    array(
184
-                        'tree_id'.$i => $treeid, 
185
-                        'user_id'.$i => $userid, 
186
-                        'sosa'.$i => $row['sosa'], 
187
-                        'indi_id'.$i => $row['indi'], 
188
-                        'gen'.$i => Functions::getGeneration($row['sosa']),
189
-                        'byear'.$i => $row['birth_year'],
190
-                        'dyear'.$i => $row['death_year']
191
-                    )
192
-                );
193
-            }
194
-            $i++;
195
-        }
175
+		$i = 0;
176
+		foreach  ($sosa_records as $row) {
177
+			$gen = Functions::getGeneration($row['sosa']);
178
+			if($gen <= self::MAX_DB_GENERATIONS) {
179
+				$questionmarks_table[] = 
180
+					'(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.', :indi_id'.$i.', :gen'.$i.', :byear'.$i.', :dyear'.$i.')';
181
+				$values_table = array_merge(
182
+					$values_table, 
183
+					array(
184
+						'tree_id'.$i => $treeid, 
185
+						'user_id'.$i => $userid, 
186
+						'sosa'.$i => $row['sosa'], 
187
+						'indi_id'.$i => $row['indi'], 
188
+						'gen'.$i => Functions::getGeneration($row['sosa']),
189
+						'byear'.$i => $row['birth_year'],
190
+						'dyear'.$i => $row['death_year']
191
+					)
192
+				);
193
+			}
194
+			$i++;
195
+		}
196 196
         
197
-        $sql = 'REPLACE INTO `##maj_sosa`' .
198
-            ' (majs_gedcom_id, majs_user_id, majs_sosa, majs_i_id, majs_gen, majs_birth_year, majs_death_year)' .
199
-            ' VALUES '. implode(',', $questionmarks_table);
200
-        Database::prepare($sql)->execute($values_table);
201
-    }
197
+		$sql = 'REPLACE INTO `##maj_sosa`' .
198
+			' (majs_gedcom_id, majs_user_id, majs_sosa, majs_i_id, majs_gen, majs_birth_year, majs_death_year)' .
199
+			' VALUES '. implode(',', $questionmarks_table);
200
+		Database::prepare($sql)->execute($values_table);
201
+	}
202 202
     
203
-    /****************
203
+	/****************
204 204
      * SIMPLE QUERIES
205 205
      ****************/
206 206
     
207
-    /**
208
-     * Returns the list of Sosa numbers to which an individual is related.
209
-     * Format: key = sosa number, value = generation for the Sosa number
210
-     * 
211
-     * @param Individual $indi
212
-     * @return array Array of sosa numbers
213
-     */
214
-    public function getSosaNumbers(Individual $indi) {
215
-        if(!$this->is_setup) return array();
216
-        return Database::prepare(
217
-                'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'.
218
-                ' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
219
-            )->execute(array(
220
-                'indi_id' => $indi->getXref(), 
221
-                'tree_id' => $this->tree->getTreeId(), 
222
-                'user_id' => $this->user->getUserId()
223
-            ))->fetchAssoc();
224
-    }
225
-    
226
-    /**
227
-     * Get the last generation of Sosa ancestors
228
-     *
229
-     * @return number Last generation if found, 1 otherwise
230
-     */
231
-    public function getLastGeneration() {
232
-        if(!$this->is_setup) return;
233
-        return Database::prepare(
234
-                'SELECT MAX(majs_gen) FROM `##maj_sosa`'.
235
-                ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
236
-            )->execute(array(
237
-                'tree_id' => $this->tree->getTreeId(), 
238
-                'user_id' => $this->user->getUserId()                
239
-            ))->fetchOne() ?: 1;
240
-    }
241
-    
242
-    /*************
207
+	/**
208
+	 * Returns the list of Sosa numbers to which an individual is related.
209
+	 * Format: key = sosa number, value = generation for the Sosa number
210
+	 * 
211
+	 * @param Individual $indi
212
+	 * @return array Array of sosa numbers
213
+	 */
214
+	public function getSosaNumbers(Individual $indi) {
215
+		if(!$this->is_setup) return array();
216
+		return Database::prepare(
217
+				'SELECT majs_sosa, majs_gen FROM `##maj_sosa`'.
218
+				' WHERE majs_i_id=:indi_id AND majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
219
+			)->execute(array(
220
+				'indi_id' => $indi->getXref(), 
221
+				'tree_id' => $this->tree->getTreeId(), 
222
+				'user_id' => $this->user->getUserId()
223
+			))->fetchAssoc();
224
+	}
225
+    
226
+	/**
227
+	 * Get the last generation of Sosa ancestors
228
+	 *
229
+	 * @return number Last generation if found, 1 otherwise
230
+	 */
231
+	public function getLastGeneration() {
232
+		if(!$this->is_setup) return;
233
+		return Database::prepare(
234
+				'SELECT MAX(majs_gen) FROM `##maj_sosa`'.
235
+				' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'
236
+			)->execute(array(
237
+				'tree_id' => $this->tree->getTreeId(), 
238
+				'user_id' => $this->user->getUserId()                
239
+			))->fetchOne() ?: 1;
240
+	}
241
+    
242
+	/*************
243 243
      * SOSA LISTS
244 244
      *************/
245 245
     
246
-    /**
247
-     * Return the list of all sosas, with the generations it belongs to
248
-     *
249
-     * @param int $ged_id ID of the gedcom file
250
-     * @return array Associative array of Sosa ancestors, with their generation, comma separated
251
-     */
252
-    public function getAllSosaWithGenerations(){
253
-        if(!$this->is_setup) return array();
254
-        return Database::prepare(
255
-            'SELECT majs_i_id AS indi,' .
256
-            ' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
257
-            ' FROM `##maj_sosa`' .
258
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' .
259
-            ' GROUP BY majs_i_id'
260
-        )->execute(array(
261
-            'tree_id' => $this->tree->getTreeId(),
262
-            'user_id' => $this->user->getUserId()
263
-        ))->fetchAssoc();
264
-    }
265
-    
266
-    /**
267
-     * Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals.
268
-     *
269
-     * @param number $gen Generation
270
-     * @return array Array of Sosa individuals
271
-     */
272
-    public function getSosaListAtGeneration($gen){
273
-        if(!$this->is_setup) return array();
274
-        if(!$this->sosa_list_by_gen)
275
-            $this->sosa_list_by_gen = array();
246
+	/**
247
+	 * Return the list of all sosas, with the generations it belongs to
248
+	 *
249
+	 * @param int $ged_id ID of the gedcom file
250
+	 * @return array Associative array of Sosa ancestors, with their generation, comma separated
251
+	 */
252
+	public function getAllSosaWithGenerations(){
253
+		if(!$this->is_setup) return array();
254
+		return Database::prepare(
255
+			'SELECT majs_i_id AS indi,' .
256
+			' GROUP_CONCAT(DISTINCT majs_gen ORDER BY majs_gen ASC SEPARATOR ",") AS generations' .
257
+			' FROM `##maj_sosa`' .
258
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id' .
259
+			' GROUP BY majs_i_id'
260
+		)->execute(array(
261
+			'tree_id' => $this->tree->getTreeId(),
262
+			'user_id' => $this->user->getUserId()
263
+		))->fetchAssoc();
264
+	}
265
+    
266
+	/**
267
+	 * Get an associative array of Sosa individuals in generation G. Keys are Sosa numbers, values individuals.
268
+	 *
269
+	 * @param number $gen Generation
270
+	 * @return array Array of Sosa individuals
271
+	 */
272
+	public function getSosaListAtGeneration($gen){
273
+		if(!$this->is_setup) return array();
274
+		if(!$this->sosa_list_by_gen)
275
+			$this->sosa_list_by_gen = array();
276 276
         
277
-        if($gen){
278
-            if(!isset($this->sosa_list_by_gen[$gen])){
279
-                $this->sosa_list_by_gen[$gen] = Database::prepare(
280
-                    'SELECT majs_sosa AS sosa, majs_i_id AS indi'.
281
-                    ' FROM `##maj_sosa`'.
282
-                    ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
283
-                    ' AND majs_gen = :gen'.
284
-                    ' ORDER BY majs_sosa ASC')
285
-                ->execute(array(
286
-                    'tree_id' => $this->tree->getTreeId(),
287
-                    'user_id' => $this->user->getUserId(),
288
-                    'gen' => $gen
289
-                ))
290
-                ->fetchAssoc();
291
-            }
292
-            return $this->sosa_list_by_gen[$gen];
293
-        }
294
-        return array();
295
-    }
296
-    
297
-    /**
298
-     * Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families.
299
-     *
300
-     * @param number $gen Generation
301
-     * @return array Array of Sosa families
302
-     */
303
-    public function getFamilySosaListAtGeneration($gen){
304
-        if(!$this->is_setup) return array();
305
-        if(!$this->sosa_fam_list_by_gen)
306
-            $this->sosa_fam_list_by_gen = array();
277
+		if($gen){
278
+			if(!isset($this->sosa_list_by_gen[$gen])){
279
+				$this->sosa_list_by_gen[$gen] = Database::prepare(
280
+					'SELECT majs_sosa AS sosa, majs_i_id AS indi'.
281
+					' FROM `##maj_sosa`'.
282
+					' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
283
+					' AND majs_gen = :gen'.
284
+					' ORDER BY majs_sosa ASC')
285
+				->execute(array(
286
+					'tree_id' => $this->tree->getTreeId(),
287
+					'user_id' => $this->user->getUserId(),
288
+					'gen' => $gen
289
+				))
290
+				->fetchAssoc();
291
+			}
292
+			return $this->sosa_list_by_gen[$gen];
293
+		}
294
+		return array();
295
+	}
296
+    
297
+	/**
298
+	 * Get an associative array of Sosa families in generation G. Keys are Sosa numbers for the husband, values families.
299
+	 *
300
+	 * @param number $gen Generation
301
+	 * @return array Array of Sosa families
302
+	 */
303
+	public function getFamilySosaListAtGeneration($gen){
304
+		if(!$this->is_setup) return array();
305
+		if(!$this->sosa_fam_list_by_gen)
306
+			$this->sosa_fam_list_by_gen = array();
307 307
         
308
-        if($gen){
309
-            if(!isset($this->sosa_fam_list_by_gen[$gen])){
310
-                $this->sosa_fam_list_by_gen[$gen] = Database::prepare(
311
-                    'SELECT s1.majs_sosa AS sosa, f_id AS fam'.
312
-                    ' FROM `##families`'.
313
-                    ' INNER JOIN `##maj_sosa` AS s1 ON (`##families`.f_husb = s1.majs_i_id AND `##families`.f_file = s1.majs_gedcom_id)'.
314
-                    ' INNER JOIN `##maj_sosa` AS s2 ON (`##families`.f_wife = s2.majs_i_id AND `##families`.f_file = s2.majs_gedcom_id)'.
315
-                    ' WHERE s1.majs_sosa + 1 = s2.majs_sosa'.
316
-                    ' AND s1.majs_gedcom_id= :tree_id AND s1.majs_user_id=:user_id'.
317
-                    ' AND s2.majs_gedcom_id= :tree_id AND s2.majs_user_id=:user_id'.
318
-                    ' AND s1.majs_gen = :gen'.
319
-                    ' ORDER BY s1.majs_sosa ASC'
320
-                    )
321
-                    ->execute(array(
322
-                        'tree_id' => $this->tree->getTreeId(),
323
-                        'user_id' => $this->user->getUserId(),
324
-                        'gen' => $gen
325
-                    ))
326
-                    ->fetchAssoc();
327
-            }
328
-            return $this->sosa_fam_list_by_gen[$gen];
329
-        }
330
-        return array();
331
-    }
332
-    
333
-    /**
334
-     * Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals.
335
-     *
336
-     * @param number $gen Generation
337
-     * @return array Array of Sosa individuals
338
-     */
339
-    public function getMissingSosaListAtGeneration($gen){
340
-        if(!$this->is_setup) return array();    
341
-        if($gen){
342
-            return $this->sosa_list_by_gen[$gen] = Database::prepare(
343
-                'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'.
344
-                ' FROM `##maj_sosa` schild'.
345
-                ' LEFT JOIN `##maj_sosa` sfat ON ((schild.majs_sosa * 2) = sfat.majs_sosa AND schild.majs_gedcom_id = sfat.majs_gedcom_id AND schild.majs_user_id = sfat.majs_user_id)'.
346
-                ' LEFT JOIN `##maj_sosa` smot ON ((schild.majs_sosa * 2 + 1) = smot.majs_sosa AND schild.majs_gedcom_id = smot.majs_gedcom_id AND schild.majs_user_id = smot.majs_user_id)'.
347
-                ' WHERE schild.majs_gedcom_id = :tree_id AND schild.majs_user_id = :user_id'.
348
-                ' AND schild.majs_gen = :gen'.
349
-                ' AND (sfat.majs_sosa IS NULL OR smot.majs_sosa IS NULL)'.
350
-                ' ORDER BY schild.majs_sosa ASC')
351
-                ->execute(array(
352
-                    'tree_id' => $this->tree->getTreeId(),
353
-                    'user_id' => $this->user->getUserId(),
354
-                    'gen' => $gen - 1
355
-                ))->fetchAll(\PDO::FETCH_ASSOC);
356
-        }
357
-        return array();
358
-    }
359
-    
360
-    
361
-    
362
-    /*************
308
+		if($gen){
309
+			if(!isset($this->sosa_fam_list_by_gen[$gen])){
310
+				$this->sosa_fam_list_by_gen[$gen] = Database::prepare(
311
+					'SELECT s1.majs_sosa AS sosa, f_id AS fam'.
312
+					' FROM `##families`'.
313
+					' INNER JOIN `##maj_sosa` AS s1 ON (`##families`.f_husb = s1.majs_i_id AND `##families`.f_file = s1.majs_gedcom_id)'.
314
+					' INNER JOIN `##maj_sosa` AS s2 ON (`##families`.f_wife = s2.majs_i_id AND `##families`.f_file = s2.majs_gedcom_id)'.
315
+					' WHERE s1.majs_sosa + 1 = s2.majs_sosa'.
316
+					' AND s1.majs_gedcom_id= :tree_id AND s1.majs_user_id=:user_id'.
317
+					' AND s2.majs_gedcom_id= :tree_id AND s2.majs_user_id=:user_id'.
318
+					' AND s1.majs_gen = :gen'.
319
+					' ORDER BY s1.majs_sosa ASC'
320
+					)
321
+					->execute(array(
322
+						'tree_id' => $this->tree->getTreeId(),
323
+						'user_id' => $this->user->getUserId(),
324
+						'gen' => $gen
325
+					))
326
+					->fetchAssoc();
327
+			}
328
+			return $this->sosa_fam_list_by_gen[$gen];
329
+		}
330
+		return array();
331
+	}
332
+    
333
+	/**
334
+	 * Get an associative array of Sosa individuals in generation G who are missing parents. Keys are Sosa numbers, values individuals.
335
+	 *
336
+	 * @param number $gen Generation
337
+	 * @return array Array of Sosa individuals
338
+	 */
339
+	public function getMissingSosaListAtGeneration($gen){
340
+		if(!$this->is_setup) return array();    
341
+		if($gen){
342
+			return $this->sosa_list_by_gen[$gen] = Database::prepare(
343
+				'SELECT schild.majs_sosa sosa, schild.majs_i_id indi, sfat.majs_sosa IS NOT NULL has_father, smot.majs_sosa IS NOT NULL has_mother'.
344
+				' FROM `##maj_sosa` schild'.
345
+				' LEFT JOIN `##maj_sosa` sfat ON ((schild.majs_sosa * 2) = sfat.majs_sosa AND schild.majs_gedcom_id = sfat.majs_gedcom_id AND schild.majs_user_id = sfat.majs_user_id)'.
346
+				' LEFT JOIN `##maj_sosa` smot ON ((schild.majs_sosa * 2 + 1) = smot.majs_sosa AND schild.majs_gedcom_id = smot.majs_gedcom_id AND schild.majs_user_id = smot.majs_user_id)'.
347
+				' WHERE schild.majs_gedcom_id = :tree_id AND schild.majs_user_id = :user_id'.
348
+				' AND schild.majs_gen = :gen'.
349
+				' AND (sfat.majs_sosa IS NULL OR smot.majs_sosa IS NULL)'.
350
+				' ORDER BY schild.majs_sosa ASC')
351
+				->execute(array(
352
+					'tree_id' => $this->tree->getTreeId(),
353
+					'user_id' => $this->user->getUserId(),
354
+					'gen' => $gen - 1
355
+				))->fetchAll(\PDO::FETCH_ASSOC);
356
+		}
357
+		return array();
358
+	}
359
+    
360
+    
361
+    
362
+	/*************
363 363
      * STATISTICS
364 364
      *************/
365
-    /**
366
-     * Get the statistic array detailed by generation.
367
-     * Statistics for each generation are:
368
-     * 	- The number of Sosa in generation
369
-     * 	- The number of Sosa up to generation
370
-     *  - The number of distinct Sosa up to generation
371
-     *  - The year of the first birth in generation
372
-     *  - The year of the last birth in generation
373
-     *  - The average year of birth in generation
374
-     *
375
-     * @return array Statistics array
376
-     */
377
-    public function getStatisticsByGeneration() {
378
-        if(!$this->is_setup) return array();
379
-        if(!$this->statistics_tab) {
380
-            $this->statistics_tab = array();
381
-            if($maxGeneration = $this->getLastGeneration()) {
382
-                for ($gen = 1; $gen <= $maxGeneration; $gen++) {
383
-                    $birthStats = $this->getStatsBirthYearInGeneration($gen);
384
-                    $this->statistics_tab[$gen] = array(
385
-                        'sosaCount'				=>	$this->getSosaCountAtGeneration($gen),
386
-                        'sosaTotalCount'		=>	$this->getSosaCountUpToGeneration($gen),
387
-                        'diffSosaTotalCount'	=>	$this->getDifferentSosaCountUpToGeneration($gen),
388
-                        'firstBirth'			=>	$birthStats['first'],
389
-                        'lastBirth'				=>	$birthStats['last'],
390
-                        'avgBirth'				=>	$birthStats['avg']
391
-                    );
392
-                }
393
-            }
394
-        }
395
-        return $this->statistics_tab;        
396
-    }
365
+	/**
366
+	 * Get the statistic array detailed by generation.
367
+	 * Statistics for each generation are:
368
+	 * 	- The number of Sosa in generation
369
+	 * 	- The number of Sosa up to generation
370
+	 *  - The number of distinct Sosa up to generation
371
+	 *  - The year of the first birth in generation
372
+	 *  - The year of the last birth in generation
373
+	 *  - The average year of birth in generation
374
+	 *
375
+	 * @return array Statistics array
376
+	 */
377
+	public function getStatisticsByGeneration() {
378
+		if(!$this->is_setup) return array();
379
+		if(!$this->statistics_tab) {
380
+			$this->statistics_tab = array();
381
+			if($maxGeneration = $this->getLastGeneration()) {
382
+				for ($gen = 1; $gen <= $maxGeneration; $gen++) {
383
+					$birthStats = $this->getStatsBirthYearInGeneration($gen);
384
+					$this->statistics_tab[$gen] = array(
385
+						'sosaCount'				=>	$this->getSosaCountAtGeneration($gen),
386
+						'sosaTotalCount'		=>	$this->getSosaCountUpToGeneration($gen),
387
+						'diffSosaTotalCount'	=>	$this->getDifferentSosaCountUpToGeneration($gen),
388
+						'firstBirth'			=>	$birthStats['first'],
389
+						'lastBirth'				=>	$birthStats['last'],
390
+						'avgBirth'				=>	$birthStats['avg']
391
+					);
392
+				}
393
+			}
394
+		}
395
+		return $this->statistics_tab;        
396
+	}
397 397
     
398 398
 	/**
399 399
 	 * How many individuals exist in the tree.
@@ -401,205 +401,205 @@  discard block
 block discarded – undo
401 401
 	 * @return int
402 402
 	 */
403 403
 	public function getTotalIndividuals() {
404
-	    if(!$this->is_setup) return 0;
405
-	    return Database::prepare(
406
-	        'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' .
407
-	        ' WHERE i_file = :tree_id')
408
-	        ->execute(array('tree_id' => $this->tree->getTreeId()))
409
-	        ->fetchOne() ?: 0;
404
+		if(!$this->is_setup) return 0;
405
+		return Database::prepare(
406
+			'SELECT SQL_CACHE COUNT(*) FROM `##individuals`' .
407
+			' WHERE i_file = :tree_id')
408
+			->execute(array('tree_id' => $this->tree->getTreeId()))
409
+			->fetchOne() ?: 0;
410 410
 	}
411 411
     
412
-    /**
413
-     * Get the total Sosa count for all generations
414
-     *
415
-     * @return number Number of Sosas
416
-     */
417
-    public function getSosaCount(){
418
-        if(!$this->is_setup) return 0;
419
-        return Database::prepare(
420
-            'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
421
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
422
-            ->execute(array(
423
-                'tree_id' => $this->tree->getTreeId(), 
424
-                'user_id' => $this->user->getUserId() 
425
-            ))->fetchOne() ?: 0;
426
-    }
427
-    
428
-    /**
429
-     * Get the number of Sosa in a specific generation.
430
-     *
431
-     * @param number $gen Generation
432
-     * @return number Number of Sosas in generation
433
-     */
434
-    public function getSosaCountAtGeneration($gen){
435
-        if(!$this->is_setup) return 0;
436
-        return Database::prepare(
437
-            'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
438
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
439
-            ' AND majs_gen= :gen')
440
-        ->execute(array(
441
-                'tree_id' => $this->tree->getTreeId(), 
442
-                'user_id' => $this->user->getUserId(),
443
-                'gen' => $gen            
444
-        ))->fetchOne() ?: 0;
445
-    }
446
-    
447
-    /**
448
-     * Get the total number of Sosa up to a specific generation.
449
-     *
450
-     * @param number $gen Generation
451
-     * @return number Total number of Sosas up to generation
452
-     */
453
-    public function getSosaCountUpToGeneration($gen){
454
-        if(!$this->is_setup) return 0;
455
-        return Database::prepare(
456
-            'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
457
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
458
-            ' AND majs_gen <= :gen')
459
-        ->execute(array(
460
-                'tree_id' => $this->tree->getTreeId(), 
461
-                'user_id' => $this->user->getUserId(),
462
-                'gen' => $gen 
463
-        ))->fetchOne() ?: 0;
464
-    }
465
-    
466
-    /**
467
-     * Get the total number of distinct Sosa individual for all generations.
468
-     *
469
-     * @return number Total number of distinct individual
470
-     */
471
-    public function getDifferentSosaCount(){
472
-        if(!$this->is_setup) return 0;
473
-        return Database::prepare(
474
-            'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
475
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
476
-        ->execute(array(
477
-                'tree_id' => $this->tree->getTreeId(), 
478
-                'user_id' => $this->user->getUserId()
479
-        ))->fetchOne() ?: 0;
480
-    }
481
-    
482
-    /**
483
-     * Get the number of distinct Sosa individual up to a specific generation.
484
-     *
485
-     * @param number $gen Generation
486
-     * @return number Number of distinct Sosa individuals up to generation
487
-     */
488
-    public function getDifferentSosaCountUpToGeneration($gen){
489
-        if(!$this->is_setup) return 0;
490
-        return Database::prepare(
491
-            'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
492
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
493
-            ' AND majs_gen <= :gen')
494
-        ->execute(array(
495
-                'tree_id' => $this->tree->getTreeId(), 
496
-                'user_id' => $this->user->getUserId(),
497
-                'gen' => $gen 
498
-        ))->fetchOne() ?: 0;
499
-    }
500
-    
501
-    /**
502
-     * Get an array of birth statistics for a specific generation
503
-     * Statistics are :
504
-     * 	- first : First birth year in generation
505
-     *  - last : Last birth year in generation
506
-     *  - avg : Average birth year
507
-     *
508
-     * @param number $gen Generation
509
-     * @return array Birth statistics array
510
-     */
511
-    public function getStatsBirthYearInGeneration($gen){
512
-        if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0);
513
-        return Database::prepare(
514
-            'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'.
515
-            ' FROM `##maj_sosa`' .
516
-            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
517
-            ' AND majs_gen=:gen AND NOT majs_birth_year = :birth_year')
518
-            ->execute(array(
519
-                'tree_id' => $this->tree->getTreeId(), 
520
-                'user_id' => $this->user->getUserId(),
521
-                'gen' => $gen,
522
-                'birth_year' => 0))
523
-            ->fetchOneRow(\PDO::FETCH_ASSOC) ?: array('first' => 0, 'avg' => 0, 'last' => 0);
524
-    }
525
-    
526
-    /**
527
-     * Get the mean generation time, based on a linear regression of birth years and generations
528
-     *
529
-     * @return number|NULL Mean generation time
530
-     */
531
-    public function getMeanGenerationTime(){
532
-        if(!$this->is_setup) return;
533
-        if(!$this->statistics_tab){
534
-            $this->getStatisticsByGeneration();
535
-        }
536
-        //Linear regression on x=generation and y=birthdate
537
-        $sum_xy = 0;
538
-        $sum_x=0;
539
-        $sum_y=0;
540
-        $sum_x2=0;
541
-        $n=count($this->statistics_tab);
542
-        foreach($this->statistics_tab as $gen=>$stats){
543
-            $sum_xy+=$gen*$stats['avgBirth'];
544
-            $sum_x+=$gen;
545
-            $sum_y+=$stats['avgBirth'];
546
-            $sum_x2+=$gen*$gen;
547
-        }
548
-        $denom=($n*$sum_x2)-($sum_x*$sum_x);
549
-        if($denom!=0){
550
-            return -(($n*$sum_xy)-($sum_x*$sum_y))/($denom);
551
-        }
552
-        return null;
553
-    }
554
-    
555
-    /**
556
-     * Return a computed array of statistics about the dispersion of ancestors across the ancestors
557
-     * at a specified generation.
558
-     * This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL
559
-     * 
560
-     * Format: 
561
-     *  - key : a base-2 representation of the ancestor at generation G for which exclusive ancestors have been found,
562
-     *          -1 is used for shared ancestors
563
-     *          For instance base2(0100) = base10(4) represent the maternal grand father
564
-     *  - values: number of ancestors exclusively in the ancestors of the ancestor in key
565
-     *  
566
-     *  For instance a result at generation 3 could be :
567
-     *      array (   -1        =>  12      -> 12 ancestors are shared by the grand-parents
568
-     *                base10(1) =>  32      -> 32 ancestors are exclusive to the paternal grand-father
569
-     *                base10(2) =>  25      -> 25 ancestors are exclusive to the paternal grand-mother
570
-     *                base10(4) =>  12      -> 12 ancestors are exclusive to the maternal grand-father
571
-     *                base10(8) =>  30      -> 30 ancestors are exclusive to the maternal grand-mother
572
-     *            )
573
-     *  
574
-     * @param int $gen Reference generation
575
-     * @return array
576
-     */
577
-    public function getAncestorDispersionForGen($gen) {
578
-        if(!$this->is_setup || $gen > 11) return array();  // Going further than 11 gen will be out of range in the query
579
-        return Database::prepare(
580
-            'SELECT branches, count(i_id)'.
581
-            ' FROM ('.
582
-            '   SELECT i_id,'.
583
-            '       CASE'.
584
-            '           WHEN CEIL(LOG2(SUM(branch))) = LOG2(SUM(branch)) THEN SUM(branch)'.
585
-            '           ELSE -1'.   // We put all ancestors shared between some branches in the same bucket
586
-            '       END branches'.
587
-            '   FROM ('.
588
-            '       SELECT DISTINCT majs_i_id i_id,'.
589
-            '           POW(2, FLOOR(majs_sosa / POW(2, (majs_gen - :gen))) - POW(2, :gen -1)) branch'.
590
-            '       FROM `##maj_sosa`'.
591
-            '       WHERE majs_gedcom_id = :tree_id AND majs_user_id = :user_id'.
592
-            '           AND majs_gen >= :gen'.
593
-            '   ) indistat'.
594
-            '   GROUP BY i_id'.
595
-            ') grouped'.
596
-            ' GROUP BY branches')
597
-            ->execute(array(
598
-                'tree_id' => $this->tree->getTreeId(), 
599
-                'user_id' => $this->user->getUserId(),
600
-                'gen' => $gen
601
-            ))->fetchAssoc() ?: array();
602
-    }
412
+	/**
413
+	 * Get the total Sosa count for all generations
414
+	 *
415
+	 * @return number Number of Sosas
416
+	 */
417
+	public function getSosaCount(){
418
+		if(!$this->is_setup) return 0;
419
+		return Database::prepare(
420
+			'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
421
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
422
+			->execute(array(
423
+				'tree_id' => $this->tree->getTreeId(), 
424
+				'user_id' => $this->user->getUserId() 
425
+			))->fetchOne() ?: 0;
426
+	}
427
+    
428
+	/**
429
+	 * Get the number of Sosa in a specific generation.
430
+	 *
431
+	 * @param number $gen Generation
432
+	 * @return number Number of Sosas in generation
433
+	 */
434
+	public function getSosaCountAtGeneration($gen){
435
+		if(!$this->is_setup) return 0;
436
+		return Database::prepare(
437
+			'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
438
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
439
+			' AND majs_gen= :gen')
440
+		->execute(array(
441
+				'tree_id' => $this->tree->getTreeId(), 
442
+				'user_id' => $this->user->getUserId(),
443
+				'gen' => $gen            
444
+		))->fetchOne() ?: 0;
445
+	}
446
+    
447
+	/**
448
+	 * Get the total number of Sosa up to a specific generation.
449
+	 *
450
+	 * @param number $gen Generation
451
+	 * @return number Total number of Sosas up to generation
452
+	 */
453
+	public function getSosaCountUpToGeneration($gen){
454
+		if(!$this->is_setup) return 0;
455
+		return Database::prepare(
456
+			'SELECT SQL_CACHE COUNT(majs_sosa) FROM `##maj_sosa`' .
457
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
458
+			' AND majs_gen <= :gen')
459
+		->execute(array(
460
+				'tree_id' => $this->tree->getTreeId(), 
461
+				'user_id' => $this->user->getUserId(),
462
+				'gen' => $gen 
463
+		))->fetchOne() ?: 0;
464
+	}
465
+    
466
+	/**
467
+	 * Get the total number of distinct Sosa individual for all generations.
468
+	 *
469
+	 * @return number Total number of distinct individual
470
+	 */
471
+	public function getDifferentSosaCount(){
472
+		if(!$this->is_setup) return 0;
473
+		return Database::prepare(
474
+			'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
475
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
476
+		->execute(array(
477
+				'tree_id' => $this->tree->getTreeId(), 
478
+				'user_id' => $this->user->getUserId()
479
+		))->fetchOne() ?: 0;
480
+	}
481
+    
482
+	/**
483
+	 * Get the number of distinct Sosa individual up to a specific generation.
484
+	 *
485
+	 * @param number $gen Generation
486
+	 * @return number Number of distinct Sosa individuals up to generation
487
+	 */
488
+	public function getDifferentSosaCountUpToGeneration($gen){
489
+		if(!$this->is_setup) return 0;
490
+		return Database::prepare(
491
+			'SELECT SQL_CACHE COUNT(DISTINCT majs_i_id) FROM `##maj_sosa`' .
492
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
493
+			' AND majs_gen <= :gen')
494
+		->execute(array(
495
+				'tree_id' => $this->tree->getTreeId(), 
496
+				'user_id' => $this->user->getUserId(),
497
+				'gen' => $gen 
498
+		))->fetchOne() ?: 0;
499
+	}
500
+    
501
+	/**
502
+	 * Get an array of birth statistics for a specific generation
503
+	 * Statistics are :
504
+	 * 	- first : First birth year in generation
505
+	 *  - last : Last birth year in generation
506
+	 *  - avg : Average birth year
507
+	 *
508
+	 * @param number $gen Generation
509
+	 * @return array Birth statistics array
510
+	 */
511
+	public function getStatsBirthYearInGeneration($gen){
512
+		if(!$this->is_setup) return array('first' => 0, 'avg' => 0, 'last' => 0);
513
+		return Database::prepare(
514
+			'SELECT MIN(majs_birth_year) AS first, AVG(majs_birth_year) AS avg, MAX(majs_birth_year) AS last'.
515
+			' FROM `##maj_sosa`' .
516
+			' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id'.
517
+			' AND majs_gen=:gen AND NOT majs_birth_year = :birth_year')
518
+			->execute(array(
519
+				'tree_id' => $this->tree->getTreeId(), 
520
+				'user_id' => $this->user->getUserId(),
521
+				'gen' => $gen,
522
+				'birth_year' => 0))
523
+			->fetchOneRow(\PDO::FETCH_ASSOC) ?: array('first' => 0, 'avg' => 0, 'last' => 0);
524
+	}
525
+    
526
+	/**
527
+	 * Get the mean generation time, based on a linear regression of birth years and generations
528
+	 *
529
+	 * @return number|NULL Mean generation time
530
+	 */
531
+	public function getMeanGenerationTime(){
532
+		if(!$this->is_setup) return;
533
+		if(!$this->statistics_tab){
534
+			$this->getStatisticsByGeneration();
535
+		}
536
+		//Linear regression on x=generation and y=birthdate
537
+		$sum_xy = 0;
538
+		$sum_x=0;
539
+		$sum_y=0;
540
+		$sum_x2=0;
541
+		$n=count($this->statistics_tab);
542
+		foreach($this->statistics_tab as $gen=>$stats){
543
+			$sum_xy+=$gen*$stats['avgBirth'];
544
+			$sum_x+=$gen;
545
+			$sum_y+=$stats['avgBirth'];
546
+			$sum_x2+=$gen*$gen;
547
+		}
548
+		$denom=($n*$sum_x2)-($sum_x*$sum_x);
549
+		if($denom!=0){
550
+			return -(($n*$sum_xy)-($sum_x*$sum_y))/($denom);
551
+		}
552
+		return null;
553
+	}
554
+    
555
+	/**
556
+	 * Return a computed array of statistics about the dispersion of ancestors across the ancestors
557
+	 * at a specified generation.
558
+	 * This statistics cannot be used for generations above 11, as it would cause a out of range in MySQL
559
+	 * 
560
+	 * Format: 
561
+	 *  - key : a base-2 representation of the ancestor at generation G for which exclusive ancestors have been found,
562
+	 *          -1 is used for shared ancestors
563
+	 *          For instance base2(0100) = base10(4) represent the maternal grand father
564
+	 *  - values: number of ancestors exclusively in the ancestors of the ancestor in key
565
+	 *  
566
+	 *  For instance a result at generation 3 could be :
567
+	 *      array (   -1        =>  12      -> 12 ancestors are shared by the grand-parents
568
+	 *                base10(1) =>  32      -> 32 ancestors are exclusive to the paternal grand-father
569
+	 *                base10(2) =>  25      -> 25 ancestors are exclusive to the paternal grand-mother
570
+	 *                base10(4) =>  12      -> 12 ancestors are exclusive to the maternal grand-father
571
+	 *                base10(8) =>  30      -> 30 ancestors are exclusive to the maternal grand-mother
572
+	 *            )
573
+	 *  
574
+	 * @param int $gen Reference generation
575
+	 * @return array
576
+	 */
577
+	public function getAncestorDispersionForGen($gen) {
578
+		if(!$this->is_setup || $gen > 11) return array();  // Going further than 11 gen will be out of range in the query
579
+		return Database::prepare(
580
+			'SELECT branches, count(i_id)'.
581
+			' FROM ('.
582
+			'   SELECT i_id,'.
583
+			'       CASE'.
584
+			'           WHEN CEIL(LOG2(SUM(branch))) = LOG2(SUM(branch)) THEN SUM(branch)'.
585
+			'           ELSE -1'.   // We put all ancestors shared between some branches in the same bucket
586
+			'       END branches'.
587
+			'   FROM ('.
588
+			'       SELECT DISTINCT majs_i_id i_id,'.
589
+			'           POW(2, FLOOR(majs_sosa / POW(2, (majs_gen - :gen))) - POW(2, :gen -1)) branch'.
590
+			'       FROM `##maj_sosa`'.
591
+			'       WHERE majs_gedcom_id = :tree_id AND majs_user_id = :user_id'.
592
+			'           AND majs_gen >= :gen'.
593
+			'   ) indistat'.
594
+			'   GROUP BY i_id'.
595
+			') grouped'.
596
+			' GROUP BY branches')
597
+			->execute(array(
598
+				'tree_id' => $this->tree->getTreeId(), 
599
+				'user_id' => $this->user->getUserId(),
600
+				'gen' => $gen
601
+			))->fetchAssoc() ?: array();
602
+	}
603 603
     
604 604
                
605 605
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Schema/Migration0.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,18 +22,18 @@
 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' .			
36
-		    ') COLLATE utf8_unicode_ci ENGINE=InnoDB'
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
+			') COLLATE utf8_unicode_ci ENGINE=InnoDB'
37 37
 		);
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListView.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 	 * {@inhericDoc}
24 24
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
25 25
 	 */
26
-    protected function renderContent() {      
27
-        ?>                
26
+	protected function renderContent() {      
27
+		?>                
28 28
         <div id="maj-sosa-list-page" class="center">
29 29
 			<h2><?php echo $this->data->get('title'); ?></h2>
30 30
 			
31 31
 			<?php  if($this->data->get('is_setup')) { 
32
-			    $selectedgen = $this->data->get('generation');
33
-			    $this->renderSosaHeader();
34
-			    if($this->data->get('has_sosa') ) {
35
-			         if($selectedgen > 0) {
36
-			        ?>
32
+				$selectedgen = $this->data->get('generation');
33
+				$this->renderSosaHeader();
34
+				if($this->data->get('has_sosa') ) {
35
+					 if($selectedgen > 0) {
36
+					?>
37 37
 			<div id="sosalist-tabs">
38 38
 				<ul>
39 39
 					<li><a href="#sosalist-indi"><?php echo I18N::translate('Individuals'); ?></a></li>
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			<?php        } else { ?>
54 54
 			<p class="warning"><?php echo I18N::translate('No ancestor has been found for generation %d', $selectedgen); ?></p>
55 55
 			<?php    }
56
-			    }
56
+				}
57 57
 			} else { ?>
58 58
 			<p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/>
59 59
 				<ul>
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 			<?php } ?>
65 65
 		</div> 
66 66
 		<?php 
67
-    }
67
+	}
68 68
     
69
-    /**
70
-     * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator
71
-     */
72
-    protected function renderSosaHeader() {
73
-        $selectedgen = $this->data->get('generation');
74
-        $max_gen = $this->data->get('max_gen');
75
-        ?>
69
+	/**
70
+	 * Render the common header to Sosa Lists, made of the generation selector, and the generation navigator
71
+	 */
72
+	protected function renderSosaHeader() {
73
+		$selectedgen = $this->data->get('generation');
74
+		$max_gen = $this->data->get('max_gen');
75
+		?>
76 76
         
77 77
     	<form method="get" name="setgen" action="module.php">
78 78
 			<input type="hidden" name="mod" value="<?php echo $this->data->get('url_module');?>">
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		
118 118
 		<?php 
119 119
 		}
120
-    }       
120
+	}       
121 121
     
122 122
 }
123 123
  
124 124
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaConfigView.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	 * {@inhericDoc}
26 26
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
27 27
 	 */
28
-    protected function renderContent() {
28
+	protected function renderContent() {
29 29
         
30
-        ?>        
30
+		?>        
31 31
         
32 32
         <div id="maj-sosa-config-page">
33 33
 			<h2><?php echo $this->data->get('title'); ?></h2>
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
         			</div>
48 48
         			<div class="value">
49 49
         				<?php 
50
-        				    $users = $this->data->get('users_settings');
51
-        				    if(count($users) == 1) {
52
-        				?>
50
+							$users = $this->data->get('users_settings');
51
+							if(count($users) == 1) {
52
+						?>
53 53
         					<label>
54 54
         						<input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?>" />
55 55
         						<?php echo $users[0]['user']->getRealNameHtml() ?>
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         				<?php  } else if(count($users) > 1) { ?>
58 58
         					<select id='maj-sosa-config-select' name="userid">
59 59
         					<?php 
60
-        					$root_indi = $users[0]['rootid'];
61
-        					foreach ($this->data->get('users_settings') as $user) { ?>
60
+							$root_indi = $users[0]['rootid'];
61
+							foreach ($this->data->get('users_settings') as $user) { ?>
62 62
         						<option value="<?php echo $user['user']->getUserId(); ?>"><?php echo $user['user']->getRealNameHtml() ?></option>
63 63
         					<?php  } ?>
64 64
         					</select>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 			</form>	
82 82
 		
83 83
 		<?php        
84
-    }
84
+	}
85 85
     
86 86
 }
87 87
  
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListIndiView.php 1 patch
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	 * {@inhericDoc}
32 32
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
33 33
 	 */
34
-    protected function renderContent() { 
34
+	protected function renderContent() { 
35 35
         
36
-        if($this->data->get('has_sosa', false)) {
37
-            $table_id = $this->data->get('table_id');            
38
-        ?>   
36
+		if($this->data->get('has_sosa', false)) {
37
+			$table_id = $this->data->get('table_id');            
38
+		?>   
39 39
         
40 40
         <div id="sosa-indi-list" class="sosa-list">
41 41
         	<table id="<?php echo $table_id;?>">
@@ -186,42 +186,42 @@  discard block
 block discarded – undo
186 186
 			<tbody>
187 187
 			
188 188
 			<?php foreach($this->data->get('sosa_list') as $sosa => $person) {
189
-			    /** @var \Fisharebest\Webtrees\Individual $person */
190
-			    if ($person->isPendingAddtion()) {
191
-			        $class = ' class="new"';
192
-			    } elseif ($person->isPendingDeletion()) {
193
-			        $class = ' class="old"';
194
-			    } else {
195
-			        $class = '';
196
-			    }
197
-			    $dperson = new \MyArtJaub\Webtrees\Individual($person);
198
-			    ?>			
189
+				/** @var \Fisharebest\Webtrees\Individual $person */
190
+				if ($person->isPendingAddtion()) {
191
+					$class = ' class="new"';
192
+				} elseif ($person->isPendingDeletion()) {
193
+					$class = ' class="old"';
194
+				} else {
195
+					$class = '';
196
+				}
197
+				$dperson = new \MyArtJaub\Webtrees\Individual($person);
198
+				?>			
199 199
         		<tr <?php echo $class?>>
200 200
         			<td class="transparent"><?php echo $sosa; ?></td>
201 201
         			<td class="transparent"><?php echo $person->getXref(); ?></td>
202 202
         			<td colspan="2">
203 203
         			<?php foreach ($person->getAllNames() as $num=>$name) {
204
-        				if ($name['type']=='NAME') {
205
-        					$title='';
206
-        				} else {
207
-        					$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"';
208
-        				}
209
-        				if ($num==$person->getPrimaryName()) {
210
-        					$class=' class="name2"';
211
-        					$sex_image=$person->getSexImage();
212
-        					list($surn, $givn)=explode(',', $name['sort']);
213
-        				} else {
214
-        					$class='';
215
-        					$sex_image='';
216
-        				} ?>
204
+						if ($name['type']=='NAME') {
205
+							$title='';
206
+						} else {
207
+							$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"';
208
+						}
209
+						if ($num==$person->getPrimaryName()) {
210
+							$class=' class="name2"';
211
+							$sex_image=$person->getSexImage();
212
+							list($surn, $givn)=explode(',', $name['sort']);
213
+						} else {
214
+							$class='';
215
+							$sex_image='';
216
+						} ?>
217 217
         				<a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>">
218 218
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?>
219 219
         				</a>
220 220
         				<?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller'); ?>
221 221
         				<br/>
222 222
             		<?php }
223
-            		echo $person->getPrimaryParentsNames('parents details1', 'none');
224
-            		?>
223
+					echo $person->getPrimaryParentsNames('parents details1', 'none');
224
+					?>
225 225
             		</td>
226 226
             		<td style="display:none;"></td>
227 227
             		<td>
@@ -232,34 +232,34 @@  discard block
 block discarded – undo
232 232
             		</td>
233 233
             		<td>
234 234
             		<?php 
235
-            		if ($birth_dates=$person->getAllBirthDates()) {
236
-			            foreach ($birth_dates as $num=>$birth_date) {
237
-    					   if ($num) { ?><br/><?php } ?>
235
+					if ($birth_dates=$person->getAllBirthDates()) {
236
+						foreach ($birth_dates as $num=>$birth_date) {
237
+						   if ($num) { ?><br/><?php } ?>
238 238
     						<?php  echo $birth_date->display(true);
239
-			            }
240
-            		} else {
241
-            		    $birth_date=$person->getEstimatedBirthDate();
242
-            		    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
243
-            		        $birth_date->display(true);
244
-            		    } else {
245
-            		        echo '&nbsp;';
246
-            		    }
247
-            		    $birth_dates[0] = new Date('');
248
-            		}
249
-            		?>
239
+						}
240
+					} else {
241
+						$birth_date=$person->getEstimatedBirthDate();
242
+						if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
243
+							$birth_date->display(true);
244
+						} else {
245
+							echo '&nbsp;';
246
+						}
247
+						$birth_dates[0] = new Date('');
248
+					}
249
+					?>
250 250
             		</td>
251 251
             		<td><?php echo $birth_date->julianDay();?></td>
252 252
         			<td>
253 253
         			<?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) {
254
-				        $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
255
-        				if ($n) { ?><br><?php } ?>
254
+						$tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
255
+						if ($n) { ?><br><?php } ?>
256 256
         				<a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>">
257 257
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?>
258 258
         				</a>
259 259
         			<?php } ?>
260 260
         			</td>
261 261
         			<?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
262
-				        $isBSourced = $dperson->isBirthSourced(); ?>
262
+						$isBSourced = $dperson->isBirthSourced(); ?>
263 263
 				   	<td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td>
264 264
 					<td><?php echo $isBSourced; ?></td>
265 265
 					<?php } else { ?>
@@ -269,36 +269,36 @@  discard block
 block discarded – undo
269 269
 					<td>
270 270
 					<?php 
271 271
 					if ($death_dates = $person->getAllDeathDates()) {
272
-				        foreach ($death_dates as $num => $death_date) {
273
-					       if ($num) { ?><br/><?php } ?>
272
+						foreach ($death_dates as $num => $death_date) {
273
+						   if ($num) { ?><br/><?php } ?>
274 274
 					 		<?php echo $death_date->display(true); 
275
-				        }
276
-			         } else {
277
-				        $death_date = $person->getEstimatedDeathDate();
278
-				        if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) {
279
-					       echo $death_date->display(true);
280
-        				} elseif ($person->isDead()) {
281
-        					echo I18N::translate('yes');
282
-        				} else {
283
-        					echo '&nbsp;';
284
-        				}
285
-                        $death_dates[0] = new Date('');
286
-			         } ?>
275
+						}
276
+					 } else {
277
+						$death_date = $person->getEstimatedDeathDate();
278
+						if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) {
279
+						   echo $death_date->display(true);
280
+						} elseif ($person->isDead()) {
281
+							echo I18N::translate('yes');
282
+						} else {
283
+							echo '&nbsp;';
284
+						}
285
+						$death_dates[0] = new Date('');
286
+					 } ?>
287 287
 			         </td>
288 288
 			         <td><?php echo $death_date->julianDay(); ?></td>
289 289
 			         <td><?php echo Date::getAge($birth_dates[0], $death_dates[0], 2); ?></td>
290 290
 			         <td><?php echo Date::getAge($birth_dates[0], $death_dates[0], 1); ?></td>
291 291
 			         <td>
292 292
         			 <?php foreach ($person->getAllDeathPlaces() as $n => $death_place) {
293
-        				$tmp = new Place($death_place, $person->getTree());
294
-        				if ($n) { ?><br><?php } ?>
293
+						$tmp = new Place($death_place, $person->getTree());
294
+						if ($n) { ?><br><?php } ?>
295 295
         				<a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>">
296 296
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?>
297 297
         				</a>
298 298
         			<?php } ?>
299 299
         			</td>
300 300
         			<?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
301
-				        $isDSourced = $dperson->isDeathSourced(); ?>
301
+						$isDSourced = $dperson->isDeathSourced(); ?>
302 302
 				   	<td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium'); ?></td>
303 303
 					<td><?php echo $isDSourced; ?></td>
304 304
 					<?php } else { ?>
@@ -308,29 +308,29 @@  discard block
 block discarded – undo
308 308
 					<td><?php  echo $person->getSex(); ?></td>
309 309
 					<td>
310 310
 					<?php if (!$person->canShow() || Date::compare($birth_date, new Date(date('Y') - 100)) > 0) {
311
-					    echo 'Y100';
312
-        			} else {
313
-        				echo 'YES';
314
-        			} ?>
311
+						echo 'Y100';
312
+					} else {
313
+						echo 'YES';
314
+					} ?>
315 315
         			</td>
316 316
         			<td>
317 317
         			<?php if (Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) {
318
-				        echo 'Y100';
319
-        			} elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) {
320
-				        echo 'YES';
321
-        			} else {
322
-				        echo 'N';
323
-			         } ?>
318
+						echo 'Y100';
319
+					} elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) {
320
+						echo 'YES';
321
+					} else {
322
+						echo 'N';
323
+					 } ?>
324 324
 			         </td>
325 325
 			         <td>
326 326
 					<?php if (!$person->getChildFamilies()) {
327
-					    echo 'R';
327
+						echo 'R';
328 328
 					}  // roots
329 329
 					elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) {
330
-            			echo 'L';
330
+						echo 'L';
331 331
 					} // leaves
332 332
 					else {
333
-					    echo '&nbsp;';
333
+						echo '&nbsp;';
334 334
 					} ?>
335 335
 					</td>
336 336
 				</tr>
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 					<th class="ui-state-default" colspan="22">
342 342
 						<div class="center">
343 343
 							<?php echo I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)',
344
-							    I18N::number($this->data->get('sosa_count')),
345
-							    I18N::number($this->data->get('sosa_theo')), 
346
-							    I18N::percentage($this->data->get('sosa_ratio'),2)
347
-							    ); ?>
344
+								I18N::number($this->data->get('sosa_count')),
345
+								I18N::number($this->data->get('sosa_theo')), 
346
+								I18N::percentage($this->data->get('sosa_ratio'),2)
347
+								); ?>
348 348
 							<?php if($this->data->get('sosa_hidden') > 0) {
349
-							    echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']';
349
+								echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']';
350 350
 							} ?>
351 351
 						</div>
352 352
 					</th>
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 				</div>
381 381
 			</div>
382 382
 		<?php 
383
-        }
384
-    }
383
+		}
384
+	}
385 385
     
386 386
 }
387 387
  
388 388
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaStatsView.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 	 * {@inhericDoc}
24 24
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
25 25
 	 */
26
-    protected function renderContent() {      
27
-        ?>                
26
+	protected function renderContent() {      
27
+		?>                
28 28
         <div id="maj-sosa-stats-page">
29 29
 			<h2><?php echo $this->data->get('title'); ?></h2>
30 30
 			
31 31
 			<?php  if($this->data->get('is_setup')) {  
32
-			    $general_stats = $this->data->get('general_stats'); ?>
32
+				$general_stats = $this->data->get('general_stats'); ?>
33 33
 			<h3><?php echo I18N::translate('General statistics'); ?></h3>
34 34
 			<div class="maj-table">
35 35
 				<div class="maj-row">
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 			<?php   } else { ?>
135 135
 			<div class="warning"><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></div>
136 136
 			<?php }     
137
-    }
137
+	}
138 138
     
139 139
 }
140 140
  
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaListFamView.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * {@inhericDoc}
33 33
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
34 34
 	 */
35
-    protected function renderContent() { 
35
+	protected function renderContent() { 
36 36
         
37
-        if($this->data->get('has_sosa', false)) {
38
-            $table_id = $this->data->get('table_id');            
39
-        ?>   
37
+		if($this->data->get('has_sosa', false)) {
38
+			$table_id = $this->data->get('table_id');            
39
+		?>   
40 40
         
41 41
 		<div id="sosa-fam-list" class="sosa-list">
42 42
 			<table id="<?php echo $table_id; ?>">
@@ -187,59 +187,59 @@  discard block
 block discarded – undo
187 187
 				<tbody>
188 188
 			
189 189
 			<?php foreach($this->data->get('sosa_list') as $sosa => $family) {
190
-			    /** @var \Fisharebest\Webtrees\Family $person */
190
+				/** @var \Fisharebest\Webtrees\Family $person */
191 191
 
192
-			    //PERSO Create decorator for Family
193
-			    $dfamily = new Family($family);
192
+				//PERSO Create decorator for Family
193
+				$dfamily = new Family($family);
194 194
 			    
195
-			    $husb = $family->getHusband();
196
-			    if (is_null($husb)) {
197
-			        $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree());
198
-			    }
199
-			    $dhusb = new \MyArtJaub\Webtrees\Individual($husb);
200
-			    $wife = $family->getWife();
201
-			    if (is_null($wife)) {
202
-			        $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree());
203
-			    }
204
-			    $dwife = new \MyArtJaub\Webtrees\Individual($wife);
195
+				$husb = $family->getHusband();
196
+				if (is_null($husb)) {
197
+					$husb = new Individual('H', '0 @H@ INDI', null, $family->getTree());
198
+				}
199
+				$dhusb = new \MyArtJaub\Webtrees\Individual($husb);
200
+				$wife = $family->getWife();
201
+				if (is_null($wife)) {
202
+					$wife = new Individual('W', '0 @W@ INDI', null, $family->getTree());
203
+				}
204
+				$dwife = new \MyArtJaub\Webtrees\Individual($wife);
205 205
 			    
206
-			    $mdate=$family->getMarriageDate();
206
+				$mdate=$family->getMarriageDate();
207 207
 			    
208
-			    if ($family->isPendingAddtion()) {
209
-			        $class = ' class="new"';
210
-			    } elseif ($family->isPendingDeletion()) {
211
-			        $class = ' class="old"';
212
-			    } else {
213
-			        $class = '';
214
-			    }
215
-			    ?>			
208
+				if ($family->isPendingAddtion()) {
209
+					$class = ' class="new"';
210
+				} elseif ($family->isPendingDeletion()) {
211
+					$class = ' class="old"';
212
+				} else {
213
+					$class = '';
214
+				}
215
+				?>			
216 216
         		<tr <?php echo $class?>>
217 217
         			<td class="transparent"><?php echo I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10); ?></td>
218 218
         			<td class="transparent"><?php echo $sosa; ?></td>
219 219
         			<!--  HUSBAND -->
220 220
         			<td colspan="2">
221 221
         			<?php foreach ($husb->getAllNames() as $num=>$name) {
222
-        				if ($name['type']=='NAME') {
223
-        					$title='';
224
-        				} else {
225
-        					$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"';
226
-        				}
227
-        				if ($num==$husb->getPrimaryName()) {
228
-        					$class=' class="name2"';
229
-        					$sex_image=$husb->getSexImage();
230
-        					list($surn, $givn)=explode(',', $name['sort']);
231
-        				} else {
232
-        					$class='';
233
-        					$sex_image='';
234
-        				} ?>
222
+						if ($name['type']=='NAME') {
223
+							$title='';
224
+						} else {
225
+							$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"';
226
+						}
227
+						if ($num==$husb->getPrimaryName()) {
228
+							$class=' class="name2"';
229
+							$sex_image=$husb->getSexImage();
230
+							list($surn, $givn)=explode(',', $name['sort']);
231
+						} else {
232
+							$class='';
233
+							$sex_image='';
234
+						} ?>
235 235
         				<a <?php echo $title.' '.$class; ?> href="<?php echo $husb->getHtmlUrl(); ?>">
236 236
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?>
237 237
         				</a>
238 238
         				<?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dhusb->getSosaNumbers(), 1, 'smaller'); ?>
239 239
         				<br/>
240 240
             		<?php }
241
-            		echo $husb->getPrimaryParentsNames('parents details1', 'none');
242
-            		?>
241
+					echo $husb->getPrimaryParentsNames('parents details1', 'none');
242
+					?>
243 243
             		</td>
244 244
             		<!-- Dummy column to match colspan in header -->
245 245
             		<td style="display:none;"></td>
@@ -255,27 +255,27 @@  discard block
 block discarded – undo
255 255
             		<!--  WIFE -->
256 256
         			<td colspan="2">
257 257
         			<?php foreach ($wife->getAllNames() as $num=>$name) {
258
-        				if ($name['type']=='NAME') {
259
-        					$title='';
260
-        				} else {
261
-        					$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"';
262
-        				}
263
-        				if ($num==$wife->getPrimaryName()) {
264
-        					$class=' class="name2"';
265
-        					$sex_image=$wife->getSexImage();
266
-        					list($surn, $givn)=explode(',', $name['sort']);
267
-        				} else {
268
-        					$class='';
269
-        					$sex_image='';
270
-        				} ?>
258
+						if ($name['type']=='NAME') {
259
+							$title='';
260
+						} else {
261
+							$title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"';
262
+						}
263
+						if ($num==$wife->getPrimaryName()) {
264
+							$class=' class="name2"';
265
+							$sex_image=$wife->getSexImage();
266
+							list($surn, $givn)=explode(',', $name['sort']);
267
+						} else {
268
+							$class='';
269
+							$sex_image='';
270
+						} ?>
271 271
         				<a <?php echo $title.' '.$class; ?> href="<?php echo $wife->getHtmlUrl(); ?>">
272 272
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?>
273 273
         				</a>
274 274
         				<?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dwife->getSosaNumbers(), 1, 'smaller'); ?>
275 275
         				<br/>
276 276
             		<?php }
277
-            		echo $wife->getPrimaryParentsNames('parents details1', 'none');
278
-            		?>
277
+					echo $wife->getPrimaryParentsNames('parents details1', 'none');
278
+					?>
279 279
             		</td>
280 280
             		<!-- Dummy column to match colspan in header -->
281 281
             		<td style="display:none;"></td>
@@ -289,31 +289,31 @@  discard block
 block discarded – undo
289 289
             		<td><?php  Date::getAge($wdate, $mdate, 2); ?></td>
290 290
             		<td><?php  Date::getAge($wdate, $mdate, 1); ?></td>
291 291
             		<td><?php 
292
-            		if ($marriage_dates = $family->getAllMarriageDates()) {
293
-        				foreach ($marriage_dates as $n => $marriage_date) {
294
-        					if ($n) { echo '<br>'; } ?>
292
+					if ($marriage_dates = $family->getAllMarriageDates()) {
293
+						foreach ($marriage_dates as $n => $marriage_date) {
294
+							if ($n) { echo '<br>'; } ?>
295 295
         					<div><?php echo $marriage_date->display(true); ?></div>
296 296
         				<?php }
297
-            		} elseif ($family->getFacts('_NMR')) {
298
-            		    echo I18N::translate('no');
299
-            		} elseif ($family->getFacts('MARR')) {
300
-            		    echo I18N::translate('yes');
301
-            		} else {
302
-            		    echo '&nbsp;';
303
-            		} ?>
297
+					} elseif ($family->getFacts('_NMR')) {
298
+						echo I18N::translate('no');
299
+					} elseif ($family->getFacts('MARR')) {
300
+						echo I18N::translate('yes');
301
+					} else {
302
+						echo '&nbsp;';
303
+					} ?>
304 304
             		</td>
305 305
             		<td><?php echo $marriage_dates ? $marriage_date->julianDay() : 0;  ?></td>
306 306
             		<td><?php 
307
-            		foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) {
308
-				        $tmp = new Place($marriage_place, $family->getTree());
309
-        				if ($n) { ?><br><?php } ?>
307
+					foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) {
308
+						$tmp = new Place($marriage_place, $family->getTree());
309
+						if ($n) { ?><br><?php } ?>
310 310
         				<a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>">
311 311
         					<?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?>
312 312
         				</a>
313 313
         			<?php  } ?>
314 314
         			</td>
315 315
         			<?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
316
-				        $isMSourced = $dfamily->isMarriageSourced(); ?>
316
+						$isMSourced = $dfamily->isMarriageSourced(); ?>
317 317
 				   	<td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isMSourced, 'MARR', 1, 'medium'); ?></td>
318 318
 					<td><?php echo $isMSourced; ?></td>
319 319
 					<?php } else { ?>
@@ -326,30 +326,30 @@  discard block
 block discarded – undo
326 326
 					<td><?php 
327 327
 					if (!$mdate->isOK()) { echo 'U'; }
328 328
 					else {
329
-					    if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; }
330
-					    else { echo 'YES'; }
329
+						if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; }
330
+						else { echo 'YES'; }
331 331
 					}
332 332
 					if ($family->getFacts(WT_EVENTS_DIV)) { echo 'D'; }
333 333
 					if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) {
334
-					    echo 'M';
334
+						echo 'M';
335 335
 					} ?>
336 336
 					</td>
337 337
 					<td><?php 
338
-			         if ($husb->isDead() && $wife->isDead()) { echo 'Y'; }
339
-			         if ($husb->isDead() && !$wife->isDead()) {
340
-        				if ($wife->getSex() == 'F') { echo 'H'; }
341
-        				if ($wife->getSex() == 'M') { echo 'W'; } // male partners
342
-        			}
343
-        			if (!$husb->isDead() && $wife->isDead()) {
344
-        				if ($husb->getSex() == 'M') { echo 'W'; }
345
-        				if ($husb->getSex() == 'F') { echo  'H'; }  // female partners
346
-        			}
347
-        			if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?>
338
+					 if ($husb->isDead() && $wife->isDead()) { echo 'Y'; }
339
+					 if ($husb->isDead() && !$wife->isDead()) {
340
+						if ($wife->getSex() == 'F') { echo 'H'; }
341
+						if ($wife->getSex() == 'M') { echo 'W'; } // male partners
342
+					}
343
+					if (!$husb->isDead() && $wife->isDead()) {
344
+						if ($husb->getSex() == 'M') { echo 'W'; }
345
+						if ($husb->getSex() == 'F') { echo  'H'; }  // female partners
346
+					}
347
+					if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?>
348 348
         			</td>
349 349
         			<td><?php 
350
-			         if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; }
351
-			         elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; }
352
-			         else { echo '&nbsp;'; } ?>
350
+					 if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; }
351
+					 elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; }
352
+					 else { echo '&nbsp;'; } ?>
353 353
 			         </td>
354 354
 				</tr>
355 355
         	<?php } ?>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
         <p class="warning"><?php echo I18N::translate('No family has been found for generation %d', $this->data->get('generation')); ?></p>
388 388
         <?php 
389 389
 		}
390
-    }
390
+	}
391 391
     
392 392
 }
393 393
  
394 394
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/Views/SosaComputeResultView.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@
 block discarded – undo
23 23
 	 * {@inhericDoc}
24 24
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
25 25
 	 */
26
-    protected function renderContent() {        
26
+	protected function renderContent() {        
27 27
         
28
-        if($this->data->get('is_success', false)) {
29
-        ?>        
28
+		if($this->data->get('is_success', false)) {
29
+		?>        
30 30
         	<i class="icon-maj-success" title="<?php echo I18N::translate('Success'); ?>"></i>&nbsp;
31 31
         	<?php echo I18N::translate('Success'); ?>
32 32
         <?php } else { ?>
33 33
 			<i class="icon-maj-error" title="<?php echo I18N::translate('Error'); ?>"></i>&nbsp;
34 34
 			<?php echo I18N::translate('Error'); ?>
35 35
 			<?php if($error = $this->data->get('error')) { echo '&nbsp;-&nbsp;' . $error; }
36
-        }
37
-    }
36
+		}
37
+	}
38 38
     
39 39
 }
40 40
  
41 41
\ No newline at end of file
Please login to merge, or discard this patch.