diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4516b132982..25211f11bd9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -927,4 +927,46 @@ class AdherentType extends CommonObject return ''; } + + + /** + * 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 void HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs,$user; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if ($user->rights->adherent->configurer) { + $return .= 'ref.'">'.img_edit().''; + } else { + $return .= ' '; + } + if (property_exists($this, 'vote')) { + $return .= '
'.$langs->trans("VoteAllowed").' : '.yn($this->vote).''; + } + if (property_exists($this, 'amount')) { + if (is_null($this->amount) || $this->amount === '') { + $return .= '
'; + } else { + $return .= '
'.$langs->trans("Amount").''; + $return .= ' : '.price($this->amount).''; + } + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + print $return; + } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 257e7266e5a..6a2dbdb125d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -44,6 +44,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$mode = GETPOST('mode', 'alopha'); $sall = GETPOST("sall", "alpha"); $filter = GETPOST("filter", 'alpha'); @@ -248,6 +249,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode'.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } @@ -256,6 +260,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } $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 ($user->rights->adherent->configurer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -269,6 +276,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -302,32 +311,46 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $membertype->amount = $objp->amount; $membertype->caneditamount = $objp->caneditamount; - print ''; - print ''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''; - print ''.dol_escape_htmltag($objp->label).''; - print ''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + //output kanban + $membertype->label = $objp->label; + $membertype->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; + } } else { - print $langs->trans("MorAndPhy"); + print ''; + print ''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''; + print ''.dol_escape_htmltag($objp->label).''; + print ''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); + } else { + print $langs->trans("MorAndPhy"); + } + print ''; + print ''.yn($objp->subscription).''; + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; + print ''.yn($objp->caneditamount).''; + print ''.yn($objp->vote).''; + print ''.$membertype->getLibStatut(5).''; + if ($user->rights->adherent->configurer) { + print 'rowid.'">'.img_edit().''; + } else { + print ' '; + } + print ""; } - print ''; - print ''.yn($objp->subscription).''; - print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; - print ''.yn($objp->caneditamount).''; - print ''.yn($objp->vote).''; - print ''.$membertype->getLibStatut(5).''; - if ($user->rights->adherent->configurer) { - print 'rowid.'">'.img_edit().''; - } else { - print ' '; - } - print ""; $i++; }