Passed
Branch master (465698)
by Michael
05:38
created

PedigreeHtmlInputAbstract::lookupField()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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