2011-02-16 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_visual_map.php: added function "createInternalNameItem"
	and "get_items_parents".
	
	*include/ajax/visual_console_builder.ajax.php, 
	godmode/reporting/visual_console_builder.editor.php: changed the method to
	show items without name in visualmap as parents in the selectbox.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3875 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-02-16 15:37:55 +00:00
parent 94211191ea
commit 94b97d1688
4 changed files with 106 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2011-02-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map.php: added function "createInternalNameItem"
and "get_items_parents".
*include/ajax/visual_console_builder.ajax.php,
godmode/reporting/visual_console_builder.editor.php: changed the method to
show items without name in visualmap as parents in the selectbox.
2011-02-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map.php: fixed the edit to set items with empty

View File

@ -225,7 +225,12 @@ echo '<div id="properties_panel" style="display: none; position: absolute; borde
</tr>
<tr id="parent_row" class="static_graph percentile_bar module_graph simple_value label icon datos">
<td><?php echo __('Parent');?></td>
<td><?php print_select_from_sql('SELECT id, label FROM tlayout_data WHERE id_layout = ' . $visualConsole['id'], 'parent', '', '', __('None'), 0);?></td>
<td>
<?php
$parents = get_items_parents($visualConsole['id']);
print_select($parents, 'parent', '', '', __('None'), 0);
?>
</td>
</tr>
<tr id="map_linked_row" class="static_graph percentile_bar module_graph simple_value label datos">
<td><?php echo __('Map linked');?></td>

View File

@ -259,9 +259,11 @@ switch ($action) {
$return['correct'] = 0;
}
else {
$text = createInternalNameItem($label, $type, $image, $agent, $id_module, $idData);
$return['correct'] = 1;
$return['id_data'] = $idData;
$return['text'] = $label;
$return['text'] = $text;
}
echo json_encode($return);
break;

View File

@ -914,4 +914,92 @@ function get_layout_status ($id_layout = 0, $depth = 0) {
return $temp_total;
}
/**
* Make a text for the parent select, when the label is not empty put this for
* the return text. Instead for the empty labels make the text with next form
* (<Type>) - <name_image> ( <agent_name> - <module_name> ) (<id item>)
*
* @param string $label The label of item in visual map.
* @param string $type The label of type in visual map.
* @param string $image The image of item in visual map.
* @param string $agent The agent name of item in visual map.
* @param string $id_module The module name of item in visual map.
* @param int $idData The id of item in visual map.
*
* @return string The text for the parent.
*/
function createInternalNameItem($label = null, $type, $image, $agent = null, $id_module, $idData) {
$text = '';
if (empty($label))
{
switch ($type) {
case 'module_graph':
case MODULE_GRAPH:
$text = __('Module graph');
break;
case 'percentile_bar':
case PERCENTILE_BAR:
$text = __('Percentile bar');
break;
case 'static_graph':
case STATIC_GRAPH:
$text = __('Static graph') . " - " .
$image;
break;
case 'simple_value':
case SIMPLE_VALUE:
$text = __('Simple Value');
break;
case 'label':
case LABEL:
$text = __('Label');
break;
case 'icon':
case ICON:
$text = __('Icon') . " - " .
$image;
break;
}
if (!empty($agent)) {
$text .= " (" . printTruncateText($agent, 10, false);
$moduleName = get_db_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module);
if (!empty($moduleName)) {
$text .= " - " . printTruncateText($moduleName, 10, false);
}
$text .= ")";
}
$text .= ' (' . $idData . ')';
}
else {
$text = $label;
}
return $text;
}
function get_items_parents($idVisual) {
$items = get_db_all_rows_filter('tlayout_data',array('id_layout' => $idVisual));
if ($items == false) {
$items = array();
}
$return = array();
foreach ($items as $item) {
$agent = null;
if ($item['id_agent'] != 0) {
$agent = get_agent_name($item['id_agent']);
}
$return[$item['id']] = createInternalNameItem($item['label'],
$item['type'], $item['image'], $agent, $item['id_agente_modulo'],
$item['id']);
}
return $return;
}
?>