(no commit message)
authorjoel kronenberg <joel.kronenberg@utoronto.ca>
Thu, 8 Dec 2005 16:13:04 +0000 (16:13 -0000)
committerjoel kronenberg <joel.kronenberg@utoronto.ca>
Thu, 8 Dec 2005 16:13:04 +0000 (16:13 -0000)
35 files changed:
docs/mods/_standard/announcements/module.php [new file with mode: 0644]
docs/mods/_standard/announcements/module.xml [new file with mode: 0644]
docs/mods/_standard/announcements/module_backup.php [new file with mode: 0644]
docs/mods/_standard/announcements/module_delete.php [new file with mode: 0644]
docs/mods/_standard/chat/module.php [new file with mode: 0644]
docs/mods/_standard/chat/module.xml [new file with mode: 0644]
docs/mods/_standard/chat/module_delete.php [new file with mode: 0644]
docs/mods/_standard/faq/add_question.php [new file with mode: 0644]
docs/mods/_standard/faq/add_topic.php [new file with mode: 0644]
docs/mods/_standard/faq/delete_question.php [new file with mode: 0644]
docs/mods/_standard/faq/delete_topic.php [new file with mode: 0644]
docs/mods/_standard/faq/edit_question.php [new file with mode: 0644]
docs/mods/_standard/faq/edit_topic.php [new file with mode: 0644]
docs/mods/_standard/faq/icon.gif [new file with mode: 0644]
docs/mods/_standard/faq/index.php [new file with mode: 0644]
docs/mods/_standard/faq/index_instructor.php [new file with mode: 0644]
docs/mods/_standard/faq/module.php [new file with mode: 0644]
docs/mods/_standard/faq/module.xml [new file with mode: 0644]
docs/mods/_standard/faq/module_backup.php [new file with mode: 0644]
docs/mods/_standard/faq/module_delete.php [new file with mode: 0644]
docs/mods/_standard/forums/module.php [new file with mode: 0644]
docs/mods/_standard/forums/module.xml [new file with mode: 0644]
docs/mods/_standard/forums/module_delete.php [new file with mode: 0644]
docs/mods/_standard/links/module.php [new file with mode: 0644]
docs/mods/_standard/links/module.xml [new file with mode: 0644]
docs/mods/_standard/links/module_backup.php [new file with mode: 0644]
docs/mods/_standard/links/module_delete.php [new file with mode: 0644]
docs/mods/_standard/polls/module.php [new file with mode: 0644]
docs/mods/_standard/polls/module.xml [new file with mode: 0644]
docs/mods/_standard/polls/module_backup.php [new file with mode: 0644]
docs/mods/_standard/polls/module_delete.php [new file with mode: 0644]
docs/mods/_standard/tests/module.php [new file with mode: 0644]
docs/mods/_standard/tests/module.xml [new file with mode: 0644]
docs/mods/_standard/tests/module_backup.php [new file with mode: 0644]
docs/mods/_standard/tests/module_delete.php [new file with mode: 0644]

