83 $langs->loadLangs(array(
"boxes",
"members"));
87 include_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
88 require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
89 $staticmember =
new Adherent($this->db);
93 $numberyears =
getDolGlobalInt(
"MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH");
95 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMembersByType").($numberyears ?
' ('.($year-$numberyears).
' - '.$year.
')' :
''));
97 if ($user->hasRight(
'adherent',
'lire')) {
98 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherentstats.class.php';
99 $stats =
new AdherentStats($this->db, $user->socid, $user->id);
101 $sumMembers = $stats->countMembersByTypeAndStatus($numberyears);
104 $this->info_box_contents[$line][] = array(
109 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
110 $this->info_box_contents[$line][] = array(
111 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
112 'text' => $labelstatus
115 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
116 $this->info_box_contents[$line][] = array(
117 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
118 'text' => $labelstatus,
121 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now + 86400, 1);
122 $this->info_box_contents[$line][] = array(
123 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
124 'text' => $labelstatus,
127 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now - 86400, 1);
128 $this->info_box_contents[$line][] = array(
129 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
130 'text' => $labelstatus
133 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
134 $this->info_box_contents[$line][] = array(
135 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
136 'text' => $labelstatus
139 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
140 $this->info_box_contents[$line][] = array(
141 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($labelstatus).
'"',
142 'text' => $labelstatus
145 $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
146 $this->info_box_contents[$line][] = array(
147 'td' =>
'class="right tdoverflowmax100" width="10%" title="'.
dol_escape_htmltag($langs->trans(
"Total")).
'"',
148 'text' => $langs->trans(
"Total")
151 foreach ($sumMembers as $key => $data) {
158 $adhtype->label = $data[
'label'];
159 $AdherentType[$key] = $adhtype;
161 $this->info_box_contents[$line][] = array(
162 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
163 'text' => $adhtype->getNomUrl(1,
dol_size(32)),
166 $this->info_box_contents[$line][] = array(
167 'td' =>
'class="right"',
168 'text' => (isset($data[
'members_draft']) && $data[
'members_draft'] > 0 ? $data[
'members_draft'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_DRAFT, 1, 0, 3),
171 $this->info_box_contents[$line][] = array(
172 'td' =>
'class="right"',
173 'text' => (isset($data[
'members_pending']) && $data[
'members_pending'] > 0 ? $data[
'members_pending'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 1, 0, 3),
176 $this->info_box_contents[$line][] = array(
177 'td' =>
'class="right"',
178 'text' => (isset($data[
'members_uptodate']) && $data[
'members_uptodate'] > 0 ? $data[
'members_uptodate'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 0, 0, 3),
181 $this->info_box_contents[$line][] = array(
182 'td' =>
'class="right"',
183 'text' => (isset($data[
'members_expired']) && $data[
'members_expired'] > 0 ? $data[
'members_expired'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_VALIDATED, 1, 1, 3),
186 $this->info_box_contents[$line][] = array(
187 'td' =>
'class="right"',
188 'text' => (isset($data[
'members_excluded']) && $data[
'members_excluded'] > 0 ? $data[
'members_excluded'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_EXCLUDED, 1, $now, 3),
191 $this->info_box_contents[$line][] = array(
192 'td' =>
'class="right"',
193 'text' => (isset($data[
'members_resiliated']) && $data[
'members_resiliated'] > 0 ? $data[
'members_resiliated'] :
'') .
' ' . $staticmember->LibStatut(
Adherent::STATUS_RESILIATED, 1, 0, 3),
196 $this->info_box_contents[$line][] = array(
197 'td' =>
'class="right"',
198 'text' => (isset($data[
'total_adhtype']) && $data[
'total_adhtype'] > 0 ? $data[
'total_adhtype'] :
''),
204 if (count($sumMembers) == 0) {
205 $this->info_box_contents[$line][0] = array(
206 'td' =>
'colspan="7" class="center"',
207 'text' => $langs->trans(
"NoRecordedMembersByType")
210 $this->info_box_contents[$line][] = array(
211 'tr' =>
'class="liste_total"',
212 'td' =>
'class="liste_total"',
213 'text' => $langs->trans(
"Total")
215 $this->info_box_contents[$line][] = array(
216 'td' =>
'class="liste_total right"',
217 'text' => $sumMembers[
'total'][
'members_draft'].
' '.$staticmember->LibStatut(
Adherent::STATUS_DRAFT, 1, 0, 3),
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"',
240 $this->info_box_contents[$line][] = array(
241 'td' =>
'class="liste_total right"',
245 $this->info_box_contents[$line][] = array(
246 'td' =>
'class="liste_total right"',
247 'text' => $sumMembers[
'total'][
'all'],
252 $this->info_box_contents[0][0] = array(
255 'text' => ($this->db->error() .
' sql=' . $sql)
259 $this->info_box_contents[0][0] = array(
260 'td' =>
'class="nohover opacitymedium left"',
261 'text' => $langs->trans(
"ReadPermissionNotAllowed")