dolibarr  13.0.2
document.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.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", "other"));
38 
39 
40 $id = GETPOSTISSET('id') ? GETPOST('id', 'int') : GETPOST('rowid', 'int');
41 $ref = GETPOST('ref', 'alphanohtml');
42 $action = GETPOST('action', 'aZ09');
43 $confirm = GETPOST('confirm', 'alpha');
44 
45 // Security check
46 $result = restrictedArea($user, 'adherent', $id);
47 
48 // Get parameters
49 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
50 $sortfield = GETPOST("sortfield", 'alpha');
51 $sortorder = GETPOST("sortorder", 'alpha');
52 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
53 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
54 $offset = $limit * $page;
55 $pageprev = $page - 1;
56 $pagenext = $page + 1;
57 if (!$sortorder) $sortorder = "ASC";
58 if (!$sortfield) $sortfield = "name";
59 
60 
61 $form = new Form($db);
62 $object = new Adherent($db);
63 $membert = new AdherentType($db);
64 $result = $object->fetch($id, $ref);
65 if ($result < 0) {
66  dol_print_error($db);
67  exit;
68 }
69 $upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
70 
71 
72 /*
73  * Actions
74  */
75 
76 include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
77 
78 
79 /*
80  * View
81  */
82 
83 $form = new Form($db);
84 
85 $title = $langs->trans("Member")." - ".$langs->trans("Documents");
86 $helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
87 llxHeader("", $title, $helpurl);
88 
89 if ($id > 0) {
90  $result = $membert->fetch($object->typeid);
91  if ($result > 0) {
92  // Build file list
93  $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
94  $totalsize = 0;
95  foreach ($filearray as $key => $file) {
96  $totalsize += $file['size'];
97  }
98 
99  if (!empty($conf->notification->enabled))
100  $langs->load("mails");
101 
102  $head = member_prepare_head($object);
103 
104  print dol_get_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
105 
106  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
107 
108  dol_banner_tab($object, 'rowid', $linkback);
109 
110  print '<div class="fichecenter">';
111 
112  print '<div class="underbanner clearboth"></div>';
113  print '<table class="border tableforfield centpercent">';
114 
115  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
116 
117  // Login
118  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
119  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
120  }
121 
122  // Type
123  print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
124 
125  // Morphy
126  print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
127  /*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
128  print $form->showphoto('memberphoto',$object);
129  print '</td>';*/
130  print '</tr>';
131 
132  // Company
133  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
134 
135  // Civility
136  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
137  print '</tr>';
138 
139  // Number of Attached Files
140  print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
141 
142  //Total Size Of Attached Files
143  print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
144 
145  print '</table>';
146 
147  print '</div>';
148 
150 
151  $modulepart = 'member';
152  $permission = $user->rights->adherent->creer;
153  $permtoedit = $user->rights->adherent->creer;
154  $param = '&id='.$object->id;
155  include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
156  print "<br><br>";
157  } else {
158  dol_print_error($db);
159  }
160 } else {
161  $langs->load("errors");
162  print $langs->trans("ErrorRecordNotFound");
163 }
164 
165 // End of page
166 llxFooter();
167 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
Class to manage members of a foundation.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:60
Class to manage members type.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59