|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
/** |
|
12
|
|
|
* Pedigree module for XOOPS |
|
13
|
|
|
* |
|
14
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
|
15
|
|
|
* @license GPL 2.0 or later |
|
16
|
|
|
* @package pedigree |
|
17
|
|
|
* @since 2.5.x |
|
18
|
|
|
* @author XOOPS Module Dev Team (http://xoops.org) |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class PedigreeOwner |
|
25
|
|
|
*/ |
|
26
|
|
|
class PedigreeOwner extends XoopsObject |
|
27
|
|
|
{ |
|
28
|
|
|
//Constructor |
|
29
|
|
|
/** |
|
30
|
|
|
* |
|
31
|
|
|
*/ |
|
32
|
|
|
public function __construct() |
|
33
|
|
|
{ |
|
34
|
|
|
parent::__construct(); |
|
35
|
|
|
$this->initVar('Id', XOBJ_DTYPE_INT, null, false, 11); |
|
36
|
|
|
$this->initVar('firstname', XOBJ_DTYPE_TXTBOX, null, false, 30); |
|
37
|
|
|
$this->initVar('lastname', XOBJ_DTYPE_TXTBOX, null, false, 30); |
|
38
|
|
|
$this->initVar('postcode', XOBJ_DTYPE_TXTBOX, null, false, 7); |
|
39
|
|
|
$this->initVar('city', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
40
|
|
|
$this->initVar('streetname', XOBJ_DTYPE_TXTBOX, null, false, 40); |
|
41
|
|
|
$this->initVar('housenumber', XOBJ_DTYPE_TXTBOX, null, false, 6); |
|
42
|
|
|
$this->initVar('phonenumber', XOBJ_DTYPE_TXTBOX, null, false, 14); |
|
43
|
|
|
$this->initVar('emailadres', XOBJ_DTYPE_TXTBOX, null, false, 40); |
|
44
|
|
|
$this->initVar('website', XOBJ_DTYPE_TXTBOX, null, false, 60); |
|
45
|
|
|
$this->initVar('user', XOBJ_DTYPE_TXTBOX, null, false, 20); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @param bool $action |
|
50
|
|
|
* |
|
51
|
|
|
* @return XoopsThemeForm |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getForm($action = false) |
|
54
|
|
|
{ |
|
55
|
|
|
global $xoopsModuleConfig; |
|
56
|
|
|
|
|
57
|
|
|
if ($action === false) { |
|
58
|
|
|
$action = $_SERVER['REQUEST_URI']; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
$title = $this->isNew() ? sprintf(_AM_PEDIGREE_OWNER_ADD) : sprintf(_AM_PEDIGREE_OWNER_EDIT); |
|
62
|
|
|
|
|
63
|
|
|
include_once(XOOPS_ROOT_PATH . '/class/xoopsformloader.php'); |
|
64
|
|
|
|
|
65
|
|
|
$form = new XoopsThemeForm($title, 'form', $action, 'post', true); |
|
66
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
|
67
|
|
|
|
|
68
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_FIRSTNAME, 'firstname', 50, 255, $this->getVar('firstname')), false); |
|
|
|
|
|
|
69
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_LASTNAME, 'lastname', 50, 255, $this->getVar('lastname')), false); |
|
70
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_POSTCODE, 'postcode', 50, 255, $this->getVar('postcode')), false); |
|
71
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_CITY, 'city', 50, 255, $this->getVar('city')), false); |
|
72
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_STREETNAME, 'streetname', 50, 255, $this->getVar('streetname')), false); |
|
73
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_HOUSENUMBER, 'housenumber', 50, 255, $this->getVar('housenumber')), false); |
|
74
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_PHONENUMBER, 'phonenumber', 50, 255, $this->getVar('phonenumber')), false); |
|
75
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_EMAILADRES, 'emailadres', 50, 255, $this->getVar('emailadres')), false); |
|
76
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_WEBSITE, 'website', 50, 255, $this->getVar('website')), false); |
|
77
|
|
|
$form->addElement(new XoopsFormText(_AM_PEDIGREE_OWNER_USER, 'user', 50, 255, $this->getVar('user')), false); |
|
78
|
|
|
|
|
79
|
|
|
$form->addElement(new XoopsFormHidden('op', 'save_owner')); |
|
80
|
|
|
|
|
81
|
|
|
//Submit buttons |
|
82
|
|
|
$button_tray = new XoopsFormElementTray('', ''); |
|
83
|
|
|
$submit_button = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
|
84
|
|
|
$button_tray->addElement($submit_button); |
|
85
|
|
|
|
|
86
|
|
|
$cancel_button = new XoopsFormButton('', '', _CANCEL, 'cancel'); |
|
87
|
|
|
$cancel_button->setExtra('onclick="history.go(-1)"'); |
|
88
|
|
|
$button_tray->addElement($cancel_button); |
|
89
|
|
|
|
|
90
|
|
|
$form->addElement($button_tray); |
|
91
|
|
|
|
|
92
|
|
|
return $form; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* Class PedigreeOwnerHandler |
|
98
|
|
|
*/ |
|
99
|
|
|
class PedigreeOwnerHandler extends XoopsPersistableObjectHandler |
|
100
|
|
|
{ |
|
101
|
|
|
/** |
|
102
|
|
|
* @param null|object|XoopsDatabase $db |
|
103
|
|
|
*/ |
|
104
|
|
|
public function __construct(XoopsDatabase $db) |
|
105
|
|
|
{ |
|
106
|
|
|
parent::__construct($db, 'pedigree_owner', 'PedigreeOwner', 'Id', 'firstname'); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Get criteria for active animals |
|
111
|
|
|
* |
|
112
|
|
|
* @return CriteriaElement |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getActiveCriteria() |
|
115
|
|
|
{ |
|
116
|
|
|
$gperm_handler = xoops_getHandler('groupperm'); |
|
|
|
|
|
|
117
|
|
|
|
|
118
|
|
|
// $criteria = new CriteriaCompo(new Criteria('offline', false)); |
|
119
|
|
|
// $criteria->add(new Criteria('published', 0, '>')); |
|
120
|
|
|
// $criteria->add(new Criteria('published', time(), '<=')); |
|
121
|
|
|
// $expiredCriteria = new CriteriaCompo(new Criteria('expired', 0)); |
|
122
|
|
|
// $expiredCriteria->add(new Criteria('expired', time(), '>='), 'OR'); |
|
123
|
|
|
// $criteria->add($expiredCriteria); |
|
124
|
|
|
// add criteria for categories that the user has permissions for |
|
125
|
|
|
// $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); |
|
126
|
|
|
//mb $allowedDownCategoriesIds = $gperm_handler->getItemIds('WFDownCatPerm', $groups, $this->wfdownloads->getModule()->mid()); |
|
127
|
|
|
//mb $criteria->add(new Criteria('cid', '(' . implode(',', $allowedDownCategoriesIds) . ')', 'IN')); |
|
128
|
|
|
|
|
129
|
|
|
$criteria = new CriteriaCompo(); |
|
130
|
|
|
$criteria->setSort('lastname ASC'); |
|
131
|
|
|
$criteria->setOrder('ASC'); |
|
132
|
|
|
|
|
133
|
|
|
return $criteria; |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|