From bbdf8ea5fedeefb4c0b5ae396df6c0e9cd9abf54 Mon Sep 17 00:00:00 2001 From: ywarnier Date: Sun, 16 Jan 2011 17:02:47 -0500 Subject: [PATCH] Moved function display_digest() from user_portal to display.lib.php --- main/inc/lib/display.lib.php | 73 +++++++++++++++++++++++++++++++++++ user_portal.php | 74 +----------------------------------- 2 files changed, 74 insertions(+), 73 deletions(-) diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 4ef7288700..66afb1b8c5 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.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 "

\n"; + while (list($key1) = each($digest)) { + if (is_array($digest[$key1])) { + // // // Title of LEVEL 1 // // // + echo "\n"; + if ($orderKey[0] == 'keyTools') { + $tools = $key1; + echo $toolsList[$key1]['name']; + } elseif ($orderKey[0] == 'keyCourse') { + $courseSysCode = $key1; + echo "", $courses[$key1]['courseCode'], "\n"; + } elseif ($orderKey[0] == 'keyTime') { + echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get()); + } + echo "\n"; + // // // End Of Title of LEVEL 1 // // // + // // // LEVEL 2 // // // + reset($digest[$key1]); + while (list ($key2) = each($digest[$key1])) { + // // // Title of LEVEL 2 // // // + echo "

\n", "\n"; + if ($orderKey[1] == 'keyTools') { + $tools = $key2; + echo $toolsList[$key2][name]; + } elseif ($orderKey[1] == 'keyCourse') { + $courseSysCode = $key2; + echo "", $courses[$key2]['courseCode'], "\n"; + } elseif ($orderKey[1] == 'keyTime') { + echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get()); + } + echo "\n"; + echo "

"; + // // // 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 = "".$toolsList[$key3]['name'].""; + } elseif ($orderKey[2] == 'keyCourse') { + $level3title = "• ".$courses[$key3]['courseCode']."\n"; + } elseif ($orderKey[2] == 'keyTime') { + $level3title = "• ".api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get()).""; + } + // // // 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, ' – ', 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 "
\n"; + } + } + } + } + } + } // End function display_digest } //end class Display \ No newline at end of file diff --git a/user_portal.php b/user_portal.php index 4455dd626f..9d2ba5dd6c 100755 --- a/user_portal.php +++ b/user_portal.php @@ -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 "

\n"; - while (list($key1) = each($digest)) { - if (is_array($digest[$key1])) { - // // // Title of LEVEL 1 // // // - echo "\n"; - if ($orderKey[0] == 'keyTools') { - $tools = $key1; - echo $toolsList[$key1]['name']; - } elseif ($orderKey[0] == 'keyCourse') { - $courseSysCode = $key1; - echo "", $courses[$key1]['courseCode'], "\n"; - } elseif ($orderKey[0] == 'keyTime') { - echo api_convert_and_format_date($digest[$key1], DATE_FORMAT_LONG, date_default_timezone_get()); - } - echo "\n"; - // // // End Of Title of LEVEL 1 // // // - // // // LEVEL 2 // // // - reset($digest[$key1]); - while (list ($key2) = each($digest[$key1])) { - // // // Title of LEVEL 2 // // // - echo "

\n", "\n"; - if ($orderKey[1] == 'keyTools') { - $tools = $key2; - echo $toolsList[$key2][name]; - } elseif ($orderKey[1] == 'keyCourse') { - $courseSysCode = $key2; - echo "", $courses[$key2]['courseCode'], "\n"; - } elseif ($orderKey[1] == 'keyTime') { - echo api_convert_and_format_date($key2, DATE_FORMAT_LONG, date_default_timezone_get()); - } - echo "\n"; - echo "

"; - // // // 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 = "".$toolsList[$key3]['name'].""; - } elseif ($orderKey[2] == 'keyCourse') { - $level3title = "• ".$courses[$key3]['courseCode']."\n"; - } elseif ($orderKey[2] == 'keyTime') { - $level3title = "• ".api_convert_and_format_date($key3, DATE_FORMAT_LONG, date_default_timezone_get()).""; - } - // // // 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, ' – ', 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 "
\n"; - } - } - } - } - } -} // End function display_digest + /** * Display code for one specific course a logged in user is subscribed to.