|
|
@ -63,7 +63,7 @@ class CourseRestorer |
|
|
|
'course_descriptions', |
|
|
|
'course_descriptions', |
|
|
|
'documents', |
|
|
|
'documents', |
|
|
|
'events', |
|
|
|
'events', |
|
|
|
// 'forum_category', |
|
|
|
'forum_category', |
|
|
|
'forums', |
|
|
|
'forums', |
|
|
|
// 'forum_topics', |
|
|
|
// 'forum_topics', |
|
|
|
'glossary', |
|
|
|
'glossary', |
|
|
@ -751,39 +751,38 @@ class CourseRestorer |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Restore forum-categories |
|
|
|
* Restore forum-categories |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function restore_forum_category($id) { |
|
|
|
function restore_forum_category($my_id = null) { |
|
|
|
$forum_cat_table = Database :: get_course_table(TABLE_FORUM_CATEGORY); |
|
|
|
$forum_cat_table = Database :: get_course_table(TABLE_FORUM_CATEGORY); |
|
|
|
$resources = $this->course->resources; |
|
|
|
$resources = $this->course->resources; |
|
|
|
$forum_cat = $resources[RESOURCE_FORUMCATEGORY][$id]; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($resources[RESOURCE_FORUMCATEGORY] as $id => $forum_cat) { |
|
|
|
if ($forum_cat && !$forum_cat->is_restored()) { |
|
|
|
if (!empty($my_id)) { |
|
|
|
$title = $forum_cat->obj->cat_title; |
|
|
|
if ($id != $my_id) { |
|
|
|
if (!empty($title)) { |
|
|
|
continue; |
|
|
|
if (!preg_match('/.*\((.+)\)$/', $title, $matches)) { |
|
|
|
} |
|
|
|
// This is for avoiding repetitive adding of training code after several backup/restore cycles. |
|
|
|
} |
|
|
|
if ($matches[1] != $this->course->code) { |
|
|
|
if (!$forum_cat->is_restored()) { |
|
|
|
$title = $title.' ('.$this->course->code.')'; |
|
|
|
$title = $forum_cat->obj->cat_title; |
|
|
|
} |
|
|
|
if (!empty($title)) { |
|
|
|
} |
|
|
|
if (!preg_match('/.*\((.+)\)$/', $title, $matches)) { |
|
|
|
} |
|
|
|
// This is for avoiding repetitive adding of training code after several backup/restore cycles. |
|
|
|
$params = (array) $forum_cat->obj; |
|
|
|
if ($matches[1] != $this->course->code) { |
|
|
|
$params['c_id'] = $this->destination_course_id; |
|
|
|
$title = $title.' ('.$this->course->code.')'; |
|
|
|
unset($params['cat_id']); |
|
|
|
} |
|
|
|
self::DBUTF8_array($params); |
|
|
|
} |
|
|
|
$new_id = Database::insert($forum_cat_table, $params); |
|
|
|
} |
|
|
|
/* |
|
|
|
$params = (array) $forum_cat->obj; |
|
|
|
$sql = "INSERT INTO ".$forum_cat_table." SET |
|
|
|
$params['c_id'] = $this->destination_course_id; |
|
|
|
c_id = ".$this->destination_course_id." , |
|
|
|
unset($params['cat_id']); |
|
|
|
cat_title = '".self::DBUTF8escapestring($title). |
|
|
|
self::DBUTF8_array($params); |
|
|
|
"', cat_comment = '".self::DBUTF8escapestring($forum_cat->description). |
|
|
|
$new_id = Database::insert($forum_cat_table, $params); |
|
|
|
"', cat_order = ".(int)self::DBUTF8escapestring($forum_cat->order). |
|
|
|
if (!empty($my_id)) { |
|
|
|
", locked = ".(int)self::DBUTF8escapestring($forum_cat->locked). |
|
|
|
return $new_id; |
|
|
|
", session_id = ".(int)self::DBUTF8escapestring($forum_cat->session_id); |
|
|
|
} |
|
|
|
Database::query($sql);*/ |
|
|
|
$this->course->resources[RESOURCE_FORUMCATEGORY][$id]->destination_id = $new_id; |
|
|
|
$this->course->resources[RESOURCE_FORUMCATEGORY][$id]->destination_id = $new_id; |
|
|
|
} |
|
|
|
return $new_id; |
|
|
|
$this->course->resources[RESOURCE_FORUMCATEGORY][$id]->destination_id; |
|
|
|
} |
|
|
|
} |
|
|
|
return $this->course->resources[RESOURCE_FORUMCATEGORY][$id]->destination_id; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|