remove old readme
[atutor.git] / mods / _standard / faq / sublinks.php
1 <?php
2
3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4
5 global $db;
6
7 $post_limit = 3;        //Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
8
9 $sql = "SELECT * FROM ".TABLE_PREFIX."faq_topics T INNER JOIN ".TABLE_PREFIX."faq_entries E ON T.topic_id = E.topic_id WHERE T.course_id = $_SESSION[course_id] ORDER BY E.revised_date DESC LIMIT $post_limit";
10 $result = mysql_query($sql, $db);
11
12 if (mysql_num_rows($result) > 0) {
13         while ($row = mysql_fetch_assoc($result)) {
14                 $list[] = '<a href="'.url_rewrite('faq/index.php#'.$row['entry_id'], AT_PRETTY_URL_IS_HEADER).'"'.
15                           (strlen($row['question']) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($row['question'], 'faqs.question').'"' : '') .'>'. 
16                           AT_print(validate_length($row['question'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'faqs.question') .'</a>'; 
17         }
18         return $list;   
19 } else {
20         return 0;
21 }
22
23
24 ?>