dolibarr 22.0.5
html.formcron.class.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
30class FormCron extends Form
31{
35 public $db;
36
40 public $error = '';
41
47 public function __construct($db)
48 {
49 $this->db = $db;
50 }
51
52
53 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
62 public function select_typejob($htmlname, $selected = '', $readonly = 0)
63 {
64 // phpcs:enable
65 global $langs;
66
67 $langs->load('cron');
68
69 $out = '';
70 if (!empty($readonly)) {
71 if ($selected == 'command') {
72 $out = img_picto('', 'terminal', 'class="pictofixedwidth marginrightonly"').'<span class="">'.$langs->trans('CronType_command').'</span>';
73 } elseif ($selected == 'method') {
74 $out = img_picto('', 'code', 'class="pictofixedwidth marginrightonly"').'<span class="">'.$langs->trans('CronType_method').'</span>';
75 }
76 } else {
77 $out = '<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
78
79 if ($selected == 'command') {
80 $selected_attr = ' selected ';
81 } else {
82 $selected_attr = '';
83 }
84 $out .= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
85
86 if ($selected == 'method') {
87 $selected_attr = ' selected ';
88 } else {
89 $selected_attr = '';
90 }
91 $out .= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
92
93 $out .= '</SELECT>';
94 }
95 if (empty($readonly)) {
96 $out .= ajax_combobox($htmlname);
97 }
98
99 return $out;
100 }
101}
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:475
Class to manage building of HTML components.
__construct($db)
Constructor.
select_typejob($htmlname, $selected='', $readonly=0)
Display On Off selector.
Class to manage generation of HTML components Only common components must be here.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)