move code up one directory
[atutor.git] / mods / _standard / directory / 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 C.member_id, M.login FROM ".TABLE_PREFIX."course_enrollment C, ".TABLE_PREFIX."members M WHERE C.course_id=$_SESSION[course_id] AND C.member_id=M.member_id AND (C.approved='y' OR C.approved='a') 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('profile.php?id='.$row['member_id'], AT_PRETTY_URL_IS_HEADER).'"'.
25                           (strlen($row['login']) > SUBLINK_TEXT_LEN ? ' title="'.$row['login'].'"' : '') .'>'. 
26                           validate_length($row['login'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>'; 
27         }
28         return $list;
29         
30 } else {
31         return 0;
32 }
33
34
35 ?>