2006-11-20 01:13:13 +00:00
|
|
|
<?php
|
2017-10-04 07:13:41 +00:00
|
|
|
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
2019-01-28 20:39:22 +00:00
|
|
|
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
2017-10-04 07:13:41 +00:00
|
|
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
2018-10-27 12:43:12 +00:00
|
|
|
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
|
2006-11-20 01:13:13 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2006-11-20 01:13:13 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-07-31 23:24:38 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-11-20 01:13:13 +00:00
|
|
|
* or see http://www.gnu.org/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2011-10-24 10:59:44 +00:00
|
|
|
* \file htdocs/core/lib/member.lib.php
|
2016-09-24 04:48:40 +00:00
|
|
|
* \brief Functions for module members
|
2008-12-11 20:12:44 +00:00
|
|
|
*/
|
2006-11-20 01:13:13 +00:00
|
|
|
|
2011-06-21 12:39:09 +00:00
|
|
|
/**
|
|
|
|
|
* Return array head with list of tabs to view object informations
|
2011-12-12 19:14:38 +00:00
|
|
|
*
|
2016-09-24 04:48:40 +00:00
|
|
|
* @param Adherent $object Member
|
|
|
|
|
* @return array head
|
2011-06-21 12:39:09 +00:00
|
|
|
*/
|
2015-02-10 09:45:48 +00:00
|
|
|
function member_prepare_head(Adherent $object)
|
2006-11-20 01:13:13 +00:00
|
|
|
{
|
2016-01-23 16:19:34 +00:00
|
|
|
global $db, $langs, $conf, $user;
|
2009-03-12 01:44:02 +00:00
|
|
|
|
2006-11-20 01:13:13 +00:00
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
2009-03-12 01:44:02 +00:00
|
|
|
|
2014-09-18 19:18:25 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/card.php?rowid='.$object->id;
|
2016-08-29 20:07:21 +00:00
|
|
|
$head[$h][1] = $langs->trans("Card");
|
2006-11-20 01:13:13 +00:00
|
|
|
$head[$h][2] = 'general';
|
|
|
|
|
$h++;
|
2009-03-12 01:44:02 +00:00
|
|
|
|
2017-10-04 07:13:41 +00:00
|
|
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE))
|
|
|
|
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
2006-11-20 01:13:13 +00:00
|
|
|
{
|
|
|
|
|
$langs->load("ldap");
|
2009-03-12 01:44:02 +00:00
|
|
|
|
2010-12-19 11:05:07 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/ldap.php?id='.$object->id;
|
2006-11-20 01:13:13 +00:00
|
|
|
$head[$h][1] = $langs->trans("LDAPCard");
|
|
|
|
|
$head[$h][2] = 'ldap';
|
|
|
|
|
$h++;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 04:48:40 +00:00
|
|
|
if (! empty($user->rights->adherent->cotisation->lire))
|
2007-05-26 02:18:06 +00:00
|
|
|
{
|
2018-03-23 18:35:25 +00:00
|
|
|
$nbSubscription = is_array($object->subscriptions)?count($object->subscriptions):0;
|
2016-09-24 04:48:40 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id;
|
2007-05-26 02:18:06 +00:00
|
|
|
$head[$h][1] = $langs->trans("Subscriptions");
|
|
|
|
|
$head[$h][2] = 'subscription';
|
2018-03-23 18:35:25 +00:00
|
|
|
if ($nbSubscription > 0) $head[$h][1].= ' <span class="badge">'.$nbSubscription.'</span>';
|
2007-05-26 02:18:06 +00:00
|
|
|
$h++;
|
|
|
|
|
}
|
2009-03-12 01:44:02 +00:00
|
|
|
|
2011-01-24 23:35:21 +00:00
|
|
|
// Show more tabs from modules
|
|
|
|
|
// Entries must be declared in modules descriptor with line
|
|
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
|
|
|
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member');
|
2011-01-24 23:35:21 +00:00
|
|
|
|
2014-05-06 21:42:19 +00:00
|
|
|
$nbNote = 0;
|
|
|
|
|
if(!empty($object->note)) $nbNote++;
|
|
|
|
|
if(!empty($object->note_private)) $nbNote++;
|
|
|
|
|
if(!empty($object->note_public)) $nbNote++;
|
2011-01-24 23:35:21 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
|
2007-05-20 22:53:11 +00:00
|
|
|
$head[$h][1] = $langs->trans("Note");
|
|
|
|
|
$head[$h][2] = 'note';
|
2014-10-19 17:57:42 +00:00
|
|
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
2007-05-20 22:53:11 +00:00
|
|
|
$h++;
|
|
|
|
|
|
2016-01-09 00:54:10 +00:00
|
|
|
// Attachments
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
2016-01-23 16:19:34 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
2019-01-27 10:55:16 +00:00
|
|
|
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
|
|
|
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
2016-01-23 16:19:34 +00:00
|
|
|
$nbLinks=Link::count($db, $object->element, $object->id);
|
2010-12-19 11:05:07 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
|
2016-01-09 00:54:10 +00:00
|
|
|
$head[$h][1] = $langs->trans('Documents');
|
2016-01-23 16:23:00 +00:00
|
|
|
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
2016-02-19 06:39:14 +00:00
|
|
|
$head[$h][2] = 'document';
|
2010-08-29 21:44:35 +00:00
|
|
|
$h++;
|
|
|
|
|
|
2016-10-02 18:15:11 +00:00
|
|
|
// Show agenda tab
|
|
|
|
|
if (! empty($conf->agenda->enabled))
|
|
|
|
|
{
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Events");
|
|
|
|
|
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
|
|
|
|
{
|
|
|
|
|
$head[$h][1].= '/';
|
|
|
|
|
$head[$h][1].= $langs->trans("Agenda");
|
|
|
|
|
}
|
|
|
|
|
$head[$h][2] = 'agenda';
|
|
|
|
|
$h++;
|
|
|
|
|
}
|
2017-09-12 09:17:23 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'remove');
|
2012-10-04 13:37:10 +00:00
|
|
|
|
2006-11-20 01:13:13 +00:00
|
|
|
return $head;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-20 04:25:43 +00:00
|
|
|
/**
|
|
|
|
|
* Return array head with list of tabs to view object informations
|
|
|
|
|
*
|
2016-04-09 13:07:33 +00:00
|
|
|
* @param AdherentType $object Member
|
2015-05-20 04:25:43 +00:00
|
|
|
* @return array head
|
|
|
|
|
*/
|
|
|
|
|
function member_type_prepare_head(AdherentType $object)
|
|
|
|
|
{
|
|
|
|
|
global $langs, $conf, $user;
|
|
|
|
|
|
|
|
|
|
$h=0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Card");
|
|
|
|
|
$head[$h][2] = 'card';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2017-10-04 07:13:41 +00:00
|
|
|
if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE))
|
|
|
|
|
&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
|
2017-09-16 15:51:18 +00:00
|
|
|
{
|
|
|
|
|
$langs->load("ldap");
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/type_ldap.php?rowid='.$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("LDAPCard");
|
|
|
|
|
$head[$h][2] = 'ldap';
|
|
|
|
|
$h++;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-20 04:25:43 +00:00
|
|
|
// Show more tabs from modules
|
|
|
|
|
// Entries must be declared in modules descriptor with line
|
|
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
|
|
|
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype');
|
2015-05-20 04:25:43 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype', 'remove');
|
2015-05-20 04:25:43 +00:00
|
|
|
|
|
|
|
|
return $head;
|
|
|
|
|
}
|
2011-06-21 12:39:09 +00:00
|
|
|
|
2011-06-22 15:43:14 +00:00
|
|
|
/**
|
|
|
|
|
* Return array head with list of tabs to view object informations
|
2012-01-11 17:43:38 +00:00
|
|
|
*
|
2012-09-30 18:49:13 +00:00
|
|
|
* @return array head
|
2011-06-22 15:43:14 +00:00
|
|
|
*/
|
2012-09-13 09:52:50 +00:00
|
|
|
function member_admin_prepare_head()
|
2011-06-22 15:43:14 +00:00
|
|
|
{
|
|
|
|
|
global $langs, $conf, $user;
|
|
|
|
|
|
|
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent.php';
|
2013-03-24 06:11:44 +00:00
|
|
|
$head[$h][1] = $langs->trans("Miscellaneous");
|
2011-06-22 15:43:14 +00:00
|
|
|
$head[$h][2] = 'general';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2017-09-12 09:17:23 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_emails.php';
|
|
|
|
|
$head[$h][1] = $langs->trans("EMails");
|
|
|
|
|
$head[$h][2] = 'emails';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2011-08-17 19:43:18 +00:00
|
|
|
// Show more tabs from modules
|
|
|
|
|
// Entries must be declared in modules descriptor with line
|
|
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
|
|
|
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin');
|
2011-12-12 19:14:38 +00:00
|
|
|
|
2011-06-22 16:24:20 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php';
|
2013-01-08 18:16:39 +00:00
|
|
|
$head[$h][1] = $langs->trans("ExtraFieldsMember");
|
2011-06-22 15:43:14 +00:00
|
|
|
$head[$h][2] = 'attributes';
|
|
|
|
|
$h++;
|
2014-05-06 21:42:19 +00:00
|
|
|
|
2013-01-08 18:16:39 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_type_extrafields.php';
|
|
|
|
|
$head[$h][1] = $langs->trans("ExtraFieldsMemberType");
|
|
|
|
|
$head[$h][2] = 'attributes_type';
|
|
|
|
|
$h++;
|
2011-06-22 15:43:14 +00:00
|
|
|
|
2017-09-12 09:17:23 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/website.php';
|
2011-07-03 16:00:18 +00:00
|
|
|
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
|
2017-09-12 09:17:23 +00:00
|
|
|
$head[$h][2] = 'website';
|
2011-07-03 16:00:18 +00:00
|
|
|
$h++;
|
2011-12-12 19:14:38 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin', 'remove');
|
2011-06-22 15:43:14 +00:00
|
|
|
|
|
|
|
|
return $head;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-21 12:39:09 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return array head with list of tabs to view object stats informations
|
2011-12-12 19:14:38 +00:00
|
|
|
*
|
2015-02-10 09:45:48 +00:00
|
|
|
* @param Adherent $object Member or null
|
2011-12-12 19:14:38 +00:00
|
|
|
* @return array head
|
2011-06-21 12:39:09 +00:00
|
|
|
*/
|
|
|
|
|
function member_stats_prepare_head($object)
|
|
|
|
|
{
|
|
|
|
|
global $langs, $conf, $user;
|
|
|
|
|
|
|
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/index.php';
|
|
|
|
|
$head[$h][1] = $langs->trans("Subscriptions");
|
|
|
|
|
$head[$h][2] = 'statssubscription';
|
|
|
|
|
$h++;
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbycountry';
|
|
|
|
|
$head[$h][1] = $langs->trans("Country");
|
|
|
|
|
$head[$h][2] = 'statscountry';
|
|
|
|
|
$h++;
|
2014-10-19 17:57:42 +00:00
|
|
|
|
2014-04-10 20:15:56 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion';
|
|
|
|
|
$head[$h][1] = $langs->trans("Region");
|
2014-05-16 13:59:57 +00:00
|
|
|
$head[$h][2] = 'statsregion';
|
2014-04-10 20:15:56 +00:00
|
|
|
$h++;
|
2011-06-21 12:39:09 +00:00
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbystate';
|
|
|
|
|
$head[$h][1] = $langs->trans("State");
|
|
|
|
|
$head[$h][2] = 'statsstate';
|
|
|
|
|
$h++;
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbytown';
|
|
|
|
|
$head[$h][1] = $langs->trans('Town');
|
|
|
|
|
$head[$h][2] = 'statstown';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2012-11-21 22:01:36 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/byproperties.php';
|
|
|
|
|
$head[$h][1] = $langs->trans('ByProperties');
|
|
|
|
|
$head[$h][2] = 'statsbyproperties';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2011-06-21 12:39:09 +00:00
|
|
|
// Show more tabs from modules
|
|
|
|
|
// Entries must be declared in modules descriptor with line
|
|
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
2012-12-01 14:45:05 +00:00
|
|
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats');
|
2011-06-21 12:39:09 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats', 'remove');
|
2012-12-01 14:45:05 +00:00
|
|
|
|
2011-06-21 12:39:09 +00:00
|
|
|
return $head;
|
|
|
|
|
}
|
2016-09-24 04:48:40 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return array head with list of tabs to view object informations
|
|
|
|
|
*
|
|
|
|
|
* @param Subscription $object Subscription
|
|
|
|
|
* @return array head
|
|
|
|
|
*/
|
|
|
|
|
function subscription_prepare_head(Subscription $object)
|
|
|
|
|
{
|
|
|
|
|
global $db, $langs, $conf, $user;
|
|
|
|
|
|
|
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Card");
|
|
|
|
|
$head[$h][2] = 'general';
|
|
|
|
|
$h++;
|
|
|
|
|
|
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription/info.php?rowid='.$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Info");
|
|
|
|
|
$head[$h][2] = 'info';
|
|
|
|
|
$h++;
|
|
|
|
|
|
|
|
|
|
// Show more tabs from modules
|
|
|
|
|
// Entries must be declared in modules descriptor with line
|
|
|
|
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
|
|
|
|
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription');
|
2016-09-24 04:48:40 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription', 'remove');
|
2016-09-24 04:48:40 +00:00
|
|
|
|
|
|
|
|
return $head;
|
|
|
|
|
}
|