move code up one directory
[atutor.git] / mods / _standard / forums / sublinks.php
1 <?php
2
3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4 require(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
5
6 global $db;
7
8 $record_limit = 3;              //Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
9 $cnt = 0;               // count number of returned forums
10
11
12
13 $all_forums = get_forums($_SESSION['course_id']);
14
15 foreach ($all_forums as $shared => $forums) {
16     if (is_array($forums)) {
17
18         foreach($forums as $row) {
19             if ($cnt >= $record_limit) break 2;
20             $cnt++;
21
22             $link_title = AT_print($row['title'], 'forums.title').' ('.AT_DATE('%F %j, %g:%i',$row['last_post'],AT_DATE_MYSQL_DATETIME).')';
23             $list[] = '<a href="'.url_rewrite('mods/_standard/forums/forum/index.php?fid='.$row['forum_id'], AT_PRETTY_URL_IS_HEADER).'"'.
24                       (strlen($link_title) > SUBLINK_TEXT_LEN ? ' title="'.$link_title.'"' : '') .'>'. 
25                       validate_length($link_title, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
26         }
27     }
28 }
29
30 if (count($list) > 0) {
31     return $list;
32 } else {
33     return 0;
34 }
35 ?>