28require
"../main.inc.php";
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
48$mode =
GETPOST(
'mode',
'alpha');
49$mine = ($mode ==
'mine' ? 1 : 0);
54include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
55if (
getDolGlobalString(
'PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object,
'fetchComments') && empty(
$object->comments)) {
65$langs->loadlangs(array(
'users',
'projects'));
81$userstatic =
new User($db);
82$companystatic =
new Societe($db);
83$contactstatic =
new Contact($db);
86$arrayofcss = array(
'/includes/jsgantt/jsgantt.css');
88if (!empty(
$conf->use_javascript_ajax)) {
90 '/includes/jsgantt/jsgantt.js',
91 '/projet/jsgantt_language.js.php?lang='.$langs->defaultlang
96$title = $langs->trans(
"Gantt");
100$help_url =
"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
102llxHeader(
"", $title, $help_url,
'', 0, 0, $arrayofjs, $arrayofcss,
'',
'mod-project page-card_ganttview');
106if (($id > 0 && is_numeric($id)) || !empty($ref)) {
109 $userWrite =
$object->restrictedProjectArea($user,
'write');
118 $param = ($mode ==
'mine' ?
'&mode=mine' :
'');
124 if (!empty($_SESSION[
'pageforbacktolist']) && !empty($_SESSION[
'pageforbacktolist'][
'project'])) {
125 $tmpurl = $_SESSION[
'pageforbacktolist'][
'project'];
126 $tmpurl = preg_replace(
'/__SOCID__/', (
string)
$object->socid, $tmpurl);
127 $linkback =
'<a href="'.$tmpurl.(preg_match(
'/\?/', $tmpurl) ?
'&' :
'?').
'restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
129 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
132 $morehtmlref =
'<div class="refidno">';
134 $morehtmlref .=
$object->title;
136 if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
137 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
139 $morehtmlref .=
'</div>';
142 if (!$user->hasRight(
'projet',
'all',
'lire')) {
143 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
144 $object->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
147 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
150 print
'<div class="fichecenter">';
151 print
'<div class="fichehalfleft">';
152 print
'<div class="underbanner clearboth"></div>';
154 print
'<table class="border tableforfield centpercent">';
158 print
'<tr><td class="tdtop">';
159 print $langs->trans(
"Usage");
163 print
'<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET(
'usage_opportunity') ? (
GETPOST(
'usage_opportunity',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_opportunity ?
' checked="checked"' :
'')).
'"> ';
164 $htmltext = $langs->trans(
"ProjectFollowOpportunity");
165 print $form->textwithpicto($langs->trans(
"ProjectFollowOpportunity"), $htmltext);
169 print
'<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET(
'usage_task') ? (
GETPOST(
'usage_task',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_task ?
' checked="checked"' :
'')).
'"> ';
170 $htmltext = $langs->trans(
"ProjectFollowTasks");
171 print $form->textwithpicto($langs->trans(
"ProjectFollowTasks"), $htmltext);
175 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"' :
'')).
'"> ';
176 $htmltext = $langs->trans(
"ProjectBillTimeDescription");
177 print $form->textwithpicto($langs->trans(
"BillTime"), $htmltext);
180 if (isModEnabled(
'eventorganization')) {
181 print
'<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET(
'usage_organize_event') ? (
GETPOST(
'usage_organize_event',
'alpha') !=
'' ?
' checked="checked"' :
'') : (
$object->usage_organize_event ?
' checked="checked"' :
'')).
'"> ';
182 $htmltext = $langs->trans(
"EventOrganizationDescriptionLong");
183 print $form->textwithpicto($langs->trans(
"ManageOrganizeEvent"), $htmltext);
189 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
191 print
img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
192 print $langs->trans(
'SharedProject');
194 print
img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
195 print $langs->trans(
'PrivateProject');
200 print
'<tr><td>'.$langs->trans(
"Budget").
'</td><td>';
201 if (!is_null(
$object->budget_amount) && strcmp(
$object->budget_amount,
'')) {
207 print
'<tr><td>'.$langs->trans(
"DateStart").
' - '.$langs->trans(
"DateEnd").
'</td><td>';
209 print($start ? $start :
'?');
212 print($end ? $end :
'?');
220 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
225 print
'<div class="fichehalfright">';
226 print
'<div class="underbanner clearboth"></div>';
228 print
'<table class="border tableforfield centpercent">';
231 print
'<td class="titlefield tdtop">'.$langs->trans(
"Description").
'</td><td>';
232 print nl2br(
$object->description);
236 if (isModEnabled(
'category')) {
237 print
'<tr><td class="valignmiddle">'.$langs->trans(
"Categories").
'</td><td>';
238 print $form->showCategories(
$object->id, Categorie::TYPE_PROJECT, 1);
247 print
'<div class="clearboth"></div>';
255$linktocreatetaskParam = array();
256$linktocreatetaskUserRight =
false;
257if ($user->hasRight(
'projet',
'all',
'creer') || $user->hasRight(
'projet',
'creer')) {
258 if (
$object->public || $userWrite > 0) {
259 $linktocreatetaskUserRight =
true;
261 $linktocreatetaskParam[
'attr'][
'title'] = $langs->trans(
"NotOwnerOfProject");
265$linktocreatetask =
dolGetButtonTitle($langs->trans(
'AddTask'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/projet/tasks.php?id='.
$object->id.
'&action=create'.$param.
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$object->id),
'', (
int) $linktocreatetaskUserRight, $linktocreatetaskParam);
267$linktotasks =
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/projet/tasks.php?id='.
$object->id,
'', 1, array(
'morecss' =>
'reposition'));
268$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'));
271print
load_fiche_titre($title, $linktotasks.
' '.$linktocreatetask,
'projecttask');
277$tasksarray = $task->getTasksArray(
null,
null, (
$object->id ?
$object->id :
$id), $socid, 0);
284if (count($tasksarray) > 0) {
287 $dateformat = $langs->trans(
"FormatDateShortJQuery");
288 $datehourformat = $langs->trans(
"FormatDateShortJQuery").
' '.$langs->trans(
"FormatHourShortJQuery");
289 $array_contacts = array();
291 $task_dependencies = array();
293 foreach ($tasksarray as $key => $val) {
294 $task->fetch($val->id,
'');
296 $idparent = ($val->fk_task_parent ? $val->fk_task_parent :
'-'.$val->fk_project);
298 $tasks[$taskcursor][
'task_id'] = $val->id;
299 $tasks[$taskcursor][
'task_alternate_id'] = ($taskcursor + 1);
300 $tasks[$taskcursor][
'task_project_id'] = $val->fk_project;
301 $tasks[$taskcursor][
'task_parent'] = $idparent;
303 $tasks[$taskcursor][
'task_is_group'] = 0;
304 $tasks[$taskcursor][
'task_css'] =
'gtaskblue';
305 $tasks[$taskcursor][
'task_position'] = $val->rang;
306 $tasks[$taskcursor][
'task_planned_workload'] = $val->planned_workload;
308 if ($val->fk_task_parent != 0 && $task->hasChildren() > 0) {
309 $tasks[$taskcursor][
'task_is_group'] = 1;
310 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
312 } elseif ($task->hasChildren() > 0) {
313 $tasks[$taskcursor][
'task_is_group'] = 1;
315 $tasks[$taskcursor][
'task_css'] =
'ggroupblack';
318 $tasks[$taskcursor][
'task_milestone'] = 0;
319 $tasks[$taskcursor][
'task_percent_complete'] = $val->progress;
322 $tasks[$taskcursor][
'task_name'] = $val->ref.
' - '.$val->label;
323 $tasks[$taskcursor][
'task_start_date'] = $val->date_start;
324 $tasks[$taskcursor][
'task_end_date'] = $val->date_end;
325 $tasks[$taskcursor][
'task_color'] =
'b4d1ea';
327 $idofusers = $task->getListContactId(
'internal');
328 $idofcontacts = $task->getListContactId(
'external');
330 if (count($idofusers) > 0) {
331 $s .= $langs->trans(
"Internals").
': ';
333 foreach ($idofusers as $valid) {
334 $userstatic->fetch($valid);
338 $s .= $userstatic->login;
343 if (count($idofcontacts) > 0) {
347 $s .= $langs->trans(
"Externals").
': ';
349 $contactidfound = array();
350 foreach ($idofcontacts as $valid) {
351 if (empty($contactidfound[$valid])) {
352 $res = $contactstatic->fetch($valid);
357 $s .= $contactstatic->getFullName($langs);
358 $contactidfound[$valid] = 1;
367 $tasks[$taskcursor][
'task_resources'] = $s;
369 $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(
"Contacts").
'</a>';
372 $tasks[$taskcursor][
'note'] = $task->note_public;
377 foreach ($tasks as $tmpkey => $tmptask) {
378 foreach ($tasks as $tmptask2) {
379 if ($tmptask2[
'task_id'] == $tmptask[
'task_parent']) {
380 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tmptask2[
'task_alternate_id'];
384 if (empty($tasks[$tmpkey][
'task_parent_alternate_id'])) {
385 $tasks[$tmpkey][
'task_parent_alternate_id'] = $tasks[$tmpkey][
'task_parent'];
391 if (!empty(
$conf->use_javascript_ajax)) {
395 $dateformatinput =
'yyyy-mm-dd';
397 $dateformatinput2 =
'standard';
401 $moreforfilter =
'<div class="liste_titre liste_titre_bydiv centpercent">';
403 $moreforfilter .=
'<div class="divsearchfield">';
406 $moreforfilter .=
' ';
407 $moreforfilter .=
'</div>';
409 $moreforfilter .=
'</div>';
411 print $moreforfilter;
413 print
'<div class="div-table-responsive">';
415 print
'<div id="tabs" class="gantt" style="width: 80vw;">'.
"\n";
416 include_once DOL_DOCUMENT_ROOT.
'/projet/ganttchart.inc.php';
421 $langs->load(
"admin");
422 print $langs->trans(
"AvailableOnlyIfJavascriptAndAjaxNotDisabled");
425 print
'<div class="opacitymedium">'.$langs->trans(
"NoTasks").
'</div>';
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of 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.