dolibarr  9.0.0
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 <http://www.gnu.org/licenses/>.
17  * or see http://www.gnu.org/
18  */
19 
29 class FormCron extends Form
30 {
34  public $db;
35 
39  public $error='';
40 
46  function __construct($db)
47  {
48  $this->db = $db;
49  }
50 
51 
52  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
61  function select_typejob($htmlname,$selected=0,$readonly=0)
62  {
63  // phpcs:enable
64  global $langs;
65 
66  $langs->load('cron@cron');
67  if (!empty($readonly)) {
68  if ($selected=='command') {
69  $out= $langs->trans('CronType_command');
70  $out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
71  $out.= '<OPTION value="command" selected>'.$langs->trans('CronType_command').'</OPTION>';
72  $out.='</SELECT>';
73  } elseif ($selected=='method') {
74  $out= $langs->trans('CronType_method');
75  $out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
76  $out.= '<OPTION value="method" selected>'.$langs->trans('CronType_method').'</OPTION>';
77  $out.='</SELECT>';
78  }
79  }else {
80 
81  $out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
82 
83  if ($selected=='command') {
84  $selected_attr=' selected ';
85  } else {
86  $selected_attr='';
87  }
88  $out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
89 
90  if ($selected=='method') {
91  $selected_attr=' selected ';
92  } else {
93  $selected_attr='';
94  }
95  $out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
96 
97  $out.='</SELECT>';
98  }
99 
100  return $out;
101  }
102 }
Class to manage building of HTML components.
__construct($db)
Constructor.
Class to manage generation of HTML components Only common components must be here.
select_typejob($htmlname, $selected=0, $readonly=0)
Display On Off selector.