made a copy
[atutor.git] / mods / _core / glossary / sublinks.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
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 /************************************************************************/
13
14 if (!defined('AT_INCLUDE_PATH')) { exit; }
15
16 global $db;
17
18 $record_limit = 3;      // Number of sublinks to display for this module on course home page -> detail view
19
20 $sql = "SELECT * FROM ".TABLE_PREFIX."glossary WHERE course_id = $_SESSION[course_id] LIMIT $record_limit";
21 $result = mysql_query($sql, $db);
22
23 if (mysql_num_rows($result) > 0) {
24         while ($row = mysql_fetch_assoc($result)) {
25                 $list[] = '<a href="'.url_rewrite('glossary/index.php?w='.urlencode($row['word']).'#term', AT_PRETTY_URL_IS_HEADER).'"'.
26                           (strlen($row['word']) > SUBLINK_TEXT_LEN ? ' title="'.$row['word'].'"' : '') .'>'. 
27                           validate_length($row['word'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>'; 
28         }
29         return $list;
30         
31 } else {
32         return 0;
33 }
34
35
36 ?>