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