$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 'static_graph': $values = array(); if ($label !== null) { $values['label'] = $label; } if ($image !== null) { $values['image'] = $image; } if ($left !== null) { $values['pos_x'] = $left; } if ($top !== null) { $values['pos_y'] = $top; } //TODO $agent -> $id_agent $id_agent = 0; //TODO $values['id_agent'] = $id_agent; if ($module !== null) { $values['id_agente_modulo'] = $module; } if ($period !== null) { $values['period'] = $period; } if ($width !== null) { $values['width'] = $width; } if ($height !== null) { $values['height'] = $height; } 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; } 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 'static_graph': $elementFields = get_db_row_filter('tlayout_data', array('id' => $id_element)); echo json_encode($elementFields); break; } break; case 'insert': switch ($type) { case 'static_graph': $values = array(); $values['id_layout'] = $id_visual_console; $values['label'] = $label; $values['image'] = $image; $values['pos_x'] = $left; $values['pos_y'] = $top; $values['label_color'] = $label_color; if ($agent != '') $values['id_agent'] = get_agent_id($agent); else $values['id_agent'] = 0; $values['id_agente_modulo'] = $module; $idData = process_sql_insert('tlayout_data', $values); $return = array(); if ($idData === false) { $return['correct'] = 0; } else { $return['correct'] = 1; $return['id_data'] = $idData; } echo json_encode($return); break; } 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; } ?>