@@ -29,30 +29,30 @@ discard block |
||
| 29 | 29 | class WelcomeBlockController extends MvcController |
| 30 | 30 | { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Pages |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * Pages |
|
| 34 | + */ |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * WelcomeBlock@index |
|
| 38 | - * |
|
| 39 | - * @param PageController $parent_controller |
|
| 40 | - * @param Tree $tree |
|
| 41 | - * @param string $block_id |
|
| 42 | - * @param string $template |
|
| 43 | - * @return $string |
|
| 44 | - */ |
|
| 45 | - public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
| 46 | - $view_bag = new ViewBag(); |
|
| 36 | + /** |
|
| 37 | + * WelcomeBlock@index |
|
| 38 | + * |
|
| 39 | + * @param PageController $parent_controller |
|
| 40 | + * @param Tree $tree |
|
| 41 | + * @param string $block_id |
|
| 42 | + * @param string $template |
|
| 43 | + * @return $string |
|
| 44 | + */ |
|
| 45 | + public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
| 46 | + $view_bag = new ViewBag(); |
|
| 47 | 47 | |
| 48 | - if($parent_controller && $tree) { |
|
| 48 | + if($parent_controller && $tree) { |
|
| 49 | 49 | |
| 50 | - $view_bag->set('tree', $tree); |
|
| 51 | - $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
| 50 | + $view_bag->set('tree', $tree); |
|
| 51 | + $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
| 52 | 52 | |
| 53 | - $id = $this->module->getName().$block_id; |
|
| 54 | - $class = $this->module->getName().'_block'; |
|
| 55 | - $parent_controller->addInlineJavascript(' |
|
| 53 | + $id = $this->module->getName().$block_id; |
|
| 54 | + $class = $this->module->getName().'_block'; |
|
| 55 | + $parent_controller->addInlineJavascript(' |
|
| 56 | 56 | jQuery("#maj-new_passwd").hide(); |
| 57 | 57 | jQuery("#maj-passwd_click").click(function() |
| 58 | 58 | { |
@@ -63,65 +63,65 @@ discard block |
||
| 63 | 63 | }); |
| 64 | 64 | '); |
| 65 | 65 | |
| 66 | - if (Auth::isAdmin()) { |
|
| 67 | - $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
| 68 | - } else { |
|
| 69 | - $title=''; |
|
| 70 | - } |
|
| 71 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
| 66 | + if (Auth::isAdmin()) { |
|
| 67 | + $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
| 68 | + } else { |
|
| 69 | + $title=''; |
|
| 70 | + } |
|
| 71 | + $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
| 72 | 72 | |
| 73 | - $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
| 74 | - $view_bag->set('piwik_enabled', $piwik_enabled); |
|
| 75 | - if($piwik_enabled) { |
|
| 76 | - $parent_controller->addInlineJavascript( |
|
| 77 | - '$("#piwik_stats") |
|
| 73 | + $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
| 74 | + $view_bag->set('piwik_enabled', $piwik_enabled); |
|
| 75 | + if($piwik_enabled) { |
|
| 76 | + $parent_controller->addInlineJavascript( |
|
| 77 | + '$("#piwik_stats") |
|
| 78 | 78 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
| 79 | - ); |
|
| 80 | - } |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 82 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 83 | 83 | |
| 84 | - if ($template) { |
|
| 85 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
| 86 | - } else { |
|
| 87 | - return $content; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 84 | + if ($template) { |
|
| 85 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
| 86 | + } else { |
|
| 87 | + return $content; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * WelcomeBlock@config |
|
| 96 | - * |
|
| 97 | - * @param string $block_id |
|
| 98 | - */ |
|
| 99 | - public function config($block_id = null) { |
|
| 94 | + /** |
|
| 95 | + * WelcomeBlock@config |
|
| 96 | + * |
|
| 97 | + * @param string $block_id |
|
| 98 | + */ |
|
| 99 | + public function config($block_id = null) { |
|
| 100 | 100 | |
| 101 | - if(empty($block_id)) throw new MvcException(404); |
|
| 101 | + if(empty($block_id)) throw new MvcException(404); |
|
| 102 | 102 | |
| 103 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
| 104 | - $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
| 105 | - $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
| 106 | - $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
| 107 | - $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
| 108 | - Cache::delete('piwikCountYear', $this->module); |
|
| 109 | - throw new MvcException(200); // Use this instead of exit |
|
| 110 | - } |
|
| 103 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
| 104 | + $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
| 105 | + $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
| 106 | + $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
| 107 | + $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
| 108 | + Cache::delete('piwikCountYear', $this->module); |
|
| 109 | + throw new MvcException(200); // Use this instead of exit |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - $view_bag = new ViewBag(); |
|
| 112 | + $view_bag = new ViewBag(); |
|
| 113 | 113 | |
| 114 | - // Is Piwik Statistic Enabled ? |
|
| 115 | - $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
| 116 | - //Piwik Root Url |
|
| 117 | - $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
| 118 | - // Piwik token |
|
| 119 | - $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
| 120 | - // Piwik side id |
|
| 121 | - $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
| 114 | + // Is Piwik Statistic Enabled ? |
|
| 115 | + $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
| 116 | + //Piwik Root Url |
|
| 117 | + $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
| 118 | + // Piwik token |
|
| 119 | + $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
| 120 | + // Piwik side id |
|
| 121 | + $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
| 122 | 122 | |
| 123 | - return ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 124 | - } |
|
| 123 | + return ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
| 46 | 46 | $view_bag = new ViewBag(); |
| 47 | 47 | |
| 48 | - if($parent_controller && $tree) { |
|
| 48 | + if ($parent_controller && $tree) { |
|
| 49 | 49 | |
| 50 | 50 | $view_bag->set('tree', $tree); |
| 51 | 51 | $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
@@ -64,22 +64,22 @@ discard block |
||
| 64 | 64 | '); |
| 65 | 65 | |
| 66 | 66 | if (Auth::isAdmin()) { |
| 67 | - $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
| 67 | + $title = '<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged='.$tree->getNameHtml().'&ctype=gedcom"></a>'; |
|
| 68 | 68 | } else { |
| 69 | - $title=''; |
|
| 69 | + $title = ''; |
|
| 70 | 70 | } |
| 71 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
| 71 | + $title .= '<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
| 72 | 72 | |
| 73 | 73 | $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
| 74 | 74 | $view_bag->set('piwik_enabled', $piwik_enabled); |
| 75 | - if($piwik_enabled) { |
|
| 75 | + if ($piwik_enabled) { |
|
| 76 | 76 | $parent_controller->addInlineJavascript( |
| 77 | 77 | '$("#piwik_stats") |
| 78 | 78 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 82 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
| 83 | 83 | |
| 84 | 84 | if ($template) { |
| 85 | 85 | return Theme::theme()->formatBlock($id, $title, $class, $content); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function config($block_id = null) { |
| 100 | 100 | |
| 101 | - if(empty($block_id)) throw new MvcException(404); |
|
| 101 | + if (empty($block_id)) throw new MvcException(404); |
|
| 102 | 102 | |
| 103 | 103 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
| 104 | 104 | $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
@@ -98,7 +98,9 @@ |
||
| 98 | 98 | */ |
| 99 | 99 | public function config($block_id = null) { |
| 100 | 100 | |
| 101 | - if(empty($block_id)) throw new MvcException(404); |
|
| 101 | + if(empty($block_id)) { |
|
| 102 | + throw new MvcException(404); |
|
| 103 | + } |
|
| 102 | 104 | |
| 103 | 105 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
| 104 | 106 | $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | interface PageHeaderExtenderInterface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Get HTML code for extending the header of a page. |
|
| 20 | - * |
|
| 21 | - * @return string HTML code extension |
|
| 22 | - */ |
|
| 23 | - public function hPrintHeader(); |
|
| 18 | + /** |
|
| 19 | + * Get HTML code for extending the header of a page. |
|
| 20 | + * |
|
| 21 | + * @return string HTML code extension |
|
| 22 | + */ |
|
| 23 | + public function hPrintHeader(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | interface PageFooterExtenderInterface { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Get HTML code for extending the footer of a page. |
|
| 20 | - * |
|
| 21 | - * @return string HTML code extension |
|
| 22 | - */ |
|
| 23 | - public function hPrintFooter(); |
|
| 18 | + /** |
|
| 19 | + * Get HTML code for extending the footer of a page. |
|
| 20 | + * |
|
| 21 | + * @return string HTML code extension |
|
| 22 | + */ |
|
| 23 | + public function hPrintFooter(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | use Fisharebest\Webtrees\Controller\IndividualController; |
@@ -34,26 +34,26 @@ |
||
| 34 | 34 | protected $fact; |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | - * Contructor for the decorator |
|
| 38 | - * |
|
| 39 | - * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
|
| 40 | - */ |
|
| 37 | + * Contructor for the decorator |
|
| 38 | + * |
|
| 39 | + * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
|
| 40 | + */ |
|
| 41 | 41 | public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
| 42 | 42 | $this->fact = $fact_in; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * Check if a fact has a date and is sourced |
|
| 47 | - * Values: |
|
| 48 | - * - 0, if no date is found for the fact |
|
| 49 | - * - -1, if the date is not precise |
|
| 50 | - * - -2, if the date is precise, but no source is found |
|
| 51 | - * - 1, if the date is precise, and a source is found |
|
| 52 | - * - 2, if the date is precise, a source exists, and is supported by a certificate (requires _ACT usage) |
|
| 53 | - * - 3, if the date is precise, a source exists, and the certificate supporting the fact is within an acceptable range of date |
|
| 54 | - * |
|
| 55 | - * @return int Level of sources |
|
| 56 | - */ |
|
| 46 | + * Check if a fact has a date and is sourced |
|
| 47 | + * Values: |
|
| 48 | + * - 0, if no date is found for the fact |
|
| 49 | + * - -1, if the date is not precise |
|
| 50 | + * - -2, if the date is precise, but no source is found |
|
| 51 | + * - 1, if the date is precise, and a source is found |
|
| 52 | + * - 2, if the date is precise, a source exists, and is supported by a certificate (requires _ACT usage) |
|
| 53 | + * - 3, if the date is precise, a source exists, and the certificate supporting the fact is within an acceptable range of date |
|
| 54 | + * |
|
| 55 | + * @return int Level of sources |
|
| 56 | + */ |
|
| 57 | 57 | public function isSourced(){ |
| 58 | 58 | $isSourced=0; |
| 59 | 59 | $date = $this->fact->getDate(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @param \Fisharebest\Webtrees\Fact $fact_in The Fact to extend |
| 40 | 40 | */ |
| 41 | - public function __construct(\Fisharebest\Webtrees\Fact $fact_in){ |
|
| 41 | + public function __construct(\Fisharebest\Webtrees\Fact $fact_in) { |
|
| 42 | 42 | $this->fact = $fact_in; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -54,22 +54,22 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return int Level of sources |
| 56 | 56 | */ |
| 57 | - public function isSourced(){ |
|
| 58 | - $isSourced=0; |
|
| 57 | + public function isSourced() { |
|
| 58 | + $isSourced = 0; |
|
| 59 | 59 | $date = $this->fact->getDate(); |
| 60 | - if($date->isOK()) { |
|
| 61 | - $isSourced=-1; |
|
| 62 | - if($date->qual1=='' && $date->minimumJulianDay() == $date->maximumJulianDay()){ |
|
| 63 | - $isSourced=-2; |
|
| 60 | + if ($date->isOK()) { |
|
| 61 | + $isSourced = -1; |
|
| 62 | + if ($date->qual1 == '' && $date->minimumJulianDay() == $date->maximumJulianDay()) { |
|
| 63 | + $isSourced = -2; |
|
| 64 | 64 | $citations = $this->fact->getCitations(); |
| 65 | - foreach($citations as $citation){ |
|
| 66 | - $isSourced=max($isSourced, 1); |
|
| 67 | - if(preg_match('/3 _ACT (.*)/', $citation) ){ |
|
| 68 | - $isSourced=max($isSourced, 2); |
|
| 65 | + foreach ($citations as $citation) { |
|
| 66 | + $isSourced = max($isSourced, 1); |
|
| 67 | + if (preg_match('/3 _ACT (.*)/', $citation)) { |
|
| 68 | + $isSourced = max($isSourced, 2); |
|
| 69 | 69 | preg_match_all("/4 DATE (.*)/", $citation, $datessource, PREG_SET_ORDER); |
| 70 | - foreach($datessource as $daterec){ |
|
| 70 | + foreach ($datessource as $daterec) { |
|
| 71 | 71 | $datesource = new Date($daterec[1]); |
| 72 | - if(abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN){ |
|
| 72 | + if (abs($datesource->julianDay() - $date->julianDay()) < self::DATE_PRECISION_MARGIN) { |
|
| 73 | 73 | $isSourced = max($isSourced, 3); //If this level increases, do not forget to change the constant MAX_IS_SOURCED_LEVEL |
| 74 | 74 | } |
| 75 | 75 | } |