dolibarr  16.0.1
note.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2016 Laurent Destailleur <aldy@users.sourceforge.net>
5  * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
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.'/resource/class/dolresource.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('companies', 'interventions'));
34 
35 $id = GETPOST('id', 'int');
36 $ref = GETPOST('ref', 'alpha');
37 $action = GETPOST('action', 'aZ09');
38 
39 // Security check
40 if ($user->socid) {
41  $socid = $user->socid;
42 }
43 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
44 $hookmanager->initHooks(array('resourcenote'));
45 
46 $object = new DolResource($db);
47 
48 // Load object
49 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
50 
51 $result = restrictedArea($user, 'resource', $object->id, 'resource');
52 
53 $permissionnote = $user->rights->resource->write; // Used by the include of actions_setnotes.inc.php
54 
55 
56 /*
57  * Actions
58  */
59 
60 $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
61 if ($reshook < 0) {
62  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
63 }
64 if (empty($reshook)) {
65  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
66 }
67 
68 
69 /*
70  * View
71  */
72 
73 llxHeader();
74 
75 $form = new Form($db);
76 
77 if ($id > 0 || !empty($ref)) {
78  $head = resource_prepare_head($object);
79  print dol_get_fiche_head($head, 'note', $langs->trans('ResourceSingular'), -1, 'resource');
80 
81  $linkback = '<a href="'.DOL_URL_ROOT.'/resource/list.php'.(!empty($socid) ? '?id='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
82 
83 
84  $morehtmlref = '<div class="refidno">';
85  $morehtmlref .= '</div>';
86 
87 
88  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
89 
90 
91  print '<div class="fichecenter">';
92  print '<div class="underbanner clearboth"></div>';
93 
94  print '<table class="border tableforfield centpercent">';
95 
96  // Resource type
97  print '<tr>';
98  print '<td class="titlefield">'.$langs->trans("ResourceType").'</td>';
99  print '<td>';
100  print $object->type_label;
101  print '</td>';
102  print '</tr>';
103 
104  print "</table>";
105 
106  print '</div>';
107 
108  $permission = $user->rights->resource->write;
109  $cssclass = 'titlefield';
110  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
111 
112  print dol_get_fiche_end();
113 }
114 
115 // End of page
116 llxFooter();
117 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Definition: card.php:142
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
resource_prepare_head($object)
Prepare head for tabs.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
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.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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:73