Completed
Push — master ( c8eead...62889a )
by Michael
04:13
created

admin/pedigree_trash.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
 * animal module for xoops
13
 *
14
 * @copyright       The TXMod XOOPS Project http://sourceforge.net/projects/thmod/
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GPL 2.0 or later
17
 * @package         animal
18
 * @since           2.5.x
19
 * @author          XOOPS Development Team ( [email protected] ) - ( http://xoops.org )
20
 * @version         $Id: pedigree_trash.php 12277 2014-01-26 01:21:57Z beckmi $
21
 */
22
23
include_once 'admin_header.php';
24
//It recovered the value of argument op in URL$
25
$op = animal_CleanVars($_REQUEST, 'op', 'list', 'string');
26
switch ($op) {
27
    case "list":
28
    default:
29
        echo $adminMenu->addNavigation('pedigree_trash.php');
30
        $adminMenu->addItemButton(_AM_PEDIGREE_NEWPEDIGREE_TRASH, 'pedigree_trash.php?op=new_pedigree_trash', 'add');
31
//        echo $adminMenu->renderButton();
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
32
        $criteria = new CriteriaCompo();
33
        $criteria->setSort("ID");
34
        $criteria->setOrder("ASC");
35
        $numrows            = $pedigreeTrashHandler->getCount();
36
        $pedigree_trash_arr = $pedigreeTrashHandler->getall($criteria);
37
38
        //Table view
39
        if ($numrows > 0) {
40
            echo "<table width='100%' cellspacing='1' class='outer'>
41
                <tr>
42
                    <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_NAAM . "</th>
43
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_ID_OWNER . "</th>
44
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_ID_BREEDER . "</th>
45
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_USER . "</th>
46
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_ROFT . "</th>
47
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_MOTHER . "</th>
48
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_FATHER . "</th>
49
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_FOTO . "</th>
50
                        <th align=\"center\">" . _AM_PEDIGREE_PEDIGREE_TRASH_COI . "</th>
51
52
                    <th align='center' width='10%'>" . _AM_PEDIGREE_FORMACTION . "</th>
53
                </tr>";
54
55
            $class = "odd";
56
57 View Code Duplication
            foreach (array_keys($pedigree_trash_arr) as $i) {
58
                if ($pedigree_trash_arr[$i]->getVar("pedigree_trash_pid") == 0) {
59
                    echo "<tr class='" . $class . "'>";
60
                    $class = ($class == "even") ? "odd" : "even";
61
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("NAAM") . "</td>";
62
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("id_owner") . "</td>";
63
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("id_breeder") . "</td>";
64
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("user") . "</td>";
65
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("roft") . "</td>";
66
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("mother") . "</td>";
67
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("father") . "</td>";
68
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("foto") . "</td>";
69
                    echo "<td align=\"center\">" . $pedigree_trash_arr[$i]->getVar("coi") . "</td>";
70
71
                    echo "<td align='center' width='10%'>
72
                        <a href='pedigree_trash.php?op=edit_pedigree_trash&ID=" . $pedigree_trash_arr[$i]->getVar("ID") . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT
73
                        . "'></a>
74
                        <a href='pedigree_trash.php?op=delete_pedigree_trash&ID=" . $pedigree_trash_arr[$i]->getVar("ID") . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='"
75
                        . _DELETE . "'></a>
76
                        </td>";
77
                    echo "</tr>";
78
                }
79
            }
80
            echo "</table><br /><br />";
81
        }
82
83
        break;
84
85 View Code Duplication
    case "new_pedigree_trash":
86
        echo $adminMenu->addNavigation("pedigree_trash.php");
87
        $adminMenu->addItemButton(_AM_PEDIGREE_PEDIGREE_TRASHLIST, 'pedigree_trash.php?op=list', 'list');
88
        echo $adminMenu->renderButton();
89
90
        $obj  =& $pedigreeTrashHandler->create();
91
        $form = $obj->getForm();
92
        $form->display();
93
        break;
94
95 View Code Duplication
    case "save_pedigree_trash":
96
        if (!$GLOBALS["xoopsSecurity"]->check()) {
97
            redirect_header("pedigree_trash.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors()));
98
        }
99
        if (isset($_REQUEST["ID"])) {
100
            $obj =& $pedigreeTrashHandler->get($_REQUEST["ID"]);
101
        } else {
102
            $obj =& $pedigreeTrashHandler->create();
103
        }
104
105
        //Form NAAM
106
        $obj->setVar("NAAM", $_REQUEST["NAAM"]);
107
        //Form id_owner
108
        $obj->setVar("id_owner", $_REQUEST["id_owner"]);
109
        //Form id_breeder
110
        $obj->setVar("id_breeder", $_REQUEST["id_breeder"]);
111
        //Form user
112
        $obj->setVar("user", $_REQUEST["user"]);
113
        //Form roft
114
        $obj->setVar("roft", $_REQUEST["roft"]);
115
        //Form mother
116
        $obj->setVar("mother", $_REQUEST["mother"]);
117
        //Form father
118
        $obj->setVar("father", $_REQUEST["father"]);
119
        //Form foto
120
        $obj->setVar("foto", $_REQUEST["foto"]);
121
        //Form coi
122
        $obj->setVar("coi", $_REQUEST["coi"]);
123
124
        if ($pedigreeTrashHandler->insert($obj)) {
125
            redirect_header("pedigree_trash.php?op=list", 2, _AM_PEDIGREE_FORMOK);
126
        }
127
128
        echo $obj->getHtmlErrors();
129
        $form =& $obj->getForm();
130
        $form->display();
131
        break;
132
133 View Code Duplication
    case "edit_pedigree_trash":
134
        echo $adminMenu->addNavigation("pedigree_trash.php");
135
        $adminMenu->addItemButton(_AM_PEDIGREE_NEWPEDIGREE_TRASH, 'pedigree_trash.php?op=new_pedigree_trash', 'add');
136
        $adminMenu->addItemButton(_AM_PEDIGREE_PEDIGREE_TRASHLIST, 'pedigree_trash.php?op=list', 'list');
137
        echo $adminMenu->renderButton();
138
        $obj  = $pedigreeTrashHandler->get($_REQUEST["ID"]);
139
        $form = $obj->getForm();
140
        $form->display();
141
        break;
142
143 View Code Duplication
    case "delete_pedigree_trash":
144
        $obj =& $pedigreeTrashHandler->get($_REQUEST["ID"]);
145
        if (isset($_REQUEST["ok"]) && $_REQUEST["ok"] == 1) {
146
            if (!$GLOBALS["xoopsSecurity"]->check()) {
147
                redirect_header("pedigree_trash.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors()));
148
            }
149
            if ($pedigreeTrashHandler->delete($obj)) {
150
                redirect_header("pedigree_trash.php", 3, _AM_PEDIGREE_FORMDELOK);
151
            } else {
152
                echo $obj->getHtmlErrors();
153
            }
154
        } else {
155
            xoops_confirm(array("ok" => 1, "ID" => $_REQUEST["ID"], "op" => "delete_pedigree_trash"), $_SERVER["REQUEST_URI"], sprintf(_AM_PEDIGREE_FORMSUREDEL, $obj->getVar("pedigree_trash")));
156
        }
157
        break;
158
}
159
include_once 'admin_footer.php';
160