62 public function selectWebsite($selected =
'', $htmlname =
'exportmodelid', $useempty = 0)
66 $sql =
"SELECT rowid, ref";
67 $sql .=
" FROM ".MAIN_DB_PREFIX.
"website";
68 $sql .=
" WHERE 1 = 1";
69 $sql .=
" ORDER BY rowid";
70 $result = $this->
db->query($sql);
73 $out .=
'<select class="flat minwidth100" name="'.$htmlname.
'" id="'.$htmlname.
'">';
76 $out .=
'<option value="-1"> </option>';
79 $num = $this->
db->num_rows($result);
83 $obj = $this->
db->fetch_object($result);
84 if ($selected == $obj->rowid)
86 $out .=
'<option value="'.$obj->rowid.
'" selected>';
88 $out .=
'<option value="'.$obj->rowid.
'">';
115 global $langs, $conf, $user;
117 $langs->load(
"admin");
119 $sql =
"SELECT rowid, code, label, entity";
120 $sql .=
" FROM ".MAIN_DB_PREFIX.
'c_type_container';
121 $sql .=
" WHERE active = 1 AND entity IN (".getEntity(
'c_type_container').
")";
122 $sql .=
" ORDER BY label";
124 dol_syslog(get_class($this).
"::selectTypeOfContainer", LOG_DEBUG);
125 $result = $this->
db->query($sql);
128 $num = $this->
db->num_rows($result);
132 print '<select id="select'.$htmlname.
'" class="flat selectTypeOfContainer minwidth200" name="'.$htmlname.
'"'.($moreattrib ?
' '.$moreattrib :
'').
'>';
133 if ($useempty == 1 || ($useempty == 2 &&
$num > 1))
135 print '<option value="-1"> </option>';
140 $obj = $this->
db->fetch_object($result);
141 if ($selected == $obj->rowid || $selected == $obj->code)
143 print '<option value="'.$obj->code.
'" selected>';
145 print '<option value="'.$obj->code.
'">';
152 if ($user->admin)
print info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
158 print $langs->trans(
"NoTypeOfPagePleaseEditDictionary");
178 global $langs, $conf, $user;
180 $langs->load(
"admin");
182 $listofsamples =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/website/samples',
'files', 0,
'^page-sample-.*\.html$');
184 $arrayofsamples = array();
185 $arrayofsamples[
'empty'] =
'EmptyPage';
186 foreach ($listofsamples as $sample)
189 if (preg_match(
'/^page-sample-(.*)\.html$/', $sample[
'name'], $reg))
192 $labelkey = ucfirst($key);
193 if ($key ==
'empty') $labelkey =
'EmptyPage';
194 $arrayofsamples[$key] = $labelkey;
199 $out .=
'<select id="select'.$htmlname.
'" class="flat selectTypeOfContainer minwidth200" name="'.$htmlname.
'"'.($moreattrib ?
' '.$moreattrib :
'').
'>';
201 if ($useempty == 1 || $useempty == 2)
203 $out .=
'<option value="-1"> </option>';
206 foreach ($arrayofsamples as $key => $val)
208 if ($selected == $key)
210 $out .=
'<option value="'.$key.
'" selected>';
212 $out .=
'<option value="'.$key.
'">';
214 $out .= $langs->trans($val);
240 public function selectContainer($website, $htmlname =
'pageid', $pageid = 0, $showempty = 0, $action =
'', $morecss =
'minwidth200', $excludeids = null)
244 $atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
247 if ($atleastonepage && $action !=
'editsource')
249 $out .=
'<select name="'.$htmlname.
'" id="'.$htmlname.
'" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'">';
251 $out .=
'<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'" disabled="disabled">';
254 if ($showempty || !$atleastonepage) $out .=
'<option value="-1"> </option>';
258 if (empty($pageid) && $action !=
'createcontainer')
260 $firstpageid = 0; $homepageid = 0;
261 foreach ($website->lines as $key => $valpage)
263 if (empty($firstpageid)) $firstpageid = $valpage->id;
264 if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid = $valpage->id;
266 $pageid = $homepageid ? $homepageid : $firstpageid;
269 foreach ($website->lines as $key => $valpage)
271 if (is_array($excludeids) && count($excludeids) && in_array($valpage->id, $excludeids))
continue;
273 $valueforoption =
'<span class="opacitymedium">['.$valpage->type_container.
' '.sprintf(
"%03d", $valpage->id).
']</span> ';
274 $valueforoption .= $valpage->pageurl.
' - '.$valpage->title;
275 if ($website->otherlang) {
276 if ($valpage->lang) {
277 $valueforoption .=
' <span class="opacitymedium">('.$valpage->lang.
')</span>';
280 if ($website->fk_default_home && $key == $website->fk_default_home) {
282 $valueforoption .=
' <span class="opacitymedium fa fa-home"></span>';
285 $out .=
'<option value="'.$key.
'"';
286 if ($pageid > 0 && $pageid == $key) $out .=
' selected';
287 $out .=
' data-html="'.dol_escape_htmltag($valueforoption).
'"';
289 $out .= $valueforoption;
297 if ($atleastonepage && $action !=
'editsource')
301 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.$pageid.
'">';
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.