dolibarr 23.0.3
card-view-header.tpl.php
1<!-- file list.tpl.php -->
2<?php
3/* Copyright (C) 2025 Open-Dsi <support@open-dsi.fr>
4 */
5// Protection to avoid direct call of template
6if (empty($context) || !is_object($context)) {
7 print "Error, template page can't be called as URL";
8 exit(1);
9}
10'@phan-var-force Context $context';
11'@phan-var-force AbstractCardController $this';
12
22$formCard = $this->formCard;
23
24?>
25
26<header class="object-card-view" data-element="<?php print dolPrintHTMLForAttribute($formCard->object->element); ?>" >
27 <div class="header-card-block">
28
29 <?php
30 // TODO: CODE QUALITY: Avoid defining object-specific logic directly inside the template.
31 // If object-specific handling is required, create a dedicated template file or pass the necessary variables in $vars so the template remains generic.
32 // also you can create a getBannerAddressForWebPortal method into object (who extend Dolibarr object) but its not a good way
33 if ($formCard->object->element == 'member') {
34 print '<div class="header-card-photo">';
35 print $formCard->form->showphoto('memberphoto', $formCard->object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0);
36 print '</div>';
37 }
38 ?>
39
40 <div class="header-card-main-information">
41 <?php if (!empty($formCard->object->ref)) : ?>
42 <div class="header-card-ref"><?php print $langs->trans("Ref") . ' : ' . dol_escape_htmltag($formCard->object->ref) ?></div>
43 <?php endif; ?>
44
45 <?php
46 // TODO: CODE QUALITY: Avoid defining object-specific logic directly inside the template.
47 // If object-specific handling is required, create a dedicated template file or pass the necessary variables so the template remains generic.
48 // also you can create a getBannerAddressForWebPortal method into webportal object (who extend Dolibarr object) but its not a good way
49
50 if ($formCard->object->element == 'member') {
51 $object = $formCard->object;
52 '@phan-var-force Adherent $object';
56 $addgendertxt = '';
57 //if (property_exists($object, 'gender') && !empty($object->gender)) {
58 // switch ($object->gender) {
59 // case 'man':
60 // $addgendertxt .= '<i class="fas fa-mars"></i>';
61 // break;
62 // case 'woman':
63 // $addgendertxt .= '<i class="fas fa-venus"></i>';
64 // break;
65 // case 'other':
66 // $addgendertxt .= '<i class="fas fa-transgender"></i>';
67 // break;
68 // }
69 //}
70 $fullname = '';
71 if (method_exists($object, 'getFullName')) {
72 $fullname = $object->getFullName($langs);
73 }
74 if ($object->morphy == 'mor' && !empty($object->company)) {
75 $out = dol_htmlentities($object->company);
76 $out .= (!empty($fullname) && $object->company != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '';
77 } else {
78 $out = dol_htmlentities($fullname) . $addgendertxt;
79 if (empty($object->socid)) {
80 $out .= (!empty($object->company) && $object->company != $fullname) ? ' (' . dol_htmlentities($object->company) . ')' : '';
81 }
82 } ?>
83 <div class="header-card-company" ><?php print $out ?></div>
84 <?php } ?>
85
86 <?php
87 // TODO : use TPL $vars not the object, there is a controller so use it instead to pass $vars.
88 if (method_exists($formCard->object, 'getBannerAddressForWebPortal')) {
89 $moreaddress = $formCard->object->getBannerAddressForWebPortal('refaddress');
90 if ($moreaddress) { ?>
91 <div class="header-card-address"><?php print $moreaddress ?></div>
92 <?php }
93 }
94 ?>
95 </div>
96
97 <div class="header-card-status" >
98 <?php
99 $htmlStatus = $formCard->object->getLibStatut(6);
100 if (empty($htmlStatus) || $htmlStatus == $formCard->object->getLibStatut(3)) {
101 $htmlStatus = $formCard->object->getLibStatut(5);
102 }
103 print $htmlStatus;
104 ?>
105 </div>
106 </div>
107
108
109</header>
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
$context
@method int call_trigger(string $triggerName, ?User $user)
Definition logout.php:42