dolibarr  7.0.0-beta
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 {
31  var $db;
32  var $error;
33 
39  function __construct($db)
40  {
41  $this->db = $db;
42  return 1;
43  }
44 
45 
54  function select_typejob($htmlname,$selected=0,$readonly=0)
55  {
56  global $langs;
57 
58  $langs->load('cron@cron');
59  if (!empty($readonly)) {
60  if ($selected=='command') {
61  $out= $langs->trans('CronType_command');
62  $out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
63  $out.= '<OPTION value="command" selected>'.$langs->trans('CronType_command').'</OPTION>';
64  $out.='</SELECT>';
65  } elseif ($selected=='method') {
66  $out= $langs->trans('CronType_method');
67  $out.='<SELECT name="'.$htmlname.'" id="'.$htmlname.'" style="display:none"/>';
68  $out.= '<OPTION value="method" selected>'.$langs->trans('CronType_method').'</OPTION>';
69  $out.='</SELECT>';
70  }
71  }else {
72 
73  $out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
74 
75  if ($selected=='command') {
76  $selected_attr=' selected ';
77  } else {
78  $selected_attr='';
79  }
80  $out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
81 
82  if ($selected=='method') {
83  $selected_attr=' selected ';
84  } else {
85  $selected_attr='';
86  }
87  $out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
88 
89  $out.='</SELECT>';
90  }
91 
92  return $out;
93  }
94 }
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.