2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
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 /************************************************************************/
13 include(TR_INCLUDE_PATH.'classes/DAO/ForumsDAO.class.php');
14 include(TR_INCLUDE_PATH.'classes/DAO/ForumsCoursesDAO.class.php');
15 include(TR_INCLUDE_PATH.'classes/DAO/ContentForumsAssocDAO.class.php');
18 * A class for DiscussionToolsParser
20 * http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_5/imsdt_v1p0_localised.xsd
22 class DiscussionToolsImport {
24 var $fid; //the forum id that is imported
27 function DiscussionToolsImport(){}
30 function import($forum_obj, $cid, $course_id){
31 $title = $forum_obj->getTitle();
32 $text = $forum_obj->getText();
34 $this->fid = $this->createForum($title, $text, $course_id);
35 $this->associateForum($cid, $this->fid);
42 * @param string text/description
43 * @return added forum's id
45 function createForum($title, $text, $course_id){
46 $forumsDAO = new ForumsDAO();
47 $forums_id = $forumsDAO->Create($title, $text);
49 $forumsCoursesDAO = new ForumsCoursesDAO();
50 $forumsCoursesDAO->Create($forums_id, $course_id);
57 * create an association between forum and content
58 * @param int content id
61 function associateForum($cid, $fid){
62 $contentForumsAssocDAO = new ContentForumsAssocDAO();
63 return $contentForumsAssocDAO->Create($cid, $fid);
67 * Return the fid that was created by this import
68 * @return int forum id.