@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | while (($file = readdir($handle)) !== false) { |
24 | 24 | if ($file != "." && $file != ".." && |
25 | 25 | strpos($file, 'CourseArchiver_') === 0 && |
26 | - is_dir($dir . '/' . $file) |
|
26 | + is_dir($dir.'/'.$file) |
|
27 | 27 | ) { |
28 | - rmdirr($dir . '/' . $file); |
|
28 | + rmdirr($dir.'/'.$file); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | closedir($handle); |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | CourseArchiver::clean_backup_dir(); |
44 | 44 | |
45 | 45 | // Create a temp directory |
46 | - $tmp_dir_name = 'CourseArchiver_' . api_get_unique_id(); |
|
47 | - $backup_dir = api_get_path(SYS_ARCHIVE_PATH) . $tmp_dir_name . '/'; |
|
46 | + $tmp_dir_name = 'CourseArchiver_'.api_get_unique_id(); |
|
47 | + $backup_dir = api_get_path(SYS_ARCHIVE_PATH).$tmp_dir_name.'/'; |
|
48 | 48 | |
49 | 49 | // All course-information will be stored in course_info.dat |
50 | - $course_info_file = $backup_dir . 'course_info.dat'; |
|
50 | + $course_info_file = $backup_dir.'course_info.dat'; |
|
51 | 51 | $zip_dir = api_get_path(SYS_ARCHIVE_PATH); |
52 | 52 | $user = api_get_user_info(); |
53 | 53 | $date = new DateTime(api_get_local_time()); |
54 | - $zip_file = $user['user_id'] . '_' . $course->code . '_' . $date->format('Ymd-His') . '.zip'; |
|
54 | + $zip_file = $user['user_id'].'_'.$course->code.'_'.$date->format('Ymd-His').'.zip'; |
|
55 | 55 | $php_errormsg = ''; |
56 | 56 | $res = @mkdir($backup_dir, $perm_dirs); |
57 | 57 | if ($res === false) { |
58 | 58 | //TODO set and handle an error message telling the user to review the permissions on the archive directory |
59 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini') . ' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0); |
|
59 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0); |
|
60 | 60 | } |
61 | 61 | // Write the course-object to the file |
62 | 62 | $fp = @fopen($course_info_file, 'w'); |
63 | 63 | if ($fp === false) { |
64 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
64 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $res = @fwrite($fp, base64_encode(serialize($course))); |
68 | 68 | if ($res === false) { |
69 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
69 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $res = @fclose($fp); |
73 | 73 | if ($res === false) { |
74 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
74 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Copy all documents to the temp-dir |
78 | 78 | if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { |
79 | 79 | foreach ($course->resources[RESOURCE_DOCUMENT] as $document) { |
80 | 80 | if ($document->file_type == DOCUMENT) { |
81 | - $doc_dir = $backup_dir . $document->path; |
|
81 | + $doc_dir = $backup_dir.$document->path; |
|
82 | 82 | @mkdir(dirname($doc_dir), $perm_dirs, true); |
83 | - if (file_exists($course->path . $document->path)) { |
|
84 | - copy($course->path . $document->path, $doc_dir); |
|
83 | + if (file_exists($course->path.$document->path)) { |
|
84 | + copy($course->path.$document->path, $doc_dir); |
|
85 | 85 | } |
86 | 86 | } else { |
87 | - @mkdir($backup_dir . $document->path, $perm_dirs, true); |
|
87 | + @mkdir($backup_dir.$document->path, $perm_dirs, true); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -92,49 +92,49 @@ discard block |
||
92 | 92 | // Copy all scorm documents to the temp-dir |
93 | 93 | if (isset($course->resources[RESOURCE_SCORM]) && is_array($course->resources[RESOURCE_SCORM])) { |
94 | 94 | foreach ($course->resources[RESOURCE_SCORM] as $document) { |
95 | - $doc_dir = dirname($backup_dir . $document->path); |
|
95 | + $doc_dir = dirname($backup_dir.$document->path); |
|
96 | 96 | @mkdir($doc_dir, $perm_dirs, true); |
97 | - copyDirTo($course->path . $document->path, $doc_dir, false); |
|
97 | + copyDirTo($course->path.$document->path, $doc_dir, false); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | // Copy calendar attachments. |
102 | 102 | |
103 | 103 | if (isset($course->resources[RESOURCE_EVENT]) && is_array($course->resources[RESOURCE_EVENT])) { |
104 | - $doc_dir = dirname($backup_dir . '/upload/calendar/'); |
|
104 | + $doc_dir = dirname($backup_dir.'/upload/calendar/'); |
|
105 | 105 | @mkdir($doc_dir, $perm_dirs, true); |
106 | - copyDirTo($course->path . 'upload/calendar/', $doc_dir, false); |
|
106 | + copyDirTo($course->path.'upload/calendar/', $doc_dir, false); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // Copy Learning path author image. |
110 | 110 | if (isset($course->resources[RESOURCE_LEARNPATH]) && is_array($course->resources[RESOURCE_LEARNPATH])) { |
111 | - $doc_dir = dirname($backup_dir . '/upload/learning_path/'); |
|
111 | + $doc_dir = dirname($backup_dir.'/upload/learning_path/'); |
|
112 | 112 | @mkdir($doc_dir, $perm_dirs, true); |
113 | - copyDirTo($course->path . 'upload/learning_path/', $doc_dir, false); |
|
113 | + copyDirTo($course->path.'upload/learning_path/', $doc_dir, false); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // Copy announcements attachments. |
117 | 117 | if (isset($course->resources[RESOURCE_ANNOUNCEMENT]) && is_array($course->resources[RESOURCE_ANNOUNCEMENT])) { |
118 | - $doc_dir = dirname($backup_dir . '/upload/announcements/'); |
|
118 | + $doc_dir = dirname($backup_dir.'/upload/announcements/'); |
|
119 | 119 | @mkdir($doc_dir, $perm_dirs, true); |
120 | - copyDirTo($course->path . 'upload/announcements/', $doc_dir, false); |
|
120 | + copyDirTo($course->path.'upload/announcements/', $doc_dir, false); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Copy work folders (only folders) |
124 | 124 | if (isset($course->resources[RESOURCE_WORK]) && is_array($course->resources[RESOURCE_WORK])) { |
125 | - $doc_dir = dirname($backup_dir . '/upload/work/'); |
|
125 | + $doc_dir = dirname($backup_dir.'/upload/work/'); |
|
126 | 126 | @mkdir($doc_dir, $perm_dirs, true); |
127 | 127 | // @todo: adjust to only create subdirs, but not copy files |
128 | - copyDirTo($course->path . 'upload/work/', $doc_dir, false); |
|
128 | + copyDirTo($course->path.'upload/work/', $doc_dir, false); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Zip the course-contents |
132 | - $zip = new PclZip($zip_dir . $zip_file); |
|
133 | - $zip->create($zip_dir . $tmp_dir_name, PCLZIP_OPT_REMOVE_PATH, $zip_dir . $tmp_dir_name . '/'); |
|
132 | + $zip = new PclZip($zip_dir.$zip_file); |
|
133 | + $zip->create($zip_dir.$tmp_dir_name, PCLZIP_OPT_REMOVE_PATH, $zip_dir.$tmp_dir_name.'/'); |
|
134 | 134 | //$zip->deleteByIndex(0); |
135 | 135 | // Remove the temp-dir. |
136 | 136 | rmdirr($backup_dir); |
137 | - return '' . $zip_file; |
|
137 | + return ''.$zip_file; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | global $dateTimeFormatLong; |
147 | 147 | $backup_files = array(); |
148 | - $dirname = api_get_path(SYS_ARCHIVE_PATH) . ''; |
|
148 | + $dirname = api_get_path(SYS_ARCHIVE_PATH).''; |
|
149 | 149 | if ($dir = opendir($dirname)) { |
150 | 150 | while (($file = readdir($dir)) !== false) { |
151 | 151 | $file_parts = explode('_', $file); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $date = $file_parts[0]; |
157 | 157 | $ext = isset($file_parts[1]) ? $file_parts[1] : null; |
158 | 158 | if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) { |
159 | - $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2) . ' ' . substr($date, 9, 2) . ':' . substr($date, 11, 2) . ':' . substr($date, 13, 2); |
|
159 | + $date = substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.substr($date, 6, 2).' '.substr($date, 9, 2).':'.substr($date, 11, 2).':'.substr($date, 13, 2); |
|
160 | 160 | $backup_files[] = array( |
161 | 161 | 'file' => $file, |
162 | 162 | 'date' => $date, |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public static function import_uploaded_file($file) |
179 | 179 | { |
180 | - $new_filename = uniqid('') . '.zip'; |
|
180 | + $new_filename = uniqid('').'.zip'; |
|
181 | 181 | $new_dir = api_get_path(SYS_ARCHIVE_PATH); |
182 | 182 | if (is_dir($new_dir) && is_writable($new_dir)) { |
183 | 183 | move_uploaded_file($file, api_get_path(SYS_ARCHIVE_PATH).$new_filename); |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | { |
201 | 201 | CourseArchiver::clean_backup_dir(); |
202 | 202 | // Create a temp directory |
203 | - $tmp_dir_name = 'CourseArchiver_' . uniqid(''); |
|
204 | - $unzip_dir = api_get_path(SYS_ARCHIVE_PATH) . '' . $tmp_dir_name; |
|
203 | + $tmp_dir_name = 'CourseArchiver_'.uniqid(''); |
|
204 | + $unzip_dir = api_get_path(SYS_ARCHIVE_PATH).''.$tmp_dir_name; |
|
205 | 205 | @mkdir($unzip_dir, api_get_permissions_for_new_directories(), true); |
206 | - @copy(api_get_path(SYS_ARCHIVE_PATH) . '' . $filename, $unzip_dir . '/backup.zip'); |
|
206 | + @copy(api_get_path(SYS_ARCHIVE_PATH).''.$filename, $unzip_dir.'/backup.zip'); |
|
207 | 207 | // unzip the archive |
208 | - $zip = new PclZip($unzip_dir . '/backup.zip'); |
|
208 | + $zip = new PclZip($unzip_dir.'/backup.zip'); |
|
209 | 209 | @chdir($unzip_dir); |
210 | 210 | $zip->extract(PCLZIP_OPT_TEMP_FILE_ON); |
211 | 211 | // remove the archive-file |
212 | 212 | if ($delete) { |
213 | - @unlink(api_get_path(SYS_ARCHIVE_PATH) . '' . $filename); |
|
213 | + @unlink(api_get_path(SYS_ARCHIVE_PATH).''.$filename); |
|
214 | 214 | } |
215 | 215 | // read the course |
216 | 216 | if (!is_file('course_info.dat')) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct($id, $path, $title) |
23 | 23 | { |
24 | - parent::__construct($id,RESOURCE_SCORM); |
|
24 | + parent::__construct($id, RESOURCE_SCORM); |
|
25 | 25 | $this->path = 'scorm'.$path; |
26 | 26 | $this->title = $title; |
27 | 27 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | echo $path; |
37 | 37 | if (!empty($this->title)) { |
38 | 38 | if (strpos($path, $this->title) === false) { |
39 | - echo " - " . $this->title; |
|
39 | + echo " - ".$this->title; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | if (is_array($resources)) { |
41 | 41 | foreach ($resources as $resource) { |
42 | 42 | Coursecopy\Resource::setClassType($resource); |
43 | - if ($resource->links_to($resource_to_check) ) { |
|
43 | + if ($resource->links_to($resource_to_check)) { |
|
44 | 44 | return true; |
45 | 45 | } |
46 | - if ($type == RESOURCE_LEARNPATH && get_class($resource)=='CourseCopyLearnpath') { |
|
46 | + if ($type == RESOURCE_LEARNPATH && get_class($resource) == 'CourseCopyLearnpath') { |
|
47 | 47 | if ($resource->has_item($resource_to_check)) { |
48 | 48 | return true; |
49 | 49 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function has_resources($resource_type = null) |
72 | 72 | { |
73 | - if( $resource_type != null) { |
|
73 | + if ($resource_type != null) { |
|
74 | 74 | return isset($this->resources[$resource_type]) && is_array($this->resources[$resource_type]) && (count( |
75 | 75 | $this->resources[$resource_type] |
76 | 76 | ) > 0); |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | $description = $resource->content; |
178 | 178 | break; |
179 | 179 | case RESOURCE_THEMATIC: |
180 | - $title = $resource->title; |
|
181 | - $description = $resource->content; |
|
180 | + $title = $resource->title; |
|
181 | + $description = $resource->content; |
|
182 | 182 | break; |
183 | 183 | case RESOURCE_ATTENDANCE: |
184 | - $title = $resource->params['name']; |
|
185 | - $description = $resource->params['description']; |
|
184 | + $title = $resource->params['name']; |
|
185 | + $description = $resource->params['description']; |
|
186 | 186 | break; |
187 | 187 | case RESOURCE_WORK: |
188 | 188 | $title = $resource->title; |
@@ -109,7 +109,7 @@ |
||
109 | 109 | $invite_mail, |
110 | 110 | $reminder_mail |
111 | 111 | ) { |
112 | - parent::__construct($id,RESOURCE_SURVEY); |
|
112 | + parent::__construct($id, RESOURCE_SURVEY); |
|
113 | 113 | $this->code = $code; |
114 | 114 | $this->title = $title; |
115 | 115 | $this->subtitle = $subtitle; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function recycle_glossary() |
161 | 161 | { |
162 | 162 | if ($this->course->has_resources(RESOURCE_GLOSSARY)) { |
163 | - $table_glossary = Database::get_course_table(TABLE_GLOSSARY); |
|
163 | + $table_glossary = Database::get_course_table(TABLE_GLOSSARY); |
|
164 | 164 | $ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_GLOSSARY]))); |
165 | 165 | if (!empty($ids)) { |
166 | 166 | $sql = "DELETE FROM ".$table_glossary." |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (trim($learnpath->path) != '') { |
557 | 557 | // when $learnpath->path value is incorrect for some reason. |
558 | 558 | // The directory trat contains files of the SCORM package is to be deleted. |
559 | - $scorm_package_dir = realpath($this->course->path . 'scorm/' . $learnpath->path); |
|
559 | + $scorm_package_dir = realpath($this->course->path.'scorm/'.$learnpath->path); |
|
560 | 560 | rmdirr($scorm_package_dir); |
561 | 561 | } |
562 | 562 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) { |
633 | 633 | if (is_numeric($last_id)) { |
634 | 634 | |
635 | - foreach($thematic->thematic_advance_list as $thematic_advance) { |
|
635 | + foreach ($thematic->thematic_advance_list as $thematic_advance) { |
|
636 | 636 | $cond = array( |
637 | 637 | 'id = ? AND c_id = ?' => array( |
638 | 638 | $thematic_advance['id'], |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | Database::delete($table_thematic_advance, $cond); |
650 | 650 | } |
651 | 651 | |
652 | - foreach($thematic->thematic_plan_list as $thematic_plan) { |
|
652 | + foreach ($thematic->thematic_plan_list as $thematic_plan) { |
|
653 | 653 | $cond = array( |
654 | 654 | 'id = ? AND c_id = ?' => array( |
655 | 655 | $thematic_plan['id'], |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | 'ThematicDeleted', |
679 | 679 | api_get_user_id() |
680 | 680 | ); |
681 | - Database::delete($table_thematic,$cond); |
|
681 | + Database::delete($table_thematic, $cond); |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | } |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | $resources = $this->course->resources; |
697 | 697 | foreach ($resources[RESOURCE_ATTENDANCE] as $last_id => $obj) { |
698 | 698 | if (is_numeric($last_id)) { |
699 | - foreach($obj->attendance_calendar as $attendance_calendar) { |
|
699 | + foreach ($obj->attendance_calendar as $attendance_calendar) { |
|
700 | 700 | $cond = array('id = ? AND c_id = ? '=>array($attendance_calendar['id'], $this->course_id)); |
701 | 701 | Database::delete($table_attendance_calendar, $cond); |
702 | 702 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | public function recycle_work($session_id = 0) |
721 | 721 | { |
722 | 722 | if ($this->course->has_resources(RESOURCE_WORK)) { |
723 | - $table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
723 | + $table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
724 | 724 | $table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); |
725 | 725 | |
726 | 726 | $resources = $this->course->resources; |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | require_once 'Resource.class.php'; |
5 | 5 | |
6 | -define('DOCUMENT','file'); |
|
7 | -define('FOLDER','folder'); |
|
6 | +define('DOCUMENT', 'file'); |
|
7 | +define('FOLDER', 'folder'); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class Document |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function __construct($id, $path, $comment, $title, $file_type, $size) |
32 | 32 | { |
33 | 33 | parent::__construct($id, RESOURCE_DOCUMENT); |
34 | - $this->path = 'document' . $path; |
|
34 | + $this->path = 'document'.$path; |
|
35 | 35 | $this->comment = $comment; |
36 | 36 | $this->title = $title; |
37 | 37 | $this->file_type = $file_type; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | echo preg_replace('@^document@', '', $this->path); |
48 | 48 | if (!empty($this->title)) { |
49 | 49 | if (strpos($this->path, $this->title) === false) { |
50 | - echo " - " . $this->title; |
|
50 | + echo " - ".$this->title; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * @param int $id |
19 | 19 | * @param string $title |
20 | 20 | */ |
21 | - public function __construct($id,$title) |
|
21 | + public function __construct($id, $title) |
|
22 | 22 | { |
23 | 23 | parent::__construct($id, RESOURCE_SESSION_COURSE); |
24 | 24 | $this->title = $title; |
@@ -47,6 +47,6 @@ |
||
47 | 47 | $user_info = api_get_user_info($this->obj->thread_poster_id); |
48 | 48 | $extra = $user_info['complete_name'].', '.$extra; |
49 | 49 | } |
50 | - echo $this->obj->thread_title . ' (' . $extra . ')'; |
|
50 | + echo $this->obj->thread_title.' ('.$extra.')'; |
|
51 | 51 | } |
52 | 52 | } |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->course->backup_path, |
521 | 521 | $this->course->info['path'] |
522 | 522 | ); |
523 | - file_put_contents($path.$document->path,$content); |
|
523 | + file_put_contents($path.$document->path, $content); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | $params = [ |
@@ -564,14 +564,14 @@ discard block |
||
564 | 564 | $new_file_name = $file_name_no_ext.'_'.$i.$ext; |
565 | 565 | $file_exists = file_exists($path.$new_file_name); |
566 | 566 | while ($file_exists) { |
567 | - $i ++; |
|
567 | + $i++; |
|
568 | 568 | $new_file_name = $file_name_no_ext.'_'.$i.$ext; |
569 | 569 | $file_exists = file_exists($path.$new_file_name); |
570 | 570 | } |
571 | 571 | |
572 | 572 | if (!empty($session_id)) { |
573 | 573 | |
574 | - $document_path = explode('/',$document->path,3); |
|
574 | + $document_path = explode('/', $document->path, 3); |
|
575 | 575 | $course_path = $path; |
576 | 576 | $orig_base_folder = $document_path[1]; |
577 | 577 | $orig_base_path = $course_path.$document_path[0].'/'.$document_path[1]; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | $folder_exists = file_exists($new_base_path); |
591 | 591 | if ($folder_exists) { |
592 | - $_SESSION['orig_base_foldername'] = $new_base_foldername; // e.g: carpeta1 in session |
|
592 | + $_SESSION['orig_base_foldername'] = $new_base_foldername; // e.g: carpeta1 in session |
|
593 | 593 | $x = ''; |
594 | 594 | while ($folder_exists) { |
595 | 595 | $x = $x + 1; |
@@ -609,9 +609,9 @@ discard block |
||
609 | 609 | $new_base_path = $_SESSION['new_base_path']; |
610 | 610 | } |
611 | 611 | |
612 | - $dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png" |
|
613 | - $basedir_dest_path = dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1" |
|
614 | - $base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document" |
|
612 | + $dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png" |
|
613 | + $basedir_dest_path = dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1" |
|
614 | + $base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document" |
|
615 | 615 | |
616 | 616 | $path_title = '/'.$new_base_foldername.'/'.$document_path[2]; |
617 | 617 | |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | //Replace old course code with the new destination code see BT#1985 |
632 | 632 | if (file_exists($dest_document_path)) { |
633 | 633 | $file_info = pathinfo($dest_document_path); |
634 | - if (in_array($file_info['extension'], array('html','htm'))) { |
|
634 | + if (in_array($file_info['extension'], array('html', 'htm'))) { |
|
635 | 635 | $content = file_get_contents($dest_document_path); |
636 | 636 | if (UTF8_CONVERT) { |
637 | 637 | $content = utf8_encode($content); |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | //Replace old course code with the new destination code see BT#1985 |
688 | 688 | if (file_exists($path.$new_file_name)) { |
689 | 689 | $file_info = pathinfo($path.$new_file_name); |
690 | - if (in_array($file_info['extension'], array('html','htm'))) { |
|
691 | - $content = file_get_contents($path.$new_file_name); |
|
690 | + if (in_array($file_info['extension'], array('html', 'htm'))) { |
|
691 | + $content = file_get_contents($path.$new_file_name); |
|
692 | 692 | if (UTF8_CONVERT) { |
693 | 693 | $content = utf8_encode($content); |
694 | 694 | } |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | //Replace old course code with the new destination code see BT#1985 |
742 | 742 | if (file_exists($path.$new_file_name)) { |
743 | 743 | $file_info = pathinfo($path.$new_file_name); |
744 | - if (in_array($file_info['extension'], array('html','htm'))) { |
|
745 | - $content = file_get_contents($path.$new_file_name); |
|
744 | + if (in_array($file_info['extension'], array('html', 'htm'))) { |
|
745 | + $content = file_get_contents($path.$new_file_name); |
|
746 | 746 | if (UTF8_CONVERT) { |
747 | 747 | $content = utf8_encode($content); |
748 | 748 | } |
@@ -805,8 +805,8 @@ discard block |
||
805 | 805 | //Replace old course code with the new destination code see BT#1985 |
806 | 806 | if (file_exists($path.$document->path)) { |
807 | 807 | $file_info = pathinfo($path.$document->path); |
808 | - if (in_array($file_info['extension'], array('html','htm'))) { |
|
809 | - $content = file_get_contents($path.$document->path); |
|
808 | + if (in_array($file_info['extension'], array('html', 'htm'))) { |
|
809 | + $content = file_get_contents($path.$document->path); |
|
810 | 810 | if (UTF8_CONVERT) { |
811 | 811 | $content = utf8_encode($content); |
812 | 812 | } |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | case FILE_OVERWRITE: |
897 | 897 | rmdirr($path.$document->path); |
898 | 898 | copyDirTo( |
899 | - $this->course->backup_path . '/' . $document->path, |
|
900 | - $path . dirname($document->path), |
|
899 | + $this->course->backup_path.'/'.$document->path, |
|
900 | + $path.dirname($document->path), |
|
901 | 901 | false |
902 | 902 | ); |
903 | 903 | break; |
@@ -919,23 +919,23 @@ discard block |
||
919 | 919 | $file_exists = file_exists($path.$new_file_name); |
920 | 920 | |
921 | 921 | while ($file_exists) { |
922 | - $i ++; |
|
922 | + $i++; |
|
923 | 923 | $new_file_name = $file_name_no_ext.'_'.$i.$ext; |
924 | 924 | $file_exists = file_exists($path.$new_file_name); |
925 | 925 | } |
926 | 926 | |
927 | 927 | rename( |
928 | - $this->course->backup_path . '/' . $document->path, |
|
929 | - $this->course->backup_path . '/' . $new_file_name |
|
928 | + $this->course->backup_path.'/'.$document->path, |
|
929 | + $this->course->backup_path.'/'.$new_file_name |
|
930 | 930 | ); |
931 | 931 | copyDirTo( |
932 | - $this->course->backup_path . '/' . $new_file_name, |
|
933 | - $path . dirname($new_file_name), |
|
932 | + $this->course->backup_path.'/'.$new_file_name, |
|
933 | + $path.dirname($new_file_name), |
|
934 | 934 | false |
935 | 935 | ); |
936 | 936 | rename( |
937 | - $this->course->backup_path . '/' . $new_file_name, |
|
938 | - $this->course->backup_path . '/' . $document->path |
|
937 | + $this->course->backup_path.'/'.$new_file_name, |
|
938 | + $this->course->backup_path.'/'.$document->path |
|
939 | 939 | ); |
940 | 940 | |
941 | 941 | break; |
@@ -943,8 +943,8 @@ discard block |
||
943 | 943 | } else { |
944 | 944 | // end if file exists |
945 | 945 | copyDirTo( |
946 | - $this->course->backup_path . '/' . $document->path, |
|
947 | - $path . dirname($document->path), |
|
946 | + $this->course->backup_path.'/'.$document->path, |
|
947 | + $path.dirname($document->path), |
|
948 | 948 | false |
949 | 949 | ); |
950 | 950 | } |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | $table_forum = Database::get_course_table(TABLE_FORUM); |
963 | 963 | $resources = $this->course->resources; |
964 | 964 | foreach ($resources[RESOURCE_FORUM] as $id => $forum) { |
965 | - $params = (array)$forum->obj; |
|
965 | + $params = (array) $forum->obj; |
|
966 | 966 | $cat_id = ''; |
967 | 967 | if (isset($this->course->resources[RESOURCE_FORUMCATEGORY]) && |
968 | 968 | isset($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']])) { |
@@ -1014,13 +1014,13 @@ discard block |
||
1014 | 1014 | foreach ($this->course->resources[RESOURCE_FORUMTOPIC] as $topic_id => $topic) { |
1015 | 1015 | if ($topic->obj->forum_id == $id) { |
1016 | 1016 | $this->restore_topic($topic_id, $new_id, $sessionId); |
1017 | - $forum_topics ++; |
|
1017 | + $forum_topics++; |
|
1018 | 1018 | } |
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | if ($forum_topics > 0) { |
1022 | 1022 | $sql = "UPDATE ".$table_forum." SET forum_threads = ".$forum_topics." |
1023 | - WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int)$new_id; |
|
1023 | + WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int) $new_id; |
|
1024 | 1024 | Database::query($sql); |
1025 | 1025 | } |
1026 | 1026 | } |
@@ -1090,13 +1090,13 @@ discard block |
||
1090 | 1090 | $table = Database :: get_course_table(TABLE_FORUM_THREAD); |
1091 | 1091 | $topic = $this->course->resources[RESOURCE_FORUMTOPIC][$thread_id]; |
1092 | 1092 | |
1093 | - $params = (array)$topic->obj; |
|
1093 | + $params = (array) $topic->obj; |
|
1094 | 1094 | $params = self::DBUTF8_array($params); |
1095 | 1095 | $params['c_id'] = $this->destination_course_id; |
1096 | 1096 | $params['forum_id'] = $forum_id; |
1097 | 1097 | $params['thread_poster_id'] = $this->first_teacher_id; |
1098 | 1098 | $params['thread_date'] = api_get_utc_datetime(); |
1099 | - $params['thread_close_date'] = '0000-00-00 00:00:00'; |
|
1099 | + $params['thread_close_date'] = '0000-00-00 00:00:00'; |
|
1100 | 1100 | $params['thread_last_post'] = 0; |
1101 | 1101 | $params['thread_replies'] = 0; |
1102 | 1102 | $params['thread_views'] = 0; |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | FROM $link_table |
1203 | 1203 | WHERE |
1204 | 1204 | c_id = ".$this->destination_course_id." AND |
1205 | - category_id='" . intval($cat_id). "'"; |
|
1205 | + category_id='" . intval($cat_id)."'"; |
|
1206 | 1206 | $result = Database::query($sql); |
1207 | 1207 | list($max_order) = Database::fetch_array($result); |
1208 | 1208 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | $params['description'] = self::DBUTF8($link->description); |
1218 | 1218 | $params['category_id'] = $cat_id; |
1219 | 1219 | $params['on_homepage'] = $link->on_homepage; |
1220 | - $params['display_order'] = $max_order+1; |
|
1220 | + $params['display_order'] = $max_order + 1; |
|
1221 | 1221 | |
1222 | 1222 | $id = Database::insert($link_table, $params); |
1223 | 1223 | |
@@ -1261,9 +1261,9 @@ discard block |
||
1261 | 1261 | if (is_object($link_cat) && !$link_cat->is_restored()) { |
1262 | 1262 | $sql = "SELECT MAX(display_order) FROM $link_cat_table |
1263 | 1263 | WHERE c_id = ".$this->destination_course_id." "; |
1264 | - $result=Database::query($sql); |
|
1265 | - list($orderMax)=Database::fetch_array($result,'NUM'); |
|
1266 | - $display_order=$orderMax+1; |
|
1264 | + $result = Database::query($sql); |
|
1265 | + list($orderMax) = Database::fetch_array($result, 'NUM'); |
|
1266 | + $display_order = $orderMax + 1; |
|
1267 | 1267 | |
1268 | 1268 | $params['c_id'] = $this->destination_course_id; |
1269 | 1269 | $params['category_title'] = self::DBUTF8($link_cat->title); |
@@ -1639,9 +1639,9 @@ discard block |
||
1639 | 1639 | if (!empty($quiz->sound)) { |
1640 | 1640 | if (isset($this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]) && |
1641 | 1641 | $this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]->is_restored()) { |
1642 | - $sql = "SELECT path FROM " . $table_doc . " |
|
1642 | + $sql = "SELECT path FROM ".$table_doc." |
|
1643 | 1643 | WHERE |
1644 | - c_id = " . $this->destination_course_id . " AND |
|
1644 | + c_id = " . $this->destination_course_id." AND |
|
1645 | 1645 | id = " . $resources[RESOURCE_DOCUMENT][$quiz->sound]->destination_id; |
1646 | 1646 | $doc = Database::query($sql); |
1647 | 1647 | $doc = Database::fetch_object($doc); |
@@ -1675,19 +1675,19 @@ discard block |
||
1675 | 1675 | 'random' => $quiz->random, |
1676 | 1676 | 'active' => $quiz->active, |
1677 | 1677 | 'sound' => self::DBUTF8($doc), |
1678 | - 'max_attempt' => (int)$quiz->max_attempt, |
|
1679 | - 'results_disabled' => (int)$quiz->results_disabled, |
|
1678 | + 'max_attempt' => (int) $quiz->max_attempt, |
|
1679 | + 'results_disabled' => (int) $quiz->results_disabled, |
|
1680 | 1680 | 'access_condition' => $quiz->access_condition, |
1681 | 1681 | 'start_time' => $quiz->start_time, |
1682 | 1682 | 'pass_percentage' => $quiz->pass_percentage, |
1683 | 1683 | 'end_time' => $quiz->end_time, |
1684 | - 'feedback_type' => (int)$quiz->feedback_type, |
|
1685 | - 'random_answers' => (int)$quiz->random_answers, |
|
1684 | + 'feedback_type' => (int) $quiz->feedback_type, |
|
1685 | + 'random_answers' => (int) $quiz->random_answers, |
|
1686 | 1686 | 'random_by_category' => $quiz->random_by_category, |
1687 | 1687 | 'review_answers' => $quiz->review_answers, |
1688 | 1688 | 'propagate_neg' => $quiz->propagate_neg, |
1689 | 1689 | 'text_when_finished' => $quiz->text_when_finished, |
1690 | - 'expired_time' => (int)$quiz->expired_time, |
|
1690 | + 'expired_time' => (int) $quiz->expired_time, |
|
1691 | 1691 | ); |
1692 | 1692 | |
1693 | 1693 | if ($respect_base_content) { |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | $qid = $this->restore_quiz_question($question_id); |
1724 | 1724 | $question_order = $quiz->question_orders[$index] ? $quiz->question_orders[$index] : ++$order; |
1725 | 1725 | $sql = "INSERT IGNORE INTO $table_rel SET |
1726 | - c_id = " . $this->destination_course_id . ", |
|
1727 | - question_id = " . $qid . ", |
|
1728 | - exercice_id = " . $new_id . ", |
|
1726 | + c_id = ".$this->destination_course_id.", |
|
1727 | + question_id = " . $qid.", |
|
1728 | + exercice_id = " . $new_id.", |
|
1729 | 1729 | question_order = " . $question_order; |
1730 | 1730 | Database::query($sql); |
1731 | 1731 | } |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | $sql = "UPDATE $table_que SET |
1801 | 1801 | picture = '$picture_name' |
1802 | 1802 | WHERE |
1803 | - c_id = " . $this->destination_course_id . " AND |
|
1803 | + c_id = ".$this->destination_course_id." AND |
|
1804 | 1804 | id = $new_id "; |
1805 | 1805 | Database::query($sql); |
1806 | 1806 | } |
@@ -1955,7 +1955,7 @@ discard block |
||
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | |
1958 | - foreach($correct_answers as $answer_id => $correct_answer) { |
|
1958 | + foreach ($correct_answers as $answer_id => $correct_answer) { |
|
1959 | 1959 | $params = array(); |
1960 | 1960 | $params['correct'] = $new_options[$correct_answer]; |
1961 | 1961 | Database::update( |
@@ -1989,7 +1989,7 @@ discard block |
||
1989 | 1989 | $tab_test_category_id_old_new = array(); // used to build the quiz_question_rel_category table |
1990 | 1990 | if ($this->course->has_resources(RESOURCE_TEST_CATEGORY)) { |
1991 | 1991 | $resources = $this->course->resources; |
1992 | - foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestcategory ) { |
|
1992 | + foreach ($resources[RESOURCE_TEST_CATEGORY] as $id => $CourseCopyTestcategory) { |
|
1993 | 1993 | $tab_test_category_id_old_new[$CourseCopyTestcategory->source_id] = $id; |
1994 | 1994 | // check if this test_category already exist in the destination BDD |
1995 | 1995 | // do not Database::escape_string $title and $description, it will be done later |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | break; |
2136 | 2136 | case FILE_RENAME: |
2137 | 2137 | $survey_code = $survey->code.'_'; |
2138 | - $i=1; |
|
2138 | + $i = 1; |
|
2139 | 2139 | $temp_survey_code = $survey_code.$i; |
2140 | 2140 | while (!$this->is_survey_code_available($temp_survey_code)) { |
2141 | 2141 | $temp_survey_code = $survey_code.++$i; |
@@ -2167,15 +2167,15 @@ discard block |
||
2167 | 2167 | $sql = "SELECT * FROM $table_sur |
2168 | 2168 | WHERE |
2169 | 2169 | c_id = ".$this->destination_course_id." AND |
2170 | - survey_id='".self::DBUTF8escapestring(Database::result($result_check,0,0))."'"; |
|
2170 | + survey_id='".self::DBUTF8escapestring(Database::result($result_check, 0, 0))."'"; |
|
2171 | 2171 | $result = Database::query($sql); |
2172 | - $survey_data = Database::fetch_array($result,'ASSOC'); |
|
2172 | + $survey_data = Database::fetch_array($result, 'ASSOC'); |
|
2173 | 2173 | |
2174 | 2174 | // if the survey is shared => also delete the shared content |
2175 | 2175 | if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) { |
2176 | - SurveyManager::delete_survey($survey_data['survey_share'], true,$this->destination_course_id); |
|
2176 | + SurveyManager::delete_survey($survey_data['survey_share'], true, $this->destination_course_id); |
|
2177 | 2177 | } |
2178 | - SurveyManager :: delete_survey($survey_data['survey_id'],false,$this->destination_course_id); |
|
2178 | + SurveyManager :: delete_survey($survey_data['survey_id'], false, $this->destination_course_id); |
|
2179 | 2179 | |
2180 | 2180 | // Insert the new source survey |
2181 | 2181 | $new_id = Database::insert($table_sur, $params); |
@@ -2251,7 +2251,7 @@ discard block |
||
2251 | 2251 | $resources = $this->course->resources; |
2252 | 2252 | $question = $resources[RESOURCE_SURVEYQUESTION][$id]; |
2253 | 2253 | |
2254 | - $new_id=0; |
|
2254 | + $new_id = 0; |
|
2255 | 2255 | |
2256 | 2256 | if (is_object($question)) { |
2257 | 2257 | if ($question->is_restored()) { |
@@ -2356,14 +2356,14 @@ discard block |
||
2356 | 2356 | |
2357 | 2357 | // Adding the author's image |
2358 | 2358 | if (!empty($lp->preview_image)) { |
2359 | - $new_filename = uniqid('').substr($lp->preview_image,strlen($lp->preview_image)-7, strlen($lp->preview_image)); |
|
2359 | + $new_filename = uniqid('').substr($lp->preview_image, strlen($lp->preview_image) - 7, strlen($lp->preview_image)); |
|
2360 | 2360 | if (file_exists($origin_path.$lp->preview_image) && !is_dir($origin_path.$lp->preview_image)) { |
2361 | 2361 | $copy_result = copy($origin_path.$lp->preview_image, $destination_path.$new_filename); |
2362 | 2362 | //$copy_result = true; |
2363 | 2363 | if ($copy_result) { |
2364 | 2364 | $lp->preview_image = $new_filename; |
2365 | 2365 | } else { |
2366 | - $lp->preview_image =''; |
|
2366 | + $lp->preview_image = ''; |
|
2367 | 2367 | } |
2368 | 2368 | } |
2369 | 2369 | } |
@@ -2524,20 +2524,20 @@ discard block |
||
2524 | 2524 | $next_item_ids[$new_item_id] = $item['next_item_id']; |
2525 | 2525 | |
2526 | 2526 | if (!empty($item['prerequisite'])) { |
2527 | - if ($lp->lp_type =='2') { |
|
2527 | + if ($lp->lp_type == '2') { |
|
2528 | 2528 | // if is an sco |
2529 | - $old_prerequisite[$new_item_id]= $item['prerequisite']; |
|
2529 | + $old_prerequisite[$new_item_id] = $item['prerequisite']; |
|
2530 | 2530 | } else { |
2531 | - $old_prerequisite[$new_item_id]= $new_item_ids[$item['prerequisite']]; |
|
2531 | + $old_prerequisite[$new_item_id] = $new_item_ids[$item['prerequisite']]; |
|
2532 | 2532 | } |
2533 | 2533 | } |
2534 | 2534 | |
2535 | 2535 | if (!empty($ref)) { |
2536 | - if ($lp->lp_type =='2') { |
|
2536 | + if ($lp->lp_type == '2') { |
|
2537 | 2537 | // if is an sco |
2538 | - $old_refs[$new_item_id]= $ref; |
|
2538 | + $old_refs[$new_item_id] = $ref; |
|
2539 | 2539 | } else { |
2540 | - $old_refs[$new_item_id]= $new_item_ids[$ref]; |
|
2540 | + $old_refs[$new_item_id] = $new_item_ids[$ref]; |
|
2541 | 2541 | } |
2542 | 2542 | } |
2543 | 2543 | |
@@ -2546,7 +2546,7 @@ discard block |
||
2546 | 2546 | |
2547 | 2547 | // Updating prerequisites |
2548 | 2548 | foreach ($old_prerequisite as $key=>$my_old_prerequisite) { |
2549 | - if($my_old_prerequisite != ''){ |
|
2549 | + if ($my_old_prerequisite != '') { |
|
2550 | 2550 | $sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."' |
2551 | 2551 | WHERE c_id = ".$this->destination_course_id." AND id = '".$key."' "; |
2552 | 2552 | Database::query($sql); |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | |
2565 | 2565 | foreach ($parent_item_ids as $new_item_id => $parent_item_old_id) { |
2566 | 2566 | $parent_new_id = 0; |
2567 | - if($parent_item_old_id != 0){ |
|
2567 | + if ($parent_item_old_id != 0) { |
|
2568 | 2568 | $parent_new_id = $new_item_ids[$parent_item_old_id]; |
2569 | 2569 | } |
2570 | 2570 | $sql = "UPDATE ".$table_item." SET parent_item_id = '".$parent_new_id."' |
@@ -2573,7 +2573,7 @@ discard block |
||
2573 | 2573 | } |
2574 | 2574 | foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) { |
2575 | 2575 | $previous_new_id = 0; |
2576 | - if($previous_item_old_id != 0){ |
|
2576 | + if ($previous_item_old_id != 0) { |
|
2577 | 2577 | $previous_new_id = $new_item_ids[$previous_item_old_id]; |
2578 | 2578 | } |
2579 | 2579 | $sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."' |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | |
2584 | 2584 | foreach ($next_item_ids as $new_item_id => $next_item_old_id) { |
2585 | 2585 | $next_new_id = 0; |
2586 | - if($next_item_old_id != 0){ |
|
2586 | + if ($next_item_old_id != 0) { |
|
2587 | 2587 | $next_new_id = $new_item_ids[$next_item_old_id]; |
2588 | 2588 | } |
2589 | 2589 | $sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."' |
@@ -2593,7 +2593,7 @@ discard block |
||
2593 | 2593 | |
2594 | 2594 | foreach ($prerequisite_ids as $new_item_id => $prerequisite_old_id) { |
2595 | 2595 | $prerequisite_new_id = 0; |
2596 | - if($prerequisite_old_id != 0){ |
|
2596 | + if ($prerequisite_old_id != 0) { |
|
2597 | 2597 | $prerequisite_new_id = $new_item_ids[$prerequisite_old_id]; |
2598 | 2598 | } |
2599 | 2599 | $sql = "UPDATE ".$table_item." SET prerequisite = '".$prerequisite_new_id."' |
@@ -2613,9 +2613,9 @@ discard block |
||
2613 | 2613 | public function restore_student_publication($sessionId = 0) |
2614 | 2614 | { |
2615 | 2615 | $sessionId = intval($sessionId); |
2616 | - $work_assignment_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); |
|
2616 | + $work_assignment_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); |
|
2617 | 2617 | $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
2618 | - $item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
2618 | + $item_property_table = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
2619 | 2619 | |
2620 | 2620 | // Query in student publication |
2621 | 2621 | $sql = 'SELECT * FROM '.$work_table.' |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | |
2694 | 2694 | $destination = '../../courses/'.$this->course->destination_path.'/work/'; |
2695 | 2695 | $origin = '../../courses/'.$this->course->info['path'].'/work/'; |
2696 | - self::allow_create_all_directory($origin,$destination,false); |
|
2696 | + self::allow_create_all_directory($origin, $destination, false); |
|
2697 | 2697 | } |
2698 | 2698 | |
2699 | 2699 | /** |
@@ -2712,16 +2712,16 @@ discard block |
||
2712 | 2712 | if ($handle = opendir($source)) { // if the folder exploration is sucsessful, continue |
2713 | 2713 | while (false !== ($file = readdir($handle))) { // as long as storing the next file to $file is successful, continue |
2714 | 2714 | if ($file != '.' && $file != '..') { |
2715 | - $path = $source . '/' . $file; |
|
2715 | + $path = $source.'/'.$file; |
|
2716 | 2716 | if (is_file($path)) { |
2717 | 2717 | /* if (!is_file($dest . '/' . $file) || $overwrite) |
2718 | 2718 | if (!@copy($path, $dest . '/' . $file)) { |
2719 | 2719 | echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>'; |
2720 | 2720 | }*/ |
2721 | - } elseif(is_dir($path)) { |
|
2722 | - if (!is_dir($dest . '/' . $file)) |
|
2723 | - mkdir($dest . '/' . $file); |
|
2724 | - self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite); |
|
2721 | + } elseif (is_dir($path)) { |
|
2722 | + if (!is_dir($dest.'/'.$file)) |
|
2723 | + mkdir($dest.'/'.$file); |
|
2724 | + self:: allow_create_all_directory($path, $dest.'/'.$file, $overwrite); |
|
2725 | 2725 | } |
2726 | 2726 | } |
2727 | 2727 | } |
@@ -2908,7 +2908,7 @@ discard block |
||
2908 | 2908 | $this->course->backup_path, |
2909 | 2909 | $this->course->info['path'] |
2910 | 2910 | ); |
2911 | - $thematic->params['c_id'] = $this->destination_course_id; |
|
2911 | + $thematic->params['c_id'] = $this->destination_course_id; |
|
2912 | 2912 | unset($thematic->params['id']); |
2913 | 2913 | unset($thematic->params['iid']); |
2914 | 2914 | |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | unset($thematic_advance['iid']); |
2933 | 2933 | $thematic_advance['attendance_id'] = 0; |
2934 | 2934 | $thematic_advance['thematic_id'] = $last_id; |
2935 | - $thematic_advance['c_id'] = $this->destination_course_id; |
|
2935 | + $thematic_advance['c_id'] = $this->destination_course_id; |
|
2936 | 2936 | $my_id = Database::insert( |
2937 | 2937 | $table_thematic_advance, |
2938 | 2938 | $thematic_advance, |
@@ -2954,7 +2954,7 @@ discard block |
||
2954 | 2954 | } |
2955 | 2955 | } |
2956 | 2956 | |
2957 | - foreach($thematic->thematic_plan_list as $thematic_plan) { |
|
2957 | + foreach ($thematic->thematic_plan_list as $thematic_plan) { |
|
2958 | 2958 | unset($thematic_plan['id']); |
2959 | 2959 | unset($thematic_plan['iid']); |
2960 | 2960 | $thematic_plan['thematic_id'] = $last_id; |
@@ -3070,7 +3070,7 @@ discard block |
||
3070 | 3070 | // re-create dir |
3071 | 3071 | // @todo check security against injection of dir in crafted course backup here! |
3072 | 3072 | $path = $obj->params['url']; |
3073 | - $path = '/'.str_replace('/','',substr($path,1)); |
|
3073 | + $path = '/'.str_replace('/', '', substr($path, 1)); |
|
3074 | 3074 | |
3075 | 3075 | $workData = array(); |
3076 | 3076 | switch ($this->file_option) { |
@@ -3092,9 +3092,9 @@ discard block |
||
3092 | 3092 | $obj->params['new_dir'] = $obj->params['title']; |
3093 | 3093 | |
3094 | 3094 | if (!empty($this->course_origin_id)) { |
3095 | - $sql = 'SELECT * FROM ' . $table_work_assignment . ' |
|
3095 | + $sql = 'SELECT * FROM '.$table_work_assignment.' |
|
3096 | 3096 | WHERE |
3097 | - c_id = ' . $this->course_origin_id . ' AND |
|
3097 | + c_id = ' . $this->course_origin_id.' AND |
|
3098 | 3098 | publication_id = ' . $id_work; |
3099 | 3099 | |
3100 | 3100 | $result = Database::query($sql); |
@@ -3206,7 +3206,7 @@ discard block |
||
3206 | 3206 | public function DBUTF8_array($array) |
3207 | 3207 | { |
3208 | 3208 | if (UTF8_CONVERT) { |
3209 | - foreach ($array as &$item) { |
|
3209 | + foreach ($array as &$item) { |
|
3210 | 3210 | $item = utf8_encode($item); |
3211 | 3211 | } |
3212 | 3212 | return $array; |