26 require
"../main.inc.php";
27 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 $id =
GETPOST(
'id',
'intcomma');
39 $mode =
GETPOST(
'mode',
'alpha');
40 $mine = ($mode ==
'mine' ? 1 : 0);
45 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
46 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object,
'fetchComments') && empty($object->comments)) $object->fetchComments();
54 $langs->loadlangs(array(
'users',
'projects'));
68 $form =
new Form($db);
70 $userstatic =
new User($db);
71 $companystatic =
new Societe($db);
72 $contactstatic =
new Contact($db);
73 $task =
new Task($db);
75 $arrayofcss = array(
'/includes/jsgantt/jsgantt.css');
77 if (!empty($conf->use_javascript_ajax))
80 '/includes/jsgantt/jsgantt.js',
81 '/projet/jsgantt_language.js.php?lang='.$langs->defaultlang
86 $title = $langs->trans(
"Gantt");
87 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = ($object->ref ? $object->ref.
' '.$object->name.
' - ' :
'').$langs->trans(
"Gantt");
88 $help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
89 llxHeader(
"", $title, $help_url,
'', 0, 0, $arrayofjs, $arrayofcss);
91 if (($id > 0 && is_numeric($id)) || !empty($ref))
95 $userWrite = $object->restrictedProjectArea($user,
'write');
102 print dol_get_fiche_head($head, $tab, $langs->trans(
"Project"), -1, ($object->public ?
'projectpub' :
'project'));
104 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
110 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
112 $morehtmlref =
'<div class="refidno">';
114 $morehtmlref .= $object->title;
116 if ($object->thirdparty->id > 0)
118 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'project');
120 $morehtmlref .=
'</div>';
123 if (!$user->rights->projet->all->lire)
125 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
126 $object->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
129 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
132 print '<div class="fichecenter">';
133 print '<div class="fichehalfleft">';
134 print '<div class="underbanner clearboth"></div>';
136 print '<table class="border tableforfield centpercent">';
139 print '<tr><td class="tdtop">';
140 print $langs->trans(
"Usage");
143 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
145 print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
146 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
147 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
150 if (empty($conf->global->PROJECT_HIDE_TASKS))
152 print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_task ?
' checked="checked"' :
'')).
'"> ';
153 $htmltext = $langs->trans(
"ProjectFollowTasks");
154 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
157 if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
159 print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET(
'usage_bill_time') ? (
GETPOST(
'usage_bill_time',
'alpha') !=
'' ?
' checked="checked"' :
'') : ($object->usage_bill_time ?
' checked="checked"' :
'')).
'"> ';
160 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
161 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
167 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
168 if ($object->public)
print $langs->trans(
'SharedProject');
169 else print $langs->trans(
'PrivateProject');
173 print '<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
175 print ($start ? $start :
'?');
178 print ($end ? $end :
'?');
183 print '<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
184 if (strcmp($object->budget_amount,
''))
print price($object->budget_amount,
'', $langs, 1, 0, 0, $conf->currency);
189 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
194 print '<div class="fichehalfright">';
195 print '<div class="ficheaddleft">';
196 print '<div class="underbanner clearboth"></div>';
198 print '<table class="border tableforfield centpercent">';
201 print '<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
202 print nl2br($object->description);
206 if ($conf->categorie->enabled) {
207 print '<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
208 print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
218 print '<div class="clearboth"></div>';
226 $linktocreatetaskParam = array();
227 $linktocreatetaskUserRight =
false;
228 if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
229 if ($object->public || $userWrite > 0) {
230 $linktocreatetaskUserRight =
true;
232 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
236 $linktocreatetask =
dolGetButtonTitle($langs->trans(
'AddTask'),
'',
'fa fa-plus-circle paddingleft', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id.
'&action=create'.$param.
'&backtopage='.urlencode(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id),
'', $linktocreatetaskUserRight, $linktocreatetaskParam);
238 $linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-list-alt paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.$object->id,
'', 1, array(
'morecss'=>
'reposition'));
239 $linktotasks .=
dolGetButtonTitle($langs->trans(
'ViewGantt'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/ganttview.php?id='.$object->id.
'&withproject=1',
'', 1, array(
'morecss'=>
'reposition marginleftonly btnTitleSelected'));
248 $tasksarray = $task->getTasksArray(0, 0, ($object->id ? $object->id : $id), $socid, 0);
255 if (count($tasksarray) > 0)
259 $dateformat = $langs->trans(
"FormatDateShortJQuery");
260 $datehourformat = $langs->trans(
"FormatDateShortJQuery").
' '.$langs->trans(
"FormatHourShortJQuery");
261 $array_contacts = array();
263 $task_dependencies = array();
265 foreach ($tasksarray as $key => $val)
267 $task->fetch($val->id,
'');
269 $idparent = ($val->fk_parent ? $val->fk_parent :
'-'.$val->fk_project);
271 $tasks[$taskcursor][
'task_id'] = $val->id;
272 $tasks[$taskcursor][
'task_alternate_id'] = ($taskcursor + 1);
273 $tasks[$taskcursor][
'task_project_id'] = $val->fk_project;
274 $tasks[$taskcursor][
'task_parent'] = $idparent;
276 $tasks[$taskcursor][
'task_is_group'] = 0;
277 $tasks[$taskcursor][
'task_css'] =
'gtaskblue';
278 $tasks[$taskcursor][
'task_position'] = $val->rang;
279 $tasks[$taskcursor][
'task_planned_workload'] = $val->planned_workload;
281 if ($val->fk_parent != 0 && $task->hasChildren() > 0) {
282 $tasks[$taskcursor][
'task_is_group'] = 1;
283 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
285 } elseif ($task->hasChildren() > 0) {
286 $tasks[$taskcursor][
'task_is_group'] = 1;
288 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
291 $tasks[$taskcursor][
'task_milestone'] =
'0';
292 $tasks[$taskcursor][
'task_percent_complete'] = $val->progress;
295 $tasks[$taskcursor][
'task_name'] = $val->ref.
' - '.$val->label;
296 $tasks[$taskcursor][
'task_start_date'] = $val->date_start;
297 $tasks[$taskcursor][
'task_end_date'] = $val->date_end;
298 $tasks[$taskcursor][
'task_color'] =
'b4d1ea';
300 $idofusers = $task->getListContactId(
'internal');
301 $idofcontacts = $task->getListContactId(
'external');
303 if (count($idofusers) > 0)
305 $s .= $langs->trans(
"Internals").
': ';
307 foreach ($idofusers as $valid)
309 $userstatic->fetch($valid);
311 $s .= $userstatic->login;
316 if (count($idofcontacts) > 0)
319 $s .= $langs->trans(
"Externals").
': ';
321 $contactidfound = array();
322 foreach ($idofcontacts as $valid)
324 if (empty($contactidfound[$valid]))
326 $res = $contactstatic->fetch($valid);
330 $s .= $contactstatic->getFullName($langs);
331 $contactidfound[$valid] = 1;
340 $tasks[$taskcursor][
'task_resources'] = $s;
341 if ($s) $tasks[$taskcursor][
'task_resources'] =
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$val->id.
'&withproject=1" title="'.
dol_escape_htmltag($s).
'">'.$langs->trans(
"List").
'</a>';
343 $tasks[$taskcursor][
'note'] = $task->note_public;
348 foreach ($tasks as $tmpkey => $tmptask)
350 foreach ($tasks as $tmptask2)
352 if ($tmptask2[
'task_id'] == $tmptask[
'task_parent'])
354 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tmptask2[
'task_alternate_id'];
358 if (empty($tasks[$tmpkey][
'task_parent_alternate_id'])) $tasks[$tmpkey][
'task_parent_alternate_id'] = $tasks[$tmpkey][
'task_parent'];
363 if (!empty($conf->use_javascript_ajax))
368 $dateformatinput =
'yyyy-mm-dd';
370 $dateformatinput2 =
'standard';
374 $moreforfilter =
'<div class="liste_titre liste_titre_bydiv centpercent">';
376 $moreforfilter .=
'<div class="divsearchfield">';
379 $moreforfilter .=
' ';
380 $moreforfilter .=
'</div>';
382 $moreforfilter .=
'</div>';
384 print $moreforfilter;
386 print '<div class="div-table-responsive">';
388 print '<div id="tabs" class="gantt" style="width: 80vw;">'.
"\n";
389 include_once DOL_DOCUMENT_ROOT.
'/projet/ganttchart.inc.php';
394 $langs->load(
"admin");
395 print $langs->trans(
"AvailableOnlyIfJavascriptAndAjaxNotDisabled");
398 print '<div class="opacitymedium">'.$langs->trans(
"NoTasks").
'</div>';
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.
Class to manage Dolibarr users.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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.
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.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...