dolibarr 25.0.0-alpha
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
7 * Copyright (C) 2021-2026 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2021-2023 Waël Almoman <info@almoman.com>
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
42require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
43require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
44require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/dashboard.lib.php';
46
47// Load translation files required by the page
48$langs->loadLangs(array("companies", "members"));
49
50// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
51$hookmanager->initHooks(array('membersindex'));
52
53// Security check
54$result = restrictedArea($user, 'adherent');
55
56
57/*
58 * Actions
59 */
60
61$userid = GETPOSTINT('userid');
62// Add box (when submit is done from a form when ajax disabled)
63include DOL_DOCUMENT_ROOT.'/core/actions_addbox.inc.php';
64
65
66/*
67 * View
68 */
69
70$form = new Form($db);
71
72// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
73$resultboxes = FormOther::getBoxesArea($user, "2");
74
75$title = $langs->trans("Members");
76$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
77
78llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-index');
79
80$staticmember = new Adherent($db);
81$statictype = new AdherentType($db);
82$subscriptionstatic = new Subscription($db);
83
84print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members');
85
86/*
87 * Statistics
88 */
89
90$boxgraph = '';
91if ($conf->use_javascript_ajax) {
92 $year = idate('Y');
93 $numberyears = getDolGlobalInt("MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH");
94
95 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
96 $stats = new AdherentStats($db, 0, $userid);
97
98 // Show array
99 $sumMembers = $stats->countMembersByTypeAndStatus($numberyears);
100 foreach (array('members_draft', 'members_pending', 'members_uptodate', 'members_expired', 'members_excluded', 'members_resiliated') as $val) {
101 if (empty($sumMembers['total'][$val])) {
102 $sumMembers['total'][$val] = 0;
103 }
104 }
105
106 $colors = getThemeBadgeStatusColors();
107 $series = array(
108 array('label' => $langs->transnoentitiesnoconv("MembersStatusToValid"), 'nb' => $sumMembers['total']['members_draft'], 'color' => '-'.$colors[0]), // Draft, not yet validated
109 array('label' => $langs->transnoentitiesnoconv("WaitingSubscription"), 'nb' => $sumMembers['total']['members_pending'], 'color' => $colors[1]),
110 array('label' => $langs->transnoentitiesnoconv("UpToDate"), 'nb' => $sumMembers['total']['members_uptodate'], 'color' => $colors[4]),
111 array('label' => $langs->transnoentitiesnoconv("OutOfDate"), 'nb' => $sumMembers['total']['members_expired'], 'color' => $colors[8]),
112 array('label' => $langs->transnoentitiesnoconv("MembersStatusExcluded"), 'nb' => $sumMembers['total']['members_excluded'], 'color' => '-'.$colors[8]),
113 array('label' => $langs->transnoentitiesnoconv("MembersStatusResiliated"), 'nb' => $sumMembers['total']['members_resiliated'], 'color' => $colors[6]),
114 );
115
116 $boxgraph .= getStatusPieChart($langs->trans("Statistics").' - '.$langs->trans("Status").' '.($numberyears ? ' ('.($year - $numberyears).' - '.$year.')' : ''), $series);
117}
118
119// boxes
120print '<div class="clearboth"></div>';
121print '<div class="fichecenter fichecenterbis">';
122
123print '<div class="twocolumns">';
124
125print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
126
127print $boxgraph;
128
129print $resultboxes['boxlista'];
130
131print '</div>'."\n";
132
133print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
134
135print $resultboxes['boxlistb'];
136
137print '</div>'."\n";
138
139print '</div>';
140print '</div>';
141
142$parameters = array('user' => $user);
143$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook
144
145// End of page
146llxFooter();
147$db->close();
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage members of a foundation.
Class to manage statistics of members.
Class to manage members type.
Class to manage generation of HTML components Only common components must be here.
static getBoxesArea($user, $areacode)
Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of us...
Class to manage subscriptions of foundation members.
getThemeBadgeStatusColors()
Return the colors of status badges defined by the current theme (theme_vars.inc.php)
getStatusPieChart($title, $series, $options=array())
Return the HTML table with a pie chart of values by status, as shown on the home page of a module.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.