e9e0a3af2511cd44cc9b6a01d530704620dd325a
[atutor.git] / docs / mods / _core / glossary / sublinks.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 if (!defined('AT_INCLUDE_PATH')) { exit; }
14
15 global $db;
16
17 $record_limit = 3;      // Number of sublinks to display for this module on course home page -> detail view
18
19 $sql = "SELECT * FROM ".TABLE_PREFIX."glossary WHERE course_id = $_SESSION[course_id] LIMIT $record_limit";
20 $result = mysql_query($sql, $db);
21
22 if (mysql_num_rows($result) > 0) {
23         while ($row = mysql_fetch_assoc($result)) {
24                 $list[] = '<a href="'.url_rewrite('mods/_core/glossary/index.php?w='.urlencode($row['word']).'#term', AT_PRETTY_URL_IS_HEADER).'"'.
25                           (strlen($row['word']) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($row['word'], 'glossary.word').'"' : '') .'>'. 
26                           AT_print(validate_length($row['word'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'glossary.word') .'</a>'; 
27         }
28         return $list;
29         
30 } else {
31         return 0;
32 }
33
34
35 ?>