1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Pedigree; |
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
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Pedigree module for XOOPS |
17
|
|
|
* |
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @package pedigree |
21
|
|
|
* @since 2.5.x |
22
|
|
|
* @author XOOPS Module Dev Team (https://xoops.org) |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
\defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class Pedigree\Trash |
30
|
|
|
*/ |
31
|
|
|
class Trash extends \XoopsObject |
32
|
|
|
{ |
33
|
|
|
//Constructor |
34
|
|
|
|
35
|
|
|
public function __construct() |
36
|
|
|
{ |
37
|
|
|
parent::__construct(); |
38
|
|
|
$this->initVar('id', \XOBJ_DTYPE_INT, null, false, 11); |
39
|
|
|
$this->initVar('pname', \XOBJ_DTYPE_TXTAREA, null, false); |
40
|
|
|
$this->initVar('id_owner', \XOBJ_DTYPE_INT, null, false, 11); |
41
|
|
|
$this->initVar('id_breeder', \XOBJ_DTYPE_INT, null, false, 11); |
42
|
|
|
$this->initVar('user', \XOBJ_DTYPE_TXTBOX, null, false, 25); |
43
|
|
|
$this->initVar('roft', \XOBJ_DTYPE_TXTBOX, null, false, 1); |
44
|
|
|
$this->initVar('mother', \XOBJ_DTYPE_INT, null, false, 5); |
45
|
|
|
$this->initVar('father', \XOBJ_DTYPE_INT, null, false, 5); |
46
|
|
|
$this->initVar('foto', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
47
|
|
|
$this->initVar('coi', \XOBJ_DTYPE_TXTBOX, null, false, 10); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function __toString() |
55
|
|
|
{ |
56
|
|
|
return $this->getVar('pname'); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param bool $action |
61
|
|
|
* |
62
|
|
|
* @return \XoopsThemeForm |
63
|
|
|
*/ |
64
|
|
|
public function getForm($action = false) |
65
|
|
|
{ |
66
|
|
|
//global $xoopsModuleConfig; |
67
|
|
|
|
68
|
|
|
if (false === $action) { |
69
|
|
|
$action = $_SERVER['REQUEST_URI']; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
$title = $this->isNew() ? \sprintf(\_AM_PEDIGREE_PEDIGREE_TRASH_ADD) : \sprintf(\_AM_PEDIGREE_PEDIGREE_TRASH_EDIT); |
73
|
|
|
|
74
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
75
|
|
|
|
76
|
|
|
$form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
77
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
78
|
|
|
|
79
|
|
|
$form->addElement(new \XoopsFormTextArea(\_AM_PEDIGREE_PEDIGREE_TRASH_PNAME, 'pname', $this->getVar('pname'), 4, 47), true); |
|
|
|
|
80
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_ID_OWNER, 'id_owner', 50, 255, $this->getVar('id_owner')), false); |
|
|
|
|
81
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_ID_BREEDER, 'id_breeder', 50, 255, $this->getVar('id_breeder')), false); |
82
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_USER, 'user', 50, 255, $this->getVar('user')), false); |
83
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_ROFT, 'roft', 50, 255, $this->getVar('roft')), false); |
84
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_MOTHER, 'mother', 50, 255, $this->getVar('mother')), false); |
85
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_FATHER, 'father', 50, 255, $this->getVar('father')), false); |
86
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_FOTO, 'foto', 50, 255, $this->getVar('foto')), false); |
87
|
|
|
$form->addElement(new \XoopsFormText(\_AM_PEDIGREE_PEDIGREE_TRASH_COI, 'coi', 50, 255, $this->getVar('coi')), false); |
88
|
|
|
|
89
|
|
|
$form->addElement(new \XoopsFormHidden('op', 'save_pedigree_trash')); |
90
|
|
|
|
91
|
|
|
//Submit buttons |
92
|
|
|
$buttonTray = new \XoopsFormElementTray('', ''); |
93
|
|
|
$submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
94
|
|
|
$buttonTray->addElement($submit_button); |
95
|
|
|
|
96
|
|
|
$cancel_button = new \XoopsFormButton('', '', _CANCEL, 'cancel'); |
97
|
|
|
$cancel_button->setExtra('onclick="history.go(-1)"'); |
98
|
|
|
$buttonTray->addElement($cancel_button); |
99
|
|
|
|
100
|
|
|
$form->addElement($buttonTray); |
101
|
|
|
|
102
|
|
|
return $form; |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|