2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2009 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
15 include(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
17 * A class for DiscussionToolsParser
19 * http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_5/imsdt_v1p0_localised.xsd
21 class DiscussionToolsImport {
23 var $fid; //the forum id that is imported
26 function DiscussionToolsImport(){}
29 function import($forum_obj){
30 $title = $forum_obj->getTitle();
31 $text = $forum_obj->getText();
33 $this->fid = $this->createForum($title, $text);
34 $this->associateForum($cid, $this->fid);
41 * @param string text/description
42 * @return added forum's id
44 function createForum($title, $text){
47 $temp['title'] = $title;
48 $temp['body'] = $text;
49 $temp['edit'] = 0; //default 0 minutes
51 add_forum($temp); //check forums.inc.php
53 $sql = 'SELECT MAX(forum_id) FROM '.TABLE_PREFIX.'forums';
54 $result = mysql_query($sql, $db);
55 $row = mysql_fetch_row($result);
61 * create an association between forum and content
62 * @param int content id
65 function associateForum($cid, $fid){
67 $sql = 'INSERT INTO '.TABLE_PREFIX."content_forums_assoc (content_id, forum_id) VALUES ($cid, $fid)";
68 mysql_query($sql, $db);
72 * Return the fid that was created by this import
73 * @return int forum id.