Пример #1
0
            $dt_import = new DiscussionToolsImport();
            //if this forum has not been added, parse it and add it.
            if (!isset($added_dt[$forum_ref])) {
                $xml_content = @file_get_contents($import_path . $forum_link);
                $dt_parser->parse($xml_content);
                $forum_obj = $dt_parser->getDt();
                $dt_import->import($forum_obj, $items[$item_id]['real_content_id']);
                $added_dt[$forum_ref] = $dt_import->getFid();
            }
            //associate the fid and content id
            $dt_import->associateForum($items[$item_id]['real_content_id'], $added_dt[$forum_ref]);
        }
    } elseif ($items[$item_id]['type'] == 'imsdt_xmlv1p0') {
        //optimize this, repeated codes as above
        $dt_parser = new DiscussionToolsParser();
        $dt_import = new DiscussionToolsImport();
        $xml_content = @file_get_contents($import_path . $content_info['href']);
        $dt_parser->parse($xml_content);
        $forum_obj = $dt_parser->getDt();
        $dt_import->import($forum_obj, $items[$item_id]['real_content_id']);
        $added_dt[$item_id] = $dt_import->getFid();
        //associate the fid and content id
        $dt_import->associateForum($items[$item_id]['real_content_id'], $added_dt[$item_id]);
    }
}
//exit;//harris
if ($package_base_path == '.') {
    $package_base_path = '';
}
// loop through the files outside the package folder, and copy them to its relative path
/**
Пример #2
0
        foreach ($items[$item_id]['forum'] as $forum_ref => $forum_link) {
            $dt_parser = new DiscussionToolsParser();
            $dt_import = new DiscussionToolsImport();
            //if this forum has not been added, parse it and add it.
            if (!isset($added_dt[$forum_ref])) {
                $xml_content = @file_get_contents($import_path . $forum_link);
                $dt_parser->parse($xml_content);
                $forum_obj = $dt_parser->getDt();
                $dt_import->import($forum_obj, $items[$item_id]['real_content_id'], $_course_id);
                $added_dt[$forum_ref] = $dt_import->getFid();
            }
        }
    } elseif ($items[$item_id]['type'] == 'imsdt_xmlv1p0') {
        //optimize this, repeated codes as above
        $dt_parser = new DiscussionToolsParser();
        $dt_import = new DiscussionToolsImport();
        $xml_content = @file_get_contents($import_path . $content_info['href']);
        $dt_parser->parse($xml_content);
        $forum_obj = $dt_parser->getDt();
        $dt_import->import($forum_obj, $items[$item_id]['real_content_id'], $_course_id);
        $added_dt[$item_id] = $dt_import->getFid();
    }
}
//exit;//harris
if ($package_base_path == '.') {
    $package_base_path = '';
}
// create course directory
if (!is_dir($course_dir)) {
    if (!@mkdir($course_dir, 0700)) {
        $msg->addError('IMPORTDIR_FAILED');