65 public function select_language($selected =
'', $htmlname =
'lang_id', $showauto = 0, $filter = null, $showempty =
'', $showwarning = 0, $disabled = 0, $morecss =
'', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = null, $mainlangonly = 0)
70 if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1;
72 $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
76 $out .=
'<select '.($multiselect ?
'multiple="multiple" ' :
'').
'class="flat'.($morecss ?
' '.$morecss :
'').
'" id="'.$htmlname.
'" name="'.$htmlname.($multiselect ?
'[]' :
'').
'"'.($disabled ?
' disabled' :
'').
'>';
77 if ($showempty && !$multiselect)
79 $out .=
'<option value="0"';
80 if ($selected ==
'') $out .=
' selected';
82 if ($showempty !=
'1') $out .= $showempty;
83 else $out .=
' ';
88 $out .=
'<option value="auto"';
89 if ($selected ==
'auto') $out .=
' selected';
90 $out .=
'>'.$langs->trans(
"AutoDetectLang").
'</option>';
93 asort($langs_available);
95 foreach ($langs_available as $key => $value)
97 $valuetoshow = $value;
99 if ($mainlangonly) $valuetoshow =
'<span class="opacitymedium">'.preg_replace(
'/[_-].*$/',
'', $key).
'</span> - '.$value;
100 else $valuetoshow =
'<span class="opacitymedium">'.$key.
'</span> - '.$value;
102 if ($showcode == 2) {
103 if ($mainlangonly) $valuetoshow = $value.
' <span class="opacitymedium">('.preg_replace(
'/[_-].*$/',
'', $key).
')</span>';
104 else $valuetoshow = $value.
' <span class="opacitymedium">('.$key.
')</span>';
108 if ($mainlangonly) $keytouse = preg_replace(
'/[_-].*$/',
'', $key);
110 if ($filter && is_array($filter) && array_key_exists($keytouse, $filter)) {
113 if ($onlykeys && is_array($onlykeys) && !array_key_exists($keytouse, $onlykeys)) {
117 $valuetoshow .=
' '.picto_from_langcode($key,
'class="saturatemedium"');
118 if ($selected == $keytouse) {
119 $out .=
'<option value="'.$keytouse.
'" selected data-html="'.
dol_escape_htmltag($valuetoshow).
'">'.$valuetoshow.
'</option>';
121 $out .=
'<option value="'.$keytouse.
'" data-html="'.
dol_escape_htmltag($valuetoshow).
'">'.$valuetoshow.
'</option>';
129 include_once DOL_DOCUMENT_ROOT.
'/core/lib/ajax.lib.php';
146 public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib =
'')
149 global $langs, $conf;
155 if (!is_array($dirmenuarray))
return -1;
157 $menuarray = array();
158 foreach ($conf->file->dol_document_root as $dirroot)
160 foreach ($dirmenuarray as $dirtoscan)
162 $dir = $dirroot.$dirtoscan;
166 $handle = opendir($dir);
167 if (is_resource($handle))
169 while (($file = readdir($handle)) !==
false)
171 if (is_file($dir.
"/".$file) && substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS' && substr($file, 0, 5) !=
'index')
173 if (preg_match(
'/lib\.php$/i', $file))
continue;
174 if (preg_match(
'/eldy_(backoffice|frontoffice)\.php$/i', $file))
continue;
175 if (preg_match(
'/auguria_(backoffice|frontoffice)\.php$/i', $file))
continue;
176 if (preg_match(
'/smartphone_(backoffice|frontoffice)\.php$/i', $file))
continue;
178 $filelib = preg_replace(
'/\.php$/i',
'', $file);
181 if (preg_match(
'/^eldy/i', $file)) $prefix =
'0';
182 elseif (preg_match(
'/^smartphone/i', $file)) $prefix =
'2';
185 if ($file == $selected)
187 $menuarray[$prefix.
'_'.$file] =
'<option value="'.$file.
'" selected>'.$filelib.
'</option>';
189 $menuarray[$prefix.
'_'.$file] =
'<option value="'.$file.
'">'.$filelib.
'</option>';
201 print '<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'"'.($moreattrib ?
' '.$moreattrib :
'').
'>';
203 foreach ($menuarray as $key => $val)
205 $tab = explode(
'_', $key);
206 $newprefix = $tab[0];
207 if ($newprefix ==
'1' && ($conf->global->MAIN_FEATURES_LEVEL < 1))
continue;
208 if ($newprefix ==
'2' && ($conf->global->MAIN_FEATURES_LEVEL < 2))
continue;
209 if ($newprefix != $oldprefix)
212 print '<option value="-1" disabled>';
213 if ($newprefix ==
'0')
print '-- '.$langs->trans(
"VersionRecommanded").
' --';
214 if ($newprefix ==
'1')
print '-- '.$langs->trans(
"VersionExperimental").
' --';
215 if ($newprefix ==
'2')
print '-- '.$langs->trans(
"VersionDevelopment").
' --';
216 if ($newprefix ==
'3')
print '-- '.$langs->trans(
"Other").
' --';
218 $oldprefix = $newprefix;
237 global $langs, $conf;
240 $expdevmenu = array();
242 $menuarray = array();
244 foreach ($dirmenuarray as $dirmenu)
246 foreach ($conf->file->dol_document_root as $dirroot)
248 $dir = $dirroot.$dirmenu;
251 $handle = opendir($dir);
252 if (is_resource($handle))
254 while (($file = readdir($handle)) !==
false)
256 if (is_file($dir.
"/".$file) && substr($file, 0, 1) <>
'.' && substr($file, 0, 3) <>
'CVS')
258 $filelib = preg_replace(
'/(_backoffice|_frontoffice)?\.php$/i',
'', $file);
259 if (preg_match(
'/^index/i', $filelib))
continue;
260 if (preg_match(
'/^default/i', $filelib))
continue;
261 if (preg_match(
'/^empty/i', $filelib))
continue;
262 if (preg_match(
'/\.lib/i', $filelib))
continue;
263 if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu))
continue;
265 $menuarray[$filelib] = 1;
267 $menuarray[
'all'] = 1;
278 print '<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'">';
280 foreach ($menuarray as $key => $val)
282 $tab = explode(
'_', $key);
283 $newprefix = $tab[0];
284 print '<option value="'.$key.
'"';
285 if ($key == $selected)
290 if ($key ==
'all')
print $langs->trans(
"AllMenus");
292 print '</option>'.
"\n";
309 global $langs, $conf;
311 print '<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'">';
312 print '<option value="-1"> </option>';
315 "Pacific/Midway"=>
"GMT-11:00",
316 "Pacific/Fakaofo"=>
"GMT-10:00",
317 "America/Anchorage"=>
"GMT-09:00",
318 "America/Los_Angeles"=>
"GMT-08:00",
319 "America/Dawson_Creek"=>
"GMT-07:00",
320 "America/Chicago"=>
"GMT-06:00",
321 "America/Bogota"=>
"GMT-05:00",
322 "America/Anguilla"=>
"GMT-04:00",
323 "America/Araguaina"=>
"GMT-03:00",
324 "America/Noronha"=>
"GMT-02:00",
325 "Atlantic/Azores"=>
"GMT-01:00",
326 "Africa/Abidjan"=>
"GMT+00:00",
327 "Europe/Paris"=>
"GMT+01:00",
328 "Europe/Helsinki"=>
"GMT+02:00",
329 "Europe/Moscow"=>
"GMT+03:00",
330 "Asia/Dubai"=>
"GMT+04:00",
331 "Asia/Karachi"=>
"GMT+05:00",
332 "Indian/Chagos"=>
"GMT+06:00",
333 "Asia/Jakarta"=>
"GMT+07:00",
334 "Asia/Hong_Kong"=>
"GMT+08:00",
335 "Asia/Tokyo"=>
"GMT+09:00",
336 "Australia/Sydney"=>
"GMT+10:00",
337 "Pacific/Noumea"=>
"GMT+11:00",
338 "Pacific/Auckland"=>
"GMT+12:00",
339 "Pacific/Enderbury"=>
"GMT+13:00"
341 foreach ($arraytz as $lib => $gmt) {
342 print '<option value="'.$lib.
'"';
343 if ($selected == $lib || $selected == $gmt)
print ' selected';
344 print '>'.$gmt.
'</option>'.
"\n";
361 public function select_paper_format($selected =
'', $htmlname =
'paperformat_id', $filter = 0, $showempty = 0)
366 $langs->load(
"dict");
368 $sql =
"SELECT code, label, width, height, unit";
369 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_paper_format";
370 $sql .=
" WHERE active=1";
371 if ($filter) $sql .=
" AND code LIKE '%".$this->db->escape($filter).
"%'";
380 $obj = $this->
db->fetch_object(
$resql);
381 $unitKey = $langs->trans(
'SizeUnit'.$obj->unit);
383 $paperformat[$obj->code] = $langs->trans(
'PaperFormat'.strtoupper($obj->code)).
' - '.round($obj->width).
'x'.round($obj->height).
' '.($unitKey ==
'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
393 $out .=
'<select class="flat" id="'.$htmlname.
'" name="'.$htmlname.
'">';
396 $out .=
'<option value=""';
397 if ($selected ==
'') $out .=
' selected';
398 $out .=
'> </option>';
400 foreach ($paperformat as $key => $value)
402 if ($selected == $key)
404 $out .=
'<option value="'.$key.
'" selected>'.$value.
'</option>';
406 $out .=
'<option value="'.$key.
'">'.$value.
'</option>';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
$conf db
API class for accounts.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...