Merge branch 'ent-4147-file-repository-manager-a-combo-multiselect' into 'develop'

Changed checkboxes for combo multiselect in File repository manager

See merge request artica/pandorafms!2700
This commit is contained in:
Alejandro Fraguas 2019-09-12 11:12:05 +02:00
commit a56d5dcad5
2 changed files with 5 additions and 13 deletions

View File

@ -44,24 +44,16 @@ $groups = groups_get_all();
// Add the All group to the beginning to be always the first // Add the All group to the beginning to be always the first
// Use this instead array_unshift to keep the array keys // Use this instead array_unshift to keep the array keys
$groups = ([0 => __('All')] + $groups); $groups = ([0 => __('All')] + $groups);
$html = ''; $groups_selected = [];
$style = 'style="padding: 2px 10px; display: inline-block;"';
foreach ($groups as $id => $name) { foreach ($groups as $id => $name) {
$checked = in_array($id, $file['groups']); if (in_array($id, $file['groups'])) {
$all_checked = false; $groups_selected[] = $id;
if ($id === 0) {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, false, '', 'class="chkb_all"', true);
$all_checked = $checked;
} else {
$checkbox = html_print_checkbox_extended('groups[]', $id, $checked, $all_checked, '', 'class="chkb_group"', true);
} }
$html .= "<div $style>$name&nbsp;$checkbox</div>";
} }
$row = []; $row = [];
$row[0] = __('Groups'); $row[0] = __('Groups');
$row[1] = $html; $row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', '');
$table->data[] = $row; $table->data[] = $row;
$table->colspan[][1] = 3; $table->colspan[][1] = 3;

View File

@ -193,7 +193,7 @@ function files_repo_add_file($file_input_name='upfile', $description='', $groups
global $config; global $config;
$attachment_path = io_safe_output($config['attachment_store']); $attachment_path = io_safe_output($config['attachment_store']);
$files_repo_path = $attachment_path.'/'.'files_repo'; $files_repo_path = $attachment_path.'/files_repo';
$result = []; $result = [];
$result['status'] = false; $result['status'] = false;