2 /***********************************************************************/
4 /***********************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or */
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /***********************************************************************/
15 * Get the latest updates of this module
16 * @return list of news, [timestamp]=>
18 function forums_news() {
19 require_once(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
20 global $db, $enrolled_courses, $system_courses;
23 if ($enrolled_courses == ''){
27 $sql = 'SELECT E.approved, E.last_cid, C.* FROM '.TABLE_PREFIX.'course_enrollment E, '.TABLE_PREFIX.'courses C WHERE E.member_id=1 AND E.course_id=C.course_id ORDER BY C.title';
28 $result = mysql_query($sql, $db);
30 while($row = mysql_fetch_assoc($result)){
31 $all_forums = get_forums($row['course_id']);
32 if (is_array($all_forums)){
33 foreach($all_forums as $forums){
34 if (is_array($forums)){
36 foreach ($forums as $forum_obj){
37 $forum_obj['course_id'] = $row['course_id'];
38 $link_title = $forum_obj['title'];
39 $news[] = array('time'=>$forum_obj['last_post'],
42 'thumb'=>'images/pin.png',
43 'course'=>$system_courses[$row['course_id']]['title'],
44 'link'=>'<a href="bounce.php?course='.$row['course_id'].SEP.'p='.urlencode('mods/_standard/forums/forum/index.php?fid='.$forum_obj['forum_id']).'"'.
45 (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($link_title, 'forums.title').'"' : '') .'>'.
46 AT_print(validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'forums.title') .'</a>');