XoopsModules25x /
suico
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace XoopsModules\Yogurt\Form; |
||
| 6 | |||
| 7 | /* |
||
| 8 | You may not change or alter any portion of this comment or credits |
||
| 9 | of supporting developers from this source code or any supporting source code |
||
| 10 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, |
||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 15 | */ |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @category Module |
||
| 19 | * @package yogurt |
||
| 20 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 21 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 22 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
| 23 | */ |
||
| 24 | |||
| 25 | use Xmf\Module\Helper\Permission; |
||
| 26 | use XoopsFormButton; |
||
| 27 | use XoopsFormHidden; |
||
| 28 | use XoopsFormLabel; |
||
| 29 | use XoopsFormSelectUser; |
||
| 30 | use XoopsModules\Yogurt; |
||
| 31 | use XoopsThemeForm; |
||
| 32 | |||
| 33 | require_once \dirname(__DIR__, 2) . '/include/common.php'; |
||
| 34 | |||
| 35 | $moduleDirName = \basename(\dirname(__DIR__, 2)); |
||
| 36 | //$helper = Yogurt\Helper::getInstance(); |
||
| 37 | $permHelper = new Permission(); |
||
| 38 | |||
| 39 | \xoops_load('XoopsFormLoader'); |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Class FriendrequestForm |
||
| 43 | */ |
||
| 44 | class FriendrequestForm extends XoopsThemeForm |
||
| 45 | { |
||
| 46 | public $targetObject; |
||
| 47 | |||
| 48 | public $helper; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Constructor |
||
| 52 | * |
||
| 53 | * @param $target |
||
| 54 | */ |
||
| 55 | |||
| 56 | public function __construct($target) |
||
| 57 | { |
||
| 58 | $this->helper = $target->helper; |
||
| 59 | |||
| 60 | $this->targetObject = $target; |
||
| 61 | |||
| 62 | $title = $this->targetObject->isNew() ? \sprintf(\AM_YOGURT_FRIENDREQUEST_ADD) : \sprintf( |
||
| 63 | \AM_YOGURT_FRIENDREQUEST_EDIT |
||
| 64 | ); |
||
| 65 | |||
| 66 | parent::__construct($title, 'form', \xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
| 67 | |||
| 68 | $this->setExtra('enctype="multipart/form-data"'); |
||
| 69 | |||
| 70 | //include ID field, it's needed so the module knows if it is a new form or an edited form |
||
| 71 | |||
| 72 | $hidden = new XoopsFormHidden( |
||
| 73 | 'friendreq_id', $this->targetObject->getVar( |
||
| 74 | 'friendreq_id' |
||
| 75 | ) |
||
| 76 | ); |
||
| 77 | |||
| 78 | $this->addElement($hidden); |
||
| 79 | |||
| 80 | unset($hidden); |
||
| 81 | |||
| 82 | // Friendpet_id |
||
| 83 | |||
| 84 | $this->addElement( |
||
| 85 | new XoopsFormLabel( |
||
| 86 | \AM_YOGURT_FRIENDREQUEST_FRIENDPET_ID, $this->targetObject->getVar( |
||
| 87 | 'friendreq_id' |
||
| 88 | ), 'friendreq_id' |
||
| 89 | ) |
||
| 90 | ); |
||
| 91 | |||
| 92 | // Inviting by Friend_uid |
||
| 93 | |||
| 94 | $this->addElement( |
||
| 95 | new XoopsFormSelectUser( |
||
| 96 | \AM_YOGURT_FRIENDREQUEST_FRIENDREQUESTER_UID, 'friendrequester_uid', false, $this->targetObject->getVar( |
||
| 97 | 'friendrequester_uid' |
||
| 98 | ), 1, false |
||
| 99 | ), |
||
| 100 | false |
||
| 101 | ); |
||
| 102 | |||
| 103 | // Invited Friend_uid |
||
| 104 | |||
| 105 | $this->addElement( |
||
| 106 | new XoopsFormSelectUser( |
||
| 107 | \AM_YOGURT_FRIENDREQUEST_FRIENDREQUESTTO_UID, 'friendrequestto_uid', false, $this->targetObject->getVar( |
||
| 108 | 'friendrequestto_uid' |
||
| 109 | ), 1, false |
||
| 110 | ), |
||
| 111 | false |
||
| 112 | ); |
||
| 113 | |||
| 114 | // Date_created |
||
| 115 | |||
| 116 | $this->addElement( |
||
| 117 | new \XoopsFormTextDateSelect( |
||
| 118 | \AM_YOGURT_FRIENDREQUEST_DATE_CREATED, 'date_created', 0, \formatTimestamp($this->targetObject->getVar('date_created'), 's') |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 119 | ) |
||
| 120 | ); |
||
| 121 | |||
| 122 | $this->addElement(new XoopsFormHidden('op', 'save')); |
||
| 123 | |||
| 124 | $this->addElement(new XoopsFormButton('', 'submit', \_SUBMIT, 'submit')); |
||
| 125 | } |
||
| 126 | } |
||
| 127 |