1 | <?php |
||
2 | // ------------------------------------------------------------------------- |
||
3 | |||
4 | use XoopsModules\Pedigree; |
||
5 | |||
6 | require_once __DIR__ . '/header.php'; |
||
7 | $helper->loadLanguage('main'); |
||
8 | |||
9 | // Include any common code for this module. |
||
10 | require_once $helper->path('include/common.php'); |
||
11 | //require_once __DIR__ . '/welcome.php'; |
||
12 | |||
13 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_index.tpl'; |
||
14 | |||
15 | include $GLOBALS['xoops']->path('/header.php'); |
||
16 | |||
17 | //load javascript |
||
18 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||
19 | //$xoTheme->addScript($helper->url('assets/js/jquery.ThickBox/thickbox-compressed.js')); |
||
20 | |||
21 | $xoTheme->addScript($helper->url('assets/js/jquery.magnific-popup.min.js')); |
||
22 | $xoTheme->addScript($helper->url('assets/js/colpick.js')); |
||
23 | |||
24 | //load CSS style sheets |
||
25 | $xoTheme->addStylesheet($helper->url('assets/css/colpick.css')); |
||
26 | $xoTheme->addStylesheet($helper->url('assets/css/magnific-popup.css')); |
||
27 | $xoTheme->addStylesheet($helper->url('assets/css/style.css')); |
||
28 | |||
29 | //$xoTheme->addStylesheet($helper->url('assets/css/jquery.ThickBox/thickbox.css')); |
||
30 | //$xoTheme->addStylesheet($helper->url('assets/css/module.css')); |
||
31 | |||
32 | $GLOBALS['xoopsTpl']->assign('pedigree_url', $helper->url()); |
||
33 | |||
34 | // Breadcrumb |
||
35 | $breadcrumb = new Pedigree\Breadcrumb(); |
||
36 | $breadcrumb->addLink($helper->getModule()->getVar('name'), $helper->url()); |
||
37 | |||
38 | $GLOBALS['xoopsTpl']->assign('module_home', $helper->getDirname()); // this definition is not removed for backward compatibility issues |
||
39 | $GLOBALS['xoopsTpl']->assign('pedigree_breadcrumb', $breadcrumb->render()); |
||
40 | |||
41 | //get module configuration |
||
42 | /** @var XoopsModuleHandler $moduleHandler */ |
||
43 | $moduleHandler = xoops_getHandler('module'); |
||
44 | $module = $moduleHandler->getByDirname($xoopsModule->dirname()); |
||
45 | $configHandler = xoops_getHandler('config'); |
||
46 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
47 | |||
48 | //create animal object |
||
49 | $animal = new Pedigree\Animal(); |
||
50 | |||
51 | //test to find out how many user fields there are.. |
||
52 | $fields = $animal->getNumOfFields(); |
||
53 | |||
54 | foreach ($fields as $i => $iValue) { |
||
55 | $userField = new Pedigree\Field($fields[$i], $animal->getConfig()); |
||
56 | if ($userField->isActive() && $userField->hasSearch()) { |
||
57 | $fieldType = $userField->getSetting('FieldType'); |
||
58 | $fieldObject = new $fieldType($userField, $animal); |
||
59 | $function = 'user' . $iValue . $fieldObject->getSearchString(); |
||
60 | //echo $function."<br>"; |
||
61 | $usersearch[] = [ |
||
62 | 'title' => $userField->getSetting('SearchName'), |
||
63 | 'searchid' => 'user' . $iValue, |
||
64 | 'function' => $function, |
||
65 | 'explanation' => $userField->getSetting('SearchExplanation'), |
||
66 | 'searchfield' => $fieldObject->searchfield() |
||
67 | ]; |
||
68 | } |
||
69 | } |
||
70 | |||
71 | //$catarray['letters'] = Pedigree\Utility::lettersChoice(); |
||
72 | $letter = ''; |
||
73 | $myObject = Pedigree\Helper::getInstance(); |
||
74 | $activeObject = 'Tree'; |
||
75 | $name = 'naam'; |
||
76 | $link = "result.php?f={$name}&l=1&o={$name}&w="; |
||
77 | $link2 = '%25'; |
||
78 | |||
79 | $criteria = $myObject->getHandler('Tree')->getActiveCriteria(); |
||
80 | $criteria->setGroupby('UPPER(LEFT(' . $name . ',1))'); |
||
81 | $catarray['letters'] = Pedigree\Utility::lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2); |
||
82 | //$catarray['toolbar'] = pedigree_toolbar(); |
||
83 | $xoopsTpl->assign('catarray', $catarray); |
||
84 | $xoopsTpl->assign('pageTitle', _MA_PEDIGREE_BROWSETOTOPIC); |
||
85 | |||
86 | //add data to smarty template |
||
87 | $GLOBALS['xoopsTpl']->assign([ |
||
88 | 'sselect' => strtr(_MA_PEDIGREE_SELECT, ['[animalType]' => $moduleConfig['animalType']]), |
||
89 | 'explain' => _MA_PEDIGREE_EXPLAIN, |
||
90 | 'sname' => _MA_PEDIGREE_SEARCHNAME, |
||
91 | 'snameex' => strtr(_MA_PEDIGREE_SEARCHNAME_EX, ['[animalTypes]' => $moduleConfig['animalTypes']]), |
||
92 | 'usersearch' => isset($usersearch) ? $usersearch : '' |
||
93 | ]); |
||
94 | $GLOBALS['xoopsTpl']->assign('showwelcome', $moduleConfig['showwelcome']); |
||
95 | //$GLOBALS['xoopsTpl']->assign('welcome', $GLOBALS['myts']->displayTarea($moduleConfig['welcome'])); |
||
96 | $word = $myts->displayTarea(strtr($helper->getConfig('welcome'), array('[numanimals]' => $numdogs, '[animalType]' => $helper->getConfig('animalType'), '[animalTypes]' => $helper->getConfig('animalTypes')))); |
||
97 | $GLOBALS['xoopsTpl']->assign('word', $word); |
||
98 | include $GLOBALS['xoops']->path('footer.php'); |
||
99 |