mambax7 /
pedigree
| 1 | <?php namespace XoopsModules\Pedigree; |
||
| 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 (https://xoops.org) |
||
| 15 | * @license GPL 2.0 or later |
||
| 16 | * @package pedigree |
||
| 17 | * @since 2.5.x |
||
| 18 | * @author XOOPS Module Dev Team (https://xoops.org) |
||
| 19 | */ |
||
| 20 | |||
| 21 | use XoopsModules\Pedigree; |
||
|
0 ignored issues
–
show
|
|||
| 22 | |||
| 23 | defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Class Pedigree\Trash |
||
| 27 | */ |
||
| 28 | class Trash extends \XoopsObject |
||
| 29 | { |
||
| 30 | //Constructor |
||
| 31 | /** |
||
| 32 | * |
||
| 33 | */ |
||
| 34 | public function __construct() |
||
| 35 | { |
||
| 36 | parent::__construct(); |
||
| 37 | $this->initVar('id', XOBJ_DTYPE_INT, null, false, 11); |
||
| 38 | $this->initVar('naam', XOBJ_DTYPE_TXTAREA, null, false); |
||
| 39 | $this->initVar('id_owner', XOBJ_DTYPE_INT, null, false, 11); |
||
| 40 | $this->initVar('id_breeder', XOBJ_DTYPE_INT, null, false, 11); |
||
| 41 | $this->initVar('user', XOBJ_DTYPE_TXTBOX, null, false, 25); |
||
| 42 | $this->initVar('roft', XOBJ_DTYPE_TXTBOX, null, false, 1); |
||
| 43 | $this->initVar('mother', XOBJ_DTYPE_INT, null, false, 5); |
||
| 44 | $this->initVar('father', XOBJ_DTYPE_INT, null, false, 5); |
||
| 45 | $this->initVar('foto', XOBJ_DTYPE_TXTBOX, null, false, 255); |
||
| 46 | $this->initVar('coi', XOBJ_DTYPE_TXTBOX, null, false, 10); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param bool $action |
||
| 51 | * |
||
| 52 | * @return \XoopsThemeForm |
||
| 53 | */ |
||
| 54 | public function getForm($action = false) |
||
| 55 | { |
||
| 56 | //global $xoopsModuleConfig; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
75% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 57 | |||
| 58 | |||
| 59 | if (false === $action) { |
||
| 60 | $action = $_SERVER['REQUEST_URI']; |
||
| 61 | } |
||
| 62 | |||
| 63 | $title = $this->isNew() ? sprintf(_AM_PEDIGREE_PEDIGREE_TRASH_ADD) : sprintf(_AM_PEDIGREE_PEDIGREE_TRASH_EDIT); |
||
| 64 | |||
| 65 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 66 | |||
| 67 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||
| 68 | $form->setExtra('enctype="multipart/form-data"'); |
||
| 69 | |||
| 70 | $form->addElement(new \XoopsFormTextArea(_AM_PEDIGREE_PEDIGREE_TRASH_NAAM, 'naam', $this->getVar('naam'), 4, 47), true); |
||
| 71 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_ID_OWNER, 'id_owner', 50, 255, $this->getVar('id_owner')), false); |
||
| 72 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_ID_BREEDER, 'id_breeder', 50, 255, $this->getVar('id_breeder')), false); |
||
| 73 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_USER, 'user', 50, 255, $this->getVar('user')), false); |
||
| 74 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_ROFT, 'roft', 50, 255, $this->getVar('roft')), false); |
||
| 75 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_MOTHER, 'mother', 50, 255, $this->getVar('mother')), false); |
||
| 76 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_FATHER, 'father', 50, 255, $this->getVar('father')), false); |
||
| 77 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_FOTO, 'foto', 50, 255, $this->getVar('foto')), false); |
||
| 78 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_TRASH_COI, 'coi', 50, 255, $this->getVar('coi')), false); |
||
| 79 | |||
| 80 | $form->addElement(new \XoopsFormHidden('op', 'save_pedigree_trash')); |
||
| 81 | |||
| 82 | //Submit buttons |
||
| 83 | $button_tray = new \XoopsFormElementTray('', ''); |
||
| 84 | $submit_button = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
||
| 85 | $button_tray->addElement($submit_button); |
||
| 86 | |||
| 87 | $cancel_button = new \XoopsFormButton('', '', _CANCEL, 'cancel'); |
||
| 88 | $cancel_button->setExtra('onclick="history.go(-1)"'); |
||
| 89 | $button_tray->addElement($cancel_button); |
||
| 90 | |||
| 91 | $form->addElement($button_tray); |
||
| 92 | |||
| 93 | return $form; |
||
| 94 | } |
||
| 95 | } |
||
| 96 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: