$id_element)); echo json_encode($layoutData); break; case 'get_module_value': $layoutData = get_db_row_filter('tlayout_data', array('id' => $id_element)); $returnValue = get_db_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']); $return = array(); $return['value'] = $returnValue; $return['max_percentile'] = $layoutData['height']; $return['width_percentile'] = $layoutData['width']; echo json_encode($return); break; case 'get_color_line': $layoutData = get_db_row_filter('tlayout_data', array('id' => $id_element)); $return = array(); $return['color_line'] = getColorLineStatus($layoutData); echo json_encode($return); break; case 'get_image': $layoutData = get_db_row_filter('tlayout_data', array('id' => $id_element)); $return = array(); $return['image'] = getImageStatusElement($layoutData); echo json_encode($return); break; case 'update': switch ($type) { case 'background': $values = array(); if ($background !== null) $values['background'] = $background; if ($width !== null) $values['width'] = $width; if ($height !== null) $values['height'] = $height; process_sql_update('tlayout', $values, array('id' => $id_visual_console)); break; case 'simple_value': case 'percentile_bar': case 'static_graph': case 'module_graph': $values = array(); if ($label !== null) { $values['label'] = $label; } if ($left !== null) { $values['pos_x'] = $left; } if ($top !== null) { $values['pos_y'] = $top; } if ($agent !== null) { $id_agent = get_agent_id($agent); $values['id_agent'] = $id_agent; } if ($id_module !== null) { $values['id_agente_modulo'] = $id_module; } if ($parent !== null) { $values['parent_item'] = $parent; } if ($map_linked !== null) { $values['id_layout_linked'] = $map_linked; } if ($label_color !== null) { $values['label_color'] = $label_color; } switch($type) { case 'module_graph': if ($height_module_graph !== null) { $values['height'] = $height_module_graph; } if ($width_module_graph !== null) { $values['width'] = $width_module_graph; } if ($period !== null) { $values['period'] = $period; } break; case 'percentile_bar': if ($width_percentile !== null) { $values['width'] = $width_percentile; } if ($max_percentile !== null) { $values['height'] = $max_percentile; } break; case 'static_graph': if ($image !== null) { $values['image'] = $image; } if ($width !== null) { $values['width'] = $width; } if ($height !== null) { $values['height'] = $height; } break; } $result = process_sql_update('tlayout_data', $values, array('id' => $id_element)); break; } break; case 'load': switch ($type) { case 'background': $backgroundFields = get_db_row_filter('tlayout', array('id' => $id_visual_console), array('background', 'height', 'width')); echo json_encode($backgroundFields); break; case 'percentile_bar': case 'static_graph': case 'module_graph': case 'simple_value': $elementFields = get_db_row_filter('tlayout_data', array('id' => $id_element)); $elementFields['agent_name'] = get_agent_name($elementFields['id_agent']); //Make the html of select box of modules about id_agent. if ($elementFields['id_agent'] != 0) { $modules = get_agent_modules ($elementFields['id_agent'], false, array('disabled' => 0, 'id_agente' => $elementFields['id_agent'])); $elementFields['modules_html'] = ''; foreach ($modules as $id => $name) { $elementFields['modules_html'] .= ''; } } else { $elementFields['modules_html'] = ''; } switch ($type) { case 'percentile_bar': $elementFields['width_percentile'] = $elementFields['width']; $elementFields['max_percentile'] = $elementFields['height']; break; case 'module_graph': $elementFields['width_module_graph'] = $elementFields['width']; $elementFields['height_module_graph'] = $elementFields['height']; break; } echo json_encode($elementFields); break; } break; case 'insert': $values = array(); $values['id_layout'] = $id_visual_console; $values['label'] = $label; $values['pos_x'] = $left; $values['pos_y'] = $top; if ($agent != '') $values['id_agent'] = get_agent_id($agent); else $values['id_agent'] = 0; $values['id_agente_modulo'] = $id_module; $values['id_layout_linked'] = $map_linked; $values['label_color'] = $label_color; $values['parent_item'] = $parent; $values['no_link_color'] = 1; switch ($type) { case 'module_graph': $values['type'] = MODULE_GRAPH; $values['height'] = $height_module_graph; $values['width'] = $width_module_graph; $values['period'] = $period; break; case 'percentile_bar': $values['type'] = PERCENTILE_BAR; $values['width'] = $width_percentile; $values['height'] = $max_percentile; break; case 'static_graph': $values['type'] = STATIC_GRAPH; $values['image'] = $image; $values['width'] = $width; $values['height'] = $height; break; case 'simple_value': $values['type'] = SIMPLE_VALUE; break; } $idData = process_sql_insert('tlayout_data', $values); $return = array(); if ($idData === false) { $return['correct'] = 0; } else { $return['correct'] = 1; $return['id_data'] = $idData; $return['text'] = $label; } echo json_encode($return); break; case 'delete': if (process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) { $return['correct'] = 0; } else { $return['correct'] = 1; } echo json_encode($return); break; } ?>