1 | <?php |
||
2 | /* Copyright (C) 2019 Alxarafe <[email protected]> |
||
3 | * |
||
4 | * This program is free software; you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU General Public License as published by |
||
6 | * the Free Software Foundation; either version 3 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * This program is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU General Public License |
||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
16 | */ |
||
17 | namespace Alixar\Views; |
||
18 | |||
19 | use Alxarafe\Helpers\Skin; |
||
20 | use Alixar\Helpers\Globals; |
||
21 | use Alixar\Base\Form; |
||
22 | use Alixar\Base\FormOther; |
||
23 | |||
24 | class CategoriesView extends \Alixar\Base\AlixarView |
||
25 | { |
||
26 | |||
27 | public $backgroundImage; |
||
28 | public $mainLoginBackgroundImage; |
||
29 | public $useJMobile; |
||
30 | public $focusElement; |
||
31 | public $url; |
||
32 | public $token; |
||
33 | public $hideTopmenu; |
||
34 | public $hideLeftmenu; |
||
35 | public $optimizeSmallscreen; |
||
36 | public $noMouseHover; |
||
37 | |||
38 | public function __construct($ctrl) |
||
39 | { |
||
40 | parent::__construct($ctrl); |
||
41 | $this->draw(); |
||
42 | $this->vars(); |
||
43 | Skin::setTemplate('categories'); |
||
44 | } |
||
45 | |||
46 | public function vars() |
||
47 | { |
||
48 | |||
49 | } |
||
50 | |||
51 | public function draw() |
||
52 | { |
||
53 | /* |
||
54 | * View |
||
55 | */ |
||
56 | |||
57 | var_dump($_POST); |
||
0 ignored issues
–
show
Security
Debugging Code
introduced
by
Loading history...
|
|||
58 | var_dump($_GET); |
||
59 | |||
60 | $action = filter_input(INPUT_GET, 'action') ?? ''; |
||
61 | |||
62 | $form = new Form(); |
||
63 | $formother = new FormOther(); |
||
64 | |||
65 | $helpurl = ''; |
||
66 | $this->llxHeader("", Globals::$langs->trans("Categories"), $helpurl); |
||
67 | |||
68 | if (Globals::$user->rights->categorie->creer) { |
||
69 | // Create or add |
||
70 | if ($action == 'create' || filter_input(INPUT_POST, "addcat") == 'addcat') { |
||
71 | DolUtils::dol_set_focus('#label'); |
||
72 | |||
73 | print '<form action="' . $_SERVER['PHP_SELF'] . '?type=' . $type . '" method="POST">'; |
||
74 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
||
75 | print '<input type="hidden" name="urlfrom" value="' . $urlfrom . '">'; |
||
76 | print '<input type="hidden" name="action" value="add">'; |
||
77 | print '<input type="hidden" name="addcat" value="addcat">'; |
||
78 | print '<input type="hidden" name="id" value="' . DolUtils::GETPOST('origin', 'alpha') . '">'; |
||
79 | print '<input type="hidden" name="type" value="' . $type . '">'; |
||
80 | print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
||
81 | if ($origin) |
||
82 | { |
||
83 | print '<input type="hidden" name="origin" value="' . $origin . '">'; |
||
84 | } |
||
85 | if ($catorigin) |
||
86 | { |
||
87 | print '<input type="hidden" name="catorigin" value="' . $catorigin . '">'; |
||
88 | } |
||
89 | |||
90 | print load_fiche_titre($langs->trans("CreateCat")); |
||
91 | |||
92 | DolUtils::dol_fiche_head(''); |
||
93 | |||
94 | print '<table width="100%" class="border">'; |
||
95 | |||
96 | // Ref |
||
97 | print '<tr>'; |
||
98 | print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Ref") . '</td><td><input id="label" class="minwidth100" name="label" value="' . $label . '">'; |
||
99 | print'</td></tr>'; |
||
100 | |||
101 | // Description |
||
102 | print '<tr><td class="tdtop">' . $langs->trans("Description") . '</td><td>'; |
||
103 | //require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
||
104 | $doleditor = new DolEditor('description', $description, '', 200, 'dolibarr_notes', '', false, true, Globals::$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_6, '90%'); |
||
105 | $doleditor->Create(); |
||
106 | print '</td></tr>'; |
||
107 | |||
108 | // Color |
||
109 | print '<tr><td>' . $langs->trans("Color") . '</td><td>'; |
||
110 | print $formother->selectColor($color, 'color'); |
||
111 | print '</td></tr>'; |
||
112 | |||
113 | // Parent category |
||
114 | print '<tr><td>' . $langs->trans("AddIn") . '</td><td>'; |
||
115 | print $form->select_all_categories($type, $catorigin, 'parent'); |
||
116 | print ajax_combobox('parent'); |
||
117 | print '</td></tr>'; |
||
118 | |||
119 | $parameters = array(); |
||
120 | $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
||
121 | print Globals::$hookManager->resPrint; |
||
122 | if (empty($reshook)) { |
||
123 | print $object->showOptionals($extrafields, 'edit'); |
||
124 | } |
||
125 | |||
126 | print '</table>'; |
||
127 | |||
128 | DolUtils::dol_fiche_end(''); |
||
129 | |||
130 | print '<div class="center">'; |
||
131 | print '<input type="submit" class="button" value="' . $langs->trans("CreateThisCat") . '" name="creation" />'; |
||
132 | print ' '; |
||
133 | print '<input type="submit" class="button" value="' . $langs->trans("Cancel") . '" name="cancel" />'; |
||
134 | print '</div>'; |
||
135 | |||
136 | print '</form>'; |
||
137 | } |
||
138 | } |
||
139 | |||
140 | // End of page |
||
141 | $this->llxFooter(); |
||
142 | //$db->close(); |
||
143 | } |
||
144 | } |
||
145 |