@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | |
| 1870 | 1870 | /** |
| 1871 | 1871 | * Get the extra terms (tags) that identify this item |
| 1872 | - * @return mixed |
|
| 1872 | + * @return string |
|
| 1873 | 1873 | */ |
| 1874 | 1874 | public function get_terms() |
| 1875 | 1875 | { |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | |
| 2070 | 2070 | /** |
| 2071 | 2071 | * Opens/launches the item. Initialises runtime values. |
| 2072 | - * @return boolean True on success, false on failure. |
|
| 2072 | + * @return boolean|null True on success, false on failure. |
|
| 2073 | 2073 | */ |
| 2074 | 2074 | public function open($allow_new_attempt = false) |
| 2075 | 2075 | { |
@@ -3494,7 +3494,7 @@ discard block |
||
| 3494 | 3494 | |
| 3495 | 3495 | /** |
| 3496 | 3496 | * Checks if the current status is part of the list of status given |
| 3497 | - * @param array $list An array of status to check for. |
|
| 3497 | + * @param string[] $list An array of status to check for. |
|
| 3498 | 3498 | * If the current status is one of the strings, return true |
| 3499 | 3499 | * |
| 3500 | 3500 | * @return boolean True if the status was one of the given strings, |
@@ -3671,7 +3671,7 @@ discard block |
||
| 3671 | 3671 | /** |
| 3672 | 3672 | * Write objectives to DB. This method is separate from write_to_db() because otherwise |
| 3673 | 3673 | * objectives are lost as a side effect to AJAX and session concurrent access |
| 3674 | - * @return boolean True or false on error |
|
| 3674 | + * @return boolean|null True or false on error |
|
| 3675 | 3675 | */ |
| 3676 | 3676 | public function write_objectives_to_db() |
| 3677 | 3677 | { |
@@ -4312,7 +4312,7 @@ discard block |
||
| 4312 | 4312 | * Removes the relation between the current item and an audio file. The file |
| 4313 | 4313 | * is only removed from the lp_item table, but remains in the document table |
| 4314 | 4314 | * and directory |
| 4315 | - * @return bool |
|
| 4315 | + * @return false|null |
|
| 4316 | 4316 | */ |
| 4317 | 4317 | public function remove_audio() |
| 4318 | 4318 | { |
@@ -4333,7 +4333,7 @@ discard block |
||
| 4333 | 4333 | * @param $status |
| 4334 | 4334 | * @param bool $decorate |
| 4335 | 4335 | * @param string $type classic|simple |
| 4336 | - * @return array|string |
|
| 4336 | + * @return string |
|
| 4337 | 4337 | */ |
| 4338 | 4338 | static function humanize_status($status, $decorate = true, $type = 'classic') |
| 4339 | 4339 | { |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | $res = Database::query($sql); |
| 200 | 200 | if (Database::num_rows($res) > 0) { |
| 201 | 201 | $se_ref = Database::fetch_array($res); |
| 202 | - $this->search_did = (int)$se_ref['search_did']; |
|
| 202 | + $this->search_did = (int) $se_ref['search_did']; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | $this->audio = $row['audio']; |
| 206 | 206 | if (self::debug > 0) { |
| 207 | 207 | error_log( |
| 208 | - 'New LP - End of learnpathItem constructor for item ' . $id, |
|
| 208 | + 'New LP - End of learnpathItem constructor for item '.$id, |
|
| 209 | 209 | 0 |
| 210 | 210 | ); |
| 211 | 211 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | public function delete() |
| 315 | 315 | { |
| 316 | 316 | if (self::debug > 0) { |
| 317 | - error_log('learnpath_item::delete() for item ' . $this->db_id, 0); |
|
| 317 | + error_log('learnpath_item::delete() for item '.$this->db_id, 0); |
|
| 318 | 318 | } |
| 319 | 319 | $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
| 320 | 320 | $lp_item = Database::get_course_table(TABLE_LP_ITEM); |
@@ -322,29 +322,29 @@ discard block |
||
| 322 | 322 | $course_id = api_get_course_int_id(); |
| 323 | 323 | |
| 324 | 324 | $sql = "DELETE FROM $lp_item_view |
| 325 | - WHERE c_id = $course_id AND lp_item_id = " . $this->db_id; |
|
| 325 | + WHERE c_id = $course_id AND lp_item_id = ".$this->db_id; |
|
| 326 | 326 | if (self::debug > 0) { |
| 327 | - error_log('Deleting from lp_item_view: ' . $sql, 0); |
|
| 327 | + error_log('Deleting from lp_item_view: '.$sql, 0); |
|
| 328 | 328 | } |
| 329 | 329 | Database::query($sql); |
| 330 | 330 | |
| 331 | 331 | $sql = "SELECT * FROM $lp_item |
| 332 | - WHERE c_id = $course_id AND id = " . $this->db_id; |
|
| 332 | + WHERE c_id = $course_id AND id = ".$this->db_id; |
|
| 333 | 333 | $res_sel = Database::query($sql); |
| 334 | 334 | if (Database::num_rows($res_sel) < 1) { |
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | $sql = "DELETE FROM $lp_item |
| 339 | - WHERE c_id = $course_id AND id = " . $this->db_id; |
|
| 339 | + WHERE c_id = $course_id AND id = ".$this->db_id; |
|
| 340 | 340 | Database::query($sql); |
| 341 | 341 | if (self::debug > 0) { |
| 342 | - error_log('Deleting from lp_item: ' . $sql); |
|
| 342 | + error_log('Deleting from lp_item: '.$sql); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | if (api_get_setting('search_enabled') == 'true') { |
| 346 | 346 | if (!is_null($this->search_did)) { |
| 347 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 347 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 348 | 348 | $di = new ChamiloIndexer(); |
| 349 | 349 | $di->remove_document($this->search_did); |
| 350 | 350 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | { |
| 381 | 381 | if (self::debug > 0) { |
| 382 | 382 | error_log( |
| 383 | - 'learnpathItem::get_attempt_id() on item ' . $this->db_id, |
|
| 383 | + 'learnpathItem::get_attempt_id() on item '.$this->db_id, |
|
| 384 | 384 | 0 |
| 385 | 385 | ); |
| 386 | 386 | } |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | if (self::debug > 0) { |
| 392 | 392 | error_log( |
| 393 | - 'New LP - End of learnpathItem::get_attempt_id() on item ' . |
|
| 394 | - $this->db_id . ' - Returning ' . $res, |
|
| 393 | + 'New LP - End of learnpathItem::get_attempt_id() on item '. |
|
| 394 | + $this->db_id.' - Returning '.$res, |
|
| 395 | 395 | 0 |
| 396 | 396 | ); |
| 397 | 397 | } |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | if (self::debug > 2) { |
| 454 | 454 | error_log( |
| 455 | 455 | 'learnpathItem::get_credit() - get_prevent_reinit!=0 and '. |
| 456 | - 'status is ' . $status, |
|
| 456 | + 'status is '.$status, |
|
| 457 | 457 | 0 |
| 458 | 458 | ); |
| 459 | 459 | } |
| 460 | 460 | //0=not attempted - 1 = incomplete |
| 461 | - if ($status != $this->possible_status[0]&& |
|
| 461 | + if ($status != $this->possible_status[0] && |
|
| 462 | 462 | $status != $this->possible_status[1] |
| 463 | 463 | ) { |
| 464 | 464 | $credit = 'no-credit'; |
@@ -532,13 +532,13 @@ discard block |
||
| 532 | 532 | case TOOL_DOCUMENT: |
| 533 | 533 | $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
| 534 | 534 | $sql = 'SELECT path |
| 535 | - FROM ' . $table_doc . ' |
|
| 535 | + FROM ' . $table_doc.' |
|
| 536 | 536 | WHERE |
| 537 | - c_id = ' . $course_id . ' AND |
|
| 537 | + c_id = ' . $course_id.' AND |
|
| 538 | 538 | id = ' . $path; |
| 539 | 539 | $res = Database::query($sql); |
| 540 | 540 | $row = Database::fetch_array($res); |
| 541 | - $real_path = 'document' . $row['path']; |
|
| 541 | + $real_path = 'document'.$row['path']; |
|
| 542 | 542 | return $real_path; |
| 543 | 543 | case TOOL_STUDENTPUBLICATION: |
| 544 | 544 | case TOOL_QUIZ: |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | } |
| 551 | 551 | } else { |
| 552 | 552 | if (!empty($path_to_scorm_dir)) { |
| 553 | - $path = $path_to_scorm_dir . $path; |
|
| 553 | + $path = $path_to_scorm_dir.$path; |
|
| 554 | 554 | } |
| 555 | 555 | return $path; |
| 556 | 556 | } |
@@ -586,8 +586,8 @@ discard block |
||
| 586 | 586 | $sql = "SELECT id FROM $tbl |
| 587 | 587 | WHERE |
| 588 | 588 | c_id = $course_id AND |
| 589 | - lp_item_id = " . $this->db_id . " AND |
|
| 590 | - lp_view_id = " . $this->view_id . " AND |
|
| 589 | + lp_item_id = ".$this->db_id." AND |
|
| 590 | + lp_view_id = " . $this->view_id." AND |
|
| 591 | 591 | view_count = " . $this->attempt_id; |
| 592 | 592 | $res = Database::query($sql); |
| 593 | 593 | if (Database::num_rows($res) > 0) { |
@@ -630,8 +630,8 @@ discard block |
||
| 630 | 630 | $sql = "SELECT id FROM $tbl |
| 631 | 631 | WHERE |
| 632 | 632 | c_id = $course_id AND |
| 633 | - lp_item_id = " . $this->db_id . " AND |
|
| 634 | - lp_view_id = " . $this->view_id ." AND |
|
| 633 | + lp_item_id = ".$this->db_id." AND |
|
| 634 | + lp_view_id = " . $this->view_id." AND |
|
| 635 | 635 | view_count = " . $this->get_attempt_id(); |
| 636 | 636 | $res = Database::query($sql); |
| 637 | 637 | if (Database::num_rows($res) > 0) { |
@@ -671,13 +671,13 @@ discard block |
||
| 671 | 671 | foreach ($this->interactions as $id => $in) { |
| 672 | 672 | $return .= "[ |
| 673 | 673 | '$id', |
| 674 | - '" . $in[1] . "', |
|
| 675 | - '" . $in[2] . "', |
|
| 676 | - '" . $in[3] . "', |
|
| 677 | - '" . $in[4] . "', |
|
| 678 | - '" . $in[5] . "', |
|
| 679 | - '" . $in[6] . "', |
|
| 680 | - '" . $in[7] . "'],"; |
|
| 674 | + '".$in[1]."', |
|
| 675 | + '" . $in[2]."', |
|
| 676 | + '" . $in[3]."', |
|
| 677 | + '" . $in[4]."', |
|
| 678 | + '" . $in[5]."', |
|
| 679 | + '" . $in[6]."', |
|
| 680 | + '" . $in[7]."'],"; |
|
| 681 | 681 | } |
| 682 | 682 | if (!empty($return)) { |
| 683 | 683 | $return = substr($return, 0, -1); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | $table = Database::get_course_table(TABLE_LP_MAIN); |
| 920 | 920 | $sql = "SELECT prevent_reinit |
| 921 | 921 | FROM $table |
| 922 | - WHERE c_id = $course_id AND id = " . $this->lp_id; |
|
| 922 | + WHERE c_id = $course_id AND id = ".$this->lp_id; |
|
| 923 | 923 | $res = Database::query($sql); |
| 924 | 924 | if (Database::num_rows($res) < 1) { |
| 925 | 925 | $this->error = "Could not find parent learnpath in lp table"; |
@@ -941,7 +941,7 @@ discard block |
||
| 941 | 941 | } |
| 942 | 942 | if (self::debug > 2) { |
| 943 | 943 | error_log( |
| 944 | - 'New LP - End of learnpathItem::get_prevent_reinit() - Returned ' . $this->prevent_reinit, |
|
| 944 | + 'New LP - End of learnpathItem::get_prevent_reinit() - Returned '.$this->prevent_reinit, |
|
| 945 | 945 | 0 |
| 946 | 946 | ); |
| 947 | 947 | } |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | $table = Database::get_course_table(TABLE_LP_MAIN); |
| 967 | 967 | $sql = "SELECT seriousgame_mode |
| 968 | 968 | FROM $table |
| 969 | - WHERE c_id = $course_id AND id = " . $this->lp_id; |
|
| 969 | + WHERE c_id = $course_id AND id = ".$this->lp_id; |
|
| 970 | 970 | $res = Database::query($sql); |
| 971 | 971 | if (Database::num_rows($res) < 1) { |
| 972 | 972 | $this->error = "Could not find parent learnpath in learnpath table"; |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | } |
| 988 | 988 | if (self::debug > 2) { |
| 989 | 989 | error_log( |
| 990 | - 'New LP - End of learnpathItem::get_seriousgame_mode() - Returned ' . $this->seriousgame_mode, |
|
| 990 | + 'New LP - End of learnpathItem::get_seriousgame_mode() - Returned '.$this->seriousgame_mode, |
|
| 991 | 991 | 0 |
| 992 | 992 | ); |
| 993 | 993 | } |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | } |
| 1033 | 1033 | if (!isset($abs_path)) { |
| 1034 | 1034 | $path = $this->get_file_path(); |
| 1035 | - $abs_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . $path; |
|
| 1035 | + $abs_path = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$path; |
|
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | $files_list = array(); |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | $abs_path |
| 1308 | 1308 | ); |
| 1309 | 1309 | $new_abs_path = realpath( |
| 1310 | - $dir . '/' . $second_part |
|
| 1310 | + $dir.'/'.$second_part |
|
| 1311 | 1311 | ); |
| 1312 | 1312 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1313 | 1313 | TOOL_DOCUMENT, |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | $abs_path |
| 1346 | 1346 | ); |
| 1347 | 1347 | $new_abs_path = realpath( |
| 1348 | - $dir . '/' . $second_part |
|
| 1348 | + $dir.'/'.$second_part |
|
| 1349 | 1349 | ); |
| 1350 | 1350 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1351 | 1351 | TOOL_DOCUMENT, |
@@ -1452,7 +1452,7 @@ discard block |
||
| 1452 | 1452 | $abs_path |
| 1453 | 1453 | ); |
| 1454 | 1454 | $new_abs_path = realpath( |
| 1455 | - $dir . '/' . $source |
|
| 1455 | + $dir.'/'.$source |
|
| 1456 | 1456 | ); |
| 1457 | 1457 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1458 | 1458 | TOOL_DOCUMENT, |
@@ -1490,7 +1490,7 @@ discard block |
||
| 1490 | 1490 | $abs_path |
| 1491 | 1491 | ); |
| 1492 | 1492 | $new_abs_path = realpath( |
| 1493 | - $dir . '/' . $source |
|
| 1493 | + $dir.'/'.$source |
|
| 1494 | 1494 | ); |
| 1495 | 1495 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1496 | 1496 | TOOL_DOCUMENT, |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | ); |
| 1575 | 1575 | $dir = dirname($abs_path); |
| 1576 | 1576 | $new_abs_path = realpath( |
| 1577 | - $dir . '/' . $source |
|
| 1577 | + $dir.'/'.$source |
|
| 1578 | 1578 | ); |
| 1579 | 1579 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1580 | 1580 | TOOL_DOCUMENT, |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | ); |
| 1620 | 1620 | $dir = dirname($abs_path); |
| 1621 | 1621 | $new_abs_path = realpath( |
| 1622 | - $dir . '/' . $source |
|
| 1622 | + $dir.'/'.$source |
|
| 1623 | 1623 | ); |
| 1624 | 1624 | $in_files_list[] = learnpathItem::get_resources_from_source( |
| 1625 | 1625 | TOOL_DOCUMENT, |
@@ -1679,7 +1679,7 @@ discard block |
||
| 1679 | 1679 | } |
| 1680 | 1680 | if (self::debug > 1) { |
| 1681 | 1681 | error_log( |
| 1682 | - 'New LP - Out of learnpathItem::get_score() - returning ' . $res, |
|
| 1682 | + 'New LP - Out of learnpathItem::get_score() - returning '.$res, |
|
| 1683 | 1683 | 0 |
| 1684 | 1684 | ); |
| 1685 | 1685 | } |
@@ -1699,7 +1699,7 @@ discard block |
||
| 1699 | 1699 | $course_id = api_get_course_int_id(); |
| 1700 | 1700 | $debug = self::debug; |
| 1701 | 1701 | if ($debug > 0) { |
| 1702 | - error_log('learnpathItem::get_status() on item ' . $this->db_id, 0); |
|
| 1702 | + error_log('learnpathItem::get_status() on item '.$this->db_id, 0); |
|
| 1703 | 1703 | } |
| 1704 | 1704 | if ($check_db) { |
| 1705 | 1705 | if ($debug > 2) { |
@@ -1710,12 +1710,12 @@ discard block |
||
| 1710 | 1710 | $sql = "SELECT status FROM $table |
| 1711 | 1711 | WHERE |
| 1712 | 1712 | c_id = $course_id AND |
| 1713 | - id = '" . $this->db_item_view_id . "' AND |
|
| 1714 | - view_count = '" . $this->get_attempt_id() . "'"; |
|
| 1713 | + id = '".$this->db_item_view_id."' AND |
|
| 1714 | + view_count = '" . $this->get_attempt_id()."'"; |
|
| 1715 | 1715 | |
| 1716 | 1716 | if ($debug > 2) { |
| 1717 | 1717 | error_log( |
| 1718 | - 'learnpathItem::get_status() - Checking DB: ' . $sql, |
|
| 1718 | + 'learnpathItem::get_status() - Checking DB: '.$sql, |
|
| 1719 | 1719 | 0 |
| 1720 | 1720 | ); |
| 1721 | 1721 | } |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | if ($update_local) { |
| 1727 | 1727 | if ($debug > 2) { |
| 1728 | 1728 | error_log( |
| 1729 | - 'learnpathItem::set_status() :' . $row['status'], |
|
| 1729 | + 'learnpathItem::set_status() :'.$row['status'], |
|
| 1730 | 1730 | 0 |
| 1731 | 1731 | ); |
| 1732 | 1732 | } |
@@ -1734,7 +1734,7 @@ discard block |
||
| 1734 | 1734 | } |
| 1735 | 1735 | if ($debug > 2) { |
| 1736 | 1736 | error_log( |
| 1737 | - 'learnpathItem::get_status() - Returning db value ' . $row['status'], |
|
| 1737 | + 'learnpathItem::get_status() - Returning db value '.$row['status'], |
|
| 1738 | 1738 | 0 |
| 1739 | 1739 | ); |
| 1740 | 1740 | } |
@@ -1751,7 +1751,7 @@ discard block |
||
| 1751 | 1751 | if (!empty($this->status)) { |
| 1752 | 1752 | if ($debug > 2) { |
| 1753 | 1753 | error_log( |
| 1754 | - 'learnpathItem::get_status() - Returning attrib: ' . $this->status, |
|
| 1754 | + 'learnpathItem::get_status() - Returning attrib: '.$this->status, |
|
| 1755 | 1755 | 0 |
| 1756 | 1756 | ); |
| 1757 | 1757 | } |
@@ -1761,7 +1761,7 @@ discard block |
||
| 1761 | 1761 | |
| 1762 | 1762 | if ($debug > 2) { |
| 1763 | 1763 | error_log( |
| 1764 | - 'learnpathItem::get_status() - Returning default ' . $this->possible_status[0], |
|
| 1764 | + 'learnpathItem::get_status() - Returning default '.$this->possible_status[0], |
|
| 1765 | 1765 | 0 |
| 1766 | 1766 | ); |
| 1767 | 1767 | } |
@@ -1801,7 +1801,7 @@ discard block |
||
| 1801 | 1801 | if ($origin == 'js') { |
| 1802 | 1802 | return '00 : 00: 00'; |
| 1803 | 1803 | } else { |
| 1804 | - return '00 ' . $h . ' 00 \' 00"'; |
|
| 1804 | + return '00 '.$h.' 00 \' 00"'; |
|
| 1805 | 1805 | } |
| 1806 | 1806 | } else { |
| 1807 | 1807 | return api_format_time($time, $origin); |
@@ -1826,7 +1826,7 @@ discard block |
||
| 1826 | 1826 | if (!isset($given_time)) { |
| 1827 | 1827 | if (self::debug > 2) { |
| 1828 | 1828 | error_log( |
| 1829 | - 'learnpathItem::get_scorm_time(): given time empty, current_start_time = ' . $this->current_start_time, |
|
| 1829 | + 'learnpathItem::get_scorm_time(): given time empty, current_start_time = '.$this->current_start_time, |
|
| 1830 | 1830 | 0 |
| 1831 | 1831 | ); |
| 1832 | 1832 | } |
@@ -1836,8 +1836,8 @@ discard block |
||
| 1836 | 1836 | FROM $table |
| 1837 | 1837 | WHERE |
| 1838 | 1838 | c_id = $course_id AND |
| 1839 | - id = '" . $this->db_item_view_id . "' AND |
|
| 1840 | - view_count = '" . $this->get_attempt_id() . "'"; |
|
| 1839 | + id = '".$this->db_item_view_id."' AND |
|
| 1840 | + view_count = '" . $this->get_attempt_id()."'"; |
|
| 1841 | 1841 | $res = Database::query($sql); |
| 1842 | 1842 | $row = Database::fetch_array($res); |
| 1843 | 1843 | $start = $row['start_time']; |
@@ -1858,7 +1858,7 @@ discard block |
||
| 1858 | 1858 | } |
| 1859 | 1859 | if (self::debug > 2) { |
| 1860 | 1860 | error_log( |
| 1861 | - 'learnpathItem::get_scorm_time(): intermediate = ' . $time, |
|
| 1861 | + 'learnpathItem::get_scorm_time(): intermediate = '.$time, |
|
| 1862 | 1862 | 0 |
| 1863 | 1863 | ); |
| 1864 | 1864 | } |
@@ -1878,7 +1878,7 @@ discard block |
||
| 1878 | 1878 | $sql = "SELECT * FROM $lp_item |
| 1879 | 1879 | WHERE |
| 1880 | 1880 | c_id = $course_id AND |
| 1881 | - id='" . intval($this->db_id) . "'"; |
|
| 1881 | + id='".intval($this->db_id)."'"; |
|
| 1882 | 1882 | $res = Database::query($sql); |
| 1883 | 1883 | $row = Database::fetch_array($res); |
| 1884 | 1884 | return $row['terms']; |
@@ -1907,9 +1907,9 @@ discard block |
||
| 1907 | 1907 | { |
| 1908 | 1908 | if (self::debug > 0) { |
| 1909 | 1909 | error_log( |
| 1910 | - 'learnpathItem::get_total_time() for item ' . $this->db_id . |
|
| 1911 | - ' - Initially, current_start_time = ' . $this->current_start_time . |
|
| 1912 | - ' and current_stop_time = ' . $this->current_stop_time, |
|
| 1910 | + 'learnpathItem::get_total_time() for item '.$this->db_id. |
|
| 1911 | + ' - Initially, current_start_time = '.$this->current_start_time. |
|
| 1912 | + ' and current_stop_time = '.$this->current_stop_time, |
|
| 1913 | 1913 | 0 |
| 1914 | 1914 | ); |
| 1915 | 1915 | } |
@@ -1950,9 +1950,9 @@ discard block |
||
| 1950 | 1950 | } else { |
| 1951 | 1951 | if (self::debug > 2) { |
| 1952 | 1952 | error_log( |
| 1953 | - 'learnpathItem::get_total_time() - Current start time = ' . |
|
| 1954 | - $this->current_start_time . ', current stop time = ' . |
|
| 1955 | - $this->current_stop_time . ' Returning ' . $time . "-----------\n", |
|
| 1953 | + 'learnpathItem::get_total_time() - Current start time = '. |
|
| 1954 | + $this->current_start_time.', current stop time = '. |
|
| 1955 | + $this->current_stop_time.' Returning '.$time."-----------\n", |
|
| 1956 | 1956 | 0 |
| 1957 | 1957 | ); |
| 1958 | 1958 | } |
@@ -1972,7 +1972,7 @@ discard block |
||
| 1972 | 1972 | } |
| 1973 | 1973 | if (self::debug > 2) { |
| 1974 | 1974 | error_log( |
| 1975 | - 'learnpathItem::get_type() - Returning ' . $res . ' for item ' . $this->db_id, |
|
| 1975 | + 'learnpathItem::get_type() - Returning '.$res.' for item '.$this->db_id, |
|
| 1976 | 1976 | 0 |
| 1977 | 1977 | ); |
| 1978 | 1978 | } |
@@ -2012,8 +2012,8 @@ discard block |
||
| 2012 | 2012 | if ($this->status_is($completedStatusList)) { |
| 2013 | 2013 | if (self::debug > 2) { |
| 2014 | 2014 | error_log( |
| 2015 | - 'learnpath::is_done() - Item ' . $this->get_id( |
|
| 2016 | - ) . ' is complete', |
|
| 2015 | + 'learnpath::is_done() - Item '.$this->get_id( |
|
| 2016 | + ).' is complete', |
|
| 2017 | 2017 | 0 |
| 2018 | 2018 | ); |
| 2019 | 2019 | } |
@@ -2022,8 +2022,8 @@ discard block |
||
| 2022 | 2022 | } else { |
| 2023 | 2023 | if (self::debug > 2) { |
| 2024 | 2024 | error_log( |
| 2025 | - 'learnpath::is_done() - Item ' . $this->get_id( |
|
| 2026 | - ) . ' is not complete', |
|
| 2025 | + 'learnpath::is_done() - Item '.$this->get_id( |
|
| 2026 | + ).' is not complete', |
|
| 2027 | 2027 | 0 |
| 2028 | 2028 | ); |
| 2029 | 2029 | } |
@@ -2060,7 +2060,7 @@ discard block |
||
| 2060 | 2060 | } |
| 2061 | 2061 | if (self::debug > 2) { |
| 2062 | 2062 | error_log( |
| 2063 | - 'New LP - End of learnpathItem::is_restart_allowed() - Returning ' . $restart, |
|
| 2063 | + 'New LP - End of learnpathItem::is_restart_allowed() - Returning '.$restart, |
|
| 2064 | 2064 | 0 |
| 2065 | 2065 | ); |
| 2066 | 2066 | } |
@@ -2139,7 +2139,7 @@ discard block |
||
| 2139 | 2139 | { |
| 2140 | 2140 | if (self::debug > 0) { |
| 2141 | 2141 | error_log( |
| 2142 | - 'learnpathItem::parse_prereq() for learnpath ' . $this->lp_id . ' with string ' . $prereqs_string, |
|
| 2142 | + 'learnpathItem::parse_prereq() for learnpath '.$this->lp_id.' with string '.$prereqs_string, |
|
| 2143 | 2143 | 0 |
| 2144 | 2144 | ); |
| 2145 | 2145 | } |
@@ -2332,7 +2332,7 @@ discard block |
||
| 2332 | 2332 | // Strange... |
| 2333 | 2333 | if (self::debug > 1) { |
| 2334 | 2334 | error_log( |
| 2335 | - 'New LP - Found ~ but strange string: ' . $prereqs_string, |
|
| 2335 | + 'New LP - Found ~ but strange string: '.$prereqs_string, |
|
| 2336 | 2336 | 0 |
| 2337 | 2337 | ); |
| 2338 | 2338 | } |
@@ -2360,7 +2360,7 @@ discard block |
||
| 2360 | 2360 | // the big brackets-enclosed condition. |
| 2361 | 2361 | if (self::debug > 1) { |
| 2362 | 2362 | error_log( |
| 2363 | - 'New LP - Dealing with group ' . $gr, |
|
| 2363 | + 'New LP - Dealing with group '.$gr, |
|
| 2364 | 2364 | 0 |
| 2365 | 2365 | ); |
| 2366 | 2366 | } |
@@ -2374,7 +2374,7 @@ discard block |
||
| 2374 | 2374 | ) { |
| 2375 | 2375 | if (self::debug > 1) { |
| 2376 | 2376 | error_log( |
| 2377 | - 'New LP - Found multiplier ' . $multi[0], |
|
| 2377 | + 'New LP - Found multiplier '.$multi[0], |
|
| 2378 | 2378 | 0 |
| 2379 | 2379 | ); |
| 2380 | 2380 | } |
@@ -2390,7 +2390,7 @@ discard block |
||
| 2390 | 2390 | $mytrue++; |
| 2391 | 2391 | if (self::debug > 1) { |
| 2392 | 2392 | error_log( |
| 2393 | - 'New LP - Found true item, counting.. (' . ($mytrue) . ')', |
|
| 2393 | + 'New LP - Found true item, counting.. ('.($mytrue).')', |
|
| 2394 | 2394 | 0 |
| 2395 | 2395 | ); |
| 2396 | 2396 | } |
@@ -2398,7 +2398,7 @@ discard block |
||
| 2398 | 2398 | } else { |
| 2399 | 2399 | if (self::debug > 1) { |
| 2400 | 2400 | error_log( |
| 2401 | - 'New LP - item ' . $cond . ' does not exist in items list', |
|
| 2401 | + 'New LP - item '.$cond.' does not exist in items list', |
|
| 2402 | 2402 | 0 |
| 2403 | 2403 | ); |
| 2404 | 2404 | } |
@@ -2445,7 +2445,7 @@ discard block |
||
| 2445 | 2445 | } else { |
| 2446 | 2446 | if (self::debug > 1) { |
| 2447 | 2447 | error_log( |
| 2448 | - 'New LP - ' . |
|
| 2448 | + 'New LP - '. |
|
| 2449 | 2449 | ' Found false item, the set is not true, return false', |
| 2450 | 2450 | 0 |
| 2451 | 2451 | ); |
@@ -2456,7 +2456,7 @@ discard block |
||
| 2456 | 2456 | } else { |
| 2457 | 2457 | if (self::debug > 1) { |
| 2458 | 2458 | error_log( |
| 2459 | - 'New LP - item ' . $cond . ' does not exist in items list', |
|
| 2459 | + 'New LP - item '.$cond.' does not exist in items list', |
|
| 2460 | 2460 | 0 |
| 2461 | 2461 | ); |
| 2462 | 2462 | } |
@@ -2482,7 +2482,7 @@ discard block |
||
| 2482 | 2482 | // value of the corresponding resource completion status. |
| 2483 | 2483 | if (self::debug > 1) { |
| 2484 | 2484 | error_log( |
| 2485 | - 'New LP - Didnt find any group, returning value for ' . $prereqs_string, |
|
| 2485 | + 'New LP - Didnt find any group, returning value for '.$prereqs_string, |
|
| 2486 | 2486 | 0 |
| 2487 | 2487 | ); |
| 2488 | 2488 | } |
@@ -2499,14 +2499,14 @@ discard block |
||
| 2499 | 2499 | if (!$returnstatus) { |
| 2500 | 2500 | if (self::debug > 1) { |
| 2501 | 2501 | error_log( |
| 2502 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
| 2502 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
| 2503 | 2503 | 0 |
| 2504 | 2504 | ); |
| 2505 | 2505 | } |
| 2506 | 2506 | } else { |
| 2507 | 2507 | if (self::debug > 1) { |
| 2508 | 2508 | error_log( |
| 2509 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
| 2509 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
| 2510 | 2510 | 0 |
| 2511 | 2511 | ); |
| 2512 | 2512 | } |
@@ -2518,12 +2518,12 @@ discard block |
||
| 2518 | 2518 | if ($returnstatus) { |
| 2519 | 2519 | //AND origin_lp_item_id = '.$user_id.' |
| 2520 | 2520 | $sql = 'SELECT exe_result, exe_weighting |
| 2521 | - FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . ' |
|
| 2521 | + FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' |
|
| 2522 | 2522 | WHERE |
| 2523 | - exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND |
|
| 2524 | - exe_user_id = ' . $user_id . ' AND |
|
| 2525 | - orig_lp_id = ' . $this->lp_id . ' AND |
|
| 2526 | - orig_lp_item_id = ' . $prereqs_string . ' AND |
|
| 2523 | + exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND |
|
| 2524 | + exe_user_id = ' . $user_id.' AND |
|
| 2525 | + orig_lp_id = ' . $this->lp_id.' AND |
|
| 2526 | + orig_lp_item_id = ' . $prereqs_string.' AND |
|
| 2527 | 2527 | status <> "incomplete" |
| 2528 | 2528 | ORDER BY exe_date DESC |
| 2529 | 2529 | LIMIT 0, 1'; |
@@ -2561,12 +2561,12 @@ discard block |
||
| 2561 | 2561 | |
| 2562 | 2562 | // Checking in the database. |
| 2563 | 2563 | $sql = 'SELECT exe_result, exe_weighting |
| 2564 | - FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES) . ' |
|
| 2564 | + FROM ' . Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' |
|
| 2565 | 2565 | WHERE |
| 2566 | - exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path . ' AND |
|
| 2567 | - exe_user_id = ' . $user_id . ' AND |
|
| 2568 | - orig_lp_id = ' . $this->lp_id . ' AND |
|
| 2569 | - orig_lp_item_id = ' . $prereqs_string . ' '; |
|
| 2566 | + exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND |
|
| 2567 | + exe_user_id = ' . $user_id.' AND |
|
| 2568 | + orig_lp_id = ' . $this->lp_id.' AND |
|
| 2569 | + orig_lp_item_id = ' . $prereqs_string.' '; |
|
| 2570 | 2570 | |
| 2571 | 2571 | $rs_quiz = Database::query($sql); |
| 2572 | 2572 | if (Database::num_rows($rs_quiz) > 0) { |
@@ -2612,14 +2612,14 @@ discard block |
||
| 2612 | 2612 | if (!$returnstatus) { |
| 2613 | 2613 | if (self::debug > 1) { |
| 2614 | 2614 | error_log( |
| 2615 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
| 2615 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
| 2616 | 2616 | 0 |
| 2617 | 2617 | ); |
| 2618 | 2618 | } |
| 2619 | 2619 | } else { |
| 2620 | 2620 | if (self::debug > 1) { |
| 2621 | 2621 | error_log( |
| 2622 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
| 2622 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
| 2623 | 2623 | 0 |
| 2624 | 2624 | ); |
| 2625 | 2625 | } |
@@ -2634,11 +2634,11 @@ discard block |
||
| 2634 | 2634 | TABLE_LP_VIEW |
| 2635 | 2635 | ); |
| 2636 | 2636 | |
| 2637 | - $sql = 'SELECT id FROM ' . $lp_view . ' |
|
| 2637 | + $sql = 'SELECT id FROM '.$lp_view.' |
|
| 2638 | 2638 | WHERE |
| 2639 | - c_id = ' . $course_id . ' AND |
|
| 2640 | - user_id = ' . $user_id . ' AND |
|
| 2641 | - lp_id = ' . $this->lp_id . ' AND |
|
| 2639 | + c_id = ' . $course_id.' AND |
|
| 2640 | + user_id = ' . $user_id.' AND |
|
| 2641 | + lp_id = ' . $this->lp_id.' AND |
|
| 2642 | 2642 | session_id = '.$sessionId.' |
| 2643 | 2643 | LIMIT 0, 1'; |
| 2644 | 2644 | $rs_lp = Database::query($sql); |
@@ -2647,11 +2647,11 @@ discard block |
||
| 2647 | 2647 | ); |
| 2648 | 2648 | $my_lp_id = $lp_id[0]; |
| 2649 | 2649 | |
| 2650 | - $sql = 'SELECT status FROM ' . $lp_item_view . ' |
|
| 2650 | + $sql = 'SELECT status FROM '.$lp_item_view.' |
|
| 2651 | 2651 | WHERE |
| 2652 | - c_id = ' . $course_id . ' AND |
|
| 2653 | - lp_view_id = ' . $my_lp_id . ' AND |
|
| 2654 | - lp_item_id = ' . $refs_list[$prereqs_string] . ' |
|
| 2652 | + c_id = ' . $course_id.' AND |
|
| 2653 | + lp_view_id = ' . $my_lp_id.' AND |
|
| 2654 | + lp_item_id = ' . $refs_list[$prereqs_string].' |
|
| 2655 | 2655 | LIMIT 0, 1'; |
| 2656 | 2656 | $rs_lp = Database::query($sql); |
| 2657 | 2657 | $status_array = Database :: fetch_row( |
@@ -2668,14 +2668,14 @@ discard block |
||
| 2668 | 2668 | if (!$returnstatus) { |
| 2669 | 2669 | if (self::debug > 1) { |
| 2670 | 2670 | error_log( |
| 2671 | - 'New LP - Prerequisite ' . $prereqs_string . ' not complete', |
|
| 2671 | + 'New LP - Prerequisite '.$prereqs_string.' not complete', |
|
| 2672 | 2672 | 0 |
| 2673 | 2673 | ); |
| 2674 | 2674 | } |
| 2675 | 2675 | } else { |
| 2676 | 2676 | if (self::debug > 1) { |
| 2677 | 2677 | error_log( |
| 2678 | - 'New LP - Prerequisite ' . $prereqs_string . ' complete', |
|
| 2678 | + 'New LP - Prerequisite '.$prereqs_string.' complete', |
|
| 2679 | 2679 | 0 |
| 2680 | 2680 | ); |
| 2681 | 2681 | } |
@@ -2686,7 +2686,7 @@ discard block |
||
| 2686 | 2686 | } else { |
| 2687 | 2687 | if (self::debug > 1) { |
| 2688 | 2688 | error_log( |
| 2689 | - 'New LP - Could not find ' . $prereqs_string . ' in ' . print_r( |
|
| 2689 | + 'New LP - Could not find '.$prereqs_string.' in '.print_r( |
|
| 2690 | 2690 | $refs_list, |
| 2691 | 2691 | true |
| 2692 | 2692 | ), |
@@ -2709,7 +2709,7 @@ discard block |
||
| 2709 | 2709 | foreach ($list as $condition) { |
| 2710 | 2710 | if (self::debug > 1) { |
| 2711 | 2711 | error_log( |
| 2712 | - 'New LP - Found OR, adding it (' . $condition . ')', |
|
| 2712 | + 'New LP - Found OR, adding it ('.$condition.')', |
|
| 2713 | 2713 | 0 |
| 2714 | 2714 | ); |
| 2715 | 2715 | } |
@@ -2762,7 +2762,7 @@ discard block |
||
| 2762 | 2762 | |
| 2763 | 2763 | if (self::debug > 1) { |
| 2764 | 2764 | error_log( |
| 2765 | - 'New LP - End of parse_prereq. Error code is now ' . $this->prereq_alert, |
|
| 2765 | + 'New LP - End of parse_prereq. Error code is now '.$this->prereq_alert, |
|
| 2766 | 2766 | 0 |
| 2767 | 2767 | ); |
| 2768 | 2768 | } |
@@ -2880,7 +2880,7 @@ discard block |
||
| 2880 | 2880 | $this->set_score($value); |
| 2881 | 2881 | if (self::debug > 2) { |
| 2882 | 2882 | error_log( |
| 2883 | - 'learnpathItem::save() - setting score to ' . $value, |
|
| 2883 | + 'learnpathItem::save() - setting score to '.$value, |
|
| 2884 | 2884 | 0 |
| 2885 | 2885 | ); |
| 2886 | 2886 | } |
@@ -2889,7 +2889,7 @@ discard block |
||
| 2889 | 2889 | $this->set_max_score($value); |
| 2890 | 2890 | if (self::debug > 2) { |
| 2891 | 2891 | error_log( |
| 2892 | - 'learnpathItem::save() - setting view_max_score to ' . $value, |
|
| 2892 | + 'learnpathItem::save() - setting view_max_score to '.$value, |
|
| 2893 | 2893 | 0 |
| 2894 | 2894 | ); |
| 2895 | 2895 | } |
@@ -2898,7 +2898,7 @@ discard block |
||
| 2898 | 2898 | $this->min_score = $value; |
| 2899 | 2899 | if (self::debug > 2) { |
| 2900 | 2900 | error_log( |
| 2901 | - 'learnpathItem::save() - setting min_score to ' . $value, |
|
| 2901 | + 'learnpathItem::save() - setting min_score to '.$value, |
|
| 2902 | 2902 | 0 |
| 2903 | 2903 | ); |
| 2904 | 2904 | } |
@@ -2908,7 +2908,7 @@ discard block |
||
| 2908 | 2908 | $this->set_status($value); |
| 2909 | 2909 | if (self::debug > 2) { |
| 2910 | 2910 | error_log( |
| 2911 | - 'learnpathItem::save() - setting status to ' . $value, |
|
| 2911 | + 'learnpathItem::save() - setting status to '.$value, |
|
| 2912 | 2912 | 0 |
| 2913 | 2913 | ); |
| 2914 | 2914 | } |
@@ -2918,7 +2918,7 @@ discard block |
||
| 2918 | 2918 | $this->set_time($value); |
| 2919 | 2919 | if (self::debug > 2) { |
| 2920 | 2920 | error_log( |
| 2921 | - 'learnpathItem::save() - setting time to ' . $value, |
|
| 2921 | + 'learnpathItem::save() - setting time to '.$value, |
|
| 2922 | 2922 | 0 |
| 2923 | 2923 | ); |
| 2924 | 2924 | } |
@@ -2927,7 +2927,7 @@ discard block |
||
| 2927 | 2927 | $this->current_data = $value; |
| 2928 | 2928 | if (self::debug > 2) { |
| 2929 | 2929 | error_log( |
| 2930 | - 'learnpathItem::save() - setting suspend_data to ' . $value, |
|
| 2930 | + 'learnpathItem::save() - setting suspend_data to '.$value, |
|
| 2931 | 2931 | 0 |
| 2932 | 2932 | ); |
| 2933 | 2933 | } |
@@ -2936,7 +2936,7 @@ discard block |
||
| 2936 | 2936 | $this->set_lesson_location($value); |
| 2937 | 2937 | if (self::debug > 2) { |
| 2938 | 2938 | error_log( |
| 2939 | - 'learnpathItem::save() - setting lesson_location to ' . $value, |
|
| 2939 | + 'learnpathItem::save() - setting lesson_location to '.$value, |
|
| 2940 | 2940 | 0 |
| 2941 | 2941 | ); |
| 2942 | 2942 | } |
@@ -2945,7 +2945,7 @@ discard block |
||
| 2945 | 2945 | $this->set_core_exit($value); |
| 2946 | 2946 | if (self::debug > 2) { |
| 2947 | 2947 | error_log( |
| 2948 | - 'learnpathItem::save() - setting core_exit to ' . $value, |
|
| 2948 | + 'learnpathItem::save() - setting core_exit to '.$value, |
|
| 2949 | 2949 | 0 |
| 2950 | 2950 | ); |
| 2951 | 2951 | } |
@@ -3092,7 +3092,7 @@ discard block |
||
| 3092 | 3092 | public function set_level($int = 0) |
| 3093 | 3093 | { |
| 3094 | 3094 | if (self::debug > 0) { |
| 3095 | - error_log('learnpathItem::set_level(' . $int . ')', 0); |
|
| 3095 | + error_log('learnpathItem::set_level('.$int.')', 0); |
|
| 3096 | 3096 | } |
| 3097 | 3097 | if (!empty($int) AND $int == strval(intval($int))) { |
| 3098 | 3098 | $this->level = $int; |
@@ -3121,7 +3121,7 @@ discard block |
||
| 3121 | 3121 | if (empty($lpItemId)) { |
| 3122 | 3122 | if (self::debug > 0) { |
| 3123 | 3123 | error_log( |
| 3124 | - 'learnpathItem::set_lp_view(' . $lp_view_id . ') $lpItemId is empty', |
|
| 3124 | + 'learnpathItem::set_lp_view('.$lp_view_id.') $lpItemId is empty', |
|
| 3125 | 3125 | 0 |
| 3126 | 3126 | ); |
| 3127 | 3127 | } |
@@ -3132,7 +3132,7 @@ discard block |
||
| 3132 | 3132 | if (empty($lp_view_id)) { |
| 3133 | 3133 | if (self::debug > 0) { |
| 3134 | 3134 | error_log( |
| 3135 | - 'learnpathItem::set_lp_view(' . $lp_view_id . ') $lp_view_id is empty', |
|
| 3135 | + 'learnpathItem::set_lp_view('.$lp_view_id.') $lp_view_id is empty', |
|
| 3136 | 3136 | 0 |
| 3137 | 3137 | ); |
| 3138 | 3138 | } |
@@ -3141,7 +3141,7 @@ discard block |
||
| 3141 | 3141 | } |
| 3142 | 3142 | |
| 3143 | 3143 | if (self::debug > 0) { |
| 3144 | - error_log('learnpathItem::set_lp_view(' . $lp_view_id . ')', 0); |
|
| 3144 | + error_log('learnpathItem::set_lp_view('.$lp_view_id.')', 0); |
|
| 3145 | 3145 | } |
| 3146 | 3146 | |
| 3147 | 3147 | $this->view_id = $lp_view_id; |
@@ -3151,13 +3151,13 @@ discard block |
||
| 3151 | 3151 | $sql = "SELECT * FROM $item_view_table |
| 3152 | 3152 | WHERE |
| 3153 | 3153 | c_id = $course_id AND |
| 3154 | - lp_item_id = " . $lpItemId . " AND |
|
| 3155 | - lp_view_id = " . $lp_view_id . " |
|
| 3154 | + lp_item_id = ".$lpItemId." AND |
|
| 3155 | + lp_view_id = " . $lp_view_id." |
|
| 3156 | 3156 | ORDER BY view_count DESC"; |
| 3157 | 3157 | |
| 3158 | 3158 | if (self::debug > 2) { |
| 3159 | 3159 | error_log( |
| 3160 | - 'learnpathItem::set_lp_view() - Querying lp_item_view: ' . $sql, |
|
| 3160 | + 'learnpathItem::set_lp_view() - Querying lp_item_view: '.$sql, |
|
| 3161 | 3161 | 0 |
| 3162 | 3162 | ); |
| 3163 | 3163 | } |
@@ -3189,7 +3189,7 @@ discard block |
||
| 3189 | 3189 | $sql = "SELECT * FROM $item_view_interaction_table |
| 3190 | 3190 | WHERE |
| 3191 | 3191 | c_id = $course_id AND |
| 3192 | - lp_iv_id = '" . $this->db_item_view_id . "'"; |
|
| 3192 | + lp_iv_id = '".$this->db_item_view_id."'"; |
|
| 3193 | 3193 | |
| 3194 | 3194 | $res = Database::query($sql); |
| 3195 | 3195 | if ($res !== false) { |
@@ -3204,7 +3204,7 @@ discard block |
||
| 3204 | 3204 | $sql = "SELECT * FROM $item_view_objective_table |
| 3205 | 3205 | WHERE |
| 3206 | 3206 | c_id = $course_id AND |
| 3207 | - lp_iv_id = '" . $this->db_item_view_id . "'"; |
|
| 3207 | + lp_iv_id = '".$this->db_item_view_id."'"; |
|
| 3208 | 3208 | |
| 3209 | 3209 | $res = Database::query($sql); |
| 3210 | 3210 | if ($res !== false) { |
@@ -3265,7 +3265,7 @@ discard block |
||
| 3265 | 3265 | { |
| 3266 | 3266 | $debug = self::debug; |
| 3267 | 3267 | if ($debug > 0) { |
| 3268 | - error_log('learnpathItem::set_score(' . $score . ')', 0); |
|
| 3268 | + error_log('learnpathItem::set_score('.$score.')', 0); |
|
| 3269 | 3269 | } |
| 3270 | 3270 | if (($this->max_score <= 0 || $score <= $this->max_score) && ($score >= $this->min_score)) { |
| 3271 | 3271 | $this->current_score = $score; |
@@ -3278,9 +3278,9 @@ discard block |
||
| 3278 | 3278 | } |
| 3279 | 3279 | |
| 3280 | 3280 | if ($debug > 0) { |
| 3281 | - error_log('get_mastery_score: ' . $masteryScore); |
|
| 3282 | - error_log('current_status: ' . $current_status); |
|
| 3283 | - error_log('current score : ' . $this->current_score); |
|
| 3281 | + error_log('get_mastery_score: '.$masteryScore); |
|
| 3282 | + error_log('current_status: '.$current_status); |
|
| 3283 | + error_log('current score : '.$this->current_score); |
|
| 3284 | 3284 | } |
| 3285 | 3285 | |
| 3286 | 3286 | // If mastery_score is set AND the current score reaches the mastery |
@@ -3308,15 +3308,15 @@ discard block |
||
| 3308 | 3308 | public function set_max_score($score) |
| 3309 | 3309 | { |
| 3310 | 3310 | if (self::debug > 0) { |
| 3311 | - error_log('learnpathItem::set_max_score(' . $score . ')', 0); |
|
| 3311 | + error_log('learnpathItem::set_max_score('.$score.')', 0); |
|
| 3312 | 3312 | } |
| 3313 | 3313 | if (is_int($score) || $score == '') { |
| 3314 | 3314 | $this->view_max_score = $score; |
| 3315 | 3315 | if (self::debug > 1) { |
| 3316 | 3316 | error_log( |
| 3317 | - 'learnpathItem::set_max_score() - ' . |
|
| 3318 | - 'Updated object score of item ' . $this->db_id . |
|
| 3319 | - ' to ' . $this->view_max_score, |
|
| 3317 | + 'learnpathItem::set_max_score() - '. |
|
| 3318 | + 'Updated object score of item '.$this->db_id. |
|
| 3319 | + ' to '.$this->view_max_score, |
|
| 3320 | 3320 | 0 |
| 3321 | 3321 | ); |
| 3322 | 3322 | } |
@@ -3334,12 +3334,12 @@ discard block |
||
| 3334 | 3334 | public function set_status($status) |
| 3335 | 3335 | { |
| 3336 | 3336 | if (self::debug > 0) { |
| 3337 | - error_log('learnpathItem::set_status(' . $status . ')', 0); |
|
| 3337 | + error_log('learnpathItem::set_status('.$status.')', 0); |
|
| 3338 | 3338 | } |
| 3339 | 3339 | |
| 3340 | 3340 | $found = false; |
| 3341 | 3341 | foreach ($this->possible_status as $possible) { |
| 3342 | - if (preg_match('/^' . $possible . '$/i', $status)) { |
|
| 3342 | + if (preg_match('/^'.$possible.'$/i', $status)) { |
|
| 3343 | 3343 | $found = true; |
| 3344 | 3344 | } |
| 3345 | 3345 | } |
@@ -3349,8 +3349,8 @@ discard block |
||
| 3349 | 3349 | if (self::debug > 1) { |
| 3350 | 3350 | error_log( |
| 3351 | 3351 | 'learnpathItem::set_status() - '. |
| 3352 | - 'Updated object status of item ' . $this->db_id . |
|
| 3353 | - ' to ' . $this->status, |
|
| 3352 | + 'Updated object status of item '.$this->db_id. |
|
| 3353 | + ' to '.$this->status, |
|
| 3354 | 3354 | 0 |
| 3355 | 3355 | ); |
| 3356 | 3356 | } |
@@ -3374,7 +3374,7 @@ discard block |
||
| 3374 | 3374 | $lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 3375 | 3375 | require_once api_get_path( |
| 3376 | 3376 | LIBRARY_PATH |
| 3377 | - ) . 'search/ChamiloIndexer.class.php'; |
|
| 3377 | + ).'search/ChamiloIndexer.class.php'; |
|
| 3378 | 3378 | $a_terms = preg_split('/,/', $terms); |
| 3379 | 3379 | $i_terms = preg_split('/,/', $this->get_terms()); |
| 3380 | 3380 | foreach ($i_terms as $term) { |
@@ -3391,7 +3391,7 @@ discard block |
||
| 3391 | 3391 | SET terms = '$terms' |
| 3392 | 3392 | WHERE |
| 3393 | 3393 | c_id = $course_id AND |
| 3394 | - id=" . $this->get_id(); |
|
| 3394 | + id=".$this->get_id(); |
|
| 3395 | 3395 | Database::query($sql); |
| 3396 | 3396 | // Save it to search engine. |
| 3397 | 3397 | if (api_get_setting('search_enabled') == 'true') { |
@@ -3419,7 +3419,7 @@ discard block |
||
| 3419 | 3419 | public function set_time($scorm_time, $format = 'scorm') |
| 3420 | 3420 | { |
| 3421 | 3421 | if (self::debug > 0) { |
| 3422 | - error_log('learnpathItem::set_time(' . $scorm_time . ')', 0); |
|
| 3422 | + error_log('learnpathItem::set_time('.$scorm_time.')', 0); |
|
| 3423 | 3423 | } |
| 3424 | 3424 | if ($scorm_time == '0' |
| 3425 | 3425 | and ($this->type != 'sco') |
@@ -3430,8 +3430,8 @@ discard block |
||
| 3430 | 3430 | $this->update_time($my_time); |
| 3431 | 3431 | if (self::debug > 0) { |
| 3432 | 3432 | error_log( |
| 3433 | - 'learnpathItem::set_time(' . $scorm_time . ') - ' . |
|
| 3434 | - 'found asset - set time to ' . $my_time, |
|
| 3433 | + 'learnpathItem::set_time('.$scorm_time.') - '. |
|
| 3434 | + 'found asset - set time to '.$my_time, |
|
| 3435 | 3435 | 0 |
| 3436 | 3436 | ); |
| 3437 | 3437 | } |
@@ -3504,10 +3504,10 @@ discard block |
||
| 3504 | 3504 | { |
| 3505 | 3505 | if (self::debug > 1) { |
| 3506 | 3506 | error_log( |
| 3507 | - 'learnpathItem::status_is(' . print_r( |
|
| 3507 | + 'learnpathItem::status_is('.print_r( |
|
| 3508 | 3508 | $list, |
| 3509 | 3509 | true |
| 3510 | - ) . ') on item ' . $this->db_id, |
|
| 3510 | + ).') on item '.$this->db_id, |
|
| 3511 | 3511 | 0 |
| 3512 | 3512 | ); |
| 3513 | 3513 | } |
@@ -3517,11 +3517,11 @@ discard block |
||
| 3517 | 3517 | } |
| 3518 | 3518 | $found = false; |
| 3519 | 3519 | foreach ($list as $status) { |
| 3520 | - if (preg_match('/^' . $status . '$/i', $currentStatus)) { |
|
| 3520 | + if (preg_match('/^'.$status.'$/i', $currentStatus)) { |
|
| 3521 | 3521 | if (self::debug > 2) { |
| 3522 | 3522 | error_log( |
| 3523 | - 'New LP - learnpathItem::status_is() - Found status ' . |
|
| 3524 | - $status . ' corresponding to current status', |
|
| 3523 | + 'New LP - learnpathItem::status_is() - Found status '. |
|
| 3524 | + $status.' corresponding to current status', |
|
| 3525 | 3525 | 0 |
| 3526 | 3526 | ); |
| 3527 | 3527 | } |
@@ -3532,8 +3532,8 @@ discard block |
||
| 3532 | 3532 | } |
| 3533 | 3533 | if (self::debug > 2) { |
| 3534 | 3534 | error_log( |
| 3535 | - 'New LP - learnpathItem::status_is() - Status ' . |
|
| 3536 | - $currentStatus . ' did not match request', |
|
| 3535 | + 'New LP - learnpathItem::status_is() - Status '. |
|
| 3536 | + $currentStatus.' did not match request', |
|
| 3537 | 3537 | 0 |
| 3538 | 3538 | ); |
| 3539 | 3539 | } |
@@ -3550,7 +3550,7 @@ discard block |
||
| 3550 | 3550 | public function update_time($total_sec = 0) |
| 3551 | 3551 | { |
| 3552 | 3552 | if (self::debug > 0) { |
| 3553 | - error_log('learnpathItem::update_time(' . $total_sec . ')', 0); |
|
| 3553 | + error_log('learnpathItem::update_time('.$total_sec.')', 0); |
|
| 3554 | 3554 | } |
| 3555 | 3555 | if ($total_sec >= 0) { |
| 3556 | 3556 | // Getting start time from finish time. The only problem in the calculation is it might be |
@@ -3602,11 +3602,11 @@ discard block |
||
| 3602 | 3602 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
| 3603 | 3603 | $course_id = api_get_course_int_id(); |
| 3604 | 3604 | |
| 3605 | - $get_view_sql = 'SELECT total_time, status FROM ' . $item_view_table . ' |
|
| 3606 | - WHERE c_id = ' . $course_id . ' |
|
| 3607 | - AND lp_item_id="' . $this->db_id . '" |
|
| 3608 | - AND lp_view_id="' . $this->view_id . '" |
|
| 3609 | - AND view_count="' . $this->attempt_id . '" ;'; |
|
| 3605 | + $get_view_sql = 'SELECT total_time, status FROM '.$item_view_table.' |
|
| 3606 | + WHERE c_id = ' . $course_id.' |
|
| 3607 | + AND lp_item_id="' . $this->db_id.'" |
|
| 3608 | + AND lp_view_id="' . $this->view_id.'" |
|
| 3609 | + AND view_count="' . $this->attempt_id.'" ;'; |
|
| 3610 | 3610 | $result = Database::query($get_view_sql); |
| 3611 | 3611 | $row = Database::fetch_array($result); |
| 3612 | 3612 | |
@@ -3659,12 +3659,12 @@ discard block |
||
| 3659 | 3659 | { |
| 3660 | 3660 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
| 3661 | 3661 | $course_id = api_get_course_int_id(); |
| 3662 | - $sql = 'UPDATE ' . $item_view_table . ' |
|
| 3663 | - SET total_time = 0, start_time=' . time() . ' |
|
| 3664 | - WHERE c_id = ' . $course_id . ' |
|
| 3665 | - AND lp_item_id="' . $this->db_id . '" |
|
| 3666 | - AND lp_view_id="' . $this->view_id . '" |
|
| 3667 | - AND view_count="' . $this->attempt_id . '" ;'; |
|
| 3662 | + $sql = 'UPDATE '.$item_view_table.' |
|
| 3663 | + SET total_time = 0, start_time=' . time().' |
|
| 3664 | + WHERE c_id = ' . $course_id.' |
|
| 3665 | + AND lp_item_id="' . $this->db_id.'" |
|
| 3666 | + AND lp_view_id="' . $this->view_id.'" |
|
| 3667 | + AND view_count="' . $this->attempt_id.'" ;'; |
|
| 3668 | 3668 | Database::query($sql); |
| 3669 | 3669 | } |
| 3670 | 3670 | |
@@ -3686,8 +3686,8 @@ discard block |
||
| 3686 | 3686 | FROM $tbl |
| 3687 | 3687 | WHERE |
| 3688 | 3688 | c_id = $course_id AND |
| 3689 | - lp_item_id = " . $this->db_id . " AND |
|
| 3690 | - lp_view_id = " . $this->view_id . " AND |
|
| 3689 | + lp_item_id = ".$this->db_id." AND |
|
| 3690 | + lp_view_id = " . $this->view_id." AND |
|
| 3691 | 3691 | view_count = " . $this->attempt_id; |
| 3692 | 3692 | $res = Database::query($sql); |
| 3693 | 3693 | if (Database::num_rows($res) > 0) { |
@@ -3695,8 +3695,8 @@ discard block |
||
| 3695 | 3695 | $lp_iv_id = $row[0]; |
| 3696 | 3696 | if (self::debug > 2) { |
| 3697 | 3697 | error_log( |
| 3698 | - 'learnpathItem::write_to_db() - Got item_view_id ' . |
|
| 3699 | - $lp_iv_id . ', now checking objectives ', |
|
| 3698 | + 'learnpathItem::write_to_db() - Got item_view_id '. |
|
| 3699 | + $lp_iv_id.', now checking objectives ', |
|
| 3700 | 3700 | 0 |
| 3701 | 3701 | ); |
| 3702 | 3702 | } |
@@ -3708,7 +3708,7 @@ discard block |
||
| 3708 | 3708 | WHERE |
| 3709 | 3709 | c_id = $course_id AND |
| 3710 | 3710 | lp_iv_id = $lp_iv_id AND |
| 3711 | - objective_id = '" . Database::escape_string($objective[0]) . "'"; |
|
| 3711 | + objective_id = '".Database::escape_string($objective[0])."'"; |
|
| 3712 | 3712 | $iva_res = Database::query($iva_sql); |
| 3713 | 3713 | // id(0), type(1), time(2), weighting(3), |
| 3714 | 3714 | // correct_responses(4), student_response(5), |
@@ -3717,22 +3717,22 @@ discard block |
||
| 3717 | 3717 | // Update (or don't). |
| 3718 | 3718 | $iva_row = Database::fetch_array($iva_res); |
| 3719 | 3719 | $iva_id = $iva_row[0]; |
| 3720 | - $ivau_sql = "UPDATE $iva_table " . |
|
| 3721 | - "SET objective_id = '" . Database::escape_string( |
|
| 3720 | + $ivau_sql = "UPDATE $iva_table ". |
|
| 3721 | + "SET objective_id = '".Database::escape_string( |
|
| 3722 | 3722 | $objective[0] |
| 3723 | - ) . "'," . |
|
| 3724 | - "status = '" . Database::escape_string( |
|
| 3723 | + )."',". |
|
| 3724 | + "status = '".Database::escape_string( |
|
| 3725 | 3725 | $objective[1] |
| 3726 | - ) . "'," . |
|
| 3727 | - "score_raw = '" . Database::escape_string( |
|
| 3726 | + )."',". |
|
| 3727 | + "score_raw = '".Database::escape_string( |
|
| 3728 | 3728 | $objective[2] |
| 3729 | - ) . "'," . |
|
| 3730 | - "score_min = '" . Database::escape_string( |
|
| 3729 | + )."',". |
|
| 3730 | + "score_min = '".Database::escape_string( |
|
| 3731 | 3731 | $objective[4] |
| 3732 | - ) . "'," . |
|
| 3733 | - "score_max = '" . Database::escape_string( |
|
| 3732 | + )."',". |
|
| 3733 | + "score_max = '".Database::escape_string( |
|
| 3734 | 3734 | $objective[3] |
| 3735 | - ) . "' " . |
|
| 3735 | + )."' ". |
|
| 3736 | 3736 | "WHERE c_id = $course_id AND id = $iva_id"; |
| 3737 | 3737 | Database::query($ivau_sql); |
| 3738 | 3738 | } else { |
@@ -3782,12 +3782,12 @@ discard block |
||
| 3782 | 3782 | $credit = $this->get_credit(); |
| 3783 | 3783 | |
| 3784 | 3784 | $item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); |
| 3785 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
| 3785 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
| 3786 | 3786 | WHERE |
| 3787 | - c_id = ' . $course_id . ' AND |
|
| 3788 | - lp_item_id="' . $this->db_id . '" AND |
|
| 3789 | - lp_view_id="' . $this->view_id . '" AND |
|
| 3790 | - view_count="' . $this->get_attempt_id() . '" '; |
|
| 3787 | + c_id = ' . $course_id.' AND |
|
| 3788 | + lp_item_id="' . $this->db_id.'" AND |
|
| 3789 | + lp_view_id="' . $this->view_id.'" AND |
|
| 3790 | + view_count="' . $this->get_attempt_id().'" '; |
|
| 3791 | 3791 | $rs_verified = Database::query($sql); |
| 3792 | 3792 | $row_verified = Database::fetch_array($rs_verified); |
| 3793 | 3793 | |
@@ -3815,8 +3815,8 @@ discard block |
||
| 3815 | 3815 | "This info shouldn't be saved as the credit or lesson mode info prevent it" |
| 3816 | 3816 | ); |
| 3817 | 3817 | error_log( |
| 3818 | - 'learnpathItem::write_to_db() - credit(' . $credit . ') or'. |
|
| 3819 | - ' lesson_mode(' . $mode . ') prevent recording!', |
|
| 3818 | + 'learnpathItem::write_to_db() - credit('.$credit.') or'. |
|
| 3819 | + ' lesson_mode('.$mode.') prevent recording!', |
|
| 3820 | 3820 | 0 |
| 3821 | 3821 | ); |
| 3822 | 3822 | } |
@@ -3840,14 +3840,14 @@ discard block |
||
| 3840 | 3840 | "max_score" => $this->get_max(), |
| 3841 | 3841 | "lp_item_id" => $this->db_id, |
| 3842 | 3842 | "lp_view_id" => $this->view_id, |
| 3843 | - "view_count" => $this->get_attempt_id() , |
|
| 3843 | + "view_count" => $this->get_attempt_id(), |
|
| 3844 | 3844 | "suspend_data" => $this->current_data, |
| 3845 | 3845 | //"max_time_allowed" => , |
| 3846 | 3846 | "lesson_location" => $this->lesson_location |
| 3847 | 3847 | ); |
| 3848 | 3848 | if (self::debug > 2) { |
| 3849 | 3849 | error_log( |
| 3850 | - 'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1), |
|
| 3850 | + 'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1), |
|
| 3851 | 3851 | 0 |
| 3852 | 3852 | ); |
| 3853 | 3853 | } |
@@ -3855,7 +3855,7 @@ discard block |
||
| 3855 | 3855 | |
| 3856 | 3856 | if ($this->db_item_view_id) { |
| 3857 | 3857 | $sql = "UPDATE $item_view_table SET id = iid |
| 3858 | - WHERE iid = " . $this->db_item_view_id; |
|
| 3858 | + WHERE iid = ".$this->db_item_view_id; |
|
| 3859 | 3859 | Database::query($sql); |
| 3860 | 3860 | $inserted = true; |
| 3861 | 3861 | } |
@@ -3865,12 +3865,12 @@ discard block |
||
| 3865 | 3865 | $sql = "SELECT * FROM $item_view_table |
| 3866 | 3866 | WHERE |
| 3867 | 3867 | c_id = $course_id AND |
| 3868 | - lp_item_id = " . $this->db_id . " AND |
|
| 3869 | - lp_view_id = " . $this->view_id . " AND |
|
| 3868 | + lp_item_id = ".$this->db_id." AND |
|
| 3869 | + lp_view_id = " . $this->view_id." AND |
|
| 3870 | 3870 | view_count = " . intval($this->get_attempt_id()); |
| 3871 | 3871 | if (self::debug > 2) { |
| 3872 | 3872 | error_log( |
| 3873 | - 'learnpathItem::write_to_db() - Querying item_view: ' . $sql, |
|
| 3873 | + 'learnpathItem::write_to_db() - Querying item_view: '.$sql, |
|
| 3874 | 3874 | 0 |
| 3875 | 3875 | ); |
| 3876 | 3876 | } |
@@ -3887,7 +3887,7 @@ discard block |
||
| 3887 | 3887 | "max_score" => $this->get_max(), |
| 3888 | 3888 | "lp_item_id" => $this->db_id, |
| 3889 | 3889 | "lp_view_id" => $this->view_id, |
| 3890 | - "view_count" => $this->get_attempt_id() , |
|
| 3890 | + "view_count" => $this->get_attempt_id(), |
|
| 3891 | 3891 | "suspend_data" => $this->current_data, |
| 3892 | 3892 | //"max_time_allowed" => ,$this->get_max_time_allowed() |
| 3893 | 3893 | "lesson_location" => $this->lesson_location |
@@ -3895,7 +3895,7 @@ discard block |
||
| 3895 | 3895 | |
| 3896 | 3896 | if (self::debug > 2) { |
| 3897 | 3897 | error_log( |
| 3898 | - 'learnpathItem::write_to_db() - Inserting into item_view forced: ' . print_r($params, 1), |
|
| 3898 | + 'learnpathItem::write_to_db() - Inserting into item_view forced: '.print_r($params, 1), |
|
| 3899 | 3899 | 0 |
| 3900 | 3900 | ); |
| 3901 | 3901 | } |
@@ -3904,7 +3904,7 @@ discard block |
||
| 3904 | 3904 | |
| 3905 | 3905 | if ($this->db_item_view_id) { |
| 3906 | 3906 | $sql = "UPDATE $item_view_table SET id = iid |
| 3907 | - WHERE iid = " . $this->db_item_view_id; |
|
| 3907 | + WHERE iid = ".$this->db_item_view_id; |
|
| 3908 | 3908 | Database::query($sql); |
| 3909 | 3909 | } |
| 3910 | 3910 | } else { |
@@ -3944,8 +3944,8 @@ discard block |
||
| 3944 | 3944 | $time_exe_date = convert_sql_date( |
| 3945 | 3945 | $row_dates['exe_date'] |
| 3946 | 3946 | ); |
| 3947 | - $mytime = ((int)$time_exe_date - (int)$time_start_date); |
|
| 3948 | - $total_time = " total_time = " . $mytime . ", "; |
|
| 3947 | + $mytime = ((int) $time_exe_date - (int) $time_start_date); |
|
| 3948 | + $total_time = " total_time = ".$mytime.", "; |
|
| 3949 | 3949 | } |
| 3950 | 3950 | } else { |
| 3951 | 3951 | $my_type_lp = learnpath::get_type_static($this->lp_id); |
@@ -3959,16 +3959,16 @@ discard block |
||
| 3959 | 3959 | |
| 3960 | 3960 | // Is not multiple attempts |
| 3961 | 3961 | if ($this->seriousgame_mode == 1 && $this->type == 'sco') { |
| 3962 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 3963 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 3962 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 3963 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 3964 | 3964 | } elseif ($this->get_prevent_reinit() == 1) { |
| 3965 | 3965 | // Process of status verified into data base. |
| 3966 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
| 3966 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
| 3967 | 3967 | WHERE |
| 3968 | - c_id = ' . $course_id . ' AND |
|
| 3969 | - lp_item_id="' . $this->db_id . '" AND |
|
| 3970 | - lp_view_id="' . $this->view_id . '" AND |
|
| 3971 | - view_count="' . $this->get_attempt_id() . '" |
|
| 3968 | + c_id = ' . $course_id.' AND |
|
| 3969 | + lp_item_id="' . $this->db_id.'" AND |
|
| 3970 | + lp_view_id="' . $this->view_id.'" AND |
|
| 3971 | + view_count="' . $this->get_attempt_id().'" |
|
| 3972 | 3972 | '; |
| 3973 | 3973 | $rs_verified = Database::query($sql); |
| 3974 | 3974 | $row_verified = Database::fetch_array($rs_verified); |
@@ -3978,26 +3978,26 @@ discard block |
||
| 3978 | 3978 | if (!in_array($this->get_status(false), $case_completed) && |
| 3979 | 3979 | $my_type_lp == 2 |
| 3980 | 3980 | ) { |
| 3981 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 3982 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 3981 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 3982 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 3983 | 3983 | } else { |
| 3984 | 3984 | // Verified into database. |
| 3985 | 3985 | if (!in_array($row_verified['status'], $case_completed) && |
| 3986 | 3986 | $my_type_lp == 2 |
| 3987 | 3987 | ) { |
| 3988 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 3989 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 3990 | - } elseif (in_array($row_verified['status'], $case_completed ) && |
|
| 3988 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 3989 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 3990 | + } elseif (in_array($row_verified['status'], $case_completed) && |
|
| 3991 | 3991 | $my_type_lp == 2 && $this->type != 'sco' |
| 3992 | 3992 | ) { |
| 3993 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 3994 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 3993 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 3994 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 3995 | 3995 | } else { |
| 3996 | 3996 | if (($my_type_lp == 3 && $this->type == 'au') || |
| 3997 | 3997 | ($my_type_lp == 1 && $this->type != 'chapter')) { |
| 3998 | 3998 | // Is AICC or Chamilo LP |
| 3999 | - $total_time = " total_time = total_time + " . $this->get_total_time() . ", "; |
|
| 4000 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 3999 | + $total_time = " total_time = total_time + ".$this->get_total_time().", "; |
|
| 4000 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 4001 | 4001 | } |
| 4002 | 4002 | } |
| 4003 | 4003 | } |
@@ -4009,27 +4009,27 @@ discard block |
||
| 4009 | 4009 | ) && $my_type_lp == 2 |
| 4010 | 4010 | ) { |
| 4011 | 4011 | // Reset zero new attempt ? |
| 4012 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 4012 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 4013 | 4013 | } elseif (!in_array($this->get_status(false), $case_completed) && |
| 4014 | 4014 | $my_type_lp == 2 |
| 4015 | 4015 | ) { |
| 4016 | - $total_time = " total_time = " . $this->get_total_time() . ", "; |
|
| 4017 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 4016 | + $total_time = " total_time = ".$this->get_total_time().", "; |
|
| 4017 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 4018 | 4018 | } else { |
| 4019 | 4019 | // It is chamilo LP. |
| 4020 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 4021 | - $my_status = " status = '" . $this->get_status(false) . "' ,"; |
|
| 4020 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 4021 | + $my_status = " status = '".$this->get_status(false)."' ,"; |
|
| 4022 | 4022 | } |
| 4023 | 4023 | |
| 4024 | 4024 | // This code line fixes the problem of wrong status. |
| 4025 | 4025 | if ($my_type_lp == 2) { |
| 4026 | 4026 | // Verify current status in multiples attempts. |
| 4027 | - $sql = 'SELECT status FROM ' . $item_view_table . ' |
|
| 4027 | + $sql = 'SELECT status FROM '.$item_view_table.' |
|
| 4028 | 4028 | WHERE |
| 4029 | - c_id = ' . $course_id . ' AND |
|
| 4030 | - lp_item_id="' . $this->db_id . '" AND |
|
| 4031 | - lp_view_id="' . $this->view_id . '" AND |
|
| 4032 | - view_count="' . $this->get_attempt_id() . '" '; |
|
| 4029 | + c_id = ' . $course_id.' AND |
|
| 4030 | + lp_item_id="' . $this->db_id.'" AND |
|
| 4031 | + lp_view_id="' . $this->view_id.'" AND |
|
| 4032 | + view_count="' . $this->get_attempt_id().'" '; |
|
| 4033 | 4033 | $rs_status = Database::query($sql); |
| 4034 | 4034 | $current_status = Database::result( |
| 4035 | 4035 | $rs_status, |
@@ -4040,7 +4040,7 @@ discard block |
||
| 4040 | 4040 | $my_status = ''; |
| 4041 | 4041 | $total_time = ''; |
| 4042 | 4042 | } else { |
| 4043 | - $total_time = " total_time = total_time +" . $this->get_total_time() . ", "; |
|
| 4043 | + $total_time = " total_time = total_time +".$this->get_total_time().", "; |
|
| 4044 | 4044 | } |
| 4045 | 4045 | } |
| 4046 | 4046 | } |
@@ -4051,38 +4051,38 @@ discard block |
||
| 4051 | 4051 | //" . //start_time = ".$this->get_current_start_time().", " . //scorm_init_time does it |
| 4052 | 4052 | ////" max_time_allowed = '".$this->get_max_time_allowed()."'," . |
| 4053 | 4053 | $sql = "UPDATE $item_view_table SET |
| 4054 | - score = " . $this->get_score() . ", |
|
| 4054 | + score = ".$this->get_score().", |
|
| 4055 | 4055 | $my_status |
| 4056 | - max_score = '" . $this->get_max() . "', |
|
| 4057 | - suspend_data = '" . Database::escape_string($this->current_data) . "', |
|
| 4058 | - lesson_location = '" . $this->lesson_location . "' |
|
| 4056 | + max_score = '".$this->get_max()."', |
|
| 4057 | + suspend_data = '" . Database::escape_string($this->current_data)."', |
|
| 4058 | + lesson_location = '" . $this->lesson_location."' |
|
| 4059 | 4059 | WHERE |
| 4060 | 4060 | c_id = $course_id AND |
| 4061 | - lp_item_id = " . $this->db_id . " AND |
|
| 4062 | - lp_view_id = " . $this->view_id . " AND |
|
| 4061 | + lp_item_id = ".$this->db_id." AND |
|
| 4062 | + lp_view_id = " . $this->view_id." AND |
|
| 4063 | 4063 | view_count = " . $this->get_attempt_id(); |
| 4064 | 4064 | |
| 4065 | 4065 | } else { |
| 4066 | 4066 | //" max_time_allowed = '".$this->get_max_time_allowed()."'," . |
| 4067 | 4067 | $sql = "UPDATE $item_view_table SET |
| 4068 | 4068 | $total_time |
| 4069 | - start_time = " . $this->get_current_start_time() . ", |
|
| 4070 | - score = " . $this->get_score() . ", |
|
| 4069 | + start_time = ".$this->get_current_start_time().", |
|
| 4070 | + score = " . $this->get_score().", |
|
| 4071 | 4071 | $my_status |
| 4072 | - max_score = '" . $this->get_max() . "', |
|
| 4073 | - suspend_data = '" . Database::escape_string($this->current_data) . "', |
|
| 4074 | - lesson_location = '" . $this->lesson_location . "' |
|
| 4072 | + max_score = '".$this->get_max()."', |
|
| 4073 | + suspend_data = '" . Database::escape_string($this->current_data)."', |
|
| 4074 | + lesson_location = '" . $this->lesson_location."' |
|
| 4075 | 4075 | WHERE |
| 4076 | 4076 | c_id = $course_id AND |
| 4077 | - lp_item_id = " . $this->db_id . " AND |
|
| 4078 | - lp_view_id = " . $this->view_id . " AND |
|
| 4077 | + lp_item_id = ".$this->db_id." AND |
|
| 4078 | + lp_view_id = " . $this->view_id." AND |
|
| 4079 | 4079 | view_count = " . $this->get_attempt_id(); |
| 4080 | 4080 | } |
| 4081 | 4081 | $this->current_start_time = time(); |
| 4082 | 4082 | } |
| 4083 | 4083 | if (self::debug > 2) { |
| 4084 | 4084 | error_log( |
| 4085 | - 'learnpathItem::write_to_db() - Updating item_view: ' . $sql, |
|
| 4085 | + 'learnpathItem::write_to_db() - Updating item_view: '.$sql, |
|
| 4086 | 4086 | 0 |
| 4087 | 4087 | ); |
| 4088 | 4088 | } |
@@ -4095,8 +4095,8 @@ discard block |
||
| 4095 | 4095 | $sql = "SELECT id FROM $tbl |
| 4096 | 4096 | WHERE |
| 4097 | 4097 | c_id = $course_id AND |
| 4098 | - lp_item_id = " . $this->db_id . " AND |
|
| 4099 | - lp_view_id = " . $this->view_id . " AND |
|
| 4098 | + lp_item_id = ".$this->db_id." AND |
|
| 4099 | + lp_view_id = " . $this->view_id." AND |
|
| 4100 | 4100 | view_count = " . $this->get_attempt_id(); |
| 4101 | 4101 | $res = Database::query($sql); |
| 4102 | 4102 | if (Database::num_rows($res) > 0) { |
@@ -4104,8 +4104,8 @@ discard block |
||
| 4104 | 4104 | $lp_iv_id = $row[0]; |
| 4105 | 4105 | if (self::debug > 2) { |
| 4106 | 4106 | error_log( |
| 4107 | - 'learnpathItem::write_to_db() - Got item_view_id ' . |
|
| 4108 | - $lp_iv_id . ', now checking interactions ', |
|
| 4107 | + 'learnpathItem::write_to_db() - Got item_view_id '. |
|
| 4108 | + $lp_iv_id.', now checking interactions ', |
|
| 4109 | 4109 | 0 |
| 4110 | 4110 | ); |
| 4111 | 4111 | } |
@@ -4116,7 +4116,7 @@ discard block |
||
| 4116 | 4116 | ) && !empty($interaction[4][0]) |
| 4117 | 4117 | ) { |
| 4118 | 4118 | foreach ($interaction[4] as $resp) { |
| 4119 | - $correct_resp .= $resp . ','; |
|
| 4119 | + $correct_resp .= $resp.','; |
|
| 4120 | 4120 | } |
| 4121 | 4121 | $correct_resp = substr( |
| 4122 | 4122 | $correct_resp, |
@@ -4135,7 +4135,7 @@ discard block |
||
| 4135 | 4135 | lp_iv_id = $lp_iv_id AND |
| 4136 | 4136 | ( |
| 4137 | 4137 | order_id = $index OR |
| 4138 | - interaction_id = '" . Database::escape_string($interaction[0]) . "' |
|
| 4138 | + interaction_id = '".Database::escape_string($interaction[0])."' |
|
| 4139 | 4139 | ) |
| 4140 | 4140 | "; |
| 4141 | 4141 | $iva_res = Database::query($iva_sql); |
@@ -4208,11 +4208,11 @@ discard block |
||
| 4208 | 4208 | public function add_audio() |
| 4209 | 4209 | { |
| 4210 | 4210 | $course_info = api_get_course_info(); |
| 4211 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/'; |
|
| 4211 | + $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/'; |
|
| 4212 | 4212 | |
| 4213 | - if (!is_dir($filepath . 'audio')) { |
|
| 4213 | + if (!is_dir($filepath.'audio')) { |
|
| 4214 | 4214 | mkdir( |
| 4215 | - $filepath . 'audio', |
|
| 4215 | + $filepath.'audio', |
|
| 4216 | 4216 | api_get_permissions_for_new_directories() |
| 4217 | 4217 | ); |
| 4218 | 4218 | $audio_id = add_document( |
@@ -4271,10 +4271,10 @@ discard block |
||
| 4271 | 4271 | // Store the mp3 file in the lp_item table. |
| 4272 | 4272 | $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 4273 | 4273 | $sql = "UPDATE $tbl_lp_item SET |
| 4274 | - audio = '" . Database::escape_string($file_path) . "' |
|
| 4274 | + audio = '".Database::escape_string($file_path)."' |
|
| 4275 | 4275 | WHERE |
| 4276 | 4276 | c_id = {$course_info['real_id']} AND |
| 4277 | - id = '" . intval($this->db_id) . "'"; |
|
| 4277 | + id = '".intval($this->db_id)."'"; |
|
| 4278 | 4278 | Database::query($sql); |
| 4279 | 4279 | } |
| 4280 | 4280 | |
@@ -4299,10 +4299,10 @@ discard block |
||
| 4299 | 4299 | // Store the mp3 file in the lp_item table. |
| 4300 | 4300 | $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
| 4301 | 4301 | $sql = "UPDATE $tbl_lp_item SET |
| 4302 | - audio = '" . Database::escape_string($file_path) . "' |
|
| 4302 | + audio = '".Database::escape_string($file_path)."' |
|
| 4303 | 4303 | WHERE |
| 4304 | 4304 | c_id = {$course_info['real_id']} AND |
| 4305 | - id = " . intval($this->db_id); |
|
| 4305 | + id = ".intval($this->db_id); |
|
| 4306 | 4306 | Database::query($sql); |
| 4307 | 4307 | } |
| 4308 | 4308 | return $file_path; |
@@ -4323,7 +4323,7 @@ discard block |
||
| 4323 | 4323 | } |
| 4324 | 4324 | $sql = "UPDATE $tbl_lp_item SET |
| 4325 | 4325 | audio = '' |
| 4326 | - WHERE c_id = $course_id AND id IN (" . $this->db_id . ")"; |
|
| 4326 | + WHERE c_id = $course_id AND id IN (".$this->db_id.")"; |
|
| 4327 | 4327 | Database::query($sql); |
| 4328 | 4328 | } |
| 4329 | 4329 | |
@@ -4369,7 +4369,7 @@ discard block |
||
| 4369 | 4369 | |
| 4370 | 4370 | if ($type == 'simple') { |
| 4371 | 4371 | if (in_array($status, array('failed', 'passed', 'browsed'))) { |
| 4372 | - $myLessonStatus = get_lang('ScormIncomplete');; |
|
| 4372 | + $myLessonStatus = get_lang('ScormIncomplete'); ; |
|
| 4373 | 4373 | $classStatus = 'warning'; |
| 4374 | 4374 | } |
| 4375 | 4375 | } |
@@ -4518,7 +4518,7 @@ discard block |
||
| 4518 | 4518 | */ |
| 4519 | 4519 | public function createForumThread($currentForumId) |
| 4520 | 4520 | { |
| 4521 | - require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php'; |
|
| 4521 | + require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php'; |
|
| 4522 | 4522 | |
| 4523 | 4523 | $em = Database::getManager(); |
| 4524 | 4524 | $threadRepo = $em->getRepository('ChamiloCourseBundle:CForumThread'); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param int $categoryId |
| 35 | 35 | * @param bool $ignoreCategoryFilter |
| 36 | 36 | * |
| 37 | - * @return void |
|
| 37 | + * @return false|null |
|
| 38 | 38 | */ |
| 39 | 39 | public function __construct( |
| 40 | 40 | $user_id, |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | "; |
| 106 | 106 | $res = Database::query($sql); |
| 107 | 107 | $names = array(); |
| 108 | - while ($row = Database::fetch_array($res,'ASSOC')) { |
|
| 108 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
| 109 | 109 | // Use domesticate here instead of Database::escape_string because |
| 110 | 110 | // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility()) |
| 111 | 111 | // is done using domesticate() |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | $lessons = array(); |
| 237 | 237 | while ($row = Database::fetch_array($result)) { |
| 238 | - if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) { |
|
| 238 | + if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) { |
|
| 239 | 239 | $lessons[$row['id']] = $row; |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | * @param int $user_id User ID |
| 21 | 21 | * @param int $view_id View ID |
| 22 | 22 | * @param int $item_id Item ID |
| 23 | - * @param float $score Current score |
|
| 24 | - * @param float $max Maximum score |
|
| 25 | - * @param float $min Minimum score |
|
| 23 | + * @param integer $score Current score |
|
| 24 | + * @param integer $max Maximum score |
|
| 25 | + * @param integer $min Minimum score |
|
| 26 | 26 | * @param string $status Lesson status |
| 27 | 27 | * @param int $time Session time |
| 28 | 28 | * @param string $suspend Suspend data |
@@ -458,7 +458,7 @@ |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | if ($myLP->get_type() == 2) { |
| 461 | - $return .= "update_stats();"; |
|
| 461 | + $return .= "update_stats();"; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | // To be sure progress is updated. |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // Set status to completed for hotpotatoes if score > 80%. |
| 164 | 164 | if ($my_type == 'hotpotatoes') { |
| 165 | 165 | if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) { |
| 166 | - if (($score/$max) > 0.8) { |
|
| 166 | + if (($score / $max) > 0.8) { |
|
| 167 | 167 | $myStatus = 'completed'; |
| 168 | 168 | if ($debug > 1) { |
| 169 | 169 | error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | - } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) { |
|
| 177 | + } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) { |
|
| 178 | 178 | $myStatus = 'failed'; |
| 179 | 179 | if ($debug > 1) { |
| 180 | 180 | error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $myLPI->current_data = $suspend; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if (isset($location) && $location != '' && $location!='undefined') { |
|
| 370 | + if (isset($location) && $location != '' && $location != 'undefined') { |
|
| 371 | 371 | $myLPI->set_lesson_location($location); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -171,7 +171,8 @@ |
||
| 171 | 171 | /** |
| 172 | 172 | * Get images files from remote host (with webservices) |
| 173 | 173 | * @param array current ppt file |
| 174 | - * @return array images files |
|
| 174 | + * @param string $file |
|
| 175 | + * @return string images files |
|
| 175 | 176 | */ |
| 176 | 177 | private function _get_remote_ppt2lp_files($file) |
| 177 | 178 | { |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | // Create the directory |
| 50 | 50 | $result = $this->generate_lp_folder($_course, $this->file_name); |
| 51 | 51 | |
| 52 | - // Create the directory |
|
| 52 | + // Create the directory |
|
| 53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 54 | 54 | ///learning_path/ppt_dirname directory |
| 55 | 55 | $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Create the directory |
| 53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 54 | 54 | ///learning_path/ppt_dirname directory |
| 55 | - $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
|
| 55 | + $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) - 1); |
|
| 56 | 56 | $this->file_path = $this->created_dir.'/'.api_replace_dangerous_char($file['name']); |
| 57 | 57 | |
| 58 | 58 | //var_dump($this->file_name, $this->file_path, $this->base_work_dir, $this->created_dir); |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | $perm = api_get_setting('permissions_for_new_files'); |
| 90 | 90 | |
| 91 | 91 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
| 92 | - $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
| 93 | - $class_path = $converter_path . ';' . $converter_path . '/jodconverter-2.2.2.jar;' . $converter_path . '/jodconverter-cli-2.2.2.jar'; |
|
| 92 | + $converter_path = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
| 93 | + $class_path = $converter_path.';'.$converter_path.'/jodconverter-2.2.2.jar;'.$converter_path.'/jodconverter-cli-2.2.2.jar'; |
|
| 94 | 94 | //$cmd = 'java -cp "'.$class_path.'" DokeosConverter'; |
| 95 | - $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $class_path . '" DokeosConverter'; |
|
| 95 | + $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$class_path.'" DokeosConverter'; |
|
| 96 | 96 | } else { |
| 97 | - $converter_path = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
| 97 | + $converter_path = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
| 98 | 98 | //$class_path = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar'; |
| 99 | 99 | $class_path = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
| 100 | - $cmd = 'cd ' . $converter_path . ' && java ' . $class_path . ' DokeosConverter'; |
|
| 100 | + $cmd = 'cd '.$converter_path.' && java '.$class_path.' DokeosConverter'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
| 103 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
| 104 | 104 | // Call to the function implemented by child. |
| 105 | 105 | $cmd .= $this->add_command_parameters(); |
| 106 | 106 | // To allow openoffice to manipulate docs. |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | @chmod($this->base_work_dir.$this->file_path, 0777); |
| 110 | 110 | |
| 111 | 111 | $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
| 112 | - putenv('LC_ALL=' . $locale); |
|
| 112 | + putenv('LC_ALL='.$locale); |
|
| 113 | 113 | |
| 114 | 114 | $files = array(); |
| 115 | 115 | $return = 0; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | if (!empty($result['images'])) { |
| 140 | 140 | foreach ($result['images'] as $image => $img_data) { |
| 141 | 141 | $image_path = $this->base_work_dir.$this->created_dir; |
| 142 | - @file_put_contents($image_path . '/' . $image, base64_decode($img_data)); |
|
| 143 | - @chmod($image_path . '/' . $image, 0777); |
|
| 142 | + @file_put_contents($image_path.'/'.$image, base64_decode($img_data)); |
|
| 143 | + @chmod($image_path.'/'.$image, 0777); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -233,38 +233,38 @@ discard block |
||
| 233 | 233 | $ppt2lpHost = api_get_setting('service_ppt2lp', 'host'); |
| 234 | 234 | $permissionFile = api_get_permissions_for_new_files(); |
| 235 | 235 | $permissionFolder = api_get_permissions_for_new_directories(); |
| 236 | - if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
| 236 | + if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
| 237 | 237 | |
| 238 | 238 | return $ids; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if ($ppt2lpHost == 'localhost') { |
| 242 | 242 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
| 243 | - $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
| 244 | - $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
| 245 | - $cmd = 'java -Dfile.encoding=UTF-8 -jar "' . $classPath . '/jodconverter-2.2.2.jar"'; |
|
| 243 | + $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
| 244 | + $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
| 245 | + $cmd = 'java -Dfile.encoding=UTF-8 -jar "'.$classPath.'/jodconverter-2.2.2.jar"'; |
|
| 246 | 246 | } else { |
| 247 | - $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
| 247 | + $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
| 248 | 248 | $classPath = ' -Dfile.encoding=UTF-8 -jar jodconverter-cli-2.2.2.jar'; |
| 249 | - $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' '; |
|
| 249 | + $cmd = 'cd '.$converterPath.' && java '.$classPath.' '; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
| 252 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
| 253 | 253 | // Call to the function implemented by child. |
| 254 | - $cmd .= ' "' . $this->base_work_dir . '/' . $this->file_path . '" "' . $this->base_work_dir . '/' . $this->created_dir . '"'; |
|
| 254 | + $cmd .= ' "'.$this->base_work_dir.'/'.$this->file_path.'" "'.$this->base_work_dir.'/'.$this->created_dir.'"'; |
|
| 255 | 255 | // To allow openoffice to manipulate docs. |
| 256 | 256 | @chmod($this->base_work_dir, $permissionFolder); |
| 257 | - @chmod($this->base_work_dir . '/' . $this->file_path, $permissionFile); |
|
| 257 | + @chmod($this->base_work_dir.'/'.$this->file_path, $permissionFile); |
|
| 258 | 258 | |
| 259 | 259 | $locale = $this->original_locale; // TODO: Improve it because we're not sure this locale is present everywhere. |
| 260 | - putenv('LC_ALL=' . $locale); |
|
| 260 | + putenv('LC_ALL='.$locale); |
|
| 261 | 261 | |
| 262 | 262 | $files = array(); |
| 263 | 263 | $return = 0; |
| 264 | 264 | $shell = exec($cmd, $files, $return); |
| 265 | 265 | // TODO: Chown is not working, root keep user privileges, should be www-data |
| 266 | - @chown($this->base_work_dir . '/' . $this->created_dir, 'www-data'); |
|
| 267 | - @chmod($this->base_work_dir . '/' . $this->created_dir, $permissionFile); |
|
| 266 | + @chown($this->base_work_dir.'/'.$this->created_dir, 'www-data'); |
|
| 267 | + @chmod($this->base_work_dir.'/'.$this->created_dir, $permissionFile); |
|
| 268 | 268 | |
| 269 | 269 | if ($return != 0) { // If the java application returns an error code. |
| 270 | 270 | switch ($return) { |
@@ -303,14 +303,14 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if (file_exists($this->base_work_dir . '/' . $this->created_dir)) { |
|
| 306 | + if (file_exists($this->base_work_dir.'/'.$this->created_dir)) { |
|
| 307 | 307 | |
| 308 | 308 | // Register Files to Document tool |
| 309 | 309 | $ids[] = add_document( |
| 310 | 310 | $_course, |
| 311 | - '/' . $this->created_dir, |
|
| 311 | + '/'.$this->created_dir, |
|
| 312 | 312 | 'file', |
| 313 | - filesize($this->base_work_dir . '/' . $this->created_dir), |
|
| 313 | + filesize($this->base_work_dir.'/'.$this->created_dir), |
|
| 314 | 314 | $convertedTitle, |
| 315 | 315 | sprintf( |
| 316 | 316 | get_lang('FileConvertedFromXToY'), |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Gets html pages and compose them into a learning path |
| 40 | 40 | * @param array The files that will compose the generated learning path. Unused so far. |
| 41 | - * @return boolean False if file does not exit. Nothing otherwise. |
|
| 41 | + * @return false|null False if file does not exit. Nothing otherwise. |
|
| 42 | 42 | */ |
| 43 | 43 | public function make_lp($files = array()) |
| 44 | 44 | { |
@@ -92,6 +92,7 @@ discard block |
||
| 92 | 92 | * Manages chapter splitting |
| 93 | 93 | * @param string Chapter header |
| 94 | 94 | * @param string Content |
| 95 | + * @param string $content |
|
| 95 | 96 | * @return void |
| 96 | 97 | */ |
| 97 | 98 | function dealPerChapter($header, $content) |
@@ -164,6 +165,7 @@ discard block |
||
| 164 | 165 | * Manages page splitting |
| 165 | 166 | * @param string Page header |
| 166 | 167 | * @param string Page body |
| 168 | + * @param string $body |
|
| 167 | 169 | * @return void |
| 168 | 170 | */ |
| 169 | 171 | function dealPerPage($header, $body) |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $intro_content = api_substr($content, 0, api_strpos($content, $matches[0][0])); |
| 118 | 118 | $items_to_create[get_lang('Introduction')] = $intro_content; |
| 119 | 119 | |
| 120 | - for ($i = 0; $i<count($matches[0]); $i++) { |
|
| 120 | + for ($i = 0; $i < count($matches[0]); $i++) { |
|
| 121 | 121 | |
| 122 | 122 | if (empty($matches[1][$i])) |
| 123 | 123 | continue; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | $first_item = 0; |
| 176 | 176 | |
| 177 | - foreach($pages as $key => $page_content) { |
|
| 177 | + foreach ($pages as $key => $page_content) { |
|
| 178 | 178 | // For every pages, we create a new file. |
| 179 | 179 | |
| 180 | 180 | $key += 1; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | foreach ($specific_fields as $specific_field) { |
| 214 | 214 | if (isset($_REQUEST[$specific_field['code']])) { |
| 215 | 215 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 216 | - $all_specific_terms .= ' '. $sterms; |
|
| 216 | + $all_specific_terms .= ' '.$sterms; |
|
| 217 | 217 | if (!empty($sterms)) { |
| 218 | 218 | $sterms = explode(',', $sterms); |
| 219 | 219 | foreach ($sterms as $sterm) { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | - $page_content = $all_specific_terms .' '. $page_content; |
|
| 225 | + $page_content = $all_specific_terms.' '.$page_content; |
|
| 226 | 226 | $ic_slide->addValue('content', $page_content); |
| 227 | 227 | // Add a comment to say terms separated by commas. |
| 228 | 228 | $courseid = api_get_course_id(); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | SE_COURSE_ID => $courseid, |
| 234 | 234 | SE_TOOL_ID => TOOL_LEARNPATH, |
| 235 | 235 | SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id), |
| 236 | - SE_USER => (int)api_get_user_id(), |
|
| 236 | + SE_USER => (int) api_get_user_id(), |
|
| 237 | 237 | ); |
| 238 | 238 | $ic_slide->xapian_data = serialize($xapian_data); |
| 239 | 239 | $di->addChunk($ic_slide); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $content = '<body><div style="width:'.$max_width.'">'.$content; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $content = preg_replace('|</body>|i','</div>\\0', $content, -1, $count); |
|
| 279 | + $content = preg_replace('|</body>|i', '</div>\\0', $content, -1, $count); |
|
| 280 | 280 | if ($count < 1) { |
| 281 | 281 | $content = $content.'</div></body>'; |
| 282 | 282 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | } elseif ($img_width > $max_width - 10) { |
| 307 | - $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width-10).'"', $images[0][$key]); |
|
| 307 | + $picture_resized = str_ireplace('width='.$img_width, 'width="'.($max_width - 10).'"', $images[0][$key]); |
|
| 308 | 308 | $content = str_replace($images[0][$key], $picture_resized, $content); |
| 309 | 309 | } |
| 310 | 310 | } |
@@ -119,8 +119,9 @@ |
||
| 119 | 119 | |
| 120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
| 121 | 121 | |
| 122 | - if (empty($matches[1][$i])) |
|
| 123 | - continue; |
|
| 122 | + if (empty($matches[1][$i])) { |
|
| 123 | + continue; |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
| 126 | 127 | if ($i + 1 !== count($matches[0])) { |
@@ -320,6 +320,10 @@ |
||
| 320 | 320 | * @param icon - if ="icon" then the small icon will appear |
| 321 | 321 | * if ="wrap" then wrapped settings are used (and no icon is displayed) |
| 322 | 322 | * if ="nolink" then only the name is returned with no href and no icon (note:only in this case, the result is not displayed, but returned) |
| 323 | + * @param string $completed |
|
| 324 | + * @param string $id_in_path |
|
| 325 | + * @param string $builder |
|
| 326 | + * @param string $icon |
|
| 323 | 327 | * @todo this function is too long, rewrite |
| 324 | 328 | */ |
| 325 | 329 | function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) { |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | $ext = strtolower($ext[sizeof($ext)-1]); |
| 287 | 287 | $myrow['path'] = rawurlencode($myrow['path']); |
| 288 | 288 | |
| 289 | - $array_ext=array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); |
|
| 289 | + $array_ext=array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); |
|
| 290 | 290 | |
| 291 | - if (api_browser_support('svg')){ |
|
| 292 | - $array_ext[]='svg'; |
|
| 293 | - } |
|
| 294 | - if (api_browser_support('ogg')){ |
|
| 295 | - $array_ext[]='ogg'; |
|
| 296 | - } |
|
| 291 | + if (api_browser_support('svg')){ |
|
| 292 | + $array_ext[]='svg'; |
|
| 293 | + } |
|
| 294 | + if (api_browser_support('ogg')){ |
|
| 295 | + $array_ext[]='ogg'; |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | 298 | $in_frames = in_array($ext, $array_ext); |
| 299 | 299 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $result = Database::query($sql); |
| 393 | 393 | $row = Database::fetch_array($result); |
| 394 | 394 | if ($row['title'] != '') { |
| 395 | - $myrow['content'] = $row['title']; |
|
| 395 | + $myrow['content'] = $row['title']; |
|
| 396 | 396 | } |
| 397 | 397 | $desc = $row['description']; |
| 398 | 398 | $ann_id = $row['item_id']; |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } |
| 470 | 470 | if ($icon == 'icon') { |
| 471 | 471 | if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
| 472 | - else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 472 | + else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 473 | 473 | } |
| 474 | 474 | $thelink = $myrow['url']; |
| 475 | 475 | if ($builder != 'builder') { |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | $myrow = Database::fetch_array($result); |
| 495 | 495 | |
| 496 | 496 | if ($builder == 'builder') { $origin = 'builder'; } |
| 497 | - // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 497 | + // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 498 | 498 | |
| 499 | 499 | $sql = "select * from $tbl_lp_item where id=$id_in_path"; |
| 500 | 500 | $result = Database::query($sql); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $name = GetQuizName($path, $documentPath); |
| 547 | 547 | |
| 548 | 548 | if ($builder == 'builder') { $origin='builder'; } |
| 549 | - // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 549 | + // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 550 | 550 | |
| 551 | 551 | $sql = "select * from $tbl_lp_item where id=$id_in_path"; |
| 552 | 552 | $result = Database::query($sql); $row = Database::fetch_array($result); |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | $myrow = Database::fetch_array($result); |
| 1107 | 1107 | |
| 1108 | 1108 | if ($builder == 'builder') { $origin = 'builder'; } |
| 1109 | - // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 1109 | + // This is needed for the exercise_submit.php can delete the session info about tests. |
|
| 1110 | 1110 | |
| 1111 | 1111 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1112 | 1112 | $result = Database::query($sql); $row = Database::fetch_array($result); |
@@ -1330,10 +1330,10 @@ discard block |
||
| 1330 | 1330 | */ |
| 1331 | 1331 | function delete_all_resources_type($type) |
| 1332 | 1332 | { |
| 1333 | - $course_id = api_get_course_int_id(); |
|
| 1334 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1335 | - $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'"; |
|
| 1336 | - Database::query($sql); |
|
| 1333 | + $course_id = api_get_course_int_id(); |
|
| 1334 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1335 | + $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'"; |
|
| 1336 | + Database::query($sql); |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | /** |
@@ -334,9 +334,14 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $length = ((($builder == 'builder') && ($icon == 'nolink')) ? 65 : 32); |
| 336 | 336 | |
| 337 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 337 | + if ($builder != 'builder') { |
|
| 338 | + $origin = 'learnpath'; |
|
| 339 | + } |
|
| 340 | + //origin = learnpath in student view |
|
| 338 | 341 | $linktype = $type; |
| 339 | - if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
| 342 | + if (($type == 'Link _self') or ($type == 'Link _blank')) { |
|
| 343 | + $type = 'Link'; |
|
| 344 | + } |
|
| 340 | 345 | |
| 341 | 346 | // YW switched litteral tool names to use of constants declared in main_api.lib.php |
| 342 | 347 | switch ($type) { |
@@ -356,7 +361,7 @@ discard block |
||
| 356 | 361 | if ($icon != 'nolink') { |
| 357 | 362 | if ($completed == 'completed') { |
| 358 | 363 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 359 | - } else { |
|
| 364 | + } else { |
|
| 360 | 365 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 361 | 366 | //echo " "; |
| 362 | 367 | } |
@@ -407,7 +412,7 @@ discard block |
||
| 407 | 412 | if ($icon != 'nolink') { |
| 408 | 413 | if ($completed == 'completed') { |
| 409 | 414 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 410 | - } else { |
|
| 415 | + } else { |
|
| 411 | 416 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 412 | 417 | //echo " "; |
| 413 | 418 | } |
@@ -454,7 +459,7 @@ discard block |
||
| 454 | 459 | if ($icon != 'nolink') { |
| 455 | 460 | if ($completed == 'completed') { |
| 456 | 461 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 457 | - } else { |
|
| 462 | + } else { |
|
| 458 | 463 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 459 | 464 | //echo " "; |
| 460 | 465 | } |
@@ -468,8 +473,7 @@ discard block |
||
| 468 | 473 | |
| 469 | 474 | if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } |
| 470 | 475 | if ($icon == 'icon') { |
| 471 | - if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
| 472 | - else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 476 | + if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 473 | 477 | } |
| 474 | 478 | $thelink = $myrow['url']; |
| 475 | 479 | if ($builder != 'builder') { |
@@ -558,7 +562,7 @@ discard block |
||
| 558 | 562 | if ($icon != 'nolink') { |
| 559 | 563 | if ($completed == 'completed') { |
| 560 | 564 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 561 | - } else { |
|
| 565 | + } else { |
|
| 562 | 566 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 563 | 567 | //echo " "; |
| 564 | 568 | } |
@@ -603,7 +607,7 @@ discard block |
||
| 603 | 607 | if ($icon != 'nolink') { |
| 604 | 608 | if ($completed == 'completed') { |
| 605 | 609 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 606 | - } else { |
|
| 610 | + } else { |
|
| 607 | 611 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 608 | 612 | //echo " "; |
| 609 | 613 | } |
@@ -647,7 +651,7 @@ discard block |
||
| 647 | 651 | if ($icon != 'nolink') { |
| 648 | 652 | if ($completed == 'completed') { |
| 649 | 653 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 650 | - } else { |
|
| 654 | + } else { |
|
| 651 | 655 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 652 | 656 | //echo " "; |
| 653 | 657 | } |
@@ -698,7 +702,7 @@ discard block |
||
| 698 | 702 | if ($icon != 'nolink') { |
| 699 | 703 | if ($completed == 'completed') { |
| 700 | 704 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 701 | - } else { |
|
| 705 | + } else { |
|
| 702 | 706 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 703 | 707 | //echo " "; |
| 704 | 708 | } |
@@ -801,7 +805,7 @@ discard block |
||
| 801 | 805 | if ($icon != 'nolink') { |
| 802 | 806 | if ($completed == 'completed') { |
| 803 | 807 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 804 | - } else { |
|
| 808 | + } else { |
|
| 805 | 809 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 806 | 810 | //echo " "; |
| 807 | 811 | } |
@@ -842,7 +846,7 @@ discard block |
||
| 842 | 846 | if ($icon != 'nolink') { |
| 843 | 847 | if ($completed == 'completed') { |
| 844 | 848 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 845 | - } else { |
|
| 849 | + } else { |
|
| 846 | 850 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 847 | 851 | //echo " "; |
| 848 | 852 | } |
@@ -858,8 +862,7 @@ discard block |
||
| 858 | 862 | 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"; |
| 859 | 863 | if ($desc != '') { |
| 860 | 864 | if ($icon != 'wrap') { |
| 861 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 862 | - else { |
|
| 865 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else { |
|
| 863 | 866 | echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
| 864 | 867 | } |
| 865 | 868 | } else { |
@@ -897,8 +900,7 @@ discard block |
||
| 897 | 900 | $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"; |
| 898 | 901 | if ($desc != '') { |
| 899 | 902 | if ($icon != 'wrap') { |
| 900 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 901 | - else { |
|
| 903 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else { |
|
| 902 | 904 | echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
| 903 | 905 | } |
| 904 | 906 | } else { |
@@ -920,7 +922,7 @@ discard block |
||
| 920 | 922 | if ($icon != 'nolink') { |
| 921 | 923 | if ($completed == 'completed') { |
| 922 | 924 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 923 | - } else { |
|
| 925 | + } else { |
|
| 924 | 926 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 925 | 927 | //echo " "; |
| 926 | 928 | } |
@@ -936,8 +938,7 @@ discard block |
||
| 936 | 938 | 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"; |
| 937 | 939 | if ($desc != '') { |
| 938 | 940 | if ($icon != 'wrap') { |
| 939 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 940 | - else { |
|
| 941 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else { |
|
| 941 | 942 | echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
| 942 | 943 | } |
| 943 | 944 | } else { |
@@ -976,8 +977,7 @@ discard block |
||
| 976 | 977 | 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"; |
| 977 | 978 | if ($desc != '') { |
| 978 | 979 | if ($icon != 'wrap') { |
| 979 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 980 | - else { |
|
| 980 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else { |
|
| 981 | 981 | echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
| 982 | 982 | } |
| 983 | 983 | } else { |
@@ -1015,8 +1015,7 @@ discard block |
||
| 1015 | 1015 | 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"; |
| 1016 | 1016 | if ($desc != '') { |
| 1017 | 1017 | if ($icon != 'wrap') { |
| 1018 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 1019 | - else { |
|
| 1018 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else { |
|
| 1020 | 1019 | echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
| 1021 | 1020 | } |
| 1022 | 1021 | } else { |
@@ -1346,11 +1345,12 @@ discard block |
||
| 1346 | 1345 | WHERE c_id = $course_id AND source_type='$type' and source_id='$id'"; |
| 1347 | 1346 | $result = Database::query($sql); |
| 1348 | 1347 | $number_added = Database::num_rows($result); |
| 1349 | - if ($number_added != 0) |
|
| 1350 | - return true; |
|
| 1351 | - else |
|
| 1352 | - return false; |
|
| 1353 | -} |
|
| 1348 | + if ($number_added != 0) { |
|
| 1349 | + return true; |
|
| 1350 | + } else { |
|
| 1351 | + return false; |
|
| 1352 | + } |
|
| 1353 | + } |
|
| 1354 | 1354 | |
| 1355 | 1355 | /** |
| 1356 | 1356 | * this function is to load the resources that were added to a specific item |
@@ -1459,8 +1459,7 @@ discard block |
||
| 1459 | 1459 | next($addedresource); |
| 1460 | 1460 | } |
| 1461 | 1461 | echo '</table>'; |
| 1462 | - } |
|
| 1463 | - else { // it is a string |
|
| 1462 | + } else { // it is a string |
|
| 1464 | 1463 | echo ''; |
| 1465 | 1464 | } |
| 1466 | 1465 | } // end of the display_resources function |
@@ -1492,8 +1491,7 @@ discard block |
||
| 1492 | 1491 | echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
| 1493 | 1492 | } |
| 1494 | 1493 | } |
| 1495 | - } |
|
| 1496 | - else { // if it is not an array, it is a string |
|
| 1494 | + } else { // if it is not an array, it is a string |
|
| 1497 | 1495 | if ($_SESSION['addedresource'] !== $type || $_SESSION['addedresourceid'] !== $id) { |
| 1498 | 1496 | if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); } |
| 1499 | 1497 | echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
@@ -1519,7 +1517,9 @@ discard block |
||
| 1519 | 1517 | $course_id = api_get_course_int_id(); |
| 1520 | 1518 | |
| 1521 | 1519 | // Styling the link of the added resource |
| 1522 | - if ($style != '') $styling = ' class="'.$style.'"'; |
|
| 1520 | + if ($style != '') { |
|
| 1521 | + $styling = ' class="'.$style.'"'; |
|
| 1522 | + } |
|
| 1523 | 1523 | if ($new_window) { $target = ' target = "_blank" '; } else { $target = ' target = "_self" '; } |
| 1524 | 1524 | |
| 1525 | 1525 | $output = ''; |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | $use_anonymous = true; |
| 18 | 18 | |
| 19 | 19 | require_once '../inc/global.inc.php'; |
| 20 | -if (!empty($_course['language'])){ |
|
| 21 | - $resource_linker_file = api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php'; |
|
| 20 | +if (!empty($_course['language'])) { |
|
| 21 | + $resource_linker_file = api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php'; |
|
| 22 | 22 | if (file_exists($resource_linker_file)) { |
| 23 | 23 | require_once $resource_linker_file; |
| 24 | 24 | } |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | 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>"; |
| 48 | 48 | } |
| 49 | 49 | if ($level && $level != 0 && $level != 1) { |
| 50 | - $folder_up=$folder; |
|
| 51 | - $folder_temp=explode('/',$folder); |
|
| 52 | - $last=count($folder_temp)-1; |
|
| 50 | + $folder_up = $folder; |
|
| 51 | + $folder_temp = explode('/', $folder); |
|
| 52 | + $last = count($folder_temp) - 1; |
|
| 53 | 53 | unset($folder_temp[$last]); |
| 54 | - $folder_up=implode('/',$folder_temp); |
|
| 54 | + $folder_up = implode('/', $folder_temp); |
|
| 55 | 55 | 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>"; |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $result = Database::query($sql); |
| 89 | 89 | while ($row = Database::fetch_array($result)) { |
| 90 | 90 | if (!$folder) { |
| 91 | - if (get_levels($row['path'])-1 == 1) { |
|
| 91 | + if (get_levels($row['path']) - 1 == 1) { |
|
| 92 | 92 | // showing the right icon. |
| 93 | 93 | if (file_or_folder($row['path'])) { |
| 94 | 94 | echo '<img src="../img/file.gif" align="middle" />'; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | echo "&folder=".substr($row['path'], 1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".substr($row['path'], 1).'</a><br />'; |
| 104 | 104 | } else { |
| 105 | 105 | echo substr($row['path'], 1).' '; |
| 106 | - echo showorhide_addresourcelink('Document',$row['id']); |
|
| 106 | + echo showorhide_addresourcelink('Document', $row['id']); |
|
| 107 | 107 | echo '<br />'; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $level = get_levels($folder) + 1; |
| 114 | 114 | |
| 115 | 115 | // We calculate each level of the database entry. |
| 116 | - $file_level=get_levels($row['path'])-1; |
|
| 116 | + $file_level = get_levels($row['path']) - 1; |
|
| 117 | 117 | // If the level of the database entry is equal to the level we ar in, we put it into an array |
| 118 | 118 | // as this is a potential good entry. |
| 119 | 119 | if ($file_level == $level) { |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | $addedresourceid = $_SESSION['addedresourceid']; |
| 192 | 192 | if ($_SESSION['addedresource']) { |
| 193 | 193 | foreach ($addedresource as $resource_type) { |
| 194 | - $sql="INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES |
|
| 194 | + $sql = "INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES |
|
| 195 | 195 | ($course_id, '$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; |
| 196 | 196 | Database::query($sql); |
| 197 | - $i=key($addedresource); |
|
| 197 | + $i = key($addedresource); |
|
| 198 | 198 | next($addedresource); |
| 199 | 199 | } |
| 200 | - $_SESSION['addedresource']=''; |
|
| 201 | - $_SESSION['addedresourceid']=''; |
|
| 200 | + $_SESSION['addedresource'] = ''; |
|
| 201 | + $_SESSION['addedresourceid'] = ''; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
@@ -278,21 +278,21 @@ discard block |
||
| 278 | 278 | $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
| 279 | 279 | $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
| 280 | 280 | $myrow = Database::fetch_array($result); |
| 281 | - $pathname = explode('/',$myrow['path']); // Making a correct name for the link. |
|
| 282 | - $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 283 | - $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 281 | + $pathname = explode('/', $myrow['path']); // Making a correct name for the link. |
|
| 282 | + $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 283 | + $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 284 | 284 | $image = choose_image($filename); |
| 285 | 285 | $ext = explode('.', $filename); |
| 286 | - $ext = strtolower($ext[sizeof($ext)-1]); |
|
| 286 | + $ext = strtolower($ext[sizeof($ext) - 1]); |
|
| 287 | 287 | $myrow['path'] = rawurlencode($myrow['path']); |
| 288 | 288 | |
| 289 | - $array_ext=array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); |
|
| 289 | + $array_ext = array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png'); |
|
| 290 | 290 | |
| 291 | - if (api_browser_support('svg')){ |
|
| 292 | - $array_ext[]='svg'; |
|
| 291 | + if (api_browser_support('svg')) { |
|
| 292 | + $array_ext[] = 'svg'; |
|
| 293 | 293 | } |
| 294 | - if (api_browser_support('ogg')){ |
|
| 295 | - $array_ext[]='ogg'; |
|
| 294 | + if (api_browser_support('ogg')) { |
|
| 295 | + $array_ext[] = 'ogg'; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | $in_frames = in_array($ext, $array_ext); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $length = ((($builder == 'builder') && ($icon == 'nolink')) ? 65 : 32); |
| 336 | 336 | |
| 337 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 337 | + if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 338 | 338 | $linktype = $type; |
| 339 | 339 | if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
| 340 | 340 | |
@@ -342,12 +342,12 @@ discard block |
||
| 342 | 342 | switch ($type) { |
| 343 | 343 | case TOOL_CALENDAR_EVENT: |
| 344 | 344 | case 'Agenda': |
| 345 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 345 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 346 | 346 | $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); |
| 347 | 347 | $myrow = Database::fetch_array($result); |
| 348 | 348 | |
| 349 | 349 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 350 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 350 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 351 | 351 | if ($row['title'] != '') { $myrow['title'] = $row['title']; } |
| 352 | 352 | $desc = $row['description']; |
| 353 | 353 | $agenda_id = $row['item_id']; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | if ($icon != 'nolink') { |
| 357 | 357 | if ($completed == 'completed') { |
| 358 | 358 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 359 | - } else { |
|
| 359 | + } else { |
|
| 360 | 360 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 361 | 361 | //echo " "; |
| 362 | 362 | } |
@@ -368,17 +368,17 @@ discard block |
||
| 368 | 368 | if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } |
| 369 | 369 | if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
| 370 | 370 | if ($builder != 'builder') { |
| 371 | - 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>"; |
|
| 371 | + 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>"; |
|
| 372 | 372 | $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"; |
| 373 | 373 | if ($desc != '') { |
| 374 | 374 | if ($icon != 'wrap') { |
| 375 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 375 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 376 | 376 | } else { |
| 377 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 377 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | } else { |
| 381 | - echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>"; |
|
| 381 | + echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>"; |
|
| 382 | 382 | } |
| 383 | 383 | break; |
| 384 | 384 | |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | if ($icon != 'nolink') { |
| 408 | 408 | if ($completed == 'completed') { |
| 409 | 409 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 410 | - } else { |
|
| 410 | + } else { |
|
| 411 | 411 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 412 | 412 | //echo " "; |
| 413 | 413 | } |
@@ -420,26 +420,26 @@ discard block |
||
| 420 | 420 | return(true); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
| 423 | + if ($icon == 'nolink') { return(shorten($title, $length)); } |
|
| 424 | 424 | if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
| 425 | 425 | if ($builder != 'builder') { |
| 426 | - 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>"; |
|
| 426 | + 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>"; |
|
| 427 | 427 | $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"; |
| 428 | 428 | if ($desc != '') { |
| 429 | 429 | if ($icon != 'wrap') { |
| 430 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 430 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 431 | 431 | } else { |
| 432 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 432 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | } else { |
| 436 | - echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title, ($length-3*$level))."</a>"; |
|
| 436 | + echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title, ($length - 3 * $level))."</a>"; |
|
| 437 | 437 | } |
| 438 | 438 | break; |
| 439 | 439 | |
| 440 | 440 | case TOOL_LINK: |
| 441 | 441 | case 'Link': |
| 442 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 442 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 443 | 443 | $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
| 444 | 444 | $myrow = Database::fetch_array($result); |
| 445 | 445 | |
@@ -447,14 +447,14 @@ discard block |
||
| 447 | 447 | $result = Database::query($sql); |
| 448 | 448 | $row = Database::fetch_array($result); |
| 449 | 449 | if ($row['title'] != '') { $myrow['title'] = $row['title']; } |
| 450 | - $desc=$row['description']; |
|
| 450 | + $desc = $row['description']; |
|
| 451 | 451 | echo str_repeat(" >", $level); |
| 452 | 452 | |
| 453 | 453 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "<td>"; } |
| 454 | 454 | if ($icon != 'nolink') { |
| 455 | 455 | if ($completed == 'completed') { |
| 456 | 456 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 457 | - } else { |
|
| 457 | + } else { |
|
| 458 | 458 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 459 | 459 | //echo " "; |
| 460 | 460 | } |
@@ -473,23 +473,23 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | $thelink = $myrow['url']; |
| 475 | 475 | if ($builder != 'builder') { |
| 476 | - 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>"; |
|
| 477 | - $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"; |
|
| 476 | + 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>"; |
|
| 477 | + $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"; |
|
| 478 | 478 | if ($desc != '') { |
| 479 | 479 | if ($icon != 'wrap') { |
| 480 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 480 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 481 | 481 | } else { |
| 482 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 482 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } else { |
| 486 | - echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>"; |
|
| 486 | + echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>"; |
|
| 487 | 487 | } |
| 488 | 488 | break; |
| 489 | 489 | |
| 490 | 490 | case TOOL_QUIZ: |
| 491 | 491 | case 'Exercise': |
| 492 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 492 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 493 | 493 | $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
| 494 | 494 | $myrow = Database::fetch_array($result); |
| 495 | 495 | |
@@ -522,35 +522,35 @@ discard block |
||
| 522 | 522 | if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); } |
| 523 | 523 | if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
| 524 | 524 | if ($builder != 'builder') { |
| 525 | - 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>"; |
|
| 525 | + 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>"; |
|
| 526 | 526 | $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"; |
| 527 | 527 | if ($desc != '') { |
| 528 | 528 | if ($icon != 'wrap') { |
| 529 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 529 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 530 | 530 | } else { |
| 531 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 531 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } else { |
| 535 | - echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow['id']."\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>"; |
|
| 535 | + echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow['id']."\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>"; |
|
| 536 | 536 | } |
| 537 | 537 | break; |
| 538 | 538 | |
| 539 | 539 | case 'hotpotatoes': |
| 540 | 540 | case 'HotPotatoes': |
| 541 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 541 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 542 | 542 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 543 | 543 | $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); |
| 544 | 544 | $myrow = Database::fetch_array($result); |
| 545 | 545 | $path = $myrow['path']; |
| 546 | 546 | $name = GetQuizName($path, $documentPath); |
| 547 | 547 | |
| 548 | - if ($builder == 'builder') { $origin='builder'; } |
|
| 548 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 549 | 549 | // This is needed for the exercise_submit.php can delete the session info about tests. |
| 550 | 550 | |
| 551 | 551 | $sql = "select * from $tbl_lp_item where id=$id_in_path"; |
| 552 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 553 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 552 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 553 | + if ($row['title'] != '') { $name = $row['title']; } |
|
| 554 | 554 | $desc = $row['description']; |
| 555 | 555 | echo str_repeat(" >", $level); |
| 556 | 556 | |
@@ -558,32 +558,32 @@ discard block |
||
| 558 | 558 | if ($icon != 'nolink') { |
| 559 | 559 | if ($completed == 'completed') { |
| 560 | 560 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 561 | - } else { |
|
| 561 | + } else { |
|
| 562 | 562 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 563 | 563 | //echo " "; |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; } |
| 567 | 567 | |
| 568 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 568 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 569 | 569 | |
| 570 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 570 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 571 | 571 | if ($icon == 'icon') { echo "<img src='../img/jqz.jpg' align=\"absmiddle\" alt='hot potatoes'>"; } |
| 572 | 572 | |
| 573 | 573 | $cid = $_course['official_code']; |
| 574 | 574 | |
| 575 | 575 | if ($builder != 'builder') { |
| 576 | - 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>"; |
|
| 576 | + 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>"; |
|
| 577 | 577 | $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"; |
| 578 | 578 | if ($desc != '') { |
| 579 | 579 | if ($icon != 'wrap') { |
| 580 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 580 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 581 | 581 | } else { |
| 582 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 582 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 583 | 583 | } |
| 584 | 584 | } |
| 585 | 585 | } else { |
| 586 | - echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 586 | + echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 587 | 587 | } |
| 588 | 588 | break; |
| 589 | 589 | |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $myrow = Database::fetch_array($result); |
| 595 | 595 | |
| 596 | 596 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 597 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 597 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 598 | 598 | if ($row['title'] != '') { $myrow["forum_name"] = $row['title']; } |
| 599 | 599 | $desc = $row['description']; |
| 600 | 600 | echo str_repeat(" >", $level); |
@@ -603,30 +603,30 @@ discard block |
||
| 603 | 603 | if ($icon != 'nolink') { |
| 604 | 604 | if ($completed == 'completed') { |
| 605 | 605 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 606 | - } else { |
|
| 606 | + } else { |
|
| 607 | 607 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 608 | 608 | //echo " "; |
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; } |
| 612 | 612 | |
| 613 | - if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 613 | + if ($myrow["forum_name"] == '') { $type = "Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 614 | 614 | |
| 615 | 615 | if ($icon == 'nolink') { return(shorten($myrow['forum_name'], $length)); } |
| 616 | 616 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 617 | 617 | $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
| 618 | 618 | if ($builder != 'builder') { |
| 619 | - 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>"; |
|
| 619 | + 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>"; |
|
| 620 | 620 | $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"; |
| 621 | 621 | if ($desc != '') { |
| 622 | 622 | if ($icon != 'wrap') { |
| 623 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 623 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 624 | 624 | } else { |
| 625 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 625 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 626 | 626 | } |
| 627 | 627 | } |
| 628 | 628 | } else { |
| 629 | - echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 629 | + echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"], ($length - 3 * $level))."</a>"; |
|
| 630 | 630 | } |
| 631 | 631 | break; |
| 632 | 632 | |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | $myrow = Database::fetch_array($result); |
| 639 | 639 | |
| 640 | 640 | $sql = "select * from $tbl_lp_item where id=$id_in_path"; |
| 641 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 641 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 642 | 642 | if ($row['title'] != '') { $myrow['topic_title'] = $row['title']; } |
| 643 | 643 | $desc = $row['description']; |
| 644 | 644 | echo str_repeat(" >", $level); |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | if ($icon != 'nolink') { |
| 648 | 648 | if ($completed == 'completed') { |
| 649 | 649 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 650 | - } else { |
|
| 650 | + } else { |
|
| 651 | 651 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 652 | 652 | //echo " "; |
| 653 | 653 | } |
@@ -659,17 +659,17 @@ discard block |
||
| 659 | 659 | if ($icon == 'nolink') { return(shorten($myrow['topic_title'], $length)); } |
| 660 | 660 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 661 | 661 | if ($builder != 'builder') { |
| 662 | - 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>"; |
|
| 662 | + 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>"; |
|
| 663 | 663 | $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"; |
| 664 | 664 | if ($desc != '') { |
| 665 | 665 | if ($icon != 'wrap') { |
| 666 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 666 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 667 | 667 | } else { |
| 668 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 668 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | } else { |
| 672 | - 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>"; |
|
| 672 | + 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>"; |
|
| 673 | 673 | } |
| 674 | 674 | break; |
| 675 | 675 | |
@@ -684,13 +684,13 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 686 | 686 | $result = Database::query($sql); |
| 687 | - $row=Database::fetch_array($result); |
|
| 687 | + $row = Database::fetch_array($result); |
|
| 688 | 688 | if ($row['title'] != '') { $myrow['post_title'] = $row['title']; } |
| 689 | 689 | $desc = $row['description']; |
| 690 | 690 | echo str_repeat(" >", $level); |
| 691 | 691 | |
| 692 | - $posternom = $myrow['nom']; $posterprenom = $myrow['prenom']; |
|
| 693 | - $posttime = $myrow['post_time']; $posttext = $myrow['post_text']; |
|
| 692 | + $posternom = $myrow['nom']; $posterprenom = $myrow['prenom']; |
|
| 693 | + $posttime = $myrow['post_time']; $posttext = $myrow['post_text']; |
|
| 694 | 694 | $posttitle = $myrow['post_title']; |
| 695 | 695 | $posttext = str_replace('"', "'", $posttext); |
| 696 | 696 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | if ($icon != 'nolink') { |
| 699 | 699 | if ($completed == 'completed') { |
| 700 | 700 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 701 | - } else { |
|
| 701 | + } else { |
|
| 702 | 702 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 703 | 703 | //echo " "; |
| 704 | 704 | } |
@@ -710,19 +710,19 @@ discard block |
||
| 710 | 710 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - if ($icon == 'nolink') { return(shorten($myrow["post_title"],$length)); } |
|
| 713 | + if ($icon == 'nolink') { return(shorten($myrow["post_title"], $length)); } |
|
| 714 | 714 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 715 | 715 | if ($builder != 'builder') { |
| 716 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval($_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["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".intval($_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"; |
|
| 716 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval($_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["post_title"], ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".intval($_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"; |
|
| 717 | 717 | if ($desc != '') { |
| 718 | 718 | if ($icon != 'wrap') { |
| 719 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 719 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 720 | 720 | } else { |
| 721 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 721 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | 724 | } else { |
| 725 | - echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["post_title"],($length-3*$level))."</a>"; |
|
| 725 | + echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["post_title"], ($length - 3 * $level))."</a>"; |
|
| 726 | 726 | } |
| 727 | 727 | break; |
| 728 | 728 | |
@@ -735,14 +735,14 @@ discard block |
||
| 735 | 735 | $myrow = Database::fetch_array($result); |
| 736 | 736 | |
| 737 | 737 | $pathname = explode('/', $myrow['path']); // Making a correct name for the link. |
| 738 | - $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 739 | - $filename=$pathname[$last]; // Making a correct name for the link. |
|
| 738 | + $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 739 | + $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 740 | 740 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "<td>"; } |
| 741 | 741 | |
| 742 | 742 | echo str_repeat(" >", $level); |
| 743 | 743 | |
| 744 | 744 | if ($icon != 'nolink') { |
| 745 | - if ($completed=='completed') { |
|
| 745 | + if ($completed == 'completed') { |
|
| 746 | 746 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 747 | 747 | } else { |
| 748 | 748 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
@@ -754,9 +754,9 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | $sql = "select * from $tbl_lp_item where id=$id_in_path"; |
| 756 | 756 | //error_log('New LP - Querying lp_item table: '.$sql, 0); |
| 757 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 757 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 758 | 758 | if ($row['title'] != '') { $filename = $row['title']; } |
| 759 | - $desc=$row['description']; |
|
| 759 | + $desc = $row['description']; |
|
| 760 | 760 | |
| 761 | 761 | if (($myrow['path'] == '') && ($filename == '')) { |
| 762 | 762 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
@@ -767,22 +767,22 @@ discard block |
||
| 767 | 767 | if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
| 768 | 768 | if ($builder != 'builder') |
| 769 | 769 | { |
| 770 | - 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>"; |
|
| 770 | + 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>"; |
|
| 771 | 771 | if ($desc != '') { |
| 772 | 772 | if ($icon != 'wrap') { |
| 773 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 773 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 774 | 774 | } else { |
| 775 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 775 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 776 | 776 | } |
| 777 | 777 | } $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"; |
| 778 | 778 | } else { |
| 779 | - $enableDocumentParsing=yes; |
|
| 779 | + $enableDocumentParsing = yes; |
|
| 780 | 780 | if (!$enableDocumentParsing) { |
| 781 | 781 | // This is the solution for the non-parsing version in the builder. |
| 782 | 782 | $file = urlencode($myrow['path']); |
| 783 | - echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 783 | + echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename, ($length - 3 * $level))."</a>"; |
|
| 784 | 784 | } else { |
| 785 | - echo "<a href=\"../document/download.php?doc_url=".$myrow['path']."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 785 | + echo "<a href=\"../document/download.php?doc_url=".$myrow['path']."\" class='$completed' $hyperlink_target_parameter>".shorten($filename, ($length - 3 * $level))."</a>"; |
|
| 786 | 786 | } |
| 787 | 787 | } |
| 788 | 788 | break; |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 794 | 794 | $result = Database::query($sql); |
| 795 | 795 | $row = Database::fetch_array($result); |
| 796 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 796 | + if ($row['title'] != '') { $name = $row['title']; } |
|
| 797 | 797 | $desc = $row['description']; |
| 798 | 798 | echo str_repeat(" >", $level); |
| 799 | 799 | |
@@ -801,30 +801,30 @@ discard block |
||
| 801 | 801 | if ($icon != 'nolink') { |
| 802 | 802 | if ($completed == 'completed') { |
| 803 | 803 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 804 | - } else { |
|
| 804 | + } else { |
|
| 805 | 805 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 806 | 806 | //echo " "; |
| 807 | 807 | } |
| 808 | 808 | } |
| 809 | 809 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; } |
| 810 | 810 | |
| 811 | - if ($name=='') { |
|
| 811 | + if ($name == '') { |
|
| 812 | 812 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | if ($icon == 'nolink') { return(shorten($name, $length)); } |
| 816 | 816 | if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
| 817 | 817 | if ($builder != 'builder') { |
| 818 | - 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"; |
|
| 818 | + 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"; |
|
| 819 | 819 | if ($desc != '') { |
| 820 | 820 | if ($icon != 'wrap') { |
| 821 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; |
|
| 821 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 822 | 822 | } else { |
| 823 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; |
|
| 823 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | 826 | } else { |
| 827 | - echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 827 | + echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 828 | 828 | } |
| 829 | 829 | break; |
| 830 | 830 | |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | if ($icon != 'nolink') { |
| 843 | 843 | if ($completed == 'completed') { |
| 844 | 844 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 845 | - } else { |
|
| 845 | + } else { |
|
| 846 | 846 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 847 | 847 | //echo " "; |
| 848 | 848 | } |
@@ -855,15 +855,15 @@ discard block |
||
| 855 | 855 | if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
| 856 | 856 | |
| 857 | 857 | if ($builder != 'builder') { |
| 858 | - 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"; |
|
| 858 | + 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"; |
|
| 859 | 859 | if ($desc != '') { |
| 860 | 860 | if ($icon != 'wrap') { |
| 861 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 861 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 862 | 862 | else { |
| 863 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
|
| 863 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 864 | 864 | } |
| 865 | 865 | } else { |
| 866 | - echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 866 | + echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 867 | 867 | } |
| 868 | 868 | break; |
| 869 | 869 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | case 'Introduction_text': |
| 872 | 872 | $name = get_lang('IntroductionText'); |
| 873 | 873 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 874 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 874 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 875 | 875 | if ($row['title'] != '') { $name = $row['title']; } |
| 876 | 876 | $desc = $row['description']; |
| 877 | 877 | echo str_repeat(" >", $level); |
@@ -893,17 +893,17 @@ discard block |
||
| 893 | 893 | if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
| 894 | 894 | |
| 895 | 895 | if ($builder != 'builder') { |
| 896 | - 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>"; |
|
| 896 | + 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>"; |
|
| 897 | 897 | $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"; |
| 898 | 898 | if ($desc != '') { |
| 899 | 899 | if ($icon != 'wrap') { |
| 900 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 900 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 901 | 901 | else { |
| 902 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
|
| 902 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 903 | 903 | } |
| 904 | 904 | } else { |
| 905 | 905 | $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
| 906 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 906 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 907 | 907 | } |
| 908 | 908 | break; |
| 909 | 909 | |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | case 'Course_description': |
| 912 | 912 | $name = get_lang('CourseDescription'); |
| 913 | 913 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 914 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 914 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 915 | 915 | if ($row['title'] != '') { $name = $row['title']; } |
| 916 | 916 | $desc = $row['description']; |
| 917 | 917 | echo str_repeat(" >", $level); |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | if ($icon != 'nolink') { |
| 921 | 921 | if ($completed == 'completed') { |
| 922 | 922 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 923 | - } else { |
|
| 923 | + } else { |
|
| 924 | 924 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 925 | 925 | //echo " "; |
| 926 | 926 | } |
@@ -929,20 +929,20 @@ discard block |
||
| 929 | 929 | |
| 930 | 930 | if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
| 931 | 931 | |
| 932 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 932 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 933 | 933 | if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
| 934 | 934 | |
| 935 | 935 | if ($builder != 'builder') { |
| 936 | - 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"; |
|
| 936 | + 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"; |
|
| 937 | 937 | if ($desc != '') { |
| 938 | 938 | if ($icon != 'wrap') { |
| 939 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 939 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 940 | 940 | else { |
| 941 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
|
| 941 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 942 | 942 | } |
| 943 | 943 | } else { |
| 944 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 945 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 944 | + $s = api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 945 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 946 | 946 | } |
| 947 | 947 | break; |
| 948 | 948 | |
@@ -952,7 +952,7 @@ discard block |
||
| 952 | 952 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 953 | 953 | $result = Database::query($sql); |
| 954 | 954 | $row = Database::fetch_array($result); |
| 955 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 955 | + if ($row['title'] != '') { $name = $row['title']; } |
|
| 956 | 956 | $desc = $row['description']; |
| 957 | 957 | echo str_repeat(" >", $level); |
| 958 | 958 | |
@@ -967,21 +967,21 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; } |
| 969 | 969 | |
| 970 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 970 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 971 | 971 | |
| 972 | 972 | if ($icon == 'nolink') { return(shorten($name, $length)); } |
| 973 | 973 | if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
| 974 | 974 | |
| 975 | 975 | if ($builder != 'builder') { |
| 976 | - 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"; |
|
| 976 | + 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"; |
|
| 977 | 977 | if ($desc != '') { |
| 978 | 978 | if ($icon != 'wrap') { |
| 979 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 979 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 980 | 980 | else { |
| 981 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
|
| 981 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 982 | 982 | } |
| 983 | 983 | } else { |
| 984 | - echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 984 | + echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 985 | 985 | } |
| 986 | 986 | break; |
| 987 | 987 | |
@@ -1006,21 +1006,21 @@ discard block |
||
| 1006 | 1006 | } |
| 1007 | 1007 | if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; } |
| 1008 | 1008 | |
| 1009 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1009 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1010 | 1010 | |
| 1011 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1011 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 1012 | 1012 | if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
| 1013 | 1013 | |
| 1014 | 1014 | if ($builder != 'builder') { |
| 1015 | - 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"; |
|
| 1015 | + 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"; |
|
| 1016 | 1016 | if ($desc != '') { |
| 1017 | 1017 | if ($icon != 'wrap') { |
| 1018 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length-3*$level))."</div></td></tr>"; } |
|
| 1018 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 1019 | 1019 | else { |
| 1020 | - echo "<div class='description'> ".shorten($desc, ($length-3*$level))."</div>"; } |
|
| 1020 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 1021 | 1021 | } |
| 1022 | 1022 | } else { |
| 1023 | - echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>"; |
|
| 1023 | + echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 1024 | 1024 | } |
| 1025 | 1025 | break; |
| 1026 | 1026 | }//end huge switch-statement |
@@ -1059,7 +1059,7 @@ discard block |
||
| 1059 | 1059 | $myrow = Database::fetch_array($result); |
| 1060 | 1060 | |
| 1061 | 1061 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1062 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1062 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1063 | 1063 | if ($row['title'] != '') { $myrow['title'] = $row['title']; } |
| 1064 | 1064 | $desc = $row['description']; |
| 1065 | 1065 | $agenda_id = $row['item_id']; |
@@ -1084,7 +1084,7 @@ discard block |
||
| 1084 | 1084 | break; |
| 1085 | 1085 | |
| 1086 | 1086 | case 'Link': |
| 1087 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 1087 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 1088 | 1088 | $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
| 1089 | 1089 | $myrow = Database::fetch_array($result); |
| 1090 | 1090 | |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | break; |
| 1102 | 1102 | |
| 1103 | 1103 | case 'Exercise': |
| 1104 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1104 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1105 | 1105 | $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
| 1106 | 1106 | $myrow = Database::fetch_array($result); |
| 1107 | 1107 | |
@@ -1109,7 +1109,7 @@ discard block |
||
| 1109 | 1109 | // This is needed for the exercise_submit.php can delete the session info about tests. |
| 1110 | 1110 | |
| 1111 | 1111 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1112 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1112 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1113 | 1113 | if ($row['title'] != '') { $myrow['title'] = $row['title']; } |
| 1114 | 1114 | |
| 1115 | 1115 | if ($builder != 'builder') { |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | } |
| 1120 | 1120 | break; |
| 1121 | 1121 | case 'HotPotatoes': |
| 1122 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1122 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1123 | 1123 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
| 1124 | 1124 | $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); |
| 1125 | 1125 | $myrow = Database::fetch_array($result); |
@@ -1137,14 +1137,14 @@ discard block |
||
| 1137 | 1137 | break; |
| 1138 | 1138 | case 'Forum': |
| 1139 | 1139 | //deprecated |
| 1140 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); // TODO: This is the old table name, it should be corrected. |
|
| 1140 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); // TODO: This is the old table name, it should be corrected. |
|
| 1141 | 1141 | $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); |
| 1142 | 1142 | $myrow = Database::fetch_array($result); |
| 1143 | 1143 | |
| 1144 | 1144 | if ($builder == 'builder') { $origin = 'builder'; } |
| 1145 | 1145 | |
| 1146 | 1146 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1147 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1147 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1148 | 1148 | if ($row['title'] != '') { $myrow['forum_name'] = $row['title']; } |
| 1149 | 1149 | |
| 1150 | 1150 | if ($myrow['forum_name'] == '') { $type = 'Forum'; } |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | $myrow = Database::fetch_array($result); |
| 1168 | 1168 | |
| 1169 | 1169 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1170 | - $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1170 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1171 | 1171 | |
| 1172 | 1172 | if ($builder != 'builder') { |
| 1173 | 1173 | $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"; |
@@ -1191,8 +1191,8 @@ discard block |
||
| 1191 | 1191 | $desc = $row['description']; |
| 1192 | 1192 | //$link .= str_repeat(" >", $level); |
| 1193 | 1193 | |
| 1194 | - $posternom = $myrow['nom']; $posterprenom = $myrow['prenom']; |
|
| 1195 | - $posttime = $myrow['post_time']; $posttext = $myrow['post_text']; |
|
| 1194 | + $posternom = $myrow['nom']; $posterprenom = $myrow['prenom']; |
|
| 1195 | + $posttime = $myrow['post_time']; $posttext = $myrow['post_text']; |
|
| 1196 | 1196 | $posttitle = $myrow['post_title']; |
| 1197 | 1197 | $posttext = str_replace('"', "'", $posttext); |
| 1198 | 1198 | |
@@ -1209,8 +1209,8 @@ discard block |
||
| 1209 | 1209 | $myrow = Database::fetch_array($result); |
| 1210 | 1210 | |
| 1211 | 1211 | $pathname = explode('/', $myrow['path']); // Making a correct name for the link. |
| 1212 | - $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1213 | - $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1212 | + $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1213 | + $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1214 | 1214 | |
| 1215 | 1215 | $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path"; |
| 1216 | 1216 | $result = Database::query($sql); |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | unset($addedresource[$resource_key]); |
| 1289 | 1289 | unset($addedresourceid[$resource_key]); |
| 1290 | 1290 | $_SESSION['addedresource'] = $addedresource; |
| 1291 | - $_SESSION['addedresourceid'] = $addedresourceid ; |
|
| 1291 | + $_SESSION['addedresourceid'] = $addedresourceid; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | /** |
@@ -1363,11 +1363,11 @@ discard block |
||
| 1363 | 1363 | |
| 1364 | 1364 | $sql = "SELECT * FROM $TABLERESOURCE |
| 1365 | 1365 | WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
| 1366 | - $result=Database::query($sql); |
|
| 1367 | - while ($row=Database::fetch_array($result)) |
|
| 1366 | + $result = Database::query($sql); |
|
| 1367 | + while ($row = Database::fetch_array($result)) |
|
| 1368 | 1368 | { |
| 1369 | - $addedresource[]=$row["resource_type"]; |
|
| 1370 | - $addedresourceid[]=$row["resource_id"]; |
|
| 1369 | + $addedresource[] = $row["resource_type"]; |
|
| 1370 | + $addedresourceid[] = $row["resource_id"]; |
|
| 1371 | 1371 | } |
| 1372 | 1372 | $_SESSION['addedresource'] = $addedresource; |
| 1373 | 1373 | $_SESSION['addedresourceid'] = $addedresourceid; |
@@ -1413,11 +1413,11 @@ discard block |
||
| 1413 | 1413 | |
| 1414 | 1414 | $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'"; |
| 1415 | 1415 | $result = Database::query($sql); |
| 1416 | - while ($row=Database::fetch_array($result)) { |
|
| 1416 | + while ($row = Database::fetch_array($result)) { |
|
| 1417 | 1417 | if ($origin != 'learnpath') { |
| 1418 | - display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1418 | + display_addedresource_link($row['resource_type'], $row['resource_id'], $style); |
|
| 1419 | 1419 | } else { |
| 1420 | - display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1420 | + display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'], 'agendaitems', '', 'builder', 'icon'); echo "<br>"; |
|
| 1421 | 1421 | } |
| 1422 | 1422 | } |
| 1423 | 1423 | } |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | |
| 1480 | 1480 | if (is_array($_SESSION['addedresource'])) { |
| 1481 | 1481 | foreach ($addedresource as $toolcompare) { |
| 1482 | - if ($toolcompare==$type && $addedresourceid[key($addedresource)] == $id) { |
|
| 1482 | + if ($toolcompare == $type && $addedresourceid[key($addedresource)] == $id) { |
|
| 1483 | 1483 | $show = 0; |
| 1484 | 1484 | } |
| 1485 | 1485 | next($addedresource); |
@@ -1513,7 +1513,7 @@ discard block |
||
| 1513 | 1513 | * @param boolean Open in a new window (true) or in the current frame/window (false)? |
| 1514 | 1514 | * @todo use the constants for the type definitions. |
| 1515 | 1515 | */ |
| 1516 | -function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_window = true) { |
|
| 1516 | +function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_window = true) { |
|
| 1517 | 1517 | $_course = api_get_course_info($course_code); |
| 1518 | 1518 | |
| 1519 | 1519 | $course_id = api_get_course_int_id(); |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | case TOOL_THREAD: //=topics |
| 1560 | 1560 | //$tbl_forum = Database::get_course_table(TABLE_FORUM); |
| 1561 | 1561 | //$tbl_thread = Database::get_course_table(TABLE_FORUM_THREAD); |
| 1562 | - $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
| 1562 | + $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
| 1563 | 1563 | // grabbing the title of the post |
| 1564 | 1564 | $sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id; |
| 1565 | 1565 | $result_title = Database::query($sql_title); |
@@ -1579,8 +1579,8 @@ discard block |
||
| 1579 | 1579 | $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id"); |
| 1580 | 1580 | $myrow = Database::fetch_array($result); |
| 1581 | 1581 | $pathname = explode('/', $myrow['path']); // Making a correct name for the link. |
| 1582 | - $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1583 | - $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1582 | + $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1583 | + $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1584 | 1584 | $image = choose_image($filename); |
| 1585 | 1585 | $ext = explode('.', $filename); |
| 1586 | 1586 | $ext = strtolower($ext[sizeof($ext) - 1]); |
@@ -1656,8 +1656,8 @@ discard block |
||
| 1656 | 1656 | if (!empty($id)) { |
| 1657 | 1657 | $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
| 1658 | 1658 | $sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"; |
| 1659 | - $result= Database::query($sql); |
|
| 1660 | - $myrow=Database::fetch_array($result); |
|
| 1659 | + $result = Database::query($sql); |
|
| 1660 | + $myrow = Database::fetch_array($result); |
|
| 1661 | 1661 | if ($row_item['title'] != '') { |
| 1662 | 1662 | $myrow['title'] = $row_item['title']; |
| 1663 | 1663 | } |
@@ -1669,8 +1669,8 @@ discard block |
||
| 1669 | 1669 | $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id"); |
| 1670 | 1670 | $myrow = Database::fetch_array($result); |
| 1671 | 1671 | $path = $myrow['path']; |
| 1672 | - $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.'' . |
|
| 1673 | - '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' . |
|
| 1672 | + $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.''. |
|
| 1673 | + '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().''. |
|
| 1674 | 1674 | '&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId; |
| 1675 | 1675 | break; |
| 1676 | 1676 | case TOOL_FORUM: |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id"; |
| 1683 | 1683 | $result = Database::query($sql); |
| 1684 | 1684 | $myrow = Database::fetch_array($result); |
| 1685 | - $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' . |
|
| 1685 | + $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.''. |
|
| 1686 | 1686 | '&forum='.$myrow['forum_id'].'&lp=true'; |
| 1687 | 1687 | } |
| 1688 | 1688 | break; |
@@ -1698,14 +1698,14 @@ discard block |
||
| 1698 | 1698 | $posttitle = $title; |
| 1699 | 1699 | $posttext = str_replace('"', "'", $posttext); |
| 1700 | 1700 | |
| 1701 | - $link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' . |
|
| 1702 | - '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' . |
|
| 1701 | + $link .= $main_dir_path.'forum/viewthread.php?post='.$id.''. |
|
| 1702 | + '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].''. |
|
| 1703 | 1703 | '&lp=true'; |
| 1704 | 1704 | break; |
| 1705 | 1705 | case TOOL_DOCUMENT: |
| 1706 | 1706 | $document = $em |
| 1707 | 1707 | ->getRepository('ChamiloCourseBundle:CDocument') |
| 1708 | - ->findOneBy(['cId' => $course_id, 'id' => $id]); |
|
| 1708 | + ->findOneBy(['cId' => $course_id, 'id' => $id]); |
|
| 1709 | 1709 | |
| 1710 | 1710 | if (!$document) { |
| 1711 | 1711 | break; |
@@ -1717,9 +1717,9 @@ discard block |
||
| 1717 | 1717 | $showDirectUrl = !in_array($extension, $jplayer_supported_files); |
| 1718 | 1718 | |
| 1719 | 1719 | if ($showDirectUrl) { |
| 1720 | - $link = $main_course_path . 'document' . $document->getPath() . '?' . api_get_cidreq(); |
|
| 1720 | + $link = $main_course_path.'document'.$document->getPath().'?'.api_get_cidreq(); |
|
| 1721 | 1721 | } else { |
| 1722 | - $link = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?' . http_build_query([ |
|
| 1722 | + $link = api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.http_build_query([ |
|
| 1723 | 1723 | 'cidReq' => $course_code, |
| 1724 | 1724 | 'id' => $id, |
| 1725 | 1725 | 'origin' => 'learnpathitem' |
@@ -1728,8 +1728,8 @@ discard block |
||
| 1728 | 1728 | |
| 1729 | 1729 | $openmethod = 2; |
| 1730 | 1730 | $officedoc = false; |
| 1731 | - Session::write('openmethod',$openmethod); |
|
| 1732 | - Session::write('officedoc',$officedoc); |
|
| 1731 | + Session::write('openmethod', $openmethod); |
|
| 1732 | + Session::write('officedoc', $officedoc); |
|
| 1733 | 1733 | break; |
| 1734 | 1734 | case TOOL_LP_FINAL_ITEM: |
| 1735 | 1735 | $link .= api_get_path(WEB_CODE_PATH).'newscorm/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learnpath_id; |
@@ -1856,8 +1856,8 @@ discard block |
||
| 1856 | 1856 | $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id"); |
| 1857 | 1857 | $myrow = Database::fetch_array($result); |
| 1858 | 1858 | $pathname = explode('/', $myrow['path']); // Making a correct name for the link. |
| 1859 | - $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1860 | - $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1859 | + $last = count($pathname) - 1; // Making a correct name for the link. |
|
| 1860 | + $filename = $pathname[$last]; // Making a correct name for the link. |
|
| 1861 | 1861 | $image = choose_image($filename); |
| 1862 | 1862 | $ext = explode('.', $filename); |
| 1863 | 1863 | $ext = strtolower($ext[sizeof($ext) - 1]); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param int $userMaxScore |
| 272 | 272 | * @param int $sessionId |
| 273 | 273 | * |
| 274 | - * @return bool Returns -1 on error |
|
| 274 | + * @return boolean|null Returns -1 on error |
|
| 275 | 275 | */ |
| 276 | 276 | public function import_manifest($courseCode, $userMaxScore = 1, $sessionId = 0, $userId = 0) |
| 277 | 277 | { |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | * @param string course Code |
| 926 | 926 | * @param string LP ID (in database) |
| 927 | 927 | * @param string Manifest file path (optional if lp_id defined) |
| 928 | - * @return integer New LP ID or false on failure |
|
| 928 | + * @return boolean New LP ID or false on failure |
|
| 929 | 929 | * TODO @TODO Implement imsmanifest_path parameter |
| 930 | 930 | */ |
| 931 | 931 | public function reimport_manifest($courseCode, $lp_id = null, $imsmanifest_path = '') |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $path = ''; |
| 394 | 394 | $type = 'dir'; |
| 395 | 395 | if (isset($this->resources[$item['identifierref']])) { |
| 396 | - $oRes =& $this->resources[$item['identifierref']]; |
|
| 396 | + $oRes = & $this->resources[$item['identifierref']]; |
|
| 397 | 397 | $path = @$oRes->get_path(); |
| 398 | 398 | if (!empty($path)) { |
| 399 | 399 | $temptype = $oRes->get_scorm_type(); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $item['parameters'] = Database::escape_string($item['parameters']); |
| 445 | 445 | |
| 446 | 446 | $sql = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,launch_data, parameters) |
| 447 | - VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'] .", '".$item['datafromlms']."', '".$item['parameters']."' )"; |
|
| 447 | + VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'].", '".$item['datafromlms']."', '".$item['parameters']."' )"; |
|
| 448 | 448 | |
| 449 | 449 | Database::query($sql); |
| 450 | 450 | if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting item : '.$sql, 0); } |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | foreach ($specific_fields as $specific_field) { |
| 479 | 479 | if (isset($_REQUEST[$specific_field['code']])) { |
| 480 | 480 | $sterms = trim($_REQUEST[$specific_field['code']]); |
| 481 | - $all_specific_terms .= ' '. $sterms; |
|
| 481 | + $all_specific_terms .= ' '.$sterms; |
|
| 482 | 482 | if (!empty($sterms)) { |
| 483 | 483 | $sterms = explode(',', $sterms); |
| 484 | 484 | foreach ($sterms as $sterm) { |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | - $body_to_index = $all_specific_terms .' '. $title; |
|
| 490 | + $body_to_index = $all_specific_terms.' '.$title; |
|
| 491 | 491 | $ic_slide->addValue("content", $body_to_index); |
| 492 | 492 | // TODO: Add a comment to say terms separated by commas. |
| 493 | 493 | $courseid = api_get_course_id(); |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | SE_COURSE_ID => $courseid, |
| 498 | 498 | SE_TOOL_ID => TOOL_LEARNPATH, |
| 499 | 499 | SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => ''), // TODO: Unify with other lp types. |
| 500 | - SE_USER => (int)api_get_user_id(), |
|
| 500 | + SE_USER => (int) api_get_user_id(), |
|
| 501 | 501 | ); |
| 502 | 502 | $ic_slide->xapian_data = serialize($xapian_data); |
| 503 | 503 | $di->addChunk($ic_slide); |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | public function import_package($zip_file_info, $current_dir = '', $courseInfo = array()) |
| 544 | 544 | { |
| 545 | 545 | if ($this->debug > 0) { |
| 546 | - error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method', 0); |
|
| 546 | + error_log('In scorm::import_package('.print_r($zip_file_info, true).',"'.$current_dir.'") method', 0); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo; |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $zip_file_name = $zip_file_info['name']; |
| 555 | 555 | |
| 556 | 556 | if ($this->debug > 1) { |
| 557 | - error_log('New LP - import_package() - zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0); |
|
| 557 | + error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | $course_rel_dir = api_get_course_path($courseInfo['code']).'/scorm'; // scorm dir web path starting from /courses |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/ |
| 563 | 563 | |
| 564 | 564 | if ($this->debug > 1) { |
| 565 | - error_log( 'New LP - import_package() - current_dir = ' . $current_dir, 0); |
|
| 565 | + error_log('New LP - import_package() - current_dir = '.$current_dir, 0); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | // Get name of the zip file without the extension. |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $file_info = pathinfo($zip_file_name); |
| 571 | 571 | $filename = $file_info['basename']; |
| 572 | 572 | $extension = $file_info['extension']; |
| 573 | - $file_base_name = str_replace('.'.$extension,'',$filename); // Filename without its extension. |
|
| 573 | + $file_base_name = str_replace('.'.$extension, '', $filename); // Filename without its extension. |
|
| 574 | 574 | $this->zipname = $file_base_name; // Save for later in case we don't have a title. |
| 575 | 575 | |
| 576 | 576 | if ($this->debug > 1) { error_log("New LP - base file name is : ".$file_base_name, 0); } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $slash_count = substr_count($shortest_path, '/'); |
| 617 | 617 | foreach ($manifest_list as $manifest_path) { |
| 618 | 618 | $tmp_slash_count = substr_count($manifest_path, '/'); |
| 619 | - if ($tmp_slash_count<$slash_count) { |
|
| 619 | + if ($tmp_slash_count < $slash_count) { |
|
| 620 | 620 | $shortest_path = $manifest_path; |
| 621 | 621 | $slash_count = $tmp_slash_count; |
| 622 | 622 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $this->subdir .= '/'.dirname($shortest_path); // Do not concatenate because already done above. |
| 626 | 626 | $manifest = $shortest_path; |
| 627 | 627 | if ($this->debug > 1) { error_log('New LP - Package type is now '.$package_type, 0); } |
| 628 | - if ($package_type== '') { |
|
| 628 | + if ($package_type == '') { |
|
| 629 | 629 | // && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM) |
| 630 | 630 | if ($this->debug > 1) { error_log('New LP - Package type is empty', 0); } |
| 631 | 631 | return api_failure::set_failure('not_scorm_content'); |
@@ -641,8 +641,8 @@ discard block |
||
| 641 | 641 | $new_dir = '/'.$new_dir; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if ($new_dir[strlen($new_dir)-1] == '/') { |
|
| 645 | - $new_dir = substr($new_dir,0,-1); |
|
| 644 | + if ($new_dir[strlen($new_dir) - 1] == '/') { |
|
| 645 | + $new_dir = substr($new_dir, 0, -1); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /* Uncompressing phase */ |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | if ($file != '.' && $file != '..') { |
| 684 | 684 | $filetype = 'file'; |
| 685 | 685 | |
| 686 | - if (is_dir($course_sys_dir . $new_dir . $file)) { |
|
| 686 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
| 687 | 687 | $filetype = 'folder'; |
| 688 | 688 | } |
| 689 | 689 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | } |
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | - @rename($course_sys_dir.$new_dir.$file,$course_sys_dir.$new_dir.$safe_file); |
|
| 715 | + @rename($course_sys_dir.$new_dir.$file, $course_sys_dir.$new_dir.$safe_file); |
|
| 716 | 716 | if ($this->debug >= 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); } |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | if ($this->debug > 0) { error_log('In scorm::get_res_path('.$id.') method', 0); } |
| 902 | 902 | $path = ''; |
| 903 | 903 | if (isset($this->resources[$id])) { |
| 904 | - $oRes =& $this->resources[$id]; |
|
| 904 | + $oRes = & $this->resources[$id]; |
|
| 905 | 905 | $path = @$oRes->get_path(); |
| 906 | 906 | } |
| 907 | 907 | return $path; |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | if ($this->debug > 0) { error_log('In scorm::get_res_type('.$id.') method', 0); } |
| 918 | 918 | $type = ''; |
| 919 | 919 | if (isset($this->resources[$id])) { |
| 920 | - $oRes =& $this->resources[$id]; |
|
| 920 | + $oRes = & $this->resources[$id]; |
|
| 921 | 921 | $temptype = $oRes->get_scorm_type(); |
| 922 | 922 | if (!empty($temptype)) { |
| 923 | 923 | $type = $temptype; |
@@ -936,9 +936,9 @@ discard block |
||
| 936 | 936 | $title = ''; |
| 937 | 937 | if (isset($this->manifest['organizations']['default'])) { |
| 938 | 938 | $title = $this->organizations[$this->manifest['organizations']['default']]->get_name(); |
| 939 | - } elseif (count($this->organizations)==1) { |
|
| 939 | + } elseif (count($this->organizations) == 1) { |
|
| 940 | 940 | // This will only get one title but so we don't need to know the index. |
| 941 | - foreach($this->organizations as $id => $value) { |
|
| 941 | + foreach ($this->organizations as $id => $value) { |
|
| 942 | 942 | $title = $this->organizations[$id]->get_name(); |
| 943 | 943 | break; |
| 944 | 944 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * This function retrieves the existing permissions of a user, group or role. |
| 121 | -* @param $content are we retrieving the rights of a user, a group or a role (the database depends on it) |
|
| 121 | +* @param string $content are we retrieving the rights of a user, a group or a role (the database depends on it) |
|
| 122 | 122 | * @param $id the id of the user, group or role |
| 123 | 123 | * @author Patrick Cool <[email protected]>, Ghent University |
| 124 | 124 | * @version 1.0 |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | /** |
| 528 | 528 | * This function gets all the roles that are defined |
| 529 | -* @param $content are we finding the roles for a user or a group (the database depends on it) |
|
| 529 | +* @param string $content are we finding the roles for a user or a group (the database depends on it) |
|
| 530 | 530 | * @param $id the id of the user or group |
| 531 | 531 | * @param string Deprecated parameter allowing use of 'platform' scope - the corresponding tables don't exist anymore so the scope is always set to 'course' |
| 532 | 532 | * @return array that contains the name of the roles the user has |
@@ -132,24 +132,20 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $table=Database::get_course_table(TABLE_PERMISSION_USER); |
| 134 | 134 | $id_field = 'user_id'; |
| 135 | - } |
|
| 136 | - elseif ($content == 'group') |
|
| 135 | + } elseif ($content == 'group') |
|
| 137 | 136 | { |
| 138 | 137 | $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
| 139 | 138 | $id_field = 'group_id'; |
| 140 | - } |
|
| 141 | - elseif ($content == 'role') |
|
| 139 | + } elseif ($content == 'role') |
|
| 142 | 140 | { |
| 143 | 141 | $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
| 144 | 142 | $id_field = 'role_id'; |
| 145 | - } |
|
| 146 | - elseif ($content == 'platform_role') |
|
| 143 | + } elseif ($content == 'platform_role') |
|
| 147 | 144 | { |
| 148 | 145 | $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
| 149 | 146 | $id_field = 'role_id'; |
| 150 | 147 | $course_id_condition = ''; |
| 151 | - } |
|
| 152 | - elseif ($content == 'task') |
|
| 148 | + } elseif ($content == 'task') |
|
| 153 | 149 | { |
| 154 | 150 | $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
| 155 | 151 | $id_field = 'task_id'; |
@@ -162,8 +158,9 @@ discard block |
||
| 162 | 158 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
| 163 | 159 | $result = Database::query($sql); |
| 164 | 160 | |
| 165 | - while($row = Database::fetch_array($result)) |
|
| 166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
| 161 | + while($row = Database::fetch_array($result)) { |
|
| 162 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
| 163 | + } |
|
| 167 | 164 | |
| 168 | 165 | return $currentpermissions; |
| 169 | 166 | } |
@@ -321,14 +318,12 @@ discard block |
||
| 321 | 318 | if ($course_admin) |
| 322 | 319 | { |
| 323 | 320 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 324 | - } |
|
| 325 | - else |
|
| 321 | + } else |
|
| 326 | 322 | { |
| 327 | 323 | if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
| 328 | 324 | { |
| 329 | 325 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 330 | - } |
|
| 331 | - else |
|
| 326 | + } else |
|
| 332 | 327 | { |
| 333 | 328 | if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
| 334 | 329 | { |
@@ -439,8 +434,7 @@ discard block |
||
| 439 | 434 | $checked='checked'; |
| 440 | 435 | $image='checkbox_on2.gif'; |
| 441 | 436 | $action='revoke'; |
| 442 | - } |
|
| 443 | - else |
|
| 437 | + } else |
|
| 444 | 438 | { |
| 445 | 439 | $checked=''; |
| 446 | 440 | $image='wrong.gif'; |
@@ -25,38 +25,38 @@ discard block |
||
| 25 | 25 | function store_permissions($content, $id) { |
| 26 | 26 | $course_id = api_get_course_int_id(); |
| 27 | 27 | |
| 28 | - // Which database are we using (depending on the $content parameter) |
|
| 29 | - if ($content=='user') |
|
| 30 | - { |
|
| 31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | - $id_field = user_id; |
|
| 33 | - } |
|
| 34 | - if ($content=='group') |
|
| 35 | - { |
|
| 36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | - $id_field = group_id; |
|
| 38 | - } |
|
| 39 | - if ($content=='role') |
|
| 40 | - { |
|
| 41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | - $id_field = role_id; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - // We first delete all the existing permissions for that user/group/role |
|
| 46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | - $result=Database::query($sql); |
|
| 48 | - |
|
| 49 | - // looping through the post values to find the permission (containing the string permission* ) |
|
| 50 | - foreach ($_POST as $key => $value) |
|
| 51 | - { |
|
| 52 | - if (strstr($key,"permission*")) |
|
| 53 | - { |
|
| 54 | - list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | - $result=Database::query($sql); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - return get_lang('PermissionsStored'); |
|
| 28 | + // Which database are we using (depending on the $content parameter) |
|
| 29 | + if ($content=='user') |
|
| 30 | + { |
|
| 31 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | + $id_field = user_id; |
|
| 33 | + } |
|
| 34 | + if ($content=='group') |
|
| 35 | + { |
|
| 36 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | + $id_field = group_id; |
|
| 38 | + } |
|
| 39 | + if ($content=='role') |
|
| 40 | + { |
|
| 41 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | + $id_field = role_id; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + // We first delete all the existing permissions for that user/group/role |
|
| 46 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | + $result=Database::query($sql); |
|
| 48 | + |
|
| 49 | + // looping through the post values to find the permission (containing the string permission* ) |
|
| 50 | + foreach ($_POST as $key => $value) |
|
| 51 | + { |
|
| 52 | + if (strstr($key,"permission*")) |
|
| 53 | + { |
|
| 54 | + list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | + $result=Database::query($sql); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + return get_lang('PermissionsStored'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -70,50 +70,50 @@ discard block |
||
| 70 | 70 | * @version 1.0 |
| 71 | 71 | */ |
| 72 | 72 | function store_one_permission($content, $action, $id, $tool,$permission) { |
| 73 | - global $rights_full; |
|
| 73 | + global $rights_full; |
|
| 74 | 74 | $course_id = api_get_course_int_id(); |
| 75 | - // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
| 75 | + // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
| 76 | 76 | |
| 77 | - // check |
|
| 78 | - //if(!in_array($permission, $rights_full)) |
|
| 79 | - //{ |
|
| 80 | - // return get_lang('Error'); |
|
| 81 | - //} |
|
| 77 | + // check |
|
| 78 | + //if(!in_array($permission, $rights_full)) |
|
| 79 | + //{ |
|
| 80 | + // return get_lang('Error'); |
|
| 81 | + //} |
|
| 82 | 82 | |
| 83 | - // Which database are we using (depending on the $content parameter) |
|
| 83 | + // Which database are we using (depending on the $content parameter) |
|
| 84 | 84 | |
| 85 | - if ($content=='user') { |
|
| 86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | - $id_field = user_id; |
|
| 88 | - } |
|
| 89 | - if ($content=='group') |
|
| 90 | - { |
|
| 91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | - $id_field = group_id; |
|
| 93 | - } |
|
| 94 | - if ($content=='role') |
|
| 95 | - { |
|
| 96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | - $id_field = role_id; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // grating a right |
|
| 101 | - if ($action=='grant') { |
|
| 102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | - $result=Database::query($sql); |
|
| 104 | - if($result) { |
|
| 105 | - $result_message=get_lang('PermissionGranted'); |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - if ($action=='revoke') |
|
| 109 | - { |
|
| 110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | - $result=Database::query($sql); |
|
| 112 | - if($result) { |
|
| 113 | - $result_message=get_lang('PermissionRevoked'); |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - return $result_message; |
|
| 85 | + if ($content=='user') { |
|
| 86 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | + $id_field = user_id; |
|
| 88 | + } |
|
| 89 | + if ($content=='group') |
|
| 90 | + { |
|
| 91 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | + $id_field = group_id; |
|
| 93 | + } |
|
| 94 | + if ($content=='role') |
|
| 95 | + { |
|
| 96 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | + $id_field = role_id; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // grating a right |
|
| 101 | + if ($action=='grant') { |
|
| 102 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | + $result=Database::query($sql); |
|
| 104 | + if($result) { |
|
| 105 | + $result_message=get_lang('PermissionGranted'); |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + if ($action=='revoke') |
|
| 109 | + { |
|
| 110 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | + $result=Database::query($sql); |
|
| 112 | + if($result) { |
|
| 113 | + $result_message=get_lang('PermissionRevoked'); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + return $result_message; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -125,47 +125,47 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | function get_permissions($content, $id) { |
| 127 | 127 | $course_id = api_get_course_int_id(); |
| 128 | - $currentpermissions=array(); |
|
| 129 | - // Which database are we using (depending on the $content parameter) |
|
| 128 | + $currentpermissions=array(); |
|
| 129 | + // Which database are we using (depending on the $content parameter) |
|
| 130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
| 131 | - if ($content == 'user') |
|
| 132 | - { |
|
| 133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | - $id_field = 'user_id'; |
|
| 135 | - } |
|
| 136 | - elseif ($content == 'group') |
|
| 137 | - { |
|
| 138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | - $id_field = 'group_id'; |
|
| 140 | - } |
|
| 141 | - elseif ($content == 'role') |
|
| 142 | - { |
|
| 143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | - $id_field = 'role_id'; |
|
| 145 | - } |
|
| 146 | - elseif ($content == 'platform_role') |
|
| 147 | - { |
|
| 148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | - $id_field = 'role_id'; |
|
| 131 | + if ($content == 'user') |
|
| 132 | + { |
|
| 133 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | + $id_field = 'user_id'; |
|
| 135 | + } |
|
| 136 | + elseif ($content == 'group') |
|
| 137 | + { |
|
| 138 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | + $id_field = 'group_id'; |
|
| 140 | + } |
|
| 141 | + elseif ($content == 'role') |
|
| 142 | + { |
|
| 143 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | + $id_field = 'role_id'; |
|
| 145 | + } |
|
| 146 | + elseif ($content == 'platform_role') |
|
| 147 | + { |
|
| 148 | + $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | + $id_field = 'role_id'; |
|
| 150 | 150 | $course_id_condition = ''; |
| 151 | - } |
|
| 152 | - elseif ($content == 'task') |
|
| 153 | - { |
|
| 154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | - $id_field = 'task_id'; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - // finding all the permissions. We store this in a multidimensional array |
|
| 159 | - // where the first dimension is the tool. |
|
| 160 | - $sql=" |
|
| 151 | + } |
|
| 152 | + elseif ($content == 'task') |
|
| 153 | + { |
|
| 154 | + $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | + $id_field = 'task_id'; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + // finding all the permissions. We store this in a multidimensional array |
|
| 159 | + // where the first dimension is the tool. |
|
| 160 | + $sql=" |
|
| 161 | 161 | SELECT * FROM " . $table . " |
| 162 | 162 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
| 163 | - $result = Database::query($sql); |
|
| 163 | + $result = Database::query($sql); |
|
| 164 | 164 | |
| 165 | - while($row = Database::fetch_array($result)) |
|
| 166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
| 165 | + while($row = Database::fetch_array($result)) |
|
| 166 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
| 167 | 167 | |
| 168 | - return $currentpermissions; |
|
| 168 | + return $currentpermissions; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -179,38 +179,38 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | function limited_or_full($current_permissions) |
| 181 | 181 | { |
| 182 | - if (api_get_setting('permissions')=='limited') |
|
| 183 | - { |
|
| 184 | - foreach ($current_permissions as $tool=>$tool_rights) |
|
| 185 | - { |
|
| 186 | - // we loop through the possible permissions of a tool and unset the entry if it is view |
|
| 187 | - // if it is visibility or move we have to grant the edit right |
|
| 188 | - foreach ($tool_rights as $key=>$value) |
|
| 189 | - { |
|
| 190 | - if ($value=='View') |
|
| 191 | - { |
|
| 192 | - unset($current_permissions[$tool][$key]); |
|
| 193 | - } |
|
| 194 | - if ($value=='Visibility' OR $value=='Move') |
|
| 195 | - { |
|
| 196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
| 197 | - { |
|
| 198 | - $current_permissions[$tool][]='Edit'; |
|
| 199 | - } |
|
| 200 | - unset($current_permissions[$tool][$key]); |
|
| 201 | - } |
|
| 202 | - //else |
|
| 203 | - //{ |
|
| 204 | - // $current_permissions[$tool][]=$value; |
|
| 205 | - //} |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - return $current_permissions; |
|
| 209 | - } |
|
| 210 | - if (api_get_setting('permissions')=='full') |
|
| 211 | - { |
|
| 212 | - return $current_permissions; |
|
| 213 | - } |
|
| 182 | + if (api_get_setting('permissions')=='limited') |
|
| 183 | + { |
|
| 184 | + foreach ($current_permissions as $tool=>$tool_rights) |
|
| 185 | + { |
|
| 186 | + // we loop through the possible permissions of a tool and unset the entry if it is view |
|
| 187 | + // if it is visibility or move we have to grant the edit right |
|
| 188 | + foreach ($tool_rights as $key=>$value) |
|
| 189 | + { |
|
| 190 | + if ($value=='View') |
|
| 191 | + { |
|
| 192 | + unset($current_permissions[$tool][$key]); |
|
| 193 | + } |
|
| 194 | + if ($value=='Visibility' OR $value=='Move') |
|
| 195 | + { |
|
| 196 | + if (!in_array('Edit',$current_permissions[$tool])) |
|
| 197 | + { |
|
| 198 | + $current_permissions[$tool][]='Edit'; |
|
| 199 | + } |
|
| 200 | + unset($current_permissions[$tool][$key]); |
|
| 201 | + } |
|
| 202 | + //else |
|
| 203 | + //{ |
|
| 204 | + // $current_permissions[$tool][]=$value; |
|
| 205 | + //} |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + return $current_permissions; |
|
| 209 | + } |
|
| 210 | + if (api_get_setting('permissions')=='full') |
|
| 211 | + { |
|
| 212 | + return $current_permissions; |
|
| 213 | + } |
|
| 214 | 214 | } |
| 215 | 215 | /** |
| 216 | 216 | * This function displays a checked or unchecked checkbox. The checkbox will be checked if the |
@@ -224,12 +224,12 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
| 226 | 226 | { |
| 227 | - $checked=""; |
|
| 228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 229 | - { |
|
| 230 | - $checked="checked"; |
|
| 231 | - } |
|
| 232 | - echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
| 227 | + $checked=""; |
|
| 228 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 229 | + { |
|
| 230 | + $checked="checked"; |
|
| 231 | + } |
|
| 232 | + echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
@@ -245,62 +245,62 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
| 247 | 247 | { |
| 248 | - if ($course_admin) { |
|
| 249 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 250 | - } else { |
|
| 251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 252 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 253 | - } else { |
|
| 254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 255 | - if ($editable) { |
|
| 256 | - $url=api_get_self(); |
|
| 257 | - $urlparameters = ''; |
|
| 258 | - foreach($_GET as $key=>$value) { |
|
| 259 | - $parameter[$key]=$value; |
|
| 260 | - } |
|
| 261 | - $parameter['action']='revoke'; |
|
| 262 | - $parameter['permission']=$permission; |
|
| 263 | - $parameter['tool']=$tool; |
|
| 264 | - foreach ($parameter as $key=>$value) { |
|
| 265 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 266 | - } |
|
| 267 | - $url=$url.'?'.$urlparameters; |
|
| 268 | - |
|
| 269 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 270 | - } |
|
| 271 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
| 272 | - if ($editable) { |
|
| 273 | - echo "</a>"; |
|
| 274 | - } |
|
| 275 | - } else { |
|
| 276 | - if ($editable) |
|
| 277 | - { |
|
| 278 | - $url=api_get_self(); |
|
| 279 | - $urlparameters = ''; |
|
| 280 | - foreach ($_GET as $key=>$value) |
|
| 281 | - { |
|
| 282 | - $parameter[$key]=$value; |
|
| 283 | - } |
|
| 284 | - $parameter['action']='grant'; |
|
| 285 | - $parameter['permission']=$permission; |
|
| 286 | - $parameter['tool']=$tool; |
|
| 287 | - foreach ($parameter as $key=>$value) |
|
| 288 | - { |
|
| 289 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 290 | - } |
|
| 291 | - $url=$url.'?'.$urlparameters; |
|
| 292 | - |
|
| 293 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 294 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 295 | - } |
|
| 296 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
| 297 | - if ($editable) |
|
| 298 | - { |
|
| 299 | - echo "</a>"; |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - } |
|
| 248 | + if ($course_admin) { |
|
| 249 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 250 | + } else { |
|
| 251 | + if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 252 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 253 | + } else { |
|
| 254 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 255 | + if ($editable) { |
|
| 256 | + $url=api_get_self(); |
|
| 257 | + $urlparameters = ''; |
|
| 258 | + foreach($_GET as $key=>$value) { |
|
| 259 | + $parameter[$key]=$value; |
|
| 260 | + } |
|
| 261 | + $parameter['action']='revoke'; |
|
| 262 | + $parameter['permission']=$permission; |
|
| 263 | + $parameter['tool']=$tool; |
|
| 264 | + foreach ($parameter as $key=>$value) { |
|
| 265 | + $urlparameters.=$key.'='.$value.'&'; |
|
| 266 | + } |
|
| 267 | + $url=$url.'?'.$urlparameters; |
|
| 268 | + |
|
| 269 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 270 | + } |
|
| 271 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
| 272 | + if ($editable) { |
|
| 273 | + echo "</a>"; |
|
| 274 | + } |
|
| 275 | + } else { |
|
| 276 | + if ($editable) |
|
| 277 | + { |
|
| 278 | + $url=api_get_self(); |
|
| 279 | + $urlparameters = ''; |
|
| 280 | + foreach ($_GET as $key=>$value) |
|
| 281 | + { |
|
| 282 | + $parameter[$key]=$value; |
|
| 283 | + } |
|
| 284 | + $parameter['action']='grant'; |
|
| 285 | + $parameter['permission']=$permission; |
|
| 286 | + $parameter['tool']=$tool; |
|
| 287 | + foreach ($parameter as $key=>$value) |
|
| 288 | + { |
|
| 289 | + $urlparameters.=$key.'='.$value.'&'; |
|
| 290 | + } |
|
| 291 | + $url=$url.'?'.$urlparameters; |
|
| 292 | + |
|
| 293 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 294 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 295 | + } |
|
| 296 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
| 297 | + if ($editable) |
|
| 298 | + { |
|
| 299 | + echo "</a>"; |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | |
@@ -318,72 +318,72 @@ discard block |
||
| 318 | 318 | function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
| 319 | 319 | { |
| 320 | 320 | |
| 321 | - if ($course_admin) |
|
| 322 | - { |
|
| 323 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 324 | - } |
|
| 325 | - else |
|
| 326 | - { |
|
| 327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 328 | - { |
|
| 329 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 330 | - } |
|
| 331 | - else |
|
| 332 | - { |
|
| 333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 334 | - { |
|
| 335 | - if ($editable) |
|
| 336 | - { |
|
| 337 | - $url = api_get_self(); |
|
| 338 | - $urlparameters = ''; |
|
| 339 | - foreach($_GET as $key => $value) |
|
| 340 | - { |
|
| 341 | - $parameter[$key] = $value; |
|
| 342 | - } |
|
| 343 | - $parameter['action']='manage_rights'; |
|
| 344 | - $parameter['do']='revoke'; |
|
| 345 | - $parameter['permission']=$permission; |
|
| 346 | - $parameter['tool']=$tool; |
|
| 347 | - $parameter['user_id']=$user_id; |
|
| 348 | - foreach ($parameter as $key=>$value) |
|
| 349 | - { |
|
| 350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 351 | - } |
|
| 352 | - $url = $url . '?' . $urlparameters; |
|
| 353 | - |
|
| 354 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 355 | - } |
|
| 356 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
| 357 | - if ($editable) { |
|
| 358 | - echo "</a>"; |
|
| 359 | - } |
|
| 360 | - } else { |
|
| 361 | - if ($editable) { |
|
| 362 | - $url = api_get_self(); |
|
| 363 | - $urlparameters = ''; |
|
| 364 | - foreach ($_GET as $key=>$value) { |
|
| 365 | - $parameter[$key]=$value; |
|
| 366 | - } |
|
| 367 | - $parameter['action']='manage_rights'; |
|
| 368 | - $parameter['do']='grant'; |
|
| 369 | - $parameter['permission']=$permission; |
|
| 370 | - $parameter['tool']=$tool; |
|
| 371 | - $parameter['user_id']=$user_id; |
|
| 372 | - foreach ($parameter as $key=>$value) { |
|
| 373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 374 | - } |
|
| 375 | - $url=$url.'?'.$urlparameters; |
|
| 376 | - |
|
| 377 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 378 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 379 | - } |
|
| 380 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
| 381 | - if ($editable) { |
|
| 382 | - echo "</a>"; |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - } |
|
| 386 | - } |
|
| 321 | + if ($course_admin) |
|
| 322 | + { |
|
| 323 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 324 | + } |
|
| 325 | + else |
|
| 326 | + { |
|
| 327 | + if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 328 | + { |
|
| 329 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 330 | + } |
|
| 331 | + else |
|
| 332 | + { |
|
| 333 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 334 | + { |
|
| 335 | + if ($editable) |
|
| 336 | + { |
|
| 337 | + $url = api_get_self(); |
|
| 338 | + $urlparameters = ''; |
|
| 339 | + foreach($_GET as $key => $value) |
|
| 340 | + { |
|
| 341 | + $parameter[$key] = $value; |
|
| 342 | + } |
|
| 343 | + $parameter['action']='manage_rights'; |
|
| 344 | + $parameter['do']='revoke'; |
|
| 345 | + $parameter['permission']=$permission; |
|
| 346 | + $parameter['tool']=$tool; |
|
| 347 | + $parameter['user_id']=$user_id; |
|
| 348 | + foreach ($parameter as $key=>$value) |
|
| 349 | + { |
|
| 350 | + $urlparameters .= $key . '=' . $value . '&'; |
|
| 351 | + } |
|
| 352 | + $url = $url . '?' . $urlparameters; |
|
| 353 | + |
|
| 354 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 355 | + } |
|
| 356 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
| 357 | + if ($editable) { |
|
| 358 | + echo "</a>"; |
|
| 359 | + } |
|
| 360 | + } else { |
|
| 361 | + if ($editable) { |
|
| 362 | + $url = api_get_self(); |
|
| 363 | + $urlparameters = ''; |
|
| 364 | + foreach ($_GET as $key=>$value) { |
|
| 365 | + $parameter[$key]=$value; |
|
| 366 | + } |
|
| 367 | + $parameter['action']='manage_rights'; |
|
| 368 | + $parameter['do']='grant'; |
|
| 369 | + $parameter['permission']=$permission; |
|
| 370 | + $parameter['tool']=$tool; |
|
| 371 | + $parameter['user_id']=$user_id; |
|
| 372 | + foreach ($parameter as $key=>$value) { |
|
| 373 | + $urlparameters .= $key . '=' . $value . '&'; |
|
| 374 | + } |
|
| 375 | + $url=$url.'?'.$urlparameters; |
|
| 376 | + |
|
| 377 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 378 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 379 | + } |
|
| 380 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
| 381 | + if ($editable) { |
|
| 382 | + echo "</a>"; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -394,41 +394,41 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function display_role_list($current_course_roles, $current_platform_roles) |
| 396 | 396 | { |
| 397 | - global $setting_visualisation; |
|
| 397 | + global $setting_visualisation; |
|
| 398 | 398 | $course_id = api_get_course_int_id(); |
| 399 | 399 | |
| 400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 401 | - |
|
| 402 | - // course roles |
|
| 403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | - $result=Database::query($sql); |
|
| 405 | - while ($row=Database::fetch_array($result)) |
|
| 406 | - { |
|
| 407 | - if (in_array($row['role_id'], $current_course_roles)) |
|
| 408 | - { |
|
| 409 | - $checked='checked'; |
|
| 410 | - $image='checkbox_on2.gif'; |
|
| 411 | - $action='revoke'; |
|
| 412 | - } |
|
| 413 | - else |
|
| 414 | - { |
|
| 415 | - $checked=''; |
|
| 416 | - $image='wrong.gif'; |
|
| 417 | - $action='grant'; |
|
| 418 | - } |
|
| 419 | - if ($setting_visualisation=='checkbox') |
|
| 420 | - { |
|
| 421 | - echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
| 422 | - } |
|
| 423 | - if ($setting_visualisation=='image') |
|
| 424 | - { |
|
| 425 | - echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - |
|
| 429 | - echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
| 430 | - echo $row['role_comment']."<br />\n"; |
|
| 431 | - } |
|
| 400 | + $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 401 | + |
|
| 402 | + // course roles |
|
| 403 | + $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | + $result=Database::query($sql); |
|
| 405 | + while ($row=Database::fetch_array($result)) |
|
| 406 | + { |
|
| 407 | + if (in_array($row['role_id'], $current_course_roles)) |
|
| 408 | + { |
|
| 409 | + $checked='checked'; |
|
| 410 | + $image='checkbox_on2.gif'; |
|
| 411 | + $action='revoke'; |
|
| 412 | + } |
|
| 413 | + else |
|
| 414 | + { |
|
| 415 | + $checked=''; |
|
| 416 | + $image='wrong.gif'; |
|
| 417 | + $action='grant'; |
|
| 418 | + } |
|
| 419 | + if ($setting_visualisation=='checkbox') |
|
| 420 | + { |
|
| 421 | + echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
| 422 | + } |
|
| 423 | + if ($setting_visualisation=='image') |
|
| 424 | + { |
|
| 425 | + echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + |
|
| 429 | + echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
| 430 | + echo $row['role_comment']."<br />\n"; |
|
| 431 | + } |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -442,24 +442,24 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | function get_roles($content,$id, $scope='course') { |
| 444 | 444 | $course_id = api_get_course_int_id(); |
| 445 | - if ($content=='user') { |
|
| 446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | - $id_field = user_id; |
|
| 448 | - } |
|
| 449 | - if ($content=='group') { |
|
| 450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | - $id_field = 'group_id'; |
|
| 452 | - } |
|
| 453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 454 | - |
|
| 455 | - $current_roles=array(); |
|
| 456 | - //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
| 457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | - $result=Database::query($sql); |
|
| 459 | - while ($row=Database::fetch_array($result)) { |
|
| 460 | - $current_roles[]=$row['role_id']; |
|
| 461 | - } |
|
| 462 | - return $current_roles; |
|
| 445 | + if ($content=='user') { |
|
| 446 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | + $id_field = user_id; |
|
| 448 | + } |
|
| 449 | + if ($content=='group') { |
|
| 450 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | + $id_field = 'group_id'; |
|
| 452 | + } |
|
| 453 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 454 | + |
|
| 455 | + $current_roles=array(); |
|
| 456 | + //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
| 457 | + $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | + $result=Database::query($sql); |
|
| 459 | + while ($row=Database::fetch_array($result)) { |
|
| 460 | + $current_roles[]=$row['role_id']; |
|
| 461 | + } |
|
| 462 | + return $current_roles; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -472,25 +472,25 @@ discard block |
||
| 472 | 472 | $course_id = api_get_course_int_id(); |
| 473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
| 474 | 474 | |
| 475 | - if ($content=='course') |
|
| 476 | - { |
|
| 477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 478 | - } |
|
| 479 | - if ($content=='platform') |
|
| 480 | - { |
|
| 481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 482 | - $course_id_condition = ''; |
|
| 483 | - } |
|
| 484 | - |
|
| 485 | - $current_roles=array(); |
|
| 486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | - $result=Database::query($sql); |
|
| 488 | - while ($row=Database::fetch_array($result)) |
|
| 489 | - { |
|
| 490 | - $roles[]=$row; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - return $roles; |
|
| 475 | + if ($content=='course') |
|
| 476 | + { |
|
| 477 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 478 | + } |
|
| 479 | + if ($content=='platform') |
|
| 480 | + { |
|
| 481 | + $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 482 | + $course_id_condition = ''; |
|
| 483 | + } |
|
| 484 | + |
|
| 485 | + $current_roles=array(); |
|
| 486 | + $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | + $result=Database::query($sql); |
|
| 488 | + while ($row=Database::fetch_array($result)) |
|
| 489 | + { |
|
| 490 | + $roles[]=$row; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + return $roles; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
@@ -506,34 +506,34 @@ discard block |
||
| 506 | 506 | */ |
| 507 | 507 | function get_roles_permissions($content,$id, $scope='course') { |
| 508 | 508 | $course_id = api_get_course_int_id(); |
| 509 | - if ($content == 'user') { |
|
| 510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | - $id_field = 'user_id'; |
|
| 512 | - } |
|
| 513 | - |
|
| 514 | - if ($content == 'group') { |
|
| 515 | - $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 516 | - $id_field = 'group_id'; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - // course roles or platform roles |
|
| 520 | - $scope = 'course'; |
|
| 521 | - if ($scope == 'course') { |
|
| 522 | - $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 523 | - $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 509 | + if ($content == 'user') { |
|
| 510 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | + $id_field = 'user_id'; |
|
| 512 | + } |
|
| 513 | + |
|
| 514 | + if ($content == 'group') { |
|
| 515 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 516 | + $id_field = 'group_id'; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + // course roles or platform roles |
|
| 520 | + $scope = 'course'; |
|
| 521 | + if ($scope == 'course') { |
|
| 522 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 523 | + $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 524 | 524 | |
| 525 | 525 | $role_condition = " role.c_id = $course_id AND role_permissions.c_id = $course_id AND "; |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | - if ($scope == 'platform') { |
|
| 529 | - $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 530 | - $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 528 | + if ($scope == 'platform') { |
|
| 529 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 530 | + $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 531 | 531 | $role_condition = ''; |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - $current_roles = array(); |
|
| 534 | + $current_roles = array(); |
|
| 535 | 535 | |
| 536 | - $sql = " |
|
| 536 | + $sql = " |
|
| 537 | 537 | SELECT * |
| 538 | 538 | FROM |
| 539 | 539 | " . $table . " role_group_user, |
@@ -547,12 +547,12 @@ discard block |
||
| 547 | 547 | role_group_user.role_id = role.role_id AND |
| 548 | 548 | role.role_id = role_permissions.role_id"; |
| 549 | 549 | |
| 550 | - $result = Database::query($sql); |
|
| 550 | + $result = Database::query($sql); |
|
| 551 | 551 | $current_role_permissions = array(); |
| 552 | - while ($row=Database::fetch_array($result)) { |
|
| 553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 552 | + while ($row=Database::fetch_array($result)) { |
|
| 553 | + $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 554 | 554 | } |
| 555 | - return $current_role_permissions; |
|
| 555 | + return $current_role_permissions; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
@@ -566,34 +566,34 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | function assign_role($content, $action, $id, $role_id, $scope='course') { |
| 568 | 568 | $course_id = api_get_course_int_id(); |
| 569 | - // Which database are we using (depending on the $content parameter) |
|
| 570 | - if ($content=='user') { |
|
| 571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | - $id_field = 'user_id'; |
|
| 573 | - } elseif($content=='group') { |
|
| 574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | - $id_field = 'group_id'; |
|
| 576 | - } else { |
|
| 577 | - return get_lang('Error'); |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - // grating a right |
|
| 581 | - if ($action=='grant') { |
|
| 582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | - $result=Database::query($sql); |
|
| 584 | - if ($result) { |
|
| 585 | - $result_message=get_lang('RoleGranted'); |
|
| 586 | - } |
|
| 587 | - } |
|
| 569 | + // Which database are we using (depending on the $content parameter) |
|
| 570 | + if ($content=='user') { |
|
| 571 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | + $id_field = 'user_id'; |
|
| 573 | + } elseif($content=='group') { |
|
| 574 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | + $id_field = 'group_id'; |
|
| 576 | + } else { |
|
| 577 | + return get_lang('Error'); |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + // grating a right |
|
| 581 | + if ($action=='grant') { |
|
| 582 | + $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | + $result=Database::query($sql); |
|
| 584 | + if ($result) { |
|
| 585 | + $result_message=get_lang('RoleGranted'); |
|
| 586 | + } |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | - if ($action=='revoke') { |
|
| 590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | - $result=Database::query($sql); |
|
| 592 | - if ($result) { |
|
| 593 | - $result_message=get_lang('RoleRevoked'); |
|
| 594 | - } |
|
| 595 | - } |
|
| 596 | - return $result_message; |
|
| 589 | + if ($action=='revoke') { |
|
| 590 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | + $result=Database::query($sql); |
|
| 592 | + if ($result) { |
|
| 593 | + $result_message=get_lang('RoleRevoked'); |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | + return $result_message; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | |
@@ -603,21 +603,21 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | function permission_array_merge($array1, $array2) |
| 605 | 605 | { |
| 606 | - foreach ($array2 as $tool=>$permissions) |
|
| 607 | - { |
|
| 608 | - foreach ($permissions as $permissionkey=>$permissionvalue) |
|
| 609 | - { |
|
| 610 | - $array1[$tool][]=$permissionvalue; |
|
| 611 | - } |
|
| 612 | - } |
|
| 613 | - return $array1; |
|
| 606 | + foreach ($array2 as $tool=>$permissions) |
|
| 607 | + { |
|
| 608 | + foreach ($permissions as $permissionkey=>$permissionvalue) |
|
| 609 | + { |
|
| 610 | + $array1[$tool][]=$permissionvalue; |
|
| 611 | + } |
|
| 612 | + } |
|
| 613 | + return $array1; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | |
| 617 | 617 | function my_print_r($array) |
| 618 | 618 | { |
| 619 | - echo '<pre>'; |
|
| 620 | - print_r($array); |
|
| 621 | - echo '</pre>'; |
|
| 619 | + echo '<pre>'; |
|
| 620 | + print_r($array); |
|
| 621 | + echo '</pre>'; |
|
| 622 | 622 | } |
| 623 | 623 | ?> |
@@ -26,34 +26,34 @@ discard block |
||
| 26 | 26 | $course_id = api_get_course_int_id(); |
| 27 | 27 | |
| 28 | 28 | // Which database are we using (depending on the $content parameter) |
| 29 | - if ($content=='user') |
|
| 29 | + if ($content == 'user') |
|
| 30 | 30 | { |
| 31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 31 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | 32 | $id_field = user_id; |
| 33 | 33 | } |
| 34 | - if ($content=='group') |
|
| 34 | + if ($content == 'group') |
|
| 35 | 35 | { |
| 36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 36 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | 37 | $id_field = group_id; |
| 38 | 38 | } |
| 39 | - if ($content=='role') |
|
| 39 | + if ($content == 'role') |
|
| 40 | 40 | { |
| 41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 41 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | 42 | $id_field = role_id; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // We first delete all the existing permissions for that user/group/role |
| 46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | - $result=Database::query($sql); |
|
| 46 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | + $result = Database::query($sql); |
|
| 48 | 48 | |
| 49 | 49 | // looping through the post values to find the permission (containing the string permission* ) |
| 50 | 50 | foreach ($_POST as $key => $value) |
| 51 | 51 | { |
| 52 | - if (strstr($key,"permission*")) |
|
| 52 | + if (strstr($key, "permission*")) |
|
| 53 | 53 | { |
| 54 | - list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | - $result=Database::query($sql); |
|
| 54 | + list($brol, $tool, $action) = explode("*", $key); |
|
| 55 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | + $result = Database::query($sql); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | return get_lang('PermissionsStored'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @author Patrick Cool <[email protected]>, Ghent University |
| 70 | 70 | * @version 1.0 |
| 71 | 71 | */ |
| 72 | -function store_one_permission($content, $action, $id, $tool,$permission) { |
|
| 72 | +function store_one_permission($content, $action, $id, $tool, $permission) { |
|
| 73 | 73 | global $rights_full; |
| 74 | 74 | $course_id = api_get_course_int_id(); |
| 75 | 75 | // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
@@ -82,35 +82,35 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // Which database are we using (depending on the $content parameter) |
| 84 | 84 | |
| 85 | - if ($content=='user') { |
|
| 86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 85 | + if ($content == 'user') { |
|
| 86 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | 87 | $id_field = user_id; |
| 88 | 88 | } |
| 89 | - if ($content=='group') |
|
| 89 | + if ($content == 'group') |
|
| 90 | 90 | { |
| 91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 91 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | 92 | $id_field = group_id; |
| 93 | 93 | } |
| 94 | - if ($content=='role') |
|
| 94 | + if ($content == 'role') |
|
| 95 | 95 | { |
| 96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 96 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | 97 | $id_field = role_id; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // grating a right |
| 101 | - if ($action=='grant') { |
|
| 102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | - $result=Database::query($sql); |
|
| 104 | - if($result) { |
|
| 105 | - $result_message=get_lang('PermissionGranted'); |
|
| 101 | + if ($action == 'grant') { |
|
| 102 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | + $result = Database::query($sql); |
|
| 104 | + if ($result) { |
|
| 105 | + $result_message = get_lang('PermissionGranted'); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - if ($action=='revoke') |
|
| 108 | + if ($action == 'revoke') |
|
| 109 | 109 | { |
| 110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | - $result=Database::query($sql); |
|
| 112 | - if($result) { |
|
| 113 | - $result_message=get_lang('PermissionRevoked'); |
|
| 110 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | + $result = Database::query($sql); |
|
| 112 | + if ($result) { |
|
| 113 | + $result_message = get_lang('PermissionRevoked'); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return $result_message; |
@@ -125,44 +125,44 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | function get_permissions($content, $id) { |
| 127 | 127 | $course_id = api_get_course_int_id(); |
| 128 | - $currentpermissions=array(); |
|
| 128 | + $currentpermissions = array(); |
|
| 129 | 129 | // Which database are we using (depending on the $content parameter) |
| 130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
| 131 | 131 | if ($content == 'user') |
| 132 | 132 | { |
| 133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 133 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | 134 | $id_field = 'user_id'; |
| 135 | 135 | } |
| 136 | 136 | elseif ($content == 'group') |
| 137 | 137 | { |
| 138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 138 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | 139 | $id_field = 'group_id'; |
| 140 | 140 | } |
| 141 | 141 | elseif ($content == 'role') |
| 142 | 142 | { |
| 143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 143 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | 144 | $id_field = 'role_id'; |
| 145 | 145 | } |
| 146 | 146 | elseif ($content == 'platform_role') |
| 147 | 147 | { |
| 148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 148 | + $table = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | 149 | $id_field = 'role_id'; |
| 150 | 150 | $course_id_condition = ''; |
| 151 | 151 | } |
| 152 | 152 | elseif ($content == 'task') |
| 153 | 153 | { |
| 154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 154 | + $table = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | 155 | $id_field = 'task_id'; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // finding all the permissions. We store this in a multidimensional array |
| 159 | 159 | // where the first dimension is the tool. |
| 160 | - $sql=" |
|
| 161 | - SELECT * FROM " . $table . " |
|
| 162 | - WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
|
| 160 | + $sql = " |
|
| 161 | + SELECT * FROM " . $table." |
|
| 162 | + WHERE $course_id_condition ".$id_field."='".Database::escape_string($id)."'"; |
|
| 163 | 163 | $result = Database::query($sql); |
| 164 | 164 | |
| 165 | - while($row = Database::fetch_array($result)) |
|
| 165 | + while ($row = Database::fetch_array($result)) |
|
| 166 | 166 | $currentpermissions[$row['tool']][] = $row['action']; |
| 167 | 167 | |
| 168 | 168 | return $currentpermissions; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | function limited_or_full($current_permissions) |
| 181 | 181 | { |
| 182 | - if (api_get_setting('permissions')=='limited') |
|
| 182 | + if (api_get_setting('permissions') == 'limited') |
|
| 183 | 183 | { |
| 184 | 184 | foreach ($current_permissions as $tool=>$tool_rights) |
| 185 | 185 | { |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | // if it is visibility or move we have to grant the edit right |
| 188 | 188 | foreach ($tool_rights as $key=>$value) |
| 189 | 189 | { |
| 190 | - if ($value=='View') |
|
| 190 | + if ($value == 'View') |
|
| 191 | 191 | { |
| 192 | 192 | unset($current_permissions[$tool][$key]); |
| 193 | 193 | } |
| 194 | - if ($value=='Visibility' OR $value=='Move') |
|
| 194 | + if ($value == 'Visibility' OR $value == 'Move') |
|
| 195 | 195 | { |
| 196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
| 196 | + if (!in_array('Edit', $current_permissions[$tool])) |
|
| 197 | 197 | { |
| 198 | - $current_permissions[$tool][]='Edit'; |
|
| 198 | + $current_permissions[$tool][] = 'Edit'; |
|
| 199 | 199 | } |
| 200 | 200 | unset($current_permissions[$tool][$key]); |
| 201 | 201 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | return $current_permissions; |
| 209 | 209 | } |
| 210 | - if (api_get_setting('permissions')=='full') |
|
| 210 | + if (api_get_setting('permissions') == 'full') |
|
| 211 | 211 | { |
| 212 | 212 | return $current_permissions; |
| 213 | 213 | } |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | * @author Patrick Cool <[email protected]>, Ghent University |
| 223 | 223 | * @version 1.0 |
| 224 | 224 | */ |
| 225 | -function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
|
| 225 | +function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array()) |
|
| 226 | 226 | { |
| 227 | - $checked=""; |
|
| 228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 227 | + $checked = ""; |
|
| 228 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
| 229 | 229 | { |
| 230 | - $checked="checked"; |
|
| 230 | + $checked = "checked"; |
|
| 231 | 231 | } |
| 232 | 232 | echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
| 233 | 233 | |
@@ -243,28 +243,28 @@ discard block |
||
| 243 | 243 | * @author Patrick Cool <[email protected]>, Ghent University |
| 244 | 244 | * @version 1.0 |
| 245 | 245 | */ |
| 246 | -function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
| 246 | +function display_image_matrix($permission_array, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
| 247 | 247 | { |
| 248 | 248 | if ($course_admin) { |
| 249 | 249 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 250 | 250 | } else { |
| 251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 251 | + if (in_array($permission, $inherited_permissions[$tool])) { |
|
| 252 | 252 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 253 | 253 | } else { |
| 254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 254 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) { |
|
| 255 | 255 | if ($editable) { |
| 256 | - $url=api_get_self(); |
|
| 256 | + $url = api_get_self(); |
|
| 257 | 257 | $urlparameters = ''; |
| 258 | - foreach($_GET as $key=>$value) { |
|
| 259 | - $parameter[$key]=$value; |
|
| 258 | + foreach ($_GET as $key=>$value) { |
|
| 259 | + $parameter[$key] = $value; |
|
| 260 | 260 | } |
| 261 | - $parameter['action']='revoke'; |
|
| 262 | - $parameter['permission']=$permission; |
|
| 263 | - $parameter['tool']=$tool; |
|
| 261 | + $parameter['action'] = 'revoke'; |
|
| 262 | + $parameter['permission'] = $permission; |
|
| 263 | + $parameter['tool'] = $tool; |
|
| 264 | 264 | foreach ($parameter as $key=>$value) { |
| 265 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 265 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 266 | 266 | } |
| 267 | - $url=$url.'?'.$urlparameters; |
|
| 267 | + $url = $url.'?'.$urlparameters; |
|
| 268 | 268 | |
| 269 | 269 | echo "\t\t\t <a href=\"".$url."\">"; |
| 270 | 270 | } |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | } else { |
| 276 | 276 | if ($editable) |
| 277 | 277 | { |
| 278 | - $url=api_get_self(); |
|
| 278 | + $url = api_get_self(); |
|
| 279 | 279 | $urlparameters = ''; |
| 280 | 280 | foreach ($_GET as $key=>$value) |
| 281 | 281 | { |
| 282 | - $parameter[$key]=$value; |
|
| 282 | + $parameter[$key] = $value; |
|
| 283 | 283 | } |
| 284 | - $parameter['action']='grant'; |
|
| 285 | - $parameter['permission']=$permission; |
|
| 286 | - $parameter['tool']=$tool; |
|
| 284 | + $parameter['action'] = 'grant'; |
|
| 285 | + $parameter['permission'] = $permission; |
|
| 286 | + $parameter['tool'] = $tool; |
|
| 287 | 287 | foreach ($parameter as $key=>$value) |
| 288 | 288 | { |
| 289 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 289 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 290 | 290 | } |
| 291 | - $url=$url.'?'.$urlparameters; |
|
| 291 | + $url = $url.'?'.$urlparameters; |
|
| 292 | 292 | |
| 293 | 293 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
| 294 | 294 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @author Patrick Cool <[email protected]>, Ghent University |
| 316 | 316 | * @version 1.0 |
| 317 | 317 | */ |
| 318 | -function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
| 318 | +function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
| 319 | 319 | { |
| 320 | 320 | |
| 321 | 321 | if ($course_admin) |
@@ -324,32 +324,32 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | else |
| 326 | 326 | { |
| 327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 327 | + if (!empty($inherited_permissions) and in_array($permission, $inherited_permissions[$tool])) |
|
| 328 | 328 | { |
| 329 | 329 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 330 | 330 | } |
| 331 | 331 | else |
| 332 | 332 | { |
| 333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 333 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
| 334 | 334 | { |
| 335 | 335 | if ($editable) |
| 336 | 336 | { |
| 337 | 337 | $url = api_get_self(); |
| 338 | 338 | $urlparameters = ''; |
| 339 | - foreach($_GET as $key => $value) |
|
| 339 | + foreach ($_GET as $key => $value) |
|
| 340 | 340 | { |
| 341 | 341 | $parameter[$key] = $value; |
| 342 | 342 | } |
| 343 | - $parameter['action']='manage_rights'; |
|
| 344 | - $parameter['do']='revoke'; |
|
| 345 | - $parameter['permission']=$permission; |
|
| 346 | - $parameter['tool']=$tool; |
|
| 347 | - $parameter['user_id']=$user_id; |
|
| 343 | + $parameter['action'] = 'manage_rights'; |
|
| 344 | + $parameter['do'] = 'revoke'; |
|
| 345 | + $parameter['permission'] = $permission; |
|
| 346 | + $parameter['tool'] = $tool; |
|
| 347 | + $parameter['user_id'] = $user_id; |
|
| 348 | 348 | foreach ($parameter as $key=>$value) |
| 349 | 349 | { |
| 350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 350 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 351 | 351 | } |
| 352 | - $url = $url . '?' . $urlparameters; |
|
| 352 | + $url = $url.'?'.$urlparameters; |
|
| 353 | 353 | |
| 354 | 354 | echo "\t\t\t <a href=\"".$url."\">"; |
| 355 | 355 | } |
@@ -362,17 +362,17 @@ discard block |
||
| 362 | 362 | $url = api_get_self(); |
| 363 | 363 | $urlparameters = ''; |
| 364 | 364 | foreach ($_GET as $key=>$value) { |
| 365 | - $parameter[$key]=$value; |
|
| 365 | + $parameter[$key] = $value; |
|
| 366 | 366 | } |
| 367 | - $parameter['action']='manage_rights'; |
|
| 368 | - $parameter['do']='grant'; |
|
| 369 | - $parameter['permission']=$permission; |
|
| 370 | - $parameter['tool']=$tool; |
|
| 371 | - $parameter['user_id']=$user_id; |
|
| 367 | + $parameter['action'] = 'manage_rights'; |
|
| 368 | + $parameter['do'] = 'grant'; |
|
| 369 | + $parameter['permission'] = $permission; |
|
| 370 | + $parameter['tool'] = $tool; |
|
| 371 | + $parameter['user_id'] = $user_id; |
|
| 372 | 372 | foreach ($parameter as $key=>$value) { |
| 373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 373 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 374 | 374 | } |
| 375 | - $url=$url.'?'.$urlparameters; |
|
| 375 | + $url = $url.'?'.$urlparameters; |
|
| 376 | 376 | |
| 377 | 377 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
| 378 | 378 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -397,30 +397,30 @@ discard block |
||
| 397 | 397 | global $setting_visualisation; |
| 398 | 398 | $course_id = api_get_course_int_id(); |
| 399 | 399 | |
| 400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 400 | + $coures_roles_table = Database::get_course_table(TABLE_ROLE); |
|
| 401 | 401 | |
| 402 | 402 | // course roles |
| 403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | - $result=Database::query($sql); |
|
| 405 | - while ($row=Database::fetch_array($result)) |
|
| 403 | + $sql = "SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | + $result = Database::query($sql); |
|
| 405 | + while ($row = Database::fetch_array($result)) |
|
| 406 | 406 | { |
| 407 | 407 | if (in_array($row['role_id'], $current_course_roles)) |
| 408 | 408 | { |
| 409 | - $checked='checked'; |
|
| 410 | - $image='checkbox_on2.gif'; |
|
| 411 | - $action='revoke'; |
|
| 409 | + $checked = 'checked'; |
|
| 410 | + $image = 'checkbox_on2.gif'; |
|
| 411 | + $action = 'revoke'; |
|
| 412 | 412 | } |
| 413 | 413 | else |
| 414 | 414 | { |
| 415 | - $checked=''; |
|
| 416 | - $image='wrong.gif'; |
|
| 417 | - $action='grant'; |
|
| 415 | + $checked = ''; |
|
| 416 | + $image = 'wrong.gif'; |
|
| 417 | + $action = 'grant'; |
|
| 418 | 418 | } |
| 419 | - if ($setting_visualisation=='checkbox') |
|
| 419 | + if ($setting_visualisation == 'checkbox') |
|
| 420 | 420 | { |
| 421 | 421 | echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
| 422 | 422 | } |
| 423 | - if ($setting_visualisation=='image') |
|
| 423 | + if ($setting_visualisation == 'image') |
|
| 424 | 424 | { |
| 425 | 425 | echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
| 426 | 426 | } |
@@ -440,24 +440,24 @@ discard block |
||
| 440 | 440 | * @author Patrick Cool <[email protected]>, Ghent University |
| 441 | 441 | * @version 1.0 |
| 442 | 442 | */ |
| 443 | -function get_roles($content,$id, $scope='course') { |
|
| 444 | - $course_id = api_get_course_int_id(); |
|
| 445 | - if ($content=='user') { |
|
| 446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 443 | +function get_roles($content, $id, $scope = 'course') { |
|
| 444 | + $course_id = api_get_course_int_id(); |
|
| 445 | + if ($content == 'user') { |
|
| 446 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | 447 | $id_field = user_id; |
| 448 | 448 | } |
| 449 | - if ($content=='group') { |
|
| 450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 449 | + if ($content == 'group') { |
|
| 450 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | 451 | $id_field = 'group_id'; |
| 452 | 452 | } |
| 453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 453 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 454 | 454 | |
| 455 | - $current_roles=array(); |
|
| 455 | + $current_roles = array(); |
|
| 456 | 456 | //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
| 457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | - $result=Database::query($sql); |
|
| 459 | - while ($row=Database::fetch_array($result)) { |
|
| 460 | - $current_roles[]=$row['role_id']; |
|
| 457 | + $sql = "SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | + $result = Database::query($sql); |
|
| 459 | + while ($row = Database::fetch_array($result)) { |
|
| 460 | + $current_roles[] = $row['role_id']; |
|
| 461 | 461 | } |
| 462 | 462 | return $current_roles; |
| 463 | 463 | } |
@@ -468,26 +468,26 @@ discard block |
||
| 468 | 468 | * @author Patrick Cool <[email protected]>, Ghent University |
| 469 | 469 | * @version 1.0 |
| 470 | 470 | */ |
| 471 | -function get_all_roles($content='course') { |
|
| 471 | +function get_all_roles($content = 'course') { |
|
| 472 | 472 | $course_id = api_get_course_int_id(); |
| 473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
| 474 | 474 | |
| 475 | - if ($content=='course') |
|
| 475 | + if ($content == 'course') |
|
| 476 | 476 | { |
| 477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 477 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 478 | 478 | } |
| 479 | - if ($content=='platform') |
|
| 479 | + if ($content == 'platform') |
|
| 480 | 480 | { |
| 481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 481 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 482 | 482 | $course_id_condition = ''; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - $current_roles=array(); |
|
| 486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | - $result=Database::query($sql); |
|
| 488 | - while ($row=Database::fetch_array($result)) |
|
| 485 | + $current_roles = array(); |
|
| 486 | + $sql = "SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | + $result = Database::query($sql); |
|
| 488 | + while ($row = Database::fetch_array($result)) |
|
| 489 | 489 | { |
| 490 | - $roles[]=$row; |
|
| 490 | + $roles[] = $row; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | return $roles; |
@@ -504,10 +504,10 @@ discard block |
||
| 504 | 504 | * @author Patrick Cool <[email protected]>, Ghent University |
| 505 | 505 | * @version 1.0 |
| 506 | 506 | */ |
| 507 | -function get_roles_permissions($content,$id, $scope='course') { |
|
| 507 | +function get_roles_permissions($content, $id, $scope = 'course') { |
|
| 508 | 508 | $course_id = api_get_course_int_id(); |
| 509 | 509 | if ($content == 'user') { |
| 510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 510 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | 511 | $id_field = 'user_id'; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -536,21 +536,21 @@ discard block |
||
| 536 | 536 | $sql = " |
| 537 | 537 | SELECT * |
| 538 | 538 | FROM |
| 539 | - " . $table . " role_group_user, |
|
| 540 | - " . $table_role . " role, |
|
| 541 | - " . $table_role_permissions . " role_permissions |
|
| 539 | + " . $table." role_group_user, |
|
| 540 | + " . $table_role." role, |
|
| 541 | + " . $table_role_permissions." role_permissions |
|
| 542 | 542 | WHERE |
| 543 | 543 | role_group_user.c_id = $course_id AND |
| 544 | 544 | $role_condition |
| 545 | - role_group_user.scope = '" . $scope . "' AND |
|
| 546 | - role_group_user." . $id_field . " = '" . $id . "' AND |
|
| 545 | + role_group_user.scope = '".$scope."' AND |
|
| 546 | + role_group_user." . $id_field." = '".$id."' AND |
|
| 547 | 547 | role_group_user.role_id = role.role_id AND |
| 548 | 548 | role.role_id = role_permissions.role_id"; |
| 549 | 549 | |
| 550 | 550 | $result = Database::query($sql); |
| 551 | 551 | $current_role_permissions = array(); |
| 552 | - while ($row=Database::fetch_array($result)) { |
|
| 553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 552 | + while ($row = Database::fetch_array($result)) { |
|
| 553 | + $current_role_permissions[$row['tool']][] = $row['action']; |
|
| 554 | 554 | } |
| 555 | 555 | return $current_role_permissions; |
| 556 | 556 | } |
@@ -564,33 +564,33 @@ discard block |
||
| 564 | 564 | * @author Patrick Cool <[email protected]>, Ghent University |
| 565 | 565 | */ |
| 566 | 566 | |
| 567 | -function assign_role($content, $action, $id, $role_id, $scope='course') { |
|
| 567 | +function assign_role($content, $action, $id, $role_id, $scope = 'course') { |
|
| 568 | 568 | $course_id = api_get_course_int_id(); |
| 569 | 569 | // Which database are we using (depending on the $content parameter) |
| 570 | - if ($content=='user') { |
|
| 571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 570 | + if ($content == 'user') { |
|
| 571 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | 572 | $id_field = 'user_id'; |
| 573 | - } elseif($content=='group') { |
|
| 574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 573 | + } elseif ($content == 'group') { |
|
| 574 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | 575 | $id_field = 'group_id'; |
| 576 | 576 | } else { |
| 577 | 577 | return get_lang('Error'); |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | // grating a right |
| 581 | - if ($action=='grant') { |
|
| 582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | - $result=Database::query($sql); |
|
| 581 | + if ($action == 'grant') { |
|
| 582 | + $sql = "INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | + $result = Database::query($sql); |
|
| 584 | 584 | if ($result) { |
| 585 | - $result_message=get_lang('RoleGranted'); |
|
| 585 | + $result_message = get_lang('RoleGranted'); |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if ($action=='revoke') { |
|
| 590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | - $result=Database::query($sql); |
|
| 589 | + if ($action == 'revoke') { |
|
| 590 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | + $result = Database::query($sql); |
|
| 592 | 592 | if ($result) { |
| 593 | - $result_message=get_lang('RoleRevoked'); |
|
| 593 | + $result_message = get_lang('RoleRevoked'); |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | return $result_message; |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | { |
| 608 | 608 | foreach ($permissions as $permissionkey=>$permissionvalue) |
| 609 | 609 | { |
| 610 | - $array1[$tool][]=$permissionvalue; |
|
| 610 | + $array1[$tool][] = $permissionvalue; |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | return $array1; |
@@ -338,6 +338,10 @@ |
||
| 338 | 338 | * @param icon - if ="icon" then the small icon will appear |
| 339 | 339 | * if ="wrap" then wrapped settings are used (and no icon is displayed) |
| 340 | 340 | * if ="nolink" then only the name is returned with no href and no icon (note:only in this case, the result is not displayed, but returned) |
| 341 | +* @param string $completed |
|
| 342 | +* @param string $id_in_path |
|
| 343 | +* @param string $builder |
|
| 344 | +* @param string $icon |
|
| 341 | 345 | * @todo this function is too long, rewrite |
| 342 | 346 | */ |
| 343 | 347 | function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | function unset_session_resources() { |
| 27 | - $_SESSION['addedresource']=''; |
|
| 28 | - $_SESSION['addedresourceid']=''; |
|
| 27 | + $_SESSION['addedresource'] = ''; |
|
| 28 | + $_SESSION['addedresourceid'] = ''; |
|
| 29 | 29 | Session::erase('addedresource'); |
| 30 | 30 | Session::erase('addedresourceid'); |
| 31 | 31 | } |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | if ($level and $level != 0 and $level != 1) |
| 48 | 48 | { |
| 49 | - $folder_up=$folder; |
|
| 50 | - $folder_temp=explode('/',$folder); |
|
| 51 | - $last=count($folder_temp)-1; |
|
| 49 | + $folder_up = $folder; |
|
| 50 | + $folder_temp = explode('/', $folder); |
|
| 51 | + $last = count($folder_temp) - 1; |
|
| 52 | 52 | unset($folder_temp[$last]); |
| 53 | - $folder_up=implode('/',$folder_temp); |
|
| 53 | + $folder_up = implode('/', $folder_temp); |
|
| 54 | 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 | 55 | } |
| 56 | 56 | } |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | // other tools do not have this feature. This only counts |
| 69 | 69 | if (api_is_allowed_to_edit()) |
| 70 | 70 | { |
| 71 | - $visibility="ip.visibility<>'2'"; |
|
| 71 | + $visibility = "ip.visibility<>'2'"; |
|
| 72 | 72 | } |
| 73 | 73 | else |
| 74 | 74 | { |
| 75 | - $visibility="ip.visibility='1'"; |
|
| 75 | + $visibility = "ip.visibility='1'"; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); |
@@ -85,12 +85,12 @@ 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)) |
|
| 88 | + $result = Database::query($sql); |
|
| 89 | + while ($row = Database::fetch_array($result)) |
|
| 90 | 90 | { |
| 91 | 91 | if (!$folder) |
| 92 | 92 | { |
| 93 | - if (get_levels($row['path'])-1==1) |
|
| 93 | + if (get_levels($row['path']) - 1 == 1) |
|
| 94 | 94 | { |
| 95 | 95 | // showing the right icon |
| 96 | 96 | if (file_or_folder($row['path'])) |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | if (file_or_folder($row['path'])) |
| 108 | 108 | { |
| 109 | 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 />'; |
|
| 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 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - echo substr($row['path'],1).' '; |
|
| 115 | - echo showorhide_addresourcelink('Document',$row['id']); |
|
| 114 | + echo substr($row['path'], 1).' '; |
|
| 115 | + echo showorhide_addresourcelink('Document', $row['id']); |
|
| 116 | 116 | echo '<br />'; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -121,16 +121,16 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | // we calculate the level we are in by using the $folder in the url |
| 123 | 123 | // we put +1 because it does not start with an / and in the database it does |
| 124 | - $level=get_levels($folder)+1; |
|
| 124 | + $level = get_levels($folder) + 1; |
|
| 125 | 125 | |
| 126 | 126 | // we calculate each level of the database entry |
| 127 | - $file_level=get_levels($row['path'])-1; |
|
| 127 | + $file_level = get_levels($row['path']) - 1; |
|
| 128 | 128 | // if the level of the database entry is equal to the level we ar in, we put it into an array |
| 129 | 129 | // as this is a potential good entry |
| 130 | - if ($file_level==$level) |
|
| 130 | + if ($file_level == $level) |
|
| 131 | 131 | { |
| 132 | - $good_paths[]=$row['path']; |
|
| 133 | - $good_ids[]=$row['id']; |
|
| 132 | + $good_paths[] = $row['path']; |
|
| 133 | + $good_ids[] = $row['id']; |
|
| 134 | 134 | } |
| 135 | 135 | //$haystack=$row['path']; |
| 136 | 136 | //$conform_folder=strstr($haystack, $folder); |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | // we have all the potential good database entries, the good ones are those that start with $folder |
| 150 | 150 | foreach ($good_paths as $path) |
| 151 | 151 | { |
| 152 | - if (strstr($path,$folder)) |
|
| 152 | + if (strstr($path, $folder)) |
|
| 153 | 153 | { |
| 154 | - $good_key=key($good_paths); |
|
| 154 | + $good_key = key($good_paths); |
|
| 155 | 155 | // showing the right icon |
| 156 | 156 | if (file_or_folder($path)) |
| 157 | 157 | { |
@@ -166,17 +166,17 @@ discard block |
||
| 166 | 166 | // folders should be clickable |
| 167 | 167 | if (file_or_folder($path)) |
| 168 | 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); |
|
| 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 | 172 | //using the correct name of the folder |
| 173 | - $folder_name=str_replace($folder.'/','',$path); |
|
| 173 | + $folder_name = str_replace($folder.'/', '', $path); |
|
| 174 | 174 | echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
| 175 | 175 | } |
| 176 | 176 | else |
| 177 | 177 | { |
| 178 | - echo str_replace("/$folder/", '',$path).' '; |
|
| 179 | - echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
|
| 178 | + echo str_replace("/$folder/", '', $path).' '; |
|
| 179 | + echo showorhide_addresourcelink('Document', $good_ids[$good_key]); |
|
| 180 | 180 | echo '<br />'; |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | { |
| 220 | 220 | foreach ($addedresource as $resource_type) |
| 221 | 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)]."')"; |
|
| 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 | 223 | Database::query($sql); |
| 224 | - $i=key($addedresource); |
|
| 224 | + $i = key($addedresource); |
|
| 225 | 225 | next($addedresource); |
| 226 | 226 | } |
| 227 | - $_SESSION['addedresource']=''; |
|
| 228 | - $_SESSION['addedresourceid']=''; |
|
| 227 | + $_SESSION['addedresource'] = ''; |
|
| 228 | + $_SESSION['addedresourceid'] = ''; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param $style this is used to style the link (for instance when a resource is hidden => the added resources should also be styled like they are hidden) |
| 239 | 239 | * @todo use the constants for the type definitions. |
| 240 | 240 | */ |
| 241 | -function display_addedresource_link($type, $id, $style='') |
|
| 241 | +function display_addedresource_link($type, $id, $style = '') |
|
| 242 | 242 | { |
| 243 | 243 | global $_course; |
| 244 | 244 | |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | break; |
| 284 | 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'; |
|
| 286 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 287 | + $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
| 288 | + $TBL_FORUMS = $_course['dbNameGlu'].'bb_forums'; |
|
| 289 | 289 | $result = Database::query("SELECT * FROM $tbl_posts posts, $TBL_FORUMS forum WHERE forum.forum_id=posts.forum_id and post_id=$id"); |
| 290 | 290 | $myrow = Database::fetch_array($result); |
| 291 | 291 | // grabbing the title of the post |
@@ -307,14 +307,14 @@ discard block |
||
| 307 | 307 | $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
| 308 | 308 | $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
| 309 | 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 |
|
| 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 | 313 | $image = choose_image($filename); |
| 314 | - $ext = explode('.',$filename); |
|
| 315 | - $ext = strtolower($ext[sizeof($ext)-1]); |
|
| 314 | + $ext = explode('.', $filename); |
|
| 315 | + $ext = strtolower($ext[sizeof($ext) - 1]); |
|
| 316 | 316 | $myrow['path'] = rawurlencode($myrow['path']); |
| 317 | - $in_frames = in_array($ext, array('htm','html','gif','jpg','jpeg','png')); |
|
| 317 | + $in_frames = in_array($ext, array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png')); |
|
| 318 | 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 | 319 | break; |
| 320 | 320 | case 'Externallink': |
@@ -349,391 +349,391 @@ discard block |
||
| 349 | 349 | |
| 350 | 350 | $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
| 351 | 351 | |
| 352 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 352 | + if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 353 | 353 | $linktype = $type; |
| 354 | 354 | if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
| 355 | 355 | |
| 356 | 356 | switch ($type) |
| 357 | 357 | { |
| 358 | 358 | case "Agenda": |
| 359 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 359 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 360 | 360 | $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
| 361 | - $myrow=Database::fetch_array($result); |
|
| 361 | + $myrow = Database::fetch_array($result); |
|
| 362 | 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); |
|
| 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 | 369 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 370 | 370 | if ($icon != 'nolink') |
| 371 | 371 | { |
| 372 | - if ($completed=='completed') { |
|
| 372 | + if ($completed == 'completed') { |
|
| 373 | 373 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 374 | - } else { |
|
| 374 | + } else { |
|
| 375 | 375 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 376 | 376 | //echo " "; |
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 380 | 380 | |
| 381 | - if ($myrow["title"]=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 381 | + if ($myrow["title"] == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 382 | 382 | |
| 383 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 383 | + if ($icon == 'nolink') { return(shorten($myrow["title"], $length)); } |
|
| 384 | 384 | if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
| 385 | 385 | if ($builder != 'builder') |
| 386 | 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"; |
|
| 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 | 389 | if ($desc != '') |
| 390 | 390 | { |
| 391 | 391 | if ($icon != 'wrap') |
| 392 | 392 | { |
| 393 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 393 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 394 | 394 | } |
| 395 | 395 | else |
| 396 | 396 | { |
| 397 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 397 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | else |
| 402 | 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>"; |
|
| 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 | 404 | } |
| 405 | 405 | break; |
| 406 | 406 | |
| 407 | 407 | case "Ad_Valvas": |
| 408 | 408 | $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
| 409 | 409 | $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
| 410 | - $myrow=Database::fetch_array($result); |
|
| 410 | + $myrow = Database::fetch_array($result); |
|
| 411 | 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); |
|
| 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 | 418 | |
| 419 | 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']; |
|
| 420 | + list($title, $text) = split('<br>', $myrow['content']); |
|
| 421 | + if ($title == '') { $title = $myrow['content']; } |
|
| 422 | + $title = $myrow['title']; |
|
| 423 | + $text = $myrow['content']; |
|
| 424 | 424 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 425 | 425 | if ($icon != 'nolink') |
| 426 | 426 | { |
| 427 | - if ($completed=='completed') { |
|
| 427 | + if ($completed == 'completed') { |
|
| 428 | 428 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 429 | - } else { |
|
| 429 | + } else { |
|
| 430 | 430 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 431 | 431 | //echo " "; |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 435 | 435 | |
| 436 | - if ($title=='') { |
|
| 437 | - $type="Announcement"; |
|
| 436 | + if ($title == '') { |
|
| 437 | + $type = "Announcement"; |
|
| 438 | 438 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
| 439 | 439 | return(true); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
| 442 | + if ($icon == 'nolink') { return(shorten($title, $length)); } |
|
| 443 | 443 | if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
| 444 | 444 | if ($builder != 'builder') |
| 445 | 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"; |
|
| 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 | 448 | if ($desc != '') |
| 449 | 449 | { |
| 450 | 450 | if ($icon != 'wrap') |
| 451 | 451 | { |
| 452 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 452 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 453 | 453 | } |
| 454 | 454 | else |
| 455 | 455 | { |
| 456 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 456 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | } |
| 460 | 460 | else |
| 461 | 461 | { |
| 462 | - echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
|
| 462 | + echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title, ($length - 3 * $level))."</a>"; |
|
| 463 | 463 | } |
| 464 | 464 | break; |
| 465 | 465 | |
| 466 | 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); |
|
| 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 | 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); |
|
| 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 | 476 | |
| 477 | 477 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 478 | 478 | if ($icon != 'nolink') |
| 479 | 479 | { |
| 480 | - if ($completed=='completed') { |
|
| 480 | + if ($completed == 'completed') { |
|
| 481 | 481 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 482 | - } else { |
|
| 482 | + } else { |
|
| 483 | 483 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 484 | 484 | //echo " "; |
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 488 | 488 | |
| 489 | - if ($myrow["title"]=='') |
|
| 489 | + if ($myrow["title"] == '') |
|
| 490 | 490 | { |
| 491 | 491 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
| 492 | 492 | return(true); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 495 | + if ($icon == 'nolink') { return(shorten($myrow["title"], $length)); } |
|
| 496 | 496 | if ($icon == 'icon') |
| 497 | 497 | { |
| 498 | - if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
| 498 | + if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
| 499 | 499 | else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
| 500 | 500 | } |
| 501 | - $thelink=$myrow["url"]; |
|
| 501 | + $thelink = $myrow["url"]; |
|
| 502 | 502 | if ($builder != 'builder') |
| 503 | 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"; |
|
| 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 | 506 | if ($desc != '') |
| 507 | 507 | { |
| 508 | 508 | if ($icon != 'wrap') |
| 509 | 509 | { |
| 510 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 510 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 511 | 511 | } |
| 512 | 512 | else |
| 513 | 513 | { |
| 514 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 514 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | else |
| 519 | 519 | { |
| 520 | - echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 520 | + echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"], ($length - 3 * $level))."</a>"; |
|
| 521 | 521 | } |
| 522 | 522 | break; |
| 523 | 523 | |
| 524 | 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); |
|
| 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 | 528 | |
| 529 | - if ($builder=='builder') { $origin='builder'; } |
|
| 529 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 530 | 530 | //this is needed for the exercise_submit.php can delete the session info about tests |
| 531 | 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); |
|
| 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 | 537 | |
| 538 | 538 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 539 | 539 | if ($icon != 'nolink') |
| 540 | 540 | { |
| 541 | - if ($completed=='completed') { |
|
| 541 | + if ($completed == 'completed') { |
|
| 542 | 542 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 543 | - } else { |
|
| 543 | + } else { |
|
| 544 | 544 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 545 | 545 | //echo " "; |
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 549 | 549 | |
| 550 | - if ($myrow["title"]=='') { |
|
| 550 | + if ($myrow["title"] == '') { |
|
| 551 | 551 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
| 552 | 552 | return(true); |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 555 | + if ($icon == 'nolink') { return(shorten($myrow["title"], $length)); } |
|
| 556 | 556 | if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
| 557 | 557 | if ($builder != 'builder') |
| 558 | 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"; |
|
| 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 | 561 | if ($desc != '') |
| 562 | 562 | { |
| 563 | 563 | if ($icon != 'wrap') |
| 564 | 564 | { |
| 565 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 565 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 566 | 566 | } |
| 567 | 567 | else |
| 568 | 568 | { |
| 569 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 569 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | else |
| 574 | 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>"; |
|
| 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 | 576 | } |
| 577 | 577 | break; |
| 578 | 578 | |
| 579 | 579 | case "HotPotatoes": |
| 580 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 581 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 580 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 581 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 582 | 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); |
|
| 583 | + $myrow = Database::fetch_array($result); |
|
| 584 | + $path = $myrow["path"]; |
|
| 585 | + $name = GetQuizName($path, $documentPath); |
|
| 586 | 586 | |
| 587 | - if ($builder=='builder') { $origin='builder'; } |
|
| 587 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 588 | 588 | //this is needed for the exercise_submit.php can delete the session info about tests |
| 589 | 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); |
|
| 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 | 595 | |
| 596 | 596 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 597 | 597 | if ($icon != 'nolink') |
| 598 | 598 | { |
| 599 | - if ($completed=='completed') { |
|
| 599 | + if ($completed == 'completed') { |
|
| 600 | 600 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 601 | - } else { |
|
| 601 | + } else { |
|
| 602 | 602 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 603 | 603 | //echo " "; |
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 607 | 607 | |
| 608 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 608 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 609 | 609 | |
| 610 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 610 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 611 | 611 | if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } |
| 612 | 612 | |
| 613 | 613 | $cid = $_course['official_code']; |
| 614 | 614 | |
| 615 | 615 | if ($builder != 'builder') |
| 616 | 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"; |
|
| 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 | 619 | if ($desc != '') |
| 620 | 620 | { |
| 621 | 621 | if ($icon != 'wrap') |
| 622 | 622 | { |
| 623 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 623 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 624 | 624 | } |
| 625 | 625 | else |
| 626 | 626 | { |
| 627 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 627 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | else |
| 632 | 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>"; |
|
| 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 | 634 | } |
| 635 | 635 | break; |
| 636 | 636 | |
| 637 | 637 | case "Forum": |
| 638 | 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); |
|
| 639 | + $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 640 | + $myrow = Database::fetch_array($result); |
|
| 641 | 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); |
|
| 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 | 647 | |
| 648 | 648 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 649 | 649 | if ($icon != 'nolink') |
| 650 | 650 | { |
| 651 | - if ($completed=='completed') { |
|
| 651 | + if ($completed == 'completed') { |
|
| 652 | 652 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 653 | - } else { |
|
| 653 | + } else { |
|
| 654 | 654 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 655 | 655 | //echo " "; |
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 659 | 659 | |
| 660 | - if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 660 | + if ($myrow["forum_name"] == '') { $type = "Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 661 | 661 | |
| 662 | - if ($icon == 'nolink') { return(shorten($myrow["forum_name"],$length)); } |
|
| 662 | + if ($icon == 'nolink') { return(shorten($myrow["forum_name"], $length)); } |
|
| 663 | 663 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 664 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 664 | + $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 665 | 665 | if ($builder != 'builder') |
| 666 | 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"; |
|
| 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 | 669 | if ($desc != '') |
| 670 | 670 | { |
| 671 | 671 | if ($icon != 'wrap') |
| 672 | 672 | { |
| 673 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 673 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 674 | 674 | } |
| 675 | 675 | else |
| 676 | 676 | { |
| 677 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 677 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | else |
| 682 | 682 | { |
| 683 | - echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 683 | + echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"], ($length - 3 * $level))."</a>"; |
|
| 684 | 684 | } |
| 685 | 685 | break; |
| 686 | 686 | |
| 687 | 687 | case "Thread": //forum post |
| 688 | 688 | //deprecated |
| 689 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 690 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 689 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 690 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 691 | 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); |
|
| 692 | + $sql = "SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 693 | + $result = Database::query($sql); |
|
| 694 | + $myrow = Database::fetch_array($result); |
|
| 695 | 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); |
|
| 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 | 701 | |
| 702 | 702 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 703 | 703 | if ($icon != 'nolink') |
| 704 | 704 | { |
| 705 | - if ($completed=='completed') { |
|
| 705 | + if ($completed == 'completed') { |
|
| 706 | 706 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 707 | - } else { |
|
| 707 | + } else { |
|
| 708 | 708 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 709 | 709 | //echo " "; |
| 710 | 710 | } |
| 711 | 711 | } |
| 712 | 712 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 713 | 713 | |
| 714 | - if ($myrow["topic_title"]=='') { $type="Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 714 | + if ($myrow["topic_title"] == '') { $type = "Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 715 | 715 | |
| 716 | - if ($icon == 'nolink') { return(shorten($myrow["topic_title"],$length)); } |
|
| 716 | + if ($icon == 'nolink') { return(shorten($myrow["topic_title"], $length)); } |
|
| 717 | 717 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 718 | 718 | if ($builder != 'builder') |
| 719 | 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"; |
|
| 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 | 722 | if ($desc != '') |
| 723 | 723 | { |
| 724 | 724 | if ($icon != 'wrap') |
| 725 | 725 | { |
| 726 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 726 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 727 | 727 | } |
| 728 | 728 | else |
| 729 | 729 | { |
| 730 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 730 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | else |
| 735 | 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>"; |
|
| 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 | 737 | } |
| 738 | 738 | break; |
| 739 | 739 | |
@@ -742,363 +742,363 @@ discard block |
||
| 742 | 742 | $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
| 743 | 743 | $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
| 744 | 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); |
|
| 745 | + $result = Database::query("SELECT * FROM $tbl_posts where post_id=$id"); |
|
| 746 | + $myrow = Database::fetch_array($result); |
|
| 747 | 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); |
|
| 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 | 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); |
|
| 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 | 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); |
|
| 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 | 762 | |
| 763 | 763 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 764 | 764 | if ($icon != 'nolink') |
| 765 | 765 | { |
| 766 | - if ($completed=='completed') { |
|
| 766 | + if ($completed == 'completed') { |
|
| 767 | 767 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 768 | - } else { |
|
| 768 | + } else { |
|
| 769 | 769 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 770 | 770 | //echo " "; |
| 771 | 771 | } |
| 772 | 772 | } |
| 773 | 773 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 774 | 774 | |
| 775 | - if ($myrow_titel["post_title"]=='') |
|
| 775 | + if ($myrow_titel["post_title"] == '') |
|
| 776 | 776 | { |
| 777 | - $type="Forum"; |
|
| 777 | + $type = "Forum"; |
|
| 778 | 778 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"],$length)); } |
|
| 781 | + if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"], $length)); } |
|
| 782 | 782 | if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
| 783 | 783 | if ($builder != 'builder') |
| 784 | 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"; |
|
| 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 | 786 | if ($desc != '') |
| 787 | 787 | { |
| 788 | 788 | if ($icon != 'wrap') |
| 789 | 789 | { |
| 790 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 790 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 791 | 791 | } |
| 792 | 792 | else |
| 793 | 793 | { |
| 794 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 794 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | else |
| 799 | 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>"; |
|
| 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 | 801 | } |
| 802 | 802 | break; |
| 803 | 803 | |
| 804 | 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); |
|
| 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 | 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 |
|
| 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 | 812 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 813 | 813 | |
| 814 | - echo str_repeat(" >",$level); |
|
| 814 | + echo str_repeat(" >", $level); |
|
| 815 | 815 | |
| 816 | 816 | if ($icon != 'nolink') { |
| 817 | - if ($completed=='completed') { |
|
| 817 | + if ($completed == 'completed') { |
|
| 818 | 818 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 819 | - } else { |
|
| 819 | + } else { |
|
| 820 | 820 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 821 | 821 | //echo " "; |
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 825 | - $image=choose_image($filename); |
|
| 825 | + $image = choose_image($filename); |
|
| 826 | 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']; |
|
| 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 | 831 | |
| 832 | - if (($myrow["path"]=='') and ($filename=='')) { |
|
| 832 | + if (($myrow["path"] == '') and ($filename == '')) { |
|
| 833 | 833 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
| 834 | 834 | return(true); |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - if ($icon == 'nolink') { return(shorten($filename,$length)); } |
|
| 837 | + if ($icon == 'nolink') { return(shorten($filename, $length)); } |
|
| 838 | 838 | if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
| 839 | 839 | if ($builder != 'builder') |
| 840 | 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>"; |
|
| 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 | 842 | if ($desc != '') |
| 843 | 843 | { |
| 844 | 844 | if ($icon != 'wrap') |
| 845 | 845 | { |
| 846 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 846 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 847 | 847 | } |
| 848 | 848 | else |
| 849 | 849 | { |
| 850 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 850 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 851 | 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"; |
|
| 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 | 853 | } |
| 854 | 854 | else |
| 855 | 855 | { |
| 856 | - $enableDocumentParsing='yes'; |
|
| 856 | + $enableDocumentParsing = 'yes'; |
|
| 857 | 857 | if (!$enableDocumentParsing) |
| 858 | 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>"; |
|
| 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 | 861 | } |
| 862 | 862 | else |
| 863 | 863 | { |
| 864 | - echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 864 | + echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename, ($length - 3 * $level))."</a>"; |
|
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | break; |
| 868 | 868 | |
| 869 | 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); |
|
| 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 | 876 | |
| 877 | 877 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 878 | 878 | if ($icon != 'nolink') |
| 879 | 879 | { |
| 880 | - if ($completed=='completed') { |
|
| 880 | + if ($completed == 'completed') { |
|
| 881 | 881 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 882 | - } else { |
|
| 882 | + } else { |
|
| 883 | 883 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 884 | 884 | //echo " "; |
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 888 | 888 | |
| 889 | - if ($name=='') |
|
| 889 | + if ($name == '') |
|
| 890 | 890 | { |
| 891 | 891 | echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 894 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 895 | 895 | if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
| 896 | 896 | if ($builder != 'builder') |
| 897 | 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"; |
|
| 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 | 899 | if ($desc != '') |
| 900 | 900 | { |
| 901 | 901 | if ($icon != 'wrap') |
| 902 | 902 | { |
| 903 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 903 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; |
|
| 904 | 904 | } |
| 905 | 905 | else |
| 906 | 906 | { |
| 907 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 907 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; |
|
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | else |
| 912 | 912 | { |
| 913 | - echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 913 | + echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 914 | 914 | } |
| 915 | 915 | break; |
| 916 | 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); |
|
| 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 | 923 | |
| 924 | 924 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 925 | 925 | if ($icon != 'nolink') { |
| 926 | - if ($completed=='completed') { |
|
| 926 | + if ($completed == 'completed') { |
|
| 927 | 927 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 928 | - } else { |
|
| 928 | + } else { |
|
| 929 | 929 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 930 | 930 | //echo " "; |
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | 933 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 934 | 934 | |
| 935 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 935 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 936 | 936 | |
| 937 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 937 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 938 | 938 | if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
| 939 | 939 | |
| 940 | 940 | if ($builder != 'builder') |
| 941 | 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"; |
|
| 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 | 943 | if ($desc != '') { |
| 944 | 944 | if ($icon != 'wrap') { |
| 945 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 945 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 946 | 946 | else { |
| 947 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 947 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 948 | 948 | } |
| 949 | 949 | } else { |
| 950 | - echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 950 | + echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 951 | 951 | } |
| 952 | 952 | break; |
| 953 | 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); |
|
| 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 | 960 | |
| 961 | 961 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 962 | 962 | if ($icon != 'nolink') { |
| 963 | - if ($completed=='completed') { |
|
| 963 | + if ($completed == 'completed') { |
|
| 964 | 964 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 965 | - } else { |
|
| 965 | + } else { |
|
| 966 | 966 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 967 | 967 | //echo " "; |
| 968 | 968 | } |
| 969 | 969 | } |
| 970 | 970 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 971 | 971 | |
| 972 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 972 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 973 | 973 | |
| 974 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 974 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 975 | 975 | if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
| 976 | 976 | |
| 977 | 977 | if ($builder != 'builder') |
| 978 | 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"; |
|
| 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 | 981 | if ($desc != '') { |
| 982 | 982 | if ($icon != 'wrap') { |
| 983 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 983 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 984 | 984 | else { |
| 985 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 985 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 986 | 986 | } |
| 987 | 987 | } else { |
| 988 | 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>"; |
|
| 989 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 990 | 990 | } |
| 991 | 991 | break; |
| 992 | 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); |
|
| 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 | 999 | |
| 1000 | 1000 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 1001 | 1001 | if ($icon != 'nolink') { |
| 1002 | - if ($completed=='completed') { |
|
| 1002 | + if ($completed == 'completed') { |
|
| 1003 | 1003 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1004 | - } else { |
|
| 1004 | + } else { |
|
| 1005 | 1005 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1006 | 1006 | //echo " "; |
| 1007 | 1007 | } |
| 1008 | 1008 | } |
| 1009 | 1009 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 1010 | 1010 | |
| 1011 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1011 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1012 | 1012 | |
| 1013 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1013 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 1014 | 1014 | if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
| 1015 | 1015 | |
| 1016 | 1016 | if ($builder != 'builder') |
| 1017 | 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"; |
|
| 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 | 1019 | if ($desc != '') { |
| 1020 | 1020 | if ($icon != 'wrap') { |
| 1021 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1021 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 1022 | 1022 | else { |
| 1023 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1023 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 1024 | 1024 | } |
| 1025 | 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>"; |
|
| 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 | 1028 | } |
| 1029 | 1029 | break; |
| 1030 | 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); |
|
| 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 | 1037 | |
| 1038 | 1038 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 1039 | 1039 | if ($icon != 'nolink') { |
| 1040 | - if ($completed=='completed') { |
|
| 1040 | + if ($completed == 'completed') { |
|
| 1041 | 1041 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1042 | - } else { |
|
| 1042 | + } else { |
|
| 1043 | 1043 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1044 | 1044 | //echo " "; |
| 1045 | 1045 | } |
| 1046 | 1046 | } |
| 1047 | 1047 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 1048 | 1048 | |
| 1049 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1049 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1050 | 1050 | |
| 1051 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1051 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 1052 | 1052 | if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
| 1053 | 1053 | |
| 1054 | 1054 | if ($builder != 'builder') |
| 1055 | 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"; |
|
| 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 | 1057 | if ($desc != '') { |
| 1058 | 1058 | if ($icon != 'wrap') { |
| 1059 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1059 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 1060 | 1060 | else { |
| 1061 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1061 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 1062 | 1062 | } |
| 1063 | 1063 | } else { |
| 1064 | - echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1064 | + echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 1065 | 1065 | } |
| 1066 | 1066 | break; |
| 1067 | 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); |
|
| 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 | 1074 | |
| 1075 | 1075 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
| 1076 | 1076 | if ($icon != 'nolink') { |
| 1077 | - if ($completed=='completed') { |
|
| 1077 | + if ($completed == 'completed') { |
|
| 1078 | 1078 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1079 | - } else { |
|
| 1079 | + } else { |
|
| 1080 | 1080 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1081 | 1081 | //echo " "; |
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
| 1085 | 1085 | |
| 1086 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1086 | + if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1087 | 1087 | |
| 1088 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1088 | + if ($icon == 'nolink') { return(shorten($name, $length)); } |
|
| 1089 | 1089 | if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
| 1090 | 1090 | |
| 1091 | 1091 | if ($builder != 'builder') |
| 1092 | 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"; |
|
| 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 | 1094 | if ($desc != '') { |
| 1095 | 1095 | if ($icon != 'wrap') { |
| 1096 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1096 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; } |
|
| 1097 | 1097 | else { |
| 1098 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1098 | + echo "<div class='description'> ".shorten($desc, ($length - 3 * $level))."</div>"; } |
|
| 1099 | 1099 | } |
| 1100 | 1100 | } else { |
| 1101 | - echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1101 | + echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>"; |
|
| 1102 | 1102 | } |
| 1103 | 1103 | break; |
| 1104 | 1104 | }//end huge switch-statement |
@@ -1117,29 +1117,29 @@ discard block |
||
| 1117 | 1117 | function get_addedresource_link_in_learnpath($type, $id, $id_in_path) |
| 1118 | 1118 | { |
| 1119 | 1119 | global $_course, $learnpath_id, $tbl_learnpath_item, $items; |
| 1120 | - global $curDirPath, $_configuration, $enableDocumentParsing, $_user , $_cid; |
|
| 1120 | + global $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; |
|
| 1121 | 1121 | |
| 1122 | 1122 | $hyperlink_target_parameter = ""; //or e.g. target='_blank' |
| 1123 | 1123 | $builder = 'player'; |
| 1124 | - $origin='learnpath'; |
|
| 1124 | + $origin = 'learnpath'; |
|
| 1125 | 1125 | |
| 1126 | - $linktype=$type; |
|
| 1127 | - if (($type=="Link _self") or ($type=="Link _blank")) { $type="Link"; } |
|
| 1126 | + $linktype = $type; |
|
| 1127 | + if (($type == "Link _self") or ($type == "Link _blank")) { $type = "Link"; } |
|
| 1128 | 1128 | |
| 1129 | 1129 | $link = ''; |
| 1130 | 1130 | |
| 1131 | 1131 | switch ($type) |
| 1132 | 1132 | { |
| 1133 | 1133 | case "Agenda": |
| 1134 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);; |
|
| 1134 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); ; |
|
| 1135 | 1135 | $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
| 1136 | - $myrow=Database::fetch_array($result); |
|
| 1136 | + $myrow = Database::fetch_array($result); |
|
| 1137 | 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']; |
|
| 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 | 1143 | |
| 1144 | 1144 | if ($builder != 'builder') |
| 1145 | 1145 | { |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | case "Ad_Valvas": |
| 1155 | 1155 | $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
| 1156 | 1156 | $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
| 1157 | - $myrow=Database::fetch_array($result); |
|
| 1157 | + $myrow = Database::fetch_array($result); |
|
| 1158 | 1158 | |
| 1159 | 1159 | if ($builder != 'builder') |
| 1160 | 1160 | { |
@@ -1167,14 +1167,14 @@ discard block |
||
| 1167 | 1167 | break; |
| 1168 | 1168 | |
| 1169 | 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); |
|
| 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 | 1173 | |
| 1174 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1175 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1174 | + $sql = "select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1175 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1176 | 1176 | |
| 1177 | - $thelink=$myrow["url"]; |
|
| 1177 | + $thelink = $myrow["url"]; |
|
| 1178 | 1178 | if ($builder != 'builder') |
| 1179 | 1179 | { |
| 1180 | 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"; |
@@ -1186,16 +1186,16 @@ discard block |
||
| 1186 | 1186 | break; |
| 1187 | 1187 | |
| 1188 | 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); |
|
| 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 | 1192 | |
| 1193 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1193 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 1194 | 1194 | //this is needed for the exercise_submit.php can delete the session info about tests |
| 1195 | 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']; } |
|
| 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 | 1199 | |
| 1200 | 1200 | if ($builder != 'builder') |
| 1201 | 1201 | { |
@@ -1208,14 +1208,14 @@ discard block |
||
| 1208 | 1208 | break; |
| 1209 | 1209 | |
| 1210 | 1210 | case "HotPotatoes": |
| 1211 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1212 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 1211 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1212 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 1213 | 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); |
|
| 1214 | + $myrow = Database::fetch_array($result); |
|
| 1215 | + $path = $myrow["path"]; |
|
| 1216 | + $name = GetQuizName($path, $documentPath); |
|
| 1217 | 1217 | |
| 1218 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1218 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 1219 | 1219 | |
| 1220 | 1220 | $cid = $_course['official_code']; |
| 1221 | 1221 | |
@@ -1232,18 +1232,18 @@ discard block |
||
| 1232 | 1232 | case "Forum": |
| 1233 | 1233 | //deprecated |
| 1234 | 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); |
|
| 1235 | + $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 1236 | + $myrow = Database::fetch_array($result); |
|
| 1237 | 1237 | |
| 1238 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1238 | + if ($builder == 'builder') { $origin = 'builder'; } |
|
| 1239 | 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']; } |
|
| 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 | 1243 | |
| 1244 | - if ($myrow["forum_name"]=='') { $type="Forum"; } |
|
| 1244 | + if ($myrow["forum_name"] == '') { $type = "Forum"; } |
|
| 1245 | 1245 | |
| 1246 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1246 | + $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1247 | 1247 | if ($builder != 'builder') |
| 1248 | 1248 | { |
| 1249 | 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"; |
@@ -1256,15 +1256,15 @@ discard block |
||
| 1256 | 1256 | |
| 1257 | 1257 | case "Thread": //forum post |
| 1258 | 1258 | //deprecated |
| 1259 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 1260 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 1259 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 1260 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 1261 | 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); |
|
| 1262 | + $sql = "SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 1263 | + $result = Database::query($sql); |
|
| 1264 | + $myrow = Database::fetch_array($result); |
|
| 1265 | 1265 | |
| 1266 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1267 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1266 | + $sql = "select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1267 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1268 | 1268 | |
| 1269 | 1269 | if ($builder != 'builder') |
| 1270 | 1270 | { |
@@ -1311,16 +1311,16 @@ discard block |
||
| 1311 | 1311 | break; |
| 1312 | 1312 | |
| 1313 | 1313 | case "Document": |
| 1314 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
| 1316 | - $myrow=Database::fetch_array($result); |
|
| 1314 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | + $result = Database::query("SELECT * FROM $dbTable WHERE id=$id", __FILE__, __LINE); |
|
| 1316 | + $myrow = Database::fetch_array($result); |
|
| 1317 | 1317 | |
| 1318 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 1319 | - $last=count($pathname)-1; // making a correct name for the link |
|
| 1320 | - $filename=$pathname[$last]; // making a correct name for the link |
|
| 1318 | + $pathname = explode("/", $myrow["path"]); // making a correct name for the link |
|
| 1319 | + $last = count($pathname) - 1; // making a correct name for the link |
|
| 1320 | + $filename = $pathname[$last]; // making a correct name for the link |
|
| 1321 | 1321 | |
| 1322 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1322 | + $sql = "select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | + $result = Database::query($sql); $row = Database::fetch_array($result); |
|
| 1324 | 1324 | |
| 1325 | 1325 | if ($builder != 'builder') |
| 1326 | 1326 | { |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | } |
| 1330 | 1330 | else |
| 1331 | 1331 | { |
| 1332 | - $enableDocumentParsing='yes'; |
|
| 1332 | + $enableDocumentParsing = 'yes'; |
|
| 1333 | 1333 | if (!$enableDocumentParsing) |
| 1334 | 1334 | { //this is the solution for the non-parsing version in the builder |
| 1335 | - $file=urlencode($myrow["path"]); |
|
| 1335 | + $file = urlencode($myrow["path"]); |
|
| 1336 | 1336 | $link .= "../document/showinframes.php?file=$file"; |
| 1337 | 1337 | } |
| 1338 | 1338 | else |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | { |
| 1375 | 1375 | $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"; |
| 1376 | 1376 | } else { |
| 1377 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1377 | + $s = api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1378 | 1378 | $link .= $s; |
| 1379 | 1379 | } |
| 1380 | 1380 | break; |
@@ -1408,8 +1408,8 @@ discard block |
||
| 1408 | 1408 | $addedresourceid = $_SESSION['addedresourceid']; |
| 1409 | 1409 | unset($addedresource[$resource_key]); |
| 1410 | 1410 | unset($addedresourceid[$resource_key]); |
| 1411 | - $_SESSION['addedresource']=$addedresource; |
|
| 1412 | - $_SESSION['addedresourceid']=$addedresourceid ; |
|
| 1411 | + $_SESSION['addedresource'] = $addedresource; |
|
| 1412 | + $_SESSION['addedresourceid'] = $addedresourceid; |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | /** |
@@ -1442,9 +1442,9 @@ discard block |
||
| 1442 | 1442 | function delete_added_resource($type, $id) |
| 1443 | 1443 | { |
| 1444 | 1444 | global $_course; |
| 1445 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1445 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1446 | 1446 | |
| 1447 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1447 | + $sql = "DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1448 | 1448 | Database::query($sql); |
| 1449 | 1449 | } |
| 1450 | 1450 | |
@@ -1455,9 +1455,9 @@ discard block |
||
| 1455 | 1455 | function delete_all_resources_type($type) |
| 1456 | 1456 | { |
| 1457 | 1457 | global $_course; |
| 1458 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1458 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1459 | 1459 | |
| 1460 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1460 | + $sql = "DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1461 | 1461 | |
| 1462 | 1462 | Database::query($sql); |
| 1463 | 1463 | } |
@@ -1468,11 +1468,11 @@ discard block |
||
| 1468 | 1468 | function check_added_resources($type, $id) |
| 1469 | 1469 | { |
| 1470 | 1470 | global $_course, $origin; |
| 1471 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | - $result=Database::query($sql); |
|
| 1474 | - $number_added=Database::num_rows($result); |
|
| 1475 | - if ($number_added<>0) |
|
| 1471 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | + $sql = "SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | + $result = Database::query($sql); |
|
| 1474 | + $number_added = Database::num_rows($result); |
|
| 1475 | + if ($number_added <> 0) |
|
| 1476 | 1476 | return true; |
| 1477 | 1477 | else |
| 1478 | 1478 | return false; |
@@ -1485,18 +1485,18 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | function edit_added_resources($type, $id) |
| 1487 | 1487 | { |
| 1488 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1488 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1489 | 1489 | $course_id = api_get_course_int_id(); |
| 1490 | 1490 | $id = intval($id); |
| 1491 | 1491 | $type = Database::escape_string($type); |
| 1492 | - $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | - $result=Database::query($sql); |
|
| 1494 | - while ($row=Database::fetch_array($result)) { |
|
| 1495 | - $addedresource[]=$row["resource_type"]; |
|
| 1496 | - $addedresourceid[]=$row["resource_id"]; |
|
| 1492 | + $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | + $result = Database::query($sql); |
|
| 1494 | + while ($row = Database::fetch_array($result)) { |
|
| 1495 | + $addedresource[] = $row["resource_type"]; |
|
| 1496 | + $addedresourceid[] = $row["resource_id"]; |
|
| 1497 | 1497 | } |
| 1498 | - $_SESSION['addedresource']=$addedresource; |
|
| 1499 | - $_SESSION['addedresourceid']=$addedresourceid; |
|
| 1498 | + $_SESSION['addedresource'] = $addedresource; |
|
| 1499 | + $_SESSION['addedresourceid'] = $addedresourceid; |
|
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | /** |
@@ -1506,12 +1506,12 @@ discard block |
||
| 1506 | 1506 | */ |
| 1507 | 1507 | function update_added_resources($type, $id) |
| 1508 | 1508 | { |
| 1509 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1509 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1510 | 1510 | $course_id = api_get_course_int_id(); |
| 1511 | 1511 | $id = intval($id); |
| 1512 | 1512 | $type = Database::escape_string($type); |
| 1513 | 1513 | // delete all the added resources for this item in the database; |
| 1514 | - $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1514 | + $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1515 | 1515 | //echo $sql; |
| 1516 | 1516 | Database::query($sql); |
| 1517 | 1517 | |
@@ -1525,25 +1525,25 @@ discard block |
||
| 1525 | 1525 | /** |
| 1526 | 1526 | * this function is to display the resources that were added to a specific item |
| 1527 | 1527 | */ |
| 1528 | -function display_added_resources($type, $id, $style='') |
|
| 1528 | +function display_added_resources($type, $id, $style = '') |
|
| 1529 | 1529 | { |
| 1530 | 1530 | // the array containing the icons |
| 1531 | - $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
| 1531 | + $arr_icons = array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif'); |
|
| 1532 | 1532 | |
| 1533 | 1533 | global $_course, $origin; |
| 1534 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1534 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1535 | 1535 | |
| 1536 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | - $result=Database::query($sql); |
|
| 1538 | - while ($row=Database::fetch_array($result)) |
|
| 1536 | + $sql = "SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | + $result = Database::query($sql); |
|
| 1538 | + while ($row = Database::fetch_array($result)) |
|
| 1539 | 1539 | { |
| 1540 | 1540 | if ($origin != 'learnpath') |
| 1541 | 1541 | { |
| 1542 | - display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1542 | + display_addedresource_link($row['resource_type'], $row['resource_id'], $style); |
|
| 1543 | 1543 | } |
| 1544 | 1544 | else |
| 1545 | 1545 | { |
| 1546 | - display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1546 | + display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'], 'agendaitems', '', 'builder', 'icon'); echo "<br>"; |
|
| 1547 | 1547 | } |
| 1548 | 1548 | } |
| 1549 | 1549 | } |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | global $locationkey; |
| 1563 | 1563 | global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
| 1564 | 1564 | |
| 1565 | - if ($resourceaction=="removeresource") |
|
| 1565 | + if ($resourceaction == "removeresource") |
|
| 1566 | 1566 | { |
| 1567 | 1567 | /* unneccessary because when editing we delete all the added resources from the |
| 1568 | 1568 | database and add all these from the session |
@@ -1583,8 +1583,8 @@ discard block |
||
| 1583 | 1583 | //echo "remove from session"; |
| 1584 | 1584 | remove_resource($locationkey); |
| 1585 | 1585 | } |
| 1586 | - $addedresource=$_SESSION['addedresource']; |
|
| 1587 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1586 | + $addedresource = $_SESSION['addedresource']; |
|
| 1587 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1588 | 1588 | if (is_array($addedresource)) |
| 1589 | 1589 | { |
| 1590 | 1590 | echo '<table>'; |
@@ -1592,16 +1592,16 @@ discard block |
||
| 1592 | 1592 | { |
| 1593 | 1593 | //echo $resource.":".$addedresourceid[key($addedresource)]; |
| 1594 | 1594 | echo '<tr><td>'; |
| 1595 | - display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
| 1595 | + display_addedresource_link($resource, $addedresourceid[key($addedresource)]); |
|
| 1596 | 1596 | echo '</td><td width="30">'; |
| 1597 | 1597 | |
| 1598 | 1598 | // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
| 1599 | 1599 | // should also contain this id. |
| 1600 | - $test=parse_url($_SERVER['REQUEST_URI']); |
|
| 1600 | + $test = parse_url($_SERVER['REQUEST_URI']); |
|
| 1601 | 1601 | $output = array(); |
| 1602 | - parse_str($test['query'],$output); |
|
| 1602 | + parse_str($test['query'], $output); |
|
| 1603 | 1603 | |
| 1604 | - if ($showdeleteimg==1) |
|
| 1604 | + if ($showdeleteimg == 1) |
|
| 1605 | 1605 | { |
| 1606 | 1606 | //if (strstr($_SERVER['REQUEST_URI'],"?id=")) |
| 1607 | 1607 | // { echo " <a href='".api_get_self()."?id=".$output['id']."&"; } |
@@ -1635,8 +1635,8 @@ discard block |
||
| 1635 | 1635 | global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
| 1636 | 1636 | //global $_SESSION['addresource']; |
| 1637 | 1637 | //global $_SESSION['addresourceid']; |
| 1638 | - $addedresource=$_SESSION['addedresource']; |
|
| 1639 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1638 | + $addedresource = $_SESSION['addedresource']; |
|
| 1639 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1640 | 1640 | |
| 1641 | 1641 | if (is_array($_SESSION['addedresource'])) |
| 1642 | 1642 | { |
@@ -1649,16 +1649,16 @@ discard block |
||
| 1649 | 1649 | //print_r($addedresourceid); |
| 1650 | 1650 | //echo "<br>"; |
| 1651 | 1651 | |
| 1652 | - if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
| 1652 | + if ($toolcompare == $type and $addedresourceid[key($addedresource)] == $id) |
|
| 1653 | 1653 | { |
| 1654 | - $show=0; |
|
| 1654 | + $show = 0; |
|
| 1655 | 1655 | } |
| 1656 | 1656 | next($addedresource); |
| 1657 | 1657 | } |
| 1658 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1659 | - if ($show!==0) |
|
| 1658 | + if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); } |
|
| 1659 | + if ($show !== 0) |
|
| 1660 | 1660 | { |
| 1661 | - if ($type=="Document") |
|
| 1661 | + if ($type == "Document") |
|
| 1662 | 1662 | { |
| 1663 | 1663 | 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>"; |
| 1664 | 1664 | } |
@@ -1670,9 +1670,9 @@ discard block |
||
| 1670 | 1670 | } |
| 1671 | 1671 | else // if it is not an array, it is a string |
| 1672 | 1672 | { |
| 1673 | - if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
| 1673 | + if ($_SESSION['addedresource'] !== $type or $_SESSION['addedresourceid'] !== $id) |
|
| 1674 | 1674 | { |
| 1675 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1675 | + if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); } |
|
| 1676 | 1676 | 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>"; |
| 1677 | 1677 | } |
| 1678 | 1678 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | if (api_is_allowed_to_edit()) |
| 70 | 70 | { |
| 71 | 71 | $visibility="ip.visibility<>'2'"; |
| 72 | - } |
|
| 73 | - else |
|
| 72 | + } else |
|
| 74 | 73 | { |
| 75 | 74 | $visibility="ip.visibility='1'"; |
| 76 | 75 | } |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | if (file_or_folder($row['path'])) |
| 97 | 96 | { |
| 98 | 97 | echo '<img src="../img/file.gif" align="middle" />'; |
| 99 | - } |
|
| 100 | - else |
|
| 98 | + } else |
|
| 101 | 99 | { |
| 102 | 100 | $image = choose_image($row['path']); |
| 103 | 101 | echo "<img src=\"../img/$image\" align=\"middle\" />"; |
@@ -108,16 +106,14 @@ discard block |
||
| 108 | 106 | { |
| 109 | 107 | echo "<a href='".api_get_self()."?content=Document"; |
| 110 | 108 | 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 |
|
| 109 | + } else |
|
| 113 | 110 | { |
| 114 | 111 | echo substr($row['path'],1).' '; |
| 115 | 112 | echo showorhide_addresourcelink('Document',$row['id']); |
| 116 | 113 | echo '<br />'; |
| 117 | 114 | } |
| 118 | 115 | } |
| 119 | - } |
|
| 120 | - else |
|
| 116 | + } else |
|
| 121 | 117 | { |
| 122 | 118 | // we calculate the level we are in by using the $folder in the url |
| 123 | 119 | // we put +1 because it does not start with an / and in the database it does |
@@ -156,8 +152,7 @@ discard block |
||
| 156 | 152 | if (file_or_folder($path)) |
| 157 | 153 | { |
| 158 | 154 | echo '<img src="../img/file.gif" align="middle" />'; |
| 159 | - } |
|
| 160 | - else |
|
| 155 | + } else |
|
| 161 | 156 | { |
| 162 | 157 | $image = choose_image($path); |
| 163 | 158 | echo "<img src=\"../img/$image\" align=\"middle\" />"; |
@@ -172,8 +167,7 @@ discard block |
||
| 172 | 167 | //using the correct name of the folder |
| 173 | 168 | $folder_name=str_replace($folder.'/','',$path); |
| 174 | 169 | echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
| 175 | - } |
|
| 176 | - else |
|
| 170 | + } else |
|
| 177 | 171 | { |
| 178 | 172 | echo str_replace("/$folder/", '',$path).' '; |
| 179 | 173 | echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
@@ -349,9 +343,14 @@ discard block |
||
| 349 | 343 | |
| 350 | 344 | $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
| 351 | 345 | |
| 352 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 346 | + if ($builder != 'builder') { |
|
| 347 | + $origin = 'learnpath'; |
|
| 348 | + } |
|
| 349 | + //origin = learnpath in student view |
|
| 353 | 350 | $linktype = $type; |
| 354 | - if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
| 351 | + if (($type == 'Link _self') or ($type == 'Link _blank')) { |
|
| 352 | + $type = 'Link'; |
|
| 353 | + } |
|
| 355 | 354 | |
| 356 | 355 | switch ($type) |
| 357 | 356 | { |
@@ -371,7 +370,7 @@ discard block |
||
| 371 | 370 | { |
| 372 | 371 | if ($completed=='completed') { |
| 373 | 372 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 374 | - } else { |
|
| 373 | + } else { |
|
| 375 | 374 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 376 | 375 | //echo " "; |
| 377 | 376 | } |
@@ -391,14 +390,12 @@ discard block |
||
| 391 | 390 | if ($icon != 'wrap') |
| 392 | 391 | { |
| 393 | 392 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 394 | - } |
|
| 395 | - else |
|
| 393 | + } else |
|
| 396 | 394 | { |
| 397 | 395 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 398 | 396 | } |
| 399 | 397 | } |
| 400 | - } |
|
| 401 | - else |
|
| 398 | + } else |
|
| 402 | 399 | { |
| 403 | 400 | echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
| 404 | 401 | } |
@@ -426,7 +423,7 @@ discard block |
||
| 426 | 423 | { |
| 427 | 424 | if ($completed=='completed') { |
| 428 | 425 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 429 | - } else { |
|
| 426 | + } else { |
|
| 430 | 427 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 431 | 428 | //echo " "; |
| 432 | 429 | } |
@@ -450,14 +447,12 @@ discard block |
||
| 450 | 447 | if ($icon != 'wrap') |
| 451 | 448 | { |
| 452 | 449 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 453 | - } |
|
| 454 | - else |
|
| 450 | + } else |
|
| 455 | 451 | { |
| 456 | 452 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 457 | 453 | } |
| 458 | 454 | } |
| 459 | - } |
|
| 460 | - else |
|
| 455 | + } else |
|
| 461 | 456 | { |
| 462 | 457 | echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
| 463 | 458 | } |
@@ -479,7 +474,7 @@ discard block |
||
| 479 | 474 | { |
| 480 | 475 | if ($completed=='completed') { |
| 481 | 476 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 482 | - } else { |
|
| 477 | + } else { |
|
| 483 | 478 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 484 | 479 | //echo " "; |
| 485 | 480 | } |
@@ -495,8 +490,7 @@ discard block |
||
| 495 | 490 | if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
| 496 | 491 | if ($icon == 'icon') |
| 497 | 492 | { |
| 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'>"; } |
|
| 493 | + if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 500 | 494 | } |
| 501 | 495 | $thelink=$myrow["url"]; |
| 502 | 496 | if ($builder != 'builder') |
@@ -508,14 +502,12 @@ discard block |
||
| 508 | 502 | if ($icon != 'wrap') |
| 509 | 503 | { |
| 510 | 504 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 511 | - } |
|
| 512 | - else |
|
| 505 | + } else |
|
| 513 | 506 | { |
| 514 | 507 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 515 | 508 | } |
| 516 | 509 | } |
| 517 | - } |
|
| 518 | - else |
|
| 510 | + } else |
|
| 519 | 511 | { |
| 520 | 512 | echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
| 521 | 513 | } |
@@ -540,7 +532,7 @@ discard block |
||
| 540 | 532 | { |
| 541 | 533 | if ($completed=='completed') { |
| 542 | 534 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 543 | - } else { |
|
| 535 | + } else { |
|
| 544 | 536 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 545 | 537 | //echo " "; |
| 546 | 538 | } |
@@ -563,14 +555,12 @@ discard block |
||
| 563 | 555 | if ($icon != 'wrap') |
| 564 | 556 | { |
| 565 | 557 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 566 | - } |
|
| 567 | - else |
|
| 558 | + } else |
|
| 568 | 559 | { |
| 569 | 560 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 570 | 561 | } |
| 571 | 562 | } |
| 572 | - } |
|
| 573 | - else |
|
| 563 | + } else |
|
| 574 | 564 | { |
| 575 | 565 | echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]."\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
| 576 | 566 | } |
@@ -598,7 +588,7 @@ discard block |
||
| 598 | 588 | { |
| 599 | 589 | if ($completed=='completed') { |
| 600 | 590 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 601 | - } else { |
|
| 591 | + } else { |
|
| 602 | 592 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 603 | 593 | //echo " "; |
| 604 | 594 | } |
@@ -621,14 +611,12 @@ discard block |
||
| 621 | 611 | if ($icon != 'wrap') |
| 622 | 612 | { |
| 623 | 613 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 624 | - } |
|
| 625 | - else |
|
| 614 | + } else |
|
| 626 | 615 | { |
| 627 | 616 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 628 | 617 | } |
| 629 | 618 | } |
| 630 | - } |
|
| 631 | - else |
|
| 619 | + } else |
|
| 632 | 620 | { |
| 633 | 621 | 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 | 622 | } |
@@ -650,7 +638,7 @@ discard block |
||
| 650 | 638 | { |
| 651 | 639 | if ($completed=='completed') { |
| 652 | 640 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 653 | - } else { |
|
| 641 | + } else { |
|
| 654 | 642 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 655 | 643 | //echo " "; |
| 656 | 644 | } |
@@ -671,14 +659,12 @@ discard block |
||
| 671 | 659 | if ($icon != 'wrap') |
| 672 | 660 | { |
| 673 | 661 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 674 | - } |
|
| 675 | - else |
|
| 662 | + } else |
|
| 676 | 663 | { |
| 677 | 664 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 678 | 665 | } |
| 679 | 666 | } |
| 680 | - } |
|
| 681 | - else |
|
| 667 | + } else |
|
| 682 | 668 | { |
| 683 | 669 | echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
| 684 | 670 | } |
@@ -704,7 +690,7 @@ discard block |
||
| 704 | 690 | { |
| 705 | 691 | if ($completed=='completed') { |
| 706 | 692 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 707 | - } else { |
|
| 693 | + } else { |
|
| 708 | 694 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 709 | 695 | //echo " "; |
| 710 | 696 | } |
@@ -724,14 +710,12 @@ discard block |
||
| 724 | 710 | if ($icon != 'wrap') |
| 725 | 711 | { |
| 726 | 712 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 727 | - } |
|
| 728 | - else |
|
| 713 | + } else |
|
| 729 | 714 | { |
| 730 | 715 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 731 | 716 | } |
| 732 | 717 | } |
| 733 | - } |
|
| 734 | - else |
|
| 718 | + } else |
|
| 735 | 719 | { |
| 736 | 720 | 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 | 721 | } |
@@ -765,7 +749,7 @@ discard block |
||
| 765 | 749 | { |
| 766 | 750 | if ($completed=='completed') { |
| 767 | 751 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 768 | - } else { |
|
| 752 | + } else { |
|
| 769 | 753 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 770 | 754 | //echo " "; |
| 771 | 755 | } |
@@ -788,14 +772,12 @@ discard block |
||
| 788 | 772 | if ($icon != 'wrap') |
| 789 | 773 | { |
| 790 | 774 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 791 | - } |
|
| 792 | - else |
|
| 775 | + } else |
|
| 793 | 776 | { |
| 794 | 777 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 795 | 778 | } |
| 796 | 779 | } |
| 797 | - } |
|
| 798 | - else |
|
| 780 | + } else |
|
| 799 | 781 | { |
| 800 | 782 | 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 | 783 | } |
@@ -816,7 +798,7 @@ discard block |
||
| 816 | 798 | if ($icon != 'nolink') { |
| 817 | 799 | if ($completed=='completed') { |
| 818 | 800 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 819 | - } else { |
|
| 801 | + } else { |
|
| 820 | 802 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 821 | 803 | //echo " "; |
| 822 | 804 | } |
@@ -844,22 +826,19 @@ discard block |
||
| 844 | 826 | if ($icon != 'wrap') |
| 845 | 827 | { |
| 846 | 828 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 847 | - } |
|
| 848 | - else |
|
| 829 | + } else |
|
| 849 | 830 | { |
| 850 | 831 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 851 | 832 | } |
| 852 | 833 | } $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 |
|
| 834 | + } else |
|
| 855 | 835 | { |
| 856 | 836 | $enableDocumentParsing='yes'; |
| 857 | 837 | if (!$enableDocumentParsing) |
| 858 | 838 | { //this is the solution for the non-parsing version in the builder |
| 859 | 839 | $file=urlencode($myrow["path"]); |
| 860 | 840 | echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
| 861 | - } |
|
| 862 | - else |
|
| 841 | + } else |
|
| 863 | 842 | { |
| 864 | 843 | echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
| 865 | 844 | } |
@@ -879,7 +858,7 @@ discard block |
||
| 879 | 858 | { |
| 880 | 859 | if ($completed=='completed') { |
| 881 | 860 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 882 | - } else { |
|
| 861 | + } else { |
|
| 883 | 862 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 884 | 863 | //echo " "; |
| 885 | 864 | } |
@@ -901,14 +880,12 @@ discard block |
||
| 901 | 880 | if ($icon != 'wrap') |
| 902 | 881 | { |
| 903 | 882 | echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
| 904 | - } |
|
| 905 | - else |
|
| 883 | + } else |
|
| 906 | 884 | { |
| 907 | 885 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
| 908 | 886 | } |
| 909 | 887 | } |
| 910 | - } |
|
| 911 | - else |
|
| 888 | + } else |
|
| 912 | 889 | { |
| 913 | 890 | echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
| 914 | 891 | } |
@@ -925,7 +902,7 @@ discard block |
||
| 925 | 902 | if ($icon != 'nolink') { |
| 926 | 903 | if ($completed=='completed') { |
| 927 | 904 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 928 | - } else { |
|
| 905 | + } else { |
|
| 929 | 906 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 930 | 907 | //echo " "; |
| 931 | 908 | } |
@@ -942,8 +919,7 @@ discard block |
||
| 942 | 919 | 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 | 920 | if ($desc != '') { |
| 944 | 921 | 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 { |
|
| 922 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } else { |
|
| 947 | 923 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
| 948 | 924 | } |
| 949 | 925 | } else { |
@@ -962,7 +938,7 @@ discard block |
||
| 962 | 938 | if ($icon != 'nolink') { |
| 963 | 939 | if ($completed=='completed') { |
| 964 | 940 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 965 | - } else { |
|
| 941 | + } else { |
|
| 966 | 942 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 967 | 943 | //echo " "; |
| 968 | 944 | } |
@@ -980,8 +956,7 @@ discard block |
||
| 980 | 956 | $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 | 957 | if ($desc != '') { |
| 982 | 958 | 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 { |
|
| 959 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } else { |
|
| 985 | 960 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
| 986 | 961 | } |
| 987 | 962 | } else { |
@@ -1001,7 +976,7 @@ discard block |
||
| 1001 | 976 | if ($icon != 'nolink') { |
| 1002 | 977 | if ($completed=='completed') { |
| 1003 | 978 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1004 | - } else { |
|
| 979 | + } else { |
|
| 1005 | 980 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1006 | 981 | //echo " "; |
| 1007 | 982 | } |
@@ -1018,8 +993,7 @@ discard block |
||
| 1018 | 993 | 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 | 994 | if ($desc != '') { |
| 1020 | 995 | 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 { |
|
| 996 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } else { |
|
| 1023 | 997 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
| 1024 | 998 | } |
| 1025 | 999 | } else { |
@@ -1039,7 +1013,7 @@ discard block |
||
| 1039 | 1013 | if ($icon != 'nolink') { |
| 1040 | 1014 | if ($completed=='completed') { |
| 1041 | 1015 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1042 | - } else { |
|
| 1016 | + } else { |
|
| 1043 | 1017 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1044 | 1018 | //echo " "; |
| 1045 | 1019 | } |
@@ -1056,8 +1030,7 @@ discard block |
||
| 1056 | 1030 | 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 | 1031 | if ($desc != '') { |
| 1058 | 1032 | 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 { |
|
| 1033 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } else { |
|
| 1061 | 1034 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
| 1062 | 1035 | } |
| 1063 | 1036 | } else { |
@@ -1076,7 +1049,7 @@ discard block |
||
| 1076 | 1049 | if ($icon != 'nolink') { |
| 1077 | 1050 | if ($completed=='completed') { |
| 1078 | 1051 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
| 1079 | - } else { |
|
| 1052 | + } else { |
|
| 1080 | 1053 | echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
| 1081 | 1054 | //echo " "; |
| 1082 | 1055 | } |
@@ -1093,8 +1066,7 @@ discard block |
||
| 1093 | 1066 | 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 | 1067 | if ($desc != '') { |
| 1095 | 1068 | 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 { |
|
| 1069 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } else { |
|
| 1098 | 1070 | echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
| 1099 | 1071 | } |
| 1100 | 1072 | } else { |
@@ -1144,8 +1116,7 @@ discard block |
||
| 1144 | 1116 | if ($builder != 'builder') |
| 1145 | 1117 | { |
| 1146 | 1118 | $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 |
|
| 1119 | + } else |
|
| 1149 | 1120 | { |
| 1150 | 1121 | $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; |
| 1151 | 1122 | } |
@@ -1159,8 +1130,7 @@ discard block |
||
| 1159 | 1130 | if ($builder != 'builder') |
| 1160 | 1131 | { |
| 1161 | 1132 | $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 |
|
| 1133 | + } else |
|
| 1164 | 1134 | { |
| 1165 | 1135 | $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; |
| 1166 | 1136 | } |
@@ -1178,8 +1148,7 @@ discard block |
||
| 1178 | 1148 | if ($builder != 'builder') |
| 1179 | 1149 | { |
| 1180 | 1150 | $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 |
|
| 1151 | + } else |
|
| 1183 | 1152 | { |
| 1184 | 1153 | $link .= $thelink; |
| 1185 | 1154 | } |
@@ -1200,8 +1169,7 @@ discard block |
||
| 1200 | 1169 | if ($builder != 'builder') |
| 1201 | 1170 | { |
| 1202 | 1171 | $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 |
|
| 1172 | + } else |
|
| 1205 | 1173 | { |
| 1206 | 1174 | $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; |
| 1207 | 1175 | } |
@@ -1222,8 +1190,7 @@ discard block |
||
| 1222 | 1190 | if ($builder != 'builder') |
| 1223 | 1191 | { |
| 1224 | 1192 | $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 |
|
| 1193 | + } else |
|
| 1227 | 1194 | { |
| 1228 | 1195 | $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; |
| 1229 | 1196 | } |
@@ -1247,8 +1214,7 @@ discard block |
||
| 1247 | 1214 | if ($builder != 'builder') |
| 1248 | 1215 | { |
| 1249 | 1216 | $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 |
|
| 1217 | + } else |
|
| 1252 | 1218 | { |
| 1253 | 1219 | $link .= "../phpbb/viewforum.php?$forumparameters"; |
| 1254 | 1220 | } |
@@ -1269,8 +1235,7 @@ discard block |
||
| 1269 | 1235 | if ($builder != 'builder') |
| 1270 | 1236 | { |
| 1271 | 1237 | $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 |
|
| 1238 | + } else |
|
| 1274 | 1239 | { |
| 1275 | 1240 | $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
| 1276 | 1241 | } |
@@ -1326,16 +1291,14 @@ discard block |
||
| 1326 | 1291 | { |
| 1327 | 1292 | $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"; |
| 1328 | 1293 | |
| 1329 | - } |
|
| 1330 | - else |
|
| 1294 | + } else |
|
| 1331 | 1295 | { |
| 1332 | 1296 | $enableDocumentParsing='yes'; |
| 1333 | 1297 | if (!$enableDocumentParsing) |
| 1334 | 1298 | { //this is the solution for the non-parsing version in the builder |
| 1335 | 1299 | $file=urlencode($myrow["path"]); |
| 1336 | 1300 | $link .= "../document/showinframes.php?file=$file"; |
| 1337 | - } |
|
| 1338 | - else |
|
| 1301 | + } else |
|
| 1339 | 1302 | { |
| 1340 | 1303 | $link .= "../document/download.php?doc_url=".$myrow["path"]; |
| 1341 | 1304 | } |
@@ -1346,8 +1309,7 @@ discard block |
||
| 1346 | 1309 | if ($builder != 'builder') |
| 1347 | 1310 | { |
| 1348 | 1311 | $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"; |
| 1349 | - } |
|
| 1350 | - else |
|
| 1312 | + } else |
|
| 1351 | 1313 | { |
| 1352 | 1314 | $link .= "../work/work.php"; |
| 1353 | 1315 | } |
@@ -1472,11 +1434,12 @@ discard block |
||
| 1472 | 1434 | $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
| 1473 | 1435 | $result=Database::query($sql); |
| 1474 | 1436 | $number_added=Database::num_rows($result); |
| 1475 | - if ($number_added<>0) |
|
| 1476 | - return true; |
|
| 1477 | - else |
|
| 1478 | - return false; |
|
| 1479 | -} |
|
| 1437 | + if ($number_added<>0) { |
|
| 1438 | + return true; |
|
| 1439 | + } else { |
|
| 1440 | + return false; |
|
| 1441 | + } |
|
| 1442 | + } |
|
| 1480 | 1443 | |
| 1481 | 1444 | |
| 1482 | 1445 | /** |
@@ -1540,8 +1503,7 @@ discard block |
||
| 1540 | 1503 | if ($origin != 'learnpath') |
| 1541 | 1504 | { |
| 1542 | 1505 | display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
| 1543 | - } |
|
| 1544 | - else |
|
| 1506 | + } else |
|
| 1545 | 1507 | { |
| 1546 | 1508 | display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
| 1547 | 1509 | } |
@@ -1616,8 +1578,7 @@ discard block |
||
| 1616 | 1578 | //$_SESSION['edit']==''; |
| 1617 | 1579 | } |
| 1618 | 1580 | echo '</table>'; |
| 1619 | - } |
|
| 1620 | - else // it is a string |
|
| 1581 | + } else // it is a string |
|
| 1621 | 1582 | { |
| 1622 | 1583 | echo ''; |
| 1623 | 1584 | } |
@@ -1661,14 +1622,12 @@ discard block |
||
| 1661 | 1622 | if ($type=="Document") |
| 1662 | 1623 | { |
| 1663 | 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>"; |
| 1664 | - } |
|
| 1665 | - else |
|
| 1625 | + } else |
|
| 1666 | 1626 | { |
| 1667 | 1627 | 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>"; |
| 1668 | 1628 | } |
| 1669 | 1629 | } |
| 1670 | - } |
|
| 1671 | - else // if it is not an array, it is a string |
|
| 1630 | + } else // if it is not an array, it is a string |
|
| 1672 | 1631 | { |
| 1673 | 1632 | if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
| 1674 | 1633 | { |
@@ -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,168 +1116,168 @@ 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 | - |
|
| 1279 | - case "Post": |
|
| 1280 | - /* todo REVIEW THIS SECTION - NOT USING VALID TABLES ANYMORE |
|
| 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 | + |
|
| 1279 | + case "Post": |
|
| 1280 | + /* todo REVIEW THIS SECTION - NOT USING VALID TABLES ANYMORE |
|
| 1281 | 1281 | $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
| 1282 | 1282 | $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
| 1283 | 1283 | $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
@@ -1308,94 +1308,94 @@ discard block |
||
| 1308 | 1308 | $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
| 1309 | 1309 | } |
| 1310 | 1310 | */ |
| 1311 | - break; |
|
| 1312 | - |
|
| 1313 | - case "Document": |
|
| 1314 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
| 1316 | - $myrow=Database::fetch_array($result); |
|
| 1317 | - |
|
| 1318 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 1319 | - $last=count($pathname)-1; // making a correct name for the link |
|
| 1320 | - $filename=$pathname[$last]; // making a correct name for the link |
|
| 1321 | - |
|
| 1322 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1324 | - |
|
| 1325 | - if ($builder != 'builder') |
|
| 1326 | - { |
|
| 1327 | - $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"; |
|
| 1328 | - |
|
| 1329 | - } |
|
| 1330 | - else |
|
| 1331 | - { |
|
| 1332 | - $enableDocumentParsing='yes'; |
|
| 1333 | - if (!$enableDocumentParsing) |
|
| 1334 | - { //this is the solution for the non-parsing version in the builder |
|
| 1335 | - $file=urlencode($myrow["path"]); |
|
| 1336 | - $link .= "../document/showinframes.php?file=$file"; |
|
| 1337 | - } |
|
| 1338 | - else |
|
| 1339 | - { |
|
| 1340 | - $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
| 1341 | - } |
|
| 1342 | - } |
|
| 1343 | - break; |
|
| 1344 | - |
|
| 1345 | - case "Assignments": |
|
| 1346 | - if ($builder != 'builder') |
|
| 1347 | - { |
|
| 1348 | - $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"; |
|
| 1349 | - } |
|
| 1350 | - else |
|
| 1351 | - { |
|
| 1352 | - $link .= "../work/work.php"; |
|
| 1353 | - } |
|
| 1354 | - break; |
|
| 1355 | - case "Dropbox": |
|
| 1356 | - if ($builder != 'builder') |
|
| 1357 | - { |
|
| 1358 | - $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"; |
|
| 1359 | - } else { |
|
| 1360 | - $link .= "../dropbox/index.php"; |
|
| 1361 | - } |
|
| 1362 | - break; |
|
| 1363 | - case "Introduction_text": |
|
| 1364 | - if ($builder != 'builder') |
|
| 1365 | - { |
|
| 1366 | - $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"; |
|
| 1367 | - } else { |
|
| 1368 | - $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 1369 | - $link .= $s; |
|
| 1370 | - } |
|
| 1371 | - break; |
|
| 1372 | - case "Course_description": |
|
| 1373 | - if ($builder != 'builder') |
|
| 1374 | - { |
|
| 1375 | - $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"; |
|
| 1376 | - } else { |
|
| 1377 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1378 | - $link .= $s; |
|
| 1379 | - } |
|
| 1380 | - break; |
|
| 1381 | - case "Groups": |
|
| 1382 | - |
|
| 1383 | - if ($builder != 'builder') |
|
| 1384 | - { |
|
| 1385 | - $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"; |
|
| 1386 | - } else { |
|
| 1387 | - $link .= "../group/group.php?origin=$origin"; |
|
| 1388 | - } |
|
| 1389 | - break; |
|
| 1390 | - case "Users": |
|
| 1391 | - if ($builder != 'builder') |
|
| 1392 | - { |
|
| 1393 | - $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"; |
|
| 1394 | - } else { |
|
| 1395 | - $link .= "../user/user.php?origin=$origin"; |
|
| 1396 | - } |
|
| 1397 | - break; |
|
| 1398 | - }//end huge switch-statement |
|
| 1311 | + break; |
|
| 1312 | + |
|
| 1313 | + case "Document": |
|
| 1314 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | + $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
| 1316 | + $myrow=Database::fetch_array($result); |
|
| 1317 | + |
|
| 1318 | + $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 1319 | + $last=count($pathname)-1; // making a correct name for the link |
|
| 1320 | + $filename=$pathname[$last]; // making a correct name for the link |
|
| 1321 | + |
|
| 1322 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1324 | + |
|
| 1325 | + if ($builder != 'builder') |
|
| 1326 | + { |
|
| 1327 | + $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"; |
|
| 1328 | + |
|
| 1329 | + } |
|
| 1330 | + else |
|
| 1331 | + { |
|
| 1332 | + $enableDocumentParsing='yes'; |
|
| 1333 | + if (!$enableDocumentParsing) |
|
| 1334 | + { //this is the solution for the non-parsing version in the builder |
|
| 1335 | + $file=urlencode($myrow["path"]); |
|
| 1336 | + $link .= "../document/showinframes.php?file=$file"; |
|
| 1337 | + } |
|
| 1338 | + else |
|
| 1339 | + { |
|
| 1340 | + $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
| 1341 | + } |
|
| 1342 | + } |
|
| 1343 | + break; |
|
| 1344 | + |
|
| 1345 | + case "Assignments": |
|
| 1346 | + if ($builder != 'builder') |
|
| 1347 | + { |
|
| 1348 | + $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"; |
|
| 1349 | + } |
|
| 1350 | + else |
|
| 1351 | + { |
|
| 1352 | + $link .= "../work/work.php"; |
|
| 1353 | + } |
|
| 1354 | + break; |
|
| 1355 | + case "Dropbox": |
|
| 1356 | + if ($builder != 'builder') |
|
| 1357 | + { |
|
| 1358 | + $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"; |
|
| 1359 | + } else { |
|
| 1360 | + $link .= "../dropbox/index.php"; |
|
| 1361 | + } |
|
| 1362 | + break; |
|
| 1363 | + case "Introduction_text": |
|
| 1364 | + if ($builder != 'builder') |
|
| 1365 | + { |
|
| 1366 | + $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"; |
|
| 1367 | + } else { |
|
| 1368 | + $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 1369 | + $link .= $s; |
|
| 1370 | + } |
|
| 1371 | + break; |
|
| 1372 | + case "Course_description": |
|
| 1373 | + if ($builder != 'builder') |
|
| 1374 | + { |
|
| 1375 | + $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"; |
|
| 1376 | + } else { |
|
| 1377 | + $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1378 | + $link .= $s; |
|
| 1379 | + } |
|
| 1380 | + break; |
|
| 1381 | + case "Groups": |
|
| 1382 | + |
|
| 1383 | + if ($builder != 'builder') |
|
| 1384 | + { |
|
| 1385 | + $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"; |
|
| 1386 | + } else { |
|
| 1387 | + $link .= "../group/group.php?origin=$origin"; |
|
| 1388 | + } |
|
| 1389 | + break; |
|
| 1390 | + case "Users": |
|
| 1391 | + if ($builder != 'builder') |
|
| 1392 | + { |
|
| 1393 | + $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"; |
|
| 1394 | + } else { |
|
| 1395 | + $link .= "../user/user.php?origin=$origin"; |
|
| 1396 | + } |
|
| 1397 | + break; |
|
| 1398 | + }//end huge switch-statement |
|
| 1399 | 1399 | return $link; |
| 1400 | 1400 | } |
| 1401 | 1401 | |
@@ -1404,12 +1404,12 @@ discard block |
||
| 1404 | 1404 | */ |
| 1405 | 1405 | function remove_resource($resource_key) |
| 1406 | 1406 | { |
| 1407 | - $addedresource = $_SESSION['addedresource']; |
|
| 1408 | - $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1409 | - unset($addedresource[$resource_key]); |
|
| 1410 | - unset($addedresourceid[$resource_key]); |
|
| 1411 | - $_SESSION['addedresource']=$addedresource; |
|
| 1412 | - $_SESSION['addedresourceid']=$addedresourceid ; |
|
| 1407 | + $addedresource = $_SESSION['addedresource']; |
|
| 1408 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1409 | + unset($addedresource[$resource_key]); |
|
| 1410 | + unset($addedresourceid[$resource_key]); |
|
| 1411 | + $_SESSION['addedresource']=$addedresource; |
|
| 1412 | + $_SESSION['addedresourceid']=$addedresourceid ; |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | /** |
@@ -1418,8 +1418,8 @@ discard block |
||
| 1418 | 1418 | */ |
| 1419 | 1419 | function show_addresource_button($additionalparameters = '') |
| 1420 | 1420 | { |
| 1421 | - global $charset; |
|
| 1422 | - 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.' />'; |
|
| 1421 | + global $charset; |
|
| 1422 | + 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.' />'; |
|
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | /** |
@@ -1441,11 +1441,11 @@ discard block |
||
| 1441 | 1441 | */ |
| 1442 | 1442 | function delete_added_resource($type, $id) |
| 1443 | 1443 | { |
| 1444 | - global $_course; |
|
| 1445 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1444 | + global $_course; |
|
| 1445 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1446 | 1446 | |
| 1447 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1448 | - Database::query($sql); |
|
| 1447 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1448 | + Database::query($sql); |
|
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | 1451 | /** |
@@ -1454,12 +1454,12 @@ discard block |
||
| 1454 | 1454 | */ |
| 1455 | 1455 | function delete_all_resources_type($type) |
| 1456 | 1456 | { |
| 1457 | - global $_course; |
|
| 1458 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1457 | + global $_course; |
|
| 1458 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1459 | 1459 | |
| 1460 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1460 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1461 | 1461 | |
| 1462 | - Database::query($sql); |
|
| 1462 | + Database::query($sql); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | /** |
@@ -1467,15 +1467,15 @@ discard block |
||
| 1467 | 1467 | */ |
| 1468 | 1468 | function check_added_resources($type, $id) |
| 1469 | 1469 | { |
| 1470 | - global $_course, $origin; |
|
| 1471 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | - $result=Database::query($sql); |
|
| 1474 | - $number_added=Database::num_rows($result); |
|
| 1475 | - if ($number_added<>0) |
|
| 1476 | - return true; |
|
| 1477 | - else |
|
| 1478 | - return false; |
|
| 1470 | + global $_course, $origin; |
|
| 1471 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | + $result=Database::query($sql); |
|
| 1474 | + $number_added=Database::num_rows($result); |
|
| 1475 | + if ($number_added<>0) |
|
| 1476 | + return true; |
|
| 1477 | + else |
|
| 1478 | + return false; |
|
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | |
@@ -1485,18 +1485,18 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | function edit_added_resources($type, $id) |
| 1487 | 1487 | { |
| 1488 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1488 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1489 | 1489 | $course_id = api_get_course_int_id(); |
| 1490 | 1490 | $id = intval($id); |
| 1491 | 1491 | $type = Database::escape_string($type); |
| 1492 | - $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | - $result=Database::query($sql); |
|
| 1494 | - while ($row=Database::fetch_array($result)) { |
|
| 1495 | - $addedresource[]=$row["resource_type"]; |
|
| 1496 | - $addedresourceid[]=$row["resource_id"]; |
|
| 1497 | - } |
|
| 1498 | - $_SESSION['addedresource']=$addedresource; |
|
| 1499 | - $_SESSION['addedresourceid']=$addedresourceid; |
|
| 1492 | + $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | + $result=Database::query($sql); |
|
| 1494 | + while ($row=Database::fetch_array($result)) { |
|
| 1495 | + $addedresource[]=$row["resource_type"]; |
|
| 1496 | + $addedresourceid[]=$row["resource_id"]; |
|
| 1497 | + } |
|
| 1498 | + $_SESSION['addedresource']=$addedresource; |
|
| 1499 | + $_SESSION['addedresourceid']=$addedresourceid; |
|
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | /** |
@@ -1506,20 +1506,20 @@ discard block |
||
| 1506 | 1506 | */ |
| 1507 | 1507 | function update_added_resources($type, $id) |
| 1508 | 1508 | { |
| 1509 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1509 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1510 | 1510 | $course_id = api_get_course_int_id(); |
| 1511 | 1511 | $id = intval($id); |
| 1512 | 1512 | $type = Database::escape_string($type); |
| 1513 | - // delete all the added resources for this item in the database; |
|
| 1514 | - $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1515 | - //echo $sql; |
|
| 1516 | - Database::query($sql); |
|
| 1513 | + // delete all the added resources for this item in the database; |
|
| 1514 | + $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1515 | + //echo $sql; |
|
| 1516 | + Database::query($sql); |
|
| 1517 | 1517 | |
| 1518 | - // store the resources from the session into the database |
|
| 1519 | - store_resources($type, $id); |
|
| 1518 | + // store the resources from the session into the database |
|
| 1519 | + store_resources($type, $id); |
|
| 1520 | 1520 | |
| 1521 | - //delete_added_resource_($type, $id); |
|
| 1522 | - unset_session_resources(); |
|
| 1521 | + //delete_added_resource_($type, $id); |
|
| 1522 | + unset_session_resources(); |
|
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | 1525 | /** |
@@ -1527,25 +1527,25 @@ discard block |
||
| 1527 | 1527 | */ |
| 1528 | 1528 | function display_added_resources($type, $id, $style='') |
| 1529 | 1529 | { |
| 1530 | - // the array containing the icons |
|
| 1531 | - $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
| 1532 | - |
|
| 1533 | - global $_course, $origin; |
|
| 1534 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1535 | - |
|
| 1536 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | - $result=Database::query($sql); |
|
| 1538 | - while ($row=Database::fetch_array($result)) |
|
| 1539 | - { |
|
| 1540 | - if ($origin != 'learnpath') |
|
| 1541 | - { |
|
| 1542 | - display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1543 | - } |
|
| 1544 | - else |
|
| 1545 | - { |
|
| 1546 | - display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1547 | - } |
|
| 1548 | - } |
|
| 1530 | + // the array containing the icons |
|
| 1531 | + $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
| 1532 | + |
|
| 1533 | + global $_course, $origin; |
|
| 1534 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1535 | + |
|
| 1536 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | + $result=Database::query($sql); |
|
| 1538 | + while ($row=Database::fetch_array($result)) |
|
| 1539 | + { |
|
| 1540 | + if ($origin != 'learnpath') |
|
| 1541 | + { |
|
| 1542 | + display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1543 | + } |
|
| 1544 | + else |
|
| 1545 | + { |
|
| 1546 | + display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | |
@@ -1556,15 +1556,15 @@ discard block |
||
| 1556 | 1556 | */ |
| 1557 | 1557 | function display_resources($showdeleteimg) |
| 1558 | 1558 | { |
| 1559 | - global $action; |
|
| 1560 | - global $resourceaction; |
|
| 1561 | - global $id; |
|
| 1562 | - global $locationkey; |
|
| 1563 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 1564 | - |
|
| 1565 | - if ($resourceaction=="removeresource") |
|
| 1566 | - { |
|
| 1567 | - /* unneccessary because when editing we delete all the added resources from the |
|
| 1559 | + global $action; |
|
| 1560 | + global $resourceaction; |
|
| 1561 | + global $id; |
|
| 1562 | + global $locationkey; |
|
| 1563 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 1564 | + |
|
| 1565 | + if ($resourceaction=="removeresource") |
|
| 1566 | + { |
|
| 1567 | + /* unneccessary because when editing we delete all the added resources from the |
|
| 1568 | 1568 | database and add all these from the session |
| 1569 | 1569 | if ($action=="edit") // we have an edit and thus we delete from the database and from the session |
| 1570 | 1570 | { |
@@ -1580,41 +1580,41 @@ discard block |
||
| 1580 | 1580 | } |
| 1581 | 1581 | else // we remove from the session |
| 1582 | 1582 | {*/ |
| 1583 | - //echo "remove from session"; |
|
| 1584 | - remove_resource($locationkey); |
|
| 1585 | - } |
|
| 1586 | - $addedresource=$_SESSION['addedresource']; |
|
| 1587 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1588 | - if (is_array($addedresource)) |
|
| 1589 | - { |
|
| 1590 | - echo '<table>'; |
|
| 1591 | - foreach ($addedresource as $resource) |
|
| 1592 | - { |
|
| 1593 | - //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
| 1594 | - echo '<tr><td>'; |
|
| 1595 | - display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
| 1596 | - echo '</td><td width="30">'; |
|
| 1597 | - |
|
| 1598 | - // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
| 1599 | - // should also contain this id. |
|
| 1600 | - $test=parse_url($_SERVER['REQUEST_URI']); |
|
| 1601 | - $output = array(); |
|
| 1602 | - parse_str($test['query'],$output); |
|
| 1603 | - |
|
| 1604 | - if ($showdeleteimg==1) |
|
| 1605 | - { |
|
| 1606 | - 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 />"; |
|
| 1607 | - } |
|
| 1608 | - echo '</td></tr>'; |
|
| 1609 | - next($addedresource); |
|
| 1610 | - //$_SESSION['edit']==''; |
|
| 1611 | - } |
|
| 1612 | - echo '</table>'; |
|
| 1613 | - } |
|
| 1614 | - else // it is a string |
|
| 1615 | - { |
|
| 1616 | - echo ''; |
|
| 1617 | - } |
|
| 1583 | + //echo "remove from session"; |
|
| 1584 | + remove_resource($locationkey); |
|
| 1585 | + } |
|
| 1586 | + $addedresource=$_SESSION['addedresource']; |
|
| 1587 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1588 | + if (is_array($addedresource)) |
|
| 1589 | + { |
|
| 1590 | + echo '<table>'; |
|
| 1591 | + foreach ($addedresource as $resource) |
|
| 1592 | + { |
|
| 1593 | + //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
| 1594 | + echo '<tr><td>'; |
|
| 1595 | + display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
| 1596 | + echo '</td><td width="30">'; |
|
| 1597 | + |
|
| 1598 | + // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
| 1599 | + // should also contain this id. |
|
| 1600 | + $test=parse_url($_SERVER['REQUEST_URI']); |
|
| 1601 | + $output = array(); |
|
| 1602 | + parse_str($test['query'],$output); |
|
| 1603 | + |
|
| 1604 | + if ($showdeleteimg==1) |
|
| 1605 | + { |
|
| 1606 | + 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 />"; |
|
| 1607 | + } |
|
| 1608 | + echo '</td></tr>'; |
|
| 1609 | + next($addedresource); |
|
| 1610 | + //$_SESSION['edit']==''; |
|
| 1611 | + } |
|
| 1612 | + echo '</table>'; |
|
| 1613 | + } |
|
| 1614 | + else // it is a string |
|
| 1615 | + { |
|
| 1616 | + echo ''; |
|
| 1617 | + } |
|
| 1618 | 1618 | } // end of the display_resources function |
| 1619 | 1619 | |
| 1620 | 1620 | |
@@ -1626,49 +1626,49 @@ discard block |
||
| 1626 | 1626 | */ |
| 1627 | 1627 | function showorhide_addresourcelink($type, $id) |
| 1628 | 1628 | { |
| 1629 | - global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
| 1630 | - //global $_SESSION['addresource']; |
|
| 1631 | - //global $_SESSION['addresourceid']; |
|
| 1632 | - $addedresource=$_SESSION['addedresource']; |
|
| 1633 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1634 | - |
|
| 1635 | - if (is_array($_SESSION['addedresource'])) |
|
| 1636 | - { |
|
| 1637 | - foreach ($addedresource as $toolcompare) |
|
| 1638 | - { |
|
| 1639 | - //echo $toolcompare; |
|
| 1640 | - //echo "/".$type."/".$id."****"; |
|
| 1641 | - //$key=key($addedresource); |
|
| 1642 | - //echo $addedresourceid[$key]; |
|
| 1643 | - //print_r($addedresourceid); |
|
| 1644 | - //echo "<br>"; |
|
| 1645 | - |
|
| 1646 | - if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
| 1647 | - { |
|
| 1648 | - $show=0; |
|
| 1649 | - } |
|
| 1650 | - next($addedresource); |
|
| 1651 | - } |
|
| 1652 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1653 | - if ($show!==0) |
|
| 1654 | - { |
|
| 1655 | - if ($type=="Document") |
|
| 1656 | - { |
|
| 1657 | - 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>"; |
|
| 1658 | - } |
|
| 1659 | - else |
|
| 1660 | - { |
|
| 1661 | - 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>"; |
|
| 1662 | - } |
|
| 1663 | - } |
|
| 1664 | - } |
|
| 1665 | - else // if it is not an array, it is a string |
|
| 1666 | - { |
|
| 1667 | - if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
| 1668 | - { |
|
| 1669 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1670 | - 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>"; |
|
| 1671 | - } |
|
| 1672 | - } |
|
| 1629 | + global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
| 1630 | + //global $_SESSION['addresource']; |
|
| 1631 | + //global $_SESSION['addresourceid']; |
|
| 1632 | + $addedresource=$_SESSION['addedresource']; |
|
| 1633 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1634 | + |
|
| 1635 | + if (is_array($_SESSION['addedresource'])) |
|
| 1636 | + { |
|
| 1637 | + foreach ($addedresource as $toolcompare) |
|
| 1638 | + { |
|
| 1639 | + //echo $toolcompare; |
|
| 1640 | + //echo "/".$type."/".$id."****"; |
|
| 1641 | + //$key=key($addedresource); |
|
| 1642 | + //echo $addedresourceid[$key]; |
|
| 1643 | + //print_r($addedresourceid); |
|
| 1644 | + //echo "<br>"; |
|
| 1645 | + |
|
| 1646 | + if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
| 1647 | + { |
|
| 1648 | + $show=0; |
|
| 1649 | + } |
|
| 1650 | + next($addedresource); |
|
| 1651 | + } |
|
| 1652 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1653 | + if ($show!==0) |
|
| 1654 | + { |
|
| 1655 | + if ($type=="Document") |
|
| 1656 | + { |
|
| 1657 | + 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>"; |
|
| 1658 | + } |
|
| 1659 | + else |
|
| 1660 | + { |
|
| 1661 | + 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>"; |
|
| 1662 | + } |
|
| 1663 | + } |
|
| 1664 | + } |
|
| 1665 | + else // if it is not an array, it is a string |
|
| 1666 | + { |
|
| 1667 | + if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
| 1668 | + { |
|
| 1669 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1670 | + 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>"; |
|
| 1671 | + } |
|
| 1672 | + } |
|
| 1673 | 1673 | } |
| 1674 | 1674 | ?> |