Merge pull request #23084 from lamrani002/kanbanUserGroup
NEW|New Add Kanban mode for listing of userGroup
This commit is contained in:
commit
c6d5ea15a5
@ -917,4 +917,32 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
$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 .= '</span>';
|
||||||
|
$return .= '<div class="info-box-content">';
|
||||||
|
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
|
||||||
|
if (property_exists($this, 'members')) {
|
||||||
|
$return .= '<br><span class="info-box-status opacitymedium">'.(!empty($this->members)? $this->members : 0).' '.$langs->trans('Users').'</span>';
|
||||||
|
}
|
||||||
|
if (property_exists($this, 'nb_rights')) {
|
||||||
|
$return .= '<br><div class="info-box-status margintoponly opacitymedium">'.$langs->trans('NbOfPermissions').' : '.$this->nb_rights.'</div>';
|
||||||
|
}
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
$return .= '</div>';
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,8 @@ $search_group = GETPOST('search_group');
|
|||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||||
$contextpage = GETPOST('optioncss', 'aZ09');
|
$contextpage = GETPOST('optioncss', 'aZ09');
|
||||||
|
$mode = GETPOST('mode', 'aZ');
|
||||||
|
|
||||||
|
|
||||||
// Defini si peux lire/modifier utilisateurs et permisssions
|
// Defini si peux lire/modifier utilisateurs et permisssions
|
||||||
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
|
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
|
||||||
@ -152,6 +154,10 @@ if ($resql) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$param = "&search_group=".urlencode($search_group)."&sall=".urlencode($sall);
|
$param = "&search_group=".urlencode($search_group)."&sall=".urlencode($sall);
|
||||||
|
if (!empty($mode)) {
|
||||||
|
$param .= '&mode='.urlencode($mode);
|
||||||
|
}
|
||||||
|
|
||||||
if ($optioncss != '') {
|
if ($optioncss != '') {
|
||||||
$param .= '&optioncss='.$optioncss;
|
$param .= '&optioncss='.$optioncss;
|
||||||
}
|
}
|
||||||
@ -159,6 +165,9 @@ if ($resql) {
|
|||||||
$text = $langs->trans("UserGroups");
|
$text = $langs->trans("UserGroups");
|
||||||
|
|
||||||
$newcardbutton = '';
|
$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'));
|
||||||
|
|
||||||
if ($caneditperms) {
|
if ($caneditperms) {
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
|
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
|
||||||
}
|
}
|
||||||
@ -172,6 +181,8 @@ if ($resql) {
|
|||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
|
||||||
|
|
||||||
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
@ -205,13 +216,29 @@ if ($resql) {
|
|||||||
|
|
||||||
$grouptemp = new UserGroup($db);
|
$grouptemp = new UserGroup($db);
|
||||||
|
|
||||||
while ($i < $num) {
|
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
|
while ($i < $imaxinloop) {
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$grouptemp->setVarsFromFetchObj($obj);
|
||||||
|
|
||||||
$grouptemp->id = $obj->rowid;
|
|
||||||
$grouptemp->name = $obj->name;
|
$grouptemp->name = $obj->name;
|
||||||
$grouptemp->note = $obj->note;
|
$grouptemp->note = $obj->note;
|
||||||
|
$grouptemp->members = $obj->nb;
|
||||||
|
$grouptemp->nb_rights = $obj->nbpermissions;
|
||||||
|
|
||||||
|
if ($mode == 'kanban') {
|
||||||
|
if ($i == 0) {
|
||||||
|
print '<tr><td colspan=5>';
|
||||||
|
print '<div class="box-flex-container">';
|
||||||
|
}
|
||||||
|
// Output Kanban
|
||||||
|
print $grouptemp->getKanbanView('');
|
||||||
|
if ($i == ($imaxinloop - 1)) {
|
||||||
|
print '</div>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $grouptemp->getNomUrl(1);
|
print $grouptemp->getNomUrl(1);
|
||||||
@ -232,6 +259,7 @@ if ($resql) {
|
|||||||
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem), "dayhour").'</td>';
|
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem), "dayhour").'</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user