2009-10-06 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php: add new function for add extend widget
	"print_extended_select_for_time", that write a two html control a
	select and textbox and scripting for interconet twice components and
	when change the textbox and save add the value in select and when
	change the selected put in textbox.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2002 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-10-06 18:50:48 +00:00
parent 79376ea722
commit 35cbb6d88c
2 changed files with 45 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2009-10-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: add new function for add extend widget
"print_extended_select_for_time", that write a two html control a
select and textbox and scripting for interconet twice components and
when change the textbox and save add the value in select and when
change the selected put in textbox.
2009-10-05 Sancho Lerena <slerena@artica.es>
* include/fgraph.php: Solved ticks in X label for boolean graphs.

View File

@ -259,6 +259,43 @@ function print_select_from_sql ($sql, $name, $selected = '', $script = '', $noth
return print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, $return, $multiple, $sort,'',$disabled);
}
/**
* Render a pair of select for times and text box for set the time more fine.
*
* @param array Array with dropdown values. Example: $fields["value"] = "label"
* @param string Select form name
* @param variant Current selected value. Can be a single value or an
* array of selected values (in combination with multiple)
* @param string Javascript onChange (select) code.
* @param string Label when nothing is selected.
* @param variant Value when nothing is selected
* @param integer $size Size of the input.
* @param bool Whether to return an output string or echo now (optional, echo by default).
*
* @return string HTML code if return parameter is true.
*/
function print_extended_select_for_time ($fields, $name, $selected = '', $script = '', $nothing = '',
$nothing_value = '0', $size = false, $return = false) {
if (($selected !== false) && (!isset($fields[$selected]))) {
$fields[$selected] = human_time_description_raw($selected,true);
}
ob_start();
print_select ($fields, $name . '_select', $selected,"javascript: $('#text-" . $name . "').val($('#" . $name . "_select').val());" . $script,
$nothing, $nothing_value, false, false, false);
print_input_text ($name, $selected, '', $size);
$returnString = ob_get_clean();
if ($return)
return $returnString;
else
echo $returnString;
}
/**
* Render an input text element. Extended version, use print_input_text() to simplify.
*