KanbanView for list of taskActivity

This commit is contained in:
Lamrani Abdel 2023-01-09 16:56:55 +01:00
parent aea48e87de
commit 1c997eaabd
2 changed files with 47 additions and 1 deletions

View File

@ -2327,4 +2327,39 @@ class Task extends CommonObjectLine
return ($datetouse > 0 && ($datetouse < ($now - $conf->project->task->warning_delay)));
}
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs, $conf;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
if (property_exists($this, 'fk_project') ) {
$return .= '<br><span class="info-box-status ">'.$this->fk_project.'</span>';
}
if (property_exists($this, 'budget_amount')) {
$return .= '<br><span class="info-box-label amount">'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
}
if (property_exists($this, 'fk_statut')) {
$return .= '<br><span class="info-box-status ">'.$this->fk_statut.'</span>';
}
if (property_exists($this, 'duration_effective')) {
$return .= '<div class="info-box-label opacitymedium">'.getTaskProgressView($this, false, false).'</div>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
}

View File

@ -580,6 +580,9 @@ llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
@ -697,7 +700,11 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer);
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create', '', $user->rights->projet->creer);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') {
@ -712,6 +719,8 @@ if (!empty($type)) {
print '<input type="hidden" name="type" value="'.$type.'">';
}
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
// Show description of content
$texthelp = '';
@ -1121,6 +1130,8 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container">';
}
// Output Kanban
$object->fk_statut = $projectstatic->getLibStatut(1);
$object->fk_project = $projectstatic->getNomUrl(1, 'task');
print $object->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';