27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherentstats.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
36 $userid =
GETPOST(
'userid',
'int');
if ($userid < 0) {
39 $socid =
GETPOST(
'socid',
'int');
if ($socid < 0) {
44 if ($user->socid > 0) {
46 $socid = $user->socid;
51 $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
55 $langs->loadLangs(array(
"companies",
"members"));
65 $title = $langs->trans(
"SubscriptionsStatistics");
70 $dir = $conf->adherent->dir_temp;
77 $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
82 $filenamenb = $dir.
'/subscriptionsnbinyear-'.$year.
'.png';
83 $fileurlnb = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsnbinyear-'.$year.
'.png';
87 $mesg = $px1->isGraphKo();
91 while ($i <= $endyear) {
95 $px1->SetLegend($legend);
96 $px1->SetMaxValue($px1->GetCeilMaxValue());
97 $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
98 $px1->SetWidth($WIDTH);
99 $px1->SetHeight($HEIGHT);
100 $px1->SetYLabel($langs->trans(
"NbOfSubscriptions"));
102 $px1->SetHorizTickIncrement(1);
103 $px1->mode =
'depth';
104 $px1->SetTitle($langs->trans(
"NbOfSubscriptions"));
106 $px1->draw($filenamenb, $fileurlnb);
110 $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
114 $filenameamount = $dir.
'/subscriptionsamountinyear-'.$year.
'.png';
115 $fileurlamount = DOL_URL_ROOT.
'/viewimage.php?modulepart=memberstats&file=subscriptionsamountinyear-'.$year.
'.png';
118 $mesg = $px2->isGraphKo();
120 $px2->SetData($data);
122 while ($i <= $endyear) {
126 $px2->SetLegend($legend);
127 $px2->SetMaxValue($px2->GetCeilMaxValue());
128 $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
129 $px2->SetWidth($WIDTH);
130 $px2->SetHeight($HEIGHT);
131 $px2->SetYLabel($langs->trans(
"AmountOfSubscriptions"));
133 $px2->SetHorizTickIncrement(1);
134 $px2->mode =
'depth';
135 $px2->SetTitle($langs->trans(
"AmountOfSubscriptions"));
137 $px2->draw($filenameamount, $fileurlamount);
146 print
'<div class="fichecenter"><div class="fichethirdleft">';
169 $data = $stats->getAllByYear();
172 print
'<div class="div-table-responsive-no-min">';
173 print
'<table class="noborder">';
174 print
'<tr class="liste_titre" height="24">';
175 print
'<td class="center">'.$langs->trans(
"Year").
'</td>';
176 print
'<td class="right">'.$langs->trans(
"NbOfSubscriptions").
'</td>';
177 print
'<td class="right">'.$langs->trans(
"AmountTotal").
'</td>';
178 print
'<td class="right">'.$langs->trans(
"AmountAverage").
'</td>';
182 foreach ($data as $val) {
183 $year = $val[
'year'];
184 while ($oldyear > $year + 1) {
186 print
'<tr class="oddeven" height="24">';
187 print
'<td class="center">';
192 print
'<td class="right">0</td>';
193 print
'<td class="right amount nowraponall">0</td>';
194 print
'<td class="right amount nowraponall">0</td>';
197 print
'<tr class="oddeven" height="24">';
198 print
'<td class="center">';
199 print
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?date_select='.((int) $year).
'">'.$year.
'</a>';
201 print
'<td class="right">'.$val[
'nb'].
'</td>';
202 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'total'],
'MT'), 1).
'</span></td>';
203 print
'<td class="right amount nowraponall"><span class="amount">'.price(
price2num($val[
'avg'],
'MT'), 1).
'</span></td>';
212 print
'</div><div class="fichetwothirdright">';
216 print
'<table class="border centpercent"><tr class="pair nohover"><td class="center">';
224 print
'</td></tr></table>';
227 print
'</div></div>';
228 print
'<div style="clear:both"></div>';
Class to manage members of a foundation.
Class to manage statistics of members.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
member_stats_prepare_head($object)
Return array head with list of tabs to view object stats informations.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.