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.
'">';
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)
236 $atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
239 if ($atleastonepage && $action !=
'editsource') {
240 $out .=
'<select name="'.$htmlname.
'" id="'.$htmlname.
'" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'">';
242 $out .=
'<select name="pageidbis" id="pageid" class="maxwidth300'.($morecss ?
' '.$morecss :
'').
'" disabled="disabled">';
245 if ($showempty || !$atleastonepage) {
246 $out .=
'<option value="-1"> </option>';
249 if ($atleastonepage) {
250 if (empty($pageid) && $action !=
'createcontainer') {
253 foreach ($website->lines as $key => $valpage) {
254 if (empty($firstpageid)) {
255 $firstpageid = $valpage->id;
257 if ($website->fk_default_home && $key == $website->fk_default_home) {
258 $homepageid = $valpage->id;
261 $pageid = $homepageid ? $homepageid : $firstpageid;
264 foreach ($website->lines as $key => $valpage) {
265 if (is_array($excludeids) && count($excludeids) && in_array($valpage->id, $excludeids)) {
269 $valueforoption =
'<span class="opacitymedium">['.$valpage->type_container.
' '.sprintf(
"%03d", $valpage->id).
']</span> ';
270 $valueforoption .= $valpage->pageurl.
' - '.$valpage->title;
271 if ($website->otherlang) {
272 if ($valpage->lang) {
273 $valueforoption .=
' <span class="opacitymedium">('.$valpage->lang.
')</span>';
276 if ($website->fk_default_home && $key == $website->fk_default_home) {
278 $valueforoption .=
' <span class="opacitymedium fa fa-home"></span>';
281 $out .=
'<option value="'.$key.
'"';
282 if ($pageid > 0 && $pageid == $key) {
285 $out .=
' data-html="'.dol_escape_htmltag($valueforoption).
'"';
287 $out .= $valueforoption;
295 if ($atleastonepage && $action !=
'editsource') {
298 $out .=
'<input type="hidden" name="'.$htmlname.
'" value="'.$pageid.
'">';