dolibarr 21.0.0-alpha
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 *
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 * or see https://www.gnu.org/
18 */
19
29class FormCron extends Form
30{
34 public $db;
35
39 public $error = '';
40
46 public function __construct($db)
47 {
48 $this->db = $db;
49 }
50
51
52 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
61 public function select_typejob($htmlname, $selected = 0, $readonly = 0)
62 {
63 // phpcs:enable
64 global $langs;
65
66 $langs->load('cron');
67
68 $out = '';
69 if (!empty($readonly)) {
70 if ($selected == 'command') {
71 $out = img_picto('', 'terminal', 'class="pictofixedwidth marginrightonly"').'<span class="">'.$langs->trans('CronType_command').'</span>';
72 } elseif ($selected == 'method') {
73 $out = img_picto('', 'code', 'class="pictofixedwidth marginrightonly"').'<span class="">'.$langs->trans('CronType_method').'</span>';
74 }
75 } else {
76 $out = '<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
77
78 if ($selected == 'command') {
79 $selected_attr = ' selected ';
80 } else {
81 $selected_attr = '';
82 }
83 $out .= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
84
85 if ($selected == 'method') {
86 $selected_attr = ' selected ';
87 } else {
88 $selected_attr = '';
89 }
90 $out .= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
91
92 $out .= '</SELECT>';
93 }
94 if (empty($readonly)) {
95 $out .= ajax_combobox($htmlname);
96 }
97
98 return $out;
99 }
100}
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:457
Class to manage building of HTML components.
__construct($db)
Constructor.
select_typejob($htmlname, $selected=0, $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)
Show picto whatever it's its name (generic function)