changed git call from https to git readonly
[atutor.git] / mods / hello_world / sublinks.php
1 <?php
2
3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4
5 /*****
6 * Free form PHP can appear here to retreive current information
7 * from the module, or a text description of the module where there is
8 * not current information
9 *****/
10
11 global $db;
12
13 $link_limit = 3;                // Number of links to be displayed on "detail view" box
14
15 $sql = "SELECT hello_world_id, value FROM ".TABLE_PREFIX."hello_world WHERE course_id=".$_SESSION[course_id].
16        " ORDER BY value LIMIT $link_limit";
17 $result = mysql_query($sql, $db);
18
19 if (mysql_num_rows($result) > 0) {
20         while ($row = mysql_fetch_assoc($result)) {
21                 /****
22                 * SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY are defined in include/lib/constance.lib.inc
23                 * SUBLINK_TEXT_LEN determins the maxium length of the string to be displayed on "detail view" box.
24                 *****/
25                 $list[] = '<a href="'.AT_BASE_HREF.url_rewrite('mods/hello_world/index.php?id='. $row['hello_world_id']).'"'.
26                           (strlen($row['value']) > SUBLINK_TEXT_LEN ? ' title="'.$row['value'].'"' : '') .'>'. 
27                           validate_length($row['value'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
28         }
29         return $list;   
30 } else {
31         return 0;
32 }
33
34 ?>