2010-04-29 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_ui.php: added the function "printTruncateText" for
	facilitate trunc texts, and add the eye candy the tooltip.

	* godmode/reporting/reporting_builder.list_items.php: used the new function
	"printTruncateText".



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2640 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-04-29 15:39:19 +00:00
parent d243ac9403
commit fe0fa1cb07
3 changed files with 39 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2010-04-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: added the function "printTruncateText" for
facilitate trunc texts, and add the eye candy the tooltip.
* godmode/reporting/reporting_builder.list_items.php: used the new function
"printTruncateText".
2010-04-29 Ramon Novoa <rnovoa@artica.es>
* include/functions_reporting.php: Added TTO, TTR, MTBF and MTTR

View File

@ -215,12 +215,7 @@ foreach ($items as $item) {
$row[5] = '-';
}
else {
if (strlen($item['description']) > 25) {
$row[5] = substr($item['description'], 0, 25) . '&hellip;' . '<a href="#" class="tip">&nbsp;<span>' . $item['description'] . '</span></a>';
}
else {
$row[5] = substr($item['description'], 0, 25);
}
$row[5] = printTruncateText($item['description'], 25, true, true);
}
// if ($item['id_gs'] == null) {

View File

@ -19,6 +19,36 @@
* @subpackage UI
*/
/**
* Truncate a text to num chars (pass as parameter) and if flag show tooltip is
* true the html artifal to show the tooltip with rest of text.
*
* @param string $text The text to truncate.
* @param integer $numChars Number chars (-1 for char "...") max the text.
* @param boolean $showTextInAToopTip Flag to show the tooltip.
* @param boolean $return Flag to return as string or not.
*/
function printTruncateText($text, $numChars = 25, $showTextInAToopTip = true, $return = true) {
if (strlen($text) > ($numChars - 1)) {
if ($showTextInAToopTip) {
$truncateText = substr($text, 0, ($numChars - 1)) . '&hellip;' . '<a href="#" class="tip">&nbsp;<span>' . $text . '</span></a>';
}
else {
$truncateText = substr($text, 0, ($numChars - 1)) . '&hellip;';
}
}
else {
$truncateText = $text;
}
if ($return == true) {
return $truncateText;
}
else {
echo $truncateText;
}
}
/**
* Prints a generic message between tags.
*