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 Alixar\Helpers\Globals; |
||
20 | use Alixar\Base\Form; |
||
21 | use Alixar\Base\FormOther; |
||
22 | |||
23 | class CategoriesView extends \Alixar\Base\AlixarView |
||
24 | { |
||
25 | |||
26 | public $backgroundImage; |
||
27 | public $mainLoginBackgroundImage; |
||
28 | public $useJMobile; |
||
29 | public $focusElement; |
||
30 | public $url; |
||
31 | public $token; |
||
32 | public $hideTopmenu; |
||
33 | public $hideLeftmenu; |
||
34 | public $optimizeSmallscreen; |
||
35 | public $noMouseHover; |
||
36 | |||
37 | public function __construct($ctrl) |
||
38 | { |
||
39 | parent::__construct($ctrl); |
||
40 | $this->draw(); |
||
41 | $this->vars(); |
||
42 | Skin::setTemplate('categories'); |
||
43 | } |
||
44 | |||
45 | public function vars() |
||
46 | { |
||
47 | |||
48 | } |
||
49 | |||
50 | public function draw() |
||
51 | { |
||
52 | /* |
||
53 | * View |
||
54 | */ |
||
55 | |||
56 | $form = new Form(); |
||
57 | $formother = new FormOther(); |
||
58 | |||
59 | $helpurl = ''; |
||
60 | $this->llxHeader("", Globals::$langs->trans("Categories"), $helpurl); |
||
61 | |||
62 | if (Globals::$user->rights->categorie->creer) { |
||
63 | // Create or add |
||
64 | if ($action == 'create' || $_POST["addcat"] == 'addcat') { |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
65 | DolUtils::dol_set_focus('#label'); |
||
66 | |||
67 | print '<form action="' . $_SERVER['PHP_SELF'] . '?type=' . $type . '" method="POST">'; |
||
68 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
||
69 | print '<input type="hidden" name="urlfrom" value="' . $urlfrom . '">'; |
||
70 | print '<input type="hidden" name="action" value="add">'; |
||
71 | print '<input type="hidden" name="addcat" value="addcat">'; |
||
72 | print '<input type="hidden" name="id" value="' . DolUtils::GETPOST('origin', 'alpha') . '">'; |
||
73 | print '<input type="hidden" name="type" value="' . $type . '">'; |
||
74 | print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
||
75 | if ($origin) |
||
76 | { |
||
77 | print '<input type="hidden" name="origin" value="' . $origin . '">'; |
||
78 | } |
||
79 | if ($catorigin) |
||
80 | { |
||
81 | print '<input type="hidden" name="catorigin" value="' . $catorigin . '">'; |
||
82 | } |
||
83 | |||
84 | print load_fiche_titre($langs->trans("CreateCat")); |
||
85 | |||
86 | DolUtils::dol_fiche_head(''); |
||
87 | |||
88 | print '<table width="100%" class="border">'; |
||
89 | |||
90 | // Ref |
||
91 | print '<tr>'; |
||
92 | print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Ref") . '</td><td><input id="label" class="minwidth100" name="label" value="' . $label . '">'; |
||
93 | print'</td></tr>'; |
||
94 | |||
95 | // Description |
||
96 | print '<tr><td class="tdtop">' . $langs->trans("Description") . '</td><td>'; |
||
97 | //require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
||
98 | $doleditor = new DolEditor('description', $description, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_6, '90%'); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
99 | $doleditor->Create(); |
||
100 | print '</td></tr>'; |
||
101 | |||
102 | // Color |
||
103 | print '<tr><td>' . $langs->trans("Color") . '</td><td>'; |
||
104 | print $formother->selectColor($color, 'color'); |
||
105 | print '</td></tr>'; |
||
106 | |||
107 | // Parent category |
||
108 | print '<tr><td>' . $langs->trans("AddIn") . '</td><td>'; |
||
109 | print $form->select_all_categories($type, $catorigin, 'parent'); |
||
110 | print ajax_combobox('parent'); |
||
111 | print '</td></tr>'; |
||
112 | |||
113 | $parameters = array(); |
||
114 | $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
||
115 | print Globals::$hookManager->resPrint; |
||
116 | if (empty($reshook)) { |
||
117 | print $object->showOptionals($extrafields, 'edit'); |
||
118 | } |
||
119 | |||
120 | print '</table>'; |
||
121 | |||
122 | DolUtils::dol_fiche_end(''); |
||
123 | |||
124 | print '<div class="center">'; |
||
125 | print '<input type="submit" class="button" value="' . $langs->trans("CreateThisCat") . '" name="creation" />'; |
||
126 | print ' '; |
||
127 | print '<input type="submit" class="button" value="' . $langs->trans("Cancel") . '" name="cancel" />'; |
||
128 | print '</div>'; |
||
129 | |||
130 | print '</form>'; |
||
131 | } |
||
132 | } |
||
133 | |||
134 | // End of page |
||
135 | $this->llxFooter(); |
||
136 | //$db->close(); |
||
137 | } |
||
138 | } |
||
139 |