@@ -11,13 +11,13 @@ |
||
11 | 11 | { |
12 | 12 | public $params = array(); |
13 | 13 | public $thematic_advance_list = array(); |
14 | - public $thematic_plan_list = array(); |
|
14 | + public $thematic_plan_list = array(); |
|
15 | 15 | |
16 | 16 | /** |
17 | - * Create a new Thematic |
|
18 | - * |
|
19 | - * @param array $params |
|
20 | - */ |
|
17 | + * Create a new Thematic |
|
18 | + * |
|
19 | + * @param array $params |
|
20 | + */ |
|
21 | 21 | public function __construct($params) |
22 | 22 | { |
23 | 23 | parent::__construct($params['id'], RESOURCE_THEMATIC); |
@@ -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 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | echo json_encode($response_data); |
64 | 64 | } |
65 | 65 | break; |
66 | - case 'show_course_information' : |
|
67 | - require_once '../global.inc.php'; |
|
66 | + case 'show_course_information' : |
|
67 | + require_once '../global.inc.php'; |
|
68 | 68 | |
69 | - // Get the name of the database course. |
|
70 | - $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
71 | - $course_info = api_get_course_info($_GET['code']); |
|
69 | + // Get the name of the database course. |
|
70 | + $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); |
|
71 | + $course_info = api_get_course_info($_GET['code']); |
|
72 | 72 | |
73 | 73 | if ( |
74 | 74 | api_get_setting('course_catalog_hide_private') === 'true' && |
@@ -78,24 +78,24 @@ discard block |
||
78 | 78 | break; |
79 | 79 | } |
80 | 80 | |
81 | - $sql = "SELECT * FROM $tbl_course_description |
|
81 | + $sql = "SELECT * FROM $tbl_course_description |
|
82 | 82 | WHERE c_id = ".$course_info['real_id']." AND session_id = 0 |
83 | 83 | ORDER BY id"; |
84 | - $result = Database::query($sql); |
|
85 | - if (Database::num_rows($result) > 0 ) { |
|
86 | - while ($description = Database::fetch_object($result)) { |
|
87 | - $descriptions[$description->id] = $description; |
|
88 | - } |
|
84 | + $result = Database::query($sql); |
|
85 | + if (Database::num_rows($result) > 0 ) { |
|
86 | + while ($description = Database::fetch_object($result)) { |
|
87 | + $descriptions[$description->id] = $description; |
|
88 | + } |
|
89 | 89 | // Function that displays the details of the course description in html. |
90 | - echo CourseManager::get_details_course_description_html( |
|
90 | + echo CourseManager::get_details_course_description_html( |
|
91 | 91 | $descriptions, |
92 | 92 | api_get_system_encoding(), |
93 | 93 | false |
94 | 94 | ); |
95 | - } else { |
|
96 | - echo get_lang('NoDescription'); |
|
97 | - } |
|
98 | - break; |
|
95 | + } else { |
|
96 | + echo get_lang('NoDescription'); |
|
97 | + } |
|
98 | + break; |
|
99 | 99 | case 'session_courses_lp_default': |
100 | 100 | /** |
101 | 101 | * @todo this functions need to belong to a class or a special |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id'; |
111 | 111 | $sord = $_REQUEST['sord']; //asc or desc |
112 | 112 | if (!in_array($sord, array('asc','desc'))) { |
113 | - $sord = 'desc'; |
|
113 | + $sord = 'desc'; |
|
114 | 114 | } |
115 | 115 | $session_id = intval($_REQUEST['session_id']); |
116 | 116 | $course_id = intval($_REQUEST['course_id']); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $my_session_list[] = $item['id_session']; |
125 | 125 | } |
126 | 126 | if (!in_array($session_id, $my_session_list)) { |
127 | - break; |
|
127 | + break; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $date = '-'; |
446 | 446 | } |
447 | 447 | |
448 | - //Checking LP publicated and expired_on dates |
|
448 | + //Checking LP publicated and expired_on dates |
|
449 | 449 | if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') { |
450 | 450 | if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) { |
451 | 451 | continue; |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | |
500 | 500 | echo json_encode($response); |
501 | 501 | break; |
502 | - default: |
|
503 | - echo ''; |
|
502 | + default: |
|
503 | + echo ''; |
|
504 | 504 | } |
505 | 505 | exit; |
@@ -12,31 +12,31 @@ discard block |
||
12 | 12 | **/ |
13 | 13 | class HotSpot extends Question |
14 | 14 | { |
15 | - public static $typePicture = 'hotspot.png'; |
|
16 | - public static $explanationLangVar = 'HotSpot'; |
|
15 | + public static $typePicture = 'hotspot.png'; |
|
16 | + public static $explanationLangVar = 'HotSpot'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * HotSpot constructor. |
20 | 20 | */ |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - $this -> type = HOT_SPOT; |
|
25 | - } |
|
26 | - |
|
27 | - public function display() |
|
28 | - { |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * @param FormValidator $form |
|
33 | - * @param int $fck_config |
|
34 | - */ |
|
35 | - public function createForm (&$form, $fck_config=0) |
|
36 | - { |
|
37 | - parent::createForm($form, $fck_config); |
|
38 | - |
|
39 | - if (!isset($_GET['editQuestion'])) { |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + $this -> type = HOT_SPOT; |
|
25 | + } |
|
26 | + |
|
27 | + public function display() |
|
28 | + { |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * @param FormValidator $form |
|
33 | + * @param int $fck_config |
|
34 | + */ |
|
35 | + public function createForm (&$form, $fck_config=0) |
|
36 | + { |
|
37 | + parent::createForm($form, $fck_config); |
|
38 | + |
|
39 | + if (!isset($_GET['editQuestion'])) { |
|
40 | 40 | $form->addElement( |
41 | 41 | 'file', |
42 | 42 | 'imageUpload', |
@@ -46,54 +46,54 @@ discard block |
||
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | |
49 | - // setting the save button here and not in the question class.php |
|
50 | - // Saving a question |
|
51 | - $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
52 | - //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
53 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
54 | - $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
55 | - } else { |
|
56 | - // setting the save button here and not in the question class.php |
|
57 | - // Editing a question |
|
58 | - $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @param FormValidator $form |
|
64 | - * @param null $objExercise |
|
65 | - * @return null|false |
|
66 | - */ |
|
67 | - public function processCreation($form, $objExercise = null) |
|
68 | - { |
|
69 | - $file_info = $form->getSubmitValue('imageUpload'); |
|
70 | - $_course = api_get_course_info(); |
|
71 | - parent::processCreation($form, $objExercise); |
|
72 | - |
|
73 | - if(!empty($file_info['tmp_name'])) { |
|
74 | - $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
75 | - $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
76 | - $picturePath = $documentPath.'/images'; |
|
77 | - |
|
78 | - // fixed width ang height |
|
79 | - if (file_exists($picturePath.'/'.$this->picture)) { |
|
80 | - $this->resizePicture('width', 800); |
|
81 | - $this->save(); |
|
82 | - } else { |
|
83 | - return false; |
|
84 | - } |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - function createAnswersForm($form) |
|
89 | - { |
|
90 | - // nothing |
|
91 | - } |
|
92 | - |
|
93 | - function processAnswersCreation($form) |
|
94 | - { |
|
95 | - // nothing |
|
96 | - } |
|
49 | + // setting the save button here and not in the question class.php |
|
50 | + // Saving a question |
|
51 | + $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
52 | + //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
53 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
54 | + $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
55 | + } else { |
|
56 | + // setting the save button here and not in the question class.php |
|
57 | + // Editing a question |
|
58 | + $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @param FormValidator $form |
|
64 | + * @param null $objExercise |
|
65 | + * @return null|false |
|
66 | + */ |
|
67 | + public function processCreation($form, $objExercise = null) |
|
68 | + { |
|
69 | + $file_info = $form->getSubmitValue('imageUpload'); |
|
70 | + $_course = api_get_course_info(); |
|
71 | + parent::processCreation($form, $objExercise); |
|
72 | + |
|
73 | + if(!empty($file_info['tmp_name'])) { |
|
74 | + $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
75 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
76 | + $picturePath = $documentPath.'/images'; |
|
77 | + |
|
78 | + // fixed width ang height |
|
79 | + if (file_exists($picturePath.'/'.$this->picture)) { |
|
80 | + $this->resizePicture('width', 800); |
|
81 | + $this->save(); |
|
82 | + } else { |
|
83 | + return false; |
|
84 | + } |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + function createAnswersForm($form) |
|
89 | + { |
|
90 | + // nothing |
|
91 | + } |
|
92 | + |
|
93 | + function processAnswersCreation($form) |
|
94 | + { |
|
95 | + // nothing |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,35 +101,35 @@ discard block |
||
101 | 101 | */ |
102 | 102 | class HotSpotDelineation extends HotSpot |
103 | 103 | { |
104 | - static $typePicture = 'hotspot-delineation.png'; |
|
105 | - static $explanationLangVar = 'HotspotDelineation'; |
|
106 | - |
|
107 | - function __construct() |
|
108 | - { |
|
109 | - parent::__construct(); |
|
110 | - $this -> type = HOT_SPOT_DELINEATION; |
|
111 | - |
|
112 | - } |
|
113 | - |
|
114 | - function createForm (&$form, $fck_config=0) |
|
115 | - { |
|
116 | - parent::createForm ($form, $fck_config); |
|
117 | - } |
|
118 | - |
|
119 | - function processCreation ($form, $objExercise = null) |
|
120 | - { |
|
121 | - $file_info = $form -> getSubmitValue('imageUpload'); |
|
122 | - parent::processCreation ($form, $objExercise); |
|
123 | - } |
|
124 | - |
|
125 | - function createAnswersForm ($form) |
|
126 | - { |
|
127 | - parent::createAnswersForm ($form); |
|
128 | - } |
|
129 | - |
|
130 | - function processAnswersCreation ($form) |
|
131 | - { |
|
132 | - parent::processAnswersCreation ($form); |
|
133 | - } |
|
104 | + static $typePicture = 'hotspot-delineation.png'; |
|
105 | + static $explanationLangVar = 'HotspotDelineation'; |
|
106 | + |
|
107 | + function __construct() |
|
108 | + { |
|
109 | + parent::__construct(); |
|
110 | + $this -> type = HOT_SPOT_DELINEATION; |
|
111 | + |
|
112 | + } |
|
113 | + |
|
114 | + function createForm (&$form, $fck_config=0) |
|
115 | + { |
|
116 | + parent::createForm ($form, $fck_config); |
|
117 | + } |
|
118 | + |
|
119 | + function processCreation ($form, $objExercise = null) |
|
120 | + { |
|
121 | + $file_info = $form -> getSubmitValue('imageUpload'); |
|
122 | + parent::processCreation ($form, $objExercise); |
|
123 | + } |
|
124 | + |
|
125 | + function createAnswersForm ($form) |
|
126 | + { |
|
127 | + parent::createAnswersForm ($form); |
|
128 | + } |
|
129 | + |
|
130 | + function processAnswersCreation ($form) |
|
131 | + { |
|
132 | + parent::processAnswersCreation ($form); |
|
133 | + } |
|
134 | 134 | } |
135 | 135 |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $is_allowedToEdit=$is_courseAdmin; |
55 | 55 | |
56 | 56 | if (isset($_SESSION['gradebook'])){ |
57 | - $gradebook= $_SESSION['gradebook']; |
|
57 | + $gradebook= $_SESSION['gradebook']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if (!empty($gradebook) && $gradebook=='view') { |
61 | - $interbreadcrumb[]= array ( |
|
61 | + $interbreadcrumb[]= array ( |
|
62 | 62 | 'url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), |
63 | 63 | 'name' => get_lang('ToolGradebook') |
64 | 64 | ); |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | Display::display_header($nameTools,"Exercises"); |
72 | 72 | |
73 | 73 | if (isset($_POST['ok'])) { |
74 | - $message = get_lang('TestLimitsAdded'); |
|
75 | - Display::display_normal_message($message); |
|
74 | + $message = get_lang('TestLimitsAdded'); |
|
75 | + Display::display_normal_message($message); |
|
76 | 76 | } |
77 | 77 | ?> |
78 | 78 | <script type="text/javascript"> |
@@ -139,22 +139,22 @@ discard block |
||
139 | 139 | * @todo shouldn't this be moved to the part above (around line 111: action handling) |
140 | 140 | */ |
141 | 141 | if (isset($_POST['ok'])) { |
142 | - $exercise_id = intval($_POST['exe_id']); |
|
143 | - if ($_POST['limit']==1) { |
|
144 | - $minutes = intval($_POST['minutes']); |
|
145 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | - Database::query($query); |
|
147 | - } else { |
|
148 | - $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | - Database::query($query); |
|
150 | - } |
|
142 | + $exercise_id = intval($_POST['exe_id']); |
|
143 | + if ($_POST['limit']==1) { |
|
144 | + $minutes = intval($_POST['minutes']); |
|
145 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= $minutes WHERE id= $exercise_id"; |
|
146 | + Database::query($query); |
|
147 | + } else { |
|
148 | + $query = "UPDATE ".$TBL_EXERCISES." SET ques_time_limit= 0 WHERE id= $exercise_id"; |
|
149 | + Database::query($query); |
|
150 | + } |
|
151 | 151 | |
152 | - if ($_POST['attempt']==1) { |
|
153 | - $attempts = intval($_POST['attempts']); |
|
154 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | - Database::query($query); |
|
156 | - } else { |
|
157 | - $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | - Database::query($query); |
|
159 | - } |
|
152 | + if ($_POST['attempt']==1) { |
|
153 | + $attempts = intval($_POST['attempts']); |
|
154 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = $attempts WHERE id= $exercise_id"; |
|
155 | + Database::query($query); |
|
156 | + } else { |
|
157 | + $query = "UPDATE ".$TBL_EXERCISES." SET num_attempts = 0 WHERE id= $exercise_id"; |
|
158 | + Database::query($query); |
|
159 | + } |
|
160 | 160 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | //user has submitted a file |
49 | 49 | if (isset($_FILES['user_upload'])) { |
50 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
51 | - if ($upload_ok) { |
|
52 | - //file got on the server without problems, now process it |
|
50 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
51 | + if ($upload_ok) { |
|
52 | + //file got on the server without problems, now process it |
|
53 | 53 | $new_path = handle_uploaded_document( |
54 | 54 | $_course, |
55 | 55 | $_FILES['user_upload'], |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | $_POST['unzip'], |
62 | 62 | $_POST['if_exists'] |
63 | 63 | ); |
64 | - $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
65 | - $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
64 | + $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
65 | + $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
66 | 66 | |
67 | - if ($new_path && ($new_comment || $new_title)) |
|
68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | - $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
70 | - $ct = ''; |
|
67 | + if ($new_path && ($new_comment || $new_title)) |
|
68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | + $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
70 | + $ct = ''; |
|
71 | 71 | if ($new_comment) { |
72 | 72 | $ct .= ", comment='$new_comment'"; |
73 | 73 | } |
74 | 74 | if ($new_title) { |
75 | 75 | $ct .= ", title='$new_title'"; |
76 | 76 | } |
77 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
78 | - } |
|
77 | + Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
78 | + } |
|
79 | 79 | //check for missing images in html files |
80 | 80 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
81 | 81 | if ($missing_files) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | //they want to create a directory |
134 | 134 | if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
135 | 135 | $added_slash = $path == '/' ? '' : '/'; |
136 | - $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
136 | + $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
137 | 137 | $created_dir = create_unexisting_directory( |
138 | 138 | $_course, |
139 | 139 | api_get_user_id(), |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if (isset($_GET['createdir'])) { |
156 | - //create the form that asks for the directory name |
|
157 | - $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
158 | - $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
159 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
160 | - $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
161 | - $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
162 | - $new_folder_text .= '</form>'; |
|
163 | - //show the form |
|
164 | - Display::display_normal_message($new_folder_text); |
|
156 | + //create the form that asks for the directory name |
|
157 | + $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
158 | + $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
159 | + $new_folder_text .= get_lang('NewDir') .' '; |
|
160 | + $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
161 | + $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
162 | + $new_folder_text .= '</form>'; |
|
163 | + //show the form |
|
164 | + Display::display_normal_message($new_folder_text); |
|
165 | 165 | } else { //give them a link to create a directory |
166 | 166 | ?> |
167 | 167 | <p> |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | function unset_session_resources() { |
27 | - $_SESSION['addedresource']=''; |
|
28 | - $_SESSION['addedresourceid']=''; |
|
29 | - Session::erase('addedresource'); |
|
30 | - Session::erase('addedresourceid'); |
|
27 | + $_SESSION['addedresource']=''; |
|
28 | + $_SESSION['addedresourceid']=''; |
|
29 | + Session::erase('addedresource'); |
|
30 | + Session::erase('addedresourceid'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,24 +35,24 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function show_folder_up() |
37 | 37 | { |
38 | - global $folder; |
|
39 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
40 | - |
|
41 | - $level = get_levels($folder); |
|
42 | - |
|
43 | - if ($level == 1) |
|
44 | - { |
|
45 | - echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
46 | - } |
|
47 | - if ($level and $level != 0 and $level != 1) |
|
48 | - { |
|
49 | - $folder_up=$folder; |
|
50 | - $folder_temp=explode('/',$folder); |
|
51 | - $last=count($folder_temp)-1; |
|
52 | - unset($folder_temp[$last]); |
|
53 | - $folder_up=implode('/',$folder_temp); |
|
54 | - echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&folder=$folder_up&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
55 | - } |
|
38 | + global $folder; |
|
39 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
40 | + |
|
41 | + $level = get_levels($folder); |
|
42 | + |
|
43 | + if ($level == 1) |
|
44 | + { |
|
45 | + echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
46 | + } |
|
47 | + if ($level and $level != 0 and $level != 1) |
|
48 | + { |
|
49 | + $folder_up=$folder; |
|
50 | + $folder_temp=explode('/',$folder); |
|
51 | + $last=count($folder_temp)-1; |
|
52 | + unset($folder_temp[$last]); |
|
53 | + $folder_up=implode('/',$folder_temp); |
|
54 | + echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&folder=$folder_up&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function show_documents($folder) |
63 | 63 | { |
64 | - global $_course; |
|
65 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
66 | - |
|
67 | - // documents are a special case: the teacher can add an invisible document (it will be viewable by the user) |
|
68 | - // other tools do not have this feature. This only counts |
|
69 | - if (api_is_allowed_to_edit()) |
|
70 | - { |
|
71 | - $visibility="ip.visibility<>'2'"; |
|
72 | - } |
|
73 | - else |
|
74 | - { |
|
75 | - $visibility="ip.visibility='1'"; |
|
76 | - } |
|
77 | - |
|
78 | - $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
79 | - $document_table = Database::get_course_table(TABLE_DOCUMENT); |
|
80 | - $sql = "SELECT * from $document_table docs, $item_property_table ip |
|
64 | + global $_course; |
|
65 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
66 | + |
|
67 | + // documents are a special case: the teacher can add an invisible document (it will be viewable by the user) |
|
68 | + // other tools do not have this feature. This only counts |
|
69 | + if (api_is_allowed_to_edit()) |
|
70 | + { |
|
71 | + $visibility="ip.visibility<>'2'"; |
|
72 | + } |
|
73 | + else |
|
74 | + { |
|
75 | + $visibility="ip.visibility='1'"; |
|
76 | + } |
|
77 | + |
|
78 | + $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
79 | + $document_table = Database::get_course_table(TABLE_DOCUMENT); |
|
80 | + $sql = "SELECT * from $document_table docs, $item_property_table ip |
|
81 | 81 | WHERE |
82 | 82 | docs.id=ip.ref AND |
83 | 83 | ip.tool = '".TOOL_DOCUMENT."' AND |
@@ -85,104 +85,104 @@ discard block |
||
85 | 85 | (ip.to_group_id = 0 OR i.to_group_id IS NULL) AND |
86 | 86 | ip.to_user_id IS NULL |
87 | 87 | ORDER BY docs.path ASC"; |
88 | - $result=Database::query($sql); |
|
89 | - while ($row=Database::fetch_array($result)) |
|
90 | - { |
|
91 | - if (!$folder) |
|
92 | - { |
|
93 | - if (get_levels($row['path'])-1==1) |
|
94 | - { |
|
95 | - // showing the right icon |
|
96 | - if (file_or_folder($row['path'])) |
|
97 | - { |
|
98 | - echo '<img src="../img/file.gif" align="middle" />'; |
|
99 | - } |
|
100 | - else |
|
101 | - { |
|
102 | - $image = choose_image($row['path']); |
|
103 | - echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
104 | - } |
|
105 | - |
|
106 | - // folders should be clickable |
|
107 | - if (file_or_folder($row['path'])) |
|
108 | - { |
|
109 | - echo "<a href='".api_get_self()."?content=Document"; |
|
110 | - echo "&folder=".substr($row['path'],1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".substr($row['path'],1).'</a><br />'; |
|
111 | - } |
|
112 | - else |
|
113 | - { |
|
114 | - echo substr($row['path'],1).' '; |
|
115 | - echo showorhide_addresourcelink('Document',$row['id']); |
|
116 | - echo '<br />'; |
|
117 | - } |
|
118 | - } |
|
119 | - } |
|
120 | - else |
|
121 | - { |
|
122 | - // we calculate the level we are in by using the $folder in the url |
|
123 | - // we put +1 because it does not start with an / and in the database it does |
|
124 | - $level=get_levels($folder)+1; |
|
125 | - |
|
126 | - // we calculate each level of the database entry |
|
127 | - $file_level=get_levels($row['path'])-1; |
|
128 | - // if the level of the database entry is equal to the level we ar in, we put it into an array |
|
129 | - // as this is a potential good entry |
|
130 | - if ($file_level==$level) |
|
131 | - { |
|
132 | - $good_paths[]=$row['path']; |
|
133 | - $good_ids[]=$row['id']; |
|
134 | - } |
|
135 | - //$haystack=$row['path']; |
|
136 | - //$conform_folder=strstr($haystack, $folder); |
|
137 | - //if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
138 | - // { |
|
139 | - // $good_folders[]=$row['path']; |
|
140 | - //echo str_replace($folder.'/','',$conform_folder); |
|
141 | - // echo '<br />'; |
|
142 | - // }// if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
143 | - } // else (if (!$folder)) |
|
144 | - } //while ($row=Database::fetch_array($result)) |
|
145 | - |
|
146 | - // this is code for the case that we are in a subfolder |
|
147 | - if ($good_paths) |
|
148 | - { |
|
149 | - // we have all the potential good database entries, the good ones are those that start with $folder |
|
150 | - foreach ($good_paths as $path) |
|
151 | - { |
|
152 | - if (strstr($path,$folder)) |
|
153 | - { |
|
154 | - $good_key=key($good_paths); |
|
155 | - // showing the right icon |
|
156 | - if (file_or_folder($path)) |
|
157 | - { |
|
158 | - echo '<img src="../img/file.gif" align="middle" />'; |
|
159 | - } |
|
160 | - else |
|
161 | - { |
|
162 | - $image = choose_image($path); |
|
163 | - echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
164 | - } |
|
165 | - |
|
166 | - // folders should be clickable |
|
167 | - if (file_or_folder($path)) |
|
168 | - { |
|
169 | - $path=substr($path,1); // remove the first / in folder_up |
|
170 | - $uri=str_replace($folder,$path,$_SERVER['REQUEST_URI']); |
|
171 | - $newuri=str_replace('add=','addnot=',$uri); |
|
172 | - //using the correct name of the folder |
|
173 | - $folder_name=str_replace($folder.'/','',$path); |
|
174 | - echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
|
175 | - } |
|
176 | - else |
|
177 | - { |
|
178 | - echo str_replace("/$folder/", '',$path).' '; |
|
179 | - echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
|
180 | - echo '<br />'; |
|
181 | - } |
|
182 | - } |
|
183 | - next($good_paths); |
|
184 | - } |
|
185 | - } |
|
88 | + $result=Database::query($sql); |
|
89 | + while ($row=Database::fetch_array($result)) |
|
90 | + { |
|
91 | + if (!$folder) |
|
92 | + { |
|
93 | + if (get_levels($row['path'])-1==1) |
|
94 | + { |
|
95 | + // showing the right icon |
|
96 | + if (file_or_folder($row['path'])) |
|
97 | + { |
|
98 | + echo '<img src="../img/file.gif" align="middle" />'; |
|
99 | + } |
|
100 | + else |
|
101 | + { |
|
102 | + $image = choose_image($row['path']); |
|
103 | + echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
104 | + } |
|
105 | + |
|
106 | + // folders should be clickable |
|
107 | + if (file_or_folder($row['path'])) |
|
108 | + { |
|
109 | + echo "<a href='".api_get_self()."?content=Document"; |
|
110 | + echo "&folder=".substr($row['path'],1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".substr($row['path'],1).'</a><br />'; |
|
111 | + } |
|
112 | + else |
|
113 | + { |
|
114 | + echo substr($row['path'],1).' '; |
|
115 | + echo showorhide_addresourcelink('Document',$row['id']); |
|
116 | + echo '<br />'; |
|
117 | + } |
|
118 | + } |
|
119 | + } |
|
120 | + else |
|
121 | + { |
|
122 | + // we calculate the level we are in by using the $folder in the url |
|
123 | + // we put +1 because it does not start with an / and in the database it does |
|
124 | + $level=get_levels($folder)+1; |
|
125 | + |
|
126 | + // we calculate each level of the database entry |
|
127 | + $file_level=get_levels($row['path'])-1; |
|
128 | + // if the level of the database entry is equal to the level we ar in, we put it into an array |
|
129 | + // as this is a potential good entry |
|
130 | + if ($file_level==$level) |
|
131 | + { |
|
132 | + $good_paths[]=$row['path']; |
|
133 | + $good_ids[]=$row['id']; |
|
134 | + } |
|
135 | + //$haystack=$row['path']; |
|
136 | + //$conform_folder=strstr($haystack, $folder); |
|
137 | + //if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
138 | + // { |
|
139 | + // $good_folders[]=$row['path']; |
|
140 | + //echo str_replace($folder.'/','',$conform_folder); |
|
141 | + // echo '<br />'; |
|
142 | + // }// if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
143 | + } // else (if (!$folder)) |
|
144 | + } //while ($row=Database::fetch_array($result)) |
|
145 | + |
|
146 | + // this is code for the case that we are in a subfolder |
|
147 | + if ($good_paths) |
|
148 | + { |
|
149 | + // we have all the potential good database entries, the good ones are those that start with $folder |
|
150 | + foreach ($good_paths as $path) |
|
151 | + { |
|
152 | + if (strstr($path,$folder)) |
|
153 | + { |
|
154 | + $good_key=key($good_paths); |
|
155 | + // showing the right icon |
|
156 | + if (file_or_folder($path)) |
|
157 | + { |
|
158 | + echo '<img src="../img/file.gif" align="middle" />'; |
|
159 | + } |
|
160 | + else |
|
161 | + { |
|
162 | + $image = choose_image($path); |
|
163 | + echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
164 | + } |
|
165 | + |
|
166 | + // folders should be clickable |
|
167 | + if (file_or_folder($path)) |
|
168 | + { |
|
169 | + $path=substr($path,1); // remove the first / in folder_up |
|
170 | + $uri=str_replace($folder,$path,$_SERVER['REQUEST_URI']); |
|
171 | + $newuri=str_replace('add=','addnot=',$uri); |
|
172 | + //using the correct name of the folder |
|
173 | + $folder_name=str_replace($folder.'/','',$path); |
|
174 | + echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
|
175 | + } |
|
176 | + else |
|
177 | + { |
|
178 | + echo str_replace("/$folder/", '',$path).' '; |
|
179 | + echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
|
180 | + echo '<br />'; |
|
181 | + } |
|
182 | + } |
|
183 | + next($good_paths); |
|
184 | + } |
|
185 | + } |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function file_or_folder($filefolder) |
195 | 195 | { |
196 | - global $_course; |
|
197 | - global $baseServDir; |
|
196 | + global $_course; |
|
197 | + global $baseServDir; |
|
198 | 198 | |
199 | - $courseDir = $_course['path'].'/document'; |
|
200 | - $baseWorkDir = api_get_path(SYS_COURSE_PATH).$courseDir; |
|
199 | + $courseDir = $_course['path'].'/document'; |
|
200 | + $baseWorkDir = api_get_path(SYS_COURSE_PATH).$courseDir; |
|
201 | 201 | |
202 | - return (is_dir($baseWorkDir.$filefolder) ? 1 : 0); |
|
202 | + return (is_dir($baseWorkDir.$filefolder) ? 1 : 0); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -210,23 +210,23 @@ discard block |
||
210 | 210 | */ |
211 | 211 | function store_resources($source_type, $source_id) |
212 | 212 | { |
213 | - global $_course; |
|
214 | - $resource_table = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
215 | - |
|
216 | - $addedresource = $_SESSION['addedresource']; |
|
217 | - $addedresourceid = $_SESSION['addedresourceid']; |
|
218 | - if ($_SESSION['addedresource']) |
|
219 | - { |
|
220 | - foreach ($addedresource as $resource_type) |
|
221 | - { |
|
222 | - $sql="INSERT INTO $resource_table (source_type, source_id, resource_type, resource_id) VALUES ('$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; |
|
223 | - Database::query($sql); |
|
224 | - $i=key($addedresource); |
|
225 | - next($addedresource); |
|
226 | - } |
|
227 | - $_SESSION['addedresource']=''; |
|
228 | - $_SESSION['addedresourceid']=''; |
|
229 | - } |
|
213 | + global $_course; |
|
214 | + $resource_table = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
215 | + |
|
216 | + $addedresource = $_SESSION['addedresource']; |
|
217 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
218 | + if ($_SESSION['addedresource']) |
|
219 | + { |
|
220 | + foreach ($addedresource as $resource_type) |
|
221 | + { |
|
222 | + $sql="INSERT INTO $resource_table (source_type, source_id, resource_type, resource_id) VALUES ('$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; |
|
223 | + Database::query($sql); |
|
224 | + $i=key($addedresource); |
|
225 | + next($addedresource); |
|
226 | + } |
|
227 | + $_SESSION['addedresource']=''; |
|
228 | + $_SESSION['addedresourceid']=''; |
|
229 | + } |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -240,87 +240,87 @@ discard block |
||
240 | 240 | */ |
241 | 241 | function display_addedresource_link($type, $id, $style='') |
242 | 242 | { |
243 | - global $_course; |
|
243 | + global $_course; |
|
244 | 244 | |
245 | - // styling the link of the added resource |
|
246 | - if ($style <> '') |
|
247 | - { |
|
248 | - $styling = ' class="'.$style.'"'; |
|
249 | - } |
|
245 | + // styling the link of the added resource |
|
246 | + if ($style <> '') |
|
247 | + { |
|
248 | + $styling = ' class="'.$style.'"'; |
|
249 | + } |
|
250 | 250 | |
251 | 251 | $course_id = api_get_course_int_id(); |
252 | 252 | |
253 | - switch ($type) |
|
254 | - { |
|
255 | - case 'Agenda': |
|
256 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
257 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); |
|
258 | - $myrow = Database::fetch_array($result); |
|
259 | - echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
260 | - break; |
|
261 | - case 'Ad_Valvas': |
|
262 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
263 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); |
|
264 | - $myrow = Database::fetch_array($result); |
|
265 | - echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
266 | - break; |
|
267 | - case 'Link':Database::get_course_table(TABLE_LINK); |
|
268 | - $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
|
269 | - $myrow = Database::fetch_array($result); |
|
270 | - echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n"; |
|
271 | - break; |
|
272 | - case 'Exercise': |
|
273 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
274 | - $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
|
275 | - $myrow = Database::fetch_array($result); |
|
276 | - echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
277 | - break; |
|
278 | - case 'Forum': |
|
279 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
280 | - $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); |
|
281 | - $myrow = Database::fetch_array($result); |
|
282 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n"; |
|
283 | - break; |
|
284 | - case 'Thread': //=topics |
|
253 | + switch ($type) |
|
254 | + { |
|
255 | + case 'Agenda': |
|
256 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
257 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); |
|
258 | + $myrow = Database::fetch_array($result); |
|
259 | + echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
260 | + break; |
|
261 | + case 'Ad_Valvas': |
|
262 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
263 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); |
|
264 | + $myrow = Database::fetch_array($result); |
|
265 | + echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
266 | + break; |
|
267 | + case 'Link':Database::get_course_table(TABLE_LINK); |
|
268 | + $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
|
269 | + $myrow = Database::fetch_array($result); |
|
270 | + echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n"; |
|
271 | + break; |
|
272 | + case 'Exercise': |
|
273 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
274 | + $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
|
275 | + $myrow = Database::fetch_array($result); |
|
276 | + echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
277 | + break; |
|
278 | + case 'Forum': |
|
279 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
280 | + $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); |
|
281 | + $myrow = Database::fetch_array($result); |
|
282 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n"; |
|
283 | + break; |
|
284 | + case 'Thread': //=topics |
|
285 | 285 | //deprecated |
286 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
287 | - $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
288 | - $TBL_FORUMS = $_course['dbNameGlu'].'bb_forums'; |
|
289 | - $result = Database::query("SELECT * FROM $tbl_posts posts, $TBL_FORUMS forum WHERE forum.forum_id=posts.forum_id and post_id=$id"); |
|
290 | - $myrow = Database::fetch_array($result); |
|
291 | - // grabbing the title of the post |
|
292 | - $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
293 | - $result_title = Database::query($sql_title); |
|
294 | - $myrow_title = Database::fetch_array($result_title); |
|
295 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n"; |
|
296 | - break; |
|
297 | - case 'Post': |
|
286 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
287 | + $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
288 | + $TBL_FORUMS = $_course['dbNameGlu'].'bb_forums'; |
|
289 | + $result = Database::query("SELECT * FROM $tbl_posts posts, $TBL_FORUMS forum WHERE forum.forum_id=posts.forum_id and post_id=$id"); |
|
290 | + $myrow = Database::fetch_array($result); |
|
291 | + // grabbing the title of the post |
|
292 | + $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
293 | + $result_title = Database::query($sql_title); |
|
294 | + $myrow_title = Database::fetch_array($result_title); |
|
295 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n"; |
|
296 | + break; |
|
297 | + case 'Post': |
|
298 | 298 | //deprecated |
299 | - $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
300 | - $tbl_post_text = Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE); |
|
301 | - $sql = "SELECT * FROM $tbl_post p, $tbl_post_text t WHERE p.post_id = t.post_id AND p.post_id = $id"; |
|
302 | - $result = Database::query($sql); |
|
303 | - $post = Database::fetch_object($result); |
|
304 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />\n"; |
|
305 | - break; |
|
306 | - case 'Document': |
|
307 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
308 | - $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
|
309 | - $myrow = Database::fetch_array($result); |
|
310 | - $pathname = explode('/',$myrow['path']); // making a correct name for the link |
|
311 | - $last = count($pathname) - 1; // making a correct name for the link |
|
312 | - $filename = $pathname[$last]; // making a correct name for the link |
|
313 | - $image = choose_image($filename); |
|
314 | - $ext = explode('.',$filename); |
|
315 | - $ext = strtolower($ext[sizeof($ext)-1]); |
|
316 | - $myrow['path'] = rawurlencode($myrow['path']); |
|
317 | - $in_frames = in_array($ext, array('htm','html','gif','jpg','jpeg','png')); |
|
318 | - echo '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />\n"; |
|
319 | - break; |
|
320 | - case 'Externallink': |
|
321 | - echo '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n"; |
|
322 | - break; |
|
323 | - } |
|
299 | + $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
300 | + $tbl_post_text = Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE); |
|
301 | + $sql = "SELECT * FROM $tbl_post p, $tbl_post_text t WHERE p.post_id = t.post_id AND p.post_id = $id"; |
|
302 | + $result = Database::query($sql); |
|
303 | + $post = Database::fetch_object($result); |
|
304 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />\n"; |
|
305 | + break; |
|
306 | + case 'Document': |
|
307 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
308 | + $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
|
309 | + $myrow = Database::fetch_array($result); |
|
310 | + $pathname = explode('/',$myrow['path']); // making a correct name for the link |
|
311 | + $last = count($pathname) - 1; // making a correct name for the link |
|
312 | + $filename = $pathname[$last]; // making a correct name for the link |
|
313 | + $image = choose_image($filename); |
|
314 | + $ext = explode('.',$filename); |
|
315 | + $ext = strtolower($ext[sizeof($ext)-1]); |
|
316 | + $myrow['path'] = rawurlencode($myrow['path']); |
|
317 | + $in_frames = in_array($ext, array('htm','html','gif','jpg','jpeg','png')); |
|
318 | + echo '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />\n"; |
|
319 | + break; |
|
320 | + case 'Externallink': |
|
321 | + echo '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n"; |
|
322 | + break; |
|
323 | + } |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -342,766 +342,766 @@ discard block |
||
342 | 342 | */ |
343 | 343 | function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) |
344 | 344 | { |
345 | - global $learnpath_id, $tbl_learnpath_item, $items; |
|
346 | - global $_course, $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; |
|
347 | - |
|
348 | - $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' |
|
349 | - |
|
350 | - $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
|
351 | - |
|
352 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
353 | - $linktype = $type; |
|
354 | - if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
355 | - |
|
356 | - switch ($type) |
|
357 | - { |
|
358 | - case "Agenda": |
|
359 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
360 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
361 | - $myrow=Database::fetch_array($result); |
|
362 | - |
|
363 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
364 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
365 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
366 | - $desc=$row['description']; |
|
367 | - $agenda_id=$row['item_id']; |
|
368 | - echo str_repeat(" >",$level); |
|
369 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
370 | - if ($icon != 'nolink') |
|
371 | - { |
|
372 | - if ($completed=='completed') { |
|
373 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
374 | - } else { |
|
375 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
376 | - //echo " "; |
|
377 | - } |
|
378 | - } |
|
379 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
380 | - |
|
381 | - if ($myrow["title"]=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
382 | - |
|
383 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
384 | - if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
|
385 | - if ($builder != 'builder') |
|
386 | - { |
|
387 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
388 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
389 | - if ($desc != '') |
|
390 | - { |
|
391 | - if ($icon != 'wrap') |
|
392 | - { |
|
393 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
394 | - } |
|
395 | - else |
|
396 | - { |
|
397 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
398 | - } |
|
399 | - } |
|
400 | - } |
|
401 | - else |
|
402 | - { |
|
403 | - echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
404 | - } |
|
405 | - break; |
|
406 | - |
|
407 | - case "Ad_Valvas": |
|
408 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
409 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
410 | - $myrow=Database::fetch_array($result); |
|
411 | - |
|
412 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
413 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
414 | - if ($row['title'] != '') { $myrow["content"]=$row['title']; } |
|
415 | - $desc=$row['description']; |
|
416 | - $ann_id=$row['item_id']; |
|
417 | - echo str_repeat(" >",$level); |
|
418 | - |
|
419 | - // the title and the text are in the content field and we only want to display the title |
|
420 | - list($title, $text)=split('<br>',$myrow['content']); |
|
421 | - if ($title=='') { $title=$myrow['content']; } |
|
422 | - $title=$myrow['title']; |
|
423 | - $text=$myrow['content']; |
|
424 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
425 | - if ($icon != 'nolink') |
|
426 | - { |
|
427 | - if ($completed=='completed') { |
|
428 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
429 | - } else { |
|
430 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
431 | - //echo " "; |
|
432 | - } |
|
433 | - } |
|
434 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
435 | - |
|
436 | - if ($title=='') { |
|
437 | - $type="Announcement"; |
|
438 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
439 | - return(true); |
|
440 | - } |
|
441 | - |
|
442 | - if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
443 | - if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
|
444 | - if ($builder != 'builder') |
|
445 | - { |
|
446 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title,($length-3*$level))."</a>"; |
|
447 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; |
|
448 | - if ($desc != '') |
|
449 | - { |
|
450 | - if ($icon != 'wrap') |
|
451 | - { |
|
452 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
453 | - } |
|
454 | - else |
|
455 | - { |
|
456 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
457 | - } |
|
458 | - } |
|
459 | - } |
|
460 | - else |
|
461 | - { |
|
462 | - echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
|
463 | - } |
|
464 | - break; |
|
465 | - |
|
466 | - case "Link" : |
|
467 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
468 | - $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
469 | - $myrow=Database::fetch_array($result); |
|
470 | - |
|
471 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
472 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
473 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
474 | - $desc=$row['description']; |
|
475 | - echo str_repeat(" >",$level); |
|
476 | - |
|
477 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
478 | - if ($icon != 'nolink') |
|
479 | - { |
|
480 | - if ($completed=='completed') { |
|
481 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
482 | - } else { |
|
483 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
484 | - //echo " "; |
|
485 | - } |
|
486 | - } |
|
487 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
488 | - |
|
489 | - if ($myrow["title"]=='') |
|
490 | - { |
|
491 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
492 | - return(true); |
|
493 | - } |
|
494 | - |
|
495 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
496 | - if ($icon == 'icon') |
|
497 | - { |
|
498 | - if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
499 | - else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
500 | - } |
|
501 | - $thelink=$myrow["url"]; |
|
502 | - if ($builder != 'builder') |
|
503 | - { |
|
504 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
505 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
506 | - if ($desc != '') |
|
507 | - { |
|
508 | - if ($icon != 'wrap') |
|
509 | - { |
|
510 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
511 | - } |
|
512 | - else |
|
513 | - { |
|
514 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
515 | - } |
|
516 | - } |
|
517 | - } |
|
518 | - else |
|
519 | - { |
|
520 | - echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
521 | - } |
|
522 | - break; |
|
523 | - |
|
524 | - case "Exercise": |
|
525 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
526 | - $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
527 | - $myrow=Database::fetch_array($result); |
|
528 | - |
|
529 | - if ($builder=='builder') { $origin='builder'; } |
|
530 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
531 | - |
|
532 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
533 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
534 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
535 | - $desc=$row['description']; |
|
536 | - echo str_repeat(" >",$level); |
|
537 | - |
|
538 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
539 | - if ($icon != 'nolink') |
|
540 | - { |
|
541 | - if ($completed=='completed') { |
|
542 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
543 | - } else { |
|
544 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
545 | - //echo " "; |
|
546 | - } |
|
547 | - } |
|
548 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
549 | - |
|
550 | - if ($myrow["title"]=='') { |
|
551 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
552 | - return(true); |
|
553 | - } |
|
554 | - |
|
555 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
556 | - if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
|
557 | - if ($builder != 'builder') |
|
558 | - { |
|
559 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
560 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
561 | - if ($desc != '') |
|
562 | - { |
|
563 | - if ($icon != 'wrap') |
|
564 | - { |
|
565 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
566 | - } |
|
567 | - else |
|
568 | - { |
|
569 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
570 | - } |
|
571 | - } |
|
572 | - } |
|
573 | - else |
|
574 | - { |
|
575 | - echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]."\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
576 | - } |
|
577 | - break; |
|
578 | - |
|
579 | - case "HotPotatoes": |
|
580 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
581 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
582 | - $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
583 | - $myrow= Database::fetch_array($result); |
|
584 | - $path=$myrow["path"]; |
|
585 | - $name=GetQuizName($path,$documentPath); |
|
586 | - |
|
587 | - if ($builder=='builder') { $origin='builder'; } |
|
588 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
589 | - |
|
590 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
591 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
592 | - if ($row['title'] != '') { $name=$row['title']; } |
|
593 | - $desc=$row['description']; |
|
594 | - echo str_repeat(" >",$level); |
|
595 | - |
|
596 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
597 | - if ($icon != 'nolink') |
|
598 | - { |
|
599 | - if ($completed=='completed') { |
|
600 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
601 | - } else { |
|
602 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
603 | - //echo " "; |
|
604 | - } |
|
605 | - } |
|
606 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
607 | - |
|
608 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
609 | - |
|
610 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
611 | - if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } |
|
612 | - |
|
613 | - $cid = $_course['official_code']; |
|
614 | - |
|
615 | - if ($builder != 'builder') |
|
616 | - { |
|
617 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
618 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
619 | - if ($desc != '') |
|
620 | - { |
|
621 | - if ($icon != 'wrap') |
|
622 | - { |
|
623 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
624 | - } |
|
625 | - else |
|
626 | - { |
|
627 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
628 | - } |
|
629 | - } |
|
630 | - } |
|
631 | - else |
|
632 | - { |
|
633 | - echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
634 | - } |
|
635 | - break; |
|
636 | - |
|
637 | - case "Forum": |
|
638 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
639 | - $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
640 | - $myrow=Database::fetch_array($result); |
|
641 | - |
|
642 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
643 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
644 | - if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
645 | - $desc=$row['description']; |
|
646 | - echo str_repeat(" >",$level); |
|
647 | - |
|
648 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
649 | - if ($icon != 'nolink') |
|
650 | - { |
|
651 | - if ($completed=='completed') { |
|
652 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
653 | - } else { |
|
654 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
655 | - //echo " "; |
|
656 | - } |
|
657 | - } |
|
658 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
659 | - |
|
660 | - if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
661 | - |
|
662 | - if ($icon == 'nolink') { return(shorten($myrow["forum_name"],$length)); } |
|
663 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
664 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
665 | - if ($builder != 'builder') |
|
666 | - { |
|
667 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
668 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
669 | - if ($desc != '') |
|
670 | - { |
|
671 | - if ($icon != 'wrap') |
|
672 | - { |
|
673 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
674 | - } |
|
675 | - else |
|
676 | - { |
|
677 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
678 | - } |
|
679 | - } |
|
680 | - } |
|
681 | - else |
|
682 | - { |
|
683 | - echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
684 | - } |
|
685 | - break; |
|
686 | - |
|
687 | - case "Thread": //forum post |
|
345 | + global $learnpath_id, $tbl_learnpath_item, $items; |
|
346 | + global $_course, $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; |
|
347 | + |
|
348 | + $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' |
|
349 | + |
|
350 | + $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
|
351 | + |
|
352 | + if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
353 | + $linktype = $type; |
|
354 | + if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
355 | + |
|
356 | + switch ($type) |
|
357 | + { |
|
358 | + case "Agenda": |
|
359 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
360 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
361 | + $myrow=Database::fetch_array($result); |
|
362 | + |
|
363 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
364 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
365 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
366 | + $desc=$row['description']; |
|
367 | + $agenda_id=$row['item_id']; |
|
368 | + echo str_repeat(" >",$level); |
|
369 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
370 | + if ($icon != 'nolink') |
|
371 | + { |
|
372 | + if ($completed=='completed') { |
|
373 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
374 | + } else { |
|
375 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
376 | + //echo " "; |
|
377 | + } |
|
378 | + } |
|
379 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
380 | + |
|
381 | + if ($myrow["title"]=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
382 | + |
|
383 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
384 | + if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
|
385 | + if ($builder != 'builder') |
|
386 | + { |
|
387 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
388 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
389 | + if ($desc != '') |
|
390 | + { |
|
391 | + if ($icon != 'wrap') |
|
392 | + { |
|
393 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
394 | + } |
|
395 | + else |
|
396 | + { |
|
397 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
398 | + } |
|
399 | + } |
|
400 | + } |
|
401 | + else |
|
402 | + { |
|
403 | + echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
404 | + } |
|
405 | + break; |
|
406 | + |
|
407 | + case "Ad_Valvas": |
|
408 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
409 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
410 | + $myrow=Database::fetch_array($result); |
|
411 | + |
|
412 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
413 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
414 | + if ($row['title'] != '') { $myrow["content"]=$row['title']; } |
|
415 | + $desc=$row['description']; |
|
416 | + $ann_id=$row['item_id']; |
|
417 | + echo str_repeat(" >",$level); |
|
418 | + |
|
419 | + // the title and the text are in the content field and we only want to display the title |
|
420 | + list($title, $text)=split('<br>',$myrow['content']); |
|
421 | + if ($title=='') { $title=$myrow['content']; } |
|
422 | + $title=$myrow['title']; |
|
423 | + $text=$myrow['content']; |
|
424 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
425 | + if ($icon != 'nolink') |
|
426 | + { |
|
427 | + if ($completed=='completed') { |
|
428 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
429 | + } else { |
|
430 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
431 | + //echo " "; |
|
432 | + } |
|
433 | + } |
|
434 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
435 | + |
|
436 | + if ($title=='') { |
|
437 | + $type="Announcement"; |
|
438 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
439 | + return(true); |
|
440 | + } |
|
441 | + |
|
442 | + if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
443 | + if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
|
444 | + if ($builder != 'builder') |
|
445 | + { |
|
446 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title,($length-3*$level))."</a>"; |
|
447 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; |
|
448 | + if ($desc != '') |
|
449 | + { |
|
450 | + if ($icon != 'wrap') |
|
451 | + { |
|
452 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
453 | + } |
|
454 | + else |
|
455 | + { |
|
456 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
457 | + } |
|
458 | + } |
|
459 | + } |
|
460 | + else |
|
461 | + { |
|
462 | + echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
|
463 | + } |
|
464 | + break; |
|
465 | + |
|
466 | + case "Link" : |
|
467 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
468 | + $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
469 | + $myrow=Database::fetch_array($result); |
|
470 | + |
|
471 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
472 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
473 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
474 | + $desc=$row['description']; |
|
475 | + echo str_repeat(" >",$level); |
|
476 | + |
|
477 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
478 | + if ($icon != 'nolink') |
|
479 | + { |
|
480 | + if ($completed=='completed') { |
|
481 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
482 | + } else { |
|
483 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
484 | + //echo " "; |
|
485 | + } |
|
486 | + } |
|
487 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
488 | + |
|
489 | + if ($myrow["title"]=='') |
|
490 | + { |
|
491 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
492 | + return(true); |
|
493 | + } |
|
494 | + |
|
495 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
496 | + if ($icon == 'icon') |
|
497 | + { |
|
498 | + if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
499 | + else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
500 | + } |
|
501 | + $thelink=$myrow["url"]; |
|
502 | + if ($builder != 'builder') |
|
503 | + { |
|
504 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
505 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
506 | + if ($desc != '') |
|
507 | + { |
|
508 | + if ($icon != 'wrap') |
|
509 | + { |
|
510 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
511 | + } |
|
512 | + else |
|
513 | + { |
|
514 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
515 | + } |
|
516 | + } |
|
517 | + } |
|
518 | + else |
|
519 | + { |
|
520 | + echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
521 | + } |
|
522 | + break; |
|
523 | + |
|
524 | + case "Exercise": |
|
525 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
526 | + $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
527 | + $myrow=Database::fetch_array($result); |
|
528 | + |
|
529 | + if ($builder=='builder') { $origin='builder'; } |
|
530 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
531 | + |
|
532 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
533 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
534 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
535 | + $desc=$row['description']; |
|
536 | + echo str_repeat(" >",$level); |
|
537 | + |
|
538 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
539 | + if ($icon != 'nolink') |
|
540 | + { |
|
541 | + if ($completed=='completed') { |
|
542 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
543 | + } else { |
|
544 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
545 | + //echo " "; |
|
546 | + } |
|
547 | + } |
|
548 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
549 | + |
|
550 | + if ($myrow["title"]=='') { |
|
551 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
552 | + return(true); |
|
553 | + } |
|
554 | + |
|
555 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
556 | + if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
|
557 | + if ($builder != 'builder') |
|
558 | + { |
|
559 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
560 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
561 | + if ($desc != '') |
|
562 | + { |
|
563 | + if ($icon != 'wrap') |
|
564 | + { |
|
565 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
566 | + } |
|
567 | + else |
|
568 | + { |
|
569 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
570 | + } |
|
571 | + } |
|
572 | + } |
|
573 | + else |
|
574 | + { |
|
575 | + echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]."\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
576 | + } |
|
577 | + break; |
|
578 | + |
|
579 | + case "HotPotatoes": |
|
580 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
581 | + $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
582 | + $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
583 | + $myrow= Database::fetch_array($result); |
|
584 | + $path=$myrow["path"]; |
|
585 | + $name=GetQuizName($path,$documentPath); |
|
586 | + |
|
587 | + if ($builder=='builder') { $origin='builder'; } |
|
588 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
589 | + |
|
590 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
591 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
592 | + if ($row['title'] != '') { $name=$row['title']; } |
|
593 | + $desc=$row['description']; |
|
594 | + echo str_repeat(" >",$level); |
|
595 | + |
|
596 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
597 | + if ($icon != 'nolink') |
|
598 | + { |
|
599 | + if ($completed=='completed') { |
|
600 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
601 | + } else { |
|
602 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
603 | + //echo " "; |
|
604 | + } |
|
605 | + } |
|
606 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
607 | + |
|
608 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
609 | + |
|
610 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
611 | + if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } |
|
612 | + |
|
613 | + $cid = $_course['official_code']; |
|
614 | + |
|
615 | + if ($builder != 'builder') |
|
616 | + { |
|
617 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
618 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
619 | + if ($desc != '') |
|
620 | + { |
|
621 | + if ($icon != 'wrap') |
|
622 | + { |
|
623 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
624 | + } |
|
625 | + else |
|
626 | + { |
|
627 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
628 | + } |
|
629 | + } |
|
630 | + } |
|
631 | + else |
|
632 | + { |
|
633 | + echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
634 | + } |
|
635 | + break; |
|
636 | + |
|
637 | + case "Forum": |
|
638 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
639 | + $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
640 | + $myrow=Database::fetch_array($result); |
|
641 | + |
|
642 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
643 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
644 | + if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
645 | + $desc=$row['description']; |
|
646 | + echo str_repeat(" >",$level); |
|
647 | + |
|
648 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
649 | + if ($icon != 'nolink') |
|
650 | + { |
|
651 | + if ($completed=='completed') { |
|
652 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
653 | + } else { |
|
654 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
655 | + //echo " "; |
|
656 | + } |
|
657 | + } |
|
658 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
659 | + |
|
660 | + if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
661 | + |
|
662 | + if ($icon == 'nolink') { return(shorten($myrow["forum_name"],$length)); } |
|
663 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
664 | + $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
665 | + if ($builder != 'builder') |
|
666 | + { |
|
667 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
668 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
669 | + if ($desc != '') |
|
670 | + { |
|
671 | + if ($icon != 'wrap') |
|
672 | + { |
|
673 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
674 | + } |
|
675 | + else |
|
676 | + { |
|
677 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
678 | + } |
|
679 | + } |
|
680 | + } |
|
681 | + else |
|
682 | + { |
|
683 | + echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
684 | + } |
|
685 | + break; |
|
686 | + |
|
687 | + case "Thread": //forum post |
|
688 | 688 | //deprecated |
689 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
690 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
691 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
692 | - $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
693 | - $result= Database::query($sql); |
|
694 | - $myrow=Database::fetch_array($result); |
|
695 | - |
|
696 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
697 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
698 | - if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; } |
|
699 | - $desc=$row['description']; |
|
700 | - echo str_repeat(" >",$level); |
|
701 | - |
|
702 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
703 | - if ($icon != 'nolink') |
|
704 | - { |
|
705 | - if ($completed=='completed') { |
|
706 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
707 | - } else { |
|
708 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
709 | - //echo " "; |
|
710 | - } |
|
711 | - } |
|
712 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
713 | - |
|
714 | - if ($myrow["topic_title"]=='') { $type="Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
715 | - |
|
716 | - if ($icon == 'nolink') { return(shorten($myrow["topic_title"],$length)); } |
|
717 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
718 | - if ($builder != 'builder') |
|
719 | - { |
|
720 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
721 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
722 | - if ($desc != '') |
|
723 | - { |
|
724 | - if ($icon != 'wrap') |
|
725 | - { |
|
726 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
727 | - } |
|
728 | - else |
|
729 | - { |
|
730 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
731 | - } |
|
732 | - } |
|
733 | - } |
|
734 | - else |
|
735 | - { |
|
736 | - echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
737 | - } |
|
738 | - break; |
|
739 | - |
|
740 | - case "Post": |
|
689 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
690 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
691 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
692 | + $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
693 | + $result= Database::query($sql); |
|
694 | + $myrow=Database::fetch_array($result); |
|
695 | + |
|
696 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
697 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
698 | + if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; } |
|
699 | + $desc=$row['description']; |
|
700 | + echo str_repeat(" >",$level); |
|
701 | + |
|
702 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
703 | + if ($icon != 'nolink') |
|
704 | + { |
|
705 | + if ($completed=='completed') { |
|
706 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
707 | + } else { |
|
708 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
709 | + //echo " "; |
|
710 | + } |
|
711 | + } |
|
712 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
713 | + |
|
714 | + if ($myrow["topic_title"]=='') { $type="Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
715 | + |
|
716 | + if ($icon == 'nolink') { return(shorten($myrow["topic_title"],$length)); } |
|
717 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
718 | + if ($builder != 'builder') |
|
719 | + { |
|
720 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
721 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
722 | + if ($desc != '') |
|
723 | + { |
|
724 | + if ($icon != 'wrap') |
|
725 | + { |
|
726 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
727 | + } |
|
728 | + else |
|
729 | + { |
|
730 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
731 | + } |
|
732 | + } |
|
733 | + } |
|
734 | + else |
|
735 | + { |
|
736 | + echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
737 | + } |
|
738 | + break; |
|
739 | + |
|
740 | + case "Post": |
|
741 | 741 | //deprecated |
742 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
743 | - $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
744 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
745 | - $result= Database::query("SELECT * FROM $tbl_posts where post_id=$id"); |
|
746 | - $myrow=Database::fetch_array($result); |
|
747 | - // grabbing the title of the post |
|
748 | - $sql_titel="SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
749 | - $result_titel=Database::query($sql_titel); |
|
750 | - $myrow_titel=Database::fetch_array($result_titel); |
|
751 | - |
|
752 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
753 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
754 | - if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; } |
|
755 | - $desc=$row['description']; |
|
756 | - echo str_repeat(" >",$level); |
|
757 | - |
|
758 | - $posternom=$myrow['nom']; $posterprenom=$myrow['prenom']; |
|
759 | - $posttime=$myrow['post_time']; $posttext=$myrow_titel['post_text']; |
|
760 | - $posttitle=$myrow_titel['post_title']; |
|
761 | - $posttext = str_replace('"',"'",$posttext); |
|
762 | - |
|
763 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
764 | - if ($icon != 'nolink') |
|
765 | - { |
|
766 | - if ($completed=='completed') { |
|
767 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
768 | - } else { |
|
769 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
770 | - //echo " "; |
|
771 | - } |
|
772 | - } |
|
773 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
774 | - |
|
775 | - if ($myrow_titel["post_title"]=='') |
|
776 | - { |
|
777 | - $type="Forum"; |
|
778 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
779 | - } |
|
780 | - |
|
781 | - if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"],$length)); } |
|
782 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
783 | - if ($builder != 'builder') |
|
784 | - { |
|
785 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; |
|
786 | - if ($desc != '') |
|
787 | - { |
|
788 | - if ($icon != 'wrap') |
|
789 | - { |
|
790 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
791 | - } |
|
792 | - else |
|
793 | - { |
|
794 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
795 | - } |
|
796 | - } |
|
797 | - } |
|
798 | - else |
|
799 | - { |
|
800 | - echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; |
|
801 | - } |
|
802 | - break; |
|
803 | - |
|
804 | - case "Document": |
|
805 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
806 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id"); |
|
807 | - $myrow=Database::fetch_array($result); |
|
808 | - |
|
809 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
810 | - $last=count($pathname)-1; // making a correct name for the link |
|
811 | - $filename=$pathname[$last]; // making a correct name for the link |
|
812 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
813 | - |
|
814 | - echo str_repeat(" >",$level); |
|
815 | - |
|
816 | - if ($icon != 'nolink') { |
|
817 | - if ($completed=='completed') { |
|
818 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
819 | - } else { |
|
820 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
821 | - //echo " "; |
|
822 | - } |
|
823 | - } |
|
824 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
825 | - $image=choose_image($filename); |
|
826 | - |
|
827 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
828 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
829 | - if ($row['title'] != '') { $filename=$row['title']; } |
|
830 | - $desc=$row['description']; |
|
831 | - |
|
832 | - if (($myrow["path"]=='') and ($filename=='')) { |
|
833 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
834 | - return(true); |
|
835 | - } |
|
836 | - |
|
837 | - if ($icon == 'nolink') { return(shorten($filename,$length)); } |
|
838 | - if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
|
839 | - if ($builder != 'builder') |
|
840 | - { |
|
841 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename,($length-3*$level))."</a>"; |
|
842 | - if ($desc != '') |
|
843 | - { |
|
844 | - if ($icon != 'wrap') |
|
845 | - { |
|
846 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
847 | - } |
|
848 | - else |
|
849 | - { |
|
850 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
851 | - } |
|
852 | - } $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
853 | - } |
|
854 | - else |
|
855 | - { |
|
856 | - $enableDocumentParsing='yes'; |
|
857 | - if (!$enableDocumentParsing) |
|
858 | - { //this is the solution for the non-parsing version in the builder |
|
859 | - $file=urlencode($myrow["path"]); |
|
860 | - echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
861 | - } |
|
862 | - else |
|
863 | - { |
|
864 | - echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
865 | - } |
|
866 | - } |
|
867 | - break; |
|
868 | - |
|
869 | - case "Assignments": |
|
870 | - $name=get_lang('Assignments'); |
|
871 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
872 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
873 | - if ($row['title'] != '') { $name=$row['title']; } |
|
874 | - $desc=$row['description']; |
|
875 | - echo str_repeat(" >",$level); |
|
876 | - |
|
877 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
878 | - if ($icon != 'nolink') |
|
879 | - { |
|
880 | - if ($completed=='completed') { |
|
881 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
882 | - } else { |
|
883 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
884 | - //echo " "; |
|
885 | - } |
|
886 | - } |
|
887 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
888 | - |
|
889 | - if ($name=='') |
|
890 | - { |
|
891 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
892 | - } |
|
893 | - |
|
894 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
895 | - if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
|
896 | - if ($builder != 'builder') |
|
897 | - { |
|
898 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
899 | - if ($desc != '') |
|
900 | - { |
|
901 | - if ($icon != 'wrap') |
|
902 | - { |
|
903 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
904 | - } |
|
905 | - else |
|
906 | - { |
|
907 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
908 | - } |
|
909 | - } |
|
910 | - } |
|
911 | - else |
|
912 | - { |
|
913 | - echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
914 | - } |
|
915 | - break; |
|
916 | - case "Dropbox": |
|
917 | - $name=get_lang('Dropbox'); |
|
918 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
919 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
920 | - if ($row['title'] != '') { $name=$row['title']; } |
|
921 | - $desc=$row['description']; |
|
922 | - echo str_repeat(" >",$level); |
|
923 | - |
|
924 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
925 | - if ($icon != 'nolink') { |
|
926 | - if ($completed=='completed') { |
|
927 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
928 | - } else { |
|
929 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
930 | - //echo " "; |
|
931 | - } |
|
932 | - } |
|
933 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
934 | - |
|
935 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
936 | - |
|
937 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
938 | - if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
|
939 | - |
|
940 | - if ($builder != 'builder') |
|
941 | - { |
|
942 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
943 | - if ($desc != '') { |
|
944 | - if ($icon != 'wrap') { |
|
945 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
946 | - else { |
|
947 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
948 | - } |
|
949 | - } else { |
|
950 | - echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
951 | - } |
|
952 | - break; |
|
953 | - case "Introduction_text": |
|
954 | - $name=get_lang('IntroductionText'); |
|
955 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
956 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
957 | - if ($row['title'] != '') { $name=$row['title']; } |
|
958 | - $desc=$row['description']; |
|
959 | - echo str_repeat(" >",$level); |
|
960 | - |
|
961 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
962 | - if ($icon != 'nolink') { |
|
963 | - if ($completed=='completed') { |
|
964 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
965 | - } else { |
|
966 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
967 | - //echo " "; |
|
968 | - } |
|
969 | - } |
|
970 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
971 | - |
|
972 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
973 | - |
|
974 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
975 | - if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
|
976 | - |
|
977 | - if ($builder != 'builder') |
|
978 | - { |
|
979 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
980 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
981 | - if ($desc != '') { |
|
982 | - if ($icon != 'wrap') { |
|
983 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
984 | - else { |
|
985 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
986 | - } |
|
987 | - } else { |
|
988 | - $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
989 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
990 | - } |
|
991 | - break; |
|
992 | - case "Course_description": |
|
993 | - $name=get_lang('CourseDescription'); |
|
994 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
995 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
996 | - if ($row['title'] != '') { $name=$row['title']; } |
|
997 | - $desc=$row['description']; |
|
998 | - echo str_repeat(" >",$level); |
|
999 | - |
|
1000 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1001 | - if ($icon != 'nolink') { |
|
1002 | - if ($completed=='completed') { |
|
1003 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1004 | - } else { |
|
1005 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1006 | - //echo " "; |
|
1007 | - } |
|
1008 | - } |
|
1009 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1010 | - |
|
1011 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1012 | - |
|
1013 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1014 | - if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
|
1015 | - |
|
1016 | - if ($builder != 'builder') |
|
1017 | - { |
|
1018 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
1019 | - if ($desc != '') { |
|
1020 | - if ($icon != 'wrap') { |
|
1021 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1022 | - else { |
|
1023 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1024 | - } |
|
1025 | - } else { |
|
1026 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
1027 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1028 | - } |
|
1029 | - break; |
|
1030 | - case "Groups": |
|
1031 | - $name=get_lang('Groups'); |
|
1032 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1033 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1034 | - if ($row['title'] != '') { $name=$row['title']; } |
|
1035 | - $desc=$row['description']; |
|
1036 | - echo str_repeat(" >",$level); |
|
1037 | - |
|
1038 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1039 | - if ($icon != 'nolink') { |
|
1040 | - if ($completed=='completed') { |
|
1041 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1042 | - } else { |
|
1043 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1044 | - //echo " "; |
|
1045 | - } |
|
1046 | - } |
|
1047 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1048 | - |
|
1049 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1050 | - |
|
1051 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1052 | - if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
|
1053 | - |
|
1054 | - if ($builder != 'builder') |
|
1055 | - { |
|
1056 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
1057 | - if ($desc != '') { |
|
1058 | - if ($icon != 'wrap') { |
|
1059 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1060 | - else { |
|
1061 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1062 | - } |
|
1063 | - } else { |
|
1064 | - echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1065 | - } |
|
1066 | - break; |
|
1067 | - case "Users": |
|
1068 | - $name=get_lang('Users'); |
|
1069 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1070 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1071 | - if ($row['title'] != '') { $name=$row['title']; } |
|
1072 | - $desc=$row['description']; |
|
1073 | - echo str_repeat(" >",$level); |
|
1074 | - |
|
1075 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1076 | - if ($icon != 'nolink') { |
|
1077 | - if ($completed=='completed') { |
|
1078 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1079 | - } else { |
|
1080 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1081 | - //echo " "; |
|
1082 | - } |
|
1083 | - } |
|
1084 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1085 | - |
|
1086 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1087 | - |
|
1088 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1089 | - if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
|
1090 | - |
|
1091 | - if ($builder != 'builder') |
|
1092 | - { |
|
1093 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
1094 | - if ($desc != '') { |
|
1095 | - if ($icon != 'wrap') { |
|
1096 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1097 | - else { |
|
1098 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1099 | - } |
|
1100 | - } else { |
|
1101 | - echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1102 | - } |
|
1103 | - break; |
|
1104 | - }//end huge switch-statement |
|
742 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
743 | + $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
744 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
745 | + $result= Database::query("SELECT * FROM $tbl_posts where post_id=$id"); |
|
746 | + $myrow=Database::fetch_array($result); |
|
747 | + // grabbing the title of the post |
|
748 | + $sql_titel="SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
749 | + $result_titel=Database::query($sql_titel); |
|
750 | + $myrow_titel=Database::fetch_array($result_titel); |
|
751 | + |
|
752 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
753 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
754 | + if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; } |
|
755 | + $desc=$row['description']; |
|
756 | + echo str_repeat(" >",$level); |
|
757 | + |
|
758 | + $posternom=$myrow['nom']; $posterprenom=$myrow['prenom']; |
|
759 | + $posttime=$myrow['post_time']; $posttext=$myrow_titel['post_text']; |
|
760 | + $posttitle=$myrow_titel['post_title']; |
|
761 | + $posttext = str_replace('"',"'",$posttext); |
|
762 | + |
|
763 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
764 | + if ($icon != 'nolink') |
|
765 | + { |
|
766 | + if ($completed=='completed') { |
|
767 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
768 | + } else { |
|
769 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
770 | + //echo " "; |
|
771 | + } |
|
772 | + } |
|
773 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
774 | + |
|
775 | + if ($myrow_titel["post_title"]=='') |
|
776 | + { |
|
777 | + $type="Forum"; |
|
778 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
779 | + } |
|
780 | + |
|
781 | + if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"],$length)); } |
|
782 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
783 | + if ($builder != 'builder') |
|
784 | + { |
|
785 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; |
|
786 | + if ($desc != '') |
|
787 | + { |
|
788 | + if ($icon != 'wrap') |
|
789 | + { |
|
790 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
791 | + } |
|
792 | + else |
|
793 | + { |
|
794 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
795 | + } |
|
796 | + } |
|
797 | + } |
|
798 | + else |
|
799 | + { |
|
800 | + echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; |
|
801 | + } |
|
802 | + break; |
|
803 | + |
|
804 | + case "Document": |
|
805 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
806 | + $result=Database::query("SELECT * FROM $dbTable WHERE id=$id"); |
|
807 | + $myrow=Database::fetch_array($result); |
|
808 | + |
|
809 | + $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
810 | + $last=count($pathname)-1; // making a correct name for the link |
|
811 | + $filename=$pathname[$last]; // making a correct name for the link |
|
812 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
813 | + |
|
814 | + echo str_repeat(" >",$level); |
|
815 | + |
|
816 | + if ($icon != 'nolink') { |
|
817 | + if ($completed=='completed') { |
|
818 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
819 | + } else { |
|
820 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
821 | + //echo " "; |
|
822 | + } |
|
823 | + } |
|
824 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
825 | + $image=choose_image($filename); |
|
826 | + |
|
827 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
828 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
829 | + if ($row['title'] != '') { $filename=$row['title']; } |
|
830 | + $desc=$row['description']; |
|
831 | + |
|
832 | + if (($myrow["path"]=='') and ($filename=='')) { |
|
833 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
834 | + return(true); |
|
835 | + } |
|
836 | + |
|
837 | + if ($icon == 'nolink') { return(shorten($filename,$length)); } |
|
838 | + if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
|
839 | + if ($builder != 'builder') |
|
840 | + { |
|
841 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename,($length-3*$level))."</a>"; |
|
842 | + if ($desc != '') |
|
843 | + { |
|
844 | + if ($icon != 'wrap') |
|
845 | + { |
|
846 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
847 | + } |
|
848 | + else |
|
849 | + { |
|
850 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
851 | + } |
|
852 | + } $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
853 | + } |
|
854 | + else |
|
855 | + { |
|
856 | + $enableDocumentParsing='yes'; |
|
857 | + if (!$enableDocumentParsing) |
|
858 | + { //this is the solution for the non-parsing version in the builder |
|
859 | + $file=urlencode($myrow["path"]); |
|
860 | + echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
861 | + } |
|
862 | + else |
|
863 | + { |
|
864 | + echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
865 | + } |
|
866 | + } |
|
867 | + break; |
|
868 | + |
|
869 | + case "Assignments": |
|
870 | + $name=get_lang('Assignments'); |
|
871 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
872 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
873 | + if ($row['title'] != '') { $name=$row['title']; } |
|
874 | + $desc=$row['description']; |
|
875 | + echo str_repeat(" >",$level); |
|
876 | + |
|
877 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
878 | + if ($icon != 'nolink') |
|
879 | + { |
|
880 | + if ($completed=='completed') { |
|
881 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
882 | + } else { |
|
883 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
884 | + //echo " "; |
|
885 | + } |
|
886 | + } |
|
887 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
888 | + |
|
889 | + if ($name=='') |
|
890 | + { |
|
891 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
892 | + } |
|
893 | + |
|
894 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
895 | + if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
|
896 | + if ($builder != 'builder') |
|
897 | + { |
|
898 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
899 | + if ($desc != '') |
|
900 | + { |
|
901 | + if ($icon != 'wrap') |
|
902 | + { |
|
903 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
904 | + } |
|
905 | + else |
|
906 | + { |
|
907 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
908 | + } |
|
909 | + } |
|
910 | + } |
|
911 | + else |
|
912 | + { |
|
913 | + echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
914 | + } |
|
915 | + break; |
|
916 | + case "Dropbox": |
|
917 | + $name=get_lang('Dropbox'); |
|
918 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
919 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
920 | + if ($row['title'] != '') { $name=$row['title']; } |
|
921 | + $desc=$row['description']; |
|
922 | + echo str_repeat(" >",$level); |
|
923 | + |
|
924 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
925 | + if ($icon != 'nolink') { |
|
926 | + if ($completed=='completed') { |
|
927 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
928 | + } else { |
|
929 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
930 | + //echo " "; |
|
931 | + } |
|
932 | + } |
|
933 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
934 | + |
|
935 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
936 | + |
|
937 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
938 | + if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
|
939 | + |
|
940 | + if ($builder != 'builder') |
|
941 | + { |
|
942 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
943 | + if ($desc != '') { |
|
944 | + if ($icon != 'wrap') { |
|
945 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
946 | + else { |
|
947 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
948 | + } |
|
949 | + } else { |
|
950 | + echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
951 | + } |
|
952 | + break; |
|
953 | + case "Introduction_text": |
|
954 | + $name=get_lang('IntroductionText'); |
|
955 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
956 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
957 | + if ($row['title'] != '') { $name=$row['title']; } |
|
958 | + $desc=$row['description']; |
|
959 | + echo str_repeat(" >",$level); |
|
960 | + |
|
961 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
962 | + if ($icon != 'nolink') { |
|
963 | + if ($completed=='completed') { |
|
964 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
965 | + } else { |
|
966 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
967 | + //echo " "; |
|
968 | + } |
|
969 | + } |
|
970 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
971 | + |
|
972 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
973 | + |
|
974 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
975 | + if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
|
976 | + |
|
977 | + if ($builder != 'builder') |
|
978 | + { |
|
979 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
980 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
981 | + if ($desc != '') { |
|
982 | + if ($icon != 'wrap') { |
|
983 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
984 | + else { |
|
985 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
986 | + } |
|
987 | + } else { |
|
988 | + $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
989 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
990 | + } |
|
991 | + break; |
|
992 | + case "Course_description": |
|
993 | + $name=get_lang('CourseDescription'); |
|
994 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
995 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
996 | + if ($row['title'] != '') { $name=$row['title']; } |
|
997 | + $desc=$row['description']; |
|
998 | + echo str_repeat(" >",$level); |
|
999 | + |
|
1000 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1001 | + if ($icon != 'nolink') { |
|
1002 | + if ($completed=='completed') { |
|
1003 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1004 | + } else { |
|
1005 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1006 | + //echo " "; |
|
1007 | + } |
|
1008 | + } |
|
1009 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1010 | + |
|
1011 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1012 | + |
|
1013 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1014 | + if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
|
1015 | + |
|
1016 | + if ($builder != 'builder') |
|
1017 | + { |
|
1018 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
1019 | + if ($desc != '') { |
|
1020 | + if ($icon != 'wrap') { |
|
1021 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1022 | + else { |
|
1023 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1024 | + } |
|
1025 | + } else { |
|
1026 | + $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
1027 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1028 | + } |
|
1029 | + break; |
|
1030 | + case "Groups": |
|
1031 | + $name=get_lang('Groups'); |
|
1032 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1033 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1034 | + if ($row['title'] != '') { $name=$row['title']; } |
|
1035 | + $desc=$row['description']; |
|
1036 | + echo str_repeat(" >",$level); |
|
1037 | + |
|
1038 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1039 | + if ($icon != 'nolink') { |
|
1040 | + if ($completed=='completed') { |
|
1041 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1042 | + } else { |
|
1043 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1044 | + //echo " "; |
|
1045 | + } |
|
1046 | + } |
|
1047 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1048 | + |
|
1049 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1050 | + |
|
1051 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1052 | + if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
|
1053 | + |
|
1054 | + if ($builder != 'builder') |
|
1055 | + { |
|
1056 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
1057 | + if ($desc != '') { |
|
1058 | + if ($icon != 'wrap') { |
|
1059 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1060 | + else { |
|
1061 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1062 | + } |
|
1063 | + } else { |
|
1064 | + echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1065 | + } |
|
1066 | + break; |
|
1067 | + case "Users": |
|
1068 | + $name=get_lang('Users'); |
|
1069 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1070 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1071 | + if ($row['title'] != '') { $name=$row['title']; } |
|
1072 | + $desc=$row['description']; |
|
1073 | + echo str_repeat(" >",$level); |
|
1074 | + |
|
1075 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
1076 | + if ($icon != 'nolink') { |
|
1077 | + if ($completed=='completed') { |
|
1078 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
1079 | + } else { |
|
1080 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
1081 | + //echo " "; |
|
1082 | + } |
|
1083 | + } |
|
1084 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
1085 | + |
|
1086 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
1087 | + |
|
1088 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
1089 | + if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
|
1090 | + |
|
1091 | + if ($builder != 'builder') |
|
1092 | + { |
|
1093 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
1094 | + if ($desc != '') { |
|
1095 | + if ($icon != 'wrap') { |
|
1096 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
1097 | + else { |
|
1098 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
1099 | + } |
|
1100 | + } else { |
|
1101 | + echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
1102 | + } |
|
1103 | + break; |
|
1104 | + }//end huge switch-statement |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | /** |
@@ -1116,253 +1116,253 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | function get_addedresource_link_in_learnpath($type, $id, $id_in_path) |
1118 | 1118 | { |
1119 | - global $_course, $learnpath_id, $tbl_learnpath_item, $items; |
|
1120 | - global $curDirPath, $_configuration, $enableDocumentParsing, $_user , $_cid; |
|
1121 | - |
|
1122 | - $hyperlink_target_parameter = ""; //or e.g. target='_blank' |
|
1123 | - $builder = 'player'; |
|
1124 | - $origin='learnpath'; |
|
1125 | - |
|
1126 | - $linktype=$type; |
|
1127 | - if (($type=="Link _self") or ($type=="Link _blank")) { $type="Link"; } |
|
1128 | - |
|
1129 | - $link = ''; |
|
1130 | - |
|
1131 | - switch ($type) |
|
1132 | - { |
|
1133 | - case "Agenda": |
|
1134 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);; |
|
1135 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
1136 | - $myrow=Database::fetch_array($result); |
|
1137 | - |
|
1138 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1139 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1140 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
1141 | - $desc=$row['description']; |
|
1142 | - $agenda_id=$row['item_id']; |
|
1143 | - |
|
1144 | - if ($builder != 'builder') |
|
1145 | - { |
|
1146 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
1147 | - } |
|
1148 | - else |
|
1149 | - { |
|
1150 | - $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; |
|
1151 | - } |
|
1152 | - break; |
|
1153 | - |
|
1154 | - case "Ad_Valvas": |
|
1155 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
1156 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
1157 | - $myrow=Database::fetch_array($result); |
|
1158 | - |
|
1159 | - if ($builder != 'builder') |
|
1160 | - { |
|
1161 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; |
|
1162 | - } |
|
1163 | - else |
|
1164 | - { |
|
1165 | - $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; |
|
1166 | - } |
|
1167 | - break; |
|
1168 | - |
|
1169 | - case "Link" : |
|
1170 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
1171 | - $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
1172 | - $myrow=Database::fetch_array($result); |
|
1173 | - |
|
1174 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1175 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1176 | - |
|
1177 | - $thelink=$myrow["url"]; |
|
1178 | - if ($builder != 'builder') |
|
1179 | - { |
|
1180 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
1181 | - } |
|
1182 | - else |
|
1183 | - { |
|
1184 | - $link .= $thelink; |
|
1185 | - } |
|
1186 | - break; |
|
1187 | - |
|
1188 | - case "Exercise": |
|
1189 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1190 | - $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
1191 | - $myrow=Database::fetch_array($result); |
|
1192 | - |
|
1193 | - if ($builder=='builder') { $origin='builder'; } |
|
1194 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
1195 | - |
|
1196 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1197 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1198 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
1199 | - |
|
1200 | - if ($builder != 'builder') |
|
1201 | - { |
|
1202 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
1203 | - } |
|
1204 | - else |
|
1205 | - { |
|
1206 | - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; |
|
1207 | - } |
|
1208 | - break; |
|
1209 | - |
|
1210 | - case "HotPotatoes": |
|
1211 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
1212 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
1213 | - $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
1214 | - $myrow= Database::fetch_array($result); |
|
1215 | - $path=$myrow["path"]; |
|
1216 | - $name=GetQuizName($path,$documentPath); |
|
1217 | - |
|
1218 | - if ($builder=='builder') { $origin='builder'; } |
|
1219 | - |
|
1220 | - $cid = $_course['official_code']; |
|
1221 | - |
|
1222 | - if ($builder != 'builder') |
|
1223 | - { |
|
1224 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
1225 | - } |
|
1226 | - else |
|
1227 | - { |
|
1228 | - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; |
|
1229 | - } |
|
1230 | - break; |
|
1231 | - |
|
1232 | - case "Forum": |
|
1119 | + global $_course, $learnpath_id, $tbl_learnpath_item, $items; |
|
1120 | + global $curDirPath, $_configuration, $enableDocumentParsing, $_user , $_cid; |
|
1121 | + |
|
1122 | + $hyperlink_target_parameter = ""; //or e.g. target='_blank' |
|
1123 | + $builder = 'player'; |
|
1124 | + $origin='learnpath'; |
|
1125 | + |
|
1126 | + $linktype=$type; |
|
1127 | + if (($type=="Link _self") or ($type=="Link _blank")) { $type="Link"; } |
|
1128 | + |
|
1129 | + $link = ''; |
|
1130 | + |
|
1131 | + switch ($type) |
|
1132 | + { |
|
1133 | + case "Agenda": |
|
1134 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);; |
|
1135 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
1136 | + $myrow=Database::fetch_array($result); |
|
1137 | + |
|
1138 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1139 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1140 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
1141 | + $desc=$row['description']; |
|
1142 | + $agenda_id=$row['item_id']; |
|
1143 | + |
|
1144 | + if ($builder != 'builder') |
|
1145 | + { |
|
1146 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
1147 | + } |
|
1148 | + else |
|
1149 | + { |
|
1150 | + $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; |
|
1151 | + } |
|
1152 | + break; |
|
1153 | + |
|
1154 | + case "Ad_Valvas": |
|
1155 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
1156 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
1157 | + $myrow=Database::fetch_array($result); |
|
1158 | + |
|
1159 | + if ($builder != 'builder') |
|
1160 | + { |
|
1161 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; |
|
1162 | + } |
|
1163 | + else |
|
1164 | + { |
|
1165 | + $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; |
|
1166 | + } |
|
1167 | + break; |
|
1168 | + |
|
1169 | + case "Link" : |
|
1170 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
1171 | + $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
1172 | + $myrow=Database::fetch_array($result); |
|
1173 | + |
|
1174 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1175 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1176 | + |
|
1177 | + $thelink=$myrow["url"]; |
|
1178 | + if ($builder != 'builder') |
|
1179 | + { |
|
1180 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
1181 | + } |
|
1182 | + else |
|
1183 | + { |
|
1184 | + $link .= $thelink; |
|
1185 | + } |
|
1186 | + break; |
|
1187 | + |
|
1188 | + case "Exercise": |
|
1189 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1190 | + $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
1191 | + $myrow=Database::fetch_array($result); |
|
1192 | + |
|
1193 | + if ($builder=='builder') { $origin='builder'; } |
|
1194 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
1195 | + |
|
1196 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1197 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1198 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
1199 | + |
|
1200 | + if ($builder != 'builder') |
|
1201 | + { |
|
1202 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
1203 | + } |
|
1204 | + else |
|
1205 | + { |
|
1206 | + $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; |
|
1207 | + } |
|
1208 | + break; |
|
1209 | + |
|
1210 | + case "HotPotatoes": |
|
1211 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
1212 | + $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
1213 | + $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
1214 | + $myrow= Database::fetch_array($result); |
|
1215 | + $path=$myrow["path"]; |
|
1216 | + $name=GetQuizName($path,$documentPath); |
|
1217 | + |
|
1218 | + if ($builder=='builder') { $origin='builder'; } |
|
1219 | + |
|
1220 | + $cid = $_course['official_code']; |
|
1221 | + |
|
1222 | + if ($builder != 'builder') |
|
1223 | + { |
|
1224 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
1225 | + } |
|
1226 | + else |
|
1227 | + { |
|
1228 | + $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; |
|
1229 | + } |
|
1230 | + break; |
|
1231 | + |
|
1232 | + case "Forum": |
|
1233 | 1233 | //deprecated |
1234 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
1235 | - $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
1236 | - $myrow=Database::fetch_array($result); |
|
1237 | - |
|
1238 | - if ($builder=='builder') { $origin='builder'; } |
|
1239 | - |
|
1240 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1241 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1242 | - if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
1243 | - |
|
1244 | - if ($myrow["forum_name"]=='') { $type="Forum"; } |
|
1245 | - |
|
1246 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
1247 | - if ($builder != 'builder') |
|
1248 | - { |
|
1249 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
1250 | - } |
|
1251 | - else |
|
1252 | - { |
|
1253 | - $link .= "../phpbb/viewforum.php?$forumparameters"; |
|
1254 | - } |
|
1255 | - break; |
|
1256 | - |
|
1257 | - case "Thread": //forum post |
|
1234 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
1235 | + $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
1236 | + $myrow=Database::fetch_array($result); |
|
1237 | + |
|
1238 | + if ($builder=='builder') { $origin='builder'; } |
|
1239 | + |
|
1240 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1241 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1242 | + if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
1243 | + |
|
1244 | + if ($myrow["forum_name"]=='') { $type="Forum"; } |
|
1245 | + |
|
1246 | + $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
1247 | + if ($builder != 'builder') |
|
1248 | + { |
|
1249 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
1250 | + } |
|
1251 | + else |
|
1252 | + { |
|
1253 | + $link .= "../phpbb/viewforum.php?$forumparameters"; |
|
1254 | + } |
|
1255 | + break; |
|
1256 | + |
|
1257 | + case "Thread": //forum post |
|
1258 | 1258 | //deprecated |
1259 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
1260 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
1261 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
1262 | - $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
1263 | - $result= Database::query($sql); |
|
1264 | - $myrow=Database::fetch_array($result); |
|
1265 | - |
|
1266 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1267 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1268 | - |
|
1269 | - if ($builder != 'builder') |
|
1270 | - { |
|
1271 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
1272 | - } |
|
1273 | - else |
|
1274 | - { |
|
1275 | - $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
1276 | - } |
|
1277 | - break; |
|
1278 | - case "Post": |
|
1279 | - break; |
|
1280 | - case "Document": |
|
1281 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
1282 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
1283 | - $myrow=Database::fetch_array($result); |
|
1284 | - |
|
1285 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
1286 | - $last=count($pathname)-1; // making a correct name for the link |
|
1287 | - $filename=$pathname[$last]; // making a correct name for the link |
|
1288 | - |
|
1289 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1290 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1291 | - |
|
1292 | - if ($builder != 'builder') |
|
1293 | - { |
|
1294 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
1295 | - |
|
1296 | - } |
|
1297 | - else |
|
1298 | - { |
|
1299 | - $enableDocumentParsing='yes'; |
|
1300 | - if (!$enableDocumentParsing) |
|
1301 | - { //this is the solution for the non-parsing version in the builder |
|
1302 | - $file=urlencode($myrow["path"]); |
|
1303 | - $link .= "../document/showinframes.php?file=$file"; |
|
1304 | - } |
|
1305 | - else |
|
1306 | - { |
|
1307 | - $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
1308 | - } |
|
1309 | - } |
|
1310 | - break; |
|
1311 | - |
|
1312 | - case "Assignments": |
|
1313 | - if ($builder != 'builder') |
|
1314 | - { |
|
1315 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
1316 | - } |
|
1317 | - else |
|
1318 | - { |
|
1319 | - $link .= "../work/work.php"; |
|
1320 | - } |
|
1321 | - break; |
|
1322 | - case "Dropbox": |
|
1323 | - if ($builder != 'builder') |
|
1324 | - { |
|
1325 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
1326 | - } else { |
|
1327 | - $link .= "../dropbox/index.php"; |
|
1328 | - } |
|
1329 | - break; |
|
1330 | - case "Introduction_text": |
|
1331 | - if ($builder != 'builder') |
|
1332 | - { |
|
1333 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
1334 | - } else { |
|
1335 | - $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
1336 | - $link .= $s; |
|
1337 | - } |
|
1338 | - break; |
|
1339 | - case "Course_description": |
|
1340 | - if ($builder != 'builder') |
|
1341 | - { |
|
1342 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
1343 | - } else { |
|
1344 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
1345 | - $link .= $s; |
|
1346 | - } |
|
1347 | - break; |
|
1348 | - case "Groups": |
|
1349 | - |
|
1350 | - if ($builder != 'builder') |
|
1351 | - { |
|
1352 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
1353 | - } else { |
|
1354 | - $link .= "../group/group.php?origin=$origin"; |
|
1355 | - } |
|
1356 | - break; |
|
1357 | - case "Users": |
|
1358 | - if ($builder != 'builder') |
|
1359 | - { |
|
1360 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
1361 | - } else { |
|
1362 | - $link .= "../user/user.php?origin=$origin"; |
|
1363 | - } |
|
1364 | - break; |
|
1365 | - }//end huge switch-statement |
|
1259 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
1260 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
1261 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
1262 | + $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
1263 | + $result= Database::query($sql); |
|
1264 | + $myrow=Database::fetch_array($result); |
|
1265 | + |
|
1266 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1267 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1268 | + |
|
1269 | + if ($builder != 'builder') |
|
1270 | + { |
|
1271 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
1272 | + } |
|
1273 | + else |
|
1274 | + { |
|
1275 | + $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
1276 | + } |
|
1277 | + break; |
|
1278 | + case "Post": |
|
1279 | + break; |
|
1280 | + case "Document": |
|
1281 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
1282 | + $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
1283 | + $myrow=Database::fetch_array($result); |
|
1284 | + |
|
1285 | + $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
1286 | + $last=count($pathname)-1; // making a correct name for the link |
|
1287 | + $filename=$pathname[$last]; // making a correct name for the link |
|
1288 | + |
|
1289 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
1290 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
1291 | + |
|
1292 | + if ($builder != 'builder') |
|
1293 | + { |
|
1294 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
1295 | + |
|
1296 | + } |
|
1297 | + else |
|
1298 | + { |
|
1299 | + $enableDocumentParsing='yes'; |
|
1300 | + if (!$enableDocumentParsing) |
|
1301 | + { //this is the solution for the non-parsing version in the builder |
|
1302 | + $file=urlencode($myrow["path"]); |
|
1303 | + $link .= "../document/showinframes.php?file=$file"; |
|
1304 | + } |
|
1305 | + else |
|
1306 | + { |
|
1307 | + $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
1308 | + } |
|
1309 | + } |
|
1310 | + break; |
|
1311 | + |
|
1312 | + case "Assignments": |
|
1313 | + if ($builder != 'builder') |
|
1314 | + { |
|
1315 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
1316 | + } |
|
1317 | + else |
|
1318 | + { |
|
1319 | + $link .= "../work/work.php"; |
|
1320 | + } |
|
1321 | + break; |
|
1322 | + case "Dropbox": |
|
1323 | + if ($builder != 'builder') |
|
1324 | + { |
|
1325 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
1326 | + } else { |
|
1327 | + $link .= "../dropbox/index.php"; |
|
1328 | + } |
|
1329 | + break; |
|
1330 | + case "Introduction_text": |
|
1331 | + if ($builder != 'builder') |
|
1332 | + { |
|
1333 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
1334 | + } else { |
|
1335 | + $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
1336 | + $link .= $s; |
|
1337 | + } |
|
1338 | + break; |
|
1339 | + case "Course_description": |
|
1340 | + if ($builder != 'builder') |
|
1341 | + { |
|
1342 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
1343 | + } else { |
|
1344 | + $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
1345 | + $link .= $s; |
|
1346 | + } |
|
1347 | + break; |
|
1348 | + case "Groups": |
|
1349 | + |
|
1350 | + if ($builder != 'builder') |
|
1351 | + { |
|
1352 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
1353 | + } else { |
|
1354 | + $link .= "../group/group.php?origin=$origin"; |
|
1355 | + } |
|
1356 | + break; |
|
1357 | + case "Users": |
|
1358 | + if ($builder != 'builder') |
|
1359 | + { |
|
1360 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
1361 | + } else { |
|
1362 | + $link .= "../user/user.php?origin=$origin"; |
|
1363 | + } |
|
1364 | + break; |
|
1365 | + }//end huge switch-statement |
|
1366 | 1366 | return $link; |
1367 | 1367 | } |
1368 | 1368 | |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | */ |
1372 | 1372 | function remove_resource($resource_key) |
1373 | 1373 | { |
1374 | - $addedresource = $_SESSION['addedresource']; |
|
1375 | - $addedresourceid = $_SESSION['addedresourceid']; |
|
1376 | - unset($addedresource[$resource_key]); |
|
1377 | - unset($addedresourceid[$resource_key]); |
|
1378 | - $_SESSION['addedresource']=$addedresource; |
|
1379 | - $_SESSION['addedresourceid']=$addedresourceid ; |
|
1374 | + $addedresource = $_SESSION['addedresource']; |
|
1375 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
1376 | + unset($addedresource[$resource_key]); |
|
1377 | + unset($addedresourceid[$resource_key]); |
|
1378 | + $_SESSION['addedresource']=$addedresource; |
|
1379 | + $_SESSION['addedresourceid']=$addedresourceid ; |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | /** |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | */ |
1386 | 1386 | function show_addresource_button($additionalparameters = '') |
1387 | 1387 | { |
1388 | - global $charset; |
|
1389 | - echo '<label for="addresources"><img src="../img/attachment.gif" /></label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities(get_lang('Attachment'), ENT_QUOTES, $charset).'" '.$additionalparameters.' />'; |
|
1388 | + global $charset; |
|
1389 | + echo '<label for="addresources"><img src="../img/attachment.gif" /></label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities(get_lang('Attachment'), ENT_QUOTES, $charset).'" '.$additionalparameters.' />'; |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | /** |
@@ -1408,11 +1408,11 @@ discard block |
||
1408 | 1408 | */ |
1409 | 1409 | function delete_added_resource($type, $id) |
1410 | 1410 | { |
1411 | - global $_course; |
|
1412 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1411 | + global $_course; |
|
1412 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1413 | 1413 | |
1414 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1415 | - Database::query($sql); |
|
1414 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1415 | + Database::query($sql); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /** |
@@ -1421,12 +1421,12 @@ discard block |
||
1421 | 1421 | */ |
1422 | 1422 | function delete_all_resources_type($type) |
1423 | 1423 | { |
1424 | - global $_course; |
|
1425 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1424 | + global $_course; |
|
1425 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1426 | 1426 | |
1427 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
1427 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
1428 | 1428 | |
1429 | - Database::query($sql); |
|
1429 | + Database::query($sql); |
|
1430 | 1430 | } |
1431 | 1431 | |
1432 | 1432 | /** |
@@ -1434,15 +1434,15 @@ discard block |
||
1434 | 1434 | */ |
1435 | 1435 | function check_added_resources($type, $id) |
1436 | 1436 | { |
1437 | - global $_course, $origin; |
|
1438 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1439 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1440 | - $result=Database::query($sql); |
|
1441 | - $number_added=Database::num_rows($result); |
|
1442 | - if ($number_added<>0) |
|
1443 | - return true; |
|
1444 | - else |
|
1445 | - return false; |
|
1437 | + global $_course, $origin; |
|
1438 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1439 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1440 | + $result=Database::query($sql); |
|
1441 | + $number_added=Database::num_rows($result); |
|
1442 | + if ($number_added<>0) |
|
1443 | + return true; |
|
1444 | + else |
|
1445 | + return false; |
|
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | |
@@ -1452,18 +1452,18 @@ discard block |
||
1452 | 1452 | */ |
1453 | 1453 | function edit_added_resources($type, $id) |
1454 | 1454 | { |
1455 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1455 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1456 | 1456 | $course_id = api_get_course_int_id(); |
1457 | 1457 | $id = intval($id); |
1458 | 1458 | $type = Database::escape_string($type); |
1459 | - $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
1460 | - $result=Database::query($sql); |
|
1461 | - while ($row=Database::fetch_array($result)) { |
|
1462 | - $addedresource[]=$row["resource_type"]; |
|
1463 | - $addedresourceid[]=$row["resource_id"]; |
|
1464 | - } |
|
1465 | - $_SESSION['addedresource']=$addedresource; |
|
1466 | - $_SESSION['addedresourceid']=$addedresourceid; |
|
1459 | + $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
1460 | + $result=Database::query($sql); |
|
1461 | + while ($row=Database::fetch_array($result)) { |
|
1462 | + $addedresource[]=$row["resource_type"]; |
|
1463 | + $addedresourceid[]=$row["resource_id"]; |
|
1464 | + } |
|
1465 | + $_SESSION['addedresource']=$addedresource; |
|
1466 | + $_SESSION['addedresourceid']=$addedresourceid; |
|
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | /** |
@@ -1473,20 +1473,20 @@ discard block |
||
1473 | 1473 | */ |
1474 | 1474 | function update_added_resources($type, $id) |
1475 | 1475 | { |
1476 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1476 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1477 | 1477 | $course_id = api_get_course_int_id(); |
1478 | 1478 | $id = intval($id); |
1479 | 1479 | $type = Database::escape_string($type); |
1480 | - // delete all the added resources for this item in the database; |
|
1481 | - $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
1482 | - //echo $sql; |
|
1483 | - Database::query($sql); |
|
1480 | + // delete all the added resources for this item in the database; |
|
1481 | + $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
1482 | + //echo $sql; |
|
1483 | + Database::query($sql); |
|
1484 | 1484 | |
1485 | - // store the resources from the session into the database |
|
1486 | - store_resources($type, $id); |
|
1485 | + // store the resources from the session into the database |
|
1486 | + store_resources($type, $id); |
|
1487 | 1487 | |
1488 | - //delete_added_resource_($type, $id); |
|
1489 | - unset_session_resources(); |
|
1488 | + //delete_added_resource_($type, $id); |
|
1489 | + unset_session_resources(); |
|
1490 | 1490 | } |
1491 | 1491 | |
1492 | 1492 | /** |
@@ -1494,25 +1494,25 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | function display_added_resources($type, $id, $style='') |
1496 | 1496 | { |
1497 | - // the array containing the icons |
|
1498 | - $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
1499 | - |
|
1500 | - global $_course, $origin; |
|
1501 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1502 | - |
|
1503 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1504 | - $result=Database::query($sql); |
|
1505 | - while ($row=Database::fetch_array($result)) |
|
1506 | - { |
|
1507 | - if ($origin != 'learnpath') |
|
1508 | - { |
|
1509 | - display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
1510 | - } |
|
1511 | - else |
|
1512 | - { |
|
1513 | - display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
1514 | - } |
|
1515 | - } |
|
1497 | + // the array containing the icons |
|
1498 | + $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
1499 | + |
|
1500 | + global $_course, $origin; |
|
1501 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
1502 | + |
|
1503 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
1504 | + $result=Database::query($sql); |
|
1505 | + while ($row=Database::fetch_array($result)) |
|
1506 | + { |
|
1507 | + if ($origin != 'learnpath') |
|
1508 | + { |
|
1509 | + display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
1510 | + } |
|
1511 | + else |
|
1512 | + { |
|
1513 | + display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
1514 | + } |
|
1515 | + } |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | |
@@ -1523,15 +1523,15 @@ discard block |
||
1523 | 1523 | */ |
1524 | 1524 | function display_resources($showdeleteimg) |
1525 | 1525 | { |
1526 | - global $action; |
|
1527 | - global $resourceaction; |
|
1528 | - global $id; |
|
1529 | - global $locationkey; |
|
1530 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
1531 | - |
|
1532 | - if ($resourceaction=="removeresource") |
|
1533 | - { |
|
1534 | - /* unneccessary because when editing we delete all the added resources from the |
|
1526 | + global $action; |
|
1527 | + global $resourceaction; |
|
1528 | + global $id; |
|
1529 | + global $locationkey; |
|
1530 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
1531 | + |
|
1532 | + if ($resourceaction=="removeresource") |
|
1533 | + { |
|
1534 | + /* unneccessary because when editing we delete all the added resources from the |
|
1535 | 1535 | database and add all these from the session |
1536 | 1536 | if ($action=="edit") // we have an edit and thus we delete from the database and from the session |
1537 | 1537 | { |
@@ -1547,41 +1547,41 @@ discard block |
||
1547 | 1547 | } |
1548 | 1548 | else // we remove from the session |
1549 | 1549 | {*/ |
1550 | - //echo "remove from session"; |
|
1551 | - remove_resource($locationkey); |
|
1552 | - } |
|
1553 | - $addedresource=$_SESSION['addedresource']; |
|
1554 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
1555 | - if (is_array($addedresource)) |
|
1556 | - { |
|
1557 | - echo '<table>'; |
|
1558 | - foreach ($addedresource as $resource) |
|
1559 | - { |
|
1560 | - //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
1561 | - echo '<tr><td>'; |
|
1562 | - display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
1563 | - echo '</td><td width="30">'; |
|
1564 | - |
|
1565 | - // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
1566 | - // should also contain this id. |
|
1567 | - $test=parse_url($_SERVER['REQUEST_URI']); |
|
1568 | - $output = array(); |
|
1569 | - parse_str($test['query'],$output); |
|
1570 | - |
|
1571 | - if ($showdeleteimg==1) |
|
1572 | - { |
|
1573 | - echo "<a href=".api_get_self()."?showresources=true&source_forum=".$_GET['source_forum']."&resourceaction=removeresource&locationkey=".key($addedresource)."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no><img src='../img/delete.gif' border='0' alt='resource ".get_lang('Delete')."' /></a><br />"; |
|
1574 | - } |
|
1575 | - echo '</td></tr>'; |
|
1576 | - next($addedresource); |
|
1577 | - //$_SESSION['edit']==''; |
|
1578 | - } |
|
1579 | - echo '</table>'; |
|
1580 | - } |
|
1581 | - else // it is a string |
|
1582 | - { |
|
1583 | - echo ''; |
|
1584 | - } |
|
1550 | + //echo "remove from session"; |
|
1551 | + remove_resource($locationkey); |
|
1552 | + } |
|
1553 | + $addedresource=$_SESSION['addedresource']; |
|
1554 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
1555 | + if (is_array($addedresource)) |
|
1556 | + { |
|
1557 | + echo '<table>'; |
|
1558 | + foreach ($addedresource as $resource) |
|
1559 | + { |
|
1560 | + //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
1561 | + echo '<tr><td>'; |
|
1562 | + display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
1563 | + echo '</td><td width="30">'; |
|
1564 | + |
|
1565 | + // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
1566 | + // should also contain this id. |
|
1567 | + $test=parse_url($_SERVER['REQUEST_URI']); |
|
1568 | + $output = array(); |
|
1569 | + parse_str($test['query'],$output); |
|
1570 | + |
|
1571 | + if ($showdeleteimg==1) |
|
1572 | + { |
|
1573 | + echo "<a href=".api_get_self()."?showresources=true&source_forum=".$_GET['source_forum']."&resourceaction=removeresource&locationkey=".key($addedresource)."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no><img src='../img/delete.gif' border='0' alt='resource ".get_lang('Delete')."' /></a><br />"; |
|
1574 | + } |
|
1575 | + echo '</td></tr>'; |
|
1576 | + next($addedresource); |
|
1577 | + //$_SESSION['edit']==''; |
|
1578 | + } |
|
1579 | + echo '</table>'; |
|
1580 | + } |
|
1581 | + else // it is a string |
|
1582 | + { |
|
1583 | + echo ''; |
|
1584 | + } |
|
1585 | 1585 | } // end of the display_resources function |
1586 | 1586 | |
1587 | 1587 | |
@@ -1593,49 +1593,49 @@ discard block |
||
1593 | 1593 | */ |
1594 | 1594 | function showorhide_addresourcelink($type, $id) |
1595 | 1595 | { |
1596 | - global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
1597 | - //global $_SESSION['addresource']; |
|
1598 | - //global $_SESSION['addresourceid']; |
|
1599 | - $addedresource=$_SESSION['addedresource']; |
|
1600 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
1601 | - |
|
1602 | - if (is_array($_SESSION['addedresource'])) |
|
1603 | - { |
|
1604 | - foreach ($addedresource as $toolcompare) |
|
1605 | - { |
|
1606 | - //echo $toolcompare; |
|
1607 | - //echo "/".$type."/".$id."****"; |
|
1608 | - //$key=key($addedresource); |
|
1609 | - //echo $addedresourceid[$key]; |
|
1610 | - //print_r($addedresourceid); |
|
1611 | - //echo "<br>"; |
|
1612 | - |
|
1613 | - if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
1614 | - { |
|
1615 | - $show=0; |
|
1616 | - } |
|
1617 | - next($addedresource); |
|
1618 | - } |
|
1619 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
1620 | - if ($show!==0) |
|
1621 | - { |
|
1622 | - if ($type=="Document") |
|
1623 | - { |
|
1624 | - echo "<a href=".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".$lang_add_it_or_resource."</a>"; |
|
1625 | - } |
|
1626 | - else |
|
1627 | - { |
|
1628 | - echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
1629 | - } |
|
1630 | - } |
|
1631 | - } |
|
1632 | - else // if it is not an array, it is a string |
|
1633 | - { |
|
1634 | - if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
1635 | - { |
|
1636 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
1637 | - echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
1638 | - } |
|
1639 | - } |
|
1596 | + global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
1597 | + //global $_SESSION['addresource']; |
|
1598 | + //global $_SESSION['addresourceid']; |
|
1599 | + $addedresource=$_SESSION['addedresource']; |
|
1600 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
1601 | + |
|
1602 | + if (is_array($_SESSION['addedresource'])) |
|
1603 | + { |
|
1604 | + foreach ($addedresource as $toolcompare) |
|
1605 | + { |
|
1606 | + //echo $toolcompare; |
|
1607 | + //echo "/".$type."/".$id."****"; |
|
1608 | + //$key=key($addedresource); |
|
1609 | + //echo $addedresourceid[$key]; |
|
1610 | + //print_r($addedresourceid); |
|
1611 | + //echo "<br>"; |
|
1612 | + |
|
1613 | + if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
1614 | + { |
|
1615 | + $show=0; |
|
1616 | + } |
|
1617 | + next($addedresource); |
|
1618 | + } |
|
1619 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
1620 | + if ($show!==0) |
|
1621 | + { |
|
1622 | + if ($type=="Document") |
|
1623 | + { |
|
1624 | + echo "<a href=".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".$lang_add_it_or_resource."</a>"; |
|
1625 | + } |
|
1626 | + else |
|
1627 | + { |
|
1628 | + echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
1629 | + } |
|
1630 | + } |
|
1631 | + } |
|
1632 | + else // if it is not an array, it is a string |
|
1633 | + { |
|
1634 | + if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
1635 | + { |
|
1636 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
1637 | + echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
1638 | + } |
|
1639 | + } |
|
1640 | 1640 | } |
1641 | 1641 | ?> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | // Login as ... |
21 | 21 | if ($action == "login_as" && !empty ($login_as_user_id)) |
22 | 22 | { |
23 | - login_user($login_as_user_id); |
|
23 | + login_user($login_as_user_id); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | //if we already have a session id and a user... |
@@ -37,150 +37,150 @@ discard block |
||
37 | 37 | |
38 | 38 | if (isset ($_GET['action'])) |
39 | 39 | { |
40 | - $check = Security::check_token('get'); |
|
41 | - if($check) |
|
42 | - { |
|
43 | - switch ($_GET['action']) |
|
44 | - { |
|
45 | - case 'show_message' : |
|
46 | - Display :: display_header($tool_name); |
|
47 | - Display :: display_normal_message($_GET['message']); |
|
48 | - break; |
|
49 | - case 'delete_user' : |
|
50 | - Display :: display_header($tool_name); |
|
51 | - if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) |
|
52 | - { |
|
53 | - Display :: display_normal_message(get_lang('UserDeleted')); |
|
54 | - } |
|
55 | - else |
|
56 | - { |
|
57 | - Display :: display_error_message(get_lang('CannotDeleteUser')); |
|
58 | - } |
|
59 | - break; |
|
60 | - case 'lock' : |
|
61 | - Display :: display_header($tool_name); |
|
62 | - $message=lock_unlock_user('lock',$_GET['user_id']); |
|
63 | - Display :: display_normal_message($message); |
|
64 | - break; |
|
65 | - case 'unlock'; |
|
66 | - Display :: display_header($tool_name); |
|
67 | - $message=lock_unlock_user('unlock',$_GET['user_id']); |
|
68 | - Display :: display_normal_message($message); |
|
69 | - break; |
|
70 | - case 'add_user'; |
|
71 | - $id=$_GET['id']; |
|
72 | - $UserList=array(); |
|
73 | - $userid_match_login = array(); |
|
74 | - foreach ($id as $user_id) { |
|
75 | - $tmp = ldap_add_user($user_id); |
|
76 | - $UserList[]= $tmp; |
|
77 | - $userid_match_login[$tmp] = $user_id; |
|
78 | - } |
|
79 | - if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) { |
|
80 | - ldap_add_user_to_session($UserList, $_GET['id_session']); |
|
81 | - header('Location: resume_session.php?id_session='.intval($_GET['id_session'])); |
|
82 | - } else { |
|
83 | - Display :: display_header($tool_name); |
|
84 | - if(count($userid_match_login)>0) |
|
85 | - { |
|
86 | - $message=get_lang('LDAPUsersAddedOrUpdated').':<br />'; |
|
87 | - foreach($userid_match_login as $user_id => $login) |
|
88 | - { |
|
89 | - $message .= '- '.$login.'<br />'; |
|
90 | - } |
|
91 | - } |
|
92 | - else |
|
93 | - { |
|
94 | - $message=get_lang('NoUserAdded'); |
|
95 | - } |
|
96 | - Display :: display_normal_message($message,false); |
|
97 | - } |
|
98 | - break; |
|
99 | - default : |
|
100 | - Display :: display_header($tool_name); |
|
101 | - } |
|
102 | - Security::clear_token(); |
|
103 | - } |
|
104 | - else |
|
105 | - { |
|
106 | - Display::display_header($tool_name); |
|
107 | - } |
|
40 | + $check = Security::check_token('get'); |
|
41 | + if($check) |
|
42 | + { |
|
43 | + switch ($_GET['action']) |
|
44 | + { |
|
45 | + case 'show_message' : |
|
46 | + Display :: display_header($tool_name); |
|
47 | + Display :: display_normal_message($_GET['message']); |
|
48 | + break; |
|
49 | + case 'delete_user' : |
|
50 | + Display :: display_header($tool_name); |
|
51 | + if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) |
|
52 | + { |
|
53 | + Display :: display_normal_message(get_lang('UserDeleted')); |
|
54 | + } |
|
55 | + else |
|
56 | + { |
|
57 | + Display :: display_error_message(get_lang('CannotDeleteUser')); |
|
58 | + } |
|
59 | + break; |
|
60 | + case 'lock' : |
|
61 | + Display :: display_header($tool_name); |
|
62 | + $message=lock_unlock_user('lock',$_GET['user_id']); |
|
63 | + Display :: display_normal_message($message); |
|
64 | + break; |
|
65 | + case 'unlock'; |
|
66 | + Display :: display_header($tool_name); |
|
67 | + $message=lock_unlock_user('unlock',$_GET['user_id']); |
|
68 | + Display :: display_normal_message($message); |
|
69 | + break; |
|
70 | + case 'add_user'; |
|
71 | + $id=$_GET['id']; |
|
72 | + $UserList=array(); |
|
73 | + $userid_match_login = array(); |
|
74 | + foreach ($id as $user_id) { |
|
75 | + $tmp = ldap_add_user($user_id); |
|
76 | + $UserList[]= $tmp; |
|
77 | + $userid_match_login[$tmp] = $user_id; |
|
78 | + } |
|
79 | + if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) { |
|
80 | + ldap_add_user_to_session($UserList, $_GET['id_session']); |
|
81 | + header('Location: resume_session.php?id_session='.intval($_GET['id_session'])); |
|
82 | + } else { |
|
83 | + Display :: display_header($tool_name); |
|
84 | + if(count($userid_match_login)>0) |
|
85 | + { |
|
86 | + $message=get_lang('LDAPUsersAddedOrUpdated').':<br />'; |
|
87 | + foreach($userid_match_login as $user_id => $login) |
|
88 | + { |
|
89 | + $message .= '- '.$login.'<br />'; |
|
90 | + } |
|
91 | + } |
|
92 | + else |
|
93 | + { |
|
94 | + $message=get_lang('NoUserAdded'); |
|
95 | + } |
|
96 | + Display :: display_normal_message($message,false); |
|
97 | + } |
|
98 | + break; |
|
99 | + default : |
|
100 | + Display :: display_header($tool_name); |
|
101 | + } |
|
102 | + Security::clear_token(); |
|
103 | + } |
|
104 | + else |
|
105 | + { |
|
106 | + Display::display_header($tool_name); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | else |
110 | 110 | { |
111 | - Display::display_header($tool_name); |
|
111 | + Display::display_header($tool_name); |
|
112 | 112 | } |
113 | 113 | if (isset ($_POST['action'])) |
114 | 114 | { |
115 | - $check = Security::check_token('get'); |
|
116 | - if($check) |
|
117 | - { |
|
118 | - switch ($_POST['action']) |
|
119 | - { |
|
120 | - case 'delete' : |
|
121 | - $number_of_selected_users = count($_POST['id']); |
|
122 | - $number_of_deleted_users = 0; |
|
123 | - foreach ($_POST['id'] as $index => $user_id) |
|
124 | - { |
|
125 | - if($user_id != $_user['user_id']) |
|
126 | - { |
|
127 | - if(UserManager :: delete_user($user_id)) |
|
128 | - { |
|
129 | - $number_of_deleted_users++; |
|
130 | - } |
|
131 | - } |
|
132 | - } |
|
133 | - if($number_of_selected_users == $number_of_deleted_users) |
|
134 | - { |
|
135 | - Display :: display_normal_message(get_lang('SelectedUsersDeleted')); |
|
136 | - } |
|
137 | - else |
|
138 | - { |
|
139 | - Display :: display_error_message(get_lang('SomeUsersNotDeleted')); |
|
140 | - } |
|
141 | - break; |
|
142 | - case 'add_user' : |
|
143 | - $number_of_selected_users = count($_POST['id']); |
|
144 | - $number_of_added_users = 0; |
|
145 | - $UserList=array(); |
|
146 | - foreach ($_POST['id'] as $index => $user_id) |
|
147 | - { |
|
148 | - if($user_id != $_user['user_id']) |
|
149 | - { |
|
150 | - $UserList[] = ldap_add_user($user_id); |
|
151 | - } |
|
152 | - } |
|
153 | - if (isset($_GET['id_session']) && (trim($_GET['id_session'])!="")) |
|
154 | - addUserToSession($UserList, $_GET['id_session']); |
|
155 | - if(count($UserList)>0) |
|
156 | - { |
|
157 | - Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded')); |
|
158 | - } |
|
159 | - else |
|
160 | - { |
|
161 | - Display :: display_normal_message(get_lang('NoUserAdded')); |
|
162 | - } |
|
163 | - break; |
|
115 | + $check = Security::check_token('get'); |
|
116 | + if($check) |
|
117 | + { |
|
118 | + switch ($_POST['action']) |
|
119 | + { |
|
120 | + case 'delete' : |
|
121 | + $number_of_selected_users = count($_POST['id']); |
|
122 | + $number_of_deleted_users = 0; |
|
123 | + foreach ($_POST['id'] as $index => $user_id) |
|
124 | + { |
|
125 | + if($user_id != $_user['user_id']) |
|
126 | + { |
|
127 | + if(UserManager :: delete_user($user_id)) |
|
128 | + { |
|
129 | + $number_of_deleted_users++; |
|
130 | + } |
|
131 | + } |
|
132 | + } |
|
133 | + if($number_of_selected_users == $number_of_deleted_users) |
|
134 | + { |
|
135 | + Display :: display_normal_message(get_lang('SelectedUsersDeleted')); |
|
136 | + } |
|
137 | + else |
|
138 | + { |
|
139 | + Display :: display_error_message(get_lang('SomeUsersNotDeleted')); |
|
140 | + } |
|
141 | + break; |
|
142 | + case 'add_user' : |
|
143 | + $number_of_selected_users = count($_POST['id']); |
|
144 | + $number_of_added_users = 0; |
|
145 | + $UserList=array(); |
|
146 | + foreach ($_POST['id'] as $index => $user_id) |
|
147 | + { |
|
148 | + if($user_id != $_user['user_id']) |
|
149 | + { |
|
150 | + $UserList[] = ldap_add_user($user_id); |
|
151 | + } |
|
152 | + } |
|
153 | + if (isset($_GET['id_session']) && (trim($_GET['id_session'])!="")) |
|
154 | + addUserToSession($UserList, $_GET['id_session']); |
|
155 | + if(count($UserList)>0) |
|
156 | + { |
|
157 | + Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded')); |
|
158 | + } |
|
159 | + else |
|
160 | + { |
|
161 | + Display :: display_normal_message(get_lang('NoUserAdded')); |
|
162 | + } |
|
163 | + break; |
|
164 | 164 | |
165 | - } |
|
166 | - Security::clear_token(); |
|
167 | - } |
|
165 | + } |
|
166 | + Security::clear_token(); |
|
167 | + } |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $form = new FormValidator('advanced_search','get'); |
171 | 171 | $form->addText('keyword_username',get_lang('LoginName'),false); |
172 | 172 | if (api_is_western_name_order()) |
173 | 173 | { |
174 | - $form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
175 | - $form->addText('keyword_lastname', get_lang('LastName'), false); |
|
174 | + $form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
175 | + $form->addText('keyword_lastname', get_lang('LastName'), false); |
|
176 | 176 | } |
177 | 177 | else |
178 | 178 | { |
179 | - $form->addText('keyword_lastname',get_lang('LastName'),false); |
|
180 | - $form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
179 | + $form->addText('keyword_lastname',get_lang('LastName'),false); |
|
180 | + $form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
181 | 181 | } |
182 | 182 | if (isset($_GET['id_session'])) |
183 | - $form->addElement('hidden','id_session',$_GET['id_session']); |
|
183 | + $form->addElement('hidden','id_session',$_GET['id_session']); |
|
184 | 184 | |
185 | 185 | $type = array(); |
186 | 186 | $type["all"] = get_lang('All'); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null; |
203 | 203 | $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null; |
204 | 204 | if (isset($_GET['id_session'])) |
205 | - $parameters['id_session'] = $_GET['id_session']; |
|
205 | + $parameters['id_session'] = $_GET['id_session']; |
|
206 | 206 | // Create a sortable table with user-data |
207 | 207 | |
208 | 208 | $parameters['sec_token'] = Security::get_token(); |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | $table->set_header(1, get_lang('LoginName')); |
213 | 213 | if (api_is_western_name_order()) |
214 | 214 | { |
215 | - $table->set_header(2, get_lang('FirstName')); |
|
216 | - $table->set_header(3, get_lang('LastName')); |
|
215 | + $table->set_header(2, get_lang('FirstName')); |
|
216 | + $table->set_header(3, get_lang('LastName')); |
|
217 | 217 | } |
218 | 218 | else |
219 | 219 | { |
220 | - $table->set_header(2, get_lang('LastName')); |
|
221 | - $table->set_header(3, get_lang('FirstName')); |
|
220 | + $table->set_header(2, get_lang('LastName')); |
|
221 | + $table->set_header(3, get_lang('FirstName')); |
|
222 | 222 | } |
223 | 223 | $table->set_header(4, get_lang('Email')); |
224 | 224 | $table->set_header(5, get_lang('Actions')); |
@@ -44,107 +44,107 @@ discard block |
||
44 | 44 | |
45 | 45 | class BigBlueButtonBN { |
46 | 46 | |
47 | - private $_securitySalt; |
|
48 | - private $_bbbServerBaseUrl; |
|
47 | + private $_securitySalt; |
|
48 | + private $_bbbServerBaseUrl; |
|
49 | 49 | |
50 | - /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
50 | + /* ___________ General Methods for the BigBlueButton Class __________ */ |
|
51 | 51 | |
52 | - function __construct() { |
|
53 | - /* |
|
52 | + function __construct() { |
|
53 | + /* |
|
54 | 54 | Establish just our basic elements in the constructor: |
55 | 55 | */ |
56 | - // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | - // simply flow in here via the constants: |
|
58 | - $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | - $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | - } |
|
61 | - |
|
62 | - private function _processXmlResponse($url){ |
|
63 | - /* |
|
56 | + // BASE CONFIGS - set these for your BBB server in config.php and they will |
|
57 | + // simply flow in here via the constants: |
|
58 | + $this->_securitySalt = CONFIG_SECURITY_SALT; |
|
59 | + $this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL; |
|
60 | + } |
|
61 | + |
|
62 | + private function _processXmlResponse($url){ |
|
63 | + /* |
|
64 | 64 | A private utility method used by other public methods to process XML responses. |
65 | 65 | */ |
66 | - if (extension_loaded('curl')) { |
|
67 | - $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | - $timeout = 10; |
|
69 | - curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | - curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | - curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | - $data = curl_exec( $ch ); |
|
74 | - curl_close( $ch ); |
|
75 | - |
|
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
80 | - } |
|
81 | - return (simplexml_load_file($url)); |
|
82 | - } |
|
83 | - |
|
84 | - private function _requiredParam($param) { |
|
85 | - /* Process required params and throw errors if we don't get values */ |
|
86 | - if ((isset($param)) && ($param != '')) { |
|
87 | - return $param; |
|
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
90 | - throw new Exception('Missing parameter.'); |
|
91 | - } |
|
92 | - else { |
|
93 | - throw new Exception(''.$param.' is required.'); |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - private function _optionalParam($param) { |
|
98 | - /* Pass most optional params through as set value, or set to '' */ |
|
99 | - /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | - if ((isset($param)) && ($param != '')) { |
|
101 | - return $param; |
|
102 | - } |
|
103 | - else { |
|
104 | - $param = ''; |
|
105 | - return $param; |
|
106 | - } |
|
107 | - } |
|
108 | - |
|
109 | - /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | - /* The methods in the following section support the following categories of the BBB API: |
|
66 | + if (extension_loaded('curl')) { |
|
67 | + $ch = curl_init() or die ( curl_error($ch) ); |
|
68 | + $timeout = 10; |
|
69 | + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); |
|
70 | + curl_setopt( $ch, CURLOPT_URL, $url ); |
|
71 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); |
|
72 | + curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout); |
|
73 | + $data = curl_exec( $ch ); |
|
74 | + curl_close( $ch ); |
|
75 | + |
|
76 | + if($data) |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + else |
|
79 | + return false; |
|
80 | + } |
|
81 | + return (simplexml_load_file($url)); |
|
82 | + } |
|
83 | + |
|
84 | + private function _requiredParam($param) { |
|
85 | + /* Process required params and throw errors if we don't get values */ |
|
86 | + if ((isset($param)) && ($param != '')) { |
|
87 | + return $param; |
|
88 | + } |
|
89 | + elseif (!isset($param)) { |
|
90 | + throw new Exception('Missing parameter.'); |
|
91 | + } |
|
92 | + else { |
|
93 | + throw new Exception(''.$param.' is required.'); |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + private function _optionalParam($param) { |
|
98 | + /* Pass most optional params through as set value, or set to '' */ |
|
99 | + /* Don't know if we'll use this one, but let's build it in case. */ |
|
100 | + if ((isset($param)) && ($param != '')) { |
|
101 | + return $param; |
|
102 | + } |
|
103 | + else { |
|
104 | + $param = ''; |
|
105 | + return $param; |
|
106 | + } |
|
107 | + } |
|
108 | + |
|
109 | + /* __________________ BBB ADMINISTRATION METHODS _________________ */ |
|
110 | + /* The methods in the following section support the following categories of the BBB API: |
|
111 | 111 | -- create |
112 | 112 | -- join |
113 | 113 | -- end |
114 | 114 | */ |
115 | 115 | |
116 | - public function getCreateMeetingUrl($creationParams) { |
|
117 | - /* |
|
116 | + public function getCreateMeetingUrl($creationParams) { |
|
117 | + /* |
|
118 | 118 | USAGE: |
119 | 119 | (see $creationParams array in createMeetingArray method.) |
120 | 120 | */ |
121 | - $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | - $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | - // Set up the basic creation URL: |
|
124 | - $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | - // Add params: |
|
126 | - $params = |
|
127 | - 'name='.urlencode($this->_meetingName). |
|
128 | - '&meetingID='.urlencode($this->_meetingId). |
|
129 | - '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | - '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | - '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | - '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | - '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | - '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | - '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | - '&record='.urlencode($creationParams['record']). |
|
137 | - '&duration='.urlencode($creationParams['duration']); |
|
138 | - //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | - $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | - // Return the complete URL: |
|
143 | - return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | - } |
|
145 | - |
|
146 | - public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | - /* |
|
121 | + $this->_meetingId = $this->_requiredParam($creationParams['meetingId']); |
|
122 | + $this->_meetingName = $this->_requiredParam($creationParams['meetingName']); |
|
123 | + // Set up the basic creation URL: |
|
124 | + $creationUrl = $this->_bbbServerBaseUrl."api/create?"; |
|
125 | + // Add params: |
|
126 | + $params = |
|
127 | + 'name='.urlencode($this->_meetingName). |
|
128 | + '&meetingID='.urlencode($this->_meetingId). |
|
129 | + '&attendeePW='.urlencode($creationParams['attendeePw']). |
|
130 | + '&moderatorPW='.urlencode($creationParams['moderatorPw']). |
|
131 | + '&dialNumber='.urlencode($creationParams['dialNumber']). |
|
132 | + '&voiceBridge='.urlencode($creationParams['voiceBridge']). |
|
133 | + '&webVoice='.urlencode($creationParams['webVoice']). |
|
134 | + '&logoutURL='.urlencode($creationParams['logoutUrl']). |
|
135 | + '&maxParticipants='.urlencode($creationParams['maxParticipants']). |
|
136 | + '&record='.urlencode($creationParams['record']). |
|
137 | + '&duration='.urlencode($creationParams['duration']); |
|
138 | + //'&meta_category='.urlencode($creationParams['meta_category']); |
|
139 | + $welcomeMessage = $creationParams['welcomeMsg']; |
|
140 | + if(trim($welcomeMessage)) |
|
141 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
142 | + // Return the complete URL: |
|
143 | + return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
|
144 | + } |
|
145 | + |
|
146 | + public function createMeetingWithXmlResponseArray($creationParams) { |
|
147 | + /* |
|
148 | 148 | USAGE: |
149 | 149 | $creationParams = array( |
150 | 150 | 'name' => 'Meeting Name', -- A name for the meeting (or username) |
@@ -162,34 +162,34 @@ discard block |
||
162 | 162 | 'meta_category' => '', -- Use to pass additional info to BBB server. See API docs to enable. |
163 | 163 | ); |
164 | 164 | */ |
165 | - $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
165 | + $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
|
166 | 166 | |
167 | 167 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
170 | - 'returncode' => $xml->returncode->__toString(), |
|
171 | - 'message' => $xml->message->__toString(), |
|
172 | - 'messageKey' => $xml->messageKey->__toString(), |
|
173 | - 'meetingId' => $xml->meetingID->__toString(), |
|
174 | - 'attendeePw' => $xml->attendeePW->__toString(), |
|
175 | - 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
176 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
177 | - 'createTime' => $xml->createTime->__toString() |
|
178 | - ); |
|
179 | - else |
|
180 | - return array( |
|
181 | - 'returncode' => $xml->returncode->__toString(), |
|
182 | - 'message' => $xml->message->__toString(), |
|
183 | - 'messageKey' => $xml->messageKey->__toString() |
|
184 | - ); |
|
185 | - } |
|
186 | - else { |
|
187 | - return null; |
|
188 | - } |
|
189 | - } |
|
190 | - |
|
191 | - public function getJoinMeetingURL($joinParams) { |
|
192 | - /* |
|
168 | + if($xml->meetingID) |
|
169 | + return array( |
|
170 | + 'returncode' => $xml->returncode->__toString(), |
|
171 | + 'message' => $xml->message->__toString(), |
|
172 | + 'messageKey' => $xml->messageKey->__toString(), |
|
173 | + 'meetingId' => $xml->meetingID->__toString(), |
|
174 | + 'attendeePw' => $xml->attendeePW->__toString(), |
|
175 | + 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
176 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
177 | + 'createTime' => $xml->createTime->__toString() |
|
178 | + ); |
|
179 | + else |
|
180 | + return array( |
|
181 | + 'returncode' => $xml->returncode->__toString(), |
|
182 | + 'message' => $xml->message->__toString(), |
|
183 | + 'messageKey' => $xml->messageKey->__toString() |
|
184 | + ); |
|
185 | + } |
|
186 | + else { |
|
187 | + return null; |
|
188 | + } |
|
189 | + } |
|
190 | + |
|
191 | + public function getJoinMeetingURL($joinParams) { |
|
192 | + /* |
|
193 | 193 | NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API |
194 | 194 | doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL |
195 | 195 | that's returned from this method and simply send your users off to that URL in your code. |
@@ -203,249 +203,249 @@ discard block |
||
203 | 203 | 'webVoiceConf' => '' -- OPTIONAL - string |
204 | 204 | ); |
205 | 205 | */ |
206 | - $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | - $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | - $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | - // Establish the basic join URL: |
|
210 | - $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | - // Add parameters to the URL: |
|
212 | - $params = |
|
213 | - 'meetingID='.urlencode($this->_meetingId). |
|
214 | - '&fullName='.urlencode($this->_username). |
|
215 | - '&password='.urlencode($this->_password). |
|
216 | - '&userID='.urlencode($joinParams['userID']). |
|
217 | - '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | - // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | - if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | - $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | - } |
|
222 | - // Return the URL: |
|
223 | - return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | - } |
|
225 | - |
|
226 | - public function getEndMeetingURL($endParams) { |
|
227 | - /* USAGE: |
|
206 | + $this->_meetingId = $this->_requiredParam($joinParams['meetingId']); |
|
207 | + $this->_username = $this->_requiredParam($joinParams['username']); |
|
208 | + $this->_password = $this->_requiredParam($joinParams['password']); |
|
209 | + // Establish the basic join URL: |
|
210 | + $joinUrl = $this->_bbbServerBaseUrl."api/join?"; |
|
211 | + // Add parameters to the URL: |
|
212 | + $params = |
|
213 | + 'meetingID='.urlencode($this->_meetingId). |
|
214 | + '&fullName='.urlencode($this->_username). |
|
215 | + '&password='.urlencode($this->_password). |
|
216 | + '&userID='.urlencode($joinParams['userID']). |
|
217 | + '&webVoiceConf='.urlencode($joinParams['webVoiceConf']); |
|
218 | + // Only use createTime if we really want to use it. If it's '', then don't pass it: |
|
219 | + if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) { |
|
220 | + $params .= '&createTime='.urlencode($joinParams['createTime']); |
|
221 | + } |
|
222 | + // Return the URL: |
|
223 | + return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt)); |
|
224 | + } |
|
225 | + |
|
226 | + public function getEndMeetingURL($endParams) { |
|
227 | + /* USAGE: |
|
228 | 228 | $endParams = array ( |
229 | 229 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
230 | 230 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
231 | 231 | ); |
232 | 232 | */ |
233 | - $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | - $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | - $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | - $params = |
|
237 | - 'meetingID='.urlencode($this->_meetingId). |
|
238 | - '&password='.urlencode($this->_password); |
|
239 | - return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | - } |
|
241 | - |
|
242 | - public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | - /* USAGE: |
|
233 | + $this->_meetingId = $this->_requiredParam($endParams['meetingId']); |
|
234 | + $this->_password = $this->_requiredParam($endParams['password']); |
|
235 | + $endUrl = $this->_bbbServerBaseUrl."api/end?"; |
|
236 | + $params = |
|
237 | + 'meetingID='.urlencode($this->_meetingId). |
|
238 | + '&password='.urlencode($this->_password); |
|
239 | + return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt)); |
|
240 | + } |
|
241 | + |
|
242 | + public function endMeetingWithXmlResponseArray($endParams) { |
|
243 | + /* USAGE: |
|
244 | 244 | $endParams = array ( |
245 | 245 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
246 | 246 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
247 | 247 | ); |
248 | 248 | */ |
249 | - $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | - if ($xml) { |
|
251 | - return array( |
|
252 | - 'returncode' => $xml->returncode->__toString(), |
|
253 | - 'message' => $xml->message->__toString(), |
|
254 | - 'messageKey' => $xml->messageKey->__toString() |
|
255 | - ); |
|
256 | - } |
|
257 | - else { |
|
258 | - return null; |
|
259 | - } |
|
260 | - |
|
261 | - } |
|
262 | - |
|
263 | - /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | - /* The methods in the following section support the following categories of the BBB API: |
|
249 | + $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams)); |
|
250 | + if ($xml) { |
|
251 | + return array( |
|
252 | + 'returncode' => $xml->returncode->__toString(), |
|
253 | + 'message' => $xml->message->__toString(), |
|
254 | + 'messageKey' => $xml->messageKey->__toString() |
|
255 | + ); |
|
256 | + } |
|
257 | + else { |
|
258 | + return null; |
|
259 | + } |
|
260 | + |
|
261 | + } |
|
262 | + |
|
263 | + /* __________________ BBB MONITORING METHODS _________________ */ |
|
264 | + /* The methods in the following section support the following categories of the BBB API: |
|
265 | 265 | -- isMeetingRunning |
266 | 266 | -- getMeetings |
267 | 267 | -- getMeetingInfo |
268 | 268 | */ |
269 | 269 | |
270 | - public function getIsMeetingRunningUrl($meetingId) { |
|
271 | - /* USAGE: |
|
270 | + public function getIsMeetingRunningUrl($meetingId) { |
|
271 | + /* USAGE: |
|
272 | 272 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
273 | 273 | */ |
274 | - $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | - $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | - $params = |
|
277 | - 'meetingID='.urlencode($this->_meetingId); |
|
278 | - return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | - } |
|
280 | - |
|
281 | - public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | - /* USAGE: |
|
274 | + $this->_meetingId = $this->_requiredParam($meetingId); |
|
275 | + $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?"; |
|
276 | + $params = |
|
277 | + 'meetingID='.urlencode($this->_meetingId); |
|
278 | + return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt)); |
|
279 | + } |
|
280 | + |
|
281 | + public function isMeetingRunningWithXmlResponseArray($meetingId) { |
|
282 | + /* USAGE: |
|
283 | 283 | $meetingId = '1234' -- REQUIRED - The unique id for the meeting |
284 | 284 | */ |
285 | - $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | - if($xml) { |
|
287 | - return array( |
|
288 | - 'returncode' => $xml->returncode->__toString(), |
|
289 | - 'running' => $xml->running->__toString() // -- Returns true/false. |
|
290 | - ); |
|
291 | - } |
|
292 | - else { |
|
293 | - return null; |
|
294 | - } |
|
295 | - |
|
296 | - } |
|
297 | - |
|
298 | - public function getGetMeetingsUrl() { |
|
299 | - /* Simply formulate the getMeetings URL |
|
285 | + $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId)); |
|
286 | + if($xml) { |
|
287 | + return array( |
|
288 | + 'returncode' => $xml->returncode->__toString(), |
|
289 | + 'running' => $xml->running->__toString() // -- Returns true/false. |
|
290 | + ); |
|
291 | + } |
|
292 | + else { |
|
293 | + return null; |
|
294 | + } |
|
295 | + |
|
296 | + } |
|
297 | + |
|
298 | + public function getGetMeetingsUrl() { |
|
299 | + /* Simply formulate the getMeetings URL |
|
300 | 300 | We do this in a separate function so we have the option to just get this |
301 | 301 | URL and print it if we want for some reason. |
302 | 302 | */ |
303 | - $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | - return $getMeetingsUrl; |
|
305 | - } |
|
303 | + $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt); |
|
304 | + return $getMeetingsUrl; |
|
305 | + } |
|
306 | 306 | |
307 | - public function getMeetingsWithXmlResponseArray() { |
|
308 | - /* USAGE: |
|
307 | + public function getMeetingsWithXmlResponseArray() { |
|
308 | + /* USAGE: |
|
309 | 309 | We don't need to pass any parameters with this one, so we just send the query URL off to BBB |
310 | 310 | and then handle the results that we get in the XML response. |
311 | 311 | */ |
312 | - $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | - if($xml) { |
|
314 | - // If we don't get a success code, stop processing and return just the returncode: |
|
315 | - if ($xml->returncode != 'SUCCESS') { |
|
316 | - $result = array( |
|
317 | - 'returncode' => $xml->returncode->__toString() |
|
318 | - ); |
|
319 | - return $result; |
|
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
322 | - /* No meetings on server, so return just this info: */ |
|
323 | - $result = array( |
|
324 | - 'returncode' => $xml->returncode->__toString(), |
|
325 | - 'messageKey' => $xml->messageKey->__toString(), |
|
326 | - 'message' => $xml->message->__toString() |
|
327 | - ); |
|
328 | - return $result; |
|
329 | - } |
|
330 | - else { |
|
331 | - // In this case, we have success and meetings. First return general response: |
|
332 | - $result = array( |
|
333 | - 'returncode' => $xml->returncode->__toString(), |
|
334 | - 'messageKey' => $xml->messageKey->__toString(), |
|
335 | - 'message' => $xml->message->__toString() |
|
336 | - ); |
|
337 | - // Then interate through meeting results and return them as part of the array: |
|
338 | - foreach ($xml->meetings->meeting as $m) { |
|
339 | - $result[] = array( |
|
340 | - 'meetingId' => $m->meetingID->__toString(), |
|
341 | - 'meetingName' => $m->meetingName->__toString(), |
|
342 | - 'createTime' => $m->createTime->__toString(), |
|
343 | - 'attendeePw' => $m->attendeePW->__toString(), |
|
344 | - 'moderatorPw' => $m->moderatorPW->__toString(), |
|
345 | - 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(), |
|
346 | - 'running' => $m->running->__toString() |
|
347 | - ); |
|
348 | - } |
|
349 | - return $result; |
|
350 | - } |
|
351 | - } |
|
352 | - else { |
|
353 | - return null; |
|
354 | - } |
|
355 | - |
|
356 | - } |
|
357 | - |
|
358 | - public function getMeetingInfoUrl($infoParams) { |
|
359 | - /* USAGE: |
|
312 | + $xml = $this->_processXmlResponse($this->getGetMeetingsUrl()); |
|
313 | + if($xml) { |
|
314 | + // If we don't get a success code, stop processing and return just the returncode: |
|
315 | + if ($xml->returncode != 'SUCCESS') { |
|
316 | + $result = array( |
|
317 | + 'returncode' => $xml->returncode->__toString() |
|
318 | + ); |
|
319 | + return $result; |
|
320 | + } |
|
321 | + elseif ($xml->messageKey == 'noMeetings') { |
|
322 | + /* No meetings on server, so return just this info: */ |
|
323 | + $result = array( |
|
324 | + 'returncode' => $xml->returncode->__toString(), |
|
325 | + 'messageKey' => $xml->messageKey->__toString(), |
|
326 | + 'message' => $xml->message->__toString() |
|
327 | + ); |
|
328 | + return $result; |
|
329 | + } |
|
330 | + else { |
|
331 | + // In this case, we have success and meetings. First return general response: |
|
332 | + $result = array( |
|
333 | + 'returncode' => $xml->returncode->__toString(), |
|
334 | + 'messageKey' => $xml->messageKey->__toString(), |
|
335 | + 'message' => $xml->message->__toString() |
|
336 | + ); |
|
337 | + // Then interate through meeting results and return them as part of the array: |
|
338 | + foreach ($xml->meetings->meeting as $m) { |
|
339 | + $result[] = array( |
|
340 | + 'meetingId' => $m->meetingID->__toString(), |
|
341 | + 'meetingName' => $m->meetingName->__toString(), |
|
342 | + 'createTime' => $m->createTime->__toString(), |
|
343 | + 'attendeePw' => $m->attendeePW->__toString(), |
|
344 | + 'moderatorPw' => $m->moderatorPW->__toString(), |
|
345 | + 'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(), |
|
346 | + 'running' => $m->running->__toString() |
|
347 | + ); |
|
348 | + } |
|
349 | + return $result; |
|
350 | + } |
|
351 | + } |
|
352 | + else { |
|
353 | + return null; |
|
354 | + } |
|
355 | + |
|
356 | + } |
|
357 | + |
|
358 | + public function getMeetingInfoUrl($infoParams) { |
|
359 | + /* USAGE: |
|
360 | 360 | $infoParams = array( |
361 | 361 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
362 | 362 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
363 | 363 | ); |
364 | 364 | */ |
365 | - $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | - $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | - $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | - $params = |
|
369 | - 'meetingID='.urlencode($this->_meetingId). |
|
370 | - '&password='.urlencode($this->_password); |
|
371 | - return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | - } |
|
373 | - |
|
374 | - public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | - /* USAGE: |
|
365 | + $this->_meetingId = $this->_requiredParam($infoParams['meetingId']); |
|
366 | + $this->_password = $this->_requiredParam($infoParams['password']); |
|
367 | + $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?"; |
|
368 | + $params = |
|
369 | + 'meetingID='.urlencode($this->_meetingId). |
|
370 | + '&password='.urlencode($this->_password); |
|
371 | + return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt)); |
|
372 | + } |
|
373 | + |
|
374 | + public function getMeetingInfoWithXmlResponseArray($infoParams) { |
|
375 | + /* USAGE: |
|
376 | 376 | $infoParams = array( |
377 | 377 | 'meetingId' => '1234', -- REQUIRED - The unique id for the meeting |
378 | 378 | 'password' => 'mp' -- REQUIRED - The moderator password for the meeting |
379 | 379 | ); |
380 | 380 | */ |
381 | - $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | - if($xml) { |
|
383 | - // If we don't get a success code or messageKey, find out why: |
|
384 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | - $result = array( |
|
386 | - 'returncode' => $xml->returncode->__toString(), |
|
387 | - 'messageKey' => $xml->messageKey->__toString(), |
|
388 | - 'message' => $xml->message->__toString() |
|
389 | - ); |
|
390 | - return $result; |
|
391 | - } |
|
392 | - else { |
|
393 | - // In this case, we have success and meeting info: |
|
394 | - $result = array( |
|
395 | - 'returncode' => $xml->returncode->__toString(), |
|
396 | - 'meetingName' => $xml->meetingName->__toString(), |
|
397 | - 'meetingId' => $xml->meetingID->__toString(), |
|
398 | - 'createTime' => $xml->createTime->__toString(), |
|
399 | - 'voiceBridge' => $xml->voiceBridge->__toString(), |
|
400 | - 'attendeePw' => $xml->attendeePW->__toString(), |
|
401 | - 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
402 | - 'running' => $xml->running->__toString(), |
|
403 | - 'recording' => $xml->recording->__toString(), |
|
404 | - 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
405 | - 'startTime' => $xml->startTime->__toString(), |
|
406 | - 'endTime' => $xml->endTime->__toString(), |
|
407 | - 'participantCount' => $xml->participantCount->__toString(), |
|
408 | - 'maxUsers' => $xml->maxUsers->__toString(), |
|
409 | - 'moderatorCount' => $xml->moderatorCount->__toString(), |
|
410 | - ); |
|
411 | - // Then interate through attendee results and return them as part of the array: |
|
412 | - foreach ($xml->attendees->attendee as $a) { |
|
413 | - $result[] = array( |
|
414 | - 'userId' => $a->userID->__toString(), |
|
415 | - 'fullName' => $a->fullName->__toString(), |
|
416 | - 'role' => $a->role->__toString() |
|
417 | - ); |
|
418 | - } |
|
419 | - return $result; |
|
420 | - } |
|
421 | - } |
|
422 | - else { |
|
423 | - return null; |
|
424 | - } |
|
425 | - |
|
426 | - } |
|
427 | - |
|
428 | - /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | - /* The methods in the following section support the following categories of the BBB API: |
|
381 | + $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams)); |
|
382 | + if($xml) { |
|
383 | + // If we don't get a success code or messageKey, find out why: |
|
384 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
385 | + $result = array( |
|
386 | + 'returncode' => $xml->returncode->__toString(), |
|
387 | + 'messageKey' => $xml->messageKey->__toString(), |
|
388 | + 'message' => $xml->message->__toString() |
|
389 | + ); |
|
390 | + return $result; |
|
391 | + } |
|
392 | + else { |
|
393 | + // In this case, we have success and meeting info: |
|
394 | + $result = array( |
|
395 | + 'returncode' => $xml->returncode->__toString(), |
|
396 | + 'meetingName' => $xml->meetingName->__toString(), |
|
397 | + 'meetingId' => $xml->meetingID->__toString(), |
|
398 | + 'createTime' => $xml->createTime->__toString(), |
|
399 | + 'voiceBridge' => $xml->voiceBridge->__toString(), |
|
400 | + 'attendeePw' => $xml->attendeePW->__toString(), |
|
401 | + 'moderatorPw' => $xml->moderatorPW->__toString(), |
|
402 | + 'running' => $xml->running->__toString(), |
|
403 | + 'recording' => $xml->recording->__toString(), |
|
404 | + 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
|
405 | + 'startTime' => $xml->startTime->__toString(), |
|
406 | + 'endTime' => $xml->endTime->__toString(), |
|
407 | + 'participantCount' => $xml->participantCount->__toString(), |
|
408 | + 'maxUsers' => $xml->maxUsers->__toString(), |
|
409 | + 'moderatorCount' => $xml->moderatorCount->__toString(), |
|
410 | + ); |
|
411 | + // Then interate through attendee results and return them as part of the array: |
|
412 | + foreach ($xml->attendees->attendee as $a) { |
|
413 | + $result[] = array( |
|
414 | + 'userId' => $a->userID->__toString(), |
|
415 | + 'fullName' => $a->fullName->__toString(), |
|
416 | + 'role' => $a->role->__toString() |
|
417 | + ); |
|
418 | + } |
|
419 | + return $result; |
|
420 | + } |
|
421 | + } |
|
422 | + else { |
|
423 | + return null; |
|
424 | + } |
|
425 | + |
|
426 | + } |
|
427 | + |
|
428 | + /* __________________ BBB RECORDING METHODS _________________ */ |
|
429 | + /* The methods in the following section support the following categories of the BBB API: |
|
430 | 430 | -- getRecordings |
431 | 431 | -- publishRecordings |
432 | 432 | -- deleteRecordings |
433 | 433 | */ |
434 | 434 | |
435 | - public function getRecordingsUrl($recordingParams) { |
|
436 | - /* USAGE: |
|
435 | + public function getRecordingsUrl($recordingParams) { |
|
436 | + /* USAGE: |
|
437 | 437 | $recordingParams = array( |
438 | 438 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
439 | 439 | ); |
440 | 440 | */ |
441 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | - $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | - return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
441 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?"; |
|
442 | + $params = 'meetingID='.urlencode($recordingParams['meetingId']); |
|
443 | + return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt)); |
|
444 | 444 | |
445 | - } |
|
445 | + } |
|
446 | 446 | |
447 | - public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | - /* USAGE: |
|
447 | + public function getRecordingsWithXmlResponseArray($recordingParams) { |
|
448 | + /* USAGE: |
|
449 | 449 | $recordingParams = array( |
450 | 450 | 'meetingId' => '1234', -- OPTIONAL - comma separate if multiple ids |
451 | 451 | ); |
@@ -453,121 +453,121 @@ discard block |
||
453 | 453 | when creating a meeting, it will kick users out after the duration. Should |
454 | 454 | probably be required in user code when 'recording' is set to true. |
455 | 455 | */ |
456 | - $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | - if($xml) { |
|
458 | - // If we don't get a success code or messageKey, find out why: |
|
459 | - if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | - $result = array( |
|
461 | - 'returncode' => $xml->returncode->__toString(), |
|
462 | - 'messageKey' => $xml->messageKey->__toString(), |
|
463 | - 'message' => $xml->message->__toString() |
|
464 | - ); |
|
465 | - return $result; |
|
466 | - } |
|
467 | - else { |
|
468 | - // In this case, we have success and recording info: |
|
469 | - $result = array( |
|
470 | - 'returncode' => $xml->returncode->__toString(), |
|
471 | - 'messageKey' => $xml->messageKey->__toString(), |
|
472 | - 'message' => $xml->message->__toString() |
|
473 | - ); |
|
474 | - |
|
475 | - foreach ($xml->recordings->recording as $r) { |
|
476 | - $result[] = array( |
|
477 | - 'recordId' => $r->recordID->__toString(), |
|
478 | - 'meetingId' => $r->meetingID->__toString(), |
|
479 | - 'name' => $r->name->__toString(), |
|
480 | - 'published' => $r->published->__toString(), |
|
481 | - 'startTime' => $r->startTime->__toString(), |
|
482 | - 'endTime' => $r->endTime->__toString(), |
|
483 | - 'playbackFormatType' => $r->playback->format->type->__toString(), |
|
484 | - 'playbackFormatUrl' => $r->playback->format->url->__toString(), |
|
485 | - 'playbackFormatLength' => $r->playback->format->length->__toString(), |
|
486 | - 'metadataTitle' => $r->metadata->title->__toString(), |
|
487 | - 'metadataSubject' => $r->metadata->subject->__toString(), |
|
488 | - 'metadataDescription' => $r->metadata->description->__toString(), |
|
489 | - 'metadataCreator' => $r->metadata->creator->__toString(), |
|
490 | - 'metadataContributor' => $r->metadata->contributor->__toString(), |
|
491 | - 'metadataLanguage' => $r->metadata->language->__toString(), |
|
492 | - // Add more here as needed for your app depending on your |
|
493 | - // use of metadata when creating recordings. |
|
494 | - ); |
|
495 | - } |
|
496 | - return $result; |
|
497 | - } |
|
498 | - } |
|
499 | - else { |
|
500 | - return null; |
|
501 | - } |
|
502 | - } |
|
503 | - |
|
504 | - public function getPublishRecordingsUrl($recordingParams) { |
|
505 | - /* USAGE: |
|
456 | + $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams)); |
|
457 | + if($xml) { |
|
458 | + // If we don't get a success code or messageKey, find out why: |
|
459 | + if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) { |
|
460 | + $result = array( |
|
461 | + 'returncode' => $xml->returncode->__toString(), |
|
462 | + 'messageKey' => $xml->messageKey->__toString(), |
|
463 | + 'message' => $xml->message->__toString() |
|
464 | + ); |
|
465 | + return $result; |
|
466 | + } |
|
467 | + else { |
|
468 | + // In this case, we have success and recording info: |
|
469 | + $result = array( |
|
470 | + 'returncode' => $xml->returncode->__toString(), |
|
471 | + 'messageKey' => $xml->messageKey->__toString(), |
|
472 | + 'message' => $xml->message->__toString() |
|
473 | + ); |
|
474 | + |
|
475 | + foreach ($xml->recordings->recording as $r) { |
|
476 | + $result[] = array( |
|
477 | + 'recordId' => $r->recordID->__toString(), |
|
478 | + 'meetingId' => $r->meetingID->__toString(), |
|
479 | + 'name' => $r->name->__toString(), |
|
480 | + 'published' => $r->published->__toString(), |
|
481 | + 'startTime' => $r->startTime->__toString(), |
|
482 | + 'endTime' => $r->endTime->__toString(), |
|
483 | + 'playbackFormatType' => $r->playback->format->type->__toString(), |
|
484 | + 'playbackFormatUrl' => $r->playback->format->url->__toString(), |
|
485 | + 'playbackFormatLength' => $r->playback->format->length->__toString(), |
|
486 | + 'metadataTitle' => $r->metadata->title->__toString(), |
|
487 | + 'metadataSubject' => $r->metadata->subject->__toString(), |
|
488 | + 'metadataDescription' => $r->metadata->description->__toString(), |
|
489 | + 'metadataCreator' => $r->metadata->creator->__toString(), |
|
490 | + 'metadataContributor' => $r->metadata->contributor->__toString(), |
|
491 | + 'metadataLanguage' => $r->metadata->language->__toString(), |
|
492 | + // Add more here as needed for your app depending on your |
|
493 | + // use of metadata when creating recordings. |
|
494 | + ); |
|
495 | + } |
|
496 | + return $result; |
|
497 | + } |
|
498 | + } |
|
499 | + else { |
|
500 | + return null; |
|
501 | + } |
|
502 | + } |
|
503 | + |
|
504 | + public function getPublishRecordingsUrl($recordingParams) { |
|
505 | + /* USAGE: |
|
506 | 506 | $recordingParams = array( |
507 | 507 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
508 | 508 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
509 | 509 | ); |
510 | 510 | */ |
511 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | - $params = |
|
513 | - 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | - '&publish='.urlencode($recordingParams['publish']); |
|
515 | - return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
511 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?"; |
|
512 | + $params = |
|
513 | + 'recordID='.urlencode($recordingParams['recordId']). |
|
514 | + '&publish='.urlencode($recordingParams['publish']); |
|
515 | + return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt)); |
|
516 | 516 | |
517 | - } |
|
517 | + } |
|
518 | 518 | |
519 | - public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | - /* USAGE: |
|
519 | + public function publishRecordingsWithXmlResponseArray($recordingParams) { |
|
520 | + /* USAGE: |
|
521 | 521 | $recordingParams = array( |
522 | 522 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
523 | 523 | 'publish' => 'true', -- REQUIRED - boolean: true/false |
524 | 524 | ); |
525 | 525 | */ |
526 | - $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | - if($xml) { |
|
528 | - return array( |
|
529 | - 'returncode' => $xml->returncode->__toString(), |
|
530 | - 'published' => $xml->published->__toString() // -- Returns true/false. |
|
531 | - ); |
|
532 | - } |
|
533 | - else { |
|
534 | - return null; |
|
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - } |
|
539 | - |
|
540 | - public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | - /* USAGE: |
|
526 | + $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams)); |
|
527 | + if($xml) { |
|
528 | + return array( |
|
529 | + 'returncode' => $xml->returncode->__toString(), |
|
530 | + 'published' => $xml->published->__toString() // -- Returns true/false. |
|
531 | + ); |
|
532 | + } |
|
533 | + else { |
|
534 | + return null; |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + } |
|
539 | + |
|
540 | + public function getDeleteRecordingsUrl($recordingParams) { |
|
541 | + /* USAGE: |
|
542 | 542 | $recordingParams = array( |
543 | 543 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
544 | 544 | ); |
545 | 545 | */ |
546 | - $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | - $params = |
|
548 | - 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | - return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | - } |
|
551 | - |
|
552 | - public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | - /* USAGE: |
|
546 | + $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?"; |
|
547 | + $params = |
|
548 | + 'recordID='.urlencode($recordingParams['recordId']); |
|
549 | + return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt)); |
|
550 | + } |
|
551 | + |
|
552 | + public function deleteRecordingsWithXmlResponseArray($recordingParams) { |
|
553 | + /* USAGE: |
|
554 | 554 | $recordingParams = array( |
555 | 555 | 'recordId' => '1234', -- REQUIRED - comma separate if multiple ids |
556 | 556 | ); |
557 | 557 | */ |
558 | 558 | |
559 | - $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | - if($xml) { |
|
561 | - return array( |
|
562 | - 'returncode' => $xml->returncode->__toString(), |
|
563 | - 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
|
564 | - ); |
|
565 | - } |
|
566 | - else { |
|
567 | - return null; |
|
568 | - } |
|
569 | - |
|
570 | - } |
|
559 | + $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams)); |
|
560 | + if($xml) { |
|
561 | + return array( |
|
562 | + 'returncode' => $xml->returncode->__toString(), |
|
563 | + 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
|
564 | + ); |
|
565 | + } |
|
566 | + else { |
|
567 | + return null; |
|
568 | + } |
|
569 | + |
|
570 | + } |
|
571 | 571 | |
572 | 572 | |
573 | 573 |