Moved function display_digest() from user_portal to display.lib.php

skala
ywarnier 14 years ago
parent 4af854dba7
commit bbdf8ea5fe
  1. 73
      main/inc/lib/display.lib.php
  2. 74
      user_portal.php

@ -1064,4 +1064,77 @@ class Display {
}
return $retvalue;
}
/**
* Displays a digest e.g. short summary of new agenda and announcements items.
* This used to be displayed in the right hand menu, but is now
* disabled by default (see config settings in this file) because most people like
* the what's new icons better.
*
* @version 1.0
*/
function display_digest($toolsList, $digest, $orderKey, $courses) {
if (is_array($digest) && (CONFVAL_showExtractInfo == SCRIPTVAL_UnderCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both)) {
// // // LEVEL 1 // // //
reset($digest);
echo "<br /><br />\n";
while (list($key1) = each($digest)) {
if (is_array($digest[$key1])) {
// // // Title of LEVEL 1 // // //
echo "<strong>\n";
if ($orderKey[0] == 'keyTools') {
$tools = $key1;
echo $toolsList[$key1]['name'];
} elseif ($orderKey[0] == 'keyCourse') {
$courseSysCode = $key1;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key1]['coursePath'], "\">", $courses[$key1]['courseCode'], "</a>\n";
} elseif ($orderKey[0] == 'keyTime') {
echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "</strong>\n";
// // // End Of Title of LEVEL 1 // // //
// // // LEVEL 2 // // //
reset($digest[$key1]);
while (list ($key2) = each($digest[$key1])) {
// // // Title of LEVEL 2 // // //
echo "<p>\n", "\n";
if ($orderKey[1] == 'keyTools') {
$tools = $key2;
echo $toolsList[$key2][name];
} elseif ($orderKey[1] == 'keyCourse') {
$courseSysCode = $key2;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key2]['coursePath'], "\">", $courses[$key2]['courseCode'], "</a>\n";
} elseif ($orderKey[1] == 'keyTime') {
echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "\n";
echo "</p>";
// // // End Of Title of LEVEL 2 // // //
// // // LEVEL 3 // // //
reset($digest[$key1][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$key1][$key2])) {
// // // Title of LEVEL 3 // // //
if ($orderKey[2] == 'keyTools') {
$level3title = "<a href=\"".$toolsList[$key3]["path"].$courseSysCode."\">".$toolsList[$key3]['name']."</a>";
} elseif ($orderKey[2] == 'keyCourse') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$key3."\">".$courses[$key3]['courseCode']."</a>\n";
} elseif ($orderKey[2] == 'keyTime') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$courseSysCode."\">".api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get())."</a>";
}
// // // End Of Title of LEVEL 3 // // //
// // // LEVEL 4 (data) // // //
reset($digest[$key1][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$key1][$key2][$key3])) {
echo $level3title, ' &ndash; ', api_substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT);
//adding ... (three dots) if the texts are too large and they are shortened
if (api_strlen($dataFromCourse) >= CONFVAL_NB_CHAR_FROM_CONTENT) {
echo '...';
}
}
echo "<br />\n";
}
}
}
}
}
} // End function display_digest
} //end class Display

@ -158,79 +158,7 @@ Display :: display_header($nameTools);
get_user_course_categories()
*/
/**
* Displays a digest e.g. short summary of new agenda and announcements items.
* This used to be displayed in the right hand menu, but is now
* disabled by default (see config settings in this file) because most people like
* the what's new icons better.
*
* @version 1.0
*/
function display_digest($toolsList, $digest, $orderKey, $courses) {
if (is_array($digest) && (CONFVAL_showExtractInfo == SCRIPTVAL_UnderCourseList || CONFVAL_showExtractInfo == SCRIPTVAL_Both)) {
// // // LEVEL 1 // // //
reset($digest);
echo "<br /><br />\n";
while (list($key1) = each($digest)) {
if (is_array($digest[$key1])) {
// // // Title of LEVEL 1 // // //
echo "<strong>\n";
if ($orderKey[0] == 'keyTools') {
$tools = $key1;
echo $toolsList[$key1]['name'];
} elseif ($orderKey[0] == 'keyCourse') {
$courseSysCode = $key1;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key1]['coursePath'], "\">", $courses[$key1]['courseCode'], "</a>\n";
} elseif ($orderKey[0] == 'keyTime') {
echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "</strong>\n";
// // // End Of Title of LEVEL 1 // // //
// // // LEVEL 2 // // //
reset($digest[$key1]);
while (list ($key2) = each($digest[$key1])) {
// // // Title of LEVEL 2 // // //
echo "<p>\n", "\n";
if ($orderKey[1] == 'keyTools') {
$tools = $key2;
echo $toolsList[$key2][name];
} elseif ($orderKey[1] == 'keyCourse') {
$courseSysCode = $key2;
echo "<a href=\"", api_get_path(WEB_COURSE_PATH), $courses[$key2]['coursePath'], "\">", $courses[$key2]['courseCode'], "</a>\n";
} elseif ($orderKey[1] == 'keyTime') {
echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get());
}
echo "\n";
echo "</p>";
// // // End Of Title of LEVEL 2 // // //
// // // LEVEL 3 // // //
reset($digest[$key1][$key2]);
while (list ($key3, $dataFromCourse) = each($digest[$key1][$key2])) {
// // // Title of LEVEL 3 // // //
if ($orderKey[2] == 'keyTools') {
$level3title = "<a href=\"".$toolsList[$key3]["path"].$courseSysCode."\">".$toolsList[$key3]['name']."</a>";
} elseif ($orderKey[2] == 'keyCourse') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$key3."\">".$courses[$key3]['courseCode']."</a>\n";
} elseif ($orderKey[2] == 'keyTime') {
$level3title = "&#8226; <a href=\"".$toolsList[$tools]["path"].$courseSysCode."\">".api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get())."</a>";
}
// // // End Of Title of LEVEL 3 // // //
// // // LEVEL 4 (data) // // //
reset($digest[$key1][$key2][$key3]);
while (list ($key4, $dataFromCourse) = each($digest[$key1][$key2][$key3])) {
echo $level3title, ' &ndash; ', api_substr(strip_tags($dataFromCourse), 0, CONFVAL_NB_CHAR_FROM_CONTENT);
//adding ... (three dots) if the texts are too large and they are shortened
if (api_strlen($dataFromCourse) >= CONFVAL_NB_CHAR_FROM_CONTENT) {
echo '...';
}
}
echo "<br />\n";
}
}
}
}
}
} // End function display_digest
/**
* Display code for one specific course a logged in user is subscribed to.

Loading…
Cancel
Save