--- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_byproperties.php +++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_byproperties.php @@ -33,9 +33,10 @@ // Security check -if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; +if ($user->socid > 0) +{ + $action = ''; + $socid = $user->socid; } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); @@ -61,119 +62,87 @@ dol_mkdir($dir); +$tab = 'byproperties'; + $data = array(); - -$sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,"; -$sql .= " MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,"; -$sql .= " d.morphy as code"; +$sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; -$sql .= " AND d.statut != -1"; // Not draft +$sql .= " AND d.statut = 1"; $sql .= " GROUP BY d.morphy"; + $foundphy = $foundmor = 0; // Define $data array dol_syslog("Count member", LOG_DEBUG); $resql = $db->query($sql); -if ($resql) { +if ($resql) +{ $num = $db->num_rows($resql); $i = 0; - while ($i < $num) { + while ($i < $num) + { $obj = $db->fetch_object($resql); if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'mor') $foundmor++; - $data[$obj->code] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'nbsubscriptions'=>$obj->nbsubscriptions, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); + $data[] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); $i++; } $db->free($resql); -} else { - dol_print_error($db); } - -$sql = "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions,"; -$sql .= " MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate,"; -$sql .= " d.morphy as code"; -$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; -$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; -$sql .= " AND d.statut >= 1"; // Active (not draft=-1, not resiliated=0) -$sql .= " GROUP BY d.morphy"; -$foundphy = $foundmor = 0; - -// Define $data array -dol_syslog("Count member still active", LOG_DEBUG); -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $db->fetch_object($resql); - - if ($obj->code == 'phy') $foundphy++; - if ($obj->code == 'mor') $foundmor++; - - $data[$obj->code]['nbactive'] = $obj->nb; - - $i++; - } - $db->free($resql); -} else { +else +{ dol_print_error($db); } $head = member_stats_prepare_head($adh); -print dol_get_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user'); +dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user'); // Print title -if (!count($data)) { - print ''.$langs->trans("NoValidatedMemberYet").'
'; +if (!count($data)) +{ + print $langs->trans("NoValidatedMemberYet").'
'; print '
'; -} else { - print ''.$langs->trans("MembersByNature").'
'; +} +else +{ + print $langs->trans("MembersByNature").'
'; print '
'; } // Print array -print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; print ''; -print ''; print ''; print ''; -if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); -if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); +if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); +if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>''); -foreach ($data as $val) { - $nb = $val['nb']; - $nbsubscriptions = $val['nbsubscriptions']; - $nbactive = $val['nbactive']; - +foreach ($data as $val) +{ print ''; print ''; - print ''; - print ''; + print ''; print ''; - print ''; print ''; print ''; } print '
'.$langs->trans("MemberNature").''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("NbOfActiveMembers").''.$langs->trans("Nature").''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("NbOfSubscriptions").''.$langs->trans("LatestSubscriptionDate").'
'.$memberstatic->getmorphylib($val['label']).''.$nb.''.$nbactive.''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.$nbsubscriptions.''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; -print '
'; -print dol_get_fiche_end(); + +dol_fiche_end(); // End of page llxFooter(); --- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_geo.php +++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_geo.php @@ -34,9 +34,10 @@ // Security check -if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; +if ($user->socid > 0) +{ + $action = ''; + $socid = $user->socid; } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); @@ -45,7 +46,7 @@ $endyear = $year; // Load translation files required by the page -$langs->loadLangs(array("companies", "members", "banks")); +$langs->loadLangs(array("companies", "members")); /* @@ -67,239 +68,258 @@ dol_mkdir($dir); -if ($mode) { - // Define sql - if ($mode == 'memberbycountry') { - $label = $langs->trans("Country"); - $tab = 'statscountry'; - - $data = array(); - $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; - $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; - $sql .= " AND d.statut != -1"; - $sql .= " GROUP BY c.label, c.code"; - //print $sql; - } - - if ($mode == 'memberbystate') { - $label = $langs->trans("Country"); - $label2 = $langs->trans("State"); - $tab = 'statsstate'; - - $data = array(); - $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; // - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; - $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; - $sql .= " AND d.statut != -1"; - $sql .= " GROUP BY co.label, co.code, c.nom"; - //print $sql; - } - if ($mode == 'memberbyregion') { // - $label = $langs->trans("Country"); - $label2 = $langs->trans("Region"); //département - $tab = 'statsregion'; //onglet - - $data = array(); //tableau de donnée - $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; - $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; - $sql .= " AND d.statut != -1"; - $sql .= " GROUP BY co.label, co.code, r.nom"; //+ - //print $sql; - } - if ($mode == 'memberbytown') { - $label = $langs->trans("Country"); - $label2 = $langs->trans("Town"); - $tab = 'statstown'; - - $data = array(); - $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; - $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; - $sql .= " AND d.statut != -1"; - $sql .= " GROUP BY c.label, c.code, d.town"; - //print $sql; - } - - $langsen = new Translate('', $conf); - $langsen->setDefaultLang('en_US'); - $langsen->load("dict"); - //print $langsen->trans("Country"."FI");exit; - - // Define $data array - dol_syslog("Count member", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $db->fetch_object($resql); - if ($mode == 'memberbycountry') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), +if ($mode) +{ + // Define sql + if ($mode == 'memberbycountry') + { + $label = $langs->trans("Country"); + $tab = 'statscountry'; + + $data = array(); + $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; + $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; + $sql .= " AND d.statut = 1"; + $sql .= " GROUP BY c.label, c.code"; + //print $sql; + } + + if ($mode == 'memberbystate') + { + $label = $langs->trans("Country"); + $label2 = $langs->trans("State"); + $tab = 'statsstate'; + + $data = array(); + $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; // + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; + $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; + $sql .= " AND d.statut = 1"; + $sql .= " GROUP BY co.label, co.code, c.nom"; + //print $sql; + } + if ($mode == 'memberbyregion') // + { + $label = $langs->trans("Country"); + $label2 = $langs->trans("Region"); //département + $tab = 'statsregion'; //onglet + + $data = array(); //tableau de donnée + $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; + $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; + $sql .= " AND d.statut = 1"; + $sql .= " GROUP BY co.label, co.code, r.nom"; //+ + //print $sql; + } + if ($mode == 'memberbytown') + { + $label = $langs->trans("Country"); + $label2 = $langs->trans("Town"); + $tab = 'statstown'; + + $data = array(); + $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; + $sql .= " WHERE d.entity IN (".getEntity('adherent').")"; + $sql .= " AND d.statut = 1"; + $sql .= " GROUP BY c.label, c.code, d.town"; + //print $sql; + } + + $langsen = new Translate('', $conf); + $langsen->setDefaultLang('en_US'); + $langsen->load("dict"); + //print $langsen->trans("Country"."FI");exit; + + // Define $data array + dol_syslog("Count member", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + if ($mode == 'memberbycountry') + { + $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'code'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) - ); - } - if ($mode == 'memberbyregion') { //+ - $data[] = array( - 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + ); + } + if ($mode == 'memberbyregion') //+ + { + $data[] = array( + 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) - ); - } - if ($mode == 'memberbystate') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + ); + } + if ($mode == 'memberbystate') + { + $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) - ); - } - if ($mode == 'memberbytown') { - $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), - 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), - 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate), - 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) - ); - } - - $i++; - } - $db->free($resql); - } else { - dol_print_error($db); - } + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + ); + } + if ($mode == 'memberbytown') + { + $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), + 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), + 'nb'=>$obj->nb, + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) + ); + } + + $i++; + } + $db->free($resql); + } + else + { + dol_print_error($db); + } } $head = member_stats_prepare_head($adh); -print dol_get_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user'); +dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user'); // Print title -if ($mode && !count($data)) { - print $langs->trans("NoValidatedMemberYet").'
'; - print '
'; -} else { - if ($mode == 'memberbycountry') print ''.$langs->trans("MembersByCountryDesc").'
'; - elseif ($mode == 'memberbystate') print ''.$langs->trans("MembersByStateDesc").'
'; - elseif ($mode == 'memberbytown') print ''.$langs->trans("MembersByTownDesc").'
'; - elseif ($mode == 'memberbyregion') print ''.$langs->trans("MembersByRegion").'
'; //+ - else { - print ''.$langs->trans("MembersStatisticsDesc").'
'; - print '
'; - print ''.$langs->trans("MembersStatisticsByCountries").'
'; - print '
'; - print ''.$langs->trans("MembersStatisticsByState").'
'; - print '
'; - print ''.$langs->trans("MembersStatisticsByTown").'
'; - print '
'; //+ +if ($mode && !count($data)) +{ + print $langs->trans("NoValidatedMemberYet").'
'; + print '
'; +} +else +{ + if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'
'; + elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'
'; + elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'
'; + elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'
'; //+ + else + { + print $langs->trans("MembersStatisticsDesc").'
'; + print '
'; + print ''.$langs->trans("MembersStatisticsByCountries").'
'; + print '
'; + print ''.$langs->trans("MembersStatisticsByState").'
'; + print '
'; + print ''.$langs->trans("MembersStatisticsByTown").'
'; + print '
'; //+ print ''.$langs->trans("MembersStatisticsByRegion").'
'; //+ - } - print '
'; + } + print '
'; } // Show graphics -if (count($arrayjs) && $mode == 'memberbycountry') { - $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; - if (is_readable($color_file)) include_once $color_file; - - // Assume we've already included the proper headers so just call our script inline - // More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR - print "\n\n"; - - // print the div tag that will contain the map - print '
'."\n"; - print '
'; -} - -if ($mode) { - // Print array - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; - print ''; - if ($label2) print ''; - print ''; - print ''; - print ''; - print ''; - - foreach ($data as $val) { - $year = $val['year']; - print ''; - print ''; - if ($label2) print ''; - print ''; - print ''; - print ''; - print ''; - } - - print '
'.$label.''.$label2.''.$langs->trans("NbOfMembers").' ('.$langs->trans("AllTime").')'.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$val['label'].''.$val['label2'].''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; - print '
'; -} - - -print dol_get_fiche_end(); +if (count($arrayjs) && $mode == 'memberbycountry') +{ + $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + if (is_readable($color_file)) include_once $color_file; + + // Assume we've already included the proper headers so just call our script inline + // More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR + print "\n\n"; + + // print the div tag that will contain the map + print '
'."\n"; + print '
'; +} + +if ($mode) +{ + // Print array / Affiche le tableau + print ''; + print ''; + print ''; + if ($label2) print ''; + print ''; + print ''; + print ''; + print ''; + + foreach ($data as $val) + { + $year = $val['year']; + print ''; + print ''; + if ($label2) print ''; + print ''; + print ''; + print ''; + print ''; + } + + print '
'.$label.''.$label2.''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$val['label'].''.$val['label2'].''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; +} + + +dol_fiche_end(); // End of page llxFooter(); --- /tmp/dsg/dolibarr/htdocs/adherents/stats/github_index.php +++ /tmp/dsg/dolibarr/htdocs/adherents/stats/client_index.php @@ -35,9 +35,10 @@ $socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0; // Security check -if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; +if ($user->socid > 0) +{ + $action = ''; + $socid = $user->socid; } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); @@ -78,25 +79,27 @@ $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); -if (!$mesg) { - $px1->SetData($data); - $i = $startyear; - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px1->SetLegend($legend); - $px1->SetMaxValue($px1->GetCeilMaxValue()); - $px1->SetMinValue(min(0, $px1->GetFloorMinValue())); - $px1->SetWidth($WIDTH); - $px1->SetHeight($HEIGHT); - $px1->SetYLabel($langs->trans("NbOfSubscriptions")); - $px1->SetShading(3); - $px1->SetHorizTickIncrement(1); - $px1->mode = 'depth'; - $px1->SetTitle($langs->trans("NbOfSubscriptions")); - - $px1->draw($filenamenb, $fileurlnb); +if (!$mesg) +{ + $px1->SetData($data); + $i = $startyear; + while ($i <= $endyear) + { + $legend[] = $i; + $i++; + } + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0, $px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfSubscriptions")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->mode = 'depth'; + $px1->SetTitle($langs->trans("NbOfSubscriptions")); + + $px1->draw($filenamenb, $fileurlnb); } // Build graphic amount of object @@ -109,31 +112,33 @@ $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); -if (!$mesg) { - $px2->SetData($data); - $i = $startyear; - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px2->SetLegend($legend); - $px2->SetMaxValue($px2->GetCeilMaxValue()); - $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); - $px2->SetWidth($WIDTH); - $px2->SetHeight($HEIGHT); - $px2->SetYLabel($langs->trans("AmountOfSubscriptions")); - $px2->SetShading(3); - $px2->SetHorizTickIncrement(1); - $px2->mode = 'depth'; - $px2->SetTitle($langs->trans("AmountOfSubscriptions")); - - $px2->draw($filenameamount, $fileurlamount); +if (!$mesg) +{ + $px2->SetData($data); + $i = $startyear; + while ($i <= $endyear) + { + $legend[] = $i; + $i++; + } + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfSubscriptions")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->mode = 'depth'; + $px2->SetTitle($langs->trans("AmountOfSubscriptions")); + + $px2->draw($filenameamount, $fileurlamount); } $head = member_stats_prepare_head($adh); -print dol_get_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), -1, 'user'); +dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), -1, 'user'); print '
'; @@ -170,32 +175,34 @@ print ''; $oldyear = 0; -foreach ($data as $val) { - $year = $val['year']; - while ($oldyear > $year + 1) { // If we have empty year - $oldyear--; - print ''; - print ''; - //print ''; - print $oldyear; - //print ''; - print ''; - print '0'; - print '0'; - print '0'; - print ''; - } - print ''; - print ''; - //print ''; - print $year; - //print ''; - print ''; - print ''.$val['nb'].''; - print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.price(price2num($val['avg'], 'MT'), 1).''; - print ''; - $oldyear = $year; +foreach ($data as $val) +{ + $year = $val['year']; + while ($oldyear > $year + 1) + { // If we have empty year + $oldyear--; + print ''; + print ''; + print ''; + print $oldyear; + print ''; + print ''; + print '0'; + print '0'; + print '0'; + print ''; + } + print ''; + print ''; + //print ''; + print $year; + //print ''; + print ''; + print ''.$val['nb'].''; + print ''.price(price2num($val['total'], 'MT'), 1).''; + print ''.price(price2num($val['avg'], 'MT'), 1).''; + print ''; + $oldyear = $year; } print ''; @@ -207,10 +214,11 @@ // Show graphs print '
'; -if ($mesg) { print $mesg; } else { - print $px1->show(); - print "
\n"; - print $px2->show(); +if ($mesg) { print $mesg; } +else { + print $px1->show(); + print "
\n"; + print $px2->show(); } print '
'; @@ -219,7 +227,7 @@ print '
'; -print dol_get_fiche_end(); +dol_fiche_end(); // End of page llxFooter();