" . ui_toggle_container($togge,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']) . "
";
+ } else {
+ $return[$key] .= "" . ui_toggle_container($togge,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']) . "
";
+ }
+ } else {
+ if ($folder['parent'] === '0'){
+ $return[$key] = "";
+ } else {
+ $return[$key] = "
";
+ }
+ $return[$key] .= ui_toggle_container($table,$folderName, '', true, true, $folder['id_group'], $folder['id_container'],$folder['parent']);
+ $return[$key] .= "
";
+ }
+ }
+ $retorno = implode("", $return);
+ return $retorno;
+}
+
+function folder_table ($graphs){
+ global $config;
+ $report_r = check_acl ($config['id_user'], 0, "RR");
+ $report_w = check_acl ($config['id_user'], 0, "RW");
+ $report_m = check_acl ($config['id_user'], 0, "RM");
+ $access = ($report_r == true) ? 'RR' : (($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RR'));
+
+ $table = new stdClass();
+ $table->width = '100%';
+ $table->class = 'databox data';
+ $table->align = array ();
+ $table->head = array ();
+ $table->head[0] = __('Graph name');
+ $table->head[1] = __('Description');
+ $table->head[2] = __('Number of Graphs');
+ $table->head[3] = __('Group');
+ $table->size[0] = '30%';
+ $table->size[2] = '200px';
+ $table->size[3] = '200px';
+ $table->align[2] = 'left';
+ $table->align[3] = 'left';
+ if ($report_w || $report_m) {
+ $table->align[4] = 'left';
+ $table->head[4] = __('Op.') .
+ html_print_checkbox('all_delete', 0, false, true, false,
+ 'check_all_checkboxes();');
+ $table->size[4] = '90px';
+ }
+ $table->data = array ();
+
+ // $result_graphs = array_slice($graphs, $offset, $config['block_size']);
+
+ foreach ($graphs as $graph) {
+ $data = array ();
+
+ $data[0] = '
' . ui_print_truncate_text($graph['name'], 70) . '';
+
+ $data[1] = ui_print_truncate_text($graph["description"], 70);
+
+ $data[2] = $graph["graphs_count"];
+ $data[3] = ui_print_group_icon($graph['id_group'],true);
+
+ if (($report_w || $report_m) && users_can_manage_group_all($access)) {
+ $data[4] = '
'.html_print_image("images/config.png", true).'';
+
+ $data[4] .= ' ';
+
+ $data[4] .= '
' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '' .
+ html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
+ }
+
+ array_push ($table->data, $data);
+ }
+ return $table;
+}
+
+function folder_get_all_child_container($parent) {
+
+ $child_folders = db_get_all_rows_filter('tcontainer',
+ array('parent' => $parent));
+
+ return $child_folders;
+}
+
+/**
+* Get parent id
+*/
+function folder_get_parent_id($child) {
+
+ $child_folders = db_get_all_rows_filter('tcontainer',
+ array('id_container' => $child));
+
+ return $child_folders[0]['parent'];
+}
+
+/**
+* Get all si
+*/
+function folder_get_sibling($sibling) {
+
+ $parent_folders = db_get_all_rows_filter('tcontainer',
+ array('id_container' => $sibling));
+
+ $sibling_folders = db_get_all_rows_filter('tcontainer',
+ array('parent' => $parent_folders[0]['parent']));
+
+ return $sibling_folders;
+}
+
+function ui_toggle_container($code, $name, $title = '', $hidden_default = true, $return = false, $group , $id_container, $parent = false) {
+ // Generate unique Id
+ $uniqid = uniqid('');
+
+ // Options
+ if ($hidden_default) {
+ $style = 'display:none';
+ $image_a = html_print_image("images/down.png", true, false, true);
+ $image_b = html_print_image("images/go.png", true, false, true);
+ $original = "images/go.png";
+ }
+ else {
+ $style = '';
+ $image_a = html_print_image("images/down.png", true, false, true);
+ $image_b = html_print_image("images/go.png", true, false, true);
+ $original = "images/down.png";
+ }
+
+ // Link to toggle
+ $table = new stdClass();
+ $table->id = 'container_table';
+ $table->width = '100%';
+ $table->cellspacing = 4;
+ $table->cellpadding = 4;
+ $table->class = 'dat';
+
+
+ if(!$parent){
+ $table->styleTable = 'font-weight: bold;background: #f2f2f2;border: 1px solid #e2e2e2;margin-bottom: 4px';
+ } else {
+ $table->styleTable = 'font-weight: bold;margin-bottom: 4px;border-bottom: 1px solid #dcdcdc;';
+ }
+
+ $table->style[0] = 'width: 30%';
+ $table->style[1] = 'width: 30%';
+
+ if(!$parent){
+ $table->style[0] = 'width: 30%';
+ $table->style[1] = 'width: 30%';
+ if ($id_container === '1'){
+ $table->style[2] = 'padding-right: 34px';
+ }
+ $table->align[1] = 'center';
+ $table->align[2] = 'center';
+
+
+ } else {
+
+ $id = folder_get_parent_id($id_container);
+ $i = 0;
+ while($id !== '0'){
+ $id = folder_get_parent_id($id);
+ $i++;
+ }
+
+ $padding_group = 28 * $i;
+ $padding_icon = 10 * $i;
+
+ $table->style[0] = 'width: 30%';
+ $table->style[1] = 'width: 30%;padding-right: '.$padding_group.'px';
+ $table->style[2] = 'padding-right: '.$padding_icon.'px';
+ $table->align[1] = 'center';
+ $table->align[2] = 'center';
+ }
+
+ $table->data = array();
+
+ $data = array();
+ $data[0] = '
' . html_print_image ($original, true, array ("title" => $title, "id" => "image_".$uniqid)) . ' '.$name.'';
+ $data[1] = ui_print_group_icon($group,true);
+ $data[2] = '
'.html_print_image("images/config.png", true).'';
+ if ($id_container !== '1'){
+ $data[2] .= '  ' .'
' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '';
+ }
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $output .= html_print_table($table, true);
+
+ // Code into a div
+ $output .= "
\n";
+ $output .= html_print_input_hidden($uniqid, $id_container);
+ $output .= $code;
+ $output .= "
";
+
+ // JQuery Toggle
+ $output .= '';
+
+ if (!$return) {
+ echo $output;
+ }
+ else {
+ return $output;
+ }
+}
+
+
+?>
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 11ad895262..d868f68f48 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -700,12 +700,17 @@ function html_print_extended_select_for_post_process($name, $selected = '',
function html_print_extended_select_for_time ($name, $selected = '',
$script = '', $nothing = '', $nothing_value = '0', $size = false,
$return = false, $select_style = false, $unique_name = true, $class='',
- $readonly = false) {
+ $readonly = false, $custom_fields = false,$style_icon = '') {
global $config;
- $fields = get_periods();
-
+ if($custom_fields){
+ $fields = $custom_fields;
+ } else {
+ $fields = get_periods();
+ }
+
+
if ( ! $selected ) {
foreach( $fields as $t_key => $t_value){
if ( $t_key != -1 ) {
@@ -770,7 +775,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
array('class' => $uniq_name . '_toggler',
'alt' => __('Custom'),
'title' => __('Custom'),
- 'style' => 'width: 18px;'), false, false, true) .
+ 'style' => 'width: 18px;'.$style_icon), false, false, true) .
'';
echo '
';
@@ -784,7 +789,7 @@ function html_print_extended_select_for_time ($name, $selected = '',
html_print_image('images/default_list.png', true,
array('class' => $uniq_name . '_toggler',
'alt' => __('List'),
- 'title' => __('List'), 'style' => 'width: 18px;')) .
+ 'title' => __('List'), 'style' => 'width: 18px;'.$style_icon)) .
'';
echo '';
echo "