@@ -28,77 +28,77 @@ |
||
28 | 28 | */ |
29 | 29 | class AdminConfigController extends MvcController |
30 | 30 | { |
31 | - /** |
|
32 | - * Manage updates sent from the AdminConfig@index form. |
|
33 | - */ |
|
34 | - protected function update() { |
|
31 | + /** |
|
32 | + * Manage updates sent from the AdminConfig@index form. |
|
33 | + */ |
|
34 | + protected function update() { |
|
35 | 35 | |
36 | - if(Auth::isAdmin()){ |
|
36 | + if(Auth::isAdmin()){ |
|
37 | 37 | |
38 | - $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
39 | - $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
38 | + $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT')); |
|
39 | + $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK')); |
|
40 | 40 | |
41 | - if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
42 | - $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
43 | - } |
|
41 | + if($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) { |
|
42 | + $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT); |
|
43 | + } |
|
44 | 44 | |
45 | - if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
46 | - $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
47 | - } |
|
45 | + if($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) { |
|
46 | + $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE); |
|
47 | + } |
|
48 | 48 | |
49 | - // Only accept valid color for MAJ_WM_FONT_COLOR |
|
50 | - $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
51 | - if($MAJ_WM_FONT_COLOR) { |
|
52 | - $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
53 | - } |
|
49 | + // Only accept valid color for MAJ_WM_FONT_COLOR |
|
50 | + $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}'); |
|
51 | + if($MAJ_WM_FONT_COLOR) { |
|
52 | + $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR); |
|
53 | + } |
|
54 | 54 | |
55 | - // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
56 | - $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
57 | - if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
58 | - $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
59 | - } |
|
55 | + // Only accept valid folders for MAJ_CERT_ROOTDIR |
|
56 | + $MAJ_CERT_ROOTDIR = preg_replace('/[\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/'); |
|
57 | + if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') { |
|
58 | + $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1); |
|
59 | + } |
|
60 | 60 | |
61 | - if ($MAJ_CERT_ROOTDIR) { |
|
62 | - if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
63 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
64 | - } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
65 | - $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
66 | - FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
67 | - } else { |
|
68 | - FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
69 | - } |
|
70 | - } |
|
61 | + if ($MAJ_CERT_ROOTDIR) { |
|
62 | + if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
63 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
64 | + } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) { |
|
65 | + $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR); |
|
66 | + FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info'); |
|
67 | + } else { |
|
68 | + FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger'); |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
72 | + FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success'); |
|
73 | 73 | |
74 | - return; |
|
75 | - } |
|
76 | - } |
|
74 | + return; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Pages |
|
80 | - */ |
|
78 | + /** |
|
79 | + * Pages |
|
80 | + */ |
|
81 | 81 | |
82 | - /** |
|
83 | - * AdminConfig@index |
|
84 | - */ |
|
85 | - public function index() { |
|
86 | - global $WT_TREE; |
|
82 | + /** |
|
83 | + * AdminConfig@index |
|
84 | + */ |
|
85 | + public function index() { |
|
86 | + global $WT_TREE; |
|
87 | 87 | |
88 | - $action = Filter::post('action'); |
|
89 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
88 | + $action = Filter::post('action'); |
|
89 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
90 | 90 | |
91 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
92 | - $ctrl = new PageController(); |
|
93 | - $ctrl |
|
94 | - ->restrictAccess(Auth::isAdmin()) |
|
95 | - ->setPageTitle($this->module->getTitle()); |
|
91 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
92 | + $ctrl = new PageController(); |
|
93 | + $ctrl |
|
94 | + ->restrictAccess(Auth::isAdmin()) |
|
95 | + ->setPageTitle($this->module->getTitle()); |
|
96 | 96 | |
97 | - $view_bag = new ViewBag(); |
|
98 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
99 | - $view_bag->set('module', $this->module); |
|
97 | + $view_bag = new ViewBag(); |
|
98 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
99 | + $view_bag->set('module', $this->module); |
|
100 | 100 | |
101 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
102 | - } |
|
101 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
102 | + } |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | \ No newline at end of file |
@@ -20,111 +20,111 @@ |
||
20 | 20 | */ |
21 | 21 | class CertificateFileProvider implements CertificateProviderInterface { |
22 | 22 | |
23 | - /** |
|
24 | - * Relative path to the root certificate folder |
|
25 | - * @var string $root_path |
|
26 | - */ |
|
27 | - protected $root_path; |
|
23 | + /** |
|
24 | + * Relative path to the root certificate folder |
|
25 | + * @var string $root_path |
|
26 | + */ |
|
27 | + protected $root_path; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Reference tree |
|
31 | - * @var Tree $tree |
|
32 | - */ |
|
33 | - protected $tree; |
|
29 | + /** |
|
30 | + * Reference tree |
|
31 | + * @var Tree $tree |
|
32 | + */ |
|
33 | + protected $tree; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Cached list of certificates' cities. |
|
37 | - * @var (null|array) $cities_list |
|
38 | - */ |
|
39 | - protected $cities_list = null; |
|
35 | + /** |
|
36 | + * Cached list of certificates' cities. |
|
37 | + * @var (null|array) $cities_list |
|
38 | + */ |
|
39 | + protected $cities_list = null; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for the File Provider |
|
43 | - * @param string $root_path |
|
44 | - * @param Tree $tree |
|
45 | - */ |
|
46 | - public function __construct($root_path, Tree $tree) { |
|
47 | - $this->root_path = $root_path; |
|
48 | - $this->tree = $tree; |
|
49 | - } |
|
41 | + /** |
|
42 | + * Constructor for the File Provider |
|
43 | + * @param string $root_path |
|
44 | + * @param Tree $tree |
|
45 | + */ |
|
46 | + public function __construct($root_path, Tree $tree) { |
|
47 | + $this->root_path = $root_path; |
|
48 | + $this->tree = $tree; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inhericDoc} |
|
53 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
54 | - */ |
|
55 | - public function getRealCertificatesDirectory(){ |
|
56 | - return WT_DATA_DIR . $this->root_path; |
|
57 | - } |
|
51 | + /** |
|
52 | + * {@inhericDoc} |
|
53 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
54 | + */ |
|
55 | + public function getRealCertificatesDirectory(){ |
|
56 | + return WT_DATA_DIR . $this->root_path; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inhericDoc} |
|
61 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
62 | - */ |
|
63 | - public function getCitiesList(){ |
|
64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
65 | - $certdir = $this->getRealCertificatesDirectory(); |
|
66 | - $this->cities_list = array(); |
|
59 | + /** |
|
60 | + * {@inhericDoc} |
|
61 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
62 | + */ |
|
63 | + public function getCitiesList(){ |
|
64 | + if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
65 | + $certdir = $this->getRealCertificatesDirectory(); |
|
66 | + $this->cities_list = array(); |
|
67 | 67 | |
68 | - $dir = opendir($certdir); |
|
68 | + $dir = opendir($certdir); |
|
69 | 69 | |
70 | - while($entry = readdir($dir)){ |
|
71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
73 | - } |
|
74 | - } |
|
75 | - sort($this->cities_list); |
|
76 | - } |
|
77 | - return $this->cities_list; |
|
78 | - } |
|
70 | + while($entry = readdir($dir)){ |
|
71 | + if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
72 | + $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
73 | + } |
|
74 | + } |
|
75 | + sort($this->cities_list); |
|
76 | + } |
|
77 | + return $this->cities_list; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * {@inhericDoc} |
|
82 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
83 | - */ |
|
84 | - public function getCertificatesList($selCity){ |
|
80 | + /** |
|
81 | + * {@inhericDoc} |
|
82 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
83 | + */ |
|
84 | + public function getCertificatesList($selCity){ |
|
85 | 85 | |
86 | - $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
86 | + $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
87 | 87 | |
88 | - $certdir = $this->getRealCertificatesDirectory(); |
|
89 | - $tabCertif= array(); |
|
88 | + $certdir = $this->getRealCertificatesDirectory(); |
|
89 | + $tabCertif= array(); |
|
90 | 90 | |
91 | - if(is_dir($certdir.$selCity)){ |
|
92 | - $dir=opendir($certdir.$selCity); |
|
93 | - while($entry = readdir($dir)){ |
|
94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
95 | - $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
96 | - $certificate = new Certificate($path, $this->tree, $this); |
|
97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
98 | - $tabCertif[] = $certificate; |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - return $tabCertif; |
|
104 | - } |
|
91 | + if(is_dir($certdir.$selCity)){ |
|
92 | + $dir=opendir($certdir.$selCity); |
|
93 | + while($entry = readdir($dir)){ |
|
94 | + if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
95 | + $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
96 | + $certificate = new Certificate($path, $this->tree, $this); |
|
97 | + if(Functions::isImageTypeSupported($certificate->extension())){ |
|
98 | + $tabCertif[] = $certificate; |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + return $tabCertif; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * {@inhericDoc} |
|
108 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
109 | - */ |
|
110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
111 | - $tabFiles= array(); |
|
112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
113 | - $contains = utf8_decode($contains); |
|
114 | - $nbCert = 0; |
|
106 | + /** |
|
107 | + * {@inhericDoc} |
|
108 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
109 | + */ |
|
110 | + public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
111 | + $tabFiles= array(); |
|
112 | + $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
113 | + $contains = utf8_decode($contains); |
|
114 | + $nbCert = 0; |
|
115 | 115 | |
116 | - if(is_dir($dirPath)){ |
|
117 | - $dir=opendir($dirPath); |
|
118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
121 | - $nbCert++; |
|
122 | - } |
|
123 | - } |
|
124 | - } |
|
125 | - sort($tabFiles); |
|
126 | - return $tabFiles; |
|
127 | - } |
|
116 | + if(is_dir($dirPath)){ |
|
117 | + $dir=opendir($dirPath); |
|
118 | + while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
119 | + if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
120 | + $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
121 | + $nbCert++; |
|
122 | + } |
|
123 | + } |
|
124 | + } |
|
125 | + sort($tabFiles); |
|
126 | + return $tabFiles; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
130 | 130 |
@@ -18,40 +18,40 @@ |
||
18 | 18 | * Patronymic Lineage Module. |
19 | 19 | */ |
20 | 20 | class PatronymicLineageModule extends fw\Module\AbstractModule |
21 | - implements ModuleMenuItemInterface |
|
21 | + implements ModuleMenuItemInterface |
|
22 | 22 | { |
23 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
24 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
23 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
24 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * {@inhericDoc} |
|
28 | - */ |
|
29 | - public function getTitle() { |
|
30 | - return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages'); |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inhericDoc} |
|
28 | + */ |
|
29 | + public function getTitle() { |
|
30 | + return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages'); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * {@inhericDoc} |
|
35 | - */ |
|
36 | - public function getDescription() { |
|
37 | - return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.'); |
|
38 | - } |
|
33 | + /** |
|
34 | + * {@inhericDoc} |
|
35 | + */ |
|
36 | + public function getDescription() { |
|
37 | + return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.'); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inhericDoc} |
|
42 | - */ |
|
43 | - public function modAction($mod_action) { |
|
44 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
45 | - } |
|
46 | - /** |
|
47 | - * {@inhericDoc} |
|
48 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
49 | - */ |
|
50 | - public function getMenu(fw\Tree $tree, $reference) { |
|
51 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
52 | - $surname = $reference && is_string($reference) ? $reference : ''; |
|
53 | - return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow')); |
|
54 | - } |
|
40 | + /** |
|
41 | + * {@inhericDoc} |
|
42 | + */ |
|
43 | + public function modAction($mod_action) { |
|
44 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
45 | + } |
|
46 | + /** |
|
47 | + * {@inhericDoc} |
|
48 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
49 | + */ |
|
50 | + public function getMenu(fw\Tree $tree, $reference) { |
|
51 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
52 | + $surname = $reference && is_string($reference) ? $reference : ''; |
|
53 | + return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow')); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | } |
57 | 57 | |
58 | 58 | \ No newline at end of file |
@@ -30,49 +30,49 @@ discard block |
||
30 | 30 | class MiscExtensionsModule extends AbstractModule |
31 | 31 | implements HookSubscriberInterface, IndividualHeaderExtenderInterface, PageHeaderExtenderInterface, PageFooterExtenderInterface, ModuleConfigInterface |
32 | 32 | { |
33 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
34 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
33 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
34 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
35 | 35 | |
36 | - /** |
|
37 | - * {@inheritDoc} |
|
38 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
39 | - */ |
|
40 | - public function getTitle() { |
|
41 | - return I18N::translate('Miscellaneous extensions'); |
|
42 | - } |
|
36 | + /** |
|
37 | + * {@inheritDoc} |
|
38 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
39 | + */ |
|
40 | + public function getTitle() { |
|
41 | + return I18N::translate('Miscellaneous extensions'); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * {@inheritDoc} |
46 | 46 | * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription() |
47 | 47 | */ |
48 | - public function getDescription() { |
|
49 | - return I18N::translate('Miscellaneous extensions for <strong>webtrees</strong>.'); |
|
50 | - } |
|
48 | + public function getDescription() { |
|
49 | + return I18N::translate('Miscellaneous extensions for <strong>webtrees</strong>.'); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * {@inhericDoc} |
|
54 | - */ |
|
55 | - public function modAction($mod_action) { |
|
56 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
57 | - } |
|
52 | + /** |
|
53 | + * {@inhericDoc} |
|
54 | + */ |
|
55 | + public function modAction($mod_action) { |
|
56 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inhericDoc} |
|
61 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
62 | - */ |
|
63 | - public function getConfigLink() { |
|
64 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inhericDoc} |
|
61 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
62 | + */ |
|
63 | + public function getConfigLink() { |
|
64 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * {@inheritDoc} |
|
69 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
70 | - */ |
|
67 | + /** |
|
68 | + * {@inheritDoc} |
|
69 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
70 | + */ |
|
71 | 71 | public function getSubscribedHooks() { |
72 | 72 | return array( |
73 | - 'hExtendIndiHeaderLeft' => 20, |
|
74 | - 'hPrintHeader' => 20, |
|
75 | - 'hPrintFooter' => 20 |
|
73 | + 'hExtendIndiHeaderLeft' => 20, |
|
74 | + 'hPrintHeader' => 20, |
|
75 | + 'hPrintFooter' => 20 |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
@@ -87,22 +87,22 @@ discard block |
||
87 | 87 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
88 | 88 | */ |
89 | 89 | public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { |
90 | - $res = ''; |
|
91 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
92 | - $titles = $dindi->getTitles(); |
|
93 | - if(count($titles)>0){ |
|
94 | - $res = ' |
|
90 | + $res = ''; |
|
91 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
92 | + $titles = $dindi->getTitles(); |
|
93 | + if(count($titles)>0){ |
|
94 | + $res = ' |
|
95 | 95 | <dl> |
96 | 96 | <dt class="label">'.I18N::translate('Titles').'</dt>'; |
97 | - foreach($titles as $title=>$props){ |
|
98 | - $res .= |
|
99 | - '<dd class="field">' . $title. ' ' . |
|
100 | - FunctionsPrint::getListFromArray($props) . |
|
101 | - '</dd>'; |
|
102 | - } |
|
103 | - $res .= '</dl>'; |
|
104 | - } |
|
105 | - return array( 'indi-header-titles' , $res); |
|
97 | + foreach($titles as $title=>$props){ |
|
98 | + $res .= |
|
99 | + '<dd class="field">' . $title. ' ' . |
|
100 | + FunctionsPrint::getListFromArray($props) . |
|
101 | + '</dd>'; |
|
102 | + } |
|
103 | + $res .= '</dl>'; |
|
104 | + } |
|
105 | + return array( 'indi-header-titles' , $res); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageHeaderExtenderInterface::hPrintHeader() |
117 | 117 | */ |
118 | 118 | public function hPrintHeader() { |
119 | - global $WT_TREE; |
|
119 | + global $WT_TREE; |
|
120 | 120 | |
121 | - $html = ''; |
|
122 | - if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){ |
|
123 | - if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')){ |
|
124 | - $html .= $this->getSetting('MAJ_HTML_HEADER', ''); |
|
125 | - } |
|
126 | - } |
|
127 | - return $html; |
|
121 | + $html = ''; |
|
122 | + if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){ |
|
123 | + if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')){ |
|
124 | + $html .= $this->getSetting('MAJ_HTML_HEADER', ''); |
|
125 | + } |
|
126 | + } |
|
127 | + return $html; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -132,26 +132,26 @@ discard block |
||
132 | 132 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageFooterExtenderInterface::hPrintFooter() |
133 | 133 | */ |
134 | 134 | public function hPrintFooter() { |
135 | - global $WT_TREE; |
|
135 | + global $WT_TREE; |
|
136 | 136 | |
137 | - $html = ''; |
|
138 | - if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){ |
|
139 | - $html .= '<br/>'; |
|
140 | - $html .= '<div class="center">'; |
|
141 | - $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', ''); |
|
142 | - if($cnil_ref != ''){ |
|
143 | - $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref); |
|
144 | - } |
|
145 | - $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')))); |
|
146 | - $html .= '</div>'; |
|
147 | - } |
|
137 | + $html = ''; |
|
138 | + if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){ |
|
139 | + $html .= '<br/>'; |
|
140 | + $html .= '<div class="center">'; |
|
141 | + $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', ''); |
|
142 | + if($cnil_ref != ''){ |
|
143 | + $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref); |
|
144 | + } |
|
145 | + $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID')))); |
|
146 | + $html .= '</div>'; |
|
147 | + } |
|
148 | 148 | |
149 | - if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){ |
|
150 | - if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')){ |
|
151 | - $html .= $this->getSetting('MAJ_HTML_FOOTER', ''); |
|
152 | - } |
|
153 | - } |
|
154 | - return $html; |
|
149 | + if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){ |
|
150 | + if(Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')){ |
|
151 | + $html .= $this->getSetting('MAJ_HTML_FOOTER', ''); |
|
152 | + } |
|
153 | + } |
|
154 | + return $html; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | } |
@@ -19,76 +19,76 @@ |
||
19 | 19 | * Welcome Block Module. |
20 | 20 | */ |
21 | 21 | class WelcomeBlockModule extends AbstractModule |
22 | - implements ModuleBlockInterface |
|
22 | + implements ModuleBlockInterface |
|
23 | 23 | { |
24 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
25 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
24 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
25 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * {@inhericDoc} |
|
29 | - */ |
|
30 | - public function getTitle() { |
|
31 | - return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
32 | - } |
|
27 | + /** |
|
28 | + * {@inhericDoc} |
|
29 | + */ |
|
30 | + public function getTitle() { |
|
31 | + return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * {@inhericDoc} |
|
36 | - */ |
|
37 | - public function getDescription() { |
|
38 | - return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
39 | - } |
|
34 | + /** |
|
35 | + * {@inhericDoc} |
|
36 | + */ |
|
37 | + public function getDescription() { |
|
38 | + return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * {@inhericDoc} |
|
43 | - */ |
|
44 | - public function modAction($mod_action) { |
|
45 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
46 | - } |
|
41 | + /** |
|
42 | + * {@inhericDoc} |
|
43 | + */ |
|
44 | + public function modAction($mod_action) { |
|
45 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inhericDoc} |
|
50 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
51 | - */ |
|
48 | + /** |
|
49 | + * {@inhericDoc} |
|
50 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
51 | + */ |
|
52 | 52 | public function getBlock($block_id, $template = true, $cfg = array()) { |
53 | - global $controller, $WT_TREE; |
|
53 | + global $controller, $WT_TREE; |
|
54 | 54 | |
55 | - $wb_controller = new WelcomeBlockController($this); |
|
56 | - return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
57 | - } |
|
55 | + $wb_controller = new WelcomeBlockController($this); |
|
56 | + return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inhericDoc} |
|
61 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
62 | - */ |
|
63 | - public function loadAjax() { |
|
64 | - return false; |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inhericDoc} |
|
61 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
62 | + */ |
|
63 | + public function loadAjax() { |
|
64 | + return false; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * {@inhericDoc} |
|
69 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
70 | - */ |
|
71 | - public function isUserBlock() { |
|
72 | - return false; |
|
73 | - } |
|
67 | + /** |
|
68 | + * {@inhericDoc} |
|
69 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
70 | + */ |
|
71 | + public function isUserBlock() { |
|
72 | + return false; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * {@inhericDoc} |
|
77 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
78 | - */ |
|
79 | - public function isGedcomBlock() { |
|
80 | - return true; |
|
81 | - } |
|
75 | + /** |
|
76 | + * {@inhericDoc} |
|
77 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
78 | + */ |
|
79 | + public function isGedcomBlock() { |
|
80 | + return true; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * {@inhericDoc} |
|
85 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
86 | - */ |
|
87 | - public function configureBlock($block_id) { |
|
83 | + /** |
|
84 | + * {@inhericDoc} |
|
85 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
86 | + */ |
|
87 | + public function configureBlock($block_id) { |
|
88 | 88 | |
89 | - $wb_controller = new WelcomeBlockController($this); |
|
90 | - return $wb_controller->config($block_id); |
|
91 | - } |
|
89 | + $wb_controller = new WelcomeBlockController($this); |
|
90 | + return $wb_controller->config($block_id); |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
94 | 94 | |
95 | 95 | \ No newline at end of file |
@@ -29,89 +29,89 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class AdminConfigController extends MvcController |
31 | 31 | { |
32 | - /** |
|
33 | - * Manage updates sent from the AdminConfig@index form. |
|
34 | - */ |
|
35 | - protected function update() { |
|
36 | - if(Auth::isAdmin()){ |
|
37 | - $ihooks = HookProvider::getInstalledHooks(); |
|
32 | + /** |
|
33 | + * Manage updates sent from the AdminConfig@index form. |
|
34 | + */ |
|
35 | + protected function update() { |
|
36 | + if(Auth::isAdmin()){ |
|
37 | + $ihooks = HookProvider::getInstalledHooks(); |
|
38 | 38 | |
39 | - $module_names= Database::prepare( |
|
40 | - "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
41 | - )->fetchOneColumn(); |
|
39 | + $module_names= Database::prepare( |
|
40 | + "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
41 | + )->fetchOneColumn(); |
|
42 | 42 | |
43 | - if($ihooks !== null){ |
|
44 | - foreach ($ihooks as $ihook => $params) { |
|
45 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | - $array_hook = explode('#', $ihook); |
|
47 | - //Update status |
|
48 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
49 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | - $previous_status = $params['status']; |
|
51 | - if ($new_status !== null) { |
|
52 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
53 | - if($new_status != $previous_status){ |
|
54 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
55 | - switch($new_status){ |
|
56 | - case 'enabled': |
|
57 | - $chook->enable($array_hook[0]); |
|
58 | - break; |
|
59 | - case 'disabled': |
|
60 | - $chook->disable($array_hook[0]); |
|
61 | - break; |
|
62 | - default: |
|
63 | - break; |
|
64 | - } |
|
65 | - } |
|
66 | - } |
|
43 | + if($ihooks !== null){ |
|
44 | + foreach ($ihooks as $ihook => $params) { |
|
45 | + if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | + $array_hook = explode('#', $ihook); |
|
47 | + //Update status |
|
48 | + $new_status= Filter::postBool('status-' . $params['id']); |
|
49 | + if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | + $previous_status = $params['status']; |
|
51 | + if ($new_status !== null) { |
|
52 | + $new_status= $new_status ? 'enabled' : 'disabled'; |
|
53 | + if($new_status != $previous_status){ |
|
54 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
55 | + switch($new_status){ |
|
56 | + case 'enabled': |
|
57 | + $chook->enable($array_hook[0]); |
|
58 | + break; |
|
59 | + case 'disabled': |
|
60 | + $chook->disable($array_hook[0]); |
|
61 | + break; |
|
62 | + default: |
|
63 | + break; |
|
64 | + } |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - //Update priority |
|
69 | - $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
70 | - $previous_priority = $params['priority']; |
|
71 | - if ($new_priority !== null) { |
|
72 | - if($new_priority != $previous_priority){ |
|
73 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
74 | - $chook->setPriority($array_hook[0], $new_priority); |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
68 | + //Update priority |
|
69 | + $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
70 | + $previous_priority = $params['priority']; |
|
71 | + if ($new_priority !== null) { |
|
72 | + if($new_priority != $previous_priority){ |
|
73 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
74 | + $chook->setPriority($array_hook[0], $new_priority); |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Pages |
|
85 | - */ |
|
83 | + /** |
|
84 | + * Pages |
|
85 | + */ |
|
86 | 86 | |
87 | - /** |
|
88 | - * AdminConfig@index |
|
89 | - */ |
|
90 | - public function index() { |
|
91 | - global $WT_TREE; |
|
87 | + /** |
|
88 | + * AdminConfig@index |
|
89 | + */ |
|
90 | + public function index() { |
|
91 | + global $WT_TREE; |
|
92 | 92 | |
93 | - HookProvider::updateHooks(); |
|
93 | + HookProvider::updateHooks(); |
|
94 | 94 | |
95 | - $action = Filter::post('action'); |
|
96 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
95 | + $action = Filter::post('action'); |
|
96 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
97 | 97 | |
98 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
99 | - $ctrl = new PageController(); |
|
100 | - $ctrl |
|
101 | - ->restrictAccess(Auth::isAdmin()) |
|
102 | - ->setPageTitle($this->module->getTitle()); |
|
98 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
99 | + $ctrl = new PageController(); |
|
100 | + $ctrl |
|
101 | + ->restrictAccess(Auth::isAdmin()) |
|
102 | + ->setPageTitle($this->module->getTitle()); |
|
103 | 103 | |
104 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
104 | + $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
105 | 105 | |
106 | - $view_bag = new ViewBag(); |
|
107 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
108 | - $view_bag->set('table_id', $table_id); |
|
109 | - $view_bag->set('hook_list', HookProvider::getRawInstalledHooks()); |
|
106 | + $view_bag = new ViewBag(); |
|
107 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
108 | + $view_bag->set('table_id', $table_id); |
|
109 | + $view_bag->set('hook_list', HookProvider::getRawInstalledHooks()); |
|
110 | 110 | |
111 | - $ctrl |
|
112 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
113 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
114 | - ->addInlineJavascript(' |
|
111 | + $ctrl |
|
112 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
113 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
114 | + ->addInlineJavascript(' |
|
115 | 115 | jQuery(document).ready(function() { |
116 | 116 | jQuery("#'.$table_id.'").dataTable( { |
117 | 117 | '.I18N::datatablesI18N().', |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | }); |
132 | 132 | '); |
133 | 133 | |
134 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
135 | - } |
|
134 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
135 | + } |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | \ No newline at end of file |
@@ -29,142 +29,142 @@ discard block |
||
29 | 29 | * Certificates Module. |
30 | 30 | */ |
31 | 31 | class CertificatesModule |
32 | - extends AbstractModule |
|
33 | - implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface |
|
32 | + extends AbstractModule |
|
33 | + implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface |
|
34 | 34 | { |
35 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
36 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
35 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
36 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Provider for Certificates |
|
40 | - * @var CertificateProviderInterface $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * Provider for Certificates |
|
40 | + * @var CertificateProviderInterface $provider |
|
41 | + */ |
|
42 | + protected $provider; |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inhericDoc} |
|
46 | - */ |
|
47 | - public function getTitle() { |
|
48 | - return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
49 | - } |
|
44 | + /** |
|
45 | + * {@inhericDoc} |
|
46 | + */ |
|
47 | + public function getTitle() { |
|
48 | + return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inhericDoc} |
|
53 | - */ |
|
54 | - public function getDescription() { |
|
55 | - return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
56 | - } |
|
51 | + /** |
|
52 | + * {@inhericDoc} |
|
53 | + */ |
|
54 | + public function getDescription() { |
|
55 | + return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * {@inhericDoc} |
|
60 | - */ |
|
61 | - public function modAction($mod_action) { |
|
62 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
63 | - } |
|
58 | + /** |
|
59 | + * {@inhericDoc} |
|
60 | + */ |
|
61 | + public function modAction($mod_action) { |
|
62 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * {@inhericDoc} |
|
67 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
68 | - */ |
|
69 | - public function getConfigLink() { |
|
70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | - } |
|
65 | + /** |
|
66 | + * {@inhericDoc} |
|
67 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
68 | + */ |
|
69 | + public function getConfigLink() { |
|
70 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inhericDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
76 | - */ |
|
77 | - public function getSubscribedHooks() { |
|
78 | - return array( |
|
79 | - 'hFactSourcePrepend' => 50, |
|
80 | - 'hGetExpectedTags' => 50, |
|
81 | - 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
82 | - 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
83 | - 'hAddSimpleTag#SOUR' => 50, |
|
84 | - 'hHasHelpTextTag#_ACT' => 50, |
|
85 | - 'hGetHelpTextTag#_ACT' => 50 |
|
86 | - ); |
|
87 | - } |
|
73 | + /** |
|
74 | + * {@inhericDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
76 | + */ |
|
77 | + public function getSubscribedHooks() { |
|
78 | + return array( |
|
79 | + 'hFactSourcePrepend' => 50, |
|
80 | + 'hGetExpectedTags' => 50, |
|
81 | + 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
82 | + 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
83 | + 'hAddSimpleTag#SOUR' => 50, |
|
84 | + 'hHasHelpTextTag#_ACT' => 50, |
|
85 | + 'hGetHelpTextTag#_ACT' => 50 |
|
86 | + ); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * {@inhericDoc} |
|
91 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
92 | - */ |
|
93 | - public function getMenu(Tree $tree, $reference = null) { |
|
94 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
95 | - return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
96 | - } |
|
89 | + /** |
|
90 | + * {@inhericDoc} |
|
91 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
92 | + */ |
|
93 | + public function getMenu(Tree $tree, $reference = null) { |
|
94 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
95 | + return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * {@inhericDoc} |
|
100 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
101 | - */ |
|
102 | - public function hFactSourcePrepend($srec) { |
|
103 | - global $WT_TREE; |
|
98 | + /** |
|
99 | + * {@inhericDoc} |
|
100 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
101 | + */ |
|
102 | + public function hFactSourcePrepend($srec) { |
|
103 | + global $WT_TREE; |
|
104 | 104 | |
105 | - $html=''; |
|
106 | - $sid=null; |
|
105 | + $html=''; |
|
106 | + $sid=null; |
|
107 | 107 | |
108 | - if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
|
109 | - if (!$srec || strlen($srec) == 0) return $html; |
|
108 | + if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
|
109 | + if (!$srec || strlen($srec) == 0) return $html; |
|
110 | 110 | |
111 | - $certificate = null; |
|
112 | - $subrecords = explode("\n", $srec); |
|
113 | - $levelSOUR = substr($subrecords[0], 0, 1); |
|
114 | - if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
115 | - $sid=$match[1]; |
|
116 | - }; |
|
117 | - $nb_subrecords = count($subrecords); |
|
118 | - for ($i=0; $i < $nb_subrecords; $i++) { |
|
119 | - $subrecords[$i] = trim($subrecords[$i]); |
|
120 | - $tag = substr($subrecords[$i], 2, 4); |
|
121 | - $text = substr($subrecords[$i], 7); |
|
122 | - if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
123 | - } |
|
111 | + $certificate = null; |
|
112 | + $subrecords = explode("\n", $srec); |
|
113 | + $levelSOUR = substr($subrecords[0], 0, 1); |
|
114 | + if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
115 | + $sid=$match[1]; |
|
116 | + }; |
|
117 | + $nb_subrecords = count($subrecords); |
|
118 | + for ($i=0; $i < $nb_subrecords; $i++) { |
|
119 | + $subrecords[$i] = trim($subrecords[$i]); |
|
120 | + $tag = substr($subrecords[$i], 2, 4); |
|
121 | + $text = substr($subrecords[$i], 7); |
|
122 | + if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
123 | + } |
|
124 | 124 | |
125 | - if($certificate && $certificate->canShow()) |
|
126 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
125 | + if($certificate && $certificate->canShow()) |
|
126 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
127 | 127 | |
128 | - } |
|
129 | - return $html; |
|
130 | - } |
|
128 | + } |
|
129 | + return $html; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * {@inhericDoc} |
|
134 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
135 | - */ |
|
136 | - public function hFactSourceAppend($srec) { } |
|
132 | + /** |
|
133 | + * {@inhericDoc} |
|
134 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
135 | + */ |
|
136 | + public function hFactSourceAppend($srec) { } |
|
137 | 137 | |
138 | - /** |
|
139 | - * {@inhericDoc} |
|
140 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
141 | - */ |
|
142 | - public function hGetExpectedTags() { |
|
143 | - return array('SOUR' => '_ACT'); |
|
144 | - } |
|
138 | + /** |
|
139 | + * {@inhericDoc} |
|
140 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
141 | + */ |
|
142 | + public function hGetExpectedTags() { |
|
143 | + return array('SOUR' => '_ACT'); |
|
144 | + } |
|
145 | 145 | |
146 | - /** |
|
147 | - * {@inhericDoc} |
|
148 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
149 | - */ |
|
150 | - public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
151 | - $html = ''; |
|
152 | - switch($tag){ |
|
153 | - case '_ACT': |
|
154 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
155 | - break; |
|
156 | - } |
|
157 | - return $html; |
|
158 | - } |
|
146 | + /** |
|
147 | + * {@inhericDoc} |
|
148 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
149 | + */ |
|
150 | + public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
151 | + $html = ''; |
|
152 | + switch($tag){ |
|
153 | + case '_ACT': |
|
154 | + if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
155 | + break; |
|
156 | + } |
|
157 | + return $html; |
|
158 | + } |
|
159 | 159 | |
160 | - /** |
|
161 | - * {@inhericDoc} |
|
162 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
163 | - */ |
|
164 | - public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
165 | - global $controller, $WT_TREE; |
|
160 | + /** |
|
161 | + * {@inhericDoc} |
|
162 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
163 | + */ |
|
164 | + public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
165 | + global $controller, $WT_TREE; |
|
166 | 166 | |
167 | - $html = ''; |
|
167 | + $html = ''; |
|
168 | 168 | |
169 | 169 | switch($tag){ |
170 | 170 | case '_ACT': |
@@ -192,78 +192,78 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | return $html; |
195 | - } |
|
195 | + } |
|
196 | 196 | |
197 | - /** |
|
198 | - * {@inhericDoc} |
|
199 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
200 | - */ |
|
201 | - public function hAddSimpleTag($context, $level) { |
|
202 | - switch($context){ |
|
203 | - case 'SOUR': |
|
204 | - FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
205 | - break; |
|
206 | - } |
|
207 | - } |
|
197 | + /** |
|
198 | + * {@inhericDoc} |
|
199 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
200 | + */ |
|
201 | + public function hAddSimpleTag($context, $level) { |
|
202 | + switch($context){ |
|
203 | + case 'SOUR': |
|
204 | + FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
205 | + break; |
|
206 | + } |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * {@inhericDoc} |
|
211 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
212 | - */ |
|
213 | - public function hHasHelpTextTag($tag) { |
|
214 | - switch($tag){ |
|
209 | + /** |
|
210 | + * {@inhericDoc} |
|
211 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
212 | + */ |
|
213 | + public function hHasHelpTextTag($tag) { |
|
214 | + switch($tag){ |
|
215 | 215 | case '_ACT': |
216 | 216 | return true; |
217 | 217 | break; |
218 | 218 | } |
219 | 219 | return false; |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * {@inhericDoc} |
|
224 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
225 | - */ |
|
226 | - public function hGetHelpTextTag($tag) { |
|
227 | - switch($tag){ |
|
228 | - case '_ACT': |
|
229 | - return array( |
|
230 | - I18N::translate('Certificate'), |
|
231 | - '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
232 | - default: |
|
233 | - return null; |
|
234 | - } |
|
235 | - } |
|
222 | + /** |
|
223 | + * {@inhericDoc} |
|
224 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
225 | + */ |
|
226 | + public function hGetHelpTextTag($tag) { |
|
227 | + switch($tag){ |
|
228 | + case '_ACT': |
|
229 | + return array( |
|
230 | + I18N::translate('Certificate'), |
|
231 | + '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
232 | + default: |
|
233 | + return null; |
|
234 | + } |
|
235 | + } |
|
236 | 236 | |
237 | - /** |
|
238 | - * Returns the default Certificate File Provider, as configured in the module |
|
239 | - * |
|
240 | - * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
241 | - */ |
|
242 | - public function getProvider() { |
|
243 | - global $WT_TREE; |
|
237 | + /** |
|
238 | + * Returns the default Certificate File Provider, as configured in the module |
|
239 | + * |
|
240 | + * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
241 | + */ |
|
242 | + public function getProvider() { |
|
243 | + global $WT_TREE; |
|
244 | 244 | |
245 | - if(!$this->provider) { |
|
246 | - $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
247 | - $this->provider = new CertificateFileProvider($root_path, $WT_TREE); |
|
248 | - } |
|
249 | - return $this->provider; |
|
250 | - } |
|
245 | + if(!$this->provider) { |
|
246 | + $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
247 | + $this->provider = new CertificateFileProvider($root_path, $WT_TREE); |
|
248 | + } |
|
249 | + return $this->provider; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | |
253 | - /** |
|
254 | - * Return the HTML code for custom simple tag _ACT |
|
255 | - * |
|
256 | - * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
257 | - * @param string|null $sid Linked Source ID, if it exists |
|
258 | - */ |
|
259 | - protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
260 | - $html = ''; |
|
261 | - if($certificate){ |
|
262 | - $certificate->setSource($sid); |
|
263 | - $html = $certificate->displayImage('icon'); |
|
264 | - } |
|
265 | - return $html; |
|
266 | - } |
|
253 | + /** |
|
254 | + * Return the HTML code for custom simple tag _ACT |
|
255 | + * |
|
256 | + * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
257 | + * @param string|null $sid Linked Source ID, if it exists |
|
258 | + */ |
|
259 | + protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
260 | + $html = ''; |
|
261 | + if($certificate){ |
|
262 | + $certificate->setSource($sid); |
|
263 | + $html = $certificate->displayImage('icon'); |
|
264 | + } |
|
265 | + return $html; |
|
266 | + } |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
270 | 270 | \ No newline at end of file |
@@ -25,215 +25,215 @@ |
||
25 | 25 | */ |
26 | 26 | class SosaStatsController extends MvcController |
27 | 27 | { |
28 | - /** |
|
29 | - * Sosa Provider for the controller |
|
30 | - * @var SosaProvider $sosa_provider |
|
31 | - */ |
|
32 | - protected $sosa_provider; |
|
28 | + /** |
|
29 | + * Sosa Provider for the controller |
|
30 | + * @var SosaProvider $sosa_provider |
|
31 | + */ |
|
32 | + protected $sosa_provider; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Constructor for SosaStatsController |
|
36 | - * @param AbstractModule $module |
|
37 | - */ |
|
38 | - public function __construct(AbstractModule $module) { |
|
39 | - global $WT_TREE; |
|
34 | + /** |
|
35 | + * Constructor for SosaStatsController |
|
36 | + * @param AbstractModule $module |
|
37 | + */ |
|
38 | + public function __construct(AbstractModule $module) { |
|
39 | + global $WT_TREE; |
|
40 | 40 | |
41 | - parent::__construct($module); |
|
41 | + parent::__construct($module); |
|
42 | 42 | |
43 | - $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
44 | - } |
|
43 | + $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Pages |
|
48 | - */ |
|
46 | + /** |
|
47 | + * Pages |
|
48 | + */ |
|
49 | 49 | |
50 | - /** |
|
51 | - * SosaStats@index |
|
52 | - */ |
|
53 | - public function index() { |
|
54 | - global $WT_TREE; |
|
50 | + /** |
|
51 | + * SosaStats@index |
|
52 | + */ |
|
53 | + public function index() { |
|
54 | + global $WT_TREE; |
|
55 | 55 | |
56 | - $controller = new PageController(); |
|
57 | - $controller |
|
58 | - ->setPageTitle(I18N::translate('Sosa Statistics')) |
|
59 | - ->addInlineJavascript('$(".help_tooltip").tooltip();') |
|
60 | - ; |
|
56 | + $controller = new PageController(); |
|
57 | + $controller |
|
58 | + ->setPageTitle(I18N::translate('Sosa Statistics')) |
|
59 | + ->addInlineJavascript('$(".help_tooltip").tooltip();') |
|
60 | + ; |
|
61 | 61 | |
62 | - $view_bag = new ViewBag(); |
|
63 | - $view_bag->set('title', $controller->getPageTitle()); |
|
64 | - $view_bag->set('is_setup', false); |
|
62 | + $view_bag = new ViewBag(); |
|
63 | + $view_bag->set('title', $controller->getPageTitle()); |
|
64 | + $view_bag->set('is_setup', false); |
|
65 | 65 | |
66 | - if($this->sosa_provider->isSetup()) { |
|
67 | - $view_bag->set('is_setup', true); |
|
66 | + if($this->sosa_provider->isSetup()) { |
|
67 | + $view_bag->set('is_setup', true); |
|
68 | 68 | |
69 | - $sosaCount = $this->sosa_provider->getSosaCount(); |
|
70 | - $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); |
|
69 | + $sosaCount = $this->sosa_provider->getSosaCount(); |
|
70 | + $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); |
|
71 | 71 | |
72 | - $general_stats = array( |
|
73 | - 'sosa_count' => $sosaCount, |
|
74 | - 'distinct_count' => $diffSosaCount, |
|
75 | - 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), |
|
76 | - 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), |
|
77 | - 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime() |
|
78 | - ); |
|
79 | - $view_bag->set('general_stats', $general_stats); |
|
72 | + $general_stats = array( |
|
73 | + 'sosa_count' => $sosaCount, |
|
74 | + 'distinct_count' => $diffSosaCount, |
|
75 | + 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), |
|
76 | + 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), |
|
77 | + 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime() |
|
78 | + ); |
|
79 | + $view_bag->set('general_stats', $general_stats); |
|
80 | 80 | |
81 | - $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); |
|
82 | - $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
81 | + $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); |
|
82 | + $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
83 | 83 | |
84 | - $gen_theoretical=1; |
|
85 | - $total_theoretical=0; |
|
86 | - $prev_diff=0; |
|
87 | - $prev_known=0.5; |
|
88 | - $gen_equiv=0; |
|
89 | - $generation_stats = array(); |
|
84 | + $gen_theoretical=1; |
|
85 | + $total_theoretical=0; |
|
86 | + $prev_diff=0; |
|
87 | + $prev_known=0.5; |
|
88 | + $gen_equiv=0; |
|
89 | + $generation_stats = array(); |
|
90 | 90 | |
91 | - foreach($stats_gen as $gen => $tab){ |
|
92 | - $genY1= I18N::translate('-'); |
|
93 | - $genY2= I18N::translate('-'); |
|
94 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
95 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
96 | - $total_theoretical += $gen_theoretical; |
|
97 | - $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
|
98 | - $gen_equiv += $perc_sosa_count_theor; |
|
99 | - $missing=2*$prev_known - $tab['sosaCount']; |
|
100 | - $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
91 | + foreach($stats_gen as $gen => $tab){ |
|
92 | + $genY1= I18N::translate('-'); |
|
93 | + $genY2= I18N::translate('-'); |
|
94 | + if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
95 | + if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
96 | + $total_theoretical += $gen_theoretical; |
|
97 | + $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
|
98 | + $gen_equiv += $perc_sosa_count_theor; |
|
99 | + $missing=2*$prev_known - $tab['sosaCount']; |
|
100 | + $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
101 | 101 | |
102 | - $generation_stats[$gen] = array( |
|
103 | - 'gen_min_birth' => $genY1, |
|
104 | - 'gen_max_birth' => $genY2, |
|
105 | - 'theoretical' => $gen_theoretical, |
|
106 | - 'known' => $tab['sosaCount'], |
|
107 | - 'perc_known' => $perc_sosa_count_theor, |
|
108 | - 'missing' => $missing, |
|
109 | - 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
110 | - 'total_known' => $tab['sosaTotalCount'], |
|
111 | - 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
|
112 | - 'different' => $gen_diff, |
|
113 | - 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), |
|
114 | - 'total_different' => $tab['diffSosaTotalCount'], |
|
115 | - 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount']) |
|
116 | - ); |
|
102 | + $generation_stats[$gen] = array( |
|
103 | + 'gen_min_birth' => $genY1, |
|
104 | + 'gen_max_birth' => $genY2, |
|
105 | + 'theoretical' => $gen_theoretical, |
|
106 | + 'known' => $tab['sosaCount'], |
|
107 | + 'perc_known' => $perc_sosa_count_theor, |
|
108 | + 'missing' => $missing, |
|
109 | + 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
110 | + 'total_known' => $tab['sosaTotalCount'], |
|
111 | + 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
|
112 | + 'different' => $gen_diff, |
|
113 | + 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), |
|
114 | + 'total_different' => $tab['diffSosaTotalCount'], |
|
115 | + 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount']) |
|
116 | + ); |
|
117 | 117 | |
118 | - $gen_theoretical = $gen_theoretical * 2; |
|
119 | - $prev_known=$tab['sosaCount']; |
|
120 | - $prev_diff=$tab['diffSosaTotalCount']; |
|
121 | - } |
|
118 | + $gen_theoretical = $gen_theoretical * 2; |
|
119 | + $prev_known=$tab['sosaCount']; |
|
120 | + $prev_diff=$tab['diffSosaTotalCount']; |
|
121 | + } |
|
122 | 122 | |
123 | - $view_bag->set('generation_stats', $generation_stats); |
|
124 | - $view_bag->set('equivalent_gen', $gen_equiv); |
|
123 | + $view_bag->set('generation_stats', $generation_stats); |
|
124 | + $view_bag->set('equivalent_gen', $gen_equiv); |
|
125 | 125 | |
126 | - $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); |
|
127 | - $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); |
|
126 | + $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); |
|
127 | + $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); |
|
132 | - } |
|
131 | + ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * Returns HTML code for a graph showing the dispersion of ancestors across father & mother |
|
136 | - * @return string HTML code |
|
137 | - */ |
|
138 | - private function htmlAncestorDispersionG2() |
|
139 | - { |
|
140 | - $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
|
141 | - if(count($ancestorsDispGen2) == 0) return; |
|
134 | + /** |
|
135 | + * Returns HTML code for a graph showing the dispersion of ancestors across father & mother |
|
136 | + * @return string HTML code |
|
137 | + */ |
|
138 | + private function htmlAncestorDispersionG2() |
|
139 | + { |
|
140 | + $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
|
141 | + if(count($ancestorsDispGen2) == 0) return; |
|
142 | 142 | |
143 | - $size = '600x300'; |
|
143 | + $size = '600x300'; |
|
144 | 144 | |
145 | - $total = array_sum($ancestorsDispGen2); |
|
146 | - $father_count = isset($ancestorsDispGen2[1]) ? $ancestorsDispGen2[1] : 0; |
|
147 | - $father = array ( |
|
148 | - 'color' => '84beff', |
|
149 | - 'count' => $father_count, |
|
150 | - 'perc' => Functions::safeDivision($father_count, $total), |
|
151 | - 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
|
152 | - ); |
|
153 | - $mother_count = isset($ancestorsDispGen2[2]) ? $ancestorsDispGen2[2] : 0; |
|
154 | - $mother = array ( |
|
155 | - 'color' => 'ffd1dc', |
|
156 | - 'count' => $mother_count, |
|
157 | - 'perc' => Functions::safeDivision($mother_count, $total), |
|
158 | - 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
|
159 | - ); |
|
160 | - $shared_count = isset($ancestorsDispGen2[-1]) ? $ancestorsDispGen2[-1] : 0; |
|
161 | - $shared = array ( |
|
162 | - 'color' => '777777', |
|
163 | - 'count' => $shared_count, |
|
164 | - 'perc' => Functions::safeDivision($shared_count, $total), |
|
165 | - 'name' => I18N::translate('Shared') |
|
166 | - ); |
|
145 | + $total = array_sum($ancestorsDispGen2); |
|
146 | + $father_count = isset($ancestorsDispGen2[1]) ? $ancestorsDispGen2[1] : 0; |
|
147 | + $father = array ( |
|
148 | + 'color' => '84beff', |
|
149 | + 'count' => $father_count, |
|
150 | + 'perc' => Functions::safeDivision($father_count, $total), |
|
151 | + 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
|
152 | + ); |
|
153 | + $mother_count = isset($ancestorsDispGen2[2]) ? $ancestorsDispGen2[2] : 0; |
|
154 | + $mother = array ( |
|
155 | + 'color' => 'ffd1dc', |
|
156 | + 'count' => $mother_count, |
|
157 | + 'perc' => Functions::safeDivision($mother_count, $total), |
|
158 | + 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
|
159 | + ); |
|
160 | + $shared_count = isset($ancestorsDispGen2[-1]) ? $ancestorsDispGen2[-1] : 0; |
|
161 | + $shared = array ( |
|
162 | + 'color' => '777777', |
|
163 | + 'count' => $shared_count, |
|
164 | + 'perc' => Functions::safeDivision($shared_count, $total), |
|
165 | + 'name' => I18N::translate('Shared') |
|
166 | + ); |
|
167 | 167 | |
168 | - $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
|
169 | - $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
|
170 | - $chl = |
|
171 | - $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
172 | - $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
173 | - $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
174 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
175 | - } |
|
168 | + $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
|
169 | + $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
|
170 | + $chl = |
|
171 | + $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
172 | + $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
173 | + $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
174 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
175 | + } |
|
176 | 176 | |
177 | - /** |
|
178 | - * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents |
|
179 | - * @return string HTML code |
|
180 | - */ |
|
181 | - private function htmlAncestorDispersionG3() |
|
182 | - { |
|
183 | - $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3); |
|
177 | + /** |
|
178 | + * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents |
|
179 | + * @return string HTML code |
|
180 | + */ |
|
181 | + private function htmlAncestorDispersionG3() |
|
182 | + { |
|
183 | + $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3); |
|
184 | 184 | |
185 | - $size = '700x300'; |
|
185 | + $size = '700x300'; |
|
186 | 186 | |
187 | - $color_motmot = 'ffd1dc'; |
|
188 | - $color_motfat = 'b998a0'; |
|
189 | - $color_fatfat = '577292'; |
|
190 | - $color_fatmot = '84beff'; |
|
191 | - $color_shared = '777777'; |
|
187 | + $color_motmot = 'ffd1dc'; |
|
188 | + $color_motfat = 'b998a0'; |
|
189 | + $color_fatfat = '577292'; |
|
190 | + $color_fatmot = '84beff'; |
|
191 | + $color_shared = '777777'; |
|
192 | 192 | |
193 | - $total_fatfat = $ancestorsDispGen2[1] ?: 0; |
|
194 | - $total_fatmot = $ancestorsDispGen2[2] ?: 0; |
|
195 | - $total_motfat = $ancestorsDispGen2[4] ?: 0; |
|
196 | - $total_motmot = $ancestorsDispGen2[8] ?: 0; |
|
197 | - $total_sha = $ancestorsDispGen2[-1] ?: 0; |
|
198 | - $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
193 | + $total_fatfat = $ancestorsDispGen2[1] ?: 0; |
|
194 | + $total_fatmot = $ancestorsDispGen2[2] ?: 0; |
|
195 | + $total_motfat = $ancestorsDispGen2[4] ?: 0; |
|
196 | + $total_motmot = $ancestorsDispGen2[8] ?: 0; |
|
197 | + $total_sha = $ancestorsDispGen2[-1] ?: 0; |
|
198 | + $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
199 | 199 | |
200 | - $chd = $this->arrayToExtendedEncoding(array( |
|
201 | - 4095 * $total_fatfat / $total, |
|
202 | - 4095 * $total_fatmot / $total, |
|
203 | - 4095 * $total_sha / $total, |
|
204 | - 4095 * $total_motfat / $total, |
|
205 | - 4095 * $total_motmot / $total |
|
206 | - )); |
|
207 | - $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
|
208 | - $chl = |
|
209 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
210 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
211 | - I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
212 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
213 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
214 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
215 | - } |
|
200 | + $chd = $this->arrayToExtendedEncoding(array( |
|
201 | + 4095 * $total_fatfat / $total, |
|
202 | + 4095 * $total_fatmot / $total, |
|
203 | + 4095 * $total_sha / $total, |
|
204 | + 4095 * $total_motfat / $total, |
|
205 | + 4095 * $total_motmot / $total |
|
206 | + )); |
|
207 | + $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
|
208 | + $chl = |
|
209 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
210 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
211 | + I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
212 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
213 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
214 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
215 | + } |
|
216 | 216 | |
217 | - /** |
|
218 | - * Convert an array to Google Chart encoding |
|
219 | - * @param arrat $a Array to encode |
|
220 | - * @return string |
|
221 | - */ |
|
222 | - private function arrayToExtendedEncoding($a) { |
|
223 | - $xencoding = WT_GOOGLE_CHART_ENCODING; |
|
217 | + /** |
|
218 | + * Convert an array to Google Chart encoding |
|
219 | + * @param arrat $a Array to encode |
|
220 | + * @return string |
|
221 | + */ |
|
222 | + private function arrayToExtendedEncoding($a) { |
|
223 | + $xencoding = WT_GOOGLE_CHART_ENCODING; |
|
224 | 224 | |
225 | - $encoding = ''; |
|
226 | - foreach ($a as $value) { |
|
227 | - if ($value < 0) { |
|
228 | - $value = 0; |
|
229 | - } |
|
230 | - $first = (int) ($value / 64); |
|
231 | - $second = $value % 64; |
|
232 | - $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
233 | - } |
|
225 | + $encoding = ''; |
|
226 | + foreach ($a as $value) { |
|
227 | + if ($value < 0) { |
|
228 | + $value = 0; |
|
229 | + } |
|
230 | + $first = (int) ($value / 64); |
|
231 | + $second = $value % 64; |
|
232 | + $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
233 | + } |
|
234 | 234 | |
235 | - return $encoding; |
|
236 | - } |
|
235 | + return $encoding; |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | 239 | } |
240 | 240 | \ No newline at end of file |
@@ -35,59 +35,59 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class AdminConfigController extends MvcController |
37 | 37 | { |
38 | - /** |
|
39 | - * GeoAnalysis Provider |
|
40 | - * @var GeoAnalysisProvider $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * GeoAnalysis Provider |
|
40 | + * @var GeoAnalysisProvider $provider |
|
41 | + */ |
|
42 | + protected $provider; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor for Admin Config controller |
|
46 | - * @param AbstractModule $module |
|
47 | - */ |
|
48 | - public function __construct(AbstractModule $module) { |
|
49 | - parent::__construct($module); |
|
44 | + /** |
|
45 | + * Constructor for Admin Config controller |
|
46 | + * @param AbstractModule $module |
|
47 | + */ |
|
48 | + public function __construct(AbstractModule $module) { |
|
49 | + parent::__construct($module); |
|
50 | 50 | |
51 | - $this->provider = $this->module->getProvider(); |
|
52 | - } |
|
51 | + $this->provider = $this->module->getProvider(); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Pages |
|
56 | - */ |
|
54 | + /** |
|
55 | + * Pages |
|
56 | + */ |
|
57 | 57 | |
58 | - /** |
|
59 | - * AdminConfig@index |
|
60 | - */ |
|
61 | - public function index() { |
|
62 | - global $WT_TREE; |
|
58 | + /** |
|
59 | + * AdminConfig@index |
|
60 | + */ |
|
61 | + public function index() { |
|
62 | + global $WT_TREE; |
|
63 | 63 | |
64 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
65 | - $controller = new PageController(); |
|
66 | - $controller |
|
67 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
68 | - ->setPageTitle($this->module->getTitle()); |
|
64 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
65 | + $controller = new PageController(); |
|
66 | + $controller |
|
67 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
68 | + ->setPageTitle($this->module->getTitle()); |
|
69 | 69 | |
70 | - $data = new ViewBag(); |
|
71 | - $data->set('title', $controller->getPageTitle()); |
|
72 | - $data->set('tree', $WT_TREE); |
|
70 | + $data = new ViewBag(); |
|
71 | + $data->set('title', $controller->getPageTitle()); |
|
72 | + $data->set('tree', $WT_TREE); |
|
73 | 73 | |
74 | - $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
74 | + $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
75 | 75 | |
76 | - $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
77 | - $data->set('table_id', $table_id); |
|
76 | + $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
77 | + $data->set('table_id', $table_id); |
|
78 | 78 | |
79 | - $other_trees = array(); |
|
80 | - foreach (Tree::getAll() as $tree) { |
|
81 | - if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
82 | - } |
|
83 | - $data->set('other_trees', $other_trees); |
|
79 | + $other_trees = array(); |
|
80 | + foreach (Tree::getAll() as $tree) { |
|
81 | + if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
82 | + } |
|
83 | + $data->set('other_trees', $other_trees); |
|
84 | 84 | |
85 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
85 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
86 | 86 | |
87 | - $controller |
|
88 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
89 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
90 | - ->addInlineJavascript(' |
|
87 | + $controller |
|
88 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
89 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
90 | + ->addInlineJavascript(' |
|
91 | 91 | //Datatable initialisation |
92 | 92 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
93 | 93 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | }); |
123 | 123 | |
124 | 124 | ') |
125 | - ->addInlineJavascript(' |
|
125 | + ->addInlineJavascript(' |
|
126 | 126 | function set_geoanalysis_status(ga_id, status, gedcom) { |
127 | 127 | jQuery.ajax({ |
128 | 128 | url: "module.php", |
@@ -166,55 +166,55 @@ discard block |
||
166 | 166 | '); |
167 | 167 | |
168 | 168 | |
169 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
170 | - } |
|
169 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
170 | + } |
|
171 | 171 | |
172 | - /** |
|
173 | - * AdminConfig@jsonGeoAnalysisList |
|
174 | - */ |
|
175 | - public function jsonGeoAnalysisList() { |
|
176 | - global $WT_TREE; |
|
172 | + /** |
|
173 | + * AdminConfig@jsonGeoAnalysisList |
|
174 | + */ |
|
175 | + public function jsonGeoAnalysisList() { |
|
176 | + global $WT_TREE; |
|
177 | 177 | |
178 | - $controller = new JsonController(); |
|
179 | - $controller |
|
180 | - ->restrictAccess(Auth::isManager($WT_TREE)); |
|
178 | + $controller = new JsonController(); |
|
179 | + $controller |
|
180 | + ->restrictAccess(Auth::isManager($WT_TREE)); |
|
181 | 181 | |
182 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
183 | - $search = Filter::postArray('search'); |
|
184 | - if($search) $search = $search['value']; |
|
185 | - $start = Filter::postInteger('start'); |
|
186 | - $length = Filter::postInteger('length'); |
|
187 | - $order = Filter::postArray('order'); |
|
182 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
183 | + $search = Filter::postArray('search'); |
|
184 | + if($search) $search = $search['value']; |
|
185 | + $start = Filter::postInteger('start'); |
|
186 | + $length = Filter::postInteger('length'); |
|
187 | + $order = Filter::postArray('order'); |
|
188 | 188 | |
189 | - foreach($order as $key => &$value) { |
|
190 | - switch($value['column']) { |
|
191 | - case 3: |
|
192 | - $value['column'] = 'majgd_descr'; |
|
193 | - break; |
|
194 | - case 5; |
|
195 | - $value['column'] = 'majgd_sublevel'; |
|
196 | - break; |
|
197 | - default: |
|
198 | - unset($order[$key]); |
|
199 | - } |
|
200 | - } |
|
189 | + foreach($order as $key => &$value) { |
|
190 | + switch($value['column']) { |
|
191 | + case 3: |
|
192 | + $value['column'] = 'majgd_descr'; |
|
193 | + break; |
|
194 | + case 5; |
|
195 | + $value['column'] = 'majgd_sublevel'; |
|
196 | + break; |
|
197 | + default: |
|
198 | + unset($order[$key]); |
|
199 | + } |
|
200 | + } |
|
201 | 201 | |
202 | - /** @var GeoAnalysisProvider $provider */ |
|
203 | - $provider = $this->module->getProvider(); |
|
202 | + /** @var GeoAnalysisProvider $provider */ |
|
203 | + $provider = $this->module->getProvider(); |
|
204 | 204 | |
205 | - $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
206 | - $recordsFiltered = count($list); |
|
207 | - $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
205 | + $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
206 | + $recordsFiltered = count($list); |
|
207 | + $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
208 | 208 | |
209 | - $data = array(); |
|
210 | - $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
211 | - foreach($list as $ga) { |
|
212 | - /** @var GeoAnalysis $ga */ |
|
209 | + $data = array(); |
|
210 | + $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
211 | + foreach($list as $ga) { |
|
212 | + /** @var GeoAnalysis $ga */ |
|
213 | 213 | |
214 | - $datum = array(); |
|
215 | - $options= $ga->getOptions(); |
|
214 | + $datum = array(); |
|
215 | + $options= $ga->getOptions(); |
|
216 | 216 | |
217 | - $datum[0] = ' |
|
217 | + $datum[0] = ' |
|
218 | 218 | <div class="btn-group"> |
219 | 219 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
220 | 220 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -238,108 +238,108 @@ discard block |
||
238 | 238 | </li> |
239 | 239 | </ul> |
240 | 240 | </div>'; |
241 | - $datum[1] = $ga->getId(); |
|
242 | - $datum[2] = $ga->isEnabled() ? |
|
241 | + $datum[1] = $ga->getId(); |
|
242 | + $datum[2] = $ga->isEnabled() ? |
|
243 | 243 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
244 | 244 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
245 | - $datum[3] = $ga->getTitle(); |
|
246 | - $analysis_level = $ga->getAnalysisLevel(); |
|
247 | - if($place_hierarchy['type'] == 'header') { |
|
248 | - $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
249 | - } else { |
|
250 | - $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
251 | - } |
|
252 | - $datum[5] = $ga->getAnalysisLevel(); |
|
253 | - $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
254 | - $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
255 | - if($ga->hasMap()) { |
|
256 | - $datum[6] = $options->getMap()->getDescription(); |
|
257 | - $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
258 | - $top_level = $options->getMapLevel(); |
|
259 | - if($place_hierarchy['type'] == 'header') { |
|
260 | - $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
261 | - } else { |
|
262 | - $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
263 | - } |
|
264 | - $datum[7] .= '</span>'; |
|
265 | - } |
|
266 | - $datum[8] = $options->isUsingFlags() ? |
|
245 | + $datum[3] = $ga->getTitle(); |
|
246 | + $analysis_level = $ga->getAnalysisLevel(); |
|
247 | + if($place_hierarchy['type'] == 'header') { |
|
248 | + $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
249 | + } else { |
|
250 | + $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
251 | + } |
|
252 | + $datum[5] = $ga->getAnalysisLevel(); |
|
253 | + $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
254 | + $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
255 | + if($ga->hasMap()) { |
|
256 | + $datum[6] = $options->getMap()->getDescription(); |
|
257 | + $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
258 | + $top_level = $options->getMapLevel(); |
|
259 | + if($place_hierarchy['type'] == 'header') { |
|
260 | + $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
261 | + } else { |
|
262 | + $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
263 | + } |
|
264 | + $datum[7] .= '</span>'; |
|
265 | + } |
|
266 | + $datum[8] = $options->isUsingFlags() ? |
|
267 | 267 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
268 | 268 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
269 | - $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
269 | + $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
270 | 270 | |
271 | - $data[] = $datum; |
|
272 | - } |
|
271 | + $data[] = $datum; |
|
272 | + } |
|
273 | 273 | |
274 | - $controller->pageHeader(); |
|
274 | + $controller->pageHeader(); |
|
275 | 275 | |
276 | - echo \Zend_Json::encode(array( |
|
277 | - 'draw' => Filter::getInteger('draw'), |
|
278 | - 'recordsTotal' => $recordsTotal, |
|
279 | - 'recordsFiltered' => $recordsFiltered, |
|
280 | - 'data' => $data |
|
281 | - )); |
|
276 | + echo \Zend_Json::encode(array( |
|
277 | + 'draw' => Filter::getInteger('draw'), |
|
278 | + 'recordsTotal' => $recordsTotal, |
|
279 | + 'recordsFiltered' => $recordsFiltered, |
|
280 | + 'data' => $data |
|
281 | + )); |
|
282 | 282 | |
283 | - } |
|
283 | + } |
|
284 | 284 | |
285 | - /** |
|
286 | - * AdminConfig@edit |
|
287 | - */ |
|
288 | - public function edit() { |
|
289 | - $ga_id = Filter::getInteger('ga_id'); |
|
290 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
285 | + /** |
|
286 | + * AdminConfig@edit |
|
287 | + */ |
|
288 | + public function edit() { |
|
289 | + $ga_id = Filter::getInteger('ga_id'); |
|
290 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
291 | 291 | |
292 | - $this->renderEdit($ga); |
|
293 | - } |
|
292 | + $this->renderEdit($ga); |
|
293 | + } |
|
294 | 294 | |
295 | - /** |
|
296 | - * AdminConfig@add |
|
297 | - */ |
|
298 | - public function add() { |
|
299 | - $this->renderEdit(null); |
|
300 | - } |
|
295 | + /** |
|
296 | + * AdminConfig@add |
|
297 | + */ |
|
298 | + public function add() { |
|
299 | + $this->renderEdit(null); |
|
300 | + } |
|
301 | 301 | |
302 | - /** |
|
303 | - * AdminConfig@save |
|
304 | - */ |
|
305 | - public function save() { |
|
306 | - global $WT_TREE; |
|
302 | + /** |
|
303 | + * AdminConfig@save |
|
304 | + */ |
|
305 | + public function save() { |
|
306 | + global $WT_TREE; |
|
307 | 307 | |
308 | - $tmp_contrl = new PageController(); |
|
309 | - $tmp_contrl->restrictAccess( |
|
310 | - Auth::isManager($WT_TREE) |
|
311 | - && Filter::checkCsrf() |
|
312 | - ); |
|
308 | + $tmp_contrl = new PageController(); |
|
309 | + $tmp_contrl->restrictAccess( |
|
310 | + Auth::isManager($WT_TREE) |
|
311 | + && Filter::checkCsrf() |
|
312 | + ); |
|
313 | 313 | |
314 | - $ga_id = Filter::postInteger('ga_id'); |
|
315 | - $description = Filter::post('description'); |
|
316 | - $analysislevel = Filter::postInteger('analysislevel'); |
|
317 | - $use_map = Filter::postBool('use_map'); |
|
318 | - if($use_map) { |
|
319 | - $map_file = base64_decode(Filter::post('map_file')); |
|
320 | - $map_top_level = Filter::postInteger('map_top_level'); |
|
321 | - } |
|
322 | - $use_flags = Filter::postBool('use_flags'); |
|
323 | - $gen_details = Filter::postInteger('gen_details'); |
|
314 | + $ga_id = Filter::postInteger('ga_id'); |
|
315 | + $description = Filter::post('description'); |
|
316 | + $analysislevel = Filter::postInteger('analysislevel'); |
|
317 | + $use_map = Filter::postBool('use_map'); |
|
318 | + if($use_map) { |
|
319 | + $map_file = base64_decode(Filter::post('map_file')); |
|
320 | + $map_top_level = Filter::postInteger('map_top_level'); |
|
321 | + } |
|
322 | + $use_flags = Filter::postBool('use_flags'); |
|
323 | + $gen_details = Filter::postInteger('gen_details'); |
|
324 | 324 | |
325 | - $success = false; |
|
326 | - if($ga_id) { |
|
327 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
328 | - if($ga) { |
|
329 | - $ga->setTitle($description); |
|
330 | - $ga->setAnalysisLevel($analysislevel + 1); |
|
331 | - $options = $ga->getOptions(); |
|
332 | - if($options) { |
|
333 | - $options->setIsUsingFlags($use_flags); |
|
334 | - $options->setMaxDetailsInGen($gen_details); |
|
335 | - if($use_map) { |
|
336 | - $options->setMap(new OutlineMap($map_file)); |
|
337 | - $options->setMapLevel($map_top_level + 1); |
|
338 | - } |
|
339 | - else { |
|
340 | - $options->setMap(null); |
|
341 | - } |
|
342 | - } |
|
325 | + $success = false; |
|
326 | + if($ga_id) { |
|
327 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
328 | + if($ga) { |
|
329 | + $ga->setTitle($description); |
|
330 | + $ga->setAnalysisLevel($analysislevel + 1); |
|
331 | + $options = $ga->getOptions(); |
|
332 | + if($options) { |
|
333 | + $options->setIsUsingFlags($use_flags); |
|
334 | + $options->setMaxDetailsInGen($gen_details); |
|
335 | + if($use_map) { |
|
336 | + $options->setMap(new OutlineMap($map_file)); |
|
337 | + $options->setMapLevel($map_top_level + 1); |
|
338 | + } |
|
339 | + else { |
|
340 | + $options->setMap(null); |
|
341 | + } |
|
342 | + } |
|
343 | 343 | |
344 | 344 | $res = $this->provider->updateGeoAnalysis($ga); |
345 | 345 | if($res) { |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
353 | 353 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
354 | 354 | } |
355 | - } |
|
356 | - } else { |
|
355 | + } |
|
356 | + } else { |
|
357 | 357 | $ga = $this->provider->createGeoAnalysis( |
358 | 358 | $description, |
359 | 359 | $analysislevel + 1, |
@@ -371,34 +371,34 @@ discard block |
||
371 | 371 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
372 | 372 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
373 | 373 | } |
374 | - } |
|
374 | + } |
|
375 | 375 | |
376 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
377 | - if(!$success) { |
|
378 | - if($ga) { |
|
379 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
380 | - } |
|
381 | - else { |
|
382 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
383 | - } |
|
384 | - } |
|
385 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
376 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
377 | + if(!$success) { |
|
378 | + if($ga) { |
|
379 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
380 | + } |
|
381 | + else { |
|
382 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
383 | + } |
|
384 | + } |
|
385 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
386 | 386 | |
387 | - } |
|
387 | + } |
|
388 | 388 | |
389 | 389 | /** |
390 | 390 | * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one. |
391 | 391 | * |
392 | 392 | * @param (GeoAnalysis!null) $ga GeoAnalysis to edit |
393 | 393 | */ |
394 | - protected function renderEdit(GeoAnalysis $ga = null) { |
|
395 | - global $WT_TREE; |
|
394 | + protected function renderEdit(GeoAnalysis $ga = null) { |
|
395 | + global $WT_TREE; |
|
396 | 396 | |
397 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
398 | - $controller = new PageController(); |
|
399 | - $controller |
|
400 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
401 | - ->addInlineJavascript(' |
|
397 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
398 | + $controller = new PageController(); |
|
399 | + $controller |
|
400 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
401 | + ->addInlineJavascript(' |
|
402 | 402 | function toggleMapOptions() { |
403 | 403 | if($("input:radio[name=\'use_map\']:checked").val() == 1) { |
404 | 404 | $("#map_options").show(); |
@@ -412,34 +412,34 @@ discard block |
||
412 | 412 | toggleMapOptions(); |
413 | 413 | '); |
414 | 414 | |
415 | - $data = new ViewBag(); |
|
416 | - if($ga) { |
|
417 | - $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
418 | - $data->set('geo_analysis', $ga); |
|
419 | - } else { |
|
420 | - $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
421 | - } |
|
415 | + $data = new ViewBag(); |
|
416 | + if($ga) { |
|
417 | + $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
418 | + $data->set('geo_analysis', $ga); |
|
419 | + } else { |
|
420 | + $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
421 | + } |
|
422 | 422 | |
423 | - $data->set('title', $controller->getPageTitle()); |
|
424 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
425 | - $data->set('module_title', $this->module->getTitle()); |
|
426 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
427 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
423 | + $data->set('title', $controller->getPageTitle()); |
|
424 | + $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
425 | + $data->set('module_title', $this->module->getTitle()); |
|
426 | + $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
427 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
428 | 428 | |
429 | - $map_list = array_map( |
|
430 | - function(OutlineMap $map) { |
|
431 | - return $map->getDescription(); |
|
432 | - }, |
|
433 | - $this->provider->getOutlineMapsList() |
|
434 | - ); |
|
435 | - asort($map_list); |
|
436 | - $data->set('map_list', $map_list); |
|
429 | + $map_list = array_map( |
|
430 | + function(OutlineMap $map) { |
|
431 | + return $map->getDescription(); |
|
432 | + }, |
|
433 | + $this->provider->getOutlineMapsList() |
|
434 | + ); |
|
435 | + asort($map_list); |
|
436 | + $data->set('map_list', $map_list); |
|
437 | 437 | |
438 | - $gen_details = array(0 => I18N::translate('All')); |
|
439 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
440 | - $data->set('generation_details', $gen_details); |
|
438 | + $gen_details = array(0 => I18N::translate('All')); |
|
439 | + for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
440 | + $data->set('generation_details', $gen_details); |
|
441 | 441 | |
442 | - ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
443 | - } |
|
442 | + ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
443 | + } |
|
444 | 444 | |
445 | 445 | } |
446 | 446 | \ No newline at end of file |