@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
52 | - /** |
|
53 | - * Displays the page header |
|
54 | - * @param string The name of the page (will be showed in the page title) |
|
55 | - * @param string Optional help file name |
|
56 | - * @param string $page_header |
|
57 | - */ |
|
52 | + /** |
|
53 | + * Displays the page header |
|
54 | + * @param string The name of the page (will be showed in the page title) |
|
55 | + * @param string Optional help file name |
|
56 | + * @param string $page_header |
|
57 | + */ |
|
58 | 58 | public static function display_header($tool_name ='', $help = null, $page_header = null) |
59 | 59 | { |
60 | 60 | $origin = api_get_origin(); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | public static function display_normal_message($message, $filter = true, $returnValue = false) |
450 | 450 | { |
451 | - $message = self::return_message($message, 'normal', $filter); |
|
451 | + $message = self::return_message($message, 'normal', $filter); |
|
452 | 452 | if ($returnValue) { |
453 | 453 | return $message; |
454 | 454 | } else { |
@@ -528,22 +528,22 @@ discard block |
||
528 | 528 | } |
529 | 529 | |
530 | 530 | if ($filter) { |
531 | - $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
531 | + $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | $class = ""; |
535 | 535 | switch($type) { |
536 | 536 | case 'warning': |
537 | 537 | $class .= 'alert alert-warning'; |
538 | - break; |
|
538 | + break; |
|
539 | 539 | case 'error': |
540 | 540 | $class .= 'alert alert-danger'; |
541 | - break; |
|
541 | + break; |
|
542 | 542 | case 'confirmation': |
543 | 543 | case 'confirm': |
544 | 544 | case 'success': |
545 | 545 | $class .= 'alert alert-success'; |
546 | - break; |
|
546 | + break; |
|
547 | 547 | case 'normal': |
548 | 548 | default: |
549 | 549 | $class .= 'alert alert-info'; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | * @param array additional attributes (for instance height, width, onclick, ...) |
687 | 687 | * @param integer The wanted width of the icon (to be looked for in the corresponding img/icons/ folder) |
688 | 688 | * @return void |
689 | - */ |
|
689 | + */ |
|
690 | 690 | public static function display_icon( |
691 | 691 | $image, |
692 | 692 | $alt_text = '', |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @author Julio Montoya 2010 Function improved, adding image constants |
723 | 723 | * @author Yannick Warnier 2011 Added size handler |
724 | 724 | * @version Feb 2011 |
725 | - */ |
|
725 | + */ |
|
726 | 726 | public static function return_icon( |
727 | 727 | $image, |
728 | 728 | $alt_text = '', |
@@ -911,14 +911,14 @@ discard block |
||
911 | 911 | */ |
912 | 912 | public static function input($type, $name, $value, $attributes = array()) |
913 | 913 | { |
914 | - if (isset($type)) { |
|
915 | - $attributes['type']= $type; |
|
916 | - } |
|
917 | - if (isset($name)) { |
|
918 | - $attributes['name']= $name; |
|
919 | - } |
|
920 | - if (isset($value)) { |
|
921 | - $attributes['value']= $value; |
|
914 | + if (isset($type)) { |
|
915 | + $attributes['type']= $type; |
|
916 | + } |
|
917 | + if (isset($name)) { |
|
918 | + $attributes['name']= $name; |
|
919 | + } |
|
920 | + if (isset($value)) { |
|
921 | + $attributes['value']= $value; |
|
922 | 922 | } |
923 | 923 | return self::tag('input', '', $attributes); |
924 | 924 | } |
@@ -931,10 +931,10 @@ discard block |
||
931 | 931 | */ |
932 | 932 | public static function button($name, $value, $attributes = array()) |
933 | 933 | { |
934 | - if (!empty($name)) { |
|
934 | + if (!empty($name)) { |
|
935 | 935 | $attributes['name'] = $name; |
936 | - } |
|
937 | - return self::tag('button', $value, $attributes); |
|
936 | + } |
|
937 | + return self::tag('button', $value, $attributes); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | * in the $htmlHeadXtra variable before the display_header |
1002 | 1002 | * Add this script |
1003 | 1003 | * @example |
1004 | - * <script> |
|
1004 | + * <script> |
|
1005 | 1005 | $(function() { |
1006 | 1006 | $( "#tabs" ).tabs(); |
1007 | 1007 | }); |
@@ -1067,20 +1067,20 @@ discard block |
||
1067 | 1067 | */ |
1068 | 1068 | public static function tabsOnlyLink($headers, $selected = null) |
1069 | 1069 | { |
1070 | - $id = uniqid(); |
|
1071 | - $i = 1; |
|
1072 | - $lis = null; |
|
1073 | - foreach ($headers as $item) { |
|
1070 | + $id = uniqid(); |
|
1071 | + $i = 1; |
|
1072 | + $lis = null; |
|
1073 | + foreach ($headers as $item) { |
|
1074 | 1074 | $class = null; |
1075 | 1075 | if ($i == $selected) { |
1076 | 1076 | $class = 'active'; |
1077 | 1077 | } |
1078 | - $item = self::tag( |
|
1079 | - 'a', |
|
1080 | - $item['content'], |
|
1081 | - array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1082 | - ); |
|
1083 | - $lis .= self::tag('li', $item, array('class' => $class)); |
|
1078 | + $item = self::tag( |
|
1079 | + 'a', |
|
1080 | + $item['content'], |
|
1081 | + array('id' => $id.'-'.$i, 'href' => $item['url']) |
|
1082 | + ); |
|
1083 | + $lis .= self::tag('li', $item, array('class' => $class)); |
|
1084 | 1084 | $i++; |
1085 | 1085 | } |
1086 | 1086 | return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin')); |
@@ -1292,8 +1292,8 @@ discard block |
||
1292 | 1292 | */ |
1293 | 1293 | public static function table($headers, $rows, $attributes = array()) |
1294 | 1294 | { |
1295 | - if (empty($attributes)) { |
|
1296 | - $attributes['class'] = 'data_table'; |
|
1295 | + if (empty($attributes)) { |
|
1296 | + $attributes['class'] = 'data_table'; |
|
1297 | 1297 | } |
1298 | 1298 | $table = new HTML_Table($attributes); |
1299 | 1299 | $row = 0; |
@@ -1301,17 +1301,17 @@ discard block |
||
1301 | 1301 | |
1302 | 1302 | // Course headers |
1303 | 1303 | if (!empty($headers)) { |
1304 | - foreach ($headers as $item) { |
|
1305 | - $table->setHeaderContents($row, $column, $item); |
|
1306 | - $column++; |
|
1307 | - } |
|
1308 | - $row = 1; |
|
1309 | - $column = 0; |
|
1304 | + foreach ($headers as $item) { |
|
1305 | + $table->setHeaderContents($row, $column, $item); |
|
1306 | + $column++; |
|
1307 | + } |
|
1308 | + $row = 1; |
|
1309 | + $column = 0; |
|
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | if (!empty($rows)) { |
1313 | - foreach($rows as $content) { |
|
1314 | - $table->setCellContents($row, $column, $content); |
|
1313 | + foreach($rows as $content) { |
|
1314 | + $table->setCellContents($row, $column, $content); |
|
1315 | 1315 | $row++; |
1316 | 1316 | } |
1317 | 1317 | } |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | //$item_property['tool'] != TOOL_DROPBOX && |
1418 | 1418 | $item_property['tool'] != TOOL_NOTEBOOK && |
1419 | 1419 | $item_property['tool'] != TOOL_CHAT) |
1420 | - ) |
|
1420 | + ) |
|
1421 | 1421 | ) |
1422 | 1422 | // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset. |
1423 | 1423 | && ($item_property['visibility'] == '1' |
@@ -1433,7 +1433,7 @@ discard block |
||
1433 | 1433 | ($item_property['to_user_id'] != $user_id) && |
1434 | 1434 | (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids))) |
1435 | 1435 | ) { |
1436 | - continue; |
|
1436 | + continue; |
|
1437 | 1437 | } |
1438 | 1438 | |
1439 | 1439 | // If it's a survey, make sure the user's invited. Otherwise drop it. |
@@ -1651,21 +1651,21 @@ discard block |
||
1651 | 1651 | * |
1652 | 1652 | * @param string id of the rating ul element |
1653 | 1653 | * @param string url that will be added (for jquery see hot_courses.tpl) |
1654 | - * @param string point info array see function CourseManager::get_course_ranking() |
|
1655 | - * @param bool add a div wrapper |
|
1656 | - * @todo use templates |
|
1654 | + * @param string point info array see function CourseManager::get_course_ranking() |
|
1655 | + * @param bool add a div wrapper |
|
1656 | + * @todo use templates |
|
1657 | 1657 | **/ |
1658 | 1658 | public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true) |
1659 | 1659 | { |
1660 | - $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1661 | - $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1660 | + $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null; |
|
1661 | + $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
|
1662 | 1662 | |
1663 | - if (!empty($percentage)) { |
|
1663 | + if (!empty($percentage)) { |
|
1664 | 1664 | $percentage = $percentage*125/100; |
1665 | 1665 | } |
1666 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1666 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
1667 | 1667 | |
1668 | - $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1668 | + $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
|
1669 | 1669 | |
1670 | 1670 | $html = '<ul id="'.$id.'" class="star-rating"> |
1671 | 1671 | <li class="current-rating" style="width:'.$percentage.'px;"></li> |
@@ -1676,26 +1676,26 @@ discard block |
||
1676 | 1676 | <li><a href="javascript:void(0);" data-link="'.$url.'&star=5" title="'.$star_label.'" class="five-stars">5</a></li> |
1677 | 1677 | </ul>'; |
1678 | 1678 | |
1679 | - $labels = array(); |
|
1679 | + $labels = array(); |
|
1680 | 1680 | |
1681 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1682 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1683 | - /* if (!empty($number_of_users_who_voted)) { |
|
1681 | + $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
1682 | + $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
1683 | + /* if (!empty($number_of_users_who_voted)) { |
|
1684 | 1684 | $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
1685 | 1685 | } */ |
1686 | 1686 | |
1687 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1687 | + $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
1688 | 1688 | |
1689 | - if (!$add_div_wrapper && api_is_anonymous()) { |
|
1690 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1691 | - } |
|
1689 | + if (!$add_div_wrapper && api_is_anonymous()) { |
|
1690 | + $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
1694 | 1694 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
1695 | 1695 | |
1696 | 1696 | if ($add_div_wrapper) { |
1697 | - $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1698 | - } |
|
1697 | + $html = Display::div($html, array('id' => 'rating_wrapper_'.$id)); |
|
1698 | + } |
|
1699 | 1699 | |
1700 | 1700 | return $html; |
1701 | 1701 | } |
@@ -1733,8 +1733,8 @@ discard block |
||
1733 | 1733 | return self::page_header($title, $second_title); |
1734 | 1734 | } |
1735 | 1735 | |
1736 | - public static function page_subheader_and_translate($title, $second_title = null) |
|
1737 | - { |
|
1736 | + public static function page_subheader_and_translate($title, $second_title = null) |
|
1737 | + { |
|
1738 | 1738 | $title = get_lang($title); |
1739 | 1739 | return self::page_subheader($title, $second_title); |
1740 | 1740 | } |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | |
106 | 106 | if (isset($_POST['language'])) { |
107 | 107 | |
108 | - $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
109 | - $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language'])); |
|
108 | + $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
109 | + $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language'])); |
|
110 | 110 | $form->addHtmlEditor( |
111 | 111 | 'content', |
112 | 112 | get_lang('Content'), |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | $form->addElement('html', $buttons); |
137 | 137 | |
138 | 138 | } else { |
139 | - $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
140 | - $form->addButtonSearch(get_lang('Load'), 'send'); |
|
139 | + $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
140 | + $form->addButtonSearch(get_lang('Load'), 'send'); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 |
@@ -42,10 +42,10 @@ |
||
42 | 42 | // this 2 "mask" function are here just because the SortableTable |
43 | 43 | function get_legal_data_mask($id, $params = null, $row = null) |
44 | 44 | { |
45 | - return LegalManager::get_legal_data($id, $params, $row); |
|
45 | + return LegalManager::get_legal_data($id, $params, $row); |
|
46 | 46 | } |
47 | 47 | function count_mask() |
48 | 48 | { |
49 | - return LegalManager::count(); |
|
49 | + return LegalManager::count(); |
|
50 | 50 | } |
51 | 51 | Display :: display_footer(); |
@@ -1231,13 +1231,13 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | /** |
1234 | - * Get the users by ID |
|
1235 | - * @param array $ids student ids |
|
1236 | - * @param string $active |
|
1237 | - * @param string $order |
|
1238 | - * @param string $limit |
|
1239 | - * @return array $result student information |
|
1240 | - */ |
|
1234 | + * Get the users by ID |
|
1235 | + * @param array $ids student ids |
|
1236 | + * @param string $active |
|
1237 | + * @param string $order |
|
1238 | + * @param string $limit |
|
1239 | + * @return array $result student information |
|
1240 | + */ |
|
1241 | 1241 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
1242 | 1242 | { |
1243 | 1243 | if (empty($ids)) { |
@@ -2275,7 +2275,7 @@ discard block |
||
2275 | 2275 | * |
2276 | 2276 | * @return array with extra data info of a user i.e array('field_variable'=>'value'); |
2277 | 2277 | */ |
2278 | - public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
2278 | + public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
2279 | 2279 | { |
2280 | 2280 | $extraField = new ExtraFieldValue('user'); |
2281 | 2281 | |
@@ -3352,12 +3352,12 @@ discard block |
||
3352 | 3352 | if ($tag_id == 0) { |
3353 | 3353 | //the tag doesn't exist |
3354 | 3354 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
3355 | - Database::query($sql); |
|
3355 | + Database::query($sql); |
|
3356 | 3356 | $last_insert_id = Database::insert_id(); |
3357 | 3357 | } else { |
3358 | 3358 | //the tag exists we update it |
3359 | 3359 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
3360 | - Database::query($sql); |
|
3360 | + Database::query($sql); |
|
3361 | 3361 | $last_insert_id = $tag_id; |
3362 | 3362 | } |
3363 | 3363 | |
@@ -3552,9 +3552,9 @@ discard block |
||
3552 | 3552 | } |
3553 | 3553 | |
3554 | 3554 | /** |
3555 | - * Get extra filtrable user fields (only type select) |
|
3556 | - * @return array |
|
3557 | - */ |
|
3555 | + * Get extra filtrable user fields (only type select) |
|
3556 | + * @return array |
|
3557 | + */ |
|
3558 | 3558 | public static function get_extra_filtrable_fields() |
3559 | 3559 | { |
3560 | 3560 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3579,9 +3579,9 @@ discard block |
||
3579 | 3579 | } |
3580 | 3580 | |
3581 | 3581 | /** |
3582 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3583 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3584 | - */ |
|
3582 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3583 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3584 | + */ |
|
3585 | 3585 | public static function get_search_form_where_extra_fields() |
3586 | 3586 | { |
3587 | 3587 | $useExtraFields = false; |
@@ -3900,23 +3900,23 @@ discard block |
||
3900 | 3900 | } |
3901 | 3901 | |
3902 | 3902 | /** |
3903 | - * Get users followed by human resource manager |
|
3904 | - * @param int $userId |
|
3905 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3906 | - * @param bool $getOnlyUserId |
|
3907 | - * @param bool $getSql |
|
3908 | - * @param bool $getCount |
|
3909 | - * @param int $from |
|
3910 | - * @param int $numberItems |
|
3911 | - * @param int $column |
|
3912 | - * @param string $direction |
|
3913 | - * @param int $active |
|
3914 | - * @param string $lastConnectionDate |
|
3915 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3916 | - * @param string $keyword |
|
3903 | + * Get users followed by human resource manager |
|
3904 | + * @param int $userId |
|
3905 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3906 | + * @param bool $getOnlyUserId |
|
3907 | + * @param bool $getSql |
|
3908 | + * @param bool $getCount |
|
3909 | + * @param int $from |
|
3910 | + * @param int $numberItems |
|
3911 | + * @param int $column |
|
3912 | + * @param string $direction |
|
3913 | + * @param int $active |
|
3914 | + * @param string $lastConnectionDate |
|
3915 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3916 | + * @param string $keyword |
|
3917 | 3917 | * |
3918 | - * @return array user list |
|
3919 | - */ |
|
3918 | + * @return array user list |
|
3919 | + */ |
|
3920 | 3920 | public static function getUsersFollowedByUser( |
3921 | 3921 | $userId, |
3922 | 3922 | $userStatus = null, |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class CourseSelectForm |
19 | 19 | { |
20 | - /** |
|
21 | - * Display the form |
|
22 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
23 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
24 | - */ |
|
25 | - public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
20 | + /** |
|
21 | + * Display the form |
|
22 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
23 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
24 | + */ |
|
25 | + public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
26 | 26 | { |
27 | 27 | global $charset; |
28 | 28 | $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); |
@@ -142,50 +142,50 @@ discard block |
||
142 | 142 | </script> |
143 | 143 | <?php |
144 | 144 | |
145 | - //get destination course title |
|
146 | - if (!empty($hidden_fields['destination_course'])) { |
|
145 | + //get destination course title |
|
146 | + if (!empty($hidden_fields['destination_course'])) { |
|
147 | 147 | $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name( |
148 | 148 | $hidden_fields['destination_session'] |
149 | 149 | ) . ')' : null; |
150 | 150 | |
151 | 151 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
152 | - echo '<h3>'; |
|
153 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
154 | - echo '</h3>'; |
|
155 | - } |
|
152 | + echo '<h3>'; |
|
153 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
154 | + echo '</h3>'; |
|
155 | + } |
|
156 | 156 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
157 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
157 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
158 | 158 | $icon = Display::returnIconPath('myprogress_bar.gif'); |
159 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
160 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
159 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
160 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
161 | 161 | |
162 | - if (!empty($hidden_fields['destination_course']) && |
|
162 | + if (!empty($hidden_fields['destination_course']) && |
|
163 | 163 | !empty($hidden_fields['origin_course']) && |
164 | 164 | !empty($hidden_fields['destination_session']) && |
165 | 165 | !empty($hidden_fields['origin_session']) |
166 | 166 | ) { |
167 | - echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
168 | - echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
169 | - echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
170 | - echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
171 | - } |
|
167 | + echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
168 | + echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
169 | + echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
170 | + echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
171 | + } |
|
172 | 172 | |
173 | - $element_count = 0; |
|
173 | + $element_count = 0; |
|
174 | 174 | $forum_categories = array(); |
175 | 175 | $forums = array(); |
176 | 176 | $forum_topics = array(); |
177 | 177 | |
178 | 178 | echo '<p>'; |
179 | - echo get_lang('SelectResources'); |
|
180 | - echo '</p>'; |
|
179 | + echo get_lang('SelectResources'); |
|
180 | + echo '</p>'; |
|
181 | 181 | |
182 | 182 | Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
183 | 183 | |
184 | 184 | foreach ($course->resources as $type => $resources) { |
185 | 185 | if (count($resources) > 0) { |
186 | - switch ($type) { |
|
187 | - //Resources to avoid |
|
188 | - case RESOURCE_FORUMCATEGORY: |
|
186 | + switch ($type) { |
|
187 | + //Resources to avoid |
|
188 | + case RESOURCE_FORUMCATEGORY: |
|
189 | 189 | foreach ($resources as $id => $resource) { |
190 | 190 | $forum_categories[$id] = $resource; |
191 | 191 | } |
@@ -204,38 +204,38 @@ discard block |
||
204 | 204 | $element_count++; |
205 | 205 | break; |
206 | 206 | case RESOURCE_LINKCATEGORY: |
207 | - case RESOURCE_FORUMPOST: |
|
208 | - case RESOURCE_QUIZQUESTION: |
|
209 | - case RESOURCE_SURVEYQUESTION: |
|
210 | - case RESOURCE_SURVEYINVITATION: |
|
211 | - case RESOURCE_SCORM: |
|
212 | - break; |
|
207 | + case RESOURCE_FORUMPOST: |
|
208 | + case RESOURCE_QUIZQUESTION: |
|
209 | + case RESOURCE_SURVEYQUESTION: |
|
210 | + case RESOURCE_SURVEYINVITATION: |
|
211 | + case RESOURCE_SCORM: |
|
212 | + break; |
|
213 | 213 | default : |
214 | - //echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
215 | - echo '<span id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$type'".');" > </span> '; |
|
216 | - echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
217 | - echo '<div id="div_'.$type.'">'; |
|
218 | - if ($type == RESOURCE_LEARNPATH) { |
|
219 | - Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
220 | - Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
221 | - } |
|
222 | - if ($type == RESOURCE_DOCUMENT) { |
|
214 | + //echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
215 | + echo '<span id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$type'".');" > </span> '; |
|
216 | + echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
217 | + echo '<div id="div_'.$type.'">'; |
|
218 | + if ($type == RESOURCE_LEARNPATH) { |
|
219 | + Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
220 | + Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
221 | + } |
|
222 | + if ($type == RESOURCE_DOCUMENT) { |
|
223 | 223 | if (api_get_setting('show_glossary_in_documents') != 'none') { |
224 | 224 | Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
225 | 225 | } |
226 | - } |
|
226 | + } |
|
227 | 227 | |
228 | - echo '<div class="well">'; |
|
228 | + echo '<div class="well">'; |
|
229 | 229 | |
230 | 230 | echo '<div class="btn-group">'; |
231 | - echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
231 | + echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
232 | 232 | echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>"; |
233 | - echo '</div><br />'; |
|
233 | + echo '</div><br />'; |
|
234 | 234 | echo '<ul class="list-unstyled">'; |
235 | - foreach ($resources as $id => $resource) { |
|
235 | + foreach ($resources as $id => $resource) { |
|
236 | 236 | if ($resource) { |
237 | 237 | echo '<li>'; |
238 | - // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
238 | + // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
239 | 239 | Resource::setClassType($resource); |
240 | 240 | echo '<label class="checkbox">'; |
241 | 241 | echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />'; |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | echo '</label>'; |
244 | 244 | echo '</li>'; |
245 | 245 | } |
246 | - } |
|
246 | + } |
|
247 | 247 | echo '</ul>'; |
248 | - echo '</div>'; |
|
249 | - echo '</div>'; |
|
250 | - echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
251 | - $element_count++; |
|
248 | + echo '</div>'; |
|
249 | + echo '</div>'; |
|
250 | + echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
251 | + $element_count++; |
|
252 | 252 | } |
253 | - } |
|
254 | - } |
|
253 | + } |
|
254 | + } |
|
255 | 255 | |
256 | 256 | //Fixes forum order |
257 | 257 | if (!empty($forum_categories)) { |
@@ -308,65 +308,65 @@ discard block |
||
308 | 308 | echo '<script language="javascript">exp('."'$type'".')</script>'; |
309 | 309 | } |
310 | 310 | |
311 | - if ($avoid_serialize) { |
|
312 | - /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
311 | + if ($avoid_serialize) { |
|
312 | + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
313 | 313 | (when there are directories with hundred/thousand of files) */ |
314 | - // this is a known issue of serialize |
|
315 | - $course->resources['document']= null; |
|
316 | - } |
|
314 | + // this is a known issue of serialize |
|
315 | + $course->resources['document']= null; |
|
316 | + } |
|
317 | 317 | |
318 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
318 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
319 | 319 | |
320 | - if (is_array($hidden_fields)) { |
|
321 | - foreach ($hidden_fields as $key => $value) { |
|
322 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
323 | - } |
|
324 | - } |
|
320 | + if (is_array($hidden_fields)) { |
|
321 | + foreach ($hidden_fields as $key => $value) { |
|
322 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
323 | + } |
|
324 | + } |
|
325 | 325 | |
326 | 326 | $recycleOption = isset($_POST['recycle_option']) ? true : false; |
327 | 327 | |
328 | - if (empty($element_count)) { |
|
329 | - Display::display_warning_message(get_lang('NoDataAvailable')); |
|
330 | - } else { |
|
331 | - if (!empty($hidden_fields['destination_session'])) { |
|
332 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
328 | + if (empty($element_count)) { |
|
329 | + Display::display_warning_message(get_lang('NoDataAvailable')); |
|
330 | + } else { |
|
331 | + if (!empty($hidden_fields['destination_session'])) { |
|
332 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
333 | 333 | get_lang('Ok').'</button>'; |
334 | - } else { |
|
334 | + } else { |
|
335 | 335 | if ($recycleOption) { |
336 | 336 | echo '<br /><button class="save" type="submit">'. |
337 | 337 | get_lang('Ok').'</button>'; |
338 | 338 | } else { |
339 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
339 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
340 | 340 | get_lang('Ok').'</button>'; |
341 | 341 | } |
342 | - } |
|
343 | - } |
|
342 | + } |
|
343 | + } |
|
344 | 344 | |
345 | - CourseSelectForm::display_hidden_quiz_questions($course); |
|
346 | - CourseSelectForm::display_hidden_scorm_directories($course); |
|
347 | - echo '</form>'; |
|
348 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
349 | - } |
|
345 | + CourseSelectForm::display_hidden_quiz_questions($course); |
|
346 | + CourseSelectForm::display_hidden_scorm_directories($course); |
|
347 | + echo '</form>'; |
|
348 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
349 | + } |
|
350 | 350 | |
351 | 351 | /** |
352 | 352 | * @param $course |
353 | 353 | */ |
354 | 354 | static function display_hidden_quiz_questions($course) |
355 | 355 | { |
356 | - if(is_array($course->resources)){ |
|
357 | - foreach ($course->resources as $type => $resources) { |
|
358 | - if (count($resources) > 0) { |
|
359 | - switch ($type) { |
|
360 | - case RESOURCE_QUIZQUESTION: |
|
361 | - foreach ($resources as $id => $resource) { |
|
362 | - echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
363 | - } |
|
364 | - break; |
|
365 | - } |
|
366 | - } |
|
367 | - } |
|
368 | - } |
|
369 | - } |
|
356 | + if(is_array($course->resources)){ |
|
357 | + foreach ($course->resources as $type => $resources) { |
|
358 | + if (count($resources) > 0) { |
|
359 | + switch ($type) { |
|
360 | + case RESOURCE_QUIZQUESTION: |
|
361 | + foreach ($resources as $id => $resource) { |
|
362 | + echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
363 | + } |
|
364 | + break; |
|
365 | + } |
|
366 | + } |
|
367 | + } |
|
368 | + } |
|
369 | + } |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * @param $course |
@@ -374,30 +374,30 @@ discard block |
||
374 | 374 | static function display_hidden_scorm_directories($course) |
375 | 375 | { |
376 | 376 | if (is_array($course->resources)){ |
377 | - foreach ($course->resources as $type => $resources) { |
|
378 | - if (count($resources) > 0) { |
|
379 | - switch($type) { |
|
380 | - case RESOURCE_SCORM: |
|
381 | - foreach ($resources as $id => $resource) { |
|
382 | - echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
383 | - } |
|
384 | - break; |
|
385 | - } |
|
386 | - } |
|
387 | - } |
|
388 | - } |
|
389 | - } |
|
377 | + foreach ($course->resources as $type => $resources) { |
|
378 | + if (count($resources) > 0) { |
|
379 | + switch($type) { |
|
380 | + case RESOURCE_SCORM: |
|
381 | + foreach ($resources as $id => $resource) { |
|
382 | + echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
383 | + } |
|
384 | + break; |
|
385 | + } |
|
386 | + } |
|
387 | + } |
|
388 | + } |
|
389 | + } |
|
390 | 390 | |
391 | - /** |
|
392 | - * Get the posted course |
|
393 | - * @param string $from who calls the function? |
|
391 | + /** |
|
392 | + * Get the posted course |
|
393 | + * @param string $from who calls the function? |
|
394 | 394 | * It can be copy_course, create_backup, import_backup or recycle_course |
395 | 395 | * @param int $session_id |
396 | 396 | * @param string $course_code |
397 | - * @return course The course-object with all resources selected by the user |
|
398 | - * in the form given by display_form(...) |
|
399 | - */ |
|
400 | - public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
397 | + * @return course The course-object with all resources selected by the user |
|
398 | + * in the form given by display_form(...) |
|
399 | + */ |
|
400 | + public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
401 | 401 | { |
402 | 402 | $course = null; |
403 | 403 | |
@@ -407,30 +407,30 @@ discard block |
||
407 | 407 | return false; |
408 | 408 | } |
409 | 409 | |
410 | - // Create the resource DOCUMENT objects |
|
411 | - // Loading the results from the checkboxes of ethe javascript |
|
412 | - $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
410 | + // Create the resource DOCUMENT objects |
|
411 | + // Loading the results from the checkboxes of ethe javascript |
|
412 | + $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
413 | 413 | |
414 | - $course_info = api_get_course_info($course_code); |
|
415 | - $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
416 | - $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
417 | - $course_id = $course_info['real_id']; |
|
414 | + $course_info = api_get_course_info($course_code); |
|
415 | + $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
416 | + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
417 | + $course_id = $course_info['real_id']; |
|
418 | 418 | |
419 | - /* Searching the documents resource that have been set to null because |
|
419 | + /* Searching the documents resource that have been set to null because |
|
420 | 420 | $avoid_serialize is true in the display_form() function*/ |
421 | - if ($from === 'copy_course') { |
|
422 | - if (is_array($resource)) { |
|
423 | - $resource = array_keys($resource); |
|
421 | + if ($from === 'copy_course') { |
|
422 | + if (is_array($resource)) { |
|
423 | + $resource = array_keys($resource); |
|
424 | 424 | |
425 | - foreach ($resource as $resource_item) { |
|
425 | + foreach ($resource as $resource_item) { |
|
426 | 426 | |
427 | - $condition_session = ''; |
|
428 | - if (!empty($session_id)) { |
|
429 | - $session_id = intval($session_id); |
|
430 | - $condition_session = ' AND d.session_id ='.$session_id; |
|
431 | - } |
|
427 | + $condition_session = ''; |
|
428 | + if (!empty($session_id)) { |
|
429 | + $session_id = intval($session_id); |
|
430 | + $condition_session = ' AND d.session_id ='.$session_id; |
|
431 | + } |
|
432 | 432 | |
433 | - $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
433 | + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
434 | 434 | FROM '.$table_doc.' d, '.$table_prop.' p |
435 | 435 | WHERE |
436 | 436 | d.c_id = '.$course_id.' AND |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | p.ref = d.id AND p.visibility != 2 AND |
440 | 440 | d.id = '.$resource_item.$condition_session.' |
441 | 441 | ORDER BY path'; |
442 | - $db_result = Database::query($sql); |
|
443 | - while ($obj = Database::fetch_object($db_result)) { |
|
442 | + $db_result = Database::query($sql); |
|
443 | + while ($obj = Database::fetch_object($db_result)) { |
|
444 | 444 | $doc = new Document( |
445 | 445 | $obj->id, |
446 | 446 | $obj->path, |
@@ -464,25 +464,25 @@ discard block |
||
464 | 464 | } |
465 | 465 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
466 | 466 | } |
467 | - } |
|
468 | - } |
|
469 | - } |
|
470 | - } |
|
467 | + } |
|
468 | + } |
|
469 | + } |
|
470 | + } |
|
471 | 471 | |
472 | - if (is_array($course->resources)) { |
|
473 | - foreach ($course->resources as $type => $resources) { |
|
472 | + if (is_array($course->resources)) { |
|
473 | + foreach ($course->resources as $type => $resources) { |
|
474 | 474 | |
475 | - switch ($type) { |
|
476 | - case RESOURCE_SURVEYQUESTION: |
|
477 | - foreach($resources as $id => $obj) { |
|
478 | - if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
475 | + switch ($type) { |
|
476 | + case RESOURCE_SURVEYQUESTION: |
|
477 | + foreach($resources as $id => $obj) { |
|
478 | + if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
479 | 479 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
480 | 480 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
481 | 481 | ) { |
482 | - unset($course->resources[$type][$id]); |
|
483 | - } |
|
484 | - } |
|
485 | - break; |
|
482 | + unset($course->resources[$type][$id]); |
|
483 | + } |
|
484 | + } |
|
485 | + break; |
|
486 | 486 | case RESOURCE_FORUMTOPIC: |
487 | 487 | case RESOURCE_FORUMPOST: |
488 | 488 | //Add post from topic |
@@ -534,62 +534,62 @@ discard block |
||
534 | 534 | } |
535 | 535 | } |
536 | 536 | } |
537 | - case RESOURCE_LINKCATEGORY: |
|
538 | - case RESOURCE_FORUMCATEGORY: |
|
539 | - case RESOURCE_QUIZQUESTION: |
|
540 | - case RESOURCE_DOCUMENT: |
|
541 | - // Mark folders to import which are not selected by the user to import, |
|
542 | - // but in which a document was selected. |
|
543 | - $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
544 | - if (!empty($resources) && is_array($resources)) |
|
545 | - foreach ($resources as $id => $obj) { |
|
546 | - if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
537 | + case RESOURCE_LINKCATEGORY: |
|
538 | + case RESOURCE_FORUMCATEGORY: |
|
539 | + case RESOURCE_QUIZQUESTION: |
|
540 | + case RESOURCE_DOCUMENT: |
|
541 | + // Mark folders to import which are not selected by the user to import, |
|
542 | + // but in which a document was selected. |
|
543 | + $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
544 | + if (!empty($resources) && is_array($resources)) |
|
545 | + foreach ($resources as $id => $obj) { |
|
546 | + if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
547 | 547 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
548 | 548 | is_array($documents) |
549 | 549 | ) { |
550 | - foreach ($documents as $id_to_check => $post_value) { |
|
551 | - $obj_to_check = $resources[$id_to_check]; |
|
552 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
553 | - if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
554 | - $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
555 | - break; |
|
556 | - } |
|
557 | - } |
|
558 | - } |
|
559 | - } |
|
560 | - default : |
|
561 | - if (!empty($resources) && is_array($resources)) { |
|
562 | - foreach ($resources as $id => $obj) { |
|
563 | - $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
564 | - // check if document is in a quiz (audio/video) |
|
565 | - if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
566 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
550 | + foreach ($documents as $id_to_check => $post_value) { |
|
551 | + $obj_to_check = $resources[$id_to_check]; |
|
552 | + $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
553 | + if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
554 | + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
555 | + break; |
|
556 | + } |
|
557 | + } |
|
558 | + } |
|
559 | + } |
|
560 | + default : |
|
561 | + if (!empty($resources) && is_array($resources)) { |
|
562 | + foreach ($resources as $id => $obj) { |
|
563 | + $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
564 | + // check if document is in a quiz (audio/video) |
|
565 | + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
566 | + foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
567 | 567 | $quiz = $quiz->obj; |
568 | - if (isset($quiz->media) && $quiz->media == $id) { |
|
569 | - $resource_is_used_elsewhere = true; |
|
570 | - } |
|
571 | - } |
|
572 | - } |
|
573 | - if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
574 | - unset($course->resources[$type][$id]); |
|
575 | - } |
|
576 | - } |
|
577 | - } |
|
578 | - } |
|
579 | - } |
|
580 | - } |
|
581 | - |
|
582 | - return $course; |
|
583 | - } |
|
584 | - |
|
585 | - /** |
|
586 | - * Display the form session export |
|
587 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
588 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
589 | - */ |
|
590 | - public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
591 | - { |
|
592 | - ?> |
|
568 | + if (isset($quiz->media) && $quiz->media == $id) { |
|
569 | + $resource_is_used_elsewhere = true; |
|
570 | + } |
|
571 | + } |
|
572 | + } |
|
573 | + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
574 | + unset($course->resources[$type][$id]); |
|
575 | + } |
|
576 | + } |
|
577 | + } |
|
578 | + } |
|
579 | + } |
|
580 | + } |
|
581 | + |
|
582 | + return $course; |
|
583 | + } |
|
584 | + |
|
585 | + /** |
|
586 | + * Display the form session export |
|
587 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
588 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
589 | + */ |
|
590 | + public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
591 | + { |
|
592 | + ?> |
|
593 | 593 | <script> |
594 | 594 | function exp(item) { |
595 | 595 | el = document.getElementById('div_'+item); |
@@ -633,66 +633,66 @@ discard block |
||
633 | 633 | </script> |
634 | 634 | <?php |
635 | 635 | |
636 | - //get destination course title |
|
637 | - if(!empty($hidden_fields['destination_course'])) { |
|
638 | - if (!empty($hidden_fields['destination_session'])) { |
|
639 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
640 | - } else { |
|
641 | - $sessionTitle = null; |
|
642 | - } |
|
636 | + //get destination course title |
|
637 | + if(!empty($hidden_fields['destination_course'])) { |
|
638 | + if (!empty($hidden_fields['destination_session'])) { |
|
639 | + $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
640 | + } else { |
|
641 | + $sessionTitle = null; |
|
642 | + } |
|
643 | 643 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
644 | - echo '<h3>'; |
|
645 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
646 | - echo '</h3>'; |
|
647 | - } |
|
644 | + echo '<h3>'; |
|
645 | + echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
646 | + echo '</h3>'; |
|
647 | + } |
|
648 | 648 | |
649 | - echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
650 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
649 | + echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
650 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
651 | 651 | $icon = Display::returnIconPath('progress_bar.gif'); |
652 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
653 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
654 | - foreach ($list_course as $course){ |
|
655 | - foreach ($course->resources as $type => $resources) { |
|
656 | - if (count($resources) > 0) { |
|
657 | - //echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
658 | - echo '<span id="img_'.$course->code.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$course->code'".');" > </span>'; |
|
659 | - echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
660 | - echo '<div id="div_'.$course->code.'">'; |
|
661 | - echo '<blockquote>'; |
|
652 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
653 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
654 | + foreach ($list_course as $course){ |
|
655 | + foreach ($course->resources as $type => $resources) { |
|
656 | + if (count($resources) > 0) { |
|
657 | + //echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
658 | + echo '<span id="img_'.$course->code.'" class="fa fa-minus-square-o fa-lg" onclick="javascript:exp('."'$course->code'".');" > </span>'; |
|
659 | + echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
660 | + echo '<div id="div_'.$course->code.'">'; |
|
661 | + echo '<blockquote>'; |
|
662 | 662 | |
663 | 663 | echo '<div class="btn-group">'; |
664 | - echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
664 | + echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
665 | 665 | echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>"; |
666 | - echo '</div><br />'; |
|
666 | + echo '</div><br />'; |
|
667 | 667 | |
668 | - foreach ($resources as $id => $resource) { |
|
669 | - echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
668 | + foreach ($resources as $id => $resource) { |
|
669 | + echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
670 | 670 | echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>'; |
671 | - $resource->show(); |
|
672 | - echo '</label>'; |
|
673 | - } |
|
674 | - echo '</blockquote>'; |
|
675 | - echo '</div>'; |
|
676 | - echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
677 | - } |
|
678 | - } |
|
679 | - } |
|
680 | - if ($avoid_serialize) { |
|
681 | - //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
682 | - // this is a known issue of serialize |
|
683 | - $course->resources['document']= null; |
|
684 | - } |
|
685 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
686 | - if (is_array($hidden_fields)) { |
|
687 | - foreach ($hidden_fields as $key => $value) { |
|
688 | - echo "\n"; |
|
689 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
690 | - } |
|
691 | - } |
|
692 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
693 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
694 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
695 | - echo '</form>'; |
|
696 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
697 | - } |
|
671 | + $resource->show(); |
|
672 | + echo '</label>'; |
|
673 | + } |
|
674 | + echo '</blockquote>'; |
|
675 | + echo '</div>'; |
|
676 | + echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
677 | + } |
|
678 | + } |
|
679 | + } |
|
680 | + if ($avoid_serialize) { |
|
681 | + //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
682 | + // this is a known issue of serialize |
|
683 | + $course->resources['document']= null; |
|
684 | + } |
|
685 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
686 | + if (is_array($hidden_fields)) { |
|
687 | + foreach ($hidden_fields as $key => $value) { |
|
688 | + echo "\n"; |
|
689 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
690 | + } |
|
691 | + } |
|
692 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
693 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
694 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
695 | + echo '</form>'; |
|
696 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
697 | + } |
|
698 | 698 | } |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
622 | - * Recycle Thematics |
|
623 | - */ |
|
622 | + * Recycle Thematics |
|
623 | + */ |
|
624 | 624 | public function recycle_thematic($session_id = 0) |
625 | 625 | { |
626 | 626 | if ($this->course->has_resources(RESOURCE_THEMATIC)) { |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
688 | - * Recycle Attendances |
|
689 | - */ |
|
688 | + * Recycle Attendances |
|
689 | + */ |
|
690 | 690 | public function recycle_attendance($session_id = 0) |
691 | 691 | { |
692 | 692 | if ($this->course->has_resources(RESOURCE_ATTENDANCE)) { |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
329 | - * Serialize the course with the best serializer available |
|
330 | - * @return string |
|
331 | - */ |
|
329 | + * Serialize the course with the best serializer available |
|
330 | + * @return string |
|
331 | + */ |
|
332 | 332 | public static function serialize($course) |
333 | 333 | { |
334 | 334 | if (extension_loaded('igbinary')) { |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Unserialize the course with the best serializer available |
|
343 | - * @param string $course |
|
344 | - */ |
|
342 | + * Unserialize the course with the best serializer available |
|
343 | + * @param string $course |
|
344 | + */ |
|
345 | 345 | public static function unserialize($course) |
346 | 346 | { |
347 | 347 | if (extension_loaded('igbinary')) { |
@@ -66,19 +66,19 @@ |
||
66 | 66 | $attachment_comment = null, |
67 | 67 | $all_day = 0 |
68 | 68 | ) { |
69 | - parent::__construct($id, RESOURCE_EVENT); |
|
69 | + parent::__construct($id, RESOURCE_EVENT); |
|
70 | 70 | |
71 | - $this->title = $title; |
|
72 | - $this->content = $content; |
|
73 | - $this->start_date = $start_date; |
|
74 | - $this->end_date = $end_date; |
|
75 | - $this->all_day = $all_day; |
|
71 | + $this->title = $title; |
|
72 | + $this->content = $content; |
|
73 | + $this->start_date = $start_date; |
|
74 | + $this->end_date = $end_date; |
|
75 | + $this->all_day = $all_day; |
|
76 | 76 | |
77 | - $this->attachment_path = $attachment_path; |
|
78 | - $this->attachment_filename = $attachment_filename; |
|
79 | - $this->attachment_size = $attachment_size; |
|
80 | - $this->attachment_comment = $attachment_comment; |
|
81 | - } |
|
77 | + $this->attachment_path = $attachment_path; |
|
78 | + $this->attachment_filename = $attachment_filename; |
|
79 | + $this->attachment_size = $attachment_size; |
|
80 | + $this->attachment_comment = $attachment_comment; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Show this Event |
@@ -84,120 +84,120 @@ |
||
84 | 84 | */ |
85 | 85 | public $author; |
86 | 86 | |
87 | - /** |
|
88 | - * Author's image |
|
89 | - */ |
|
90 | - public $preview_image; |
|
87 | + /** |
|
88 | + * Author's image |
|
89 | + */ |
|
90 | + public $preview_image; |
|
91 | 91 | |
92 | - /** |
|
93 | - * Create a new learnpath |
|
94 | - * @param integer ID |
|
95 | - * @param integer Type (1,2,3,...) |
|
96 | - * @param string $name |
|
97 | - * @param string $path |
|
98 | - * @param string $ref |
|
99 | - * @param string $description |
|
100 | - * @param string $content_local |
|
101 | - * @param string $default_encoding |
|
102 | - * @param string $default_view_mode |
|
103 | - * @param bool $prevent_reinit |
|
104 | - * @param bool $force_commit |
|
105 | - * @param string $content_maker |
|
106 | - * @param integer $display_order |
|
107 | - * @param string $js_lib |
|
108 | - * @param string $content_license |
|
109 | - * @param integer $debug |
|
110 | - * @param string $visibility |
|
111 | - * @param array $items |
|
112 | - */ |
|
113 | - public function __construct( |
|
114 | - $id, |
|
115 | - $type, |
|
116 | - $name, |
|
117 | - $path, |
|
118 | - $ref, |
|
119 | - $description, |
|
120 | - $content_local, |
|
121 | - $default_encoding, |
|
122 | - $default_view_mode, |
|
123 | - $prevent_reinit, |
|
124 | - $force_commit, |
|
125 | - $content_maker, |
|
126 | - $display_order, |
|
127 | - $js_lib, |
|
128 | - $content_license, |
|
129 | - $debug, |
|
130 | - $visibility, |
|
131 | - $author, |
|
132 | - $preview_image, |
|
133 | - $use_max_score, |
|
134 | - $autolaunch, |
|
135 | - $created_on, |
|
136 | - $modified_on, |
|
137 | - $publicated_on, |
|
138 | - $expired_on, |
|
139 | - $session_id, |
|
140 | - $items |
|
141 | - ) { |
|
142 | - parent::__construct($id, RESOURCE_LEARNPATH); |
|
143 | - $this->lp_type = $type; |
|
144 | - $this->name = $name; |
|
145 | - $this->path = $path; |
|
146 | - $this->ref = $ref; |
|
147 | - $this->description = $description; |
|
148 | - $this->content_local = $content_local; |
|
149 | - $this->default_encoding = $default_encoding; |
|
150 | - $this->default_view_mod = $default_view_mode; |
|
151 | - $this->prevent_reinit = $prevent_reinit; |
|
152 | - $this->force_commit = $force_commit; |
|
153 | - $this->content_maker = $content_maker; |
|
154 | - $this->display_order = $display_order; |
|
155 | - $this->js_lib = $js_lib; |
|
156 | - $this->content_license = $content_license; |
|
157 | - $this->debug = $debug; |
|
158 | - $this->visibility=$visibility; |
|
92 | + /** |
|
93 | + * Create a new learnpath |
|
94 | + * @param integer ID |
|
95 | + * @param integer Type (1,2,3,...) |
|
96 | + * @param string $name |
|
97 | + * @param string $path |
|
98 | + * @param string $ref |
|
99 | + * @param string $description |
|
100 | + * @param string $content_local |
|
101 | + * @param string $default_encoding |
|
102 | + * @param string $default_view_mode |
|
103 | + * @param bool $prevent_reinit |
|
104 | + * @param bool $force_commit |
|
105 | + * @param string $content_maker |
|
106 | + * @param integer $display_order |
|
107 | + * @param string $js_lib |
|
108 | + * @param string $content_license |
|
109 | + * @param integer $debug |
|
110 | + * @param string $visibility |
|
111 | + * @param array $items |
|
112 | + */ |
|
113 | + public function __construct( |
|
114 | + $id, |
|
115 | + $type, |
|
116 | + $name, |
|
117 | + $path, |
|
118 | + $ref, |
|
119 | + $description, |
|
120 | + $content_local, |
|
121 | + $default_encoding, |
|
122 | + $default_view_mode, |
|
123 | + $prevent_reinit, |
|
124 | + $force_commit, |
|
125 | + $content_maker, |
|
126 | + $display_order, |
|
127 | + $js_lib, |
|
128 | + $content_license, |
|
129 | + $debug, |
|
130 | + $visibility, |
|
131 | + $author, |
|
132 | + $preview_image, |
|
133 | + $use_max_score, |
|
134 | + $autolaunch, |
|
135 | + $created_on, |
|
136 | + $modified_on, |
|
137 | + $publicated_on, |
|
138 | + $expired_on, |
|
139 | + $session_id, |
|
140 | + $items |
|
141 | + ) { |
|
142 | + parent::__construct($id, RESOURCE_LEARNPATH); |
|
143 | + $this->lp_type = $type; |
|
144 | + $this->name = $name; |
|
145 | + $this->path = $path; |
|
146 | + $this->ref = $ref; |
|
147 | + $this->description = $description; |
|
148 | + $this->content_local = $content_local; |
|
149 | + $this->default_encoding = $default_encoding; |
|
150 | + $this->default_view_mod = $default_view_mode; |
|
151 | + $this->prevent_reinit = $prevent_reinit; |
|
152 | + $this->force_commit = $force_commit; |
|
153 | + $this->content_maker = $content_maker; |
|
154 | + $this->display_order = $display_order; |
|
155 | + $this->js_lib = $js_lib; |
|
156 | + $this->content_license = $content_license; |
|
157 | + $this->debug = $debug; |
|
158 | + $this->visibility=$visibility; |
|
159 | 159 | |
160 | - $this->use_max_score=$use_max_score; |
|
161 | - $this->autolaunch=$autolaunch; |
|
162 | - $this->created_on=$created_on; |
|
163 | - $this->modified_on=$modified_on; |
|
164 | - $this->publicated_on=$publicated_on; |
|
165 | - $this->expired_on=$expired_on; |
|
166 | - $this->session_id=$session_id; |
|
160 | + $this->use_max_score=$use_max_score; |
|
161 | + $this->autolaunch=$autolaunch; |
|
162 | + $this->created_on=$created_on; |
|
163 | + $this->modified_on=$modified_on; |
|
164 | + $this->publicated_on=$publicated_on; |
|
165 | + $this->expired_on=$expired_on; |
|
166 | + $this->session_id=$session_id; |
|
167 | 167 | |
168 | - $this->author= $author; |
|
169 | - $this->preview_image= $preview_image; |
|
168 | + $this->author= $author; |
|
169 | + $this->preview_image= $preview_image; |
|
170 | 170 | |
171 | - $this->items = $items; |
|
172 | - } |
|
173 | - /** |
|
174 | - * Get the items |
|
175 | - */ |
|
176 | - function get_items() |
|
177 | - { |
|
178 | - return $this->items; |
|
179 | - } |
|
171 | + $this->items = $items; |
|
172 | + } |
|
173 | + /** |
|
174 | + * Get the items |
|
175 | + */ |
|
176 | + function get_items() |
|
177 | + { |
|
178 | + return $this->items; |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * Check if a given resource is used as an item in this chapter |
|
183 | - */ |
|
184 | - function has_item($resource) |
|
185 | - { |
|
186 | - foreach ($this->items as $item) { |
|
187 | - if ($item['id'] == $resource->get_id() && |
|
188 | - isset($item['type']) && $item['type'] == $resource->get_type() |
|
189 | - ) { |
|
190 | - return true; |
|
191 | - } |
|
192 | - } |
|
193 | - return false; |
|
194 | - } |
|
181 | + /** |
|
182 | + * Check if a given resource is used as an item in this chapter |
|
183 | + */ |
|
184 | + function has_item($resource) |
|
185 | + { |
|
186 | + foreach ($this->items as $item) { |
|
187 | + if ($item['id'] == $resource->get_id() && |
|
188 | + isset($item['type']) && $item['type'] == $resource->get_type() |
|
189 | + ) { |
|
190 | + return true; |
|
191 | + } |
|
192 | + } |
|
193 | + return false; |
|
194 | + } |
|
195 | 195 | |
196 | - /** |
|
197 | - * Show this learnpath |
|
198 | - */ |
|
199 | - function show() { |
|
200 | - parent::show(); |
|
201 | - echo $this->name; |
|
202 | - } |
|
196 | + /** |
|
197 | + * Show this learnpath |
|
198 | + */ |
|
199 | + function show() { |
|
200 | + parent::show(); |
|
201 | + echo $this->name; |
|
202 | + } |
|
203 | 203 | } |