62 public function selectWebsite($selected =
'', $htmlname =
'exportmodelid', $useempty = 0)
66 $sql =
"SELECT rowid, ref";
67 $sql .=
" FROM ".$this->db->prefix().
"website";
68 $sql .=
" WHERE 1 = 1";
69 $sql .=
" ORDER BY rowid";
70 $result = $this->db->query($sql);
72 $out .=
'<select class="flat minwidth100" name="'.$htmlname.
'" id="'.$htmlname.
'">';
74 $out .=
'<option value="-1"> </option>';
77 $num = $this->db->num_rows($result);
80 $obj = $this->db->fetch_object($result);
81 if ($selected == $obj->rowid) {
82 $out .=
'<option value="'.$obj->rowid.
'" selected>';
84 $out .=
'<option value="'.$obj->rowid.
'">';
110 public function selectTypeOfContainer($htmlname, $selected =
'', $useempty = 0, $moreattrib =
'', $addjscombo = 0, $morecss =
'minwidth200')
112 global $langs, $conf, $user;
114 $langs->load(
"admin");
116 $sql =
"SELECT rowid, code, label, entity";
117 $sql .=
" FROM ".$this->db->prefix().
'c_type_container';
118 $sql .=
" WHERE active = 1 AND entity IN (".getEntity(
'c_type_container').
")";
119 $sql .=
" ORDER BY label";
121 dol_syslog(get_class($this).
"::selectTypeOfContainer", LOG_DEBUG);
122 $result = $this->db->query($sql);
124 $num = $this->db->num_rows($result);
127 print
'<select id="select'.$htmlname.
'" class="flat selectTypeOfContainer'.($morecss ?
' '.$morecss :
'').
'" name="'.$htmlname.
'"'.($moreattrib ?
' '.$moreattrib :
'').
'>';
128 if ($useempty == 1 || ($useempty == 2 &&
$num > 1)) {
129 print
'<option value="-1"> </option>';
133 $obj = $this->db->fetch_object($result);
134 if ($selected == $obj->rowid || $selected == $obj->code) {
135 print
'<option value="'.$obj->code.
'" selected>';
137 print
'<option value="'.$obj->code.
'">';
139 print $langs->trans($obj->label);
145 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
152 print $langs->trans(
"NoTypeOfPagePleaseEditDictionary");
171 public function selectSampleOfContainer($htmlname, $selected =
'', $useempty = 0, $moreattrib =
'', $addjscombo = 0, $morecss =
'minwidth200')
173 global $langs, $conf, $user;
175 $langs->load(
"admin");
177 $listofsamples =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/website/samples',
'files', 0,
'^page-sample-.*\.html$');
179 $arrayofsamples = array();
180 $arrayofsamples[
'empty'] =
'EmptyPage';
181 foreach ($listofsamples as $sample) {
183 if (preg_match(
'/^page-sample-(.*)\.html$/', $sample[
'name'], $reg)) {
185 $labelkey = ucfirst($key);
186 if ($key ==
'empty') {
187 $labelkey =
'EmptyPage';
189 $arrayofsamples[$key] = $labelkey;
194 $out .=
'<select id="select'.$htmlname.
'" class="selectSampleOfContainer'.($morecss?
' '.$morecss :
'').
'" name="'.$htmlname.
'"'.($moreattrib ?
' '.$moreattrib :
'').
'>';
196 if ($useempty == 1 || $useempty == 2) {
197 $out .=
'<option value="-1"> </option>';
200 foreach ($arrayofsamples as $key => $val) {
201 if ($selected == $key) {
202 $out .=
'<option value="'.$key.
'" selected>';
204 $out .=
'<option value="'.$key.
'">';
206 $out .= $langs->trans($val);
232 public function selectContainer($website, $htmlname =
'pageid', $pageid = 0, $showempty = 0, $action =
'', $morecss =
'minwidth200', $excludeids =
null)
234 global $conf, $langs;
238 $atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
241 if ($atleastonepage && $action !=
'editsource') {
242 $out .=
'<select name="'.$htmlname.
'" id="'.$htmlname.
'" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'">';
244 $out .=
'<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'"'.($action ==
'editsource' ?
' disabled="disabled"' :
'').
'>';
247 if ($showempty || !$atleastonepage) {
248 $out .=
'<option class="optiongrey" value="-1">'.(is_numeric($showempty) ?
' ' : $showempty).
'</option>';
256 if ($atleastonepage) {
257 if (empty($pageid) && $action !=
'createcontainer') {
260 foreach ($website->lines as $key => $valpage) {
261 if (empty($firstpageid)) {
262 $firstpageid = $valpage->id;
264 if ($website->fk_default_home && $key == $website->fk_default_home) {
265 $homepageid = $valpage->id;
268 $pageid = $homepageid ? $homepageid : $firstpageid;
271 foreach ($website->lines as $key => $valpage) {
272 if (is_array($excludeids) && count($excludeids) && in_array($valpage->id, $excludeids)) {
276 $valueforoption =
'<span class="opacitymedium">['.$valpage->type_container.
' '.sprintf(
"%03d", $valpage->id).
']</span> ';
277 $valueforoption .= $valpage->pageurl.
' - '.$valpage->title;
278 if ($website->otherlang) {
279 if ($valpage->lang) {
280 $valueforoption .=
' <span class="opacitymedium">('.$valpage->lang.
')</span>';
283 if ($website->fk_default_home && $key == $website->fk_default_home) {
285 $valueforoption .=
' <span class="opacitymedium fa fa-home"></span>';
288 $out .=
'<option value="'.$key.
'"';
289 if ($pageid > 0 && $pageid == $key) {
292 $out .=
' data-html="'.dol_escape_htmltag($valueforoption).
'"';
294 $out .= $valueforoption;
302 if ($atleastonepage && $action !=
'editsource') {
305 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.$pageid.
'">';
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.