remove old readme
[atutor.git] / mods / _standard / student_tools / index.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002 - 2009                                            */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 define('AT_INCLUDE_PATH', '../../../include/');
14 require (AT_INCLUDE_PATH.'vitals.inc.php');
15 require ('classes/StudentToolsUtil.class.php');
16
17 $fha_student_tools = StudentToolsUtil::getStudentTools($_SESSION['course_id']);
18
19 if(count($fha_student_tools) == "" ){
20         $msg->addInfo('NO_TOOLS_FOUND');
21 }
22
23 $sql = "SELECT home_view FROM ".TABLE_PREFIX."fha_student_tools WHERE course_id = $_SESSION[course_id]";
24 $result = mysql_query($sql,$db);
25 $row= mysql_fetch_assoc($result);
26 $home_view = $row['home_view'];
27
28 // Enable drag and drop to reorder displayed modules when the module view mode is 
29 // set to "detail view" and user role is instructor
30 if ($home_view == 1 && authenticate(AT_PRIV_ADMIN,AT_PRIV_RETURN))
31 {
32         $_custom_head .= '
33 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-layout.css" />
34 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-text.css" />
35 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-theme-mist.css" />
36 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/framework/fss/css/fss-theme-hc.css" />
37 <link rel="stylesheet" type="text/css" href="'.AT_BASE_HREF.'jscripts/infusion/components/reorderer/css/Reorderer.css" />
38
39 <script type="text/javascript">
40 jQuery(document).ready(function () {
41         var reorder_example_grid = fluid.reorderGrid("#details_view",  {
42                 selectors : {
43                         movables : ".home_box"
44                 },
45             listeners: {
46                         afterMove: function (item, requestedPosition, movables) {
47                                 //save the state to the db
48                                 var myDivs = jQuery ("div[class^=home_box]", "#details_view");
49                                 var moved_modules = "";
50                                 
51                                 if (myDivs.constructor.toString().indexOf("Array"))   // myDivs is an array
52                                 {
53                                         for (i=0; i<myDivs.length; i++)
54                                                 moved_modules += myDivs[i].id+"|";
55                                 }
56                                 moved_modules = moved_modules.substring(0, moved_modules.length-1); // remove the last "|"
57                                 
58                                 if (moved_modules != "")
59                                         jQuery.post("'.AT_BASE_HREF.'move_module.php", { "moved_modules":moved_modules, "from":"student_tools" }, function(data) {});     
60                 }
61             },
62                 styles: {
63                     selected: "draggable_selected",
64                     hover: "draggable_selected"
65                 }
66 });
67
68 });
69
70 function remove_module(module)
71 {
72         jQuery.post("'.AT_BASE_HREF.'move_module.php", { "remove":module, "from":"student_tools" }, function(data) {});
73         jQuery("div[id=\""+module.replace(/\//g,"-")+"\"]").remove();
74 }
75
76 </script>
77         
78 ';
79 }
80
81 require (AT_INCLUDE_PATH.'header.inc.php');
82
83 $home_links = array();
84
85 if($fha_student_tools[0] != "" ){
86         //query reading the type of home viewable. 0: icon view   1: detail view
87         
88         $savant->assign('view_mode', $home_view);
89         $savant->assign('home_links', get_home_navigation($fha_student_tools));
90 }
91
92 $savant->assign('num_pages', 0);
93 $savant->assign('current_page', 0);
94 $savant->display('index.tmpl.php');
95
96 ?>
97
98
99 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>