dolibarr  16.0.5
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 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array("companies", "members"));
38 
39 $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
40 
41 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
42 $sortfield = GETPOST('sortfield', 'aZ09comma');
43 $sortorder = GETPOST('sortorder', 'aZ09comma');
44 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
45 if (empty($page) || $page == -1) {
46  $page = 0;
47 } // If $page is not defined, or '' or -1
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
51 if (!$sortfield) {
52  $sortfield = 'a.datep,a.id';
53 }
54 if (!$sortorder) {
55  $sortorder = 'DESC';
56 }
57 
58 if (GETPOST('actioncode', 'array')) {
59  $actioncode = GETPOST('actioncode', 'array', 3);
60  if (!count($actioncode)) {
61  $actioncode = '0';
62  }
63 } else {
64  $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
65 }
66 $search_agenda_label = GETPOST('search_agenda_label');
67 
68 // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
69 $objcanvas = null;
70 
71 // Security check
72 $result = restrictedArea($user, 'adherent', $id);
73 
74 $object = new Adherent($db);
75 $result = $object->fetch($id);
76 if ($result > 0) {
77  $object->fetch_thirdparty();
78 
79  $adht = new AdherentType($db);
80  $result = $adht->fetch($object->typeid);
81 }
82 
83 
84 /*
85  * Actions
86  */
87 
88 $parameters = array('id'=>$id, 'objcanvas'=>$objcanvas);
89 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90 if ($reshook < 0) {
91  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
92 }
93 
94 if (empty($reshook)) {
95  // Cancel
96  if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
97  header("Location: ".$backtopage);
98  exit;
99  }
100 
101  // Purge search criteria
102  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
103  $actioncode = '';
104  $search_agenda_label = '';
105  }
106 }
107 
108 
109 
110 /*
111  * View
112  */
113 
114 $contactstatic = new Contact($db);
115 
116 $form = new Form($db);
117 
118 /*
119  * Customer and/or supplier category sheet
120  */
121 if ($object->id > 0) {
122  require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
123  require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
124 
125  $langs->load("companies");
126 
127  $title = $langs->trans("Member")." - ".$langs->trans("Agenda");
128 
129  $help_url = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder";
130 
131  llxHeader("", $title, $help_url);
132 
133  if (!empty($conf->notification->enabled)) {
134  $langs->load("mails");
135  }
136  $head = member_prepare_head($object);
137 
138  print dol_get_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
139 
140  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
141 
142  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
143  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
144  $morehtmlref .= '</a>';
145 
146  dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
147 
148  print '<div class="fichecenter">';
149 
150  print '<div class="underbanner clearboth"></div>';
151 
152  $object->info($id);
153  dol_print_object_info($object, 1);
154 
155  print '</div>';
156 
157  print dol_get_fiche_end();
158 
159 
160  //print '<div class="tabsAction">';
161  //print '</div>';
162 
163 
164  $newcardbutton = '';
165  if (isModEnabled('agenda')) {
166  $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);
167  }
168 
169  if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
170  print '<br>';
171 
172  $param = '&id='.$id;
173  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
174  $param .= '&contextpage='.$contextpage;
175  }
176  if ($limit > 0 && $limit != $conf->liste_limit) {
177  $param .= '&limit='.$limit;
178  }
179 
180  print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
181 
182  // List of all actions
183  $filters = array();
184  $filters['search_agenda_label'] = $search_agenda_label;
185 
186  // TODO Replace this with same code than into list.php
187  show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
188  }
189 }
190 
191 // End of page
192 llxFooter();
193 $db->close();
AdherentType
Class to manage members type.
Definition: adherent_type.class.php:35
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
member_prepare_head
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
dol_banner_tab
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.
Definition: functions.lib.php:2032
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3866
dolGetButtonTitle
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.
Definition: functions.lib.php:10591
show_actions_done
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).
Definition: company.lib.php:1389
Contact
Class to manage contact/addresses.
Definition: contact.class.php:40
print_barre_liste
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.
Definition: functions.lib.php:5243
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:46
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1808
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2004
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_print_object_info
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
Definition: functions2.lib.php:205
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8123
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59