37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 $langsArray=array(
"errors",
"admin",
"mails",
"languages");
50 $langsArray[]=
'members';
53 $langsArray[]=
'eventorganization';
56 $langs->loadLangs($langsArray);
58 $toselect =
GETPOST(
'toselect',
'array');
59 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
60 $massaction =
GETPOST(
'massaction',
'alpha');
61 $confirm =
GETPOST(
'confirm',
'alpha');
62 $mode =
GETPOST(
'mode',
'aZ09');
63 $optioncss =
GETPOST(
'optioncss',
'alpha');
66 $rowid =
GETPOST(
'rowid',
'alpha');
67 $search_label =
GETPOST(
'search_label',
'alphanohtml');
68 $search_type_template =
GETPOST(
'search_type_template',
'alpha');
69 $search_lang =
GETPOST(
'search_lang',
'alpha');
70 $search_fk_user =
GETPOST(
'search_fk_user',
'intcomma');
71 $search_topic =
GETPOST(
'search_topic',
'alpha');
72 $search_module =
GETPOST(
'search_module',
'alpha');
76 $acts[0] =
"activate";
78 $actl[0] =
img_picto($langs->trans(
"Disabled"),
'switch_off',
'class="size15x"');
79 $actl[1] =
img_picto($langs->trans(
"Activated"),
'switch_on',
'class="size15x"');
81 $listoffset =
GETPOST(
'listoffset',
'alpha');
82 $listlimit =
GETPOST(
'listlimit',
'alpha') > 0 ?
GETPOST(
'listlimit',
'alpha') : 1000;
84 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
85 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
86 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
88 if (empty($page) || $page == -1) {
91 $offset = $listlimit * $page;
92 $pageprev = $page - 1;
93 $pagenext = $page + 1;
95 if (empty($sortfield)) {
96 $sortfield =
'type_template,lang,position,label';
98 if (empty($sortorder)) {
103 $hookmanager->initHooks(array(
'emailtemplates'));
108 $tabname[25] = MAIN_DB_PREFIX.
"c_email_templates";
112 $tabfield[25] =
"label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
113 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
114 $tabfield[25] .=
',content_lines';
118 $tabfieldvalue = array();
119 $tabfieldvalue[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
120 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
121 $tabfieldvalue[25] .=
',content_lines';
125 $tabfieldinsert = array();
126 $tabfieldinsert[25] =
"label,lang,type_template,fk_user,private,position,topic,email_from,joinfiles,defaultfortype,content";
127 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
128 $tabfieldinsert[25] .=
',content_lines';
130 $tabfieldinsert[25] .=
',entity';
138 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
140 if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
142 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
143 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
144 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
145 foreach ($tmp as $key => $val) {
146 $helpsubstit .= $key.
' -> '.$val.
'<br>';
147 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
151 $tmp[
'__(AnyTranslationKey)__'] =
'Translation';
152 $helpsubstit = $langs->trans(
"AvailableVariables").
':<br>';
153 $helpsubstitforlines = $langs->trans(
"AvailableVariables").
':<br>';
154 foreach ($tmp as $key => $val) {
155 $helpsubstit .= $key.
' -> '.$val.
'<br>';
158 foreach ($tmp as $key => $val) {
159 $helpsubstitforlines .= $key.
' -> '.$val.
'<br>';
165 $tabhelp[25] = array(
166 'label'=>$langs->trans(
'EnterAnyCode'),
167 'type_template'=>$langs->trans(
"TemplateForElement"),
168 'private'=>$langs->trans(
"TemplateIsVisibleByOwnerOnly"),
169 'position'=>$langs->trans(
"PositionIntoComboList"),
170 'topic'=>
'<span class="small">'.$helpsubstit.
'</span>',
171 'email_from'=>$langs->trans(
'ForceEmailFrom'),
172 'joinfiles'=>$langs->trans(
'AttachMainDocByDefault'),
173 'defaultfortype'=>$langs->trans(
"DefaultForTypeDesc"),
174 'content'=>
'<span class="small">'.$helpsubstit.
'</span>',
175 'content_lines'=>
'<span class="small">'.$helpsubstitforlines.
'</span>'
180 $elementList = array();
183 $elementList[
'all'] =
'-- '.dol_escape_htmltag($langs->trans(
"All")).
' --';
184 $elementList[
'none'] =
'-- '.dol_escape_htmltag($langs->trans(
"None")).
' --';
185 $elementList[
'user'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToUser'));
186 if (
isModEnabled(
'adherent') && $user->hasRight(
'adherent',
'lire')) {
187 $elementList[
'member'] =
img_picto(
'',
'object_member',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToMember'));
189 if (
isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
190 $elementList[
'recruitmentcandidature_send'] =
img_picto(
'',
'recruitmentcandidature',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'RecruitmentCandidatures'));
192 if (
isModEnabled(
"societe") && $user->hasRight(
'societe',
'lire')) {
193 $elementList[
'thirdparty'] =
img_picto(
'',
'company',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToThirdparty'));
196 $elementList[
'project'] =
img_picto(
'',
'project',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToProject'));
198 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
199 $elementList[
'propal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendProposal'));
201 if (
isModEnabled(
'commande') && $user->hasRight(
'commande',
'lire')) {
202 $elementList[
'order_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendOrder'));
204 if (
isModEnabled(
'facture') && $user->hasRight(
'facture',
'lire')) {
205 $elementList[
'facture_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendInvoice'));
208 $elementList[
'shipping_send'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendShipment'));
211 $elementList[
'reception_send'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendReception'));
214 $elementList[
'fichinter_send'] =
img_picto(
'',
'intervention',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendIntervention'));
217 $elementList[
'supplier_proposal_send'] =
img_picto(
'',
'propal',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierRequestForQuotation'));
219 if (
isModEnabled(
"supplier_order") && ($user->hasRight(
'fournisseur',
'commande',
'lire') || $user->hasRight(
'supplier_order',
'read'))) {
220 $elementList[
'order_supplier_send'] =
img_picto(
'',
'order',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierOrder'));
222 if (
isModEnabled(
"supplier_invoice") && ($user->hasRight(
'fournisseur',
'facture',
'lire') || $user->hasRight(
'supplier_invoice',
'read'))) {
223 $elementList[
'invoice_supplier_send'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendSupplierInvoice'));
225 if (
isModEnabled(
'contrat') && $user->hasRight(
'contrat',
'lire')) {
226 $elementList[
'contract'] =
img_picto(
'',
'contract',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendContract'));
228 if (
isModEnabled(
'ticket') && !empty($user->rights->ticket->read)) {
229 $elementList[
'ticket_send'] =
img_picto(
'',
'ticket',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToTicket'));
231 if (
isModEnabled(
'expensereport') && !empty($user->rights->expensereport->lire)) {
232 $elementList[
'expensereport_send'] =
img_picto(
'',
'trip',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToExpenseReport'));
235 $elementList[
'actioncomm_send'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventPush'));
237 if (
isModEnabled(
'eventorganization') && !empty($user->rights->eventorganization->read)) {
238 $elementList[
'conferenceorbooth'] =
img_picto(
'',
'action',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToSendEventOrganization'));
240 if (
isModEnabled(
'partnership') && !empty($user->rights->partnership->read)) {
241 $elementList[
'partnership_send'] =
img_picto(
'',
'partnership',
'class="pictofixedwidth"').dol_escape_htmltag($langs->trans(
'MailToPartnership'));
244 $parameters = array(
'elementList'=>$elementList);
245 $reshook = $hookmanager->executeHooks(
'emailElementlist', $parameters);
247 foreach ($hookmanager->resArray as $item => $value) {
248 $elementList[$item] = $value;
257 if (!empty($user->socid)) {
261 $permissiontoadd = 1;
262 $permissiontodelete = 1;
270 if (
GETPOST(
'cancel',
'alpha')) {
274 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
278 $parameters = array();
279 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
284 if (empty($reshook)) {
286 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
289 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
292 $search_type_template =
'';
294 $search_fk_user =
'';
298 $search_array_options = array();
302 if ((
GETPOST(
'actionadd',
'alpha') ||
GETPOST(
'actionmodify',
'alpha')) && $permissiontoadd) {
303 $listfield = explode(
',', str_replace(
' ',
'', $tabfield[$id]));
304 $listfieldinsert = explode(
',', $tabfieldinsert[$id]);
305 $listfieldmodify = explode(
',', $tabfieldinsert[$id]);
306 $listfieldvalue = explode(
',', $tabfieldvalue[$id]);
310 foreach ($listfield as $f => $value) {
312 if (in_array($value, [
'joinfiles',
'defaultfortype',
'content',
'content_lines',
'module'])) {
317 if (
GETPOST(
'actionmodify',
'alpha') && $value ==
'topic') {
318 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
321 if ((!
GETPOSTISSET($value) ||
GETPOST($value) ==
'' ||
GETPOST($value) ==
'-1') && $value !=
'lang' && $value !=
'fk_user' && $value !=
'position') {
323 $fieldnamekey = $listfield[$f];
325 if ($fieldnamekey ==
'libelle' || ($fieldnamekey ==
'label')) {
326 $fieldnamekey =
'Code';
328 if ($fieldnamekey ==
'code') {
329 $fieldnamekey =
'Code';
331 if ($fieldnamekey ==
'note') {
332 $fieldnamekey =
'Note';
334 if ($fieldnamekey ==
'type_template') {
335 $fieldnamekey =
'TypeOfTemplate';
337 if ($fieldnamekey ==
'fk_user') {
338 $fieldnamekey =
'Owner';
340 if ($fieldnamekey ==
'private') {
341 $fieldnamekey =
'Private';
343 if ($fieldnamekey ==
'position') {
344 $fieldnamekey =
'Position';
346 if ($fieldnamekey ==
'topic') {
347 $fieldnamekey =
'Topic';
350 setEventMessages($langs->transnoentities(
"ErrorFieldRequired", $langs->transnoentities($fieldnamekey)),
null,
'errors');
356 if ($ok &&
GETPOST(
'actionadd')) {
358 $sql =
"INSERT INTO ".$tabname[$id].
" (";
360 $sql .= $tabfieldinsert[$id];
361 $sql .=
", active, enabled)";
366 foreach ($listfieldinsert as $f => $value) {
367 $keycode = isset($listfieldvalue[$i]) ? $listfieldvalue[$i] :
"";
368 if ($value ==
'lang') {
369 $keycode =
'langcode';
371 if (empty($keycode)) {
376 if ($value ==
'entity') {
377 $_POST[$keycode] = $conf->entity;
379 if ($value ==
'fk_user' && !($_POST[$keycode] > 0)) {
380 $_POST[$keycode] =
'';
382 if ($value ==
'private' && !is_numeric($_POST[$keycode])) {
383 $_POST[$keycode] =
'0';
385 if ($value ==
'position' && !is_numeric($_POST[$keycode])) {
386 $_POST[$keycode] =
'1';
388 if ($value ==
'defaultfortype' && !is_numeric($_POST[$keycode])) {
389 $_POST[$keycode] =
'0';
396 if (
GETPOST($keycode) ==
'' && $keycode !=
'langcode') {
398 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
400 } elseif ($keycode ==
'fk_user') {
402 $sql .=
" ".((int) $user->id);
406 } elseif ($keycode ==
'content') {
407 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
408 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position',
'entity'))) {
411 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
418 $result = $db->query(
$sql);
421 $_POST = array(
'id'=>$id);
423 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
424 setEventMessages($langs->transnoentities(
"ErrorRecordAlreadyExists"),
null,
'errors');
433 if ($ok &&
GETPOST(
'actionmodify')) {
437 $sql =
"UPDATE ".$tabname[$id].
" SET ";
440 foreach ($listfieldmodify as $field) {
441 if ($field ==
'entity') {
444 $_POST[$keycode] = $conf->entity;
446 $keycode = $listfieldvalue[$i];
449 if ($field ==
'lang') {
450 $keycode =
'langcode';
452 if (empty($keycode)) {
457 if ($field ==
'fk_user' && !(
GETPOST(
'fk_user',
'int') > 0)) {
458 $_POST[
'fk_user'] =
'';
460 if ($field ==
'topic') {
461 $_POST[
'topic'] =
GETPOST(
'topic-'.$rowid);
463 if ($field ==
'joinfiles') {
464 $_POST[
'joinfiles'] =
GETPOST(
'joinfiles-'.$rowid);
466 if ($field ==
'content') {
467 $_POST[
'content'] =
GETPOST(
'content-'.$rowid,
'restricthtml');
469 if ($field ==
'content_lines') {
470 $_POST[
'content_lines'] =
GETPOST(
'content_lines-'.$rowid,
'restricthtml');
478 if (
GETPOST($keycode) ==
'' || (!in_array($keycode, array(
'langcode',
'position',
'private',
'defaultfortype')) && !
GETPOST($keycode))) {
480 } elseif (
GETPOST($keycode) ==
'0' && $keycode ==
'langcode') {
482 } elseif ($keycode ==
'fk_user') {
484 $sql .=
" ".((int) $user->id);
488 } elseif ($keycode ==
'content') {
489 $sql .=
"'".$db->escape(
GETPOST($keycode,
'restricthtml')).
"'";
490 } elseif (in_array($keycode, array(
'joinfiles',
'defaultfortype',
'private',
'position'))) {
493 $sql .=
"'".$db->escape(
GETPOST($keycode,
'alphanohtml')).
"'";
498 $sql .=
" WHERE ".$db->escape($rowidcol).
" = ".((int) $rowid);
500 $sql .=
" AND fk_user = ".((int) $user->id);
505 $resql = $db->query(
$sql);
515 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
518 $sql =
"DELETE from ".$tabname[$id].
" WHERE ".$rowidcol.
" = ".((int) $rowid);
520 $sql .=
" AND fk_user = ".((int) $user->id);
523 $result = $db->query(
$sql);
525 if ($db->errno() ==
'DB_ERROR_CHILD_EXISTS') {
526 setEventMessages($langs->transnoentities(
"ErrorRecordIsUsedByChild"),
null,
'errors');
534 if ($action == $acts[0] && $permissiontoadd) {
537 $sql =
"UPDATE ".$tabname[$id].
" SET active = 1 WHERE rowid = ".((int) $rowid);
539 $result = $db->query(
$sql);
546 if ($action == $acts[1] && $permissiontoadd) {
549 $sql =
"UPDATE ".$tabname[$id].
" SET active = 0 WHERE rowid = ".((int) $rowid);
551 $result = $db->query(
$sql);
571 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
572 $title = $langs->trans(
"EMailsSetup");
574 $title = $langs->trans(
"EMailTemplates");
579 $sql =
"SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, email_from,joinfiles, defaultfortype, content_lines, content, enabled, active";
580 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_email_templates";
581 $sql .=
" WHERE entity IN (".getEntity(
'email_template').
")";
583 $sql .=
" AND (private = 0 OR (private = 1 AND fk_user = ".((int) $user->id).
"))";
584 $sql .=
" AND (active = 1 OR fk_user = ".((int) $user->id).
")";
587 $sql .=
" AND (lang = '".$db->escape($langs->defaultlang).
"' OR lang IS NULL OR lang = '')";
592 if ($search_type_template !=
'' && $search_type_template !=
'-1') {
598 if ($search_fk_user !=
'' && $search_fk_user !=
'-1') {
601 if ($search_module) {
608 if ($sortfield ==
'country') {
609 $sortfield =
'country_code';
611 $sql .= $db->order($sortfield, $sortorder);
612 $sql .= $db->plimit($listlimit + 1, $offset);
620 $arrayofselected = is_array($toselect) ? $toselect : array();
624 $param .=
'&mode='.urlencode($mode);
626 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
627 $param .=
'&contextpage='.urlencode($contextpage);
629 if ($limit > 0 && $limit != $conf->liste_limit) {
630 $param .=
'&limit='.((int) $limit);
632 if (!empty($search) && is_array($search)) {
633 foreach ($search as $key => $val) {
634 if (is_array($search[$key]) && count($search[$key])) {
635 foreach ($search[$key] as $skey) {
637 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
640 } elseif ($search[$key] !=
'') {
641 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
645 if ($optioncss !=
'') {
646 $param .=
'&optioncss='.urlencode($optioncss);
649 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
651 $parameters = array();
652 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
653 $param .= $hookmanager->resPrint;
657 $titlepicto =
'title_setup';
660 $url = DOL_URL_ROOT.
'/admin/mails_templates.php?action=create';
661 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewEMailTemplate'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
664 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
670 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
675 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
682 if ($action ==
'delete') {
683 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.((
int) $rowid).
'&code='.urlencode($code).
'&id='.((
int) $id), $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_delete',
'', 0, 1);
687 $fieldlist = explode(
',', $tabfield[$id]);
689 if ($action ==
'create') {
691 $obj =
new stdClass();
692 $obj->label =
GETPOST(
'label');
694 $obj->type_template =
GETPOST(
'type_template');
695 $obj->fk_user =
GETPOST(
'fk_user',
'int');
696 $obj->private =
GETPOST(
'private',
'int');
697 $obj->position =
GETPOST(
'position');
698 $obj->topic =
GETPOST(
'topic');
699 $obj->joinfiles =
GETPOST(
'joinfiles');
700 $obj->defaultfortype =
GETPOST(
'defaultfortype') ? 1 : 0;
701 $obj->content =
GETPOST(
'content',
'restricthtml');
704 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
705 print
'<input type="hidden" name="token" value="'.newToken().
'">';
706 print
'<input type="hidden" name="action" value="add">';
707 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
709 print
'<div class="div-table-responsive-no-min">';
710 print
'<table class="noborder centpercent">';
713 print
'<tr class="liste_titre">';
714 foreach ($fieldlist as $field => $value) {
717 $valuetoshow = ucfirst($fieldlist[$field]);
718 $valuetoshow = $langs->trans($valuetoshow);
720 if ($fieldlist[$field] ==
'module') {
721 $valuetoshow =
' ';
723 if ($fieldlist[$field] ==
'fk_user') {
724 $valuetoshow = $langs->trans(
"Owner");
726 if ($fieldlist[$field] ==
'lang') {
727 $valuetoshow = (!
getDolGlobalInt(
'MAIN_MULTILANGS') ?
' ' : $langs->trans(
"Language"));
729 if ($fieldlist[$field] ==
'type') {
730 $valuetoshow = $langs->trans(
"Type");
732 if ($fieldlist[$field] ==
'position') {
735 if ($fieldlist[$field] ==
'code') {
736 $valuetoshow = $langs->trans(
"Code");
738 if ($fieldlist[$field] ==
'label') {
739 $valuetoshow = $langs->trans(
"Code");
741 if ($fieldlist[$field] ==
'type_template') {
742 $valuetoshow = $langs->trans(
"TypeOfTemplate"); $css =
"center";
744 if (in_array($fieldlist[$field], array(
'private',
'private',
'defaultfortype'))) {
748 if ($fieldlist[$field] ==
'topic') {
751 if ($fieldlist[$field] ==
'joinfiles') {
754 if ($fieldlist[$field] ==
'content') {
757 if ($fieldlist[$field] ==
'content_lines') {
760 if ($valuetoshow !=
'') {
761 print
'<th class="'.$css.
'">';
762 if (!empty($tabhelp[$id][$value]) && preg_match(
'/^http(s*):/i', $tabhelp[$id][$value])) {
763 print
'<a href="'.$tabhelp[$id][$value].
'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.
' '.
img_help(1, $valuetoshow).
'</a>';
764 } elseif (!empty($tabhelp[$id][$value])) {
765 if (in_array($value, array(
'topic'))) {
766 print
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2, $value);
768 print
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2);
777 print
'<input type="hidden" name="id" value="'.$id.
'">';
781 $tmpaction =
'create';
783 'fieldlist' => $fieldlist,
784 'tabname' => $tabname[$id]
786 $reshook = $hookmanager->executeHooks(
'createEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
787 $error = $hookmanager->error;
788 $errors = $hookmanager->errors;
792 print
'<tr class="oddeven">';
794 if (empty($reshook)) {
795 if ($action ==
'edit') {
796 fieldList($fieldlist, $obj, $tabname[$id],
'hide');
798 fieldList($fieldlist, $obj, $tabname[$id],
'add');
802 print
'<td class="right">';
806 print
'<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
809 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
810 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
811 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content',
'content_lines');
813 foreach ($fieldsforcontent as $tmpfieldlist) {
815 if ($tmpfieldlist ==
'topic') {
816 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
818 if ($tmpfieldlist ==
'email_from') {
819 print
$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist);
821 if ($tmpfieldlist ==
'joinfiles') {
822 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
824 if ($tmpfieldlist ==
'content') {
825 print
$form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
827 if ($tmpfieldlist ==
'content_lines') {
828 print
$form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
832 if ($tmpfieldlist ==
'topic') {
833 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
834 } elseif ($tmpfieldlist ==
'email_from') {
835 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'" value="'.(!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'').
'">';
836 } elseif ($tmpfieldlist ==
'joinfiles') {
837 print
$form->selectyesno($tmpfieldlist, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1,
false, 0, 1);
839 $okforextended =
true;
840 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
841 $okforextended =
false;
843 $doleditor =
new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
''),
'', 400,
'dolibarr_mailings',
'In',
false, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
844 print $doleditor->Create(1);
853 if ($action !=
'edit') {
855 print
'<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans(
"Add").
'"> ';
856 print
'<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
867 $resql = $db->query(
$sql);
873 $num = $db->num_rows($resql);
875 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">';
876 print
'<input type="hidden" name="token" value="'.newToken().
'">';
877 print
'<input type="hidden" name="from" value="'.dol_escape_htmltag(
GETPOST(
'from',
'alpha')).
'">';
879 print
'<div class="div-table-responsive-no-min">';
880 print
'<table class="noborder centpercent">';
884 $param =
'&id='.((int) $id);
886 $param .=
'&search_label='.urlencode($search_label);
888 if ($search_lang > 0) {
889 $param .=
'&search_lang='.urlencode($search_lang);
891 if ($search_type_template !=
'-1') {
892 $param .=
'&search_type_template='.urlencode($search_type_template);
894 if ($search_fk_user > 0) {
895 $param .=
'&search_fk_user='.urlencode($search_fk_user);
897 if ($search_module) {
898 $param .=
'&search_module='.urlencode($search_module);
901 $param .=
'&search_topic='.urlencode($search_topic);
904 $paramwithsearch = $param;
906 $paramwithsearch .=
'&sortorder='.urlencode($sortorder);
909 $paramwithsearch .=
'&sortfield='.urlencode($sortfield);
911 if (
GETPOST(
'from',
'alpha')) {
912 $paramwithsearch .=
'&from='.urlencode(
GETPOST(
'from',
'alpha'));
916 if ($num > $listlimit) {
917 print
'<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).
'">';
918 print_fleche_navigation($page, $_SERVER[
"PHP_SELF"], $paramwithsearch, ($num > $listlimit),
'<li class="pagination"><span>'.$langs->trans(
"Page").
' '.($page + 1).
'</span></li>');
924 print
'<tr class="liste_titre">';
927 print
'<td class="liste_titre center" width="64">';
928 $searchpicto =
$form->showFilterButtons();
932 foreach ($fieldlist as $field => $value) {
933 if ($value ==
'module') {
934 print
'<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).
'"></td>';
935 } elseif ($value ==
'label') {
936 print
'<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).
'"></td>';
937 } elseif ($value ==
'lang') {
938 print
'<td class="liste_titre">';
939 print $formadmin->select_language($search_lang,
'search_lang', 0,
null, 1, 0, 0,
'maxwidth100');
941 } elseif ($value ==
'fk_user') {
942 print
'<td class="liste_titre">';
943 print
$form->select_dolusers($search_fk_user,
'search_fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'maxwidth100', 1);
945 } elseif ($value ==
'topic') {
946 print
'<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).
'"></td>';
947 } elseif ($value ==
'type_template') {
948 print
'<td class="liste_titre center">';
949 print
$form->selectarray(
'search_type_template', $elementList, $search_type_template, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth125', 1,
'', 0, 1);
951 } elseif (!in_array($value, array(
'content',
'content_lines'))) {
952 print
'<td class="liste_titre"></td>';
962 print
'<td class="liste_titre center" width="64">';
963 $searchpicto =
$form->showFilterButtons();
970 print
'<tr class="liste_titre">';
975 foreach ($fieldlist as $field => $value) {
988 $valuetoshow = ucfirst($fieldlist[$field]);
989 $valuetoshow = $langs->trans($valuetoshow);
990 if ($fieldlist[$field] ==
'module') {
991 $css =
'tdoverflowmax100';
993 if ($fieldlist[$field] ==
'fk_user') {
994 $valuetoshow = $langs->trans(
"Owner");
996 if ($fieldlist[$field] ==
'lang') {
997 $valuetoshow = $langs->trans(
"Language");
999 if ($fieldlist[$field] ==
'type') {
1000 $valuetoshow = $langs->trans(
"Type");
1002 if ($fieldlist[$field] ==
'libelle' || $fieldlist[$field] ==
'label') {
1003 $valuetoshow = $langs->trans(
"Code");
1005 if ($fieldlist[$field] ==
'type_template') {
1007 $valuetoshow = $langs->trans(
"TypeOfTemplate");
1009 if ($fieldlist[$field] ==
'private') {
1012 if ($fieldlist[$field] ==
'position') {
1016 if ($fieldlist[$field] ==
'joinfiles') {
1017 $valuetoshow = $langs->trans(
"FilesAttachedToEmail");
1021 if ($fieldlist[$field] ==
'content') {
1022 $valuetoshow = $langs->trans(
"Content"); $showfield = 0;
1024 if ($fieldlist[$field] ==
'content_lines') {
1025 $valuetoshow = $langs->trans(
"ContentForLines"); $showfield = 0;
1030 if (!empty($tabhelp[$id][$value])) {
1031 if (in_array($value, array(
'topic'))) {
1032 $valuetoshow =
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'tooltip'.$value, $forcenowrap);
1034 $valuetoshow =
$form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1,
'help',
'', 0, 2,
'', $forcenowrap);
1037 $sortfieldtouse = ($sortable ? $fieldlist[$field] :
'');
1038 if ($sortfieldtouse ==
'type_template') {
1039 $sortfieldtouse.=
'type_template,lang,position,label';
1041 print
getTitleFieldOfList($valuetoshow, 0, $_SERVER[
"PHP_SELF"], $sortfieldtouse, ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder, $css.
' ');
1045 print
getTitleFieldOfList($langs->trans(
"Status"), 0, $_SERVER[
"PHP_SELF"],
"active", ($page ?
'page='.$page.
'&' :
''), $param,
'', $sortfield, $sortorder,
'center ');
1057 $obj = $db->fetch_object($resql);
1060 if ($action ==
'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1061 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1063 $tmpaction =
'edit';
1064 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1065 $reshook = $hookmanager->executeHooks(
'editEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1066 $error = $hookmanager->error; $errors = $hookmanager->errors;
1070 print
'<td class="center">';
1071 print
'<input type="hidden" name="page" value="'.$page.
'">';
1072 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1073 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1074 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1075 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1079 if (empty($reshook)) {
1080 fieldList($fieldlist, $obj, $tabname[$id],
'edit');
1084 print
'<td class="center">';
1085 print
'<input type="hidden" name="page" value="'.$page.
'">';
1086 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
1087 print
'<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans(
"Modify").
'">';
1088 print
'<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).
'"></div>';
1089 print
'<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans(
"Cancel").
'">';
1094 print
'<tr class="oddeven nohover'.(in_array($tmpfieldlist, array(
'topic',
'joinfiles')) ?
' nobottom' :
'').
'" id="tr-'.$tmpfieldlist.
'-'.$rowid.
'">';
1095 print
'<td colspan="10">';
1097 $fieldsforcontent = array(
'topic',
'email_from',
'joinfiles',
'content');
1098 if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
1099 $fieldsforcontent[] =
'content_lines';
1101 foreach ($fieldsforcontent as $tmpfieldlist) {
1104 $valuetoshow = $obj->$tmpfieldlist;
1110 if ($tmpfieldlist ==
'topic') {
1111 print
'<strong>'.$form->textwithpicto($langs->trans(
"Topic"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1112 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1115 if ($tmpfieldlist ==
'email_from') {
1116 print
'<strong>'.$form->textwithpicto($langs->trans(
"MailFrom"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1117 print
'<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.
'-'.$rowid.
'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
'').
'">';
1120 if ($tmpfieldlist ==
'joinfiles') {
1121 print
'<strong>'.$form->textwithpicto($langs->trans(
"FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'</strong> ';
1122 print
$form->selectyesno($tmpfieldlist.
'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist :
'0'), 1,
false, 0, 1);
1126 if ($tmpfieldlist ==
'content') {
1127 print
$form->textwithpicto($langs->trans(
"Content"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1128 $okforextended =
true;
1129 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1130 $okforextended =
false;
1132 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 500,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1133 print $doleditor->Create(1);
1135 if ($tmpfieldlist ==
'content_lines') {
1137 print
$form->textwithpicto($langs->trans(
"ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1,
'help',
'', 0, 2, $tmpfieldlist).
'<br>';
1138 $okforextended =
true;
1139 if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
1140 $okforextended =
false;
1142 $doleditor =
new DolEditor($tmpfieldlist.
'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} :
''),
'', 140,
'dolibarr_mailings',
'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6,
'90%');
1143 print $doleditor->Create(1);
1157 $tempmodulekey = $obj->module;
1158 if (empty($conf->$tempmodulekey) || !
isModEnabled($tempmodulekey)) {
1164 $keyforobj =
'type_template';
1165 if (!in_array($obj->$keyforobj, array_keys($elementList))) {
1170 if (!
dol_eval($obj->enabled, 1, 1,
'1')) {
1178 $iserasable = 1; $canbedisabled = 1; $canbemodified = 1;
1179 if (!$user->admin && $obj->fk_user != $user->id) {
1185 $url = $_SERVER[
"PHP_SELF"].
'?'.($page ?
'page='.$page.
'&' :
'').
'sortfield='.$sortfield.
'&sortorder='.$sortorder.
'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code :
'')).
'&code='.(!empty($obj->code) ?urlencode($obj->code) :
'');
1190 print
'<tr class="oddeven" id="rowid-'.$obj->rowid.
'">';
1194 print
'<td class="center nowraponall" width="64">';
1195 if ($canbemodified) {
1196 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1199 print
'<a class="marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1205 $tmpaction =
'view';
1206 $parameters = array(
'fieldlist'=>$fieldlist,
'tabname'=>$tabname[$id]);
1207 $reshook = $hookmanager->executeHooks(
'viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction);
1209 $error = $hookmanager->error; $errors = $hookmanager->errors;
1211 if (empty($reshook)) {
1212 foreach ($fieldlist as $field => $value) {
1213 if (in_array($fieldlist[$field], array(
'content',
'content_lines'))) {
1220 $tmpvar = $fieldlist[$field];
1221 $valuetoshow = $obj->$tmpvar;
1222 if ($value ==
'label' || $value ==
'topic') {
1223 if ($langs->trans($valuetoshow) != $valuetoshow) {
1224 $valuetoshow = $langs->trans($valuetoshow);
1228 if ($value ==
'label') {
1229 $class .=
' tdoverflowmax100';
1231 if ($value ==
'topic') {
1232 $class .=
' tdoverflowmax200 small';
1234 if ($value ==
'type_template') {
1235 $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
1236 $css =
"center tdoverflowmax150";
1238 if ($value ==
'lang' && $valuetoshow) {
1239 $valuetoshow = $valuetoshow.
' - '.$langs->trans(
"Language_".$valuetoshow);
1240 $class .=
' tdoverflowmax100';
1242 if ($value ==
'fk_user') {
1243 if ($valuetoshow > 0) {
1244 $fuser =
new User($db);
1245 $fuser->fetch($valuetoshow);
1246 $valuetoshow = $fuser->getNomUrl(1);
1247 $class .=
' tdoverflowmax100';
1250 if ($value ==
'private') {
1253 $valuetoshow =
yn($valuetoshow);
1258 if ($value ==
'position') {
1261 if (in_array($value, array(
'joinfiles',
'defaultfortype'))) {
1265 $valuetoshow =
'<input type="checkbox" checked="checked" disabled>';
1276 print
'<!-- '.$fieldlist[$field].
' -->';
1277 print
'<td class="'.$class.
'"';
1278 if (in_array($value, array(
'code',
'label',
'topic'))) {
1279 print
' title="'.dol_escape_htmltag($valuetoshow).
'"';
1289 print
'<td class="center nowrap">';
1290 if ($canbedisabled) {
1291 print
'<a class="reposition" href="'.$url.
'&action='.$acts[$obj->active].
'&token='.
newToken().
'">'.$actl[$obj->active].
'</a>';
1293 print
'<span class="opacitymedium">'.$actl[$obj->active].
'</span>';
1299 print
'<td class="center nowraponall" width="64">';
1300 if ($canbemodified) {
1301 print
'<a class="reposition editfielda" href="'.$url.
'&action=edit&token='.
newToken().
'">'.
img_edit().
'</a>';
1304 print
'<a class="marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
1319 if ($nbqualified == 0) {
1321 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1330 if (!empty($user->admin) && (empty($_SESSION[
'leftmenu']) || $_SESSION[
'leftmenu'] !=
'email_templates')) {
1349 function fieldList($fieldlist, $obj =
'', $tabname =
'', $context =
'')
1351 global $langs, $user, $db;
1353 global $elementList;
1357 foreach ($fieldlist as $field => $value) {
1359 if ($value ==
'module') {
1361 } elseif ($value ==
'fk_user') {
1364 print
$form->select_dolusers(empty($obj->$value) ?
'' : $obj->$value,
'fk_user', 1,
null, 0, ($user->admin ?
'' :
'hierarchyme'),
null, 0, 0, 0,
'', 0,
'',
'minwidth75 maxwidth100');
1366 if ($context ==
'add') {
1367 print $user->getNomUrl(1);
1368 $forcedvalue = $user->id;
1370 if ($obj && !empty($obj->$value) && $obj->$value > 0) {
1371 $fuser =
new User($db);
1372 $fuser->fetch($obj->$value);
1373 print $fuser->getNomUrl(1);
1374 $forcedvalue = $fuser->id;
1376 $forcedvalue = $obj->$value;
1380 print
'<input type="hidden" value="'.$forcedvalue.
'" name="'.$keyname.
'">';
1383 } elseif ($value ==
'lang') {
1386 $selectedlang =
GETPOSTISSET(
'langcode') ?
GETPOST(
'langcode',
'aZ09') : $langs->defaultlang;
1387 if ($context ==
'edit') {
1388 $selectedlang = $obj->lang;
1390 print $formadmin->select_language($selectedlang,
'langcode', 0,
null, 1, 0, 0,
'maxwidth100');
1392 if (!empty($obj->lang)) {
1393 print $obj->lang.
' - '.$langs->trans(
'Language_'.$obj->lang);
1396 if ($keyname ==
'lang') {
1397 $keyname =
'langcode';
1399 print
'<input type="hidden" value="'.(empty($obj->lang) ?
'' : $obj->lang).
'" name="'.$keyname.
'">';
1402 } elseif ($value ==
'type_template') {
1404 print
'<td class="center">';
1405 if ($context ==
'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) {
1407 print
'<input type="hidden" name="type_template" value="'.$obj->type_template.
'">';
1408 print $obj->type_template;
1410 print
$form->selectarray(
'type_template', $elementList, (!empty($obj->type_template) ? $obj->type_template:
''), 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth75 maxwidth125', 1,
'', 0, 1);
1413 } elseif ($context ==
'add' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1415 } elseif ($context ==
'edit' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1417 } elseif ($context ==
'hide' && in_array($value, array(
'topic',
'joinfiles',
'content',
'content_lines'))) {
1420 $size =
''; $class =
''; $classtd =
'';
1421 if ($value ==
'code') {
1422 $class =
'maxwidth100';
1424 if ($value ==
'label') {
1425 $class =
'maxwidth200';
1427 if ($value ==
'private') {
1428 $class =
'maxwidth50';
1429 $classtd =
'center';
1431 if ($value ==
'position') {
1432 $class =
'maxwidth50 center';
1433 $classtd =
'center';
1435 if ($value ==
'topic') {
1436 $class =
'quatrevingtpercent';
1438 if ($value ==
'defaultfortype') {
1439 $class =
'width25 center';
1440 $classtd =
'center';
1443 print
'<td'.($classtd ?
' class="'.$classtd.
'"' :
'').
'>';
1444 if ($value ==
'private') {
1445 if (empty($user->admin)) {
1446 print
$form->selectyesno($value,
'1', 1);
1448 print
$form->selectyesno($value, (isset($obj->$value) ? $obj->$value :
''), 1);
1451 print
'<input type="text" '.$size.
'class="flat'.($class ?
' '.$class :
'').
'" value="'.(isset($obj->$value) ? $obj->$value :
'').
'" name="'. $value .
'">';