@@ -8,194 +8,194 @@ |
||
8 | 8 | */ |
9 | 9 | class CourseCopyLearnpath extends Coursecopy\Resource |
10 | 10 | { |
11 | - /** |
|
12 | - * Type of learnpath (can be dokeos (1), scorm (2), aicc (3)) |
|
13 | - */ |
|
14 | - public $lp_type; |
|
15 | - /** |
|
16 | - * The name |
|
17 | - */ |
|
18 | - public $name; |
|
19 | - /** |
|
20 | - * The reference |
|
21 | - */ |
|
22 | - public $ref; |
|
23 | - /** |
|
24 | - * The description |
|
25 | - */ |
|
26 | - public $description; |
|
27 | - /** |
|
28 | - * Path to the learning path files |
|
29 | - */ |
|
30 | - public $path; |
|
31 | - /** |
|
32 | - * Whether additional commits should be forced or not |
|
33 | - */ |
|
34 | - public $force_commit; |
|
35 | - /** |
|
36 | - * View mode by default ('embedded' or 'fullscreen') |
|
37 | - */ |
|
38 | - public $default_view_mod; |
|
39 | - /** |
|
40 | - * Default character encoding |
|
41 | - */ |
|
42 | - public $default_encoding; |
|
43 | - /** |
|
44 | - * Display order |
|
45 | - */ |
|
46 | - public $display_order; |
|
47 | - /** |
|
48 | - * Content editor/publisher |
|
49 | - */ |
|
50 | - public $content_maker; |
|
51 | - /** |
|
52 | - * Location of the content (local or remote) |
|
53 | - */ |
|
54 | - public $content_local; |
|
55 | - /** |
|
56 | - * License of the content |
|
57 | - */ |
|
58 | - public $content_license; |
|
59 | - /** |
|
60 | - * Whether to prevent reinitialisation or not |
|
61 | - */ |
|
62 | - public $prevent_reinit; |
|
63 | - /** |
|
64 | - * JavaScript library used |
|
65 | - */ |
|
66 | - public $js_lib; |
|
67 | - /** |
|
68 | - * Debug level for this lp |
|
69 | - */ |
|
70 | - public $debug; |
|
71 | - /** |
|
72 | - * The items |
|
73 | - */ |
|
74 | - public $items; |
|
75 | - /** |
|
76 | - * The learnpath visibility on the homepage |
|
77 | - */ |
|
78 | - public $visibility; |
|
11 | + /** |
|
12 | + * Type of learnpath (can be dokeos (1), scorm (2), aicc (3)) |
|
13 | + */ |
|
14 | + public $lp_type; |
|
15 | + /** |
|
16 | + * The name |
|
17 | + */ |
|
18 | + public $name; |
|
19 | + /** |
|
20 | + * The reference |
|
21 | + */ |
|
22 | + public $ref; |
|
23 | + /** |
|
24 | + * The description |
|
25 | + */ |
|
26 | + public $description; |
|
27 | + /** |
|
28 | + * Path to the learning path files |
|
29 | + */ |
|
30 | + public $path; |
|
31 | + /** |
|
32 | + * Whether additional commits should be forced or not |
|
33 | + */ |
|
34 | + public $force_commit; |
|
35 | + /** |
|
36 | + * View mode by default ('embedded' or 'fullscreen') |
|
37 | + */ |
|
38 | + public $default_view_mod; |
|
39 | + /** |
|
40 | + * Default character encoding |
|
41 | + */ |
|
42 | + public $default_encoding; |
|
43 | + /** |
|
44 | + * Display order |
|
45 | + */ |
|
46 | + public $display_order; |
|
47 | + /** |
|
48 | + * Content editor/publisher |
|
49 | + */ |
|
50 | + public $content_maker; |
|
51 | + /** |
|
52 | + * Location of the content (local or remote) |
|
53 | + */ |
|
54 | + public $content_local; |
|
55 | + /** |
|
56 | + * License of the content |
|
57 | + */ |
|
58 | + public $content_license; |
|
59 | + /** |
|
60 | + * Whether to prevent reinitialisation or not |
|
61 | + */ |
|
62 | + public $prevent_reinit; |
|
63 | + /** |
|
64 | + * JavaScript library used |
|
65 | + */ |
|
66 | + public $js_lib; |
|
67 | + /** |
|
68 | + * Debug level for this lp |
|
69 | + */ |
|
70 | + public $debug; |
|
71 | + /** |
|
72 | + * The items |
|
73 | + */ |
|
74 | + public $items; |
|
75 | + /** |
|
76 | + * The learnpath visibility on the homepage |
|
77 | + */ |
|
78 | + public $visibility; |
|
79 | 79 | |
80 | - /** |
|
81 | - * Author info |
|
82 | - */ |
|
83 | - public $author; |
|
80 | + /** |
|
81 | + * Author info |
|
82 | + */ |
|
83 | + public $author; |
|
84 | 84 | |
85 | - /** |
|
86 | - * Author's image |
|
87 | - */ |
|
88 | - public $preview_image; |
|
85 | + /** |
|
86 | + * Author's image |
|
87 | + */ |
|
88 | + public $preview_image; |
|
89 | 89 | |
90 | - /** |
|
91 | - * Create a new learnpath |
|
92 | - * @param integer ID |
|
93 | - * @param integer Type (1,2,3,...) |
|
94 | - * @param string $name |
|
95 | - * @param string $path |
|
96 | - * @param string $ref |
|
97 | - * @param string $description |
|
98 | - * @param string $content_local |
|
99 | - * @param string $default_encoding |
|
100 | - * @param string $default_view_mode |
|
101 | - * @param bool $prevent_reinit |
|
102 | - * @param bool $force_commit |
|
103 | - * @param string $content_maker |
|
104 | - * @param integer $display_order |
|
105 | - * @param string $js_lib |
|
106 | - * @param string $content_license |
|
107 | - * @param integer $debug |
|
108 | - * @param string $visibility |
|
109 | - * @param array $items |
|
110 | - */ |
|
111 | - public function __construct( |
|
112 | - $id, |
|
113 | - $type, |
|
114 | - $name, |
|
115 | - $path, |
|
116 | - $ref, |
|
117 | - $description, |
|
118 | - $content_local, |
|
119 | - $default_encoding, |
|
120 | - $default_view_mode, |
|
121 | - $prevent_reinit, |
|
122 | - $force_commit, |
|
123 | - $content_maker, |
|
124 | - $display_order, |
|
125 | - $js_lib, |
|
126 | - $content_license, |
|
127 | - $debug, |
|
128 | - $visibility, |
|
129 | - $author, |
|
130 | - $preview_image, |
|
131 | - $use_max_score, |
|
132 | - $autolaunch, |
|
133 | - $created_on, |
|
134 | - $modified_on, |
|
135 | - $publicated_on, |
|
136 | - $expired_on, |
|
137 | - $session_id, |
|
138 | - $items |
|
139 | - ) { |
|
140 | - parent::__construct($id, RESOURCE_LEARNPATH); |
|
141 | - $this->lp_type = $type; |
|
142 | - $this->name = $name; |
|
143 | - $this->path = $path; |
|
144 | - $this->ref = $ref; |
|
145 | - $this->description = $description; |
|
146 | - $this->content_local = $content_local; |
|
147 | - $this->default_encoding = $default_encoding; |
|
148 | - $this->default_view_mod = $default_view_mode; |
|
149 | - $this->prevent_reinit = $prevent_reinit; |
|
150 | - $this->force_commit = $force_commit; |
|
151 | - $this->content_maker = $content_maker; |
|
152 | - $this->display_order = $display_order; |
|
153 | - $this->js_lib = $js_lib; |
|
154 | - $this->content_license = $content_license; |
|
155 | - $this->debug = $debug; |
|
156 | - $this->visibility=$visibility; |
|
90 | + /** |
|
91 | + * Create a new learnpath |
|
92 | + * @param integer ID |
|
93 | + * @param integer Type (1,2,3,...) |
|
94 | + * @param string $name |
|
95 | + * @param string $path |
|
96 | + * @param string $ref |
|
97 | + * @param string $description |
|
98 | + * @param string $content_local |
|
99 | + * @param string $default_encoding |
|
100 | + * @param string $default_view_mode |
|
101 | + * @param bool $prevent_reinit |
|
102 | + * @param bool $force_commit |
|
103 | + * @param string $content_maker |
|
104 | + * @param integer $display_order |
|
105 | + * @param string $js_lib |
|
106 | + * @param string $content_license |
|
107 | + * @param integer $debug |
|
108 | + * @param string $visibility |
|
109 | + * @param array $items |
|
110 | + */ |
|
111 | + public function __construct( |
|
112 | + $id, |
|
113 | + $type, |
|
114 | + $name, |
|
115 | + $path, |
|
116 | + $ref, |
|
117 | + $description, |
|
118 | + $content_local, |
|
119 | + $default_encoding, |
|
120 | + $default_view_mode, |
|
121 | + $prevent_reinit, |
|
122 | + $force_commit, |
|
123 | + $content_maker, |
|
124 | + $display_order, |
|
125 | + $js_lib, |
|
126 | + $content_license, |
|
127 | + $debug, |
|
128 | + $visibility, |
|
129 | + $author, |
|
130 | + $preview_image, |
|
131 | + $use_max_score, |
|
132 | + $autolaunch, |
|
133 | + $created_on, |
|
134 | + $modified_on, |
|
135 | + $publicated_on, |
|
136 | + $expired_on, |
|
137 | + $session_id, |
|
138 | + $items |
|
139 | + ) { |
|
140 | + parent::__construct($id, RESOURCE_LEARNPATH); |
|
141 | + $this->lp_type = $type; |
|
142 | + $this->name = $name; |
|
143 | + $this->path = $path; |
|
144 | + $this->ref = $ref; |
|
145 | + $this->description = $description; |
|
146 | + $this->content_local = $content_local; |
|
147 | + $this->default_encoding = $default_encoding; |
|
148 | + $this->default_view_mod = $default_view_mode; |
|
149 | + $this->prevent_reinit = $prevent_reinit; |
|
150 | + $this->force_commit = $force_commit; |
|
151 | + $this->content_maker = $content_maker; |
|
152 | + $this->display_order = $display_order; |
|
153 | + $this->js_lib = $js_lib; |
|
154 | + $this->content_license = $content_license; |
|
155 | + $this->debug = $debug; |
|
156 | + $this->visibility=$visibility; |
|
157 | 157 | |
158 | - $this->use_max_score=$use_max_score; |
|
159 | - $this->autolaunch=$autolaunch; |
|
160 | - $this->created_on=$created_on; |
|
161 | - $this->modified_on=$modified_on; |
|
162 | - $this->publicated_on=$publicated_on; |
|
163 | - $this->expired_on=$expired_on; |
|
164 | - $this->session_id=$session_id; |
|
158 | + $this->use_max_score=$use_max_score; |
|
159 | + $this->autolaunch=$autolaunch; |
|
160 | + $this->created_on=$created_on; |
|
161 | + $this->modified_on=$modified_on; |
|
162 | + $this->publicated_on=$publicated_on; |
|
163 | + $this->expired_on=$expired_on; |
|
164 | + $this->session_id=$session_id; |
|
165 | 165 | |
166 | - $this->author= $author; |
|
167 | - $this->preview_image= $preview_image; |
|
166 | + $this->author= $author; |
|
167 | + $this->preview_image= $preview_image; |
|
168 | 168 | |
169 | - $this->items = $items; |
|
170 | - } |
|
171 | - /** |
|
172 | - * Get the items |
|
173 | - */ |
|
174 | - function get_items() |
|
175 | - { |
|
176 | - return $this->items; |
|
177 | - } |
|
169 | + $this->items = $items; |
|
170 | + } |
|
171 | + /** |
|
172 | + * Get the items |
|
173 | + */ |
|
174 | + function get_items() |
|
175 | + { |
|
176 | + return $this->items; |
|
177 | + } |
|
178 | 178 | |
179 | - /** |
|
180 | - * Check if a given resource is used as an item in this chapter |
|
181 | - */ |
|
182 | - function has_item($resource) |
|
183 | - { |
|
184 | - foreach ($this->items as $item) { |
|
185 | - if ($item['id'] == $resource->get_id() && |
|
186 | - isset($item['type']) && $item['type'] == $resource->get_type() |
|
187 | - ) { |
|
188 | - return true; |
|
189 | - } |
|
190 | - } |
|
191 | - return false; |
|
192 | - } |
|
179 | + /** |
|
180 | + * Check if a given resource is used as an item in this chapter |
|
181 | + */ |
|
182 | + function has_item($resource) |
|
183 | + { |
|
184 | + foreach ($this->items as $item) { |
|
185 | + if ($item['id'] == $resource->get_id() && |
|
186 | + isset($item['type']) && $item['type'] == $resource->get_type() |
|
187 | + ) { |
|
188 | + return true; |
|
189 | + } |
|
190 | + } |
|
191 | + return false; |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * Show this learnpath |
|
196 | - */ |
|
197 | - function show() { |
|
198 | - parent::show(); |
|
199 | - echo $this->name; |
|
200 | - } |
|
194 | + /** |
|
195 | + * Show this learnpath |
|
196 | + */ |
|
197 | + function show() { |
|
198 | + parent::show(); |
|
199 | + echo $this->name; |
|
200 | + } |
|
201 | 201 | } |
@@ -153,18 +153,18 @@ |
||
153 | 153 | $this->js_lib = $js_lib; |
154 | 154 | $this->content_license = $content_license; |
155 | 155 | $this->debug = $debug; |
156 | - $this->visibility=$visibility; |
|
156 | + $this->visibility = $visibility; |
|
157 | 157 | |
158 | - $this->use_max_score=$use_max_score; |
|
159 | - $this->autolaunch=$autolaunch; |
|
160 | - $this->created_on=$created_on; |
|
161 | - $this->modified_on=$modified_on; |
|
162 | - $this->publicated_on=$publicated_on; |
|
163 | - $this->expired_on=$expired_on; |
|
164 | - $this->session_id=$session_id; |
|
158 | + $this->use_max_score = $use_max_score; |
|
159 | + $this->autolaunch = $autolaunch; |
|
160 | + $this->created_on = $created_on; |
|
161 | + $this->modified_on = $modified_on; |
|
162 | + $this->publicated_on = $publicated_on; |
|
163 | + $this->expired_on = $expired_on; |
|
164 | + $this->session_id = $session_id; |
|
165 | 165 | |
166 | - $this->author= $author; |
|
167 | - $this->preview_image= $preview_image; |
|
166 | + $this->author = $author; |
|
167 | + $this->preview_image = $preview_image; |
|
168 | 168 | |
169 | 169 | $this->items = $items; |
170 | 170 | } |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | $table_doc = Database:: get_course_table(TABLE_DOCUMENT); |
596 | 596 | |
597 | 597 | if (!empty($courseId) && !empty($session_id)) { |
598 | - $session_id = intval($session_id); |
|
598 | + $session_id = intval($session_id); |
|
599 | 599 | if ($with_base_content) { |
600 | 600 | $session_condition = api_get_session_condition( |
601 | 601 | $session_id, |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | 'title' => get_lang('OrphanQuestions', ''), |
805 | 805 | 'type' => 2 |
806 | 806 | ); |
807 | - $newQuiz = new Quiz((object)$obj); |
|
807 | + $newQuiz = new Quiz((object) $obj); |
|
808 | 808 | if (!empty($orphanQuestionIds)) { |
809 | 809 | foreach ($orphanQuestionIds as $index => $orphanId) { |
810 | 810 | $order = $index + 1; |
@@ -91,7 +91,7 @@ |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | - * @param array $array |
|
94 | + * @param string[] $array |
|
95 | 95 | */ |
96 | 96 | public function set_tools_to_build($array) |
97 | 97 | { |
@@ -66,19 +66,19 @@ |
||
66 | 66 | $attachment_comment = null, |
67 | 67 | $all_day = 0 |
68 | 68 | ) { |
69 | - parent::__construct($id, RESOURCE_EVENT); |
|
69 | + parent::__construct($id, RESOURCE_EVENT); |
|
70 | 70 | |
71 | - $this->title = $title; |
|
72 | - $this->content = $content; |
|
73 | - $this->start_date = $start_date; |
|
74 | - $this->end_date = $end_date; |
|
75 | - $this->all_day = $all_day; |
|
71 | + $this->title = $title; |
|
72 | + $this->content = $content; |
|
73 | + $this->start_date = $start_date; |
|
74 | + $this->end_date = $end_date; |
|
75 | + $this->all_day = $all_day; |
|
76 | 76 | |
77 | - $this->attachment_path = $attachment_path; |
|
78 | - $this->attachment_filename = $attachment_filename; |
|
79 | - $this->attachment_size = $attachment_size; |
|
80 | - $this->attachment_comment = $attachment_comment; |
|
81 | - } |
|
77 | + $this->attachment_path = $attachment_path; |
|
78 | + $this->attachment_filename = $attachment_filename; |
|
79 | + $this->attachment_size = $attachment_size; |
|
80 | + $this->attachment_comment = $attachment_comment; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Show this Event |
@@ -25,6 +25,6 @@ |
||
25 | 25 | public function show() |
26 | 26 | { |
27 | 27 | parent::show(); |
28 | - echo $this->obj->title . ' (' . $this->obj->poster_name . ', ' . $this->obj->post_date . ')'; |
|
28 | + echo $this->obj->title.' ('.$this->obj->poster_name.', '.$this->obj->post_date.')'; |
|
29 | 29 | } |
30 | 30 | } |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | |
137 | 137 | //get destination course title |
138 | 138 | if (!empty($hidden_fields['destination_course'])) { |
139 | - $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name( |
|
139 | + $sessionTitle = !empty($hidden_fields['destination_session']) ? ' ('.api_get_session_name( |
|
140 | 140 | $hidden_fields['destination_session'] |
141 | - ) . ')' : null; |
|
141 | + ).')' : null; |
|
142 | 142 | |
143 | 143 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
144 | 144 | echo '<h3>'; |
145 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
145 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'].' ('.$course_infos['code'].') '.$sessionTitle; |
|
146 | 146 | echo '</h3>'; |
147 | 147 | } |
148 | 148 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
299 | 299 | (when there are directories with hundred/thousand of files) */ |
300 | 300 | // this is a known issue of serialize |
301 | - $course->resources['document']= null; |
|
301 | + $course->resources['document'] = null; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | Display::display_warning_message(get_lang('NoDataAvailable')); |
316 | 316 | } else { |
317 | 317 | if (!empty($hidden_fields['destination_session'])) { |
318 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
318 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
319 | 319 | get_lang('Ok').'</button>'; |
320 | 320 | } else { |
321 | 321 | if ($recycleOption) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | static function display_hidden_quiz_questions($course) |
341 | 341 | { |
342 | - if(is_array($course->resources)){ |
|
342 | + if (is_array($course->resources)) { |
|
343 | 343 | foreach ($course->resources as $type => $resources) { |
344 | 344 | if (count($resources) > 0) { |
345 | 345 | switch ($type) { |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | */ |
360 | 360 | static function display_hidden_scorm_directories($course) |
361 | 361 | { |
362 | - if (is_array($course->resources)){ |
|
362 | + if (is_array($course->resources)) { |
|
363 | 363 | foreach ($course->resources as $type => $resources) { |
364 | 364 | if (count($resources) > 0) { |
365 | - switch($type) { |
|
365 | + switch ($type) { |
|
366 | 366 | case RESOURCE_SCORM: |
367 | 367 | foreach ($resources as $id => $resource) { |
368 | 368 | echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | if (is_array($resource)) { |
409 | 409 | $resource = array_keys($resource); |
410 | 410 | |
411 | - foreach ($resource as $resource_item) { |
|
411 | + foreach ($resource as $resource_item) { |
|
412 | 412 | |
413 | 413 | $condition_session = ''; |
414 | 414 | if (!empty($session_id)) { |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | tool = '".RESOURCE_DOCUMENT."' AND |
445 | 445 | ref = $resource_item "; |
446 | 446 | $res = Database::query($sql); |
447 | - $all_properties = array (); |
|
448 | - while ($item_property = Database::fetch_array($res,'ASSOC')) { |
|
447 | + $all_properties = array(); |
|
448 | + while ($item_property = Database::fetch_array($res, 'ASSOC')) { |
|
449 | 449 | $all_properties[] = $item_property; |
450 | 450 | } |
451 | 451 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | switch ($type) { |
462 | 462 | case RESOURCE_SURVEYQUESTION: |
463 | - foreach($resources as $id => $obj) { |
|
463 | + foreach ($resources as $id => $obj) { |
|
464 | 464 | if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
465 | 465 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
466 | 466 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | ) { |
536 | 536 | foreach ($documents as $id_to_check => $post_value) { |
537 | 537 | $obj_to_check = $resources[$id_to_check]; |
538 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
538 | + $shared_path_part = substr($obj_to_check->path, 0, strlen($obj->path)); |
|
539 | 539 | if ($id_to_check != $id && $obj->path == $shared_path_part) { |
540 | 540 | $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
541 | 541 | break; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
550 | 550 | // check if document is in a quiz (audio/video) |
551 | 551 | if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
552 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
552 | + foreach ($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
553 | 553 | $quiz = $quiz->obj; |
554 | 554 | if (isset($quiz->media) && $quiz->media == $id) { |
555 | 555 | $resource_is_used_elsewhere = true; |
@@ -618,15 +618,15 @@ discard block |
||
618 | 618 | <?php |
619 | 619 | |
620 | 620 | //get destination course title |
621 | - if(!empty($hidden_fields['destination_course'])) { |
|
621 | + if (!empty($hidden_fields['destination_course'])) { |
|
622 | 622 | if (!empty($hidden_fields['destination_session'])) { |
623 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
623 | + $sessionTitle = ' ('.api_get_session_name($hidden_fields['destination_session']).')'; |
|
624 | 624 | } else { |
625 | 625 | $sessionTitle = null; |
626 | 626 | } |
627 | 627 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
628 | 628 | echo '<h3>'; |
629 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
629 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'].$sessionTitle; |
|
630 | 630 | echo '</h3>'; |
631 | 631 | } |
632 | 632 | |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
635 | 635 | echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.api_get_path(WEB_CODE_PATH).'img/progress_bar.gif\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
636 | 636 | echo '<input type="hidden" name="action" value="course_select_form"/>'; |
637 | - foreach ($list_course as $course){ |
|
637 | + foreach ($list_course as $course) { |
|
638 | 638 | foreach ($course->resources as $type => $resources) { |
639 | 639 | if (count($resources) > 0) { |
640 | 640 | echo '<img id="img_'.$course->code.'" src="../img/1.gif" onclick="javascript:exp('."'$course->code'".');" />'; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | if ($avoid_serialize) { |
663 | 663 | //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
664 | 664 | // this is a known issue of serialize |
665 | - $course->resources['document']= null; |
|
665 | + $course->resources['document'] = null; |
|
666 | 666 | } |
667 | 667 | echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
668 | 668 | if (is_array($hidden_fields)) { |
@@ -527,14 +527,15 @@ |
||
527 | 527 | // Mark folders to import which are not selected by the user to import, |
528 | 528 | // but in which a document was selected. |
529 | 529 | $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
530 | - if (!empty($resources) && is_array($resources)) |
|
531 | - foreach ($resources as $id => $obj) { |
|
530 | + if (!empty($resources) && is_array($resources)) { |
|
531 | + foreach ($resources as $id => $obj) { |
|
532 | 532 | if (isset($obj->file_type) && $obj->file_type == 'folder' && |
533 | 533 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
534 | 534 | is_array($documents) |
535 | 535 | ) { |
536 | 536 | foreach ($documents as $id_to_check => $post_value) { |
537 | 537 | $obj_to_check = $resources[$id_to_check]; |
538 | + } |
|
538 | 539 | $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
539 | 540 | if ($id_to_check != $id && $obj->path == $shared_path_part) { |
540 | 541 | $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class CourseSelectForm |
13 | 13 | { |
14 | - /** |
|
15 | - * Display the form |
|
16 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
17 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
18 | - */ |
|
19 | - public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
14 | + /** |
|
15 | + * Display the form |
|
16 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
17 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
18 | + */ |
|
19 | + public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
20 | 20 | { |
21 | 21 | global $charset; |
22 | 22 | $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); |
@@ -134,50 +134,50 @@ discard block |
||
134 | 134 | </script> |
135 | 135 | <?php |
136 | 136 | |
137 | - //get destination course title |
|
138 | - if (!empty($hidden_fields['destination_course'])) { |
|
137 | + //get destination course title |
|
138 | + if (!empty($hidden_fields['destination_course'])) { |
|
139 | 139 | $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name( |
140 | 140 | $hidden_fields['destination_session'] |
141 | 141 | ) . ')' : null; |
142 | 142 | |
143 | 143 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
144 | - echo '<h3>'; |
|
145 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
146 | - echo '</h3>'; |
|
147 | - } |
|
144 | + echo '<h3>'; |
|
145 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
146 | + echo '</h3>'; |
|
147 | + } |
|
148 | 148 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
149 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
149 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
150 | 150 | $icon = Display::returnIconPath('myprogress_bar.gif'); |
151 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
152 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
151 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
152 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
153 | 153 | |
154 | - if (!empty($hidden_fields['destination_course']) && |
|
154 | + if (!empty($hidden_fields['destination_course']) && |
|
155 | 155 | !empty($hidden_fields['origin_course']) && |
156 | 156 | !empty($hidden_fields['destination_session']) && |
157 | 157 | !empty($hidden_fields['origin_session']) |
158 | 158 | ) { |
159 | - echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
160 | - echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
161 | - echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
162 | - echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
163 | - } |
|
159 | + echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
160 | + echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
161 | + echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
162 | + echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
163 | + } |
|
164 | 164 | |
165 | - $element_count = 0; |
|
165 | + $element_count = 0; |
|
166 | 166 | $forum_categories = array(); |
167 | 167 | $forums = array(); |
168 | 168 | $forum_topics = array(); |
169 | 169 | |
170 | 170 | echo '<p>'; |
171 | - echo get_lang('SelectResources'); |
|
172 | - echo '</p>'; |
|
171 | + echo get_lang('SelectResources'); |
|
172 | + echo '</p>'; |
|
173 | 173 | |
174 | 174 | Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
175 | 175 | |
176 | 176 | foreach ($course->resources as $type => $resources) { |
177 | 177 | if (count($resources) > 0) { |
178 | - switch ($type) { |
|
179 | - //Resources to avoid |
|
180 | - case RESOURCE_FORUMCATEGORY: |
|
178 | + switch ($type) { |
|
179 | + //Resources to avoid |
|
180 | + case RESOURCE_FORUMCATEGORY: |
|
181 | 181 | foreach ($resources as $id => $resource) { |
182 | 182 | $forum_categories[$id] = $resource; |
183 | 183 | } |
@@ -196,33 +196,33 @@ discard block |
||
196 | 196 | $element_count++; |
197 | 197 | break; |
198 | 198 | case RESOURCE_LINKCATEGORY: |
199 | - case RESOURCE_FORUMPOST: |
|
200 | - case RESOURCE_QUIZQUESTION: |
|
201 | - case RESOURCE_SURVEYQUESTION: |
|
202 | - case RESOURCE_SURVEYINVITATION: |
|
203 | - case RESOURCE_SCORM: |
|
204 | - break; |
|
199 | + case RESOURCE_FORUMPOST: |
|
200 | + case RESOURCE_QUIZQUESTION: |
|
201 | + case RESOURCE_SURVEYQUESTION: |
|
202 | + case RESOURCE_SURVEYINVITATION: |
|
203 | + case RESOURCE_SCORM: |
|
204 | + break; |
|
205 | 205 | default : |
206 | - echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
207 | - echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
208 | - echo '<div id="div_'.$type.'">'; |
|
209 | - if ($type == RESOURCE_LEARNPATH) { |
|
210 | - Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
211 | - Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
212 | - } |
|
213 | - if ($type == RESOURCE_DOCUMENT) { |
|
206 | + echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
207 | + echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
208 | + echo '<div id="div_'.$type.'">'; |
|
209 | + if ($type == RESOURCE_LEARNPATH) { |
|
210 | + Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
211 | + Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
212 | + } |
|
213 | + if ($type == RESOURCE_DOCUMENT) { |
|
214 | 214 | if (api_get_setting('show_glossary_in_documents') != 'none') { |
215 | 215 | Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
216 | 216 | } |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | - echo '<blockquote>'; |
|
219 | + echo '<blockquote>'; |
|
220 | 220 | echo '<div class="btn-group">'; |
221 | - echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
221 | + echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
222 | 222 | echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>"; |
223 | - echo '</div><br />'; |
|
223 | + echo '</div><br />'; |
|
224 | 224 | |
225 | - foreach ($resources as $id => $resource) { |
|
225 | + foreach ($resources as $id => $resource) { |
|
226 | 226 | if ($resource) { |
227 | 227 | Coursecopy\Resource::setClassType($resource); |
228 | 228 | echo '<label class="checkbox">'; |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | $resource->show(); |
231 | 231 | echo '</label>'; |
232 | 232 | } |
233 | - } |
|
234 | - echo '</blockquote>'; |
|
235 | - echo '</div>'; |
|
236 | - echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
237 | - $element_count++; |
|
233 | + } |
|
234 | + echo '</blockquote>'; |
|
235 | + echo '</div>'; |
|
236 | + echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
237 | + $element_count++; |
|
238 | 238 | } |
239 | - } |
|
240 | - } |
|
239 | + } |
|
240 | + } |
|
241 | 241 | |
242 | 242 | //Fixes forum order |
243 | 243 | if (!empty($forum_categories)) { |
@@ -293,65 +293,65 @@ discard block |
||
293 | 293 | echo '<script language="javascript">exp('."'$type'".')</script>'; |
294 | 294 | } |
295 | 295 | |
296 | - if ($avoid_serialize) { |
|
297 | - /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
296 | + if ($avoid_serialize) { |
|
297 | + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
298 | 298 | (when there are directories with hundred/thousand of files) */ |
299 | - // this is a known issue of serialize |
|
300 | - $course->resources['document']= null; |
|
301 | - } |
|
299 | + // this is a known issue of serialize |
|
300 | + $course->resources['document']= null; |
|
301 | + } |
|
302 | 302 | |
303 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
303 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
304 | 304 | |
305 | - if (is_array($hidden_fields)) { |
|
306 | - foreach ($hidden_fields as $key => $value) { |
|
307 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
308 | - } |
|
309 | - } |
|
305 | + if (is_array($hidden_fields)) { |
|
306 | + foreach ($hidden_fields as $key => $value) { |
|
307 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
308 | + } |
|
309 | + } |
|
310 | 310 | |
311 | 311 | $recycleOption = isset($_POST['recycle_option']) ? true : false; |
312 | 312 | |
313 | - if (empty($element_count)) { |
|
314 | - Display::display_warning_message(get_lang('NoDataAvailable')); |
|
315 | - } else { |
|
316 | - if (!empty($hidden_fields['destination_session'])) { |
|
317 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
313 | + if (empty($element_count)) { |
|
314 | + Display::display_warning_message(get_lang('NoDataAvailable')); |
|
315 | + } else { |
|
316 | + if (!empty($hidden_fields['destination_session'])) { |
|
317 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
318 | 318 | get_lang('Ok').'</button>'; |
319 | - } else { |
|
319 | + } else { |
|
320 | 320 | if ($recycleOption) { |
321 | 321 | echo '<br /><button class="save" type="submit">'. |
322 | 322 | get_lang('Ok').'</button>'; |
323 | 323 | } else { |
324 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
324 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
325 | 325 | get_lang('Ok').'</button>'; |
326 | 326 | } |
327 | - } |
|
328 | - } |
|
327 | + } |
|
328 | + } |
|
329 | 329 | |
330 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
331 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
332 | - echo '</form>'; |
|
333 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
334 | - } |
|
330 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
331 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
332 | + echo '</form>'; |
|
333 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
334 | + } |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * @param $course |
338 | 338 | */ |
339 | 339 | static function display_hidden_quiz_questions($course) |
340 | 340 | { |
341 | - if(is_array($course->resources)){ |
|
342 | - foreach ($course->resources as $type => $resources) { |
|
343 | - if (count($resources) > 0) { |
|
344 | - switch ($type) { |
|
345 | - case RESOURCE_QUIZQUESTION: |
|
346 | - foreach ($resources as $id => $resource) { |
|
347 | - echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
348 | - } |
|
349 | - break; |
|
350 | - } |
|
351 | - } |
|
352 | - } |
|
353 | - } |
|
354 | - } |
|
341 | + if(is_array($course->resources)){ |
|
342 | + foreach ($course->resources as $type => $resources) { |
|
343 | + if (count($resources) > 0) { |
|
344 | + switch ($type) { |
|
345 | + case RESOURCE_QUIZQUESTION: |
|
346 | + foreach ($resources as $id => $resource) { |
|
347 | + echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
348 | + } |
|
349 | + break; |
|
350 | + } |
|
351 | + } |
|
352 | + } |
|
353 | + } |
|
354 | + } |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * @param $course |
@@ -359,30 +359,30 @@ discard block |
||
359 | 359 | static function display_hidden_scorm_directories($course) |
360 | 360 | { |
361 | 361 | if (is_array($course->resources)){ |
362 | - foreach ($course->resources as $type => $resources) { |
|
363 | - if (count($resources) > 0) { |
|
364 | - switch($type) { |
|
365 | - case RESOURCE_SCORM: |
|
366 | - foreach ($resources as $id => $resource) { |
|
367 | - echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
368 | - } |
|
369 | - break; |
|
370 | - } |
|
371 | - } |
|
372 | - } |
|
373 | - } |
|
374 | - } |
|
362 | + foreach ($course->resources as $type => $resources) { |
|
363 | + if (count($resources) > 0) { |
|
364 | + switch($type) { |
|
365 | + case RESOURCE_SCORM: |
|
366 | + foreach ($resources as $id => $resource) { |
|
367 | + echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
368 | + } |
|
369 | + break; |
|
370 | + } |
|
371 | + } |
|
372 | + } |
|
373 | + } |
|
374 | + } |
|
375 | 375 | |
376 | - /** |
|
377 | - * Get the posted course |
|
378 | - * @param string $from who calls the function? |
|
376 | + /** |
|
377 | + * Get the posted course |
|
378 | + * @param string $from who calls the function? |
|
379 | 379 | * It can be copy_course, create_backup, import_backup or recycle_course |
380 | 380 | * @param int $session_id |
381 | 381 | * @param string $course_code |
382 | - * @return course The course-object with all resources selected by the user |
|
383 | - * in the form given by display_form(...) |
|
384 | - */ |
|
385 | - public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
382 | + * @return course The course-object with all resources selected by the user |
|
383 | + * in the form given by display_form(...) |
|
384 | + */ |
|
385 | + public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
386 | 386 | { |
387 | 387 | $course = null; |
388 | 388 | |
@@ -392,30 +392,30 @@ discard block |
||
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | |
395 | - // Create the resource DOCUMENT objects |
|
396 | - // Loading the results from the checkboxes of ethe javascript |
|
397 | - $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
395 | + // Create the resource DOCUMENT objects |
|
396 | + // Loading the results from the checkboxes of ethe javascript |
|
397 | + $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
398 | 398 | |
399 | - $course_info = api_get_course_info($course_code); |
|
400 | - $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
401 | - $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
402 | - $course_id = $course_info['real_id']; |
|
399 | + $course_info = api_get_course_info($course_code); |
|
400 | + $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
401 | + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
402 | + $course_id = $course_info['real_id']; |
|
403 | 403 | |
404 | - /* Searching the documents resource that have been set to null because |
|
404 | + /* Searching the documents resource that have been set to null because |
|
405 | 405 | $avoid_serialize is true in the display_form() function*/ |
406 | - if ($from == 'copy_course') { |
|
407 | - if (is_array($resource)) { |
|
408 | - $resource = array_keys($resource); |
|
406 | + if ($from == 'copy_course') { |
|
407 | + if (is_array($resource)) { |
|
408 | + $resource = array_keys($resource); |
|
409 | 409 | |
410 | - foreach ($resource as $resource_item) { |
|
410 | + foreach ($resource as $resource_item) { |
|
411 | 411 | |
412 | - $condition_session = ''; |
|
413 | - if (!empty($session_id)) { |
|
414 | - $session_id = intval($session_id); |
|
415 | - $condition_session = ' AND d.session_id ='.$session_id; |
|
416 | - } |
|
412 | + $condition_session = ''; |
|
413 | + if (!empty($session_id)) { |
|
414 | + $session_id = intval($session_id); |
|
415 | + $condition_session = ' AND d.session_id ='.$session_id; |
|
416 | + } |
|
417 | 417 | |
418 | - $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
418 | + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
419 | 419 | FROM '.$table_doc.' d, '.$table_prop.' p |
420 | 420 | WHERE |
421 | 421 | d.c_id = '.$course_id.' AND |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | p.ref = d.id AND p.visibility != 2 AND |
425 | 425 | d.id = '.$resource_item.$condition_session.' |
426 | 426 | ORDER BY path'; |
427 | - $db_result = Database::query($sql); |
|
428 | - while ($obj = Database::fetch_object($db_result)) { |
|
427 | + $db_result = Database::query($sql); |
|
428 | + while ($obj = Database::fetch_object($db_result)) { |
|
429 | 429 | $doc = new Document( |
430 | 430 | $obj->id, |
431 | 431 | $obj->path, |
@@ -449,25 +449,25 @@ discard block |
||
449 | 449 | } |
450 | 450 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
451 | 451 | } |
452 | - } |
|
453 | - } |
|
454 | - } |
|
455 | - } |
|
452 | + } |
|
453 | + } |
|
454 | + } |
|
455 | + } |
|
456 | 456 | |
457 | - if (is_array($course->resources)) { |
|
458 | - foreach ($course->resources as $type => $resources) { |
|
457 | + if (is_array($course->resources)) { |
|
458 | + foreach ($course->resources as $type => $resources) { |
|
459 | 459 | |
460 | - switch ($type) { |
|
461 | - case RESOURCE_SURVEYQUESTION: |
|
462 | - foreach($resources as $id => $obj) { |
|
463 | - if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
460 | + switch ($type) { |
|
461 | + case RESOURCE_SURVEYQUESTION: |
|
462 | + foreach($resources as $id => $obj) { |
|
463 | + if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
464 | 464 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
465 | 465 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
466 | 466 | ) { |
467 | - unset($course->resources[$type][$id]); |
|
468 | - } |
|
469 | - } |
|
470 | - break; |
|
467 | + unset($course->resources[$type][$id]); |
|
468 | + } |
|
469 | + } |
|
470 | + break; |
|
471 | 471 | case RESOURCE_FORUMTOPIC: |
472 | 472 | case RESOURCE_FORUMPOST: |
473 | 473 | //Add post from topic |
@@ -519,62 +519,62 @@ discard block |
||
519 | 519 | } |
520 | 520 | } |
521 | 521 | } |
522 | - case RESOURCE_LINKCATEGORY : |
|
523 | - case RESOURCE_FORUMCATEGORY : |
|
524 | - case RESOURCE_QUIZQUESTION : |
|
525 | - case RESOURCE_DOCUMENT: |
|
526 | - // Mark folders to import which are not selected by the user to import, |
|
527 | - // but in which a document was selected. |
|
528 | - $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
529 | - if (!empty($resources) && is_array($resources)) |
|
530 | - foreach ($resources as $id => $obj) { |
|
531 | - if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
522 | + case RESOURCE_LINKCATEGORY : |
|
523 | + case RESOURCE_FORUMCATEGORY : |
|
524 | + case RESOURCE_QUIZQUESTION : |
|
525 | + case RESOURCE_DOCUMENT: |
|
526 | + // Mark folders to import which are not selected by the user to import, |
|
527 | + // but in which a document was selected. |
|
528 | + $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
529 | + if (!empty($resources) && is_array($resources)) |
|
530 | + foreach ($resources as $id => $obj) { |
|
531 | + if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
532 | 532 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
533 | 533 | is_array($documents) |
534 | 534 | ) { |
535 | - foreach ($documents as $id_to_check => $post_value) { |
|
536 | - $obj_to_check = $resources[$id_to_check]; |
|
537 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
538 | - if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
539 | - $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
540 | - break; |
|
541 | - } |
|
542 | - } |
|
543 | - } |
|
544 | - } |
|
545 | - default : |
|
546 | - if (!empty($resources) && is_array($resources)) { |
|
547 | - foreach ($resources as $id => $obj) { |
|
548 | - $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
549 | - // check if document is in a quiz (audio/video) |
|
550 | - if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
551 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
535 | + foreach ($documents as $id_to_check => $post_value) { |
|
536 | + $obj_to_check = $resources[$id_to_check]; |
|
537 | + $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
538 | + if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
539 | + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
540 | + break; |
|
541 | + } |
|
542 | + } |
|
543 | + } |
|
544 | + } |
|
545 | + default : |
|
546 | + if (!empty($resources) && is_array($resources)) { |
|
547 | + foreach ($resources as $id => $obj) { |
|
548 | + $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
549 | + // check if document is in a quiz (audio/video) |
|
550 | + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
551 | + foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
552 | 552 | $quiz = $quiz->obj; |
553 | - if (isset($quiz->media) && $quiz->media == $id) { |
|
554 | - $resource_is_used_elsewhere = true; |
|
555 | - } |
|
556 | - } |
|
557 | - } |
|
558 | - if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
559 | - unset($course->resources[$type][$id]); |
|
560 | - } |
|
561 | - } |
|
562 | - } |
|
563 | - } |
|
564 | - } |
|
565 | - } |
|
566 | - |
|
567 | - return $course; |
|
568 | - } |
|
569 | - |
|
570 | - /** |
|
571 | - * Display the form session export |
|
572 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
573 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
574 | - */ |
|
575 | - public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
576 | - { |
|
577 | - ?> |
|
553 | + if (isset($quiz->media) && $quiz->media == $id) { |
|
554 | + $resource_is_used_elsewhere = true; |
|
555 | + } |
|
556 | + } |
|
557 | + } |
|
558 | + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
559 | + unset($course->resources[$type][$id]); |
|
560 | + } |
|
561 | + } |
|
562 | + } |
|
563 | + } |
|
564 | + } |
|
565 | + } |
|
566 | + |
|
567 | + return $course; |
|
568 | + } |
|
569 | + |
|
570 | + /** |
|
571 | + * Display the form session export |
|
572 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
573 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
574 | + */ |
|
575 | + public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
576 | + { |
|
577 | + ?> |
|
578 | 578 | <script> |
579 | 579 | function exp(item) { |
580 | 580 | el = document.getElementById('div_'+item); |
@@ -616,65 +616,65 @@ discard block |
||
616 | 616 | </script> |
617 | 617 | <?php |
618 | 618 | |
619 | - //get destination course title |
|
620 | - if(!empty($hidden_fields['destination_course'])) { |
|
621 | - if (!empty($hidden_fields['destination_session'])) { |
|
622 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
623 | - } else { |
|
624 | - $sessionTitle = null; |
|
625 | - } |
|
619 | + //get destination course title |
|
620 | + if(!empty($hidden_fields['destination_course'])) { |
|
621 | + if (!empty($hidden_fields['destination_session'])) { |
|
622 | + $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
623 | + } else { |
|
624 | + $sessionTitle = null; |
|
625 | + } |
|
626 | 626 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
627 | - echo '<h3>'; |
|
628 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
629 | - echo '</h3>'; |
|
630 | - } |
|
627 | + echo '<h3>'; |
|
628 | + echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
629 | + echo '</h3>'; |
|
630 | + } |
|
631 | 631 | |
632 | - echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
633 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
632 | + echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
633 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
634 | 634 | $icon = Display::returnIconPath('progress_bar.gif'); |
635 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
636 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
637 | - foreach ($list_course as $course){ |
|
638 | - foreach ($course->resources as $type => $resources) { |
|
639 | - if (count($resources) > 0) { |
|
640 | - echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
641 | - echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
642 | - echo '<div id="div_'.$course->code.'">'; |
|
643 | - echo '<blockquote>'; |
|
635 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
636 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
637 | + foreach ($list_course as $course){ |
|
638 | + foreach ($course->resources as $type => $resources) { |
|
639 | + if (count($resources) > 0) { |
|
640 | + echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
641 | + echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
642 | + echo '<div id="div_'.$course->code.'">'; |
|
643 | + echo '<blockquote>'; |
|
644 | 644 | |
645 | 645 | echo '<div class="btn-group">'; |
646 | - echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
646 | + echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
647 | 647 | echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>"; |
648 | - echo '</div><br />'; |
|
648 | + echo '</div><br />'; |
|
649 | 649 | |
650 | - foreach ($resources as $id => $resource) { |
|
651 | - echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
650 | + foreach ($resources as $id => $resource) { |
|
651 | + echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
652 | 652 | echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>'; |
653 | - $resource->show(); |
|
654 | - echo '</label>'; |
|
655 | - } |
|
656 | - echo '</blockquote>'; |
|
657 | - echo '</div>'; |
|
658 | - echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
659 | - } |
|
660 | - } |
|
661 | - } |
|
662 | - if ($avoid_serialize) { |
|
663 | - //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
664 | - // this is a known issue of serialize |
|
665 | - $course->resources['document']= null; |
|
666 | - } |
|
667 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
668 | - if (is_array($hidden_fields)) { |
|
669 | - foreach ($hidden_fields as $key => $value) { |
|
670 | - echo "\n"; |
|
671 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
672 | - } |
|
673 | - } |
|
674 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
675 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
676 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
677 | - echo '</form>'; |
|
678 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
679 | - } |
|
653 | + $resource->show(); |
|
654 | + echo '</label>'; |
|
655 | + } |
|
656 | + echo '</blockquote>'; |
|
657 | + echo '</div>'; |
|
658 | + echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
659 | + } |
|
660 | + } |
|
661 | + } |
|
662 | + if ($avoid_serialize) { |
|
663 | + //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
664 | + // this is a known issue of serialize |
|
665 | + $course->resources['document']= null; |
|
666 | + } |
|
667 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
668 | + if (is_array($hidden_fields)) { |
|
669 | + foreach ($hidden_fields as $key => $value) { |
|
670 | + echo "\n"; |
|
671 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
672 | + } |
|
673 | + } |
|
674 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
675 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
676 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
677 | + echo '</form>'; |
|
678 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
679 | + } |
|
680 | 680 | } |
@@ -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; |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
329 | - * Serialize the course with the best serializer available |
|
330 | - * @return string |
|
331 | - */ |
|
329 | + * Serialize the course with the best serializer available |
|
330 | + * @return string |
|
331 | + */ |
|
332 | 332 | public static function serialize($course) |
333 | 333 | { |
334 | 334 | if (extension_loaded('igbinary')) { |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Unserialize the course with the best serializer available |
|
343 | - * @param string $course |
|
344 | - */ |
|
342 | + * Unserialize the course with the best serializer available |
|
343 | + * @param string $course |
|
344 | + */ |
|
345 | 345 | public static function unserialize($course) |
346 | 346 | { |
347 | 347 | if (extension_loaded('igbinary')) { |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
622 | - * Recycle Thematics |
|
623 | - */ |
|
622 | + * Recycle Thematics |
|
623 | + */ |
|
624 | 624 | public function recycle_thematic($session_id = 0) |
625 | 625 | { |
626 | 626 | if ($this->course->has_resources(RESOURCE_THEMATIC)) { |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
688 | - * Recycle Attendances |
|
689 | - */ |
|
688 | + * Recycle Attendances |
|
689 | + */ |
|
690 | 690 | public function recycle_attendance($session_id = 0) |
691 | 691 | { |
692 | 692 | if ($this->course->has_resources(RESOURCE_ATTENDANCE)) { |
@@ -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; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * @return bool |
|
41 | + * @return false|null |
|
42 | 42 | */ |
43 | 43 | public function create_user_folder() |
44 | 44 | { |
@@ -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 | } |
@@ -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 | } |