1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Xoopspartners; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* You may not change or alter any portion of this comment or credits |
7
|
|
|
* of supporting developers from this source code or any supporting source code |
8
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
* This program is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12
|
|
|
* |
13
|
|
|
*------------------------------------ |
14
|
|
|
* Author: Raul Recio (AKA UNFOR) |
15
|
|
|
* Project: The XOOPS Project |
16
|
|
|
*------------------------------------ |
17
|
|
|
*/ |
18
|
|
|
/** |
19
|
|
|
* XoopsPartners - a partner affiliation links module |
20
|
|
|
* |
21
|
|
|
* @package module\Xoopspartners\class |
22
|
|
|
* @author Raul Recio (aka UNFOR) |
23
|
|
|
* @author XOOPS Module Development Team |
24
|
|
|
* @copyright {@link https://xoops.org 2001-2016 XOOPS Project} |
25
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
26
|
|
|
* @link https://xoops.org XOOPS |
27
|
|
|
*/ |
28
|
|
|
/** |
29
|
|
|
* Class Partners |
30
|
|
|
* |
31
|
|
|
* {@inheritDoc} |
32
|
|
|
* @see \XoopsObject |
33
|
|
|
*/ |
34
|
|
|
class Partners extends \XoopsObject |
35
|
|
|
{ |
36
|
|
|
protected $db; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* constructor |
40
|
|
|
* |
41
|
|
|
* @param null $id |
|
|
|
|
42
|
|
|
* @todo change 'url' to XOBJ_DTYPE_URL |
43
|
|
|
*/ |
44
|
|
|
public function __construct($id = null) |
45
|
|
|
{ |
46
|
|
|
$this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
47
|
|
|
|
48
|
|
|
$this->initVar('id', \XOBJ_DTYPE_INT, null, false); |
49
|
|
|
$this->initVar('weight', \XOBJ_DTYPE_INT, null, false, 10); |
50
|
|
|
$this->initVar('hits', \XOBJ_DTYPE_INT, null, true, 10); |
51
|
|
|
$this->initVar('url', \XOBJ_DTYPE_TXTBOX, null, true); |
52
|
|
|
$this->initVar('image', \XOBJ_DTYPE_TXTBOX, null, true); |
53
|
|
|
$this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false); |
54
|
|
|
$this->initVar('description', \XOBJ_DTYPE_TXTBOX, null, true); |
55
|
|
|
$this->initVar('status', \XOBJ_DTYPE_INT, null, false, 0); |
56
|
|
|
if (!empty($id)) { |
57
|
|
|
if (\is_array($id)) { |
58
|
|
|
$this->assignVars($id); |
59
|
|
|
} else { |
60
|
|
|
$this->load((int)$id); |
|
|
|
|
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns category title |
67
|
|
|
* |
68
|
|
|
* @return string |
69
|
|
|
*/ |
70
|
|
|
public function __toString() |
71
|
|
|
{ |
72
|
|
|
return $this->getVar('title', 's'); |
|
|
|
|
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|