remove old readme
[atutor.git] / mods / _standard / student_tools / classes / StudentToolsUtil.class.php
1 <?php\r
2 /************************************************************************/\r
3 /* ATutor                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002 - 2009                                            */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 // $Id: ims_import.php 10319 2010-10-08 20:43:03Z hwong $\r
13 \r
14 /**\r
15 * This class contains all the utility functions to set/get/clean progress \r
16 * information\r
17 * @access       public\r
18 * @author       Cindy Qi Li\r
19 */\r
20 if (!defined('AT_INCLUDE_PATH')) exit;\r
21 \r
22 class StudentToolsUtil {\r
23 \r
24         /**\r
25          * Return an array of all the student tools for current course.\r
26          * Return an empty array if no student tools defined.\r
27          */\r
28         public static function getStudentTools($course_id) \r
29         {\r
30                 global $db;\r
31                 \r
32                 $student_tools = array();\r
33                 $sql = "SELECT links FROM ".TABLE_PREFIX."fha_student_tools WHERE course_id=$course_id";\r
34                 $result = mysql_query($sql, $db);\r
35                 if ($row = mysql_fetch_assoc($result)) {\r
36                         $student_tools = explode('|', $row['links']);\r
37                 }\r
38                 // removed the empty array value\r
39                 $cleaned_student_tools = array();\r
40                 \r
41                 foreach ($student_tools as $tool) {\r
42                         if (trim($tool) <> '') $cleaned_student_tools[] = $tool;\r
43                 }\r
44                 \r
45                 return $cleaned_student_tools;\r
46         }\r
47 }\r
48 ?>