73 $langs->loadLangs(array(
"boxes",
"members"));
77 include_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
78 require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
79 $staticmember =
new Adherent($this->db);
83 $numberyears =
getDolGlobalInt(
"MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH");
85 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMembersByType").($numberyears ?
' ('.($year - $numberyears).
' - '.$year.
')' :
''));
87 if ($user->hasRight(
'adherent',
'lire')) {
88 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherentstats.class.php';
89 $stats =
new AdherentStats($this->db, $user->socid, $user->id);
91 $sumMembers = $stats->countMembersByTypeAndStatus($numberyears);
94 $this->info_box_contents[$line][] = array(
99 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
100 $this->info_box_contents[$line][] = array(
101 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
102 'text' => $labelstatus
105 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
106 $this->info_box_contents[$line][] = array(
107 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
108 'text' => $labelstatus,
111 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now + 86400, 1);
112 $this->info_box_contents[$line][] = array(
113 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
114 'text' => $labelstatus,
117 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now - 86400, 1);
118 $this->info_box_contents[$line][] = array(
119 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
120 'text' => $labelstatus
123 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
124 $this->info_box_contents[$line][] = array(
125 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
126 'text' => $labelstatus
129 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
130 $this->info_box_contents[$line][] = array(
131 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
132 'text' => $labelstatus
135 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
136 $this->info_box_contents[$line][] = array(
137 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($langs->trans(
"Total")).
'"',
138 'text' => $langs->trans(
"Total")
141 $AdherentType = array();
142 foreach ($sumMembers as $key => $data) {
143 if ($key ==
'total') {
147 $adhtype->id = (int) $key;
148 $adhtype->label = $data[
'label'];
149 $AdherentType[$key] = $adhtype;
151 $this->info_box_contents[$line][] = array(
152 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
153 'text' => $adhtype->getNomUrl(1,
dol_size(32)),
156 $this->info_box_contents[$line][] = array(
157 'td' =>
'class="right"',
158 'text' => (isset($data[
'members_draft']) && $data[
'members_draft'] > 0 ? $data[
'members_draft'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_DRAFT, 1, 0, 3),
161 $this->info_box_contents[$line][] = array(
162 'td' =>
'class="right"',
163 'text' => (isset($data[
'members_pending']) && $data[
'members_pending'] > 0 ? $data[
'members_pending'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 1, 0, 3),
166 $this->info_box_contents[$line][] = array(
167 'td' =>
'class="right"',
168 'text' => (isset($data[
'members_uptodate']) && $data[
'members_uptodate'] > 0 ? $data[
'members_uptodate'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 0, 0, 3),
171 $this->info_box_contents[$line][] = array(
172 'td' =>
'class="right"',
173 'text' => (isset($data[
'members_expired']) && $data[
'members_expired'] > 0 ? $data[
'members_expired'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 1, 1, 3),
176 $this->info_box_contents[$line][] = array(
177 'td' =>
'class="right"',
178 'text' => (isset($data[
'members_excluded']) && $data[
'members_excluded'] > 0 ? $data[
'members_excluded'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_EXCLUDED, 1, $now, 3),
181 $this->info_box_contents[$line][] = array(
182 'td' =>
'class="right"',
183 'text' => (isset($data[
'members_resiliated']) && $data[
'members_resiliated'] > 0 ? $data[
'members_resiliated'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_RESILIATED, 1, 0, 3),
186 $this->info_box_contents[$line][] = array(
187 'td' =>
'class="right"',
188 'text' => (isset($data[
'total_adhtype']) && $data[
'total_adhtype'] > 0 ? $data[
'total_adhtype'] :
''),
194 if (count($sumMembers) == 0) {
195 $this->info_box_contents[$line][0] = array(
196 'td' =>
'colspan="7" class="center"',
197 'text' => $langs->trans(
"NoRecordedMembersByType")
200 $this->info_box_contents[$line][] = array(
201 'tr' =>
'class="liste_total"',
202 'td' =>
'class="liste_total"',
203 'text' => $langs->trans(
"Total")
205 $this->info_box_contents[$line][] = array(
206 'td' =>
'class="liste_total right"',
207 'text' => $sumMembers[
'total'][
'members_draft'].
' '.$staticmember->LibStatut(
Adherent::STATUS_DRAFT, 1, 0, 3),
210 $this->info_box_contents[$line][] = array(
211 'td' =>
'class="liste_total right"',
215 $this->info_box_contents[$line][] = array(
216 'td' =>
'class="liste_total right"',
220 $this->info_box_contents[$line][] = array(
221 'td' =>
'class="liste_total right"',
225 $this->info_box_contents[$line][] = array(
226 'td' =>
'class="liste_total right"',
230 $this->info_box_contents[$line][] = array(
231 'td' =>
'class="liste_total right"',
235 $this->info_box_contents[$line][] = array(
236 'td' =>
'class="liste_total right"',
237 'text' => $sumMembers[
'total'][
'all'],
242 $this->info_box_contents[0][0] = array(
245 'text' => ($this->db->lasterror())
249 $this->info_box_contents[0][0] = array(
250 'td' =>
'class="nohover left"',
251 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'