diff --git a/docs/mods/_standard/announcements/module.php b/docs/mods/_standard/announcements/module.php
new file mode 100644 (file)
index 0000000..1927152
--- /dev/null
@@ -0,0 +1,21 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_ANNOUNCEMENTS', $this->getPrivilege());\r
+\r
+$this->_pages['tools/news/index.php']['title_var'] = 'announcements';\r
+$this->_pages['tools/news/index.php']['guide']     = 'instructor/?p=1.0.announcements.php';\r
+$this->_pages['tools/news/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/news/index.php']['children']  = array('editor/add_news.php');\r
+\r
+       $this->_pages['editor/add_news.php']['title_var']  = 'add_announcement';\r
+       $this->_pages['editor/add_news.php']['parent'] = 'tools/news/index.php';\r
+\r
+       $this->_pages['editor/edit_news.php']['title_var']  = 'edit_announcement';\r
+       $this->_pages['editor/edit_news.php']['parent'] = 'tools/news/index.php';\r
+\r
+       $this->_pages['editor/delete_news.php']['title_var']  = 'delete_announcement';\r
+       $this->_pages['editor/delete_news.php']['parent'] = 'tools/news/index.php';\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/announcements/module.xml b/docs/mods/_standard/announcements/module.xml
new file mode 100644 (file)
index 0000000..ab7a1ff
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Announcements</name> \r
+    <description lang="en">Announcements are useful for posting important information to students on the course Home page.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege></admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-25</date> \r
+        <state>stable</state> \r
+        <notes>This is a core module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/announcements/module_backup.php b/docs/mods/_standard/announcements/module_backup.php
new file mode 100644 (file)
index 0000000..5fb48e0
--- /dev/null
@@ -0,0 +1,33 @@
+<?php\r
+\r
+$sql = array();\r
+$sql['news'] = 'SELECT date, formatting, title, body FROM '.TABLE_PREFIX.'news WHERE course_id=? ORDER BY news_id ASC';\r
+\r
+\r
+// ??\r
+// not sure what to call this.\r
+// it takes a CSV row and returns a valid SQL row (ie. all the correct fields).\r
+\r
+function news_convert($row, $course_id, $table_id_map, $version) {\r
+       static $member_id;\r
+\r
+       if (!isset($member_id)) {\r
+               global $db;\r
+               $sql        = "SELECT member_id FROM ".TABLE_PREFIX."courses WHERE course_id=$course_id";\r
+               $result     = mysql_query($sql, $db);\r
+               $member_row = mysql_fetch_assoc($result);\r
+               $member_id  = $member_row['member_id'];\r
+       }\r
+       $new_row = array();\r
+       $new_row[0] = 0;\r
+       $new_row[1] = $course_id;\r
+       $new_row[2] = $member_id;\r
+       $new_row[3] = $row[0];\r
+       $new_row[4] = $row[1];\r
+       $new_row[5] = $row[2];\r
+       $new_row[6] = $row[3];\r
+\r
+       return $new_row;\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/announcements/module_delete.php b/docs/mods/_standard/announcements/module_delete.php
new file mode 100644 (file)
index 0000000..a5d85a7
--- /dev/null
@@ -0,0 +1,20 @@
+<?php\r
+\r
+function announcements_delete($course) {\r
+       global $db;\r
+\r
+       /* announcement RSS: */\r
+       if (file_exists(AT_CONTENT_DIR . 'feeds/' . $course . '/RSS1.0.xml')) {\r
+               @unlink(AT_CONTENT_DIR . 'feeds/' . $course . '/RSS1.0.xml');\r
+       }\r
+       if (file_exists(AT_CONTENT_DIR . 'feeds/' . $course . '/RSS2.0.xml')) {\r
+               @unlink(AT_CONTENT_DIR . 'feeds/' . $course . '/RSS2.0.xml');\r
+       }\r
+\r
+       //announcements\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."news WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/chat/module.php b/docs/mods/_standard/chat/module.php
new file mode 100644 (file)
index 0000000..e3c7547
--- /dev/null
@@ -0,0 +1,33 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_CHAT', $this->getPrivilege());\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'chat/index.php';\r
+\r
+$this->_pages['tools/chat/index.php']['title_var'] = 'chat';\r
+$this->_pages['tools/chat/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/chat/index.php']['children']  = array('tools/chat/start_transcript.php');\r
+$this->_pages['tools/chat/index.php']['guide']     = 'instructor/?p=3.0.chat.php';\r
+\r
+       $this->_pages['tools/chat/start_transcript.php']['title_var']  = 'chat_start_transcript';\r
+       $this->_pages['tools/chat/start_transcript.php']['parent'] = 'tools/chat/index.php';\r
+\r
+       $this->_pages['tools/chat/delete_transcript.php']['title_var']  = 'chat_delete_transcript';\r
+       $this->_pages['tools/chat/delete_transcript.php']['parent'] = 'tools/chat/index.php';\r
+\r
+       $this->_pages['tools/chat/view_transcript.php']['title_var']  = 'chat_transcript';\r
+       $this->_pages['tools/chat/view_transcript.php']['parent'] = 'tools/chat/index.php';\r
+\r
+$this->_pages['chat/index.php']['title_var'] = 'chat';\r
+$this->_pages['chat/index.php']['img']       = 'images/home-chat.gif';\r
+\r
+       $this->_pages['chat/chat_frame.php']['title_var'] = 'chat';\r
+       $this->_pages['chat/chat_frame.php']['parent']    = 'chat/index.php';\r
+\r
+       $this->_pages['chat/view_transcript.php']['title_var'] = 'chat_transcript';\r
+       $this->_pages['chat/view_transcript']['parent']        = 'chat/index.php';\r
+       \r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/chat/module.xml b/docs/mods/_standard/chat/module.xml
new file mode 100644 (file)
index 0000000..fd416b4
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Chat</name> \r
+    <description lang="en">AChat is an accessible chat forum for real time discussions.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege></admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-29</date> \r
+        <state>stable</state> \r
+        <notes>This is a core module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/chat/module_delete.php b/docs/mods/_standard/chat/module_delete.php
new file mode 100644 (file)
index 0000000..c4f6538
--- /dev/null
@@ -0,0 +1,13 @@
+<?php\r
+\r
+function chat_delete($course) {\r
+       global $db;\r
+\r
+       $path = AT_CONTENT_DIR . 'chat/' . $course . '/';\r
+       if (is_dir($path)) {\r
+               clr_dir($path);\r
+       }\r
+\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/add_question.php b/docs/mods/_standard/faq/add_question.php
new file mode 100644 (file)
index 0000000..68a737d
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+define('AT_INCLUDE_PATH', '../../../include/');
+require (AT_INCLUDE_PATH.'vitals.inc.php');
+
+authenticate(AT_PRIV_FAQ);
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index_instructor.php');
+       exit;
+} else if (isset($_POST['submit'])) {
+       if (trim($_POST['question']) == '') {
+               $msg->addError('QUESTION_EMPTY');
+       }
+
+       if (trim($_POST['answer']) == '') {
+               $msg->addError('ANSWER_EMPTY');
+       }
+
+       if (!$msg->containsErrors()) {
+               $_POST['question'] = $addslashes($_POST['question']);
+               $_POST['answer']   = $addslashes($_POST['answer']);
+               $_POST['topic_id'] = intval($_POST['topic_id']);
+
+               // check that this topic_id belongs to this course:
+               $sql    = "SELECT topic_id FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_POST[topic_id] AND course_id=$_SESSION[course_id]";
+               $result = mysql_query($sql, $db);
+               if ($row = mysql_fetch_assoc($result)) {
+                       $sql    = "INSERT INTO ".TABLE_PREFIX."faq_entries VALUES (0, $_POST[topic_id], NOW(), 1, '$_POST[question]', '$_POST[answer]')";
+                       $result = mysql_query($sql,$db);
+               }
+               
+               $msg->addFeedback('QUESTION_ADDED');
+               header('Location: index_instructor.php');
+               exit;
+       }
+}
+
+require(AT_INCLUDE_PATH.'header.inc.php');
+
+       $sql    = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";
+       $result = mysql_query($sql, $db);
+       $num_topics = mysql_num_rows($result);
+       if (!$num_topics) {
+               $msg->printErrors('NO_FAQ_TOPICS');
+               require(AT_INCLUDE_PATH.'footer.inc.php');
+               exit;
+       }
+?>
+
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
+
+<div class="input-form">
+       <div class="row">
+
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="topic"><?php  echo _AT('topic'); ?></label><br />
+               <select name="topic_id" id="topic">
+                       <?php while ($row = mysql_fetch_assoc($result)): ?>
+                               <option value="<?php echo $row['topic_id']; ?>"<?php if (isset($_POST['topic_id']) && ($row['topic_id'] == $_POST['topic_id'])) { echo ' selected="selected"'; } ?>><?php echo htmlspecialchars($row['name']); ?></option>
+                       <?php endwhile; ?>
+               </select>
+       </div>
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="question"><?php  echo _AT('question'); ?></label><br />
+               <input type="text" name="question" size="50" id="question" value="<?php if (isset($_POST['question'])) echo stripslashes($_POST['question']);  ?>" />
+
+       </div>
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="answer"><?php  echo _AT('answer'); ?></label><br />
+               <textarea name="answer" cols="45" rows="3" id="answer" style="width:90%;"><?php if (isset ($_POST['answer'])) echo stripslashes($_POST['answer']);  ?></textarea>
+       </div>
+
+
+       <div class="row buttons">
+               <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
+       </div>
+</div>
+</form>
+
+<?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/add_topic.php b/docs/mods/_standard/faq/add_topic.php
new file mode 100644 (file)
index 0000000..c19c2ac
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+define('AT_INCLUDE_PATH', '../../../include/');
+require (AT_INCLUDE_PATH.'vitals.inc.php');
+
+authenticate(AT_PRIV_FAQ);
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index_instructor.php');
+       exit;
+} else if (isset($_POST['submit'])) {
+       if (trim($_POST['name']) == '') {
+               $msg->addError('NAME_EMPTY');
+       }
+
+       if (!$msg->containsErrors()) {
+               $_POST['name'] = $addslashes($_POST['name']);
+
+               $sql    = "INSERT INTO ".TABLE_PREFIX."faq_topics VALUES (0, $_SESSION[course_id], '$_POST[name]')";
+               $result = mysql_query($sql,$db);
+               
+               $msg->addFeedback('TOPIC_ADDED');
+               header('Location: index_instructor.php');
+               exit;
+       }
+}
+
+require(AT_INCLUDE_PATH.'header.inc.php');
+
+?>
+
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
+
+<div class="input-form">       
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="name"><?php  echo _AT('name'); ?></label><br />
+               <input type="text" name="name" size="50" id="name" value="<?php if (isset($_POST['name'])) echo stripslashes($_POST['name']);  ?>" />
+       </div>
+
+       <div class="row buttons">
+               <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
+       </div>
+</div>
+</form>
+
+<?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/delete_question.php b/docs/mods/_standard/faq/delete_question.php
new file mode 100644 (file)
index 0000000..a5339ac
--- /dev/null
@@ -0,0 +1,49 @@
+<?php\r
+define('AT_INCLUDE_PATH', '../../../include/');\r
+require (AT_INCLUDE_PATH.'vitals.inc.php');\r
+\r
+authenticate(AT_PRIV_FAQ);\r
+\r
+if (isset($_POST['submit_no'])) {\r
+       $msg->addFeedback('CANCELLED');\r
+       Header('Location: index_instructor.php');\r
+       exit;\r
+} else if (isset($_POST['submit_yes'])) {\r
+       $_POST['id'] = intval($_POST['id']);\r
+       $_POST['topic_id'] = intval($_POST['topic_id']);\r
+\r
+       // check that this topic_id belongs to this course:\r
+       $sql    = "SELECT topic_id FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_POST[topic_id] AND course_id=$_SESSION[course_id]";\r
+       $result = mysql_query($sql, $db);\r
+       if ($row = mysql_fetch_assoc($result)) {\r
+               $sql = "DELETE FROM ".TABLE_PREFIX."faq_entries WHERE entry_id=$_POST[id] AND topic_id=$_POST[topic_id]";\r
+               $result = mysql_query($sql, $db);\r
+       }\r
+\r
+       $msg->addFeedback('QUESTION_DELETED');\r
+       header('Location: index_instructor.php');\r
+       exit;\r
+}\r
+\r
+require(AT_INCLUDE_PATH.'header.inc.php');\r
+\r
+\r
+$_GET['id'] = intval($_GET['id']); \r
+\r
+$sql = "SELECT question, topic_id FROM ".TABLE_PREFIX."faq_entries WHERE entry_id=$_GET[id]";\r
+\r
+$result = mysql_query($sql,$db);\r
+if ($row = mysql_fetch_assoc($result)) {\r
+       $hidden_vars['topic_id'] = $row['topic_id'];\r
+       $hidden_vars['id'] = $_GET['id'];\r
+\r
+       $confirm = array('DELETE_FAQ_QUESTION', $row['question']);\r
+       $msg->addConfirm($confirm, $hidden_vars);\r
+       $msg->printConfirm();\r
+} else {\r
+       $msg->addError('QUESTION_NOT_FOUND');\r
+}\r
+\r
+require(AT_INCLUDE_PATH.'footer.inc.php');\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/delete_topic.php b/docs/mods/_standard/faq/delete_topic.php
new file mode 100644 (file)
index 0000000..2c85ca0
--- /dev/null
@@ -0,0 +1,46 @@
+<?php\r
+define('AT_INCLUDE_PATH', '../../../include/');\r
+require (AT_INCLUDE_PATH.'vitals.inc.php');\r
+\r
+authenticate(AT_PRIV_FAQ);\r
+\r
+if (isset($_POST['submit_no'])) {\r
+       $msg->addFeedback('CANCELLED');\r
+       Header('Location: index_instructor.php');\r
+       exit;\r
+} else if (isset($_POST['submit_yes'])) {\r
+       $_POST['id'] = intval($_POST['id']);\r
+\r
+       // check that this topic_id belongs to this course:\r
+       $sql = "DELETE FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_POST[id] AND course_id=$_SESSION[course_id]";\r
+       $result = mysql_query($sql, $db);\r
+       if (mysql_affected_rows($db) == 1) {\r
+               $sql = "DELETE FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$_POST[topic_id]";\r
+               $result = mysql_query($sql, $db);\r
+       }\r
+\r
+       $msg->addFeedback('TOPIC_DELETED');\r
+       header('Location: index_instructor.php');\r
+       exit;\r
+}\r
+\r
+require(AT_INCLUDE_PATH.'header.inc.php');\r
+\r
+\r
+$_GET['id'] = intval($_GET['id']); \r
+\r
+$sql = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_GET[id]";\r
+\r
+$result = mysql_query($sql,$db);\r
+if ($row = mysql_fetch_assoc($result)) {\r
+       $hidden_vars['id'] = $_GET['id'];\r
+\r
+       $confirm = array('DELETE_FAQ_TOPIC', $row['name']);\r
+       $msg->addConfirm($confirm, $hidden_vars);\r
+       $msg->printConfirm();\r
+} else {\r
+       $msg->addError('TOPIC_NOT_FOUND');\r
+}\r
+\r
+require(AT_INCLUDE_PATH.'footer.inc.php');\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/edit_question.php b/docs/mods/_standard/faq/edit_question.php
new file mode 100644 (file)
index 0000000..32ff464
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+define('AT_INCLUDE_PATH', '../../../include/');
+require (AT_INCLUDE_PATH.'vitals.inc.php');
+
+authenticate(AT_PRIV_FAQ);
+
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index_instructor.php');
+       exit;
+} 
+
+if (isset($_GET['id'])) {
+       $id = intval($_GET['id']);
+} else {
+       $id = intval($_POST['id']);
+}
+
+if (isset($_POST['submit'])) {
+       if (trim($_POST['question']) == '') {
+               $msg->addError('QUESTION_EMPTY');
+       }
+
+       if (trim($_POST['answer']) == '') {
+               $msg->addError('ANSWER_EMPTY');
+       }
+
+       if (!$msg->containsErrors()) {
+               $_POST['question'] = $addslashes($_POST['question']);
+               $_POST['answer'] = $addslashes($_POST['answer']);
+               $_POST['topic_id'] = intval($_POST['topic_id']);
+
+               $sql = "UPDATE ".TABLE_PREFIX."faq_entries SET question='$_POST[question]', answer='$_POST[answer]', topic_id=$_POST[topic_id] WHERE entry_id=$id";
+               $result = mysql_query($sql,$db);
+
+               $msg->addFeedback('QUESTION_UPDATED');
+               header('Location: index_instructor.php');
+               exit;
+       }
+}
+
+require(AT_INCLUDE_PATH.'header.inc.php');
+
+if ($id == 0) {
+       $msg->printErrors('QUESTION_NOT_FOUND');
+       require (AT_INCLUDE_PATH.'footer.inc.php');
+       exit;
+}
+
+$sql = "SELECT * FROM ".TABLE_PREFIX."faq_entries WHERE entry_id=$id";
+$result = mysql_query($sql,$db);
+if (!($row = mysql_fetch_assoc($result))) {
+       $msg->printErrors('QUESTION_NOT_FOUND');
+       require (AT_INCLUDE_PATH.'footer.inc.php');
+       exit;
+}
+
+
+$sql   = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";
+$result = mysql_query($sql, $db);
+$num_topics = mysql_num_rows($result);
+if (!$num_topics) {
+       $msg->printErrorS('NO_FAQ_TOPICS');
+       require(AT_INCLUDE_PATH.'footer.inc.php');
+       exit;
+}
+
+?>
+
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
+<input type="hidden" name="id" value="<?php echo $row['entry_id']; ?>" />
+
+<div class="input-form">
+       <div class="row">
+               <?php
+                       $sql    = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";
+                       $result = mysql_query($sql, $db);
+               ?>
+
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="topic"><?php  echo _AT('topic'); ?></label><br />
+               <select name="topic_id" id="topic">
+                       <?php while ($topic_row = mysql_fetch_assoc($result)): ?>
+                               <option value="<?php echo $topic_row['topic_id']; ?>"<?php if ($topic_row['topic_id'] == $row['topic_id']) { echo ' selected="selected"'; } ?>><?php echo htmlspecialchars($topic_row['name']); ?></option>
+                       <?php endwhile; ?>
+               </select>
+       </div>
+
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="question"><?php echo _AT('question'); ?>:</label><br />
+               <input type="text" name="question" size="50" id="question" value="<?php if (isset ($_POST['question'])) { echo stripslashes($_POST['question']); } else { echo $row['question']; } ?>" />
+       </div>
+
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="answer"><?php  echo _AT('answer'); ?></label><br />
+               <textarea name="answer" cols="45" rows="3" id="answer" style="width:90%;"><?php if (isset ($_POST['answer'])) { echo stripslashes($_POST['answer']); } else { echo $row['answer']; } ?></textarea>
+       </div>
+
+       <div class="row buttons">
+               <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?> " />
+       </div>
+
+</div>
+</form>
+<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/edit_topic.php b/docs/mods/_standard/faq/edit_topic.php
new file mode 100644 (file)
index 0000000..66e50c2
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+define('AT_INCLUDE_PATH', '../../../include/');
+require (AT_INCLUDE_PATH.'vitals.inc.php');
+
+authenticate(AT_PRIV_FAQ);
+
+
+if (isset($_POST['cancel'])) {
+       $msg->addFeedback('CANCELLED');
+       header('Location: index_instructor.php');
+       exit;
+} 
+
+if (isset($_GET['id'])) {
+       $id = intval($_GET['id']);
+} else {
+       $id = intval($_POST['id']);
+}
+
+if (isset($_POST['submit'])) {
+       if (trim($_POST['name']) == '') {
+               $msg->addError('NAME_EMPTY');
+       }
+
+       if (!$msg->containsErrors()) {
+               $_POST['name'] = $addslashes($_POST['name']);
+
+               $sql    = "UPDATE ".TABLE_PREFIX."faq_topics SET name='$_POST[name]' WHERE topic_id=$id AND course_id=$_SESSION[course_id]";
+               $result = mysql_query($sql,$db);
+
+               $msg->addFeedback('TOPIC_UPDATED');
+               header('Location: index_instructor.php');
+               exit;
+       }
+}
+
+require(AT_INCLUDE_PATH.'header.inc.php');
+
+if ($id == 0) {
+       $msg->printErrors('TOPIC_NOT_FOUND');
+       require (AT_INCLUDE_PATH.'footer.inc.php');
+       exit;
+}
+
+$sql   = "SELECT name FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] AND topic_id=$id ORDER BY name";
+$result = mysql_query($sql, $db);
+if (!$row = mysql_fetch_assoc($result)) {
+       $msg->printErrorS('TOPIC_NOT_FOUND');
+       require(AT_INCLUDE_PATH.'footer.inc.php');
+       exit;
+} else if (!$_POST['name']) {
+       $_POST['name'] = $row['name'];
+}
+
+?>
+
+<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">
+<input type="hidden" name="id" value="<?php echo $id; ?>" />
+
+<div class="input-form">
+       <div class="row">
+               <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><label for="name"><?php  echo _AT('name'); ?></label><br />
+               <input type="text" name="name" size="50" id="name" value="<?php if (isset($_POST['name'])) echo stripslashes($_POST['name']);  ?>" />
+       </div>
+
+       <div class="row buttons">
+               <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
+               <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?> " />
+       </div>
+
+</div>
+</form>
+<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/icon.gif b/docs/mods/_standard/faq/icon.gif
new file mode 100644 (file)
index 0000000..56ae823
Binary files /dev/null and b/docs/mods/_standard/faq/icon.gif differ
diff --git a/docs/mods/_standard/faq/index.php b/docs/mods/_standard/faq/index.php
new file mode 100644 (file)
index 0000000..fb7947e
--- /dev/null
@@ -0,0 +1,41 @@
+<?php\r
+\r
+define('AT_INCLUDE_PATH', '../../../include/');\r
+require (AT_INCLUDE_PATH.'vitals.inc.php');\r
+require (AT_INCLUDE_PATH.'header.inc.php');\r
+\r
+$counter = 1;\r
+$sql    = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";\r
+$result  = mysql_query($sql, $db);\r
+?>\r
+\r
+<?php if ($row = mysql_fetch_assoc($result)) : ?>\r
+       <ul style="list-style: none;">\r
+               <?php do { ?>\r
+                       <li style="font-weight: bold; margin-bottom: 10px;">\r
+                               <?php echo $row['name']; ?>\r
+                               <?php \r
+                                       $entry_sql = "SELECT * FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$row[topic_id] ORDER BY question";\r
+                                       $entry_result = mysql_query($entry_sql, $db);\r
+                               if ($entry_row = mysql_fetch_assoc($entry_result)) {?>\r
+                               <ol start="<?php echo $counter; ?>">\r
+\r
+                                       <?php do { ?>\r
+                                               <li style="font-weight: normal">\r
+                                                       <h3><?php echo $entry_row['question']; ?></h3>\r
+                                                       <p><?php echo $entry_row['answer'];?></p>\r
+                                               </li>\r
+                                               <?php $counter++; ?>\r
+                                       <?php } while ($entry_row = mysql_fetch_assoc($entry_result)) ?>\r
+                               </ol>\r
+                               <?php } else { ?>\r
+                                       <p style="padding-left: 20px; padding-top:3px; font-weight:normal;"><?php echo _AT('no_questions');  ?></p>\r
+                               <?php } ?>\r
+                       </li>\r
+               <?php } while($row = mysql_fetch_assoc($result)); ?>\r
+       </ul>\r
+<?php else: ?>\r
+       <?php echo _AT('none_found'); ?>\r
+<?php endif; ?>\r
+\r
+<?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/index_instructor.php b/docs/mods/_standard/faq/index_instructor.php
new file mode 100644 (file)
index 0000000..d51ae3b
--- /dev/null
@@ -0,0 +1,94 @@
+<?php\r
+\r
+define('AT_INCLUDE_PATH', '../../../include/');\r
+require (AT_INCLUDE_PATH.'vitals.inc.php');\r
+authenticate(AT_PRIV_FAQ);\r
+\r
+if (isset($_GET['edit'], $_GET['item'])) {\r
+       $item = intval($_GET['item']);\r
+       if (substr($_GET['item'], -1) == 'q') {\r
+               header('Location: edit_question.php?id=' . $item);\r
+       } else {\r
+               header('Location: edit_topic.php?id=' . $item);\r
+       }\r
+       exit;\r
+} else if (isset($_GET['delete'], $_GET['item'])) {\r
+       $item = intval($_GET['item']);\r
+\r
+       if (substr($_GET['item'], -1) == 'q') {\r
+               header('Location: delete_question.php?id=' . $item);\r
+       } else {\r
+               header('Location: delete_topic.php?id=' . $item);\r
+       }\r
+       exit;\r
+} else if (!empty($_GET)) {\r
+       $msg->addError('NO_ITEM_SELECTED');\r
+}\r
+\r
+require(AT_INCLUDE_PATH.'header.inc.php'); \r
+\r
+$orders = array('asc' => 'desc', 'desc' => 'asc');\r
+\r
+if (isset($_GET['asc'])) {\r
+       $order = 'asc';\r
+       $col   = $addslashes($_GET['asc']);\r
+} else if (isset($_GET['desc'])) {\r
+       $order = 'desc';\r
+       $col   = $addslashes($_GET['desc']);\r
+} else {\r
+       // no order set\r
+       $order = 'desc';\r
+       $col   = 'created_date';\r
+}\r
+\r
+$counter = 1;\r
+$sql    = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";\r
+$result  = mysql_query($sql, $db);\r
+?>\r
+\r
+<form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">\r
+<table class="data" style="width: 60%;">\r
+<thead>\r
+<tr>\r
+       <th>&nbsp;</th>\r
+       <th style="width: 100%;"><?php echo _AT('name'); ?></th>\r
+</tr>\r
+</thead>\r
+<tfoot>\r
+<tr>\r
+       <td colspan="2"><input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> \r
+                                   <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /></td>\r
+</tr>\r
+</tfoot>\r
+<?php if ($row = mysql_fetch_assoc($result)) : ?>\r
+<tbody>\r
+               <?php do { ?>\r
+                       <tr onmousedown="document.form['t<?php echo $row['topic_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['topic_id']; ?>_0">\r
+                               <th style="border-top:1pt solid #e0e0e0;"><input type="radio" name="item" id="t<?php echo $row['topic_id']; ?>" value="<?php echo $row['topic_id']; ?>" /></th>\r
+                               <th style="border-top:1pt solid #e0e0e0;"><?php echo $row['name']; ?></th>\r
+                       </tr>\r
+                       <?php \r
+                               $entry_sql = "SELECT * FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$row[topic_id] ORDER BY question";\r
+                               $entry_result = mysql_query($entry_sql, $db);\r
+                       ?>\r
+\r
+                       <?php if ($entry_row = mysql_fetch_assoc($entry_result)) : do { ?>\r
+                               <tr onmousedown="document.form['q<?php echo $entry_row['entry_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['topic_id']; ?>_<?php echo $entry_row['entry_id']; ?>">\r
+                                       <td><input type="radio" name="item" id="q<?php echo $entry_row['entry_id']; ?>" value="<?php echo $entry_row['entry_id']; ?>q" /></td>\r
+                                       <td><?php echo $entry_row['question']; ?></td>\r
+                               </tr>\r
+                       <?php } while ($entry_row = mysql_fetch_assoc($entry_result)); else: ?>\r
+                               <tr>\r
+                                       <td>&nbsp;</td>\r
+                                       <td><?php echo _AT('no_questions'); ?></td>\r
+                               </tr>\r
+                       <?php endif; ?>\r
+               <?php } while($row = mysql_fetch_assoc($result)); ?>\r
+</tbody>\r
+<?php else: ?>\r
+       <?php echo _AT('none_found'); ?>\r
+<?php endif; ?>\r
+</table>\r
+</form>\r
+\r
+<?php require(AT_INCLUDE_PATH.'footer.inc.php');  ?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/module.php b/docs/mods/_standard/faq/module.php
new file mode 100644 (file)
index 0000000..c36e518
--- /dev/null
@@ -0,0 +1,40 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_FAQ', $this->getPrivilege());\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'mods/_standard/faq/index.php';\r
+\r
+\r
+// instructor Manage section:\r
+$this->_pages['mods/_standard/faq/index_instructor.php']['title_var'] = 'faq';\r
+$this->_pages['mods/_standard/faq/index_instructor.php']['parent']    = 'tools/index.php';\r
+$this->_pages['mods/_standard/faq/index_instructor.php']['children']  = array('mods/_standard/faq/add_topic.php', 'mods/_standard/faq/add_question.php');\r
+$this->_pages['mods/_standard/faq/index_instructor.php']['guide']     = 'instructor/?p=16.0.faq.php';\r
+\r
+\r
+       $this->_pages['mods/_standard/faq/add_topic.php']['title_var'] = 'add_topic';\r
+       $this->_pages['mods/_standard/faq/add_topic.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+       $this->_pages['mods/_standard/faq/delete_topic.php']['title_var'] = 'delete';\r
+       $this->_pages['mods/_standard/faq/delete_topic.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+       $this->_pages['mods/_standard/faq/edit_topic.php']['title_var'] = 'edit';\r
+       $this->_pages['mods/_standard/faq/edit_topic.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+       $this->_pages['mods/_standard/faq/add_question.php']['title_var'] = 'add_question';\r
+       $this->_pages['mods/_standard/faq/add_question.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+       $this->_pages['mods/_standard/faq/delete_question.php']['title_var'] = 'delete';\r
+       $this->_pages['mods/_standard/faq/delete_question.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+       $this->_pages['mods/_standard/faq/edit_question.php']['title_var'] = 'edit';\r
+       $this->_pages['mods/_standard/faq/edit_question.php']['parent']    = 'mods/_standard/faq/index_instructor.php';\r
+\r
+// student page:\r
+$this->_pages['mods/_standard/faq/index.php']['title_var'] = 'faq';\r
+$this->_pages['mods/_standard/faq/index.php']['img']       = 'mods/_standard/faq/icon.gif';\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/module.xml b/docs/mods/_standard/faq/module.xml
new file mode 100644 (file)
index 0000000..2f75b74
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Frequently Asked Questions (FAQ)</name> \r
+    <description lang="en">Adds course-specific FAQs which instructors can manage.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+        <date>2005-10-12</date> \r
+        <state>stable</state> \r
+        <notes></notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/module_backup.php b/docs/mods/_standard/faq/module_backup.php
new file mode 100644 (file)
index 0000000..b36b541
--- /dev/null
@@ -0,0 +1,29 @@
+<?php\r
+/* each table to be backed up. includes the sql entry and fields */\r
+\r
+$sql = array();\r
+$sql['faq_topics']  = 'SELECT topic_id, name FROM '.TABLE_PREFIX.'faq_topics WHERE course_id=? ORDER BY name';\r
+$sql['faq_entries'] = 'SELECT E.topic_id, E.revised_date, E.approved, E.question, E.answer FROM '.TABLE_PREFIX.'faq_entries E INNER JOIN '.TABLE_PREFIX.'faq_topics T USING (topic_id) WHERE T.course_id=? ORDER BY T.name, E.question';\r
+\r
+function faq_topics_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0]  = $row[0];\r
+       $new_row[1]  = $course_id;\r
+       $new_row[2]  = $row[1];\r
+\r
+       return $new_row;\r
+}\r
+\r
+function faq_entries_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0]  = 0;\r
+       $new_row[1]  = $table_id_map['faq_topics'][$row[0]];\r
+       $new_row[2]  = $row[1];\r
+       $new_row[3]  = $row[2];\r
+       $new_row[4]  = $row[3];\r
+       $new_row[5]  = $row[4];\r
+\r
+       return $new_row;\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/faq/module_delete.php b/docs/mods/_standard/faq/module_delete.php
new file mode 100644 (file)
index 0000000..7b6aabe
--- /dev/null
@@ -0,0 +1,19 @@
+<?php\r
+\r
+function faq_delete($course) {\r
+       global $db;\r
+\r
+       $sql = "SELECT topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+       while ($row = mysql_fetch_assoc($result)) {\r
+               $sql = "DELETE FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$row[topic_id]";\r
+               mysql_query($sql, $db);\r
+       }\r
+\r
+       $sql = "DELETE FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$course";\r
+       mysql_query($sql, $db);\r
+\r
+       clr_dir($path);\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/forums/module.php b/docs/mods/_standard/forums/module.php
new file mode 100644 (file)
index 0000000..d80d4ff
--- /dev/null
@@ -0,0 +1,57 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_FORUMS',       $this->getPrivilege() );\r
+define('AT_ADMIN_PRIV_FORUMS', $this->getAdminPrivilege() );\r
+\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'forum/list.php';\r
+\r
+//side dropdown\r
+$this->_stacks['posts'] = array('title_var'=>'posts','file'=>AT_INCLUDE_PATH.'html/dropdowns/posts.inc.php');\r
+\r
+//instructor pages\r
+$this->_pages['tools/forums/index.php']['title_var'] = 'forums';\r
+$this->_pages['tools/forums/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/forums/index.php']['guide']     = 'instructor/?p=3.0.forums.php';\r
+$this->_pages['tools/forums/index.php']['children']  = array('editor/add_forum.php');\r
+\r
+       $this->_pages['editor/add_forum.php']['title_var']  = 'create_forum';\r
+       $this->_pages['editor/add_forum.php']['parent'] = 'tools/forums/index.php';\r
+\r
+       $this->_pages['editor/delete_forum.php']['title_var']  = 'delete_forum';\r
+       $this->_pages['editor/delete_forum.php']['parent'] = 'tools/forums/index.php';\r
+\r
+       $this->_pages['editor/edit_forum.php']['title_var']  = 'edit_forum';\r
+       $this->_pages['editor/edit_forum.php']['parent'] = 'tools/forums/index.php';\r
+\r
+//student pages\r
+$this->_pages['forum/list.php']['title_var']  = 'forums';\r
+$this->_pages['forum/list.php']['img']        = 'images/home-forums.gif';\r
+\r
+// for admin\r
+if (admin_authenticate(AT_ADMIN_PRIV_FORUMS, TRUE) || admin_authenticate(AT_ADMIN_PRIV_ADMIN, TRUE)) {\r
+       if (admin_authenticate(AT_ADMIN_PRIV_ADMIN, TRUE)) {\r
+               $this->_pages['admin/courses.php']['children'] = array('admin/forums.php');\r
+               $this->_pages['admin/forums.php']['parent']    = 'admin/courses.php';\r
+       } else {\r
+               $this->_pages[AT_NAV_ADMIN] = array('admin/forums.php');\r
+               $this->_pages['admin/forums.php']['parent'] = AT_NAV_ADMIN;\r
+       }\r
+\r
+       $this->_pages['admin/forums.php']['title_var'] = 'forums';\r
+       $this->_pages['admin/forums.php']['guide']     = 'admin/?p=4.3.forums.php';\r
+       $this->_pages['admin/forums.php']['children']  = array('admin/forum_add.php');\r
+\r
+               $this->_pages['admin/forum_add.php']['title_var'] = 'create_forum';\r
+               $this->_pages['admin/forum_add.php']['parent']    = 'admin/forums.php';\r
+\r
+               $this->_pages['admin/forum_edit.php']['title_var'] = 'edit_forum';\r
+               $this->_pages['admin/forum_edit.php']['parent']    = 'admin/forums.php';\r
+\r
+               $this->_pages['admin/forum_delete.php']['title_var'] = 'delete_forum';\r
+               $this->_pages['admin/forum_delete.php']['parent']    = 'admin/forums.php';\r
+}\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/forums/module.xml b/docs/mods/_standard/forums/module.xml
new file mode 100644 (file)
index 0000000..3b72bf4
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Forums</name> \r
+    <description lang="en">Instructors may create and manage forums for course discussion.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege>create</admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-26</date> \r
+        <state>stable</state> \r
+        <notes>This is a core module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/forums/module_delete.php b/docs/mods/_standard/forums/module_delete.php
new file mode 100644 (file)
index 0000000..2331fb9
--- /dev/null
@@ -0,0 +1,76 @@
+<?php\r
+\r
+function forums_delete($course) {\r
+       global $db;\r
+\r
+       $sql = "SELECT * FROM ".TABLE_PREFIX."forums_courses WHERE course_id=$course";\r
+       $f_result = mysql_query($sql, $db);\r
+       while ($forum = mysql_fetch_assoc($f_result)) {\r
+               $forum_id = $forum['forum_id'];\r
+               $sql = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."forums_courses WHERE forum_id=$forum_id";\r
+               $result = mysql_query($sql, $db);\r
+               $row = mysql_fetch_assoc($result);\r
+               if ($row['cnt'] == 1) {\r
+                       //debug('deleting non-shared forums');\r
+\r
+                       $sql    = "SELECT post_id FROM ".TABLE_PREFIX."forums_threads WHERE forum_id=$forum_id";\r
+                       $result = mysql_query($sql, $db);\r
+                       while ($row = mysql_fetch_assoc($result)) {\r
+                               $sql     = "DELETE FROM ".TABLE_PREFIX."forums_accessed WHERE post_id=$row[post_id]";\r
+                               $result2 = mysql_query($sql, $db);\r
+                       }\r
+\r
+                       $sql    = "DELETE FROM ".TABLE_PREFIX."forums_subscriptions WHERE forum_id=$forum_id";\r
+                       $result = mysql_query($sql, $db);\r
+\r
+                       $sql    = "DELETE FROM ".TABLE_PREFIX."forums_threads WHERE forum_id=$forum_id";\r
+                       $result = mysql_query($sql, $db);\r
+\r
+                       $sql    = "DELETE FROM ".TABLE_PREFIX."forums WHERE forum_id=$forum_id";\r
+                       $result = mysql_query($sql, $db);\r
+                       \r
+                       $sql = "DELETE FROM ".TABLE_PREFIX."forums_courses WHERE forum_id=$forum_id";\r
+                       $result = mysql_query($sql, $db);\r
+\r
+               } else if ($row['cnt'] > 1) {\r
+                       // this is a shared forum:\r
+                       // debug('unsubscribe all the students who will not be able to access this forum anymore.');\r
+                       $sql     = "SELECT course_id FROM ".TABLE_PREFIX."forums_courses WHERE forum_id=$forum[forum_id] AND course_id <> $course";\r
+                       $result2 = mysql_query($sql, $db);\r
+                       while ($row2 = mysql_fetch_assoc($result2)) {\r
+                               $courses[] = $row2['course_id'];\r
+                       }\r
+                       $courses_list = implode(',', $courses);\r
+\r
+                       // list of all the students who are in other courses as well\r
+                       $sql     = "SELECT member_id FROM ".TABLE_PREFIX."course_enrollment WHERE course_id IN ($courses_list)";\r
+                       $result2 = mysql_query($sql, $db);\r
+                       while ($row2 = mysql_fetch_assoc($result2)) {\r
+                               $students[] = $row2['member_id'];\r
+                       }\r
+\r
+                       $students_list = implode(',', $students);\r
+                       \r
+                       if ($students_list) {\r
+                               // remove the subscriptions\r
+                               $sql    = "SELECT post_id FROM ".TABLE_PREFIX."forums_threads WHERE forum_id=$forum[forum_id]";\r
+                               $result2 = mysql_query($sql, $db);\r
+                               while ($row2 = mysql_fetch_array($result2)) {\r
+                                       $sql     = "DELETE FROM ".TABLE_PREFIX."forums_accessed WHERE post_id=$row2[post_id] AND member_id NOT IN ($students_list)";\r
+                                       $result3 = mysql_query($sql, $db);\r
+                               }\r
+\r
+                               $sql     = "DELETE FROM ".TABLE_PREFIX."forums_subscriptions WHERE forum_id=$forum[forum_id] AND member_id NOT IN ($students_list)";\r
+                               $result3 = mysql_query($sql, $db);\r
+                       }\r
+\r
+                       $sql = "DELETE FROM ".TABLE_PREFIX."forums_courses WHERE forum_id=$forum[forum_id] AND course_id=$course";\r
+                       $result = mysql_query($sql, $db);\r
+               }\r
+       }\r
+\r
+       $sql = "OPTIMIZE TABLE ".TABLE_PREFIX."forums_threads";\r
+       $result = mysql_query($sql, $db);\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/links/module.php b/docs/mods/_standard/links/module.php
new file mode 100644 (file)
index 0000000..6d651b7
--- /dev/null
@@ -0,0 +1,44 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_LINKS', $this->getPrivilege());\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'links/index.php';\r
+\r
+$this->_pages['tools/links/index.php']['title_var'] = 'links';\r
+$this->_pages['tools/links/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/links/index.php']['children'] = array('tools/links/add.php', 'tools/links/categories.php', 'tools/links/categories_create.php');\r
+\r
+       $this->_pages['tools/links/add.php']['title_var']  = 'add_link';\r
+       $this->_pages['tools/links/add.php']['parent'] = 'tools/links/index.php';\r
+\r
+       $this->_pages['tools/links/edit.php']['title_var']  = 'edit_link';\r
+       $this->_pages['tools/links/edit.php']['parent'] = 'tools/links/index.php';\r
+\r
+       $this->_pages['tools/links/delete.php']['title_var']  = 'delete_link';\r
+       $this->_pages['tools/links/delete.php']['parent'] = 'tools/links/index.php';\r
+\r
+       $this->_pages['tools/links/categories.php']['title_var']  = 'categories';\r
+       $this->_pages['tools/links/categories.php']['parent'] = 'tools/links/index.php';\r
+\r
+       $this->_pages['tools/links/categories_create.php']['title_var']  = 'create_category';\r
+       $this->_pages['tools/links/categories_create.php']['parent'] = 'tools/links/index.php';\r
+\r
+       $this->_pages['tools/links/categories_edit.php']['title_var']  = 'edit_category';\r
+       $this->_pages['tools/links/categories_edit.php']['parent'] = 'tools/links/categories.php';\r
+\r
+       $this->_pages['tools/links/categories_delete.php']['title_var']  = 'delete_category';\r
+       $this->_pages['tools/links/categories_delete.php']['parent'] = 'tools/links/categories.php';\r
+\r
+//student pages\r
+$this->_pages['links/index.php']['title_var'] = 'links';\r
+$this->_pages['links/index.php']['children']  = array('links/add.php');\r
+$this->_pages['links/index.php']['img']       = 'images/home-links.gif';\r
+\r
+       $this->_pages['links/add.php']['title_var'] = 'suggest_link';\r
+       $this->_pages['links/add.php']['parent']    = 'links/index.php';\r
+\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/links/module.xml b/docs/mods/_standard/links/module.xml
new file mode 100644 (file)
index 0000000..9cc52f3
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Links</name> \r
+    <description lang="en">It may be a useful resource to provide a list of external links to websites related to course material.  Link categories can be defined and students may suggest links.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege></admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-22</date> \r
+        <state>stable</state> \r
+        <notes>This is a core module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/links/module_backup.php b/docs/mods/_standard/links/module_backup.php
new file mode 100644 (file)
index 0000000..d1fb06d
--- /dev/null
@@ -0,0 +1,39 @@
+<?php\r
+\r
+$sql = array();\r
+\r
+$sql['resource_categories'] = 'SELECT CatID, CatName, CatParent FROM '.TABLE_PREFIX.'resource_categories WHERE course_id=? ORDER BY CatID ASC';\r
+\r
+$sql['resource_links'] = 'SELECT L.CatID, Url, LinkName, Description, Approved, SubmitName, SubmitEmail, SubmitDate, hits FROM '.TABLE_PREFIX.'resource_links L, '.TABLE_PREFIX.'resource_categories C  WHERE C.course_id=? AND L.CatID=C.CatID ORDER BY LinkID ASC';\r
+\r
+\r
+\r
+function resource_categories_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0] = $row[0];\r
+       $new_row[1] = $course_id;\r
+       $new_row[2] = $row[1];\r
+       $new_row[3] = $row[2];\r
+\r
+       return $new_row;\r
+\r
+}\r
+\r
+function resource_links_convert($row, $course_id, $table_id_map, $version) {\r
+       static $i;\r
+\r
+       $new_row = array();\r
+       $new_row[0] = 0;\r
+       $new_row[1] = $table_id_map['resource_categories'][$row[0]];\r
+       $new_row[2] = $row[1];\r
+       $new_row[3] = $row[2];\r
+       $new_row[4] = $row[3];\r
+       $new_row[5] = $row[4];\r
+       $new_row[6] = $row[5];\r
+       $new_row[7] = $row[6];\r
+       $new_row[8] = $row[7];\r
+       $new_row[9] = $row[8];\r
+\r
+       return $new_row;\r
+}\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/links/module_delete.php b/docs/mods/_standard/links/module_delete.php
new file mode 100644 (file)
index 0000000..aaf6de1
--- /dev/null
@@ -0,0 +1,19 @@
+<?php\r
+\r
+function links_delete($course) {\r
+       global $db;\r
+\r
+       $sql    = "SELECT * FROM ".TABLE_PREFIX."resource_categories WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+       $total_links = 0;\r
+       while ($row = mysql_fetch_array($result)) {\r
+               $sql = "DELETE FROM ".TABLE_PREFIX."resource_links WHERE CatID=$row[0]";\r
+               $result2 = mysql_query($sql, $db);\r
+               $total_links += mysql_affected_rows($db);\r
+       }\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."resource_categories WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/polls/module.php b/docs/mods/_standard/polls/module.php
new file mode 100644 (file)
index 0000000..5afdfd3
--- /dev/null
@@ -0,0 +1,31 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_POLLS', $this->getPrivilege());\r
+\r
+//side dropdown\r
+$this->_stacks['poll'] = array('title_var'=>'poll','file'=>AT_INCLUDE_PATH.'html/dropdowns/poll.inc.php');\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'polls/index.php';\r
+\r
+$this->_pages['polls/index.php']['title_var'] = 'polls';\r
+$this->_pages['polls/index.php']['img']       = 'images/home-polls.gif';\r
+\r
+$this->_pages['tools/polls/index.php']['title_var'] = 'polls';\r
+$this->_pages['tools/polls/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/polls/index.php']['children']  = array('tools/polls/add.php');\r
+$this->_pages['tools/polls/index.php']['guide']     = 'instructor/?p=11.0.polls.php';\r
+\r
+       $this->_pages['tools/polls/add.php']['title_var'] = 'add_poll';\r
+       $this->_pages['tools/polls/add.php']['parent']    = 'tools/polls/index.php';\r
+\r
+       $this->_pages['tools/polls/edit.php']['title_var'] = 'edit_poll';\r
+       $this->_pages['tools/polls/edit.php']['parent']    = 'tools/polls/index.php';\r
+\r
+       $this->_pages['tools/polls/delete.php']['title_var'] = 'delete_poll';\r
+       $this->_pages['tools/polls/delete.php']['parent']    = 'tools/polls/index.php';\r
+\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/polls/module.xml b/docs/mods/_standard/polls/module.xml
new file mode 100644 (file)
index 0000000..9dfb4fe
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Polls</name> \r
+    <description lang="en">Polls are useful for quickly gathering course member opinions. Instructors and students with poll privileges can post a question with up to seven choices for answers.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege></admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-22</date> \r
+        <state>stable</state> \r
+        <notes>This is a core module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/polls/module_backup.php b/docs/mods/_standard/polls/module_backup.php
new file mode 100644 (file)
index 0000000..3208851
--- /dev/null
@@ -0,0 +1,37 @@
+<?php\r
+/* each table to be backed up. includes the sql entry and fields */\r
+\r
+$sql = array();\r
+$sql['polls'] = 'SELECT question, created_date, choice1, choice2, choice3, choice4, choice5, choice6, choice7 FROM '.TABLE_PREFIX.'polls WHERE course_id=?';\r
+\r
+/* the tables to be restored, the order matters! */\r
+/* the key must be the module directory name.    */\r
+/* a {table_name}Table class must exist that extends AbstractTable */\r
+       $restore_tables = array('polls');\r
+\r
+function polls_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0]  = 0;\r
+       $new_row[1]  = $course_id;\r
+       $new_row[2]  = $row[0];\r
+       $new_row[3]  = $row[1];\r
+       $new_row[4]  = 0;\r
+       $new_row[5]  = $row[2];\r
+       $new_row[6]  = 0;\r
+       $new_row[7]  = $row[3];\r
+       $new_row[8]  = 0;\r
+       $new_row[9]  = $row[4];\r
+       $new_row[10] = 0;\r
+       $new_row[11] = $row[5];\r
+       $new_row[12] = 0;\r
+       $new_row[13] = $row[6];\r
+       $new_row[14] = 0;\r
+       $new_row[15] = $row[7];\r
+       $new_row[16] = 0;\r
+       $new_row[17] = $row[8];\r
+       $new_row[18] = 0;\r
+\r
+       return $new_row;\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/polls/module_delete.php b/docs/mods/_standard/polls/module_delete.php
new file mode 100644 (file)
index 0000000..5b1d5ad
--- /dev/null
@@ -0,0 +1,19 @@
+<?php\r
+\r
+function polls_delete($course) {\r
+       global $db;\r
+\r
+       $sql    = "SELECT poll_id FROM ".TABLE_PREFIX."polls WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+       if (!$result) {\r
+               return;\r
+       }\r
+       while ($row = mysql_fetch_assoc($result)) {\r
+               $sql     = "DELETE FROM ".TABLE_PREFIX."polls_members WHERE poll_id=$row[poll_id]";\r
+               @mysql_query($sql, $db);\r
+       }\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."polls WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+}\r
+\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/tests/module.php b/docs/mods/_standard/tests/module.php
new file mode 100644 (file)
index 0000000..a7f4913
--- /dev/null
@@ -0,0 +1,94 @@
+<?php\r
+if (!defined('AT_INCLUDE_PATH')) { exit; }\r
+if (!isset($this) || (isset($this) && (strtolower(get_class($this)) != 'module'))) { exit(__FILE__ . ' is not a Module'); }\r
+\r
+define('AT_PRIV_TESTS', $this->getPrivilege());\r
+\r
+// if this module is to be made available to students on the Home or Main Navigation\r
+$_student_tool = 'tools/my_tests.php';\r
+\r
+$this->_pages['tools/tests/index.php']['title_var'] = 'tests';\r
+$this->_pages['tools/tests/index.php']['parent']    = 'tools/index.php';\r
+$this->_pages['tools/tests/index.php']['guide']     = 'instructor/?p=15.0.tests_surveys.php';\r
+$this->_pages['tools/tests/index.php']['children']  = array('tools/tests/create_test.php', 'tools/tests/question_db.php', 'tools/tests/question_cats.php');\r
+\r
+$this->_pages['tools/tests/create_test.php']['title_var'] = 'create_test';\r
+$this->_pages['tools/tests/create_test.php']['parent']    = 'tools/tests/index.php';\r
+$this->_pages['tools/tests/create_test.php']['guide']     = 'instructor/?p=15.1.creating_tests_surveys.php';\r
+\r
+$this->_pages['tools/tests/question_db.php']['title_var'] = 'question_database';\r
+$this->_pages['tools/tests/question_db.php']['parent']    = 'tools/tests/index.php';\r
+$this->_pages['tools/tests/question_db.php']['guide']     = 'instructor/?p=15.2.question_database.php';\r
+\r
+       $this->_pages['tools/tests/create_question_multi.php']['title_var'] = 'create_question_multi';\r
+       $this->_pages['tools/tests/create_question_multi.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+\r
+$this->_pages['tools/tests/question_cats.php']['title_var'] = 'question_categories';\r
+$this->_pages['tools/tests/question_cats.php']['parent']    = 'tools/tests/index.php';\r
+$this->_pages['tools/tests/question_cats.php']['children']  = array('tools/tests/question_cats_manage.php');\r
+$this->_pages['tools/tests/question_cats.php']['guide']     = 'instructor/?p=15.3.question_categories.php';\r
+\r
+$this->_pages['tools/tests/question_cats_manage.php']['title_var'] = 'create_category';\r
+$this->_pages['tools/tests/question_cats_manage.php']['parent']    = 'tools/tests/question_cats.php';\r
+\r
+$this->_pages['tools/tests/question_cats_delete.php']['title_var'] = 'delete_category';\r
+$this->_pages['tools/tests/question_cats_delete.php']['parent']    = 'tools/tests/question_cats.php';\r
+\r
+$this->_pages['tools/tests/edit_test.php']['title_var'] = 'edit_test';\r
+$this->_pages['tools/tests/edit_test.php']['parent']    = 'tools/tests/index.php';\r
+\r
+$this->_pages['tools/tests/preview.php']['title_var'] = 'preview_questions';\r
+$this->_pages['tools/tests/preview.php']['parent']    = 'tools/tests/index.php';\r
+$this->_pages['tools/tests/preview.php']['guide']     = 'instructor/?p=15.5.preview.php';\r
+\r
+$this->_pages['tools/tests/preview_question.php']['title_var'] = 'preview';\r
+$this->_pages['tools/tests/preview_question.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+$this->_pages['tools/tests/results.php']['title_var'] = 'submissions';\r
+$this->_pages['tools/tests/results.php']['parent']    = 'tools/tests/index.php';\r
+\r
+$this->_pages['tools/tests/results_all.php']['guide'] = 'instructor/?p=15.7.student_submissions.php';\r
+\r
+//$this->_pages['tools/tests/results_all_quest.php']['title_var']  =  _AT('question')." "._AT('statistics');\r
+//$this->_pages['tools/tests/results_all_quest.php']['parent'] = 'tools/tests/index.php';\r
+$this->_pages['tools/tests/results_all_quest.php']['guide']     = 'instructor/?p=15.8.statistics.php';\r
+\r
+$this->_pages['tools/tests/delete_test.php']['title_var'] = 'delete_test';\r
+$this->_pages['tools/tests/delete_test.php']['parent']    = 'tools/tests/index.php';\r
+\r
+$this->_pages['tools/view_results.php']['title_var'] = 'view_results';\r
+$this->_pages['tools/view_results.php']['parent']    = 'tools/my_tests.php';\r
+\r
+       // test questions\r
+       $this->_pages['tools/tests/create_question_tf.php']['title_var'] = 'create_new_question';\r
+       $this->_pages['tools/tests/create_question_tf.php']['parent']    = 'tools/tests/question_db.php';\r
+       \r
+       $this->_pages['tools/tests/create_question_multi.php']['title_var'] = 'create_new_question';\r
+       $this->_pages['tools/tests/create_question_multi.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+       $this->_pages['tools/tests/create_question_long.php']['title_var'] = 'create_new_question';\r
+       $this->_pages['tools/tests/create_question_long.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+       $this->_pages['tools/tests/create_question_likert.php']['title_var'] = 'create_new_question';\r
+       $this->_pages['tools/tests/create_question_likert.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+       $this->_pages['tools/tests/edit_question_tf.php']['title_var'] = 'edit_question';\r
+       $this->_pages['tools/tests/edit_question_tf.php']['parent']    = 'tools/tests/question_db.php';\r
+       \r
+       $this->_pages['tools/tests/edit_question_multi.php']['title_var'] = 'edit_question';\r
+       $this->_pages['tools/tests/edit_question_multi.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+       $this->_pages['tools/tests/edit_question_long.php']['title_var'] = 'edit_question';\r
+       $this->_pages['tools/tests/edit_question_long.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+       $this->_pages['tools/tests/edit_question_likert.php']['title_var'] = 'edit_question';\r
+       $this->_pages['tools/tests/edit_question_likert.php']['parent']    = 'tools/tests/question_db.php';\r
+\r
+$this->_pages['tools/take_test.php']['title_var'] = 'take_test';\r
+$this->_pages['tools/take_test.php']['parent']    = 'tools/my_tests.php';\r
+\r
+//student page\r
+$this->_pages['tools/my_tests.php']['title_var'] = 'my_tests';\r
+$this->_pages['tools/my_tests.php']['img']       = 'images/home-tests.gif';\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/tests/module.xml b/docs/mods/_standard/tests/module.xml
new file mode 100644 (file)
index 0000000..2d9d8e7
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?> \r
+<module version="0.1"> \r
+    <name lang="en">Tests</name> \r
+    <description lang="en">This is a large module that allows instructors to create tests and surveys for students with various question types and weights.</description> \r
+    <maintainers>\r
+        <maintainer> \r
+            <name>ATutor Team</name> \r
+            <email>info@atutor.ca</email> \r
+        </maintainer>\r
+    </maintainers> \r
+    <url>http://atutor.ca</url> \r
+    <license>GPL</license> \r
+       <release> \r
+        <version>0.1</version> \r
+               <privileges>\r
+                       <instructor_privilege>create</instructor_privilege>\r
+                       <admin_privilege></admin_privilege> \r
+               </privileges>\r
+        <date>2005-08-25</date> \r
+        <state>stable</state> \r
+        <notes>This is a standard module.</notes> \r
+    </release> \r
+</module>
\ No newline at end of file
diff --git a/docs/mods/_standard/tests/module_backup.php b/docs/mods/_standard/tests/module_backup.php
new file mode 100644 (file)
index 0000000..45bab85
--- /dev/null
@@ -0,0 +1,88 @@
+<?php\r
+\r
+$sql = array();\r
+\r
+$sql['tests'] = 'SELECT test_id, title, format, start_date, end_date, randomize_order, num_questions, instructions, content_id, result_release, random, difficulty, num_takes, anonymous, out_of FROM '.TABLE_PREFIX.'tests WHERE course_id=? ORDER BY test_id ASC';\r
+\r
+$sql['tests_questions_categories'] = 'SELECT category_id, title FROM '.TABLE_PREFIX.'tests_questions_categories WHERE course_id=?';\r
+\r
+$sql['tests_questions'] = 'SELECT question_id, category_id, type, feedback, question, choice_0, choice_1, choice_2, choice_3, choice_4, choice_5, choice_6, choice_7, choice_8, choice_9, answer_0, answer_1, answer_2, answer_3, answer_4, answer_5, answer_6, answer_7, answer_8, answer_9, properties, content_id FROM '.TABLE_PREFIX.'tests_questions WHERE course_id=?';\r
+\r
+$sql['tests_questions_assoc'] = 'SELECT TQ.test_id, question_id, weight, ordering, required FROM '.TABLE_PREFIX.'tests_questions_assoc TQ, '.TABLE_PREFIX.'tests T WHERE T.course_id=? AND T.test_id=TQ.test_id ORDER BY TQ.test_id';\r
+\r
+function tests_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0]  = $row[0];\r
+       $new_row[1]  = $course_id;\r
+       $new_row[2]  = $row[1];\r
+       $new_row[3]  = $row[2];\r
+       $new_row[4]  = $row[3];\r
+       $new_row[5]  = $row[4];\r
+       $new_row[6]  = $row[5];\r
+       $new_row[7]  = $row[6];\r
+       $new_row[8]  = $row[7];\r
+       $new_row[9]  = 0;\r
+       $new_row[10] = $row[9]  ? $row[9]  : 0;\r
+       $new_row[11] = $row[10] ? $row[10] : 0;\r
+       $new_row[12] = $row[11] ? $row[11] : 0;\r
+       $new_row[13] = $row[12] ? $row[12] : 0;\r
+       $new_row[14] = $row[13] ? $row[13] : 0;\r
+       $new_row[15] = $row[14] ? $row[14] : 0;\r
+\r
+       return $new_row;\r
+}\r
+\r
+function tests_questions_categories_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0] = $row[0];\r
+       $new_row[1] = $course_id;\r
+       $new_row[2] = $row[1];\r
+\r
+       return $new_row;\r
+}\r
+\r
+function tests_questions_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0]  = $row[0];\r
+       $new_row[1]  = $table_id_map['tests_questions_categories'][$row[1]];\r
+       $new_row[2]  = $course_id;\r
+       $new_row[3]  = $row[2];\r
+       $new_row[4]  = $row[3];\r
+       $new_row[5]  = $row[4];\r
+       $new_row[6]  = $row[5];\r
+       $new_row[7]  = $row[6];\r
+       $new_row[8]  = $row[7];\r
+       $new_row[9]  = $row[8];\r
+       $new_row[10] = $row[9];\r
+       $new_row[11] = $row[10];\r
+       $new_row[12] = $row[11];\r
+       $new_row[13] = $row[12];\r
+       $new_row[14] = $row[13];\r
+       $new_row[15] = $row[14];\r
+       $new_row[16] = $row[15];\r
+       $new_row[17] = $row[16];\r
+       $new_row[18] = $row[17];\r
+       $new_row[19] = $row[18];\r
+       $new_row[20] = $row[19];\r
+       $new_row[21] = $row[20];\r
+       $new_row[22] = $row[21];\r
+       $new_row[23] = $row[22];\r
+       $new_row[24] = $row[23];\r
+       $new_row[25] = $row[24];\r
+       $new_row[26] = $row[25];\r
+       $new_row[27] = $row[26];\r
+\r
+       return $new_row;\r
+}\r
+\r
+function tests_questions_assoc_convert($row, $course_id, $table_id_map, $version) {\r
+       $new_row = array();\r
+       $new_row[0] = $table_id_map['tests'][$row[0]];\r
+       $new_row[1] = $table_id_map['tests_questions'][$row[1]];\r
+       $new_row[2] = $row[2];\r
+       $new_row[3] = $row[3];\r
+       $new_row[4] = $row[4];\r
+\r
+       return $new_row;\r
+}\r
+?>
\ No newline at end of file
diff --git a/docs/mods/_standard/tests/module_delete.php b/docs/mods/_standard/tests/module_delete.php
new file mode 100644 (file)
index 0000000..bb0b22b
--- /dev/null
@@ -0,0 +1,36 @@
+<?php\r
+\r
+function tests_delete($course) {\r
+       global $db;\r
+\r
+       $sql    = "SELECT test_id FROM ".TABLE_PREFIX."tests WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+       while ($row = mysql_fetch_assoc($result)) {\r
+               $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc WHERE test_id=$row[test_id]";\r
+               $result2 = mysql_query($sql, $db);\r
+       \r
+               $sql2   = "SELECT result_id FROM ".TABLE_PREFIX."tests_results WHERE test_id=$row[test_id]";\r
+               $result2 = mysql_query($sql2, $db);\r
+               while ($row2 = mysql_fetch_assoc($result2)) {\r
+                       $sql3   = "DELETE FROM ".TABLE_PREFIX."tests_answers WHERE result_id=$row2[result_id]";\r
+                       $result3 = mysql_query($sql3, $db);\r
+               }\r
+               $sql    = "DELETE FROM ".TABLE_PREFIX."tests_results WHERE test_id=$row[test_id]";\r
+               $result2 = mysql_query($sql, $db);\r
+\r
+               $sql    = "DELETE FROM ".TABLE_PREFIX."tests_groups WHERE test_id=$row[test_id]";\r
+               $result2 = mysql_query($sql, $db);\r
+       }\r
+\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+\r
+       $sql    = "DELETE FROM ".TABLE_PREFIX."tests WHERE course_id=$course";\r
+       $result = mysql_query($sql, $db);\r
+\r
+}\r
+\r
+?>
\ No newline at end of file