diff --git a/main/course_info/maintenance.php b/main/course_info/maintenance.php
index efae8c1232..8e96f19bf9 100644
--- a/main/course_info/maintenance.php
+++ b/main/course_info/maintenance.php
@@ -47,10 +47,6 @@ api_display_tool_title($nameTools);
?>
-
-
-
-
-
-
-
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/main/coursecopy/classes/CourseRestorer.class.php b/main/coursecopy/classes/CourseRestorer.class.php
index 45154814ea..ae5f91cbf9 100644
--- a/main/coursecopy/classes/CourseRestorer.class.php
+++ b/main/coursecopy/classes/CourseRestorer.class.php
@@ -1,4 +1,4 @@
-course->destination_db);
$resources = $this->course->resources;
+ $destination_course['dbName']= $this->course->destination_db;
+
foreach ($resources[RESOURCE_DOCUMENT] as $id => $document)
- {
+ {
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
$perm = api_get_setting('permissions_for_new_directories');
- $perm = octdec(!empty($perm)?$perm:'0770');
- mkdirr(dirname($path.$document->path),$perm);
+ $perm = octdec(!empty($perm)?$perm:0770);
+ $dirs = explode('/', dirname($document->path));
+
+ $my_temp = '';
+ for ($i=1; $ifile_type == DOCUMENT)
{
if (file_exists($path.$document->path))
diff --git a/main/coursecopy/classes/CourseSelectForm.class.php b/main/coursecopy/classes/CourseSelectForm.class.php
index 7024d22753..1b01bddf74 100644
--- a/main/coursecopy/classes/CourseSelectForm.class.php
+++ b/main/coursecopy/classes/CourseSelectForm.class.php
@@ -1,5 +1,5 @@
';
echo '';
- echo '';
+
foreach ($course->resources as $type => $resources)
{
if (count($resources) > 0)
@@ -148,6 +148,11 @@ class CourseSelectForm
}
}
}
+
+ //Documents are avoided due the huge moun of memory that serialize function eats (when there are directories with hundred of files)
+ $course->resources['document']= null;
+ echo '';
+
if (is_array($hidden_fields))
{
foreach ($hidden_fields as $key => $value)
@@ -213,6 +218,32 @@ class CourseSelectForm
function get_posted_course()
{
$course = unserialize(base64_decode($_POST['course']));
+
+ //Create the resource DOCUMENT objects
+ //Loading the results from the checkboxes of the javascript
+ $resource = $_POST['resource'][RESOURCE_DOCUMENT];
+ $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
+ $table_prop = Database :: get_course_table(TABLE_ITEM_PROPERTY);
+ $resource = array_keys($resource);
+ foreach ($resource as $resource_item) {
+ $sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 AND id = '.$resource_item.' ORDER BY path';
+ $db_result = api_sql_query($sql, __FILE__, __LINE__);
+ while ($obj = Database::fetch_object($db_result)) {
+ $doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
+ $course->add_resource($doc);
+
+ // adding item property
+ $sql = "SELECT * FROM $table_prop WHERE TOOL = '".RESOURCE_DOCUMENT."' AND ref='".$resource_item."'";
+ $res = api_sql_query($sql,__FILE__,__LINE__);
+ $all_properties = array ();
+ while ($item_property = Database::fetch_array($res,'ASSOC')) {
+ $all_properties[] = $item_property;
+ }
+ $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties;
+ }
+ }
+
+
foreach ($course->resources as $type => $resources)
{
switch ($type)
@@ -62,14 +58,17 @@ api_display_tool_title($nameTools);