27 include_once DOL_DOCUMENT_ROOT.
'/core/boxes/modules_boxes.php';
35 public $boxcode =
"lastmembers";
36 public $boximg =
"object_user";
37 public $boxlabel =
"BoxLastMembers";
38 public $depends = array(
"adherent");
48 public $info_box_head = array();
49 public $info_box_contents = array();
65 $listofmodulesforexternal = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
66 if (!in_array(
'adherent', $listofmodulesforexternal) && !empty($user->socid)) $this->enabled = 0;
68 $this->hidden = !($user->rights->adherent->lire);
79 global $user, $langs, $conf;
80 $langs->load(
"boxes");
84 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
87 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastModifiedMembers", $max));
89 if ($user->rights->adherent->lire) {
90 $sql =
"SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
91 $sql .=
" a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
92 $sql .=
' a.photo, a.email, a.gender, a.morphy,';
93 $sql .=
" t.subscription";
94 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as t";
95 $sql .=
" WHERE a.entity IN (".getEntity(
'member').
")";
96 $sql .=
" AND a.fk_adherent_type = t.rowid";
97 $sql .=
" ORDER BY a.tms DESC";
98 $sql .= $this->
db->plimit($max, 0);
100 $result = $this->
db->query($sql);
102 $num = $this->
db->num_rows($result);
105 while ($line < $num) {
106 $objp = $this->
db->fetch_object($result);
107 $datec = $this->
db->jdate($objp->datec);
108 $datem = $this->
db->jdate($objp->tms);
110 $memberstatic->lastname = $objp->lastname;
111 $memberstatic->firstname = $objp->firstname;
112 $memberstatic->id = $objp->rowid;
113 $memberstatic->ref = $objp->rowid;
114 $memberstatic->photo = $objp->photo;
115 $memberstatic->gender = $objp->gender;
116 $memberstatic->email = $objp->email;
117 $memberstatic->morphy = $objp->morphy;
118 $memberstatic->company = $objp->company;
119 $memberstatic->statut = $objp->status;
120 $memberstatic->date_creation = $datec;
121 $memberstatic->date_modification = $datem;
122 $memberstatic->need_subscription = $objp->subscription;
123 $memberstatic->datefin = $this->
db->jdate($objp->date_end_subscription);
125 if (!empty($objp->fk_soc)) {
126 $memberstatic->socid = $objp->fk_soc;
127 $memberstatic->fetch_thirdparty();
128 $memberstatic->name = $memberstatic->thirdparty->name;
130 $memberstatic->name = $objp->company;
133 $this->info_box_contents[$line][] = array(
134 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
135 'text' => $memberstatic->getNomUrl(-1),
139 $this->info_box_contents[$line][] = array(
140 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
141 'text' => $memberstatic->company,
142 'url' => DOL_URL_ROOT.
"/adherents/card.php?rowid=".$objp->rowid,
145 $this->info_box_contents[$line][] = array(
146 'td' =>
'class="right"',
150 $this->info_box_contents[$line][] = array(
151 'td' =>
'class="right" width="18"',
152 'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3),
159 $this->info_box_contents[$line][0] = array(
160 'td' =>
'class="center"',
161 'text'=>$langs->trans(
"NoRecordedCustomers"),
164 $this->
db->free($result);
166 $this->info_box_contents[0][0] = array(
169 'text' => ($this->
db->error().
' sql='.$sql),
173 $this->info_box_contents[0][0] = array(
174 'td' =>
'class="nohover opacitymedium left"',
175 'text' => $langs->trans(
"ReadPermissionNotAllowed")
188 public function showBox($head = null, $contents = null, $nooutput = 0)
190 return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
$conf db
API class for accounts.
loadBox($max=5)
Load data into info_box_contents array to show array later.
Class to manage members of a foundation.
showBox($head=null, $contents=null, $nooutput=0)
Method to show box.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Class to manage the box to show last members.
__construct($db, $param= '')
Constructor.