Dolibarrization
This commit is contained in:
parent
d072d4c656
commit
735309b010
@ -651,7 +651,7 @@ print $hookmanager->resPrint;
|
|||||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||||
}
|
}
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++; // For the column action
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,33 +32,45 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
|||||||
// Load translation files required by page
|
// Load translation files required by page
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||||
$search_group = GETPOST('search_group');
|
|
||||||
$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');
|
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||||
$mode = GETPOST('mode', 'aZ');
|
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||||
|
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||||
|
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||||
|
$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'); // Go back to a dedicated page
|
||||||
|
$optioncss = GETPOST('optioncss', 'aZ09'); // Option for the css output (always '' except when 'print')
|
||||||
|
$mode = GETPOST('mode', 'aZ');
|
||||||
|
|
||||||
|
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||||
// Defini si peux lire/modifier utilisateurs et permisssions
|
$search_group = GETPOST('search_group');
|
||||||
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
|
|
||||||
// Advanced permissions
|
|
||||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
|
||||||
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) {
|
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||||
|
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||||
$page = 0;
|
$page = 0;
|
||||||
}
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
// Initialize technical objects
|
||||||
|
$object = new UserGroup($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
|
||||||
|
//$hookmanager->initHooks(array('myobjectlist')); // Note that conf->hooks_modules contains array
|
||||||
|
|
||||||
|
// Fetch optionals attributes and labels
|
||||||
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
|
||||||
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
if (!$sortfield) {
|
if (!$sortfield) {
|
||||||
$sortfield = "g.nom";
|
$sortfield = "g.nom";
|
||||||
}
|
}
|
||||||
@ -87,20 +99,28 @@ if (!$user->hasRight("user", "user", "read") && !$user->admin) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Defini si peux lire/modifier utilisateurs et permisssions
|
||||||
|
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
|
||||||
|
// Advanced permissions
|
||||||
|
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||||
|
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) {
|
if (GETPOST('cancel', 'alpha')) {
|
||||||
$action = 'list'; $massaction = '';
|
$action = 'list';
|
||||||
|
$massaction = '';
|
||||||
}
|
}
|
||||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||||
$massaction = '';
|
$massaction = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -110,22 +130,33 @@ if (empty($reshook)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||||
$search_label = "";
|
foreach ($object->fields as $key => $val) {
|
||||||
$search_date_creation = "";
|
$search[$key] = '';
|
||||||
$search_date_update = "";
|
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||||
|
$search[$key.'_dtstart'] = '';
|
||||||
|
$search[$key.'_dtend'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$toselect = array();
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
}
|
}
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||||
|
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||||
|
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
$title = $langs->trans("UserGroups");
|
|
||||||
$help_url="";
|
$help_url="";
|
||||||
llxHeader('', $title, $help_url);
|
$title = $langs->trans("UserGroups");
|
||||||
|
$morejs = array();
|
||||||
|
$morecss = array();
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
|
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
|
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
|
||||||
@ -139,139 +170,231 @@ if (isModEnabled('multicompany') && $conf->entity == 1 && (getDolGlobalInt('MULT
|
|||||||
if (!empty($search_group)) {
|
if (!empty($search_group)) {
|
||||||
natural_search(array("g.nom", "g.note"), $search_group);
|
natural_search(array("g.nom", "g.note"), $search_group);
|
||||||
}
|
}
|
||||||
if ($sall) {
|
if ($search_all) {
|
||||||
$sql .= natural_search(array("g.nom", "g.note"), $sall);
|
$sql .= natural_search(array("g.nom", "g.note"), $search_all);
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
|
$sql .= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
|
||||||
|
|
||||||
|
// Complete request and execute it with limit
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if (!$resql) {
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
$nbtotalofrecords = $num;
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$param = "&search_group=".urlencode($search_group)."&sall=".urlencode($sall);
|
|
||||||
if (!empty($mode)) {
|
|
||||||
$param .= '&mode='.urlencode($mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($optioncss != '') {
|
|
||||||
$param .= '&optioncss='.$optioncss;
|
|
||||||
}
|
|
||||||
|
|
||||||
$text = $langs->trans("UserGroups");
|
|
||||||
|
|
||||||
$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) {
|
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
||||||
if ($optioncss != '') {
|
|
||||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
||||||
}
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
||||||
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);
|
|
||||||
|
|
||||||
if ($sall) {
|
|
||||||
foreach ($fieldstosearchall as $key => $val) {
|
|
||||||
$fieldstosearchall[$key] = $langs->trans($val);
|
|
||||||
}
|
|
||||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$moreforfilter = '';
|
|
||||||
|
|
||||||
//$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
|
||||||
//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
|
||||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
|
|
||||||
//multicompany
|
|
||||||
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
|
||||||
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
|
|
||||||
}
|
|
||||||
print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("", $_SERVER["PHP_SELF"]);
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$grouptemp = new UserGroup($db);
|
|
||||||
|
|
||||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
|
||||||
|
|
||||||
while ($i < $imaxinloop) {
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
$grouptemp->setVarsFromFetchObj($obj);
|
|
||||||
|
|
||||||
$grouptemp->name = $obj->name;
|
|
||||||
$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 '<td>';
|
|
||||||
print $grouptemp->getNomUrl(1);
|
|
||||||
if (isModEnabled('multicompany') && !$obj->entity) {
|
|
||||||
print img_picto($langs->trans("GlobalGroup"), 'redstar');
|
|
||||||
}
|
|
||||||
print "</td>";
|
|
||||||
//multicompany
|
|
||||||
if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
|
||||||
$mc->getInfo($obj->entity);
|
|
||||||
print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
|
|
||||||
}
|
|
||||||
print '<td class="center">'.$obj->nb.'</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.$obj->nbpermissions.'</a>';
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
|
|
||||||
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem), "dayhour").'</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
|
||||||
|
$nbtotalofrecords = $num;
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Output page
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
|
||||||
|
|
||||||
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
|
$param = "&search_group=".urlencode($search_group)."&search_all=".urlencode($search_all);
|
||||||
|
if (!empty($mode)) {
|
||||||
|
$param .= '&mode='.urlencode($mode);
|
||||||
|
}
|
||||||
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
|
$param .= '&contextpage='.urlencode($contextpage);
|
||||||
|
}
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
|
foreach ($search as $key => $val) {
|
||||||
|
if (is_array($search[$key])) {
|
||||||
|
foreach ($search[$key] as $skey) {
|
||||||
|
if ($skey != '') {
|
||||||
|
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
|
||||||
|
$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
|
||||||
|
$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
|
||||||
|
$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
|
||||||
|
} elseif ($search[$key] != '') {
|
||||||
|
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($optioncss != '') {
|
||||||
|
$param .= '&optioncss='.urlencode($optioncss);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
|
if ($optioncss != '') {
|
||||||
|
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
|
}
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
|
print '<input type="hidden" name="action" value="list">';
|
||||||
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
|
|
||||||
|
$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) {
|
||||||
|
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
|
if ($search_all) {
|
||||||
|
$setupstring = '';
|
||||||
|
foreach ($fieldstosearchall as $key => $val) {
|
||||||
|
$fieldstosearchall[$key] = $langs->trans($val);
|
||||||
|
$setupstring .= $key."=".$val.";";
|
||||||
|
}
|
||||||
|
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||||
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$moreforfilter = '';
|
||||||
|
|
||||||
|
//$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
|
//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||||
|
|
||||||
|
// Fields title search
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// Fields title label
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||||
|
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||||
|
}
|
||||||
|
print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
//multicompany
|
||||||
|
if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||||
|
print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], "g.entity", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
print_liste_field_titre("NbOfUsers", $_SERVER["PHP_SELF"], "nb", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
print_liste_field_titre("NbOfPermissions", $_SERVER["PHP_SELF"], "nbpermissions", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center ');
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
print_liste_field_titre("", $_SERVER["PHP_SELF"]);
|
||||||
|
$totalarray['nbfield']++; // For the column action
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$savnbfield = $totalarray['nbfield'];
|
||||||
|
$totalarray = array();
|
||||||
|
$totalarray['nbfield'] = 0;
|
||||||
|
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||||
|
while ($i < $imaxinloop) {
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if (empty($obj)) {
|
||||||
|
break; // Should not happen
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store properties in $object
|
||||||
|
$object->setVarsFromFetchObj($obj);
|
||||||
|
|
||||||
|
$object->name = $obj->name;
|
||||||
|
$object->note = $obj->note;
|
||||||
|
$object->members = $obj->nb;
|
||||||
|
$object->nb_rights = $obj->nbpermissions;
|
||||||
|
|
||||||
|
if ($mode == 'kanban') {
|
||||||
|
if ($i == 0) {
|
||||||
|
print '<tr><td colspan="'.$savnbfield.'">';
|
||||||
|
print '<div class="box-flex-container">';
|
||||||
|
}
|
||||||
|
// Output Kanban
|
||||||
|
print $object->getKanbanView('');
|
||||||
|
if ($i == ($imaxinloop - 1)) {
|
||||||
|
print '</div>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Show here line of result
|
||||||
|
$j = 0;
|
||||||
|
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||||
|
// Action column
|
||||||
|
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||||
|
print '<td class="nowrap center">';
|
||||||
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
$selected = 0;
|
||||||
|
if (in_array($object->id, $arrayofselected)) {
|
||||||
|
$selected = 1;
|
||||||
|
}
|
||||||
|
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $object->getNomUrl(1);
|
||||||
|
if (isModEnabled('multicompany') && !$obj->entity) {
|
||||||
|
print img_picto($langs->trans("GlobalGroup"), 'redstar');
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
//multicompany
|
||||||
|
if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
|
||||||
|
$mc->getInfo($obj->entity);
|
||||||
|
print '<td class="center">'.dol_escape_htmltag($mc->label).'</td>';
|
||||||
|
}
|
||||||
|
print '<td class="center">'.$obj->nb.'</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/user/group/perms.php?id='.$obj->rowid.'">'.$obj->nbpermissions.'</a>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
|
||||||
|
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem), "dayhour").'</td>';
|
||||||
|
// Action column
|
||||||
|
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||||
|
print '<td class="nowrap center">';
|
||||||
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
$selected = 0;
|
||||||
|
if (in_array($object->id, $arrayofselected)) {
|
||||||
|
$selected = 1;
|
||||||
|
}
|
||||||
|
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user