dolibarr 21.0.0-beta
resource_add.tpl.php
1<!-- BEGIN TEMPLATE resource_add.tpl.php -->
2<?php
3/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
28// Protection to avoid direct call of template
29if (empty($conf) || !is_object($conf)) {
30 print "Error, template page can't be called as URL";
31 exit(1);
32}
33
34
35require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
36
37$form = new Form($db);
38$formresources = new FormResource($db);
39
40$out = '';
41
42$out .= '<div class="centpercent allwidth nohover">';
43
44$out .= '<form class="nohover '.(!empty($var) && $var == true ? 'pair' : 'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
45$out .= '<input type="hidden" name="token" value="'.newToken().'">';
46$out .= '<input type="hidden" name="action" value="add_element_resource">';
47$out .= '<input type="hidden" name="element" value="'.$element.'">';
48$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
49$out .= '<input type="hidden" name="ref" value="'.$element_ref.'">';
50$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';
51
52$out .= '<div class="noborder borderbottom">';
53
54// Place
55$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">'.$langs->trans("SelectResource").'</div>';
56$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
57$events = array();
58$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
59$out .= $formresources->select_resource_list(0, 'fk_resource', [], 1, 1, 0, $events, '', 2, 0);
60$out .= '</div>';
61
62$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block marginleftonly"><label for="resbusy">'.$langs->trans('Busy').'</label> ';
63//$out .= $form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1);
64$out .= '<input type="checkbox" id="resbusy" name="busy" value="1"'.(GETPOSTISSET('fk_resource') ? (GETPOST('busy') ? ' checked' : '') : ' checked').'>';
65$out .= '</div>';
66$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block marginleftonly"><label for="resmandatory">'.$langs->trans('Mandatory').'</label> ';
67//$out .= $form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1);
68$out .= '<input type="checkbox" id="resmandatory" name="mandatory" value="1"'.(GETPOSTISSET('fk_resource') ? (GETPOST('mandatory') ? ' checked' : '') : ' checked').'>';
69$out .= '</div>';
70
71$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block right">';
72$out .= '<input type="submit" id="add-resource-place" class="button button-add small" value="'.$langs->trans("Add").'"/>';
73$out .= '</div>';
74
75$out .= '</div>';
76
77$out .= '</form>';
78
79$out .= '</div>';
80$out .= '<br>';
81
82print $out;
83?>
84<!-- END TEMPLATE resource_add.tpl.php -->
Class to manage generation of HTML components Only common components must be here.
Class to manage forms for the module resource.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79