dolibarr 19.0.3
agenda.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
4 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
6 * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
7 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
32require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
33require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36
37// Load translation files required by the page
38$langs->loadLangs(array('companies', 'members'));
39
40// Get Parameters
41$id = GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
42
43// Pagination
44$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
45$sortfield = GETPOST('sortfield', 'aZ09comma');
46$sortorder = GETPOST('sortorder', 'aZ09comma');
47$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
48if (empty($page) || $page == -1) {
49 $page = 0;
50} // If $page is not defined, or '' or -1
51$offset = $limit * $page;
52$pageprev = $page - 1;
53$pagenext = $page + 1;
54if (!$sortfield) {
55 $sortfield = 'a.datep,a.id';
56}
57if (!$sortorder) {
58 $sortorder = 'DESC';
59}
60
61if (GETPOST('actioncode', 'array')) {
62 $actioncode = GETPOST('actioncode', 'array', 3);
63 if (!count($actioncode)) {
64 $actioncode = '0';
65 }
66} else {
67 $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
68}
69$search_rowid = GETPOST('search_rowid');
70$search_agenda_label = GETPOST('search_agenda_label');
71
72// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
73$objcanvas = null;
74
75// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
76$hookmanager->initHooks(array('memberagenda', 'globalcard'));
77
78// Security check
79$result = restrictedArea($user, 'adherent', $id);
80
81// Initialize technical objects
82$object = new Adherent($db);
83$result = $object->fetch($id);
84if ($result > 0) {
85 $object->fetch_thirdparty();
86
87 $adht = new AdherentType($db);
88 $result = $adht->fetch($object->typeid);
89}
90
91
92/*
93 * Actions
94 */
95
96$parameters = array('id'=>$id, 'objcanvas'=>$objcanvas);
97$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
98if ($reshook < 0) {
99 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
100}
101
102if (empty($reshook)) {
103 // Cancel
104 if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
105 header("Location: ".$backtopage);
106 exit;
107 }
108
109 // Purge search criteria
110 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
111 $actioncode = '';
112 $search_rowid = '';
113 $search_agenda_label = '';
114 }
115}
116
117
118
119/*
120 * View
121 */
122
123$contactstatic = new Contact($db);
124
125$form = new Form($db);
126
127
128if ($object->id > 0) {
129 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
130 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
131
132 $langs->load("companies");
133
134 $title = $langs->trans("Member")." - ".$langs->trans("Agenda");
135
136 $help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
137
138 llxHeader("", $title, $help_url);
139
140 if (isModEnabled('notification')) {
141 $langs->load("mails");
142 }
143 $head = member_prepare_head($object);
144
145 print dol_get_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
146
147 $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
148
149 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
150 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
151 $morehtmlref .= '</a>';
152
153 dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
154
155 print '<div class="fichecenter">';
156
157 print '<div class="underbanner clearboth"></div>';
158
159 $object->info($id);
160 dol_print_object_info($object, 1);
161
162 print '</div>';
163
164 print dol_get_fiche_end();
165
166
167 //print '<div class="tabsAction">';
168 //print '</div>';
169
170
171 $newcardbutton = '';
172 if (isModEnabled('agenda')) {
173 $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id);
174 }
175
176 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
177 print '<br>';
178
179 $param = '&id='.$id;
180 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
181 $param .= '&contextpage='.$contextpage;
182 }
183 if ($limit > 0 && $limit != $conf->liste_limit) {
184 $param .= '&limit='.$limit;
185 }
186
187 print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
188
189 // List of all actions
190 $filters = array();
191 $filters['search_agenda_label'] = $search_agenda_label;
192 $filters['search_rowid'] = $search_rowid;
193
194 // TODO Replace this with same code than into list.php
195 show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
196 }
197}
198
199// End of page
200llxFooter();
201$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage members of a foundation.
Class to manage members type.
Class to manage generation of HTML components Only common components must be here.
show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
Show html area with actions (done or not, ignore the name of function).
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
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.
Contact()
Old copy.
Definition index.php:572