dolibarr  7.0.0-beta
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@capnetworks.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 <http://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 $langs->load("members");
37 $langs->load("companies");
38 $langs->load('other');
39 
40 $id=GETPOST('id','int');
41 $action=GETPOST('action','alpha');
42 $confirm=GETPOST('confirm','alpha');
43 
44 // Security check
45 $result=restrictedArea($user,'adherent',$id);
46 
47 // Get parameters
48 $sortfield = GETPOST("sortfield",'alpha');
49 $sortorder = GETPOST("sortorder",'alpha');
50 $page = GETPOST("page",'int');
51 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
52 $offset = $conf->liste_limit * $page ;
53 $pageprev = $page - 1;
54 $pagenext = $page + 1;
55 if (! $sortorder) $sortorder="ASC";
56 if (! $sortfield) $sortfield="name";
57 
58 
59 $form = new Form($db);
60 $object=new Adherent($db);
61 $membert=new AdherentType($db);
62 $result=$object->fetch($id);
63 if ($result < 0)
64 {
65  dol_print_error($db);
66  exit;
67 }
68 $upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
69 
70 
71 /*
72  * Actions
73  */
74 
75 include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
76 
77 
78 /*
79  * View
80  */
81 
82 $form = new Form($db);
83 
84 $title=$langs->trans("Member") . " - " . $langs->trans("Documents");
85 $helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
86 llxHeader("",$title,$helpurl);
87 
88 if ($id > 0)
89 {
90  $result=$membert->fetch($object->typeid);
91  if ($result > 0)
92  {
93 
94  // Construit liste des fichiers
95  $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
96  $totalsize=0;
97  foreach($filearray as $key => $file)
98  {
99  $totalsize+=$file['size'];
100  }
101 
102  if (! empty($conf->notification->enabled))
103  $langs->load("mails");
104 
105  $head = member_prepare_head($object);
106 
107  dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
108 
109  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
110 
111  dol_banner_tab($object, 'rowid', $linkback);
112 
113  print '<div class="fichecenter">';
114 
115  print '<div class="underbanner clearboth"></div>';
116  print '<table class="border centpercent">';
117 
118  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
119 
120  // Login
121  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
122  {
123  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
124  }
125 
126  // Type
127  print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
128 
129  // Morphy
130  print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
131  /*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
132  print $form->showphoto('memberphoto',$object);
133  print '</td>';*/
134  print '</tr>';
135 
136  // Company
137  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
138 
139  // Civility
140  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
141  print '</tr>';
142 
143  // Nbre fichiers
144  print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
145 
146  //Total taille
147  print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
148 
149  print '</table>';
150 
151  print '</div>';
152 
153  dol_fiche_end();
154 
155  $modulepart = 'member';
156  $permission = $user->rights->adherent->creer;
157  $permtoedit = $user->rights->adherent->creer;
158  $param = '&id=' . $object->id;
159  include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
160  print "<br><br>";
161  }
162  else
163  {
164  dol_print_error($db);
165  }
166 }
167 else
168 {
169  $langs->load("errors");
170  print $langs->trans("ErrorRecordNotFound");
171 }
172 
173 
174 llxFooter();
175 $db->close();
llxHeader()
Header empty.
Definition: document.php:70
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
Return a path to have a the directory according to object where files are stored. ...
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.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
if(empty($reshook)) $form
View.
Definition: perms.php:103
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="")
Scan a directory and return a list of files/directories.
Definition: files.lib.php:58
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage members of a foundation.
Class to manage members type.
print
Draft customers invoices.
Definition: index.php:91
llxFooter()
Footer empty.
Definition: document.php:76
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.