@@ -20,16 +20,16 @@ |
||
20 | 20 | $exerciseId = $objExercise->selectId(); |
21 | 21 | if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
22 | 22 | $hit = 0; |
23 | - $answerId = $hotspotId; |
|
23 | + $answerId = $hotspotId; |
|
24 | 24 | |
25 | - // remove from session |
|
26 | - unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
25 | + // remove from session |
|
26 | + unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
27 | 27 | } else { // user clicked ON a hotspot |
28 | - $hit = 1; |
|
29 | - $answerId = $hotspotId; |
|
28 | + $hit = 1; |
|
29 | + $answerId = $hotspotId; |
|
30 | 30 | |
31 | - // Save into session |
|
32 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
31 | + // Save into session |
|
32 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | //round-up the coordinates |
@@ -49,29 +49,29 @@ discard block |
||
49 | 49 | $extra_field_list = UserManager::get_extra_fields(); |
50 | 50 | $new_field_list = array(); |
51 | 51 | if (is_array($extra_field_list)) { |
52 | - foreach ($extra_field_list as $extra_field) { |
|
53 | - //if is enabled to filter and is a "<select>" field type |
|
54 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
52 | + foreach ($extra_field_list as $extra_field) { |
|
53 | + //if is enabled to filter and is a "<select>" field type |
|
54 | + if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
55 | 55 | $new_field_list[] = array( |
56 | 56 | 'name' => $extra_field[3], |
57 | 57 | 'variable' => $extra_field[1], |
58 | 58 | 'data' => $extra_field[9], |
59 | 59 | ); |
60 | - } |
|
61 | - } |
|
60 | + } |
|
61 | + } |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | function search_users($needle, $type) |
65 | 65 | { |
66 | - global $id_session; |
|
66 | + global $id_session; |
|
67 | 67 | |
68 | 68 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
69 | 69 | $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
70 | 70 | |
71 | - $xajax_response = new xajaxResponse(); |
|
72 | - $return = ''; |
|
71 | + $xajax_response = new xajaxResponse(); |
|
72 | + $return = ''; |
|
73 | 73 | |
74 | - if (!empty($needle) && !empty($type)) { |
|
74 | + if (!empty($needle) && !empty($type)) { |
|
75 | 75 | |
76 | 76 | //normal behaviour |
77 | 77 | if ($type == 'any_session' && $needle == 'false') { |
@@ -79,32 +79,32 @@ discard block |
||
79 | 79 | $needle = ''; |
80 | 80 | } |
81 | 81 | |
82 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
83 | - $charset = api_get_system_encoding(); |
|
84 | - $needle = Database::escape_string($needle); |
|
85 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
82 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
83 | + $charset = api_get_system_encoding(); |
|
84 | + $needle = Database::escape_string($needle); |
|
85 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
86 | 86 | |
87 | - $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
88 | - $cond_user_id = ''; |
|
87 | + $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
88 | + $cond_user_id = ''; |
|
89 | 89 | |
90 | 90 | //Only for single & multiple |
91 | 91 | if (in_array($type, array('single','multiple'))) { |
92 | - if (!empty($id_session)) { |
|
93 | - $id_session = intval($id_session); |
|
94 | - // check id_user from session_rel_user table |
|
95 | - $sql = 'SELECT user_id FROM '.$tbl_session_rel_user.' |
|
92 | + if (!empty($id_session)) { |
|
93 | + $id_session = intval($id_session); |
|
94 | + // check id_user from session_rel_user table |
|
95 | + $sql = 'SELECT user_id FROM '.$tbl_session_rel_user.' |
|
96 | 96 | WHERE session_id ="'.$id_session.'" AND relation_type<>'.SESSION_RELATION_TYPE_RRHH.' '; |
97 | - $res = Database::query($sql); |
|
98 | - $user_ids = array(); |
|
99 | - if (Database::num_rows($res) > 0) { |
|
100 | - while ($row = Database::fetch_row($res)) { |
|
101 | - $user_ids[] = (int)$row[0]; |
|
102 | - } |
|
103 | - } |
|
104 | - if (count($user_ids) > 0) { |
|
105 | - $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')'; |
|
106 | - } |
|
107 | - } |
|
97 | + $res = Database::query($sql); |
|
98 | + $user_ids = array(); |
|
99 | + if (Database::num_rows($res) > 0) { |
|
100 | + while ($row = Database::fetch_row($res)) { |
|
101 | + $user_ids[] = (int)$row[0]; |
|
102 | + } |
|
103 | + } |
|
104 | + if (count($user_ids) > 0) { |
|
105 | + $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')'; |
|
106 | + } |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | switch ($type) { |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | user.status <> 6 '.$cond_user_id. |
137 | 137 | $order_clause; |
138 | 138 | break; |
139 | - } |
|
140 | - if (api_is_multiple_url_enabled()) { |
|
141 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
142 | - $access_url_id = api_get_current_access_url_id(); |
|
143 | - if ($access_url_id != -1) { |
|
139 | + } |
|
140 | + if (api_is_multiple_url_enabled()) { |
|
141 | + $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
142 | + $access_url_id = api_get_current_access_url_id(); |
|
143 | + if ($access_url_id != -1) { |
|
144 | 144 | switch ($type) { |
145 | 145 | case 'single': |
146 | 146 | $sql = 'SELECT user.user_id, username, lastname, firstname |
@@ -178,36 +178,36 @@ discard block |
||
178 | 178 | user.status<>6 '.$cond_user_id. |
179 | 179 | $order_clause; |
180 | 180 | break; |
181 | - } |
|
182 | - } |
|
183 | - } |
|
181 | + } |
|
182 | + } |
|
183 | + } |
|
184 | 184 | |
185 | - $rs = Database::query($sql); |
|
185 | + $rs = Database::query($sql); |
|
186 | 186 | $i=0; |
187 | - if ($type == 'single') { |
|
188 | - while ($user = Database::fetch_array($rs)) { |
|
189 | - $i++; |
|
190 | - if ($i<=10) { |
|
191 | - $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
192 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
|
193 | - } else { |
|
194 | - $return .= '...<br />'; |
|
195 | - } |
|
196 | - } |
|
197 | - |
|
198 | - $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
199 | - } else { |
|
200 | - $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
|
201 | - while ($user = Database :: fetch_array($rs)) { |
|
202 | - $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
203 | - $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
|
204 | - } |
|
205 | - $return .= '</select>'; |
|
206 | - $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
207 | - } |
|
208 | - } |
|
187 | + if ($type == 'single') { |
|
188 | + while ($user = Database::fetch_array($rs)) { |
|
189 | + $i++; |
|
190 | + if ($i<=10) { |
|
191 | + $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
192 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
|
193 | + } else { |
|
194 | + $return .= '...<br />'; |
|
195 | + } |
|
196 | + } |
|
197 | + |
|
198 | + $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
199 | + } else { |
|
200 | + $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
|
201 | + while ($user = Database :: fetch_array($rs)) { |
|
202 | + $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
|
203 | + $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
|
204 | + } |
|
205 | + $return .= '</select>'; |
|
206 | + $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | - return $xajax_response; |
|
210 | + return $xajax_response; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $xajax -> processRequests(); |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($use_extra_fields) { |
349 | 349 | $final_result = array(); |
350 | - if (count($extra_field_result)>1) { |
|
351 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
350 | + if (count($extra_field_result)>1) { |
|
351 | + for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
352 | 352 | if (is_array($extra_field_result[$i+1])) { |
353 | 353 | $final_result = array_intersect( |
354 | 354 | $extra_field_result[$i], |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | 'un' => $user['username'] |
427 | 427 | ); |
428 | 428 | unset($users[$uid]); |
429 | - } |
|
429 | + } |
|
430 | 430 | } |
431 | 431 | unset($users); //clean to free memory |
432 | 432 | |
@@ -471,13 +471,13 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | if ($add_type === 'multiple') { |
474 | - $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
475 | - $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
|
474 | + $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
|
475 | + $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); |
|
476 | 476 | } else { |
477 | - $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
|
478 | - $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
477 | + $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); |
|
478 | + $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
479 | 479 | } |
480 | - $link_add_group = '<a href="usergroups.php">'. |
|
480 | + $link_add_group = '<a href="usergroups.php">'. |
|
481 | 481 | Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>'; |
482 | 482 | ?> |
483 | 483 | <div class="actions"> |
@@ -487,30 +487,30 @@ discard block |
||
487 | 487 | <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?> |
488 | 488 | <?php |
489 | 489 | if ($add_type === 'multiple') { |
490 | - if (is_array($extra_field_list)) { |
|
491 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
492 | - echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
493 | - foreach ($new_field_list as $new_field) { |
|
494 | - echo $new_field['name']; |
|
495 | - $varname = 'field_'.$new_field['variable']; |
|
496 | - echo ' <select name="'.$varname.'">'; |
|
497 | - echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
498 | - foreach ($new_field['data'] as $option) { |
|
499 | - $checked=''; |
|
500 | - if (isset($_POST[$varname])) { |
|
501 | - if ($_POST[$varname] == $option[1]) { |
|
502 | - $checked = 'selected="true"'; |
|
503 | - } |
|
504 | - } |
|
505 | - echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
506 | - } |
|
507 | - echo '</select>'; |
|
508 | - echo ' '; |
|
509 | - } |
|
510 | - echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
511 | - echo '<br /><br />'; |
|
512 | - } |
|
513 | - } |
|
490 | + if (is_array($extra_field_list)) { |
|
491 | + if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
492 | + echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
493 | + foreach ($new_field_list as $new_field) { |
|
494 | + echo $new_field['name']; |
|
495 | + $varname = 'field_'.$new_field['variable']; |
|
496 | + echo ' <select name="'.$varname.'">'; |
|
497 | + echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
498 | + foreach ($new_field['data'] as $option) { |
|
499 | + $checked=''; |
|
500 | + if (isset($_POST[$varname])) { |
|
501 | + if ($_POST[$varname] == $option[1]) { |
|
502 | + $checked = 'selected="true"'; |
|
503 | + } |
|
504 | + } |
|
505 | + echo '<option value="'.$option[1].'" '.$checked.'>'.$option[1].'</option>'; |
|
506 | + } |
|
507 | + echo '</select>'; |
|
508 | + echo ' '; |
|
509 | + } |
|
510 | + echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
511 | + echo '<br /><br />'; |
|
512 | + } |
|
513 | + } |
|
514 | 514 | } |
515 | 515 | ?> |
516 | 516 | <input type="hidden" name="form_sent" value="1" /> |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <div id="content_source"> |
534 | 534 | <?php |
535 | 535 | if (!($add_type == 'multiple')) { |
536 | - ?> |
|
536 | + ?> |
|
537 | 537 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" /> |
538 | 538 | <div id="ajax_list_users_single"></div> |
539 | 539 | <?php |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | <div id="ajax_list_users_multiple"> |
543 | 543 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="span5"> |
544 | 544 | <?php |
545 | - foreach ($nosessionUsersList as $uid => $enreg) { |
|
546 | - ?> |
|
545 | + foreach ($nosessionUsersList as $uid => $enreg) { |
|
546 | + ?> |
|
547 | 547 | <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
548 | 548 | <?php |
549 | - } |
|
550 | - ?> |
|
549 | + } |
|
550 | + ?> |
|
551 | 551 | </select> |
552 | 552 | </div> |
553 | 553 | <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id"> |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | <?php |
556 | 556 | } |
557 | 557 | unset($nosessionUsersList); |
558 | - ?> |
|
558 | + ?> |
|
559 | 559 | </div> |
560 | 560 | </div> |
561 | 561 | |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | <br /> |
583 | 583 | <br /> |
584 | 584 | <?php |
585 | - if (isset($_GET['add'])) { |
|
586 | - echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
585 | + if (isset($_GET['add'])) { |
|
586 | + echo '<button class="btn btn-primary" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
587 | 587 | } else { |
588 | 588 | //@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed) |
589 | - echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
|
589 | + echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
|
590 | 590 | } |
591 | - ?> |
|
591 | + ?> |
|
592 | 592 | </div> |
593 | 593 | <div class="span5"> |
594 | 594 | <div class="multiple_select_header"> |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class CourseSelectForm |
19 | 19 | { |
20 | - /** |
|
21 | - * Display the form |
|
20 | + /** |
|
21 | + * Display the form |
|
22 | 22 | * @param array $course |
23 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
24 | - * @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file |
|
25 | - */ |
|
26 | - public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
23 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
24 | + * @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file |
|
25 | + */ |
|
26 | + public static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
27 | 27 | { |
28 | 28 | global $charset; |
29 | 29 | $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); |
@@ -138,48 +138,48 @@ discard block |
||
138 | 138 | } |
139 | 139 | </script> |
140 | 140 | <?php |
141 | - // get destination course title |
|
142 | - if (!empty($hidden_fields['destination_course'])) { |
|
141 | + // get destination course title |
|
142 | + if (!empty($hidden_fields['destination_course'])) { |
|
143 | 143 | $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name($hidden_fields['destination_session']) . ')' : null; |
144 | 144 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
145 | - echo '<h3>'; |
|
146 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
147 | - echo '</h3>'; |
|
148 | - } |
|
145 | + echo '<h3>'; |
|
146 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
147 | + echo '</h3>'; |
|
148 | + } |
|
149 | 149 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
150 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
150 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
151 | 151 | $icon = Display::returnIconPath('myprogress_bar.gif'); |
152 | 152 | echo '<div class="tool-backups-options">'; |
153 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
154 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
153 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
154 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
155 | 155 | |
156 | - if (!empty($hidden_fields['destination_course']) && |
|
156 | + if (!empty($hidden_fields['destination_course']) && |
|
157 | 157 | !empty($hidden_fields['origin_course']) && |
158 | 158 | !empty($hidden_fields['destination_session']) && |
159 | 159 | !empty($hidden_fields['origin_session']) |
160 | 160 | ) { |
161 | - echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
162 | - echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
163 | - echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
164 | - echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
165 | - } |
|
161 | + echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
162 | + echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
163 | + echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
164 | + echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
165 | + } |
|
166 | 166 | |
167 | - $element_count = 0; |
|
167 | + $element_count = 0; |
|
168 | 168 | $forum_categories = array(); |
169 | 169 | $forums = array(); |
170 | 170 | $forum_topics = array(); |
171 | 171 | |
172 | 172 | echo '<p>'; |
173 | - echo get_lang('SelectResources'); |
|
174 | - echo '</p>'; |
|
173 | + echo get_lang('SelectResources'); |
|
174 | + echo '</p>'; |
|
175 | 175 | |
176 | 176 | Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
177 | 177 | |
178 | 178 | foreach ($course->resources as $type => $resources) { |
179 | 179 | if (count($resources) > 0) { |
180 | - switch ($type) { |
|
181 | - //Resources to avoid |
|
182 | - case RESOURCE_FORUMCATEGORY: |
|
180 | + switch ($type) { |
|
181 | + //Resources to avoid |
|
182 | + case RESOURCE_FORUMCATEGORY: |
|
183 | 183 | foreach ($resources as $id => $resource) { |
184 | 184 | $forum_categories[$id] = $resource; |
185 | 185 | } |
@@ -206,30 +206,30 @@ discard block |
||
206 | 206 | break; |
207 | 207 | default: |
208 | 208 | echo '<div class="item-backup" onclick="javascript:exp('."'$type'".');">'; |
209 | - echo '<em id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" ></em>'; |
|
210 | - echo '<span class="title">'.$resource_titles[$type].'</span></div>'; |
|
211 | - echo '<div class="item-content" id="div_'.$type.'">'; |
|
212 | - if ($type == RESOURCE_LEARNPATH) { |
|
213 | - Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
214 | - Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
215 | - } |
|
216 | - if ($type == RESOURCE_DOCUMENT) { |
|
209 | + echo '<em id="img_'.$type.'" class="fa fa-minus-square-o fa-lg" ></em>'; |
|
210 | + echo '<span class="title">'.$resource_titles[$type].'</span></div>'; |
|
211 | + echo '<div class="item-content" id="div_'.$type.'">'; |
|
212 | + if ($type == RESOURCE_LEARNPATH) { |
|
213 | + Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
214 | + Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
215 | + } |
|
216 | + if ($type == RESOURCE_DOCUMENT) { |
|
217 | 217 | if (api_get_setting('show_glossary_in_documents') != 'none') { |
218 | 218 | Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
219 | 219 | } |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - echo '<div class="well">'; |
|
222 | + echo '<div class="well">'; |
|
223 | 223 | |
224 | 224 | echo '<div class="btn-group">'; |
225 | - echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
225 | + echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
226 | 226 | echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>"; |
227 | - echo '</div>'; |
|
227 | + echo '</div>'; |
|
228 | 228 | echo '<ul class="list-backups-options">'; |
229 | - foreach ($resources as $id => $resource) { |
|
229 | + foreach ($resources as $id => $resource) { |
|
230 | 230 | if ($resource) { |
231 | 231 | echo '<li>'; |
232 | - // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
232 | + // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
233 | 233 | Resource::setClassType($resource); |
234 | 234 | echo '<label class="checkbox">'; |
235 | 235 | echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />'; |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | echo '</label>'; |
238 | 238 | echo '</li>'; |
239 | 239 | } |
240 | - } |
|
240 | + } |
|
241 | 241 | echo '</ul>'; |
242 | - echo '</div>'; |
|
243 | - echo '</div>'; |
|
244 | - echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
245 | - $element_count++; |
|
242 | + echo '</div>'; |
|
243 | + echo '</div>'; |
|
244 | + echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
245 | + $element_count++; |
|
246 | 246 | } |
247 | - } |
|
248 | - } |
|
247 | + } |
|
248 | + } |
|
249 | 249 | |
250 | 250 | //Fixes forum order |
251 | 251 | if (!empty($forum_categories)) { |
@@ -301,66 +301,66 @@ discard block |
||
301 | 301 | echo '<script language="javascript">exp('."'$type'".')</script>'; |
302 | 302 | } |
303 | 303 | |
304 | - if ($avoid_serialize) { |
|
305 | - /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
304 | + if ($avoid_serialize) { |
|
305 | + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
306 | 306 | (when there are directories with hundred/thousand of files) */ |
307 | - // this is a known issue of serialize |
|
308 | - $course->resources['document']= null; |
|
309 | - } |
|
307 | + // this is a known issue of serialize |
|
308 | + $course->resources['document']= null; |
|
309 | + } |
|
310 | 310 | |
311 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
311 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
312 | 312 | |
313 | - if (is_array($hidden_fields)) { |
|
314 | - foreach ($hidden_fields as $key => $value) { |
|
315 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
316 | - } |
|
317 | - } |
|
313 | + if (is_array($hidden_fields)) { |
|
314 | + foreach ($hidden_fields as $key => $value) { |
|
315 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
316 | + } |
|
317 | + } |
|
318 | 318 | |
319 | 319 | $recycleOption = isset($_POST['recycle_option']) ? true : false; |
320 | 320 | |
321 | - if (empty($element_count)) { |
|
322 | - Display::display_warning_message(get_lang('NoDataAvailable')); |
|
323 | - } else { |
|
324 | - if (!empty($hidden_fields['destination_session'])) { |
|
325 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
321 | + if (empty($element_count)) { |
|
322 | + Display::display_warning_message(get_lang('NoDataAvailable')); |
|
323 | + } else { |
|
324 | + if (!empty($hidden_fields['destination_session'])) { |
|
325 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
326 | 326 | get_lang('Ok').'</button>'; |
327 | - } else { |
|
327 | + } else { |
|
328 | 328 | if ($recycleOption) { |
329 | 329 | echo '<br /><button class="save" type="submit">'. |
330 | 330 | get_lang('Ok').'</button>'; |
331 | 331 | } else { |
332 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
332 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
333 | 333 | get_lang('Ok').'</button>'; |
334 | 334 | } |
335 | - } |
|
336 | - } |
|
335 | + } |
|
336 | + } |
|
337 | 337 | |
338 | - CourseSelectForm::display_hidden_quiz_questions($course); |
|
339 | - CourseSelectForm::display_hidden_scorm_directories($course); |
|
340 | - echo '</form>'; |
|
338 | + CourseSelectForm::display_hidden_quiz_questions($course); |
|
339 | + CourseSelectForm::display_hidden_scorm_directories($course); |
|
340 | + echo '</form>'; |
|
341 | 341 | echo '</div>'; |
342 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
343 | - } |
|
342 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
343 | + } |
|
344 | 344 | |
345 | 345 | /** |
346 | 346 | * @param $course |
347 | 347 | */ |
348 | 348 | public static function display_hidden_quiz_questions($course) |
349 | 349 | { |
350 | - if(is_array($course->resources)){ |
|
351 | - foreach ($course->resources as $type => $resources) { |
|
352 | - if (count($resources) > 0) { |
|
353 | - switch ($type) { |
|
354 | - case RESOURCE_QUIZQUESTION: |
|
355 | - foreach ($resources as $id => $resource) { |
|
356 | - echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
357 | - } |
|
358 | - break; |
|
359 | - } |
|
360 | - } |
|
361 | - } |
|
362 | - } |
|
363 | - } |
|
350 | + if(is_array($course->resources)){ |
|
351 | + foreach ($course->resources as $type => $resources) { |
|
352 | + if (count($resources) > 0) { |
|
353 | + switch ($type) { |
|
354 | + case RESOURCE_QUIZQUESTION: |
|
355 | + foreach ($resources as $id => $resource) { |
|
356 | + echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
357 | + } |
|
358 | + break; |
|
359 | + } |
|
360 | + } |
|
361 | + } |
|
362 | + } |
|
363 | + } |
|
364 | 364 | |
365 | 365 | /** |
366 | 366 | * @param $course |
@@ -368,30 +368,30 @@ discard block |
||
368 | 368 | public static function display_hidden_scorm_directories($course) |
369 | 369 | { |
370 | 370 | if (is_array($course->resources)){ |
371 | - foreach ($course->resources as $type => $resources) { |
|
372 | - if (count($resources) > 0) { |
|
373 | - switch($type) { |
|
374 | - case RESOURCE_SCORM: |
|
375 | - foreach ($resources as $id => $resource) { |
|
376 | - echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
377 | - } |
|
378 | - break; |
|
379 | - } |
|
380 | - } |
|
381 | - } |
|
382 | - } |
|
383 | - } |
|
371 | + foreach ($course->resources as $type => $resources) { |
|
372 | + if (count($resources) > 0) { |
|
373 | + switch($type) { |
|
374 | + case RESOURCE_SCORM: |
|
375 | + foreach ($resources as $id => $resource) { |
|
376 | + echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
377 | + } |
|
378 | + break; |
|
379 | + } |
|
380 | + } |
|
381 | + } |
|
382 | + } |
|
383 | + } |
|
384 | 384 | |
385 | - /** |
|
386 | - * Get the posted course |
|
387 | - * @param string $from who calls the function? |
|
385 | + /** |
|
386 | + * Get the posted course |
|
387 | + * @param string $from who calls the function? |
|
388 | 388 | * It can be copy_course, create_backup, import_backup or recycle_course |
389 | 389 | * @param int $session_id |
390 | 390 | * @param string $course_code |
391 | - * @return course The course-object with all resources selected by the user |
|
392 | - * in the form given by display_form(...) |
|
393 | - */ |
|
394 | - public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
391 | + * @return course The course-object with all resources selected by the user |
|
392 | + * in the form given by display_form(...) |
|
393 | + */ |
|
394 | + public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
395 | 395 | { |
396 | 396 | $course = null; |
397 | 397 | |
@@ -401,30 +401,30 @@ discard block |
||
401 | 401 | return false; |
402 | 402 | } |
403 | 403 | |
404 | - // Create the resource DOCUMENT objects |
|
405 | - // Loading the results from the checkboxes of ethe javascript |
|
406 | - $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
404 | + // Create the resource DOCUMENT objects |
|
405 | + // Loading the results from the checkboxes of ethe javascript |
|
406 | + $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
407 | 407 | |
408 | - $course_info = api_get_course_info($course_code); |
|
409 | - $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
410 | - $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
411 | - $course_id = $course_info['real_id']; |
|
408 | + $course_info = api_get_course_info($course_code); |
|
409 | + $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
410 | + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
411 | + $course_id = $course_info['real_id']; |
|
412 | 412 | |
413 | - /* Searching the documents resource that have been set to null because |
|
413 | + /* Searching the documents resource that have been set to null because |
|
414 | 414 | $avoid_serialize is true in the display_form() function*/ |
415 | - if ($from === 'copy_course') { |
|
416 | - if (is_array($resource)) { |
|
417 | - $resource = array_keys($resource); |
|
415 | + if ($from === 'copy_course') { |
|
416 | + if (is_array($resource)) { |
|
417 | + $resource = array_keys($resource); |
|
418 | 418 | |
419 | - foreach ($resource as $resource_item) { |
|
419 | + foreach ($resource as $resource_item) { |
|
420 | 420 | |
421 | - $condition_session = ''; |
|
422 | - if (!empty($session_id)) { |
|
423 | - $session_id = intval($session_id); |
|
424 | - $condition_session = ' AND d.session_id ='.$session_id; |
|
425 | - } |
|
421 | + $condition_session = ''; |
|
422 | + if (!empty($session_id)) { |
|
423 | + $session_id = intval($session_id); |
|
424 | + $condition_session = ' AND d.session_id ='.$session_id; |
|
425 | + } |
|
426 | 426 | |
427 | - $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
427 | + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
428 | 428 | FROM '.$table_doc.' d, '.$table_prop.' p |
429 | 429 | WHERE |
430 | 430 | d.c_id = '.$course_id.' AND |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | p.ref = d.id AND p.visibility != 2 AND |
434 | 434 | d.id = '.$resource_item.$condition_session.' |
435 | 435 | ORDER BY path'; |
436 | - $db_result = Database::query($sql); |
|
437 | - while ($obj = Database::fetch_object($db_result)) { |
|
436 | + $db_result = Database::query($sql); |
|
437 | + while ($obj = Database::fetch_object($db_result)) { |
|
438 | 438 | $doc = new Document( |
439 | 439 | $obj->id, |
440 | 440 | $obj->path, |
@@ -458,25 +458,25 @@ discard block |
||
458 | 458 | } |
459 | 459 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
460 | 460 | } |
461 | - } |
|
462 | - } |
|
463 | - } |
|
464 | - } |
|
461 | + } |
|
462 | + } |
|
463 | + } |
|
464 | + } |
|
465 | 465 | |
466 | - if (is_array($course->resources)) { |
|
467 | - foreach ($course->resources as $type => $resources) { |
|
466 | + if (is_array($course->resources)) { |
|
467 | + foreach ($course->resources as $type => $resources) { |
|
468 | 468 | |
469 | - switch ($type) { |
|
470 | - case RESOURCE_SURVEYQUESTION: |
|
471 | - foreach($resources as $id => $obj) { |
|
472 | - if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
469 | + switch ($type) { |
|
470 | + case RESOURCE_SURVEYQUESTION: |
|
471 | + foreach($resources as $id => $obj) { |
|
472 | + if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
473 | 473 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
474 | 474 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
475 | 475 | ) { |
476 | - unset($course->resources[$type][$id]); |
|
477 | - } |
|
478 | - } |
|
479 | - break; |
|
476 | + unset($course->resources[$type][$id]); |
|
477 | + } |
|
478 | + } |
|
479 | + break; |
|
480 | 480 | case RESOURCE_FORUMTOPIC: |
481 | 481 | case RESOURCE_FORUMPOST: |
482 | 482 | //Add post from topic |
@@ -528,63 +528,63 @@ discard block |
||
528 | 528 | } |
529 | 529 | } |
530 | 530 | } |
531 | - case RESOURCE_LINKCATEGORY: |
|
532 | - case RESOURCE_FORUMCATEGORY: |
|
533 | - case RESOURCE_QUIZQUESTION: |
|
534 | - case RESOURCE_DOCUMENT: |
|
535 | - // Mark folders to import which are not selected by the user to import, |
|
536 | - // but in which a document was selected. |
|
537 | - $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
538 | - if (!empty($resources) && is_array($resources)) |
|
539 | - foreach ($resources as $id => $obj) { |
|
540 | - if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
531 | + case RESOURCE_LINKCATEGORY: |
|
532 | + case RESOURCE_FORUMCATEGORY: |
|
533 | + case RESOURCE_QUIZQUESTION: |
|
534 | + case RESOURCE_DOCUMENT: |
|
535 | + // Mark folders to import which are not selected by the user to import, |
|
536 | + // but in which a document was selected. |
|
537 | + $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
538 | + if (!empty($resources) && is_array($resources)) |
|
539 | + foreach ($resources as $id => $obj) { |
|
540 | + if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
541 | 541 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
542 | 542 | is_array($documents) |
543 | 543 | ) { |
544 | - foreach ($documents as $id_to_check => $post_value) { |
|
545 | - $obj_to_check = $resources[$id_to_check]; |
|
546 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
547 | - if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
548 | - $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
549 | - break; |
|
550 | - } |
|
551 | - } |
|
552 | - } |
|
553 | - } |
|
554 | - default : |
|
555 | - if (!empty($resources) && is_array($resources)) { |
|
556 | - foreach ($resources as $id => $obj) { |
|
557 | - $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
558 | - // check if document is in a quiz (audio/video) |
|
559 | - if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
560 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
544 | + foreach ($documents as $id_to_check => $post_value) { |
|
545 | + $obj_to_check = $resources[$id_to_check]; |
|
546 | + $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
547 | + if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
548 | + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
549 | + break; |
|
550 | + } |
|
551 | + } |
|
552 | + } |
|
553 | + } |
|
554 | + default : |
|
555 | + if (!empty($resources) && is_array($resources)) { |
|
556 | + foreach ($resources as $id => $obj) { |
|
557 | + $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
558 | + // check if document is in a quiz (audio/video) |
|
559 | + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
560 | + foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
561 | 561 | $quiz = $quiz->obj; |
562 | - if (isset($quiz->media) && $quiz->media == $id) { |
|
563 | - $resource_is_used_elsewhere = true; |
|
564 | - } |
|
565 | - } |
|
566 | - } |
|
567 | - if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
568 | - unset($course->resources[$type][$id]); |
|
569 | - } |
|
570 | - } |
|
571 | - } |
|
572 | - } |
|
573 | - } |
|
574 | - } |
|
562 | + if (isset($quiz->media) && $quiz->media == $id) { |
|
563 | + $resource_is_used_elsewhere = true; |
|
564 | + } |
|
565 | + } |
|
566 | + } |
|
567 | + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
568 | + unset($course->resources[$type][$id]); |
|
569 | + } |
|
570 | + } |
|
571 | + } |
|
572 | + } |
|
573 | + } |
|
574 | + } |
|
575 | 575 | |
576 | - return $course; |
|
577 | - } |
|
576 | + return $course; |
|
577 | + } |
|
578 | 578 | |
579 | - /** |
|
580 | - * Display the form session export |
|
579 | + /** |
|
580 | + * Display the form session export |
|
581 | 581 | * @param array $list_course |
582 | - * @param array $hidden_fields Hidden fields to add to the form. |
|
582 | + * @param array $hidden_fields Hidden fields to add to the form. |
|
583 | 583 | * @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file |
584 | - */ |
|
585 | - public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
586 | - { |
|
587 | - ?> |
|
584 | + */ |
|
585 | + public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
586 | + { |
|
587 | + ?> |
|
588 | 588 | <script> |
589 | 589 | function exp(item) { |
590 | 590 | el = document.getElementById('div_'+item); |
@@ -626,68 +626,68 @@ discard block |
||
626 | 626 | </script> |
627 | 627 | <?php |
628 | 628 | |
629 | - //get destination course title |
|
630 | - if(!empty($hidden_fields['destination_course'])) { |
|
631 | - if (!empty($hidden_fields['destination_session'])) { |
|
632 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
633 | - } else { |
|
634 | - $sessionTitle = null; |
|
635 | - } |
|
629 | + //get destination course title |
|
630 | + if(!empty($hidden_fields['destination_course'])) { |
|
631 | + if (!empty($hidden_fields['destination_session'])) { |
|
632 | + $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
633 | + } else { |
|
634 | + $sessionTitle = null; |
|
635 | + } |
|
636 | 636 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
637 | - echo '<h3>'; |
|
638 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
639 | - echo '</h3>'; |
|
640 | - } |
|
637 | + echo '<h3>'; |
|
638 | + echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
639 | + echo '</h3>'; |
|
640 | + } |
|
641 | 641 | |
642 | - echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
643 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
642 | + echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
643 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
644 | 644 | $icon = Display::returnIconPath('progress_bar.gif'); |
645 | 645 | echo '<div class="tool-backups-options">'; |
646 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
647 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
648 | - foreach ($list_course as $course) { |
|
649 | - foreach ($course->resources as $type => $resources) { |
|
650 | - if (count($resources) > 0) { |
|
646 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
647 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
648 | + foreach ($list_course as $course) { |
|
649 | + foreach ($course->resources as $type => $resources) { |
|
650 | + if (count($resources) > 0) { |
|
651 | 651 | echo '<div class="item-backup" onclick="javascript:exp('."'$course->code'".');">'; |
652 | - echo '<em id="img_'.$course->code.'" class="fa fa-minus-square-o fa-lg"></em>'; |
|
653 | - echo '<span class="title"> '.$course->code.'</span></div>'; |
|
654 | - echo '<div class="item-content" id="div_'.$course->code.'">'; |
|
655 | - echo '<blockquote>'; |
|
652 | + echo '<em id="img_'.$course->code.'" class="fa fa-minus-square-o fa-lg"></em>'; |
|
653 | + echo '<span class="title"> '.$course->code.'</span></div>'; |
|
654 | + echo '<div class="item-content" id="div_'.$course->code.'">'; |
|
655 | + echo '<blockquote>'; |
|
656 | 656 | |
657 | 657 | echo '<div class="btn-group">'; |
658 | - echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
658 | + echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
659 | 659 | echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>"; |
660 | - echo '</div>'; |
|
660 | + echo '</div>'; |
|
661 | 661 | |
662 | - foreach ($resources as $id => $resource) { |
|
663 | - echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
662 | + foreach ($resources as $id => $resource) { |
|
663 | + echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
664 | 664 | echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>'; |
665 | - $resource->show(); |
|
666 | - echo '</label>'; |
|
667 | - } |
|
668 | - echo '</blockquote>'; |
|
669 | - echo '</div>'; |
|
670 | - echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
671 | - } |
|
672 | - } |
|
673 | - } |
|
674 | - if ($avoid_serialize) { |
|
675 | - //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
676 | - // this is a known issue of serialize |
|
677 | - $course->resources['document']= null; |
|
678 | - } |
|
679 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
680 | - if (is_array($hidden_fields)) { |
|
681 | - foreach ($hidden_fields as $key => $value) { |
|
682 | - echo "\n"; |
|
683 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
684 | - } |
|
685 | - } |
|
686 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
687 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
688 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
689 | - echo '</form>'; |
|
665 | + $resource->show(); |
|
666 | + echo '</label>'; |
|
667 | + } |
|
668 | + echo '</blockquote>'; |
|
669 | + echo '</div>'; |
|
670 | + echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
671 | + } |
|
672 | + } |
|
673 | + } |
|
674 | + if ($avoid_serialize) { |
|
675 | + //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
676 | + // this is a known issue of serialize |
|
677 | + $course->resources['document']= null; |
|
678 | + } |
|
679 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
680 | + if (is_array($hidden_fields)) { |
|
681 | + foreach ($hidden_fields as $key => $value) { |
|
682 | + echo "\n"; |
|
683 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
684 | + } |
|
685 | + } |
|
686 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
687 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
688 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
689 | + echo '</form>'; |
|
690 | 690 | echo '</div>'; |
691 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
692 | - } |
|
691 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
692 | + } |
|
693 | 693 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | //user has submitted a file |
49 | 49 | if (isset($_FILES['user_upload'])) { |
50 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
51 | - if ($upload_ok) { |
|
52 | - //file got on the server without problems, now process it |
|
50 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
51 | + if ($upload_ok) { |
|
52 | + //file got on the server without problems, now process it |
|
53 | 53 | $new_path = handle_uploaded_document( |
54 | 54 | $_course, |
55 | 55 | $_FILES['user_upload'], |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | $_POST['unzip'], |
62 | 62 | $_POST['if_exists'] |
63 | 63 | ); |
64 | - $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
65 | - $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
64 | + $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
|
65 | + $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
|
66 | 66 | |
67 | - if ($new_path && ($new_comment || $new_title)) |
|
68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | - $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
70 | - $ct = ''; |
|
67 | + if ($new_path && ($new_comment || $new_title)) |
|
68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | + $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
70 | + $ct = ''; |
|
71 | 71 | if ($new_comment) { |
72 | 72 | $ct .= ", comment='$new_comment'"; |
73 | 73 | } |
74 | 74 | if ($new_title) { |
75 | 75 | $ct .= ", title='$new_title'"; |
76 | 76 | } |
77 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
78 | - } |
|
77 | + Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
78 | + } |
|
79 | 79 | //check for missing images in html files |
80 | 80 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
81 | 81 | if ($missing_files) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | //they want to create a directory |
134 | 134 | if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
135 | 135 | $added_slash = $path == '/' ? '' : '/'; |
136 | - $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
136 | + $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
137 | 137 | $created_dir = create_unexisting_directory( |
138 | 138 | $_course, |
139 | 139 | api_get_user_id(), |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | if (isset($_GET['createdir'])) { |
156 | - //create the form that asks for the directory name |
|
157 | - $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
158 | - $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
159 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
160 | - $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
161 | - $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
162 | - $new_folder_text .= '</form>'; |
|
163 | - //show the form |
|
164 | - Display::display_normal_message($new_folder_text); |
|
156 | + //create the form that asks for the directory name |
|
157 | + $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
158 | + $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
159 | + $new_folder_text .= get_lang('NewDir') .' '; |
|
160 | + $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
161 | + $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
162 | + $new_folder_text .= '</form>'; |
|
163 | + //show the form |
|
164 | + Display::display_normal_message($new_folder_text); |
|
165 | 165 | } else { //give them a link to create a directory |
166 | 166 | ?> |
167 | 167 | <p> |
@@ -12,31 +12,31 @@ discard block |
||
12 | 12 | **/ |
13 | 13 | class HotSpot extends Question |
14 | 14 | { |
15 | - public static $typePicture = 'hotspot.png'; |
|
16 | - public static $explanationLangVar = 'HotSpot'; |
|
15 | + public static $typePicture = 'hotspot.png'; |
|
16 | + public static $explanationLangVar = 'HotSpot'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * HotSpot constructor. |
20 | 20 | */ |
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(); |
|
24 | - $this->type = HOT_SPOT; |
|
25 | - } |
|
26 | - |
|
27 | - public function display() |
|
28 | - { |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * @param FormValidator $form |
|
33 | - * @param int $fck_config |
|
34 | - */ |
|
35 | - public function createForm (&$form, $fck_config=0) |
|
36 | - { |
|
37 | - parent::createForm($form, $fck_config); |
|
38 | - |
|
39 | - if (!isset($_GET['editQuestion'])) { |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + $this->type = HOT_SPOT; |
|
25 | + } |
|
26 | + |
|
27 | + public function display() |
|
28 | + { |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * @param FormValidator $form |
|
33 | + * @param int $fck_config |
|
34 | + */ |
|
35 | + public function createForm (&$form, $fck_config=0) |
|
36 | + { |
|
37 | + parent::createForm($form, $fck_config); |
|
38 | + |
|
39 | + if (!isset($_GET['editQuestion'])) { |
|
40 | 40 | $form->addElement( |
41 | 41 | 'file', |
42 | 42 | 'imageUpload', |
@@ -46,54 +46,54 @@ discard block |
||
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | |
49 | - // setting the save button here and not in the question class.php |
|
50 | - // Saving a question |
|
51 | - $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
52 | - //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
53 | - $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
54 | - $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
55 | - } else { |
|
56 | - // setting the save button here and not in the question class.php |
|
57 | - // Editing a question |
|
58 | - $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @param FormValidator $form |
|
64 | - * @param null $objExercise |
|
65 | - * @return null|false |
|
66 | - */ |
|
67 | - public function processCreation($form, $objExercise = null) |
|
68 | - { |
|
69 | - $file_info = $form->getSubmitValue('imageUpload'); |
|
70 | - $_course = api_get_course_info(); |
|
71 | - parent::processCreation($form, $objExercise); |
|
72 | - |
|
73 | - if(!empty($file_info['tmp_name'])) { |
|
74 | - $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
75 | - $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
76 | - $picturePath = $documentPath.'/images'; |
|
77 | - |
|
78 | - // fixed width ang height |
|
79 | - if (file_exists($picturePath.'/'.$this->picture)) { |
|
80 | - $this->resizePicture('width', 800); |
|
81 | - $this->save(); |
|
82 | - } else { |
|
83 | - return false; |
|
84 | - } |
|
85 | - } |
|
86 | - } |
|
87 | - |
|
88 | - function createAnswersForm($form) |
|
89 | - { |
|
90 | - // nothing |
|
91 | - } |
|
92 | - |
|
93 | - function processAnswersCreation($form) |
|
94 | - { |
|
95 | - // nothing |
|
96 | - } |
|
49 | + // setting the save button here and not in the question class.php |
|
50 | + // Saving a question |
|
51 | + $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
52 | + //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion'); |
|
53 | + $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); |
|
54 | + $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile'); |
|
55 | + } else { |
|
56 | + // setting the save button here and not in the question class.php |
|
57 | + // Editing a question |
|
58 | + $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion'); |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @param FormValidator $form |
|
64 | + * @param null $objExercise |
|
65 | + * @return null|false |
|
66 | + */ |
|
67 | + public function processCreation($form, $objExercise = null) |
|
68 | + { |
|
69 | + $file_info = $form->getSubmitValue('imageUpload'); |
|
70 | + $_course = api_get_course_info(); |
|
71 | + parent::processCreation($form, $objExercise); |
|
72 | + |
|
73 | + if(!empty($file_info['tmp_name'])) { |
|
74 | + $this->uploadPicture($file_info['tmp_name'], $file_info['name']); |
|
75 | + $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
76 | + $picturePath = $documentPath.'/images'; |
|
77 | + |
|
78 | + // fixed width ang height |
|
79 | + if (file_exists($picturePath.'/'.$this->picture)) { |
|
80 | + $this->resizePicture('width', 800); |
|
81 | + $this->save(); |
|
82 | + } else { |
|
83 | + return false; |
|
84 | + } |
|
85 | + } |
|
86 | + } |
|
87 | + |
|
88 | + function createAnswersForm($form) |
|
89 | + { |
|
90 | + // nothing |
|
91 | + } |
|
92 | + |
|
93 | + function processAnswersCreation($form) |
|
94 | + { |
|
95 | + // nothing |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,38 +101,38 @@ discard block |
||
101 | 101 | */ |
102 | 102 | class HotSpotDelineation extends HotSpot |
103 | 103 | { |
104 | - public static $typePicture = 'hotspot-delineation.png'; |
|
105 | - public static $explanationLangVar = 'HotspotDelineation'; |
|
104 | + public static $typePicture = 'hotspot-delineation.png'; |
|
105 | + public static $explanationLangVar = 'HotspotDelineation'; |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * HotSpotDelineation constructor. |
109 | 109 | */ |
110 | - public function __construct() |
|
111 | - { |
|
112 | - parent::__construct(); |
|
113 | - $this -> type = HOT_SPOT_DELINEATION; |
|
114 | - |
|
115 | - } |
|
116 | - |
|
117 | - function createForm(&$form, $fck_config=0) |
|
118 | - { |
|
119 | - parent::createForm ($form, $fck_config); |
|
120 | - } |
|
121 | - |
|
122 | - function processCreation ($form, $objExercise = null) |
|
123 | - { |
|
124 | - $file_info = $form -> getSubmitValue('imageUpload'); |
|
125 | - parent::processCreation ($form, $objExercise); |
|
126 | - } |
|
127 | - |
|
128 | - function createAnswersForm ($form) |
|
129 | - { |
|
130 | - parent::createAnswersForm ($form); |
|
131 | - } |
|
132 | - |
|
133 | - function processAnswersCreation ($form) |
|
134 | - { |
|
135 | - parent::processAnswersCreation ($form); |
|
136 | - } |
|
110 | + public function __construct() |
|
111 | + { |
|
112 | + parent::__construct(); |
|
113 | + $this -> type = HOT_SPOT_DELINEATION; |
|
114 | + |
|
115 | + } |
|
116 | + |
|
117 | + function createForm(&$form, $fck_config=0) |
|
118 | + { |
|
119 | + parent::createForm ($form, $fck_config); |
|
120 | + } |
|
121 | + |
|
122 | + function processCreation ($form, $objExercise = null) |
|
123 | + { |
|
124 | + $file_info = $form -> getSubmitValue('imageUpload'); |
|
125 | + parent::processCreation ($form, $objExercise); |
|
126 | + } |
|
127 | + |
|
128 | + function createAnswersForm ($form) |
|
129 | + { |
|
130 | + parent::createAnswersForm ($form); |
|
131 | + } |
|
132 | + |
|
133 | + function processAnswersCreation ($form) |
|
134 | + { |
|
135 | + parent::processAnswersCreation ($form); |
|
136 | + } |
|
137 | 137 | } |
138 | 138 |
@@ -6,7 +6,6 @@ discard block |
||
6 | 6 | * |
7 | 7 | * Contains several functions dealing with displaying, |
8 | 8 | * editing,... of a blog |
9 | - |
|
10 | 9 | * @package chamilo.blogs |
11 | 10 | * @author Toon Keppens <[email protected]> |
12 | 11 | * @author Julio Montoya - Cleaning code |
@@ -333,7 +332,7 @@ discard block |
||
333 | 332 | // Storing the attachments if any |
334 | 333 | if ($result) { |
335 | 334 | $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '. |
336 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
335 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
337 | 336 | Database::query($sql); |
338 | 337 | $id = Database::insert_id(); |
339 | 338 | if ($id) { |
@@ -470,7 +469,7 @@ discard block |
||
470 | 469 | // Storing the attachments if any |
471 | 470 | if ($result) { |
472 | 471 | $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
473 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
472 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
474 | 473 | Database::query($sql); |
475 | 474 | |
476 | 475 | $id = Database::insert_id(); |
@@ -1389,10 +1388,10 @@ discard block |
||
1389 | 1388 | echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
1390 | 1389 | echo "<table class=\"data_table\">"; |
1391 | 1390 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1392 | - "<th width='240'><b>",get_lang('Title'),"</b></th>", |
|
1393 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1394 | - "<th><b>",get_lang('Color'),"</b></th>", |
|
1395 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1391 | + "<th width='240'><b>",get_lang('Title'),"</b></th>", |
|
1392 | + "<th><b>",get_lang('Description'),"</b></th>", |
|
1393 | + "<th><b>",get_lang('Color'),"</b></th>", |
|
1394 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1396 | 1395 | "</tr>"; |
1397 | 1396 | |
1398 | 1397 | |
@@ -1424,14 +1423,14 @@ discard block |
||
1424 | 1423 | echo '<td width="50">'; |
1425 | 1424 | echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">'; |
1426 | 1425 | echo Display::return_icon('edit.png', get_lang('EditTask')); |
1427 | - echo "</a>"; |
|
1428 | - echo '<a href="'.$delete_link.'"'; |
|
1429 | - echo $delete_confirm; |
|
1430 | - echo '>'; |
|
1426 | + echo "</a>"; |
|
1427 | + echo '<a href="'.$delete_link.'"'; |
|
1428 | + echo $delete_confirm; |
|
1429 | + echo '>'; |
|
1431 | 1430 | echo Display::return_icon($delete_icon, $delete_title); |
1432 | - echo "</a>"; |
|
1433 | - echo '</td>'; |
|
1434 | - echo '</tr>'; |
|
1431 | + echo "</a>"; |
|
1432 | + echo '</td>'; |
|
1433 | + echo '</tr>'; |
|
1435 | 1434 | } |
1436 | 1435 | echo "</table>"; |
1437 | 1436 | } |
@@ -1455,11 +1454,11 @@ discard block |
||
1455 | 1454 | echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
1456 | 1455 | echo "<table class=\"data_table\">"; |
1457 | 1456 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
1458 | - "<th width='240'><b>",get_lang('Member'),"</b></th>", |
|
1459 | - "<th><b>",get_lang('Task'),"</b></th>", |
|
1460 | - "<th><b>",get_lang('Description'),"</b></th>", |
|
1461 | - "<th><b>",get_lang('TargetDate'),"</b></th>", |
|
1462 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1457 | + "<th width='240'><b>",get_lang('Member'),"</b></th>", |
|
1458 | + "<th><b>",get_lang('Task'),"</b></th>", |
|
1459 | + "<th><b>",get_lang('Description'),"</b></th>", |
|
1460 | + "<th><b>",get_lang('TargetDate'),"</b></th>", |
|
1461 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>", |
|
1463 | 1462 | "</tr>"; |
1464 | 1463 | |
1465 | 1464 | $course_id = api_get_course_int_id(); |
@@ -2307,7 +2306,7 @@ discard block |
||
2307 | 2306 | * @param Integer $year: the 4-digit year indication e.g. 2005 |
2308 | 2307 | * |
2309 | 2308 | * @return html code |
2310 | - */ |
|
2309 | + */ |
|
2311 | 2310 | public static function display_minimonthcalendar($month, $year, $blog_id) |
2312 | 2311 | { |
2313 | 2312 | // Init |
@@ -2600,34 +2599,34 @@ discard block |
||
2600 | 2599 | */ |
2601 | 2600 | function get_blog_attachment($blog_id, $post_id=null,$comment_id=null) |
2602 | 2601 | { |
2603 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2604 | - |
|
2605 | - $blog_id = intval($blog_id); |
|
2606 | - $comment_id = intval($comment_id); |
|
2607 | - $post_id = intval($post_id); |
|
2608 | - $row=array(); |
|
2609 | - $where=''; |
|
2610 | - if (!empty ($post_id) && is_numeric($post_id)) { |
|
2611 | - $where.=' AND post_id ="'.$post_id.'" '; |
|
2612 | - } |
|
2613 | - |
|
2614 | - if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
2615 | - if (!empty ($post_id)) { |
|
2616 | - $where.= ' AND '; |
|
2617 | - } |
|
2618 | - $where.=' comment_id ="'.$comment_id.'" '; |
|
2619 | - } |
|
2602 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2603 | + |
|
2604 | + $blog_id = intval($blog_id); |
|
2605 | + $comment_id = intval($comment_id); |
|
2606 | + $post_id = intval($post_id); |
|
2607 | + $row=array(); |
|
2608 | + $where=''; |
|
2609 | + if (!empty ($post_id) && is_numeric($post_id)) { |
|
2610 | + $where.=' AND post_id ="'.$post_id.'" '; |
|
2611 | + } |
|
2612 | + |
|
2613 | + if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
2614 | + if (!empty ($post_id)) { |
|
2615 | + $where.= ' AND '; |
|
2616 | + } |
|
2617 | + $where.=' comment_id ="'.$comment_id.'" '; |
|
2618 | + } |
|
2620 | 2619 | |
2621 | 2620 | $course_id = api_get_course_int_id(); |
2622 | 2621 | |
2623 | - $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
2622 | + $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
2624 | 2623 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2625 | 2624 | |
2626 | - $result=Database::query($sql); |
|
2627 | - if (Database::num_rows($result)!=0) { |
|
2628 | - $row=Database::fetch_array($result); |
|
2629 | - } |
|
2630 | - return $row; |
|
2625 | + $result=Database::query($sql); |
|
2626 | + if (Database::num_rows($result)!=0) { |
|
2627 | + $row=Database::fetch_array($result); |
|
2628 | + } |
|
2629 | + return $row; |
|
2631 | 2630 | } |
2632 | 2631 | |
2633 | 2632 | /** |
@@ -2644,16 +2643,16 @@ discard block |
||
2644 | 2643 | |
2645 | 2644 | function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null) |
2646 | 2645 | { |
2647 | - $_course = api_get_course_info(); |
|
2648 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2649 | - $blog_id = intval($blog_id); |
|
2650 | - $comment_id = intval($comment_id); |
|
2651 | - $post_id = intval($post_id); |
|
2646 | + $_course = api_get_course_info(); |
|
2647 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
2648 | + $blog_id = intval($blog_id); |
|
2649 | + $comment_id = intval($comment_id); |
|
2650 | + $post_id = intval($post_id); |
|
2652 | 2651 | |
2653 | 2652 | $course_id = api_get_course_int_id(); |
2654 | - $where = null; |
|
2653 | + $where = null; |
|
2655 | 2654 | |
2656 | - // delete files in DB |
|
2655 | + // delete files in DB |
|
2657 | 2656 | if (!empty ($post_id) && is_numeric($post_id)) { |
2658 | 2657 | $where .= ' AND post_id ="'.$post_id.'" '; |
2659 | 2658 | } |
@@ -2665,25 +2664,25 @@ discard block |
||
2665 | 2664 | $where .= ' comment_id ="'.$comment_id.'" '; |
2666 | 2665 | } |
2667 | 2666 | |
2668 | - // delete all files in directory |
|
2669 | - $courseDir = $_course['path'].'/upload/blog'; |
|
2670 | - $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
2671 | - $updir = $sys_course_path.$courseDir; |
|
2667 | + // delete all files in directory |
|
2668 | + $courseDir = $_course['path'].'/upload/blog'; |
|
2669 | + $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
2670 | + $updir = $sys_course_path.$courseDir; |
|
2672 | 2671 | |
2673 | - $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
2672 | + $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
2674 | 2673 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2675 | - $result=Database::query($sql); |
|
2676 | - |
|
2677 | - while ($row=Database::fetch_row($result)) { |
|
2678 | - $file=$updir.'/'.$row[0]; |
|
2679 | - if (Security::check_abs_path($file,$updir) ) |
|
2680 | - { |
|
2681 | - @ unlink($file); |
|
2682 | - } |
|
2683 | - } |
|
2684 | - $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
2674 | + $result=Database::query($sql); |
|
2675 | + |
|
2676 | + while ($row=Database::fetch_row($result)) { |
|
2677 | + $file=$updir.'/'.$row[0]; |
|
2678 | + if (Security::check_abs_path($file,$updir) ) |
|
2679 | + { |
|
2680 | + @ unlink($file); |
|
2681 | + } |
|
2682 | + } |
|
2683 | + $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
2685 | 2684 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
2686 | - Database::query($sql); |
|
2685 | + Database::query($sql); |
|
2687 | 2686 | } |
2688 | 2687 | |
2689 | 2688 | /** |
@@ -2693,12 +2692,12 @@ discard block |
||
2693 | 2692 | */ |
2694 | 2693 | function get_blog_post_from_user($course_code, $user_id) |
2695 | 2694 | { |
2696 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
2697 | - $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
2698 | - $course_info = api_get_course_info($course_code); |
|
2699 | - $course_id = $course_info['real_id']; |
|
2695 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
2696 | + $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
2697 | + $course_info = api_get_course_info($course_code); |
|
2698 | + $course_id = $course_info['real_id']; |
|
2700 | 2699 | |
2701 | - $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
2700 | + $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
2702 | 2701 | FROM $tbl_blogs blog |
2703 | 2702 | INNER JOIN $tbl_blog_post post |
2704 | 2703 | ON (blog.blog_id = post.blog_id) |
@@ -2707,19 +2706,19 @@ discard block |
||
2707 | 2706 | post.c_id = $course_id AND |
2708 | 2707 | author_id = $user_id AND visibility = 1 |
2709 | 2708 | ORDER BY post.date_creation DESC "; |
2710 | - $result = Database::query($sql); |
|
2711 | - $return_data = ''; |
|
2712 | - |
|
2713 | - if (Database::num_rows($result)!=0) { |
|
2714 | - while ($row=Database::fetch_array($result)) { |
|
2715 | - $return_data.= '<div class="clear"></div><br />'; |
|
2716 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2717 | - $return_data.= '<br / >'; |
|
2718 | - $return_data.= $row['full_text']; |
|
2719 | - $return_data.= '<br /><br />'; |
|
2720 | - } |
|
2721 | - } |
|
2722 | - return $return_data; |
|
2709 | + $result = Database::query($sql); |
|
2710 | + $return_data = ''; |
|
2711 | + |
|
2712 | + if (Database::num_rows($result)!=0) { |
|
2713 | + while ($row=Database::fetch_array($result)) { |
|
2714 | + $return_data.= '<div class="clear"></div><br />'; |
|
2715 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2716 | + $return_data.= '<br / >'; |
|
2717 | + $return_data.= $row['full_text']; |
|
2718 | + $return_data.= '<br /><br />'; |
|
2719 | + } |
|
2720 | + } |
|
2721 | + return $return_data; |
|
2723 | 2722 | } |
2724 | 2723 | |
2725 | 2724 | /** |
@@ -2736,7 +2735,7 @@ discard block |
||
2736 | 2735 | $course_info = api_get_course_info($course_code); |
2737 | 2736 | $course_id = $course_info['real_id']; |
2738 | 2737 | |
2739 | - $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
2738 | + $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
2740 | 2739 | FROM $tbl_blogs blog INNER JOIN $tbl_blog_comment comment |
2741 | 2740 | ON (blog.blog_id = comment.blog_id) |
2742 | 2741 | WHERE blog.c_id = $course_id AND |
@@ -2744,18 +2743,18 @@ discard block |
||
2744 | 2743 | author_id = $user_id AND |
2745 | 2744 | visibility = 1 |
2746 | 2745 | ORDER BY blog_name"; |
2747 | - $result = Database::query($sql); |
|
2748 | - $return_data = ''; |
|
2749 | - if (Database::num_rows($result)!=0) { |
|
2750 | - while ($row=Database::fetch_array($result)) { |
|
2751 | - $return_data.= '<div class="clear"></div><br />'; |
|
2752 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2753 | - $return_data.= '<br / >'; |
|
2754 | - //$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';*/ |
|
2755 | - $return_data.= $row['comment']; |
|
2756 | - $return_data.= '<br />'; |
|
2757 | - } |
|
2758 | - } |
|
2759 | - return $return_data; |
|
2746 | + $result = Database::query($sql); |
|
2747 | + $return_data = ''; |
|
2748 | + if (Database::num_rows($result)!=0) { |
|
2749 | + while ($row=Database::fetch_array($result)) { |
|
2750 | + $return_data.= '<div class="clear"></div><br />'; |
|
2751 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
2752 | + $return_data.= '<br / >'; |
|
2753 | + //$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';*/ |
|
2754 | + $return_data.= $row['comment']; |
|
2755 | + $return_data.= '<br />'; |
|
2756 | + } |
|
2757 | + } |
|
2758 | + return $return_data; |
|
2760 | 2759 | } |
2761 | 2760 |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Displays the title + grid |
53 | 53 | */ |
54 | - public function display() |
|
54 | + public function display() |
|
55 | 55 | { |
56 | - // action links |
|
57 | - echo '<div class="actions" style="margin-bottom:20px">'; |
|
56 | + // action links |
|
57 | + echo '<div class="actions" style="margin-bottom:20px">'; |
|
58 | 58 | echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>'; |
59 | - echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
60 | - echo '</div>'; |
|
59 | + echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
60 | + echo '</div>'; |
|
61 | 61 | echo Display::grid_html('grade_model'); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Returns a Form validator Obj |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | $form->addElement('hidden', 'maxvalue', '100'); |
120 | - $form->addElement('hidden', 'minvalue', '0'); |
|
120 | + $form->addElement('hidden', 'minvalue', '0'); |
|
121 | 121 | $renderer = & $form->defaultRenderer(); |
122 | 122 | |
123 | 123 | $component_array = array(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Setting the rules |
193 | 193 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
194 | 194 | |
195 | - return $form; |
|
195 | + return $form; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function delete($id) |
257 | 257 | { |
258 | - parent::delete($id); |
|
258 | + parent::delete($id); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | /** |
310 | 310 | * GradeModelComponents constructor. |
311 | 311 | */ |
312 | - public function __construct() |
|
312 | + public function __construct() |
|
313 | 313 | { |
314 | 314 | parent::__construct(); |
315 | 315 | $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * @param array $params |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function save($params, $show_query = false) |
324 | 324 | { |
325 | - $id = parent::save($params, $show_query); |
|
325 | + $id = parent::save($params, $show_query); |
|
326 | 326 | |
327 | 327 | return $id; |
328 | 328 | } |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | - return $block_data; |
|
311 | - } |
|
310 | + return $block_data; |
|
311 | + } |
|
312 | 312 | |
313 | 313 | /** |
314 | 314 | * get data about enabled dashboard block (stored insise block table) |
@@ -491,42 +491,42 @@ discard block |
||
491 | 491 | return $data; |
492 | 492 | } |
493 | 493 | |
494 | - /** |
|
495 | - * This function update extra user blocks data after closing a dashboard block |
|
496 | - * @param int User id |
|
497 | - * @param string plugin path |
|
498 | - * @param integer $user_id |
|
499 | - * @return bool |
|
500 | - */ |
|
501 | - public static function close_user_block($user_id, $path) |
|
494 | + /** |
|
495 | + * This function update extra user blocks data after closing a dashboard block |
|
496 | + * @param int User id |
|
497 | + * @param string plugin path |
|
498 | + * @param integer $user_id |
|
499 | + * @return bool |
|
500 | + */ |
|
501 | + public static function close_user_block($user_id, $path) |
|
502 | 502 | { |
503 | - $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
504 | - $user_block_data = self::get_user_block_data($user_id); |
|
505 | - |
|
506 | - foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
507 | - unset($user_block_data[$enabled_block['id']]); |
|
508 | - } |
|
509 | - |
|
510 | - // get columns and blocks id for updating extra user data |
|
511 | - $columns = array(); |
|
512 | - $user_blocks_id = array(); |
|
513 | - foreach ($user_block_data as $data) { |
|
514 | - $user_blocks_id[$data['block_id']] = true; |
|
515 | - $columns[$data['block_id']] = $data['column']; |
|
516 | - } |
|
517 | - |
|
518 | - // update extra user blocks data |
|
519 | - $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
520 | - |
|
521 | - return $upd_extra_field; |
|
522 | - } |
|
523 | - |
|
524 | - /** |
|
525 | - * get links for styles from dashboard plugins |
|
526 | - * @return string links |
|
527 | - */ |
|
528 | - public static function get_links_for_styles_from_dashboard_plugins() { |
|
529 | - |
|
530 | - return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
531 | - } |
|
503 | + $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path); |
|
504 | + $user_block_data = self::get_user_block_data($user_id); |
|
505 | + |
|
506 | + foreach ($enabled_dashboard_blocks as $enabled_block) { |
|
507 | + unset($user_block_data[$enabled_block['id']]); |
|
508 | + } |
|
509 | + |
|
510 | + // get columns and blocks id for updating extra user data |
|
511 | + $columns = array(); |
|
512 | + $user_blocks_id = array(); |
|
513 | + foreach ($user_block_data as $data) { |
|
514 | + $user_blocks_id[$data['block_id']] = true; |
|
515 | + $columns[$data['block_id']] = $data['column']; |
|
516 | + } |
|
517 | + |
|
518 | + // update extra user blocks data |
|
519 | + $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns); |
|
520 | + |
|
521 | + return $upd_extra_field; |
|
522 | + } |
|
523 | + |
|
524 | + /** |
|
525 | + * get links for styles from dashboard plugins |
|
526 | + * @return string links |
|
527 | + */ |
|
528 | + public static function get_links_for_styles_from_dashboard_plugins() { |
|
529 | + |
|
530 | + return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL; |
|
531 | + } |
|
532 | 532 | } |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | { |
16 | 16 | } |
17 | 17 | |
18 | - /** |
|
19 | - * Add a new Term and Condition |
|
20 | - * @param int $language language id |
|
21 | - * @param string $content content |
|
22 | - * @param int $type term and condition type (0 or 1) |
|
23 | - * @param string $changes explain changes |
|
24 | - * @return boolean success |
|
25 | - */ |
|
26 | - public static function add($language, $content, $type, $changes) |
|
18 | + /** |
|
19 | + * Add a new Term and Condition |
|
20 | + * @param int $language language id |
|
21 | + * @param string $content content |
|
22 | + * @param int $type term and condition type (0 or 1) |
|
23 | + * @param string $changes explain changes |
|
24 | + * @return boolean success |
|
25 | + */ |
|
26 | + public static function add($language, $content, $type, $changes) |
|
27 | 27 | { |
28 | 28 | $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
29 | 29 | $last = self::get_last_condition($language); |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Gets the data of a Term and condition by language |
|
101 | - * @param int $language language id |
|
102 | - * @return array all the info of a Term and condition |
|
103 | - */ |
|
104 | - public static function get_last_condition($language) |
|
99 | + /** |
|
100 | + * Gets the data of a Term and condition by language |
|
101 | + * @param int $language language id |
|
102 | + * @return array all the info of a Term and condition |
|
103 | + */ |
|
104 | + public static function get_last_condition($language) |
|
105 | 105 | { |
106 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
107 | - $language= Database::escape_string($language); |
|
108 | - $sql = "SELECT * FROM $legal_conditions_table |
|
106 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
107 | + $language= Database::escape_string($language); |
|
108 | + $sql = "SELECT * FROM $legal_conditions_table |
|
109 | 109 | WHERE language_id = '".$language."' |
110 | 110 | ORDER BY version DESC |
111 | 111 | LIMIT 1 "; |
112 | - $result = Database::query($sql); |
|
113 | - $result = Database::fetch_array($result, 'ASSOC'); |
|
112 | + $result = Database::query($sql); |
|
113 | + $result = Database::fetch_array($result, 'ASSOC'); |
|
114 | 114 | |
115 | 115 | if (isset($result['content'])) { |
116 | 116 | $result['content'] = self::replaceTags($result['content']); |
117 | 117 | } |
118 | 118 | return $result; |
119 | - } |
|
119 | + } |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * @param string $content |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | return $content; |
141 | 141 | } |
142 | 142 | |
143 | - /** |
|
144 | - * Gets the last version of a Term and condition by language |
|
145 | - * @param int $language language id |
|
146 | - * @return boolean | int the version or false if does not exist |
|
147 | - */ |
|
148 | - public static function get_last_version($language) |
|
143 | + /** |
|
144 | + * Gets the last version of a Term and condition by language |
|
145 | + * @param int $language language id |
|
146 | + * @return boolean | int the version or false if does not exist |
|
147 | + */ |
|
148 | + public static function get_last_version($language) |
|
149 | 149 | { |
150 | 150 | $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
151 | 151 | $language = intval($language); |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | |
164 | 164 | return false; |
165 | 165 | } |
166 | - } |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Show the last condition |
|
170 | - * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
168 | + /** |
|
169 | + * Show the last condition |
|
170 | + * @param array $term_preview with type and content i.e array('type'=>'1', 'content'=>'hola'); |
|
171 | 171 | * |
172 | - * @return string html preview |
|
173 | - */ |
|
174 | - public static function show_last_condition($term_preview) |
|
172 | + * @return string html preview |
|
173 | + */ |
|
174 | + public static function show_last_condition($term_preview) |
|
175 | 175 | { |
176 | 176 | $preview = ''; |
177 | 177 | switch ($term_preview['type']) { |
@@ -201,37 +201,37 @@ discard block |
||
201 | 201 | default: |
202 | 202 | break; |
203 | 203 | } |
204 | - return $preview; |
|
205 | - } |
|
204 | + return $preview; |
|
205 | + } |
|
206 | 206 | |
207 | - /** |
|
208 | - * Get the terms and condition table (only for maintenance) |
|
209 | - * @param int $from |
|
210 | - * @param int $number_of_items |
|
211 | - * @param int $column |
|
212 | - * @return array |
|
213 | - */ |
|
214 | - public static function get_legal_data($from, $number_of_items, $column) |
|
207 | + /** |
|
208 | + * Get the terms and condition table (only for maintenance) |
|
209 | + * @param int $from |
|
210 | + * @param int $number_of_items |
|
211 | + * @param int $column |
|
212 | + * @return array |
|
213 | + */ |
|
214 | + public static function get_legal_data($from, $number_of_items, $column) |
|
215 | 215 | { |
216 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
217 | - $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
218 | - $from = intval($from); |
|
219 | - $number_of_items = intval($number_of_items); |
|
220 | - $column = intval($column); |
|
216 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
217 | + $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE); |
|
218 | + $from = intval($from); |
|
219 | + $number_of_items = intval($number_of_items); |
|
220 | + $column = intval($column); |
|
221 | 221 | |
222 | - $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
222 | + $sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date) |
|
223 | 223 | FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) "; |
224 | - $sql .= "ORDER BY language, version ASC "; |
|
225 | - $sql .= "LIMIT $from, $number_of_items "; |
|
224 | + $sql .= "ORDER BY language, version ASC "; |
|
225 | + $sql .= "LIMIT $from, $number_of_items "; |
|
226 | 226 | |
227 | - $result = Database::query($sql); |
|
228 | - $legals = array(); |
|
229 | - $versions = array(); |
|
230 | - while ($legal = Database::fetch_array($result)) { |
|
231 | - // max 2000 chars |
|
232 | - //echo strlen($legal[1]); echo '<br>'; |
|
233 | - $versions[] = $legal[0]; |
|
234 | - $languages[] = $legal[1]; |
|
227 | + $result = Database::query($sql); |
|
228 | + $legals = array(); |
|
229 | + $versions = array(); |
|
230 | + while ($legal = Database::fetch_array($result)) { |
|
231 | + // max 2000 chars |
|
232 | + //echo strlen($legal[1]); echo '<br>'; |
|
233 | + $versions[] = $legal[0]; |
|
234 | + $languages[] = $legal[1]; |
|
235 | 235 | if (strlen($legal[2]) > 2000) { |
236 | 236 | $legal[2] = substr($legal[2], 0, 2000).' ... '; |
237 | 237 | } |
@@ -240,50 +240,50 @@ discard block |
||
240 | 240 | } elseif ($legal[4] == 1) { |
241 | 241 | $legal[4] = get_lang('PageLink'); |
242 | 242 | } |
243 | - $legals[] = $legal; |
|
244 | - } |
|
245 | - return $legals; |
|
246 | - } |
|
243 | + $legals[] = $legal; |
|
244 | + } |
|
245 | + return $legals; |
|
246 | + } |
|
247 | 247 | |
248 | - /** |
|
249 | - * Gets the number of terms and conditions available |
|
250 | - * @return int |
|
251 | - */ |
|
252 | - public static function count() |
|
248 | + /** |
|
249 | + * Gets the number of terms and conditions available |
|
250 | + * @return int |
|
251 | + */ |
|
252 | + public static function count() |
|
253 | 253 | { |
254 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
255 | - $sql = "SELECT count(*) as count_result |
|
254 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
255 | + $sql = "SELECT count(*) as count_result |
|
256 | 256 | FROM $legal_conditions_table |
257 | 257 | ORDER BY id DESC "; |
258 | - $result = Database::query($sql); |
|
259 | - $url = Database::fetch_array($result,'ASSOC'); |
|
260 | - $result = $url['count_result']; |
|
258 | + $result = Database::query($sql); |
|
259 | + $url = Database::fetch_array($result,'ASSOC'); |
|
260 | + $result = $url['count_result']; |
|
261 | 261 | |
262 | - return $result; |
|
263 | - } |
|
262 | + return $result; |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * Get type of terms and conditions |
|
267 | - * @param int $legal_id |
|
268 | - * @param int $language_id |
|
269 | - * @return int The current type of terms and conditions |
|
270 | - */ |
|
271 | - public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
265 | + /** |
|
266 | + * Get type of terms and conditions |
|
267 | + * @param int $legal_id |
|
268 | + * @param int $language_id |
|
269 | + * @return int The current type of terms and conditions |
|
270 | + */ |
|
271 | + public static function get_type_of_terms_and_conditions($legal_id, $language_id) |
|
272 | 272 | { |
273 | - $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
274 | - $legal_id = intval($legal_id); |
|
275 | - $language_id = intval($language_id); |
|
276 | - $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
273 | + $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL); |
|
274 | + $legal_id = intval($legal_id); |
|
275 | + $language_id = intval($language_id); |
|
276 | + $sql = 'SELECT type FROM '.$legal_conditions_table.' |
|
277 | 277 | WHERE id = "'.$legal_id.'" AND language_id="'.$language_id.'"'; |
278 | - $rs = Database::query($sql); |
|
278 | + $rs = Database::query($sql); |
|
279 | 279 | |
280 | - return Database::result($rs,0,'type'); |
|
281 | - } |
|
280 | + return Database::result($rs,0,'type'); |
|
281 | + } |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * @param int $userId |
285 | 285 | */ |
286 | - public static function sendLegal($userId) |
|
286 | + public static function sendLegal($userId) |
|
287 | 287 | { |
288 | 288 | $subject = get_lang('SendTermsSubject'); |
289 | 289 | $content = sprintf( |