Passed
Push — master ( 48d769...5ccf6e )
by Michael
07:14
created

index.php (4 issues)

Labels
Severity
1
<?php
2
// -------------------------------------------------------------------------
3
4
use XoopsModules\Pedigree;
5
6
require_once __DIR__ . '/header.php';
7
8
$moduleDirName = basename(__DIR__);
9
xoops_loadLanguage('main', $moduleDirName);
0 ignored issues
show
The function xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

9
/** @scrutinizer ignore-call */ 
10
xoops_loadLanguage('main', $moduleDirName);
Loading history...
10
11
// Include any common code for this module.
12
require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php';
0 ignored issues
show
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
13
require_once __DIR__ . '/welcome.php';
14
15
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_index.tpl';
16
17
include $GLOBALS['xoops']->path('/header.php');
18
19
//load javascript
20
$xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js');
0 ignored issues
show
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
21
//$xoTheme->addScript(PEDIGREE_URL . '/assets/js/jquery.ThickBox/thickbox-compressed.js');
22
23
$xoTheme->addScript(PEDIGREE_URL . '/assets/js/jquery.magnific-popup.min.js');
24
$xoTheme->addScript(PEDIGREE_URL . '/assets/js/colpick.js');
25
26
//load CSS style sheets
27
$xoTheme->addStylesheet(PEDIGREE_URL . '/assets/css/colpick.css');
28
$xoTheme->addStylesheet(PEDIGREE_URL . '/assets/css/magnific-popup.css');
29
$xoTheme->addStylesheet(PEDIGREE_URL . '/assets/css/style.css');
30
31
//$xoTheme->addStylesheet(PEDIGREE_URL . '/assets/css/jquery.ThickBox/thickbox.css');
32
//$xoTheme->addStylesheet(PEDIGREE_URL . '/module.css');
33
34
$GLOBALS['xoopsTpl']->assign('pedigree_url', PEDIGREE_URL . '/');
35
36
// Breadcrumb
37
$breadcrumb = new Pedigree\Breadcrumb();
38
$breadcrumb->addLink($helper->getModule()->getVar('name'), PEDIGREE_URL);
39
40
$GLOBALS['xoopsTpl']->assign('module_home', Pedigree\Utility::getModuleName(false)); // this definition is not removed for backward compatibility issues
41
$GLOBALS['xoopsTpl']->assign('pedigree_breadcrumb', $breadcrumb->render());
42
43
//get module configuration
44
/** @var XoopsModuleHandler $moduleHandler */
45
$moduleHandler = xoops_getHandler('module');
0 ignored issues
show
The function xoops_getHandler was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
$moduleHandler = /** @scrutinizer ignore-call */ xoops_getHandler('module');
Loading history...
46
$module        = $moduleHandler->getByDirname($xoopsModule->dirname());
47
$configHandler = xoops_getHandler('config');
48
$moduleConfig  = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
49
50
//create animal object
51
$animal = new Pedigree\Animal();
52
53
//test to find out how many user fields there are..
54
$fields = $animal->getNumOfFields();
55
56
for ($i = 0, $iMax = count($fields); $i < $iMax; ++$i) {
57
    $userField = new Pedigree\Field($fields[$i], $animal->getConfig());
58
    if ($userField->isActive() && $userField->hasSearch()) {
59
        $fieldType   = $userField->getSetting('FieldType');
60
        $fieldObject = new $fieldType($userField, $animal);
61
        $function    = 'user' . $fields[$i] . $fieldObject->getSearchString();
62
        //echo $function."<br>";
63
        $usersearch[] = [
64
            'title'       => $userField->getSetting('SearchName'),
65
            'searchid'    => 'user' . $fields[$i],
66
            'function'    => $function,
67
            'explanation' => $userField->getSetting('SearchExplanation'),
68
            'searchfield' => $fieldObject->searchfield()
69
        ];
70
    }
71
}
72
73
//$catarray['letters']          = Pedigree\Utility::lettersChoice();
74
$letter              = '';
75
$myObject     = Pedigree\Helper::getInstance();
76
$activeObject = 'Tree';
77
$name         = 'naam';
78
$link         = "result.php?f={$name}&amp;l=1&amp;o={$name}&amp;w=";
79
$link2        = '%25';
80
81
$criteria = $myObject->getHandler('Tree')->getActiveCriteria();
82
$criteria->setGroupby('UPPER(LEFT(' . $name . ',1))');
83
$catarray['letters'] = Pedigree\Utility::lettersChoice($myObject, $activeObject, $criteria, $name, $link, $link2);
84
//$catarray['toolbar']          = pedigree_toolbar();
85
$xoopsTpl->assign('catarray', $catarray);
86
$xoopsTpl->assign('pageTitle', _MA_PEDIGREE_BROWSETOTOPIC);
87
88
//add data to smarty template
89
$GLOBALS['xoopsTpl']->assign([
90
                                 'sselect'    => strtr(_MA_PEDIGREE_SELECT, ['[animalType]' => $moduleConfig['animalType']]),
91
                                 'explain'     => _MA_PEDIGREE_EXPLAIN,
92
                                 'sname'       => _MA_PEDIGREE_SEARCHNAME,
93
                                 'snameex'    => strtr(_MA_PEDIGREE_SEARCHNAME_EX, ['[animalTypes]' => $moduleConfig['animalTypes']]),
94
                                 'usersearch' => isset($usersearch) ? $usersearch : ''
95
                             ]);
96
$GLOBALS['xoopsTpl']->assign('showwelcome', $moduleConfig['showwelcome']);
97
//$GLOBALS['xoopsTpl']->assign('welcome', $GLOBALS['myts']->displayTarea($moduleConfig['welcome']));
98
//$word = $myts->displayTarea(strtr($helper->getConfig('welcome'), array('[numanimals]' => $numdogs, '[animalType]' => $helper->getConfig('animalType'), '[animalTypes]' => $helper->getConfig('animalTypes'))));
99
$GLOBALS['xoopsTpl']->assign('word', $word);
100
include $GLOBALS['xoops']->path('footer.php');
101