Passed
Branch master (48d769)
by Michael
02:30
created

HtmlInputAbstract   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 65
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A echoMsg() 0 3 1
A lookupField() 0 12 2
1
<?php namespace XoopsModules\Pedigree;
2
3
/**
4
 *  pedigree HTML Input Interface Class Elements
5
 *
6
 * @copyright  ZySpec Incorporated
7
 * @license    {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
8
 * @package    pedigree
9
 * @subpackage class
10
 * @author     zyspec <[email protected]>
11
 * @since      1.3.1
12
 */
13
14
use XoopsModules\Pedigree;
15
16
defined('XOOPS_ROOT_PATH') || die('Restricted access');
17
18
/**
19
 * Pedigree\HtmlInputAbstract
20
 *
21
 * @package   pedigree
22
 * @author    zyspec <[email protected]>
23
 * @copyright Copyright (c) 2014 ZySpec Incorporated
24
 * @access    public
25
 */
26
27
require_once __DIR__ . '/field.php';
28
29
/**
30
 * Class Pedigree\HtmlInputAbstract
31
 */
32
abstract class HtmlInputAbstract extends Pedigree\Field
33
{
34
    /**
35
     * @return mixed
36
     */
37
    abstract public function editField();
38
39
    /**
40
     * @param $name
41
     * @return mixed
42
     */
43
    abstract public function newField($name);
44
45
    /**
46
     * @return mixed
47
     */
48
    abstract public function viewField();
49
50
    /**
51
     * @return mixed
52
     */
53
    abstract public function showField();
54
55
    /**
56
     * @return mixed
57
     */
58
    abstract public function showValue();
59
60
    /**
61
     * @return mixed
62
     */
63
    abstract public function searchField();
64
65
    /**
66
     * @return mixed
67
     */
68
    abstract public function getSearchString();
69
70
    /**
71
     * @param string $message
72
     *
73
     * @return void
74
     */
75
    public function echoMsg($message)
76
    {
77
        echo "<span style='color: red;'><h3>{$message}</h3></span>";
78
    }
79
80
    /**
81
     * @param $fieldnumber
82
     *
83
     * @return array
84
     */
85
    public function lookupField($fieldnumber)
86
    {
87
        $ret = [];
88
        global $xoopsDB;
89
        $SQL    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_lookup' . $fieldnumber) . " ORDER BY 'order'";
90
        $result = $GLOBALS['xoopsDB']->query($SQL);
91
        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
92
            $ret[] = ['id' => $row['id'], 'value' => $row['value']];
93
        }
94
95
        //array_multisort($ret,SORT_ASC);
96
        return $ret;
97
    }
98
}
99