dolibarr  13.0.2
info.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require '../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
30 
31 // Load translation files required by the page
32 $langs->load("projects");
33 
34 $id = GETPOST('id', 'int');
35 $ref = GETPOST('ref', 'alpha');
36 $socid = GETPOST('socid', 'int');
37 $action = GETPOST('action', 'aZ09');
38 
39 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
40 $sortfield = GETPOST("sortfield", "aZ09comma");
41 $sortorder = GETPOST("sortorder", 'aZ09comma');
42 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
43 $page = is_numeric($page) ? $page : 0;
44 $page = $page == -1 ? 0 : $page;
45 if (!$sortfield) $sortfield = "a.datep,a.id";
46 if (!$sortorder) $sortorder = "DESC";
47 $offset = $limit * $page;
48 $pageprev = $page - 1;
49 $pagenext = $page + 1;
50 
51 if (GETPOST('actioncode', 'array'))
52 {
53  $actioncode = GETPOST('actioncode', 'array', 3);
54  if (!count($actioncode)) $actioncode = '0';
55 } else {
56  $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));
57 }
58 $search_agenda_label = GETPOST('search_agenda_label');
59 
60 // Security check
61 $id = GETPOST("id", 'int');
62 $socid = 0;
63 //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
64 $result = restrictedArea($user, 'projet', $id, 'projet&project');
65 
66 if (!$user->rights->projet->lire) accessforbidden();
67 
68 
69 
70 /*
71  * Actions
72  */
73 
74 $parameters = array('id'=>$socid);
75 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
76 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
77 
78 // Purge search criteria
79 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
80 {
81  $actioncode = '';
82  $search_agenda_label = '';
83 }
84 
85 
86 
87 /*
88  * View
89  */
90 
91 $form = new Form($db);
92 $object = new Project($db);
93 
94 if ($id > 0 || !empty($ref))
95 {
96  $object->fetch($id, $ref);
97  $object->fetch_thirdparty();
98  if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments();
99  $object->info($object->id);
100 }
101 
102 $title = $langs->trans("Project").' - '.$object->ref.' '.$object->name;
103 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
104 $help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
105 llxHeader("", $title, $help_url);
106 
107 $head = project_prepare_head($object);
108 
109 print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
110 
111 
112 // Project card
113 
114 $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
115 
116 $morehtmlref = '<div class="refidno">';
117 // Title
118 $morehtmlref .= $object->title;
119 // Thirdparty
120 if ($object->thirdparty->id > 0)
121 {
122  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
123 }
124 $morehtmlref .= '</div>';
125 
126 // Define a complementary filter for search of next/prev ref.
127 if (!$user->rights->projet->all->lire)
128 {
129  $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
130  $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
131 }
132 
133 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
134 
135 
136 print '<div class="fichecenter">';
137 print '<div class="underbanner clearboth"></div>';
138 
139 dol_print_object_info($object, 1);
140 
141 print '</div>';
142 
143 print '<div class="clearboth"></div>';
144 
146 
147 
148 // Actions buttons
149 
150 $out = '';
151 $permok = $user->rights->agenda->myactions->create;
152 if ($permok)
153 {
154  $out .= '&projectid='.$object->id;
155 }
156 
157 
158 //print '<div class="tabsAction">';
159 $morehtmlcenter = '';
160 if (!empty($conf->agenda->enabled))
161 {
162  $addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
163  $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
164 }
165 
166 //print '</div>';
167 
168 if (!empty($object->id))
169 {
170  print '<br>';
171 
172  $param = '&id='.$object->id;
173  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
174  if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
175 
176  print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1);
177 
178  // List of all actions
179  $filters = array();
180  $filters['search_agenda_label'] = $search_agenda_label;
181  show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
182 }
183 
184 // End of page
185 llxFooter();
186 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
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).
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
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.
Class to manage projects.
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.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
Definition: project.lib.php:36
print
Draft customers invoices.
Definition: index.php:89
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