@@ -33,18 +33,18 @@ |
||
33 | 33 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
34 | 34 | |
35 | 35 | if (! isset($_course)) { |
36 | - api_not_allowed(true); |
|
36 | + api_not_allowed(true); |
|
37 | 37 | } |
38 | 38 | $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url; |
39 | 39 | |
40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
41 | 41 | if (is_dir($full_file_name)) { |
42 | - //remove last slash if present |
|
43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
44 | - //create the path |
|
45 | - $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
|
46 | - //redirect |
|
47 | - header('Location: '.$document_explorer); |
|
42 | + //remove last slash if present |
|
43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
44 | + //create the path |
|
45 | + $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
|
46 | + //redirect |
|
47 | + header('Location: '.$document_explorer); |
|
48 | 48 | exit; |
49 | 49 | } |
50 | 50 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | session_cache_limiter('public'); |
16 | 16 | |
17 | 17 | require_once '../inc/global.inc.php'; |
18 | -$this_section=SECTION_COURSES; |
|
18 | +$this_section = SECTION_COURSES; |
|
19 | 19 | |
20 | 20 | // IMPORTANT to avoid caching of documents |
21 | 21 | header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $doc_url = str_replace(' ', '+', $doc_url); |
33 | 33 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
34 | 34 | |
35 | -if (! isset($_course)) { |
|
35 | +if (!isset($_course)) { |
|
36 | 36 | api_not_allowed(true); |
37 | 37 | } |
38 | 38 | $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
41 | 41 | if (is_dir($full_file_name)) { |
42 | 42 | //remove last slash if present |
43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
43 | + while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul); |
|
44 | 44 | //create the path |
45 | 45 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
46 | 46 | //redirect |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | exit; |
49 | 49 | } |
50 | 50 | |
51 | -$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
51 | +$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
52 | 52 | $course_id = api_get_course_int_id(); |
53 | 53 | |
54 | 54 | // launch event |
@@ -40,7 +40,9 @@ |
||
40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
41 | 41 | if (is_dir($full_file_name)) { |
42 | 42 | //remove last slash if present |
43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') { |
|
44 | + $doc_url = substr($doc_url,0,$dul); |
|
45 | + } |
|
44 | 46 | //create the path |
45 | 47 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
46 | 48 | //redirect |
@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | api_not_allowed(true); |
14 | 14 | } |
15 | 15 | |
16 | -$this_section = SECTION_COURSES; |
|
17 | -$current_course_tool = TOOL_BLOGS; |
|
16 | +$this_section = SECTION_COURSES; |
|
17 | +$current_course_tool = TOOL_BLOGS; |
|
18 | 18 | |
19 | 19 | /* ACCESS RIGHTS */ |
20 | 20 | // notice for unauthorized people. |
21 | 21 | api_protect_course_script(true); |
22 | 22 | |
23 | 23 | $lib_path = api_get_path(LIBRARY_PATH); |
24 | -$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
24 | +$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
25 | 25 | |
26 | 26 | $nameTools = get_lang('Blogs'); |
27 | 27 | $DaysShort = api_get_week_days_short(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $safe_comment_title, |
136 | 136 | $safe_comment_text, |
137 | 137 | $blog_id, |
138 | - (int)$_GET['post_id'], |
|
138 | + (int) $_GET['post_id'], |
|
139 | 139 | $_POST['comment_parent_id'], |
140 | 140 | $_POST['task_id'] |
141 | 141 | ); |
@@ -147,29 +147,29 @@ discard block |
||
147 | 147 | if (!empty($_POST['register'])) { |
148 | 148 | if (is_array($_POST['user'])) { |
149 | 149 | foreach ($_POST['user'] as $index => $user_id) { |
150 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
150 | + Blog :: set_user_subscribed((int) $_GET['blog_id'], $user_id); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | 154 | if (!empty($_POST['unregister'])) { |
155 | 155 | if (is_array($_POST['user'])) { |
156 | 156 | foreach ($_POST['user'] as $index => $user_id) { |
157 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
157 | + Blog :: set_user_unsubscribed((int) $_GET['blog_id'], $user_id); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
161 | 161 | if (!empty($_GET['register'])) { |
162 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
162 | + Blog :: set_user_subscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); |
|
163 | 163 | $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
164 | 164 | $flag = 1; |
165 | 165 | } |
166 | 166 | if (!empty($_GET['unregister'])) { |
167 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
167 | + Blog :: set_user_unsubscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { |
171 | 171 | if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
172 | - Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
172 | + Blog :: delete_task($blog_id, (int) $_GET['task_id']); |
|
173 | 173 | $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
174 | 174 | } |
175 | 175 | |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | if (isset($_GET['action']) && $_GET['action'] == 'view_post') { |
183 | 183 | $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
184 | 184 | |
185 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
185 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
186 | 186 | if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
187 | - Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
187 | + Blog :: delete_comment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']); |
|
188 | 188 | $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
189 | 189 | } else { |
190 | 190 | $error = true; |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
195 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
196 | 196 | if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
197 | - Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
197 | + Blog :: delete_post($blog_id, (int) $_GET['article_id']); |
|
198 | 198 | $action = ''; // Article is gone, go to blog home |
199 | 199 | $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
200 | 200 | } else { |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
206 | 206 | if (isset($_GET['type']) && $_GET['type'] == 'post') { |
207 | 207 | if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
208 | - Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
208 | + Blog :: add_rating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']); |
|
209 | 209 | $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
210 | 210 | } |
211 | 211 | } |
212 | 212 | if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
213 | 213 | if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
214 | - Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
214 | + Blog :: add_rating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']); |
|
215 | 215 | $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
216 | 216 | } |
217 | 217 | } |
@@ -290,16 +290,16 @@ discard block |
||
290 | 290 | echo '<div class=actions>'; |
291 | 291 | ?> |
292 | 292 | <a href="<?php echo api_get_self(); ?>?blog_id=<?php echo $blog_id ?>&<?php echo api_get_cidreq(); ?>" title="<?php echo get_lang('Home') ?>"> |
293 | - <?php echo Display::return_icon('blog.png', get_lang('Home'),'',ICON_SIZE_MEDIUM); ?></a> |
|
294 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?> |
|
293 | + <?php echo Display::return_icon('blog.png', get_lang('Home'), '', ICON_SIZE_MEDIUM); ?></a> |
|
294 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?> |
|
295 | 295 | <a href="<?php echo api_get_self(); ?>?action=new_post&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('NewPost') ?>"> |
296 | - <?php echo Display::return_icon('new_article.png', get_lang('NewPost'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
297 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?> |
|
296 | + <?php echo Display::return_icon('new_article.png', get_lang('NewPost'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
297 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?> |
|
298 | 298 | <a href="<?php echo api_get_self(); ?>?action=manage_tasks&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageTasks') ?>"> |
299 | - <?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
300 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?> |
|
299 | + <?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
300 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?> |
|
301 | 301 | <a href="<?php echo api_get_self(); ?>?action=manage_members&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageMembers') ?>"> |
302 | - <?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
302 | + <?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
303 | 303 | <?php |
304 | 304 | echo '</div>'; |
305 | 305 | |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | <div class="panel-heading"><?php echo get_lang('Calendar') ?></div> |
318 | 318 | <div class="panel-body"> |
319 | 319 | <?php |
320 | - $month = isset($_GET['month']) ? (int)$_GET['month'] : (int) date('m'); |
|
321 | - $year = isset($_GET['year']) ? (int)$_GET['year'] : date('Y'); |
|
320 | + $month = isset($_GET['month']) ? (int) $_GET['month'] : (int) date('m'); |
|
321 | + $year = isset($_GET['year']) ? (int) $_GET['year'] : date('Y'); |
|
322 | 322 | Blog::display_minimonthcalendar($month, $year, $blog_id); |
323 | 323 | ?> |
324 | 324 | </div> |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $course_id = api_get_course_int_id(); |
364 | 364 | |
365 | 365 | if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) { |
366 | - $task_id = (int)$_GET['task_id']; |
|
366 | + $task_id = (int) $_GET['task_id']; |
|
367 | 367 | } else { |
368 | 368 | $task_id = 0; |
369 | 369 | $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
@@ -379,9 +379,10 @@ discard block |
||
379 | 379 | $result = Database::query($sql); |
380 | 380 | $row = Database::fetch_array($result); |
381 | 381 | |
382 | - if ($row['number'] == 1) |
|
383 | - $user_task = true; |
|
384 | -} |
|
382 | + if ($row['number'] == 1) { |
|
383 | + $user_task = true; |
|
384 | + } |
|
385 | + } |
|
385 | 386 | |
386 | 387 | switch ($action) { |
387 | 388 | case 'new_post': |
@@ -468,16 +469,17 @@ discard block |
||
468 | 469 | echo '<br /><br />'; |
469 | 470 | Blog :: display_assigned_task_list($blog_id); |
470 | 471 | echo '<br /><br />'; |
472 | + } else { |
|
473 | + api_not_allowed(); |
|
471 | 474 | } |
472 | - else |
|
473 | - api_not_allowed(); |
|
474 | 475 | |
475 | 476 | break; |
476 | 477 | case 'execute_task' : |
477 | - if (isset ($_GET['post_id'])) |
|
478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
479 | - else |
|
480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
478 | + if (isset ($_GET['post_id'])) { |
|
479 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
480 | + } else { |
|
481 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
482 | + } |
|
481 | 483 | |
482 | 484 | break; |
483 | 485 | case 'view_search_result' : |
@@ -41,181 +41,181 @@ discard block |
||
41 | 41 | $safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null; |
42 | 42 | |
43 | 43 | if (!empty($_POST['new_post_submit'])) { |
44 | - Blog:: create_post( |
|
45 | - $_POST['title'], |
|
46 | - $_POST['full_text'], |
|
47 | - $_POST['post_file_comment'], |
|
48 | - $blog_id |
|
49 | - ); |
|
50 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
44 | + Blog:: create_post( |
|
45 | + $_POST['title'], |
|
46 | + $_POST['full_text'], |
|
47 | + $_POST['post_file_comment'], |
|
48 | + $blog_id |
|
49 | + ); |
|
50 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
51 | 51 | } |
52 | 52 | if (!empty($_POST['edit_post_submit'])) { |
53 | - Blog:: edit_post( |
|
54 | - $_POST['post_id'], |
|
55 | - $_POST['title'], |
|
56 | - $_POST['full_text'], |
|
57 | - $blog_id |
|
58 | - ); |
|
59 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
53 | + Blog:: edit_post( |
|
54 | + $_POST['post_id'], |
|
55 | + $_POST['title'], |
|
56 | + $_POST['full_text'], |
|
57 | + $blog_id |
|
58 | + ); |
|
59 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if (!empty($_POST['new_comment_submit'])) { |
63 | - Blog:: create_comment( |
|
64 | - $_POST['title'], |
|
65 | - $_POST['comment'], |
|
66 | - $_POST['post_file_comment'], |
|
67 | - $blog_id, |
|
68 | - $_GET['post_id'], |
|
69 | - $_POST['comment_parent_id'] |
|
70 | - ); |
|
71 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
63 | + Blog:: create_comment( |
|
64 | + $_POST['title'], |
|
65 | + $_POST['comment'], |
|
66 | + $_POST['post_file_comment'], |
|
67 | + $blog_id, |
|
68 | + $_GET['post_id'], |
|
69 | + $_POST['comment_parent_id'] |
|
70 | + ); |
|
71 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if (!empty($_POST['new_task_submit'])) { |
75 | 75 | |
76 | - Blog:: create_task( |
|
77 | - $blog_id, |
|
78 | - $safe_task_name, |
|
79 | - $safe_task_description, |
|
80 | - (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
81 | - (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
82 | - (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
83 | - (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
84 | - ); |
|
85 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
76 | + Blog:: create_task( |
|
77 | + $blog_id, |
|
78 | + $safe_task_name, |
|
79 | + $safe_task_description, |
|
80 | + (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
81 | + (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
82 | + (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
83 | + (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
84 | + ); |
|
85 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if (isset($_POST['edit_task_submit'])) { |
89 | - Blog:: edit_task( |
|
90 | - $_POST['blog_id'], |
|
91 | - $_POST['task_id'], |
|
92 | - $safe_task_name, |
|
93 | - $safe_task_description, |
|
94 | - $_POST['chkArticleDelete'], |
|
95 | - $_POST['chkArticleEdit'], |
|
96 | - $_POST['chkCommentsDelete'], |
|
97 | - $_POST['task_color'] |
|
98 | - ); |
|
99 | - $return_message = array( |
|
100 | - 'type' => 'confirmation', |
|
101 | - 'message' => get_lang('TaskEdited') |
|
102 | - ); |
|
89 | + Blog:: edit_task( |
|
90 | + $_POST['blog_id'], |
|
91 | + $_POST['task_id'], |
|
92 | + $safe_task_name, |
|
93 | + $safe_task_description, |
|
94 | + $_POST['chkArticleDelete'], |
|
95 | + $_POST['chkArticleEdit'], |
|
96 | + $_POST['chkCommentsDelete'], |
|
97 | + $_POST['task_color'] |
|
98 | + ); |
|
99 | + $return_message = array( |
|
100 | + 'type' => 'confirmation', |
|
101 | + 'message' => get_lang('TaskEdited') |
|
102 | + ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if (!empty($_POST['assign_task_submit'])) { |
106 | - Blog:: assign_task( |
|
107 | - $blog_id, |
|
108 | - $_POST['task_user_id'], |
|
109 | - $_POST['task_task_id'], |
|
110 | - $_POST['task_day'] |
|
111 | - ); |
|
112 | - $return_message = array( |
|
113 | - 'type' => 'confirmation', |
|
114 | - 'message' => get_lang('TaskAssigned') |
|
115 | - ); |
|
106 | + Blog:: assign_task( |
|
107 | + $blog_id, |
|
108 | + $_POST['task_user_id'], |
|
109 | + $_POST['task_task_id'], |
|
110 | + $_POST['task_day'] |
|
111 | + ); |
|
112 | + $return_message = array( |
|
113 | + 'type' => 'confirmation', |
|
114 | + 'message' => get_lang('TaskAssigned') |
|
115 | + ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | if (isset($_POST['assign_task_edit_submit'])) { |
119 | - Blog:: edit_assigned_task( |
|
120 | - $blog_id, |
|
121 | - $_POST['task_user_id'], |
|
122 | - $_POST['task_task_id'], |
|
123 | - $_POST['task_day'], |
|
124 | - $_POST['old_user_id'], |
|
125 | - $_POST['old_task_id'], |
|
126 | - $_POST['old_target_date'] |
|
127 | - ); |
|
128 | - $return_message = array( |
|
129 | - 'type' => 'confirmation', |
|
130 | - 'message' => get_lang('AssignedTaskEdited') |
|
131 | - ); |
|
119 | + Blog:: edit_assigned_task( |
|
120 | + $blog_id, |
|
121 | + $_POST['task_user_id'], |
|
122 | + $_POST['task_task_id'], |
|
123 | + $_POST['task_day'], |
|
124 | + $_POST['old_user_id'], |
|
125 | + $_POST['old_task_id'], |
|
126 | + $_POST['old_target_date'] |
|
127 | + ); |
|
128 | + $return_message = array( |
|
129 | + 'type' => 'confirmation', |
|
130 | + 'message' => get_lang('AssignedTaskEdited') |
|
131 | + ); |
|
132 | 132 | } |
133 | 133 | if (!empty($_POST['new_task_execution_submit'])) { |
134 | - Blog:: create_comment( |
|
135 | - $safe_comment_title, |
|
136 | - $safe_comment_text, |
|
137 | - $blog_id, |
|
138 | - (int)$_GET['post_id'], |
|
139 | - $_POST['comment_parent_id'], |
|
140 | - $_POST['task_id'] |
|
141 | - ); |
|
142 | - $return_message = array( |
|
143 | - 'type' => 'confirmation', |
|
144 | - 'message' => get_lang('CommentCreated') |
|
145 | - ); |
|
134 | + Blog:: create_comment( |
|
135 | + $safe_comment_title, |
|
136 | + $safe_comment_text, |
|
137 | + $blog_id, |
|
138 | + (int)$_GET['post_id'], |
|
139 | + $_POST['comment_parent_id'], |
|
140 | + $_POST['task_id'] |
|
141 | + ); |
|
142 | + $return_message = array( |
|
143 | + 'type' => 'confirmation', |
|
144 | + 'message' => get_lang('CommentCreated') |
|
145 | + ); |
|
146 | 146 | } |
147 | 147 | if (!empty($_POST['register'])) { |
148 | - if (is_array($_POST['user'])) { |
|
149 | - foreach ($_POST['user'] as $index => $user_id) { |
|
150 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
151 | - } |
|
152 | - } |
|
148 | + if (is_array($_POST['user'])) { |
|
149 | + foreach ($_POST['user'] as $index => $user_id) { |
|
150 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
151 | + } |
|
152 | + } |
|
153 | 153 | } |
154 | 154 | if (!empty($_POST['unregister'])) { |
155 | - if (is_array($_POST['user'])) { |
|
156 | - foreach ($_POST['user'] as $index => $user_id) { |
|
157 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
158 | - } |
|
159 | - } |
|
155 | + if (is_array($_POST['user'])) { |
|
156 | + foreach ($_POST['user'] as $index => $user_id) { |
|
157 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
158 | + } |
|
159 | + } |
|
160 | 160 | } |
161 | 161 | if (!empty($_GET['register'])) { |
162 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
163 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
164 | - $flag = 1; |
|
162 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
163 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
164 | + $flag = 1; |
|
165 | 165 | } |
166 | 166 | if (!empty($_GET['unregister'])) { |
167 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
167 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { |
171 | - if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
172 | - Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
173 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
174 | - } |
|
175 | - |
|
176 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
177 | - Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
178 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
179 | - } |
|
171 | + if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
172 | + Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
173 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
174 | + } |
|
175 | + |
|
176 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
177 | + Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
178 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
179 | + } |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | if (isset($_GET['action']) && $_GET['action'] == 'view_post') { |
183 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
184 | - |
|
185 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
186 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
187 | - Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
188 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
189 | - } else { |
|
190 | - $error = true; |
|
191 | - $message = get_lang('ActionNotAllowed'); |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
196 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
197 | - Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
198 | - $action = ''; // Article is gone, go to blog home |
|
199 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
200 | - } else { |
|
201 | - $error = true; |
|
202 | - $message = get_lang('ActionNotAllowed'); |
|
203 | - } |
|
204 | - } |
|
205 | - if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
206 | - if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
207 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
208 | - Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
209 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
210 | - } |
|
211 | - } |
|
212 | - if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
213 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
214 | - Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
215 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
216 | - } |
|
217 | - } |
|
218 | - } |
|
183 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
184 | + |
|
185 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
186 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
187 | + Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
188 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
189 | + } else { |
|
190 | + $error = true; |
|
191 | + $message = get_lang('ActionNotAllowed'); |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
196 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
197 | + Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
198 | + $action = ''; // Article is gone, go to blog home |
|
199 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
200 | + } else { |
|
201 | + $error = true; |
|
202 | + $message = get_lang('ActionNotAllowed'); |
|
203 | + } |
|
204 | + } |
|
205 | + if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
206 | + if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
207 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
208 | + Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
209 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
210 | + } |
|
211 | + } |
|
212 | + if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
213 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
214 | + Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
215 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
216 | + } |
|
217 | + } |
|
218 | + } |
|
219 | 219 | } |
220 | 220 | /* |
221 | 221 | DISPLAY |
@@ -223,67 +223,67 @@ discard block |
||
223 | 223 | |
224 | 224 | // Set breadcrumb |
225 | 225 | switch ($action) { |
226 | - case 'new_post' : |
|
227 | - $nameTools = get_lang('NewPost'); |
|
226 | + case 'new_post' : |
|
227 | + $nameTools = get_lang('NewPost'); |
|
228 | 228 | $interbreadcrumb[] = array( |
229 | 229 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
230 | 230 | "name" => Blog:: get_blog_title($blog_id), |
231 | 231 | ); |
232 | - Display :: display_header($nameTools, 'Blogs'); |
|
233 | - break; |
|
234 | - case 'manage_tasks' : |
|
235 | - $nameTools = get_lang('TaskManager'); |
|
232 | + Display :: display_header($nameTools, 'Blogs'); |
|
233 | + break; |
|
234 | + case 'manage_tasks' : |
|
235 | + $nameTools = get_lang('TaskManager'); |
|
236 | 236 | $interbreadcrumb[] = array( |
237 | 237 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
238 | 238 | "name" => Blog:: get_blog_title($blog_id), |
239 | 239 | ); |
240 | - Display :: display_header($nameTools, 'Blogs'); |
|
241 | - break; |
|
242 | - case 'manage_members' : |
|
243 | - $nameTools = get_lang('MemberManager'); |
|
240 | + Display :: display_header($nameTools, 'Blogs'); |
|
241 | + break; |
|
242 | + case 'manage_members' : |
|
243 | + $nameTools = get_lang('MemberManager'); |
|
244 | 244 | $interbreadcrumb[] = array( |
245 | 245 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
246 | 246 | "name" => Blog:: get_blog_title($blog_id), |
247 | 247 | ); |
248 | - Display :: display_header($nameTools, 'Blogs'); |
|
249 | - break; |
|
250 | - case 'manage_rights' : |
|
251 | - $nameTools = get_lang('RightsManager'); |
|
248 | + Display :: display_header($nameTools, 'Blogs'); |
|
249 | + break; |
|
250 | + case 'manage_rights' : |
|
251 | + $nameTools = get_lang('RightsManager'); |
|
252 | 252 | $interbreadcrumb[] = array( |
253 | 253 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
254 | 254 | 'name' => Blog:: get_blog_title($blog_id), |
255 | 255 | ); |
256 | - Display :: display_header($nameTools, 'Blogs'); |
|
257 | - break; |
|
258 | - case 'view_search_result' : |
|
259 | - $nameTools = get_lang('SearchResults'); |
|
256 | + Display :: display_header($nameTools, 'Blogs'); |
|
257 | + break; |
|
258 | + case 'view_search_result' : |
|
259 | + $nameTools = get_lang('SearchResults'); |
|
260 | 260 | $interbreadcrumb[] = array( |
261 | 261 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
262 | 262 | 'name' => Blog:: get_blog_title($blog_id), |
263 | 263 | ); |
264 | - Display :: display_header($nameTools, 'Blogs'); |
|
265 | - break; |
|
266 | - case 'execute_task' : |
|
267 | - $nameTools = get_lang('ExecuteThisTask'); |
|
264 | + Display :: display_header($nameTools, 'Blogs'); |
|
265 | + break; |
|
266 | + case 'execute_task' : |
|
267 | + $nameTools = get_lang('ExecuteThisTask'); |
|
268 | 268 | $interbreadcrumb[] = array( |
269 | 269 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
270 | 270 | 'name' => Blog:: get_blog_title($blog_id), |
271 | 271 | ); |
272 | - Display :: display_header($nameTools, 'Blogs'); |
|
273 | - break; |
|
274 | - default : |
|
275 | - $nameTools = Blog :: get_blog_title($blog_id); |
|
276 | - Display :: display_header($nameTools, 'Blogs'); |
|
272 | + Display :: display_header($nameTools, 'Blogs'); |
|
273 | + break; |
|
274 | + default : |
|
275 | + $nameTools = Blog :: get_blog_title($blog_id); |
|
276 | + Display :: display_header($nameTools, 'Blogs'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // feedback messages |
280 | 280 | if (!empty($return_message)) { |
281 | - if ($return_message['type'] == 'confirmation') { |
|
282 | - Display::display_confirmation_message($return_message['message']); |
|
283 | - } |
|
284 | - if ($return_message['type'] == 'error') { |
|
285 | - Display::display_error_message($return_message['message']); |
|
286 | - } |
|
281 | + if ($return_message['type'] == 'confirmation') { |
|
282 | + Display::display_confirmation_message($return_message['message']); |
|
283 | + } |
|
284 | + if ($return_message['type'] == 'error') { |
|
285 | + Display::display_error_message($return_message['message']); |
|
286 | + } |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // actions |
@@ -350,12 +350,12 @@ discard block |
||
350 | 350 | <?php |
351 | 351 | |
352 | 352 | if (isset($error)) { |
353 | - Display :: display_error_message($message); |
|
353 | + Display :: display_error_message($message); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | if (isset($flag) && $flag == '1') { |
357 | - $action = "manage_tasks"; |
|
358 | - Blog :: display_assign_task_form($blog_id); |
|
357 | + $action = "manage_tasks"; |
|
358 | + Blog :: display_assign_task_form($blog_id); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $user_task = false; |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | $course_id = api_get_course_int_id(); |
364 | 364 | |
365 | 365 | if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) { |
366 | - $task_id = (int)$_GET['task_id']; |
|
366 | + $task_id = (int)$_GET['task_id']; |
|
367 | 367 | } else { |
368 | - $task_id = 0; |
|
369 | - $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
368 | + $task_id = 0; |
|
369 | + $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
370 | 370 | |
371 | - $sql = "SELECT COUNT(*) as number |
|
371 | + $sql = "SELECT COUNT(*) as number |
|
372 | 372 | FROM ".$tbl_blogs_tasks_rel_user." |
373 | 373 | WHERE |
374 | 374 | c_id = $course_id AND |
@@ -376,120 +376,120 @@ discard block |
||
376 | 376 | user_id = ".api_get_user_id()." AND |
377 | 377 | task_id = ".$task_id; |
378 | 378 | |
379 | - $result = Database::query($sql); |
|
380 | - $row = Database::fetch_array($result); |
|
379 | + $result = Database::query($sql); |
|
380 | + $row = Database::fetch_array($result); |
|
381 | 381 | |
382 | - if ($row['number'] == 1) |
|
383 | - $user_task = true; |
|
382 | + if ($row['number'] == 1) |
|
383 | + $user_task = true; |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | switch ($action) { |
387 | - case 'new_post': |
|
388 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
389 | - // we show the form if |
|
390 | - // 1. no post data |
|
391 | - // 2. there is post data and the required field is empty |
|
392 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
393 | - // if there is post data there is certainly an error in the form |
|
394 | - if ($_POST) { |
|
395 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
396 | - } |
|
397 | - Blog :: display_form_new_post($blog_id); |
|
398 | - } else { |
|
399 | - if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
400 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
401 | - } else { |
|
402 | - Blog :: display_blog_posts($blog_id); |
|
403 | - } |
|
404 | - } |
|
405 | - } else { |
|
406 | - api_not_allowed(); |
|
407 | - } |
|
408 | - break; |
|
409 | - case 'view_post' : |
|
410 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
411 | - break; |
|
412 | - case 'edit_post' : |
|
413 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
414 | - |
|
415 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
416 | - // we show the form if |
|
417 | - // 1. no post data |
|
418 | - // 2. there is post data and the required field is empty |
|
419 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
420 | - // if there is post data there is certainly an error in the form |
|
421 | - if ($_POST) { |
|
422 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
423 | - } |
|
387 | + case 'new_post': |
|
388 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
389 | + // we show the form if |
|
390 | + // 1. no post data |
|
391 | + // 2. there is post data and the required field is empty |
|
392 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
393 | + // if there is post data there is certainly an error in the form |
|
394 | + if ($_POST) { |
|
395 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
396 | + } |
|
397 | + Blog :: display_form_new_post($blog_id); |
|
398 | + } else { |
|
399 | + if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
400 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
401 | + } else { |
|
402 | + Blog :: display_blog_posts($blog_id); |
|
403 | + } |
|
404 | + } |
|
405 | + } else { |
|
406 | + api_not_allowed(); |
|
407 | + } |
|
408 | + break; |
|
409 | + case 'view_post' : |
|
410 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
411 | + break; |
|
412 | + case 'edit_post' : |
|
413 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
414 | + |
|
415 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
416 | + // we show the form if |
|
417 | + // 1. no post data |
|
418 | + // 2. there is post data and the required field is empty |
|
419 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
420 | + // if there is post data there is certainly an error in the form |
|
421 | + if ($_POST) { |
|
422 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
423 | + } |
|
424 | 424 | Blog :: display_form_edit_post($blog_id, intval($_GET['post_id'])); |
425 | - } else { |
|
426 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
427 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
428 | - } else { |
|
429 | - Blog :: display_blog_posts($blog_id); |
|
430 | - } |
|
431 | - } |
|
432 | - } else { |
|
433 | - api_not_allowed(); |
|
434 | - } |
|
435 | - |
|
436 | - break; |
|
437 | - case 'manage_members' : |
|
438 | - if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
439 | - Blog :: display_form_user_subscribe($blog_id); |
|
440 | - echo '<br /><br />'; |
|
441 | - Blog :: display_form_user_unsubscribe($blog_id); |
|
442 | - } else { |
|
443 | - api_not_allowed(); |
|
425 | + } else { |
|
426 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
427 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
428 | + } else { |
|
429 | + Blog :: display_blog_posts($blog_id); |
|
430 | + } |
|
431 | + } |
|
432 | + } else { |
|
433 | + api_not_allowed(); |
|
434 | + } |
|
435 | + |
|
436 | + break; |
|
437 | + case 'manage_members' : |
|
438 | + if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
439 | + Blog :: display_form_user_subscribe($blog_id); |
|
440 | + echo '<br /><br />'; |
|
441 | + Blog :: display_form_user_unsubscribe($blog_id); |
|
442 | + } else { |
|
443 | + api_not_allowed(); |
|
444 | 444 | } |
445 | 445 | |
446 | - break; |
|
447 | - case 'manage_rights' : |
|
448 | - Blog :: display_form_user_rights($blog_id); |
|
449 | - break; |
|
450 | - case 'manage_tasks' : |
|
451 | - if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
452 | - if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
453 | - Blog:: display_new_task_form($blog_id); |
|
454 | - } |
|
455 | - if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
456 | - Blog:: display_assign_task_form($blog_id); |
|
457 | - } |
|
458 | - if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
459 | - Blog:: display_edit_task_form( |
|
460 | - $blog_id, |
|
461 | - intval($_GET['task_id']) |
|
462 | - ); |
|
463 | - } |
|
464 | - if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
465 | - Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
466 | - } |
|
467 | - Blog :: display_task_list($blog_id); |
|
468 | - echo '<br /><br />'; |
|
469 | - Blog :: display_assigned_task_list($blog_id); |
|
470 | - echo '<br /><br />'; |
|
471 | - } |
|
472 | - else |
|
473 | - api_not_allowed(); |
|
474 | - |
|
475 | - break; |
|
476 | - case 'execute_task' : |
|
477 | - if (isset ($_GET['post_id'])) |
|
478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
479 | - else |
|
480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
481 | - |
|
482 | - break; |
|
483 | - case 'view_search_result' : |
|
484 | - Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
485 | - break; |
|
486 | - case '' : |
|
487 | - default : |
|
488 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
489 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
490 | - } else { |
|
491 | - Blog :: display_blog_posts($blog_id); |
|
492 | - } |
|
446 | + break; |
|
447 | + case 'manage_rights' : |
|
448 | + Blog :: display_form_user_rights($blog_id); |
|
449 | + break; |
|
450 | + case 'manage_tasks' : |
|
451 | + if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
452 | + if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
453 | + Blog:: display_new_task_form($blog_id); |
|
454 | + } |
|
455 | + if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
456 | + Blog:: display_assign_task_form($blog_id); |
|
457 | + } |
|
458 | + if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
459 | + Blog:: display_edit_task_form( |
|
460 | + $blog_id, |
|
461 | + intval($_GET['task_id']) |
|
462 | + ); |
|
463 | + } |
|
464 | + if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
465 | + Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
466 | + } |
|
467 | + Blog :: display_task_list($blog_id); |
|
468 | + echo '<br /><br />'; |
|
469 | + Blog :: display_assigned_task_list($blog_id); |
|
470 | + echo '<br /><br />'; |
|
471 | + } |
|
472 | + else |
|
473 | + api_not_allowed(); |
|
474 | + |
|
475 | + break; |
|
476 | + case 'execute_task' : |
|
477 | + if (isset ($_GET['post_id'])) |
|
478 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
479 | + else |
|
480 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
481 | + |
|
482 | + break; |
|
483 | + case 'view_search_result' : |
|
484 | + Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
485 | + break; |
|
486 | + case '' : |
|
487 | + default : |
|
488 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
489 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
490 | + } else { |
|
491 | + Blog :: display_blog_posts($blog_id); |
|
492 | + } |
|
493 | 493 | } |
494 | 494 | ?> |
495 | 495 | </div> |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | require_once '../inc/global.inc.php'; |
11 | -$current_course_tool = TOOL_BLOGS; |
|
11 | +$current_course_tool = TOOL_BLOGS; |
|
12 | 12 | |
13 | 13 | $this_section = SECTION_COURSES; |
14 | 14 | |
15 | -$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
15 | +$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
16 | 16 | |
17 | 17 | /* ACCESS RIGHTS */ |
18 | 18 | // notice for unauthorized people. |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // ONLY USERS REGISTERED IN THE COURSE |
22 | 22 | if ((!$is_allowed_in_course || !$is_courseMember) && !api_is_allowed_to_edit()) { |
23 | - api_not_allowed(true);//print headers/footers |
|
23 | + api_not_allowed(true); //print headers/footers |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if (api_is_allowed_to_edit()) { |
@@ -30,30 +30,30 @@ discard block |
||
30 | 30 | // the learning path, we do not include the banner so we have to explicitly |
31 | 31 | // include the stylesheet, which is normally done in the header |
32 | 32 | if (empty($_GET['origin']) || $_GET['origin'] != 'learnpath') { |
33 | - $interbreadcrumb[]= array ('url' => 'blog_admin.php?','name' => $nameTools); |
|
34 | - $my_url=''; |
|
35 | - if (isset($_GET['action']) && $_GET['action']=='add') { |
|
36 | - $current_section=get_lang('AddBlog'); |
|
37 | - $my_url='action=add'; |
|
38 | - } elseif (isset($_GET['action']) && $_GET['action']=='edit') { |
|
39 | - $current_section=get_lang('EditBlog'); |
|
40 | - $my_url='action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']); |
|
33 | + $interbreadcrumb[] = array('url' => 'blog_admin.php?', 'name' => $nameTools); |
|
34 | + $my_url = ''; |
|
35 | + if (isset($_GET['action']) && $_GET['action'] == 'add') { |
|
36 | + $current_section = get_lang('AddBlog'); |
|
37 | + $my_url = 'action=add'; |
|
38 | + } elseif (isset($_GET['action']) && $_GET['action'] == 'edit') { |
|
39 | + $current_section = get_lang('EditBlog'); |
|
40 | + $my_url = 'action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']); |
|
41 | 41 | } |
42 | 42 | Display::display_header(''); |
43 | 43 | } |
44 | 44 | echo '<div class="actions">'; |
45 | 45 | echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add'>", |
46 | - Display::return_icon('new_blog.png',get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
46 | + Display::return_icon('new_blog.png', get_lang('AddBlog'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
47 | 47 | echo '</div>'; |
48 | 48 | |
49 | 49 | if (!empty($_POST['new_blog_submit']) AND !empty($_POST['blog_name'])) { |
50 | - if (isset($_POST['blog_name'])) { |
|
50 | + if (isset($_POST['blog_name'])) { |
|
51 | 51 | Blog::create_blog($_POST['blog_name'], $_POST['blog_subtitle']); |
52 | 52 | Display::display_confirmation_message(get_lang('BlogStored')); |
53 | 53 | } |
54 | 54 | } |
55 | 55 | if (!empty($_POST['edit_blog_submit']) AND !empty($_POST['blog_name'])) { |
56 | - if (strlen(trim($_POST['blog_name']))>0) { |
|
56 | + if (strlen(trim($_POST['blog_name'])) > 0) { |
|
57 | 57 | Blog::edit_blog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']); |
58 | 58 | Display::display_confirmation_message(get_lang('BlogEdited')); |
59 | 59 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // we show the form if |
95 | 95 | // 1. no post data |
96 | 96 | // 2. there is post data and one of the three form elements is empty |
97 | - if (!$_POST OR (!empty($_POST) AND (empty($_POST['edit_blog_submit']) OR empty($_POST['blog_name']) ))) { |
|
97 | + if (!$_POST OR (!empty($_POST) AND (empty($_POST['edit_blog_submit']) OR empty($_POST['blog_name'])))) { |
|
98 | 98 | // if there is post data there is certainly an error in the form |
99 | 99 | if ($_POST) { |
100 | 100 | Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | Display::addFlash( |
247 | 247 | Display::return_message(get_lang('MessageSent')) |
248 | 248 | ); |
249 | - header('Location: ' . api_get_path(WEB_PATH)); |
|
249 | + header('Location: '.api_get_path(WEB_PATH)); |
|
250 | 250 | exit; |
251 | 251 | } |
252 | 252 | } |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | api_is_course_tutor() || api_is_course_coach() |
276 | 276 | ) { |
277 | 277 | $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
278 | - $actions .='<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
279 | - $actions .='<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
278 | + $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
279 | + $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
280 | 280 | |
281 | 281 | $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&exerciseId='.intval($_GET['exerciseId']).'" >'. |
282 | 282 | Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |
@@ -400,8 +400,9 @@ |
||
400 | 400 | $extra .= $form->return_form(); |
401 | 401 | $extra .= '</div>'; |
402 | 402 | |
403 | -if ($is_allowedToEdit) |
|
403 | +if ($is_allowedToEdit) { |
|
404 | 404 | echo $extra; |
405 | +} |
|
405 | 406 | |
406 | 407 | echo $actions; |
407 | 408 |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | if ($is_allowedToEdit && $origin != 'learnpath') { |
74 | 74 | // the form |
75 | 75 | if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) { |
76 | - $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
76 | + $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&path='.Security::remove_XSS($hotpotatoes_path).' ">'.Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
77 | 77 | } |
78 | 78 | } else { |
79 | - $actions .= '<a href="exercise.php">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
79 | + $actions .= '<a href="exercise.php">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($is_allowedToEdit) { |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | if ($is_allowedToEdit || $is_tutor) { |
100 | 100 | $nameTools = get_lang('StudentScore'); |
101 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
101 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
102 | 102 | $objExerciseTmp = new Exercise(); |
103 | 103 | /*if ($objExerciseTmp->read($exercise_id)) { |
104 | 104 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name); |
105 | 105 | }*/ |
106 | 106 | } else { |
107 | - $interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
107 | + $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
108 | 108 | $objExerciseTmp = new Exercise(); |
109 | 109 | /*if ($objExerciseTmp->read($exercise_id)) { |
110 | 110 | $nameTools = get_lang('Results').': '.$objExerciseTmp->name; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $actions = Display::div($actions, array('class'=> 'actions')); |
117 | 117 | |
118 | -$extra = '<script type="text/javascript"> |
|
118 | +$extra = '<script type="text/javascript"> |
|
119 | 119 | $(document).ready(function() { |
120 | 120 | |
121 | 121 | $( "#dialog:ui-dialog" ).dialog( "destroy" ); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // Generating group list |
170 | 170 | |
171 | 171 | $group_list = GroupManager::get_group_list(); |
172 | -$group_parameters = array('group_all:'.get_lang('All'),'group_none:'.get_lang('None')); |
|
172 | +$group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None')); |
|
173 | 173 | |
174 | 174 | foreach ($group_list as $group) { |
175 | 175 | $group_parameters[] = $group['id'].':'.$group['name']; |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | |
193 | 193 | // Column config |
194 | 194 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
195 | - $column_model = array( |
|
196 | - array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
197 | - array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
198 | - array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
199 | - array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
200 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
201 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
202 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
195 | + $column_model = array( |
|
196 | + array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
197 | + array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
|
198 | + array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
199 | + array('name'=>'group_name', 'index'=>'group_id', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
200 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
201 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
202 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
203 | 203 | ); |
204 | 204 | |
205 | 205 | $action_links = ' |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | |
223 | 223 | //Column config |
224 | 224 | // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
225 | - $column_model = array( |
|
226 | - array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
227 | - array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
228 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
225 | + $column_model = array( |
|
226 | + array('name'=>'exe_date', 'index'=>'exe_date', 'width'=>'60', 'align'=>'left', 'search' => 'false'), |
|
227 | + array('name'=>'score', 'index'=>'exe_result', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
|
228 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'60', 'align'=>'left', 'search' => 'false') |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | if (!$is_allowedToEdit) { |
48 | - // api_not_allowed(); |
|
48 | + // api_not_allowed(); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (!empty($_REQUEST['path'])) { |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | get_lang('Actions') |
191 | 191 | ); |
192 | 192 | |
193 | - // Column config |
|
194 | - // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
|
195 | - $column_model = array( |
|
193 | + // Column config |
|
194 | + // @todo fix search firstname/lastname that doesn't work. rmove search for the moment |
|
195 | + $column_model = array( |
|
196 | 196 | array('name'=>'firstname', 'index'=>'firstname', 'width'=>'50', 'align'=>'left', 'search' => 'false'), |
197 | 197 | array('name'=>'lastname', 'index'=>'lastname', 'width'=>'50', 'align'=>'left', 'formatter'=>'action_formatter', 'search' => 'false'), |
198 | 198 | array('name'=>'login', 'hidden'=>'true', 'index'=>'username', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php'); |
19 | 19 | |
20 | 20 | foreach ($file as &$value) { |
21 | - $variable = explode('=', $value , 2); |
|
21 | + $variable = explode('=', $value, 2); |
|
22 | 22 | if (count($variable) > 1) { |
23 | 23 | $variable = substr(trim($variable[0]), 1); |
24 | 24 | $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Hotspot languae conversion |
|
5 | - * @package chamilo.exercise |
|
6 | - */ |
|
4 | + * Hotspot languae conversion |
|
5 | + * @package chamilo.exercise |
|
6 | + */ |
|
7 | 7 | /** |
8 | - * Code |
|
9 | - */ |
|
8 | + * Code |
|
9 | + */ |
|
10 | 10 | session_cache_limiter('none'); |
11 | 11 | |
12 | 12 | $language_file = 'hotspot'; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | $file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php'); |
19 | 19 | |
20 | 20 | foreach ($file as &$value) { |
21 | - $variable = explode('=', $value , 2); |
|
22 | - if (count($variable) > 1) { |
|
23 | - $variable = substr(trim($variable[0]), 1); |
|
24 | - $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
|
25 | - echo $variable; |
|
26 | - } |
|
21 | + $variable = explode('=', $value , 2); |
|
22 | + if (count($variable) > 1) { |
|
23 | + $variable = substr(trim($variable[0]), 1); |
|
24 | + $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; |
|
25 | + echo $variable; |
|
26 | + } |
|
27 | 27 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | function add_category_form($action) { |
148 | 148 | $action = Security::remove_XSS($action); |
149 | 149 | // initiate the object |
150 | - $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action); |
|
150 | + $form = new FormValidator('note', 'post', api_get_self().'?action='.$action); |
|
151 | 151 | // Setting the form elements |
152 | 152 | $form->addElement('header', get_lang('AddACategory')); |
153 | 153 | $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95')); |
@@ -189,19 +189,19 @@ discard block |
||
189 | 189 | |
190 | 190 | function display_add_category() { |
191 | 191 | echo '<div class="actions">'; |
192 | - echo '<a href="exercise.php?' . api_get_cidreq() . '">' . |
|
193 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
194 | - echo '<a href="' . api_get_self() . '?action=addcategory">' . |
|
195 | - Display::return_icon('question_category.gif', get_lang('AddACategory')) . '</a>'; |
|
192 | + echo '<a href="exercise.php?'.api_get_cidreq().'">'. |
|
193 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
194 | + echo '<a href="'.api_get_self().'?action=addcategory">'. |
|
195 | + Display::return_icon('question_category.gif', get_lang('AddACategory')).'</a>'; |
|
196 | 196 | echo '</div>'; |
197 | 197 | echo "<br/>"; |
198 | - echo "<fieldset><legend>" . get_lang('QuestionCategory') . "</legend></fieldset>"; |
|
198 | + echo "<fieldset><legend>".get_lang('QuestionCategory')."</legend></fieldset>"; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | // display goback to category list page link |
202 | 202 | function display_goback() { |
203 | 203 | echo '<div class="actions">'; |
204 | - echo '<a href="' . api_get_self() . '">' . |
|
205 | - Display::return_icon('back.png', get_lang('BackToCategoryList'), array(), 32) . '</a>'; |
|
204 | + echo '<a href="'.api_get_self().'">'. |
|
205 | + Display::return_icon('back.png', get_lang('BackToCategoryList'), array(), 32).'</a>'; |
|
206 | 206 | echo '</div>'; |
207 | 207 | } |
@@ -249,7 +249,7 @@ |
||
249 | 249 | break; |
250 | 250 | case RESULT_DISABLE_SHOW_SCORE_ONLY: |
251 | 251 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) { |
252 | - $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
|
252 | + $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
|
253 | 253 | } |
254 | 254 | else { |
255 | 255 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | require_once '../inc/global.inc.php'; |
14 | 14 | |
15 | -$current_course_tool = TOOL_QUIZ; |
|
15 | +$current_course_tool = TOOL_QUIZ; |
|
16 | 16 | |
17 | 17 | // Clear the exercise session just in case |
18 | 18 | if (isset($_SESSION['objExercise'])) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | if ($time_control) { |
51 | 51 | // Get time left for expiring time |
52 | - $time_left = api_strtotime($clock_expired_time,'UTC') - time(); |
|
52 | + $time_left = api_strtotime($clock_expired_time, 'UTC') - time(); |
|
53 | 53 | |
54 | 54 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/stylesheet/jquery.epiclock.css'); |
55 | 55 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/epiclock/renderers/minute/epiclock.minute.css'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $html = ''; |
74 | 74 | $message = ''; |
75 | -$html.= '<div class="exercise">'; |
|
75 | +$html .= '<div class="exercise">'; |
|
76 | 76 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
77 | 77 | $edit_link = ''; |
78 | 78 | if ($is_allowed_to_edit && $objExercise->sessionId == $sessionId) { |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | $attempt_result['exe_result'], |
178 | 178 | $attempt_result['exe_weighting'] |
179 | 179 | ); |
180 | - $attempt_url = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?'; |
|
181 | - $attempt_url .= api_get_cidreq() . '&show_headers=1&'; |
|
180 | + $attempt_url = api_get_path(WEB_CODE_PATH).'exercice/result.php?'; |
|
181 | + $attempt_url .= api_get_cidreq().'&show_headers=1&'; |
|
182 | 182 | $attempt_url .= http_build_query([ |
183 | 183 | 'id' => $attempt_result['exe_id'] |
184 | 184 | ]); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | get_lang('Show'), |
189 | 189 | $attempt_url, |
190 | 190 | [ |
191 | - 'class' => $btn_class . 'btn btn-default', |
|
191 | + 'class' => $btn_class.'btn btn-default', |
|
192 | 192 | 'data-title' => get_lang('Show'), |
193 | 193 | 'data-size' => 'lg' |
194 | 194 | ] |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | ), |
207 | 207 | 'userIp' => $attempt_result['user_ip'] |
208 | 208 | ); |
209 | - $attempt_link .= " " . $teacher_revised; |
|
209 | + $attempt_link .= " ".$teacher_revised; |
|
210 | 210 | |
211 | 211 | if (in_array( |
212 | 212 | $objExercise->results_disabled, |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | $attempt_message = Display::return_message($attempt_message, 'info'); |
284 | 284 | } |
285 | 285 | if ($visible_return['value'] == true) { |
286 | - $message .= $attempt_message; |
|
286 | + $message .= $attempt_message; |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | 290 | if ($time_control) { |
291 | - $html.= $objExercise->return_time_left_div(); |
|
291 | + $html .= $objExercise->return_time_left_div(); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | $html .= $message; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $table_content, |
309 | 309 | ['class' => 'table-responsive'] |
310 | 310 | ); |
311 | -$html.= '</div>'; |
|
311 | +$html .= '</div>'; |
|
312 | 312 | echo $html; |
313 | 313 | |
314 | 314 | Display::display_footer(); |
@@ -250,8 +250,7 @@ |
||
250 | 250 | case RESULT_DISABLE_SHOW_SCORE_ONLY: |
251 | 251 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) { |
252 | 252 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')); |
253 | - } |
|
254 | - else { |
|
253 | + } else { |
|
255 | 254 | $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details')); |
256 | 255 | } |
257 | 256 | break; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE); |
93 | 93 | |
94 | 94 | if (empty($objExercise)) { |
95 | - $objExercise = new Exercise(); |
|
95 | + $objExercise = new Exercise(); |
|
96 | 96 | $objExercise->read($exercise_id); |
97 | 97 | } |
98 | 98 | $feedback_type = $objExercise->feedback_type; |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | //Only users can see their own results |
101 | 101 | if (!$is_allowedToEdit) { |
102 | 102 | if ($student_id != $current_user_id) { |
103 | - api_not_allowed(true); |
|
103 | + api_not_allowed(true); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | if (isset($_SESSION['gradebook'])) { |
108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
108 | + $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (!empty($gradebook) && $gradebook=='view') { |
112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
112 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $fromlink = ''; |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
125 | 125 | |
126 | 126 | if ($origin != 'learnpath') { |
127 | - Display::display_header(''); |
|
127 | + Display::display_header(''); |
|
128 | 128 | } else { |
129 | 129 | $htmlHeadXtra[] = " |
130 | 130 | <style> |
131 | 131 | body { background: none;} |
132 | 132 | </style> |
133 | 133 | "; |
134 | - Display::display_reduced_header(); |
|
134 | + Display::display_reduced_header(); |
|
135 | 135 | } |
136 | 136 | ?> |
137 | 137 | <script> |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | } else { |
213 | - Display::display_warning_message(get_lang('CantViewResults')); |
|
214 | - $show_results = false; |
|
213 | + Display::display_warning_message(get_lang('CantViewResults')); |
|
214 | + $show_results = false; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
218 | - $show_results = false; |
|
218 | + $show_results = false; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ($show_results || $show_only_total_score) { |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | $exerciseResult = array(); |
261 | 261 | |
262 | 262 | while ($row = Database::fetch_array($result)) { |
263 | - $question_list_from_database[] = $row['question_id']; |
|
264 | - $exerciseResult[$row['question_id']] = $row['answer']; |
|
263 | + $question_list_from_database[] = $row['question_id']; |
|
264 | + $exerciseResult[$row['question_id']] = $row['answer']; |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | //Fixing #2073 Fixing order of questions |
268 | 268 | if (!empty($track_exercise_info['data_tracking'])) { |
269 | - $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
269 | + $temp_question_list = explode(',', $track_exercise_info['data_tracking']); |
|
270 | 270 | |
271 | 271 | // Getting question list from data_tracking |
272 | 272 | if (!empty($temp_question_list)) { |
@@ -306,64 +306,64 @@ discard block |
||
306 | 306 | |
307 | 307 | foreach ($questionList as $questionId) { |
308 | 308 | |
309 | - $choice = $exerciseResult[$questionId]; |
|
310 | - // destruction of the Question object |
|
311 | - unset($objQuestionTmp); |
|
309 | + $choice = $exerciseResult[$questionId]; |
|
310 | + // destruction of the Question object |
|
311 | + unset($objQuestionTmp); |
|
312 | 312 | |
313 | - // creates a temporary Question object |
|
314 | - $objQuestionTmp = Question::read($questionId); |
|
315 | - $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | - $answerType = $objQuestionTmp->selectType(); |
|
313 | + // creates a temporary Question object |
|
314 | + $objQuestionTmp = Question::read($questionId); |
|
315 | + $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | + $answerType = $objQuestionTmp->selectType(); |
|
317 | 317 | |
318 | - // Start buffer |
|
318 | + // Start buffer |
|
319 | 319 | ob_start(); |
320 | 320 | |
321 | 321 | /* Use switch |
322 | 322 | switch ($answerType) { |
323 | 323 | }*/ |
324 | 324 | |
325 | - if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
325 | + if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
|
326 | 326 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
327 | 327 | $questionScore = $question_result['score']; |
328 | 328 | $totalScore += $question_result['score']; |
329 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
330 | - $choice = array(); |
|
329 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
330 | + $choice = array(); |
|
331 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
332 | + $questionScore = $question_result['score']; |
|
333 | + $totalScore += $question_result['score']; |
|
334 | + } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
331 | 335 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
332 | 336 | $questionScore = $question_result['score']; |
333 | 337 | $totalScore += $question_result['score']; |
334 | - } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
338 | + echo '</table>'; |
|
339 | + } elseif ($answerType == FILL_IN_BLANKS) { |
|
335 | 340 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
336 | 341 | $questionScore = $question_result['score']; |
337 | 342 | $totalScore += $question_result['score']; |
338 | - echo '</table>'; |
|
339 | - } elseif ($answerType == FILL_IN_BLANKS) { |
|
343 | + } elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
340 | 344 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
341 | 345 | $questionScore = $question_result['score']; |
342 | 346 | $totalScore += $question_result['score']; |
343 | - } elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
|
347 | + } elseif ($answerType == FREE_ANSWER) { |
|
348 | + $answer = $str; |
|
344 | 349 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
345 | 350 | $questionScore = $question_result['score']; |
346 | 351 | $totalScore += $question_result['score']; |
347 | - } elseif ($answerType == FREE_ANSWER) { |
|
352 | + } elseif ($answerType == ORAL_EXPRESSION) { |
|
348 | 353 | $answer = $str; |
349 | 354 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
350 | 355 | $questionScore = $question_result['score']; |
351 | 356 | $totalScore += $question_result['score']; |
352 | - } elseif ($answerType == ORAL_EXPRESSION) { |
|
353 | - $answer = $str; |
|
354 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
355 | - $questionScore = $question_result['score']; |
|
356 | - $totalScore += $question_result['score']; |
|
357 | 357 | } elseif (in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE])) { |
358 | 358 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
359 | 359 | $questionScore = $question_result['score']; |
360 | 360 | $totalScore += $question_result['score']; |
361 | - } elseif ($answerType == HOT_SPOT) { |
|
362 | - if ($show_results) { |
|
363 | - echo '<table width="500" border="0"><tr> |
|
361 | + } elseif ($answerType == HOT_SPOT) { |
|
362 | + if ($show_results) { |
|
363 | + echo '<table width="500" border="0"><tr> |
|
364 | 364 | <td valign="top" align="center" style="padding-left:0px;" > |
365 | 365 | <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">'; |
366 | - } |
|
366 | + } |
|
367 | 367 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
368 | 368 | $questionScore = $question_result['score']; |
369 | 369 | $totalScore += $question_result['score']; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | <br> |
393 | 393 | "; |
394 | 394 | } |
395 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
395 | + } else if($answerType == HOT_SPOT_DELINEATION) { |
|
396 | 396 | |
397 | 397 | $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database'); |
398 | 398 | |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | </table> |
536 | 536 | "; |
537 | 537 | } |
538 | - } |
|
538 | + } |
|
539 | 539 | |
540 | - if ($show_results) { |
|
541 | - if ($answerType != HOT_SPOT) { |
|
542 | - echo '</table>'; |
|
543 | - } |
|
544 | - } |
|
540 | + if ($show_results) { |
|
541 | + if ($answerType != HOT_SPOT) { |
|
542 | + echo '</table>'; |
|
543 | + } |
|
544 | + } |
|
545 | 545 | |
546 | - $comnt = null; |
|
546 | + $comnt = null; |
|
547 | 547 | |
548 | 548 | if ($show_results) { |
549 | 549 | if ( |
@@ -560,40 +560,40 @@ discard block |
||
560 | 560 | |
561 | 561 | $marksname = ''; |
562 | 562 | |
563 | - if ($isFeedbackAllowed) { |
|
564 | - $name = "fckdiv".$questionId; |
|
565 | - $marksname = "marksName".$questionId; |
|
566 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
567 | - $url_name = get_lang('EditCommentsAndMarks'); |
|
568 | - } else { |
|
569 | - if ($action=='edit') { |
|
570 | - $url_name = get_lang('EditIndividualComment'); |
|
571 | - } else { |
|
572 | - $url_name = get_lang('AddComments'); |
|
573 | - } |
|
574 | - } |
|
563 | + if ($isFeedbackAllowed) { |
|
564 | + $name = "fckdiv".$questionId; |
|
565 | + $marksname = "marksName".$questionId; |
|
566 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
567 | + $url_name = get_lang('EditCommentsAndMarks'); |
|
568 | + } else { |
|
569 | + if ($action=='edit') { |
|
570 | + $url_name = get_lang('EditIndividualComment'); |
|
571 | + } else { |
|
572 | + $url_name = get_lang('AddComments'); |
|
573 | + } |
|
574 | + } |
|
575 | 575 | echo '<br />'; |
576 | 576 | echo Display::url($url_name, 'javascript://', array('class' => 'btn', 'onclick'=>"showfck('".$name."', '".$marksname."');")); |
577 | - echo '<br />'; |
|
577 | + echo '<br />'; |
|
578 | 578 | |
579 | 579 | echo '<div id="feedback_'.$name.'" style="width:100%">'; |
580 | - $comnt = trim(Event::get_comments($id, $questionId)); |
|
581 | - if (empty($comnt)) { |
|
582 | - echo '<br />'; |
|
583 | - } else { |
|
584 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
585 | - } |
|
586 | - echo '</div>'; |
|
580 | + $comnt = trim(Event::get_comments($id, $questionId)); |
|
581 | + if (empty($comnt)) { |
|
582 | + echo '<br />'; |
|
583 | + } else { |
|
584 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
585 | + } |
|
586 | + echo '</div>'; |
|
587 | 587 | |
588 | 588 | echo '<div id="'.$name.'" style="display:none">'; |
589 | - $arrid[] = $questionId; |
|
590 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
591 | - $feedback_form->addElement('html','<br>'); |
|
592 | - $renderer =& $feedback_form->defaultRenderer(); |
|
593 | - $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
594 | - $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
595 | - $comnt = Event::get_comments($id, $questionId); |
|
596 | - $default = array('comments_'.$questionId => $comnt); |
|
589 | + $arrid[] = $questionId; |
|
590 | + $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
591 | + $feedback_form->addElement('html','<br>'); |
|
592 | + $renderer =& $feedback_form->defaultRenderer(); |
|
593 | + $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
|
594 | + $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
|
595 | + $comnt = Event::get_comments($id, $questionId); |
|
596 | + $default = array('comments_'.$questionId => $comnt); |
|
597 | 597 | |
598 | 598 | if ($useAdvancedEditor) { |
599 | 599 | $feedback_form->addElement( |
@@ -610,52 +610,52 @@ discard block |
||
610 | 610 | } else { |
611 | 611 | $feedback_form->addElement('textarea', 'comments_' . $questionId); |
612 | 612 | } |
613 | - $feedback_form->addElement('html','<br>'); |
|
614 | - $feedback_form->setDefaults($default); |
|
615 | - $feedback_form->display(); |
|
616 | - echo '</div>'; |
|
617 | - |
|
618 | - } else { |
|
619 | - $comnt = Event::get_comments($id, $questionId); |
|
620 | - echo '<br />'; |
|
621 | - if (!empty($comnt)) { |
|
622 | - echo '<b>'.get_lang('Feedback').'</b>'; |
|
623 | - echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
624 | - } |
|
625 | - } |
|
626 | - |
|
627 | - if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
628 | - if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
629 | - $marksname = "marksName".$questionId; |
|
613 | + $feedback_form->addElement('html','<br>'); |
|
614 | + $feedback_form->setDefaults($default); |
|
615 | + $feedback_form->display(); |
|
616 | + echo '</div>'; |
|
617 | + |
|
618 | + } else { |
|
619 | + $comnt = Event::get_comments($id, $questionId); |
|
620 | + echo '<br />'; |
|
621 | + if (!empty($comnt)) { |
|
622 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
623 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
624 | + } |
|
625 | + } |
|
626 | + |
|
627 | + if ($is_allowedToEdit && $isFeedbackAllowed) { |
|
628 | + if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
|
629 | + $marksname = "marksName".$questionId; |
|
630 | 630 | echo '<div id="'.$marksname.'" style="display:none">'; |
631 | 631 | echo '<form name="marksform_'.$questionId.'" method="post" action="">'; |
632 | - $arrmarks[] = $questionId; |
|
633 | - echo get_lang("AssignMarks"); |
|
634 | - echo " <select name='marks' id='marks'>"; |
|
635 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
636 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
637 | - } |
|
638 | - echo '</select>'; |
|
639 | - echo '</form><br /></div>'; |
|
640 | - |
|
641 | - if ($questionScore == -1 ) { |
|
642 | - $questionScore = 0; |
|
643 | - echo Display::return_message(get_lang('notCorrectedYet')); |
|
644 | - } |
|
645 | - } else { |
|
646 | - $arrmarks[] = $questionId; |
|
647 | - echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
632 | + $arrmarks[] = $questionId; |
|
633 | + echo get_lang("AssignMarks"); |
|
634 | + echo " <select name='marks' id='marks'>"; |
|
635 | + for ($i=0;$i<=$questionWeighting;$i++) { |
|
636 | + echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
637 | + } |
|
638 | + echo '</select>'; |
|
639 | + echo '</form><br /></div>'; |
|
640 | + |
|
641 | + if ($questionScore == -1 ) { |
|
642 | + $questionScore = 0; |
|
643 | + echo Display::return_message(get_lang('notCorrectedYet')); |
|
644 | + } |
|
645 | + } else { |
|
646 | + $arrmarks[] = $questionId; |
|
647 | + echo '<div id="'.$marksname.'" style="display:none"><form name="marksform_'.$questionId.'" method="post" action=""> |
|
648 | 648 | <select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form><br/ ></div>'; |
649 | - } |
|
650 | - } else { |
|
651 | - if ($questionScore == -1) { |
|
652 | - $questionScore = 0; |
|
653 | - } |
|
654 | - } |
|
655 | - } |
|
649 | + } |
|
650 | + } else { |
|
651 | + if ($questionScore == -1) { |
|
652 | + $questionScore = 0; |
|
653 | + } |
|
654 | + } |
|
655 | + } |
|
656 | 656 | |
657 | 657 | $my_total_score = $questionScore; |
658 | - $my_total_weight = $questionWeighting; |
|
658 | + $my_total_weight = $questionWeighting; |
|
659 | 659 | $totalWeighting += $questionWeighting; |
660 | 660 | $category_was_added_for_this_test = false; |
661 | 661 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | $score = array(); |
703 | 703 | if ($show_results) { |
704 | - $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
704 | + $score['result'] = get_lang('Score')." : ".ExerciseLib::show_score($my_total_score, $my_total_weight, false, false); |
|
705 | 705 | $score['pass'] = $my_total_score >= $my_total_weight ? true : false; |
706 | 706 | $score['type'] = $answerType; |
707 | 707 | $score['score'] = $my_total_score; |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | $score['comments'] = isset($comnt) ? $comnt : null; |
710 | 710 | } |
711 | 711 | |
712 | - unset($objAnswerTmp); |
|
713 | - $i++; |
|
712 | + unset($objAnswerTmp); |
|
713 | + $i++; |
|
714 | 714 | |
715 | 715 | $contents = ob_get_clean(); |
716 | 716 | |
717 | 717 | $question_content = '<div class="question_row">'; |
718 | 718 | |
719 | - if ($show_results) { |
|
719 | + if ($show_results) { |
|
720 | 720 | //Shows question title an description |
721 | - $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
722 | - } |
|
723 | - $counter++; |
|
721 | + $question_content .= $objQuestionTmp->return_header(null, $counter, $score); |
|
722 | + } |
|
723 | + $counter++; |
|
724 | 724 | $question_content .= $contents; |
725 | 725 | $question_content .= '</div>'; |
726 | 726 | $exercise_content .= $question_content; |
@@ -730,12 +730,12 @@ discard block |
||
730 | 730 | |
731 | 731 | //Total score |
732 | 732 | if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
733 | - if ($show_results || $show_only_total_score) { |
|
733 | + if ($show_results || $show_only_total_score) { |
|
734 | 734 | $total_score_text .= '<div class="question_row">'; |
735 | 735 | $my_total_score_temp = $totalScore; |
736 | - if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
737 | - $my_total_score_temp = 0; |
|
738 | - } |
|
736 | + if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) { |
|
737 | + $my_total_score_temp = 0; |
|
738 | + } |
|
739 | 739 | $total_score_text .= ExerciseLib::get_question_ribbon( |
740 | 740 | $objExercise, |
741 | 741 | $my_total_score_temp, |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | true |
744 | 744 | ); |
745 | 745 | $total_score_text .= '</div>'; |
746 | - } |
|
746 | + } |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | if (!empty($category_list) && ($show_results || $show_only_total_score)) { |
@@ -767,25 +767,25 @@ discard block |
||
767 | 767 | } |
768 | 768 | |
769 | 769 | if ($isFeedbackAllowed) { |
770 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
771 | - echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
772 | - echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
773 | - echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
774 | - echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
775 | - echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
776 | - echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
777 | - } else { |
|
778 | - echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
779 | - } |
|
780 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
770 | + if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
771 | + echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
|
772 | + echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
|
773 | + echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
|
774 | + echo '<input type = "hidden" name="student_id" value="'.$student_id.'">'; |
|
775 | + echo '<input type = "hidden" name="total_score" value="'.$totalScore.'"> '; |
|
776 | + echo '<input type = "hidden" name="my_exe_exo_id" value="'.$exercise_id.'"> '; |
|
777 | + } else { |
|
778 | + echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
|
779 | + } |
|
780 | + if ($origin !='learnpath' && $origin!='student_progress') { |
|
781 | 781 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
782 | - ?> |
|
782 | + ?> |
|
783 | 783 | <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"> |
784 | 784 | <?php echo get_lang('CorrectTest'); ?> |
785 | 785 | </button> |
786 | 786 | </form> |
787 | 787 | <?php |
788 | - } |
|
788 | + } |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | //Came from lpstats in a lp |
@@ -802,21 +802,21 @@ discard block |
||
802 | 802 | } |
803 | 803 | |
804 | 804 | if ($origin != 'learnpath') { |
805 | - //we are not in learnpath tool |
|
806 | - Display::display_footer(); |
|
805 | + //we are not in learnpath tool |
|
806 | + Display::display_footer(); |
|
807 | 807 | } else { |
808 | - if (!isset($_GET['fb_type'])) { |
|
809 | - $lp_mode = $_SESSION['lp_mode']; |
|
810 | - $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
811 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
812 | - echo '<script type="text/javascript">'.$href.'</script>'; |
|
813 | - // Record the results in the learning path, using the SCORM interface (API) |
|
814 | - echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
815 | - echo '</body></html>'; |
|
816 | - } else { |
|
817 | - Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
808 | + if (!isset($_GET['fb_type'])) { |
|
809 | + $lp_mode = $_SESSION['lp_mode']; |
|
810 | + $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
|
811 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
812 | + echo '<script type="text/javascript">'.$href.'</script>'; |
|
813 | + // Record the results in the learning path, using the SCORM interface (API) |
|
814 | + echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |
|
815 | + echo '</body></html>'; |
|
816 | + } else { |
|
817 | + Display::display_normal_message(get_lang('ExerciseFinished').' '.get_lang('ToContinueUseMenu')); |
|
818 | 818 | echo '<br />'; |
819 | - } |
|
819 | + } |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | // Destroying the session |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | require_once '../inc/global.inc.php'; |
18 | 18 | $debug = false; |
19 | -if (empty($origin) ) { |
|
19 | +if (empty($origin)) { |
|
20 | 20 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
21 | 21 | } |
22 | 22 | |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
31 | 31 | $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
32 | 32 | $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
33 | -$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
33 | +$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
34 | 34 | |
35 | 35 | // General parameters passed via POST/GET |
36 | -if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST,1)); } |
|
36 | +if ($debug) { error_log('Entered exercise_result.php: '.print_r($_POST, 1)); } |
|
37 | 37 | |
38 | 38 | if (empty($formSent)) { $formSent = isset($_REQUEST['formSent']) ? $_REQUEST['formSent'] : null; } |
39 | 39 | if (empty($exerciseResult)) { $exerciseResult = isset($_SESSION['exerciseResult']) ? $_SESSION['exerciseResult'] : null; } |
40 | -if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null;} |
|
41 | -if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null;} |
|
42 | -if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null;} |
|
43 | -if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null;} |
|
44 | -if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null;} |
|
45 | -if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null;} |
|
46 | -if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;} |
|
47 | -if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;} |
|
40 | +if (empty($questionId)) { $questionId = isset($_REQUEST['questionId']) ? $_REQUEST['questionId'] : null; } |
|
41 | +if (empty($choice)) { $choice = isset($_REQUEST['choice']) ? $_REQUEST['choice'] : null; } |
|
42 | +if (empty($questionNum)) { $questionNum = isset($_REQUEST['num']) ? $_REQUEST['num'] : null; } |
|
43 | +if (empty($nbrQuestions)) { $nbrQuestions = isset($_REQUEST['nbrQuestions']) ? $_REQUEST['nbrQuestions'] : null; } |
|
44 | +if (empty($questionList)) { $questionList = isset($_SESSION['questionList']) ? $_SESSION['questionList'] : null; } |
|
45 | +if (empty($objExercise)) { $objExercise = isset($_SESSION['objExercise']) ? $_SESSION['objExercise'] : null; } |
|
46 | +if (empty($exeId)) { $exeId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; } |
|
47 | +if (empty($action)) { $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; } |
|
48 | 48 | |
49 | 49 | $id = intval($_REQUEST['id']); //exe id |
50 | 50 | |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | if (isset($_SESSION['gradebook'])) { |
108 | - $gradebook= Security::remove_XSS($_SESSION['gradebook']); |
|
108 | + $gradebook = Security::remove_XSS($_SESSION['gradebook']); |
|
109 | 109 | } |
110 | 110 | |
111 | -if (!empty($gradebook) && $gradebook=='view') { |
|
112 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('ToolGradebook')); |
|
111 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
112 | + $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $fromlink = ''; |
116 | 116 | |
117 | -$interbreadcrumb[]= array("url" => "exercise.php?".api_get_cidreq(),"name" => get_lang('Exercises')); |
|
118 | -$interbreadcrumb[]= array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(),"name" => $objExercise->name); |
|
119 | -$interbreadcrumb[]= array("url" => "#","name" => get_lang('Result')); |
|
117 | +$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
118 | +$interbreadcrumb[] = array("url" => "overview.php?exerciseId=".$exercise_id.'&'.api_get_cidreq(), "name" => $objExercise->name); |
|
119 | +$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
|
120 | 120 | |
121 | 121 | $this_section = SECTION_COURSES; |
122 | 122 | |
123 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
124 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
123 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
124 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
125 | 125 | |
126 | 126 | if ($origin != 'learnpath') { |
127 | 127 | Display::display_header(''); |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | // Avoiding the "Score 0/0" message when the exe_id is not set |
179 | 179 | if (!empty($track_exercise_info)) { |
180 | 180 | // if the results_disabled of the Quiz is 1 when block the script |
181 | - $result_disabled = $track_exercise_info['results_disabled']; |
|
181 | + $result_disabled = $track_exercise_info['results_disabled']; |
|
182 | 182 | |
183 | - if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) ) { |
|
183 | + if (!(api_is_platform_admin() || api_is_course_admin() || api_is_course_coach())) { |
|
184 | 184 | if ($result_disabled == 1) { |
185 | 185 | $show_results = false; |
186 | 186 | if ($origin != 'learnpath') { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $show_results = false; |
215 | 215 | } |
216 | 216 | |
217 | -if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) { |
|
217 | +if ($origin == 'learnpath' && !isset($_GET['fb_type'])) { |
|
218 | 218 | $show_results = false; |
219 | 219 | } |
220 | 220 | |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | |
232 | 232 | $i = $totalScore = $totalWeighting = 0; |
233 | 233 | |
234 | -if ($debug > 0){error_log("ExerciseResult: ".print_r($exerciseResult,1)); error_log("QuestionList: ".print_r($questionList,1));} |
|
234 | +if ($debug > 0) {error_log("ExerciseResult: ".print_r($exerciseResult, 1)); error_log("QuestionList: ".print_r($questionList, 1)); } |
|
235 | 235 | |
236 | 236 | $arrques = array(); |
237 | 237 | $arrans = array(); |
238 | 238 | |
239 | -$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
239 | +$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($student_id)." "; |
|
240 | 240 | $sql = "SELECT attempts.question_id, answer |
241 | 241 | FROM $TBL_TRACK_ATTEMPT as attempts |
242 | 242 | INNER JOIN ".$TBL_TRACK_EXERCISES." AS stats_exercises |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $total_weighting = 0; |
292 | 292 | foreach ($questionList as $questionId) { |
293 | 293 | $objQuestionTmp = Question::read($questionId); |
294 | - $total_weighting +=$objQuestionTmp->selectWeighting(); |
|
294 | + $total_weighting += $objQuestionTmp->selectWeighting(); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $counter = 1; |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | unset($objQuestionTmp); |
312 | 312 | |
313 | 313 | // creates a temporary Question object |
314 | - $objQuestionTmp = Question::read($questionId); |
|
315 | - $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | - $answerType = $objQuestionTmp->selectType(); |
|
314 | + $objQuestionTmp = Question::read($questionId); |
|
315 | + $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
316 | + $answerType = $objQuestionTmp->selectType(); |
|
317 | 317 | |
318 | 318 | // Start buffer |
319 | 319 | ob_start(); |
@@ -323,39 +323,39 @@ discard block |
||
323 | 323 | }*/ |
324 | 324 | |
325 | 325 | if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { |
326 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
326 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
327 | 327 | $questionScore = $question_result['score']; |
328 | - $totalScore += $question_result['score']; |
|
329 | - } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
328 | + $totalScore += $question_result['score']; |
|
329 | + } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { |
|
330 | 330 | $choice = array(); |
331 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
331 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
332 | 332 | $questionScore = $question_result['score']; |
333 | 333 | $totalScore += $question_result['score']; |
334 | - } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
335 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
334 | + } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { |
|
335 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
336 | 336 | $questionScore = $question_result['score']; |
337 | 337 | $totalScore += $question_result['score']; |
338 | 338 | echo '</table>'; |
339 | 339 | } elseif ($answerType == FILL_IN_BLANKS) { |
340 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
340 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
341 | 341 | $questionScore = $question_result['score']; |
342 | 342 | $totalScore += $question_result['score']; |
343 | 343 | } elseif ($answerType == GLOBAL_MULTIPLE_ANSWER) { |
344 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
344 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
345 | 345 | $questionScore = $question_result['score']; |
346 | 346 | $totalScore += $question_result['score']; |
347 | 347 | } elseif ($answerType == FREE_ANSWER) { |
348 | 348 | $answer = $str; |
349 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
349 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
350 | 350 | $questionScore = $question_result['score']; |
351 | 351 | $totalScore += $question_result['score']; |
352 | 352 | } elseif ($answerType == ORAL_EXPRESSION) { |
353 | 353 | $answer = $str; |
354 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
354 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
355 | 355 | $questionScore = $question_result['score']; |
356 | 356 | $totalScore += $question_result['score']; |
357 | 357 | } elseif (in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE])) { |
358 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
358 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
359 | 359 | $questionScore = $question_result['score']; |
360 | 360 | $totalScore += $question_result['score']; |
361 | 361 | } elseif ($answerType == HOT_SPOT) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | <td valign="top" align="center" style="padding-left:0px;" > |
365 | 365 | <table border="1" bordercolor="#A4A4A4" style="border-collapse: collapse;" width="552">'; |
366 | 366 | } |
367 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
367 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); |
|
368 | 368 | $questionScore = $question_result['score']; |
369 | 369 | $totalScore += $question_result['score']; |
370 | 370 | |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | <br> |
393 | 393 | "; |
394 | 394 | } |
395 | - } else if($answerType == HOT_SPOT_DELINEATION) { |
|
395 | + } else if ($answerType == HOT_SPOT_DELINEATION) { |
|
396 | 396 | |
397 | - $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database'); |
|
397 | + $question_result = $objExercise->manage_answer($id, $questionId, $choice, 'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database'); |
|
398 | 398 | |
399 | 399 | $questionScore = $question_result['score']; |
400 | 400 | $totalScore += $question_result['score']; |
@@ -414,20 +414,20 @@ discard block |
||
414 | 414 | if ($show_results) { |
415 | 415 | |
416 | 416 | if ($overlap_color) { |
417 | - $overlap_color='green'; |
|
417 | + $overlap_color = 'green'; |
|
418 | 418 | } else { |
419 | - $overlap_color='red'; |
|
419 | + $overlap_color = 'red'; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | if ($missing_color) { |
423 | - $missing_color='green'; |
|
423 | + $missing_color = 'green'; |
|
424 | 424 | } else { |
425 | - $missing_color='red'; |
|
425 | + $missing_color = 'red'; |
|
426 | 426 | } |
427 | 427 | if ($excess_color) { |
428 | - $excess_color='green'; |
|
428 | + $excess_color = 'green'; |
|
429 | 429 | } else { |
430 | - $excess_color='red'; |
|
430 | + $excess_color = 'red'; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | if (!is_numeric($final_overlap)) { |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | $final_excess = 0; |
442 | 442 | } |
443 | 443 | |
444 | - if ($final_excess>100) { |
|
444 | + if ($final_excess > 100) { |
|
445 | 445 | $final_excess = 100; |
446 | 446 | } |
447 | 447 | |
448 | - $table_resume='<table class="data_table"> |
|
448 | + $table_resume = '<table class="data_table"> |
|
449 | 449 | <tr class="row_odd" > |
450 | 450 | <td></td> |
451 | 451 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -455,38 +455,38 @@ discard block |
||
455 | 455 | <tr class="row_even"> |
456 | 456 | <td><b>'.get_lang('Overlap').'</b></td> |
457 | 457 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
458 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
458 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
459 | 459 | </tr> |
460 | 460 | |
461 | 461 | <tr> |
462 | 462 | <td><b>'.get_lang('Excess').'</b></td> |
463 | 463 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
464 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
464 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
465 | 465 | </tr> |
466 | 466 | |
467 | 467 | <tr class="row_even"> |
468 | 468 | <td><b>'.get_lang('Missing').'</b></td> |
469 | 469 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
470 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
470 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
471 | 471 | </tr></table>'; |
472 | 472 | |
473 | - if ($answerType!= HOT_SPOT_DELINEATION) { |
|
474 | - $item_list = explode('@@',$destination); |
|
473 | + if ($answerType != HOT_SPOT_DELINEATION) { |
|
474 | + $item_list = explode('@@', $destination); |
|
475 | 475 | |
476 | 476 | $try = $item_list[0]; |
477 | 477 | $lp = $item_list[1]; |
478 | 478 | $destinationid = $item_list[2]; |
479 | 479 | $url = $item_list[3]; |
480 | - $table_resume=''; |
|
480 | + $table_resume = ''; |
|
481 | 481 | } else { |
482 | - if ($next==0) { |
|
482 | + if ($next == 0) { |
|
483 | 483 | $try = $try_hotspot; |
484 | 484 | $lp = $lp_hotspot; |
485 | - $destinationid= $select_question_hotspot; |
|
486 | - $url=$url_hotspot; |
|
485 | + $destinationid = $select_question_hotspot; |
|
486 | + $url = $url_hotspot; |
|
487 | 487 | } else { |
488 | 488 | //show if no error |
489 | - $comment=$answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
489 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
490 | 490 | $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
491 | 491 | } |
492 | 492 | } |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
495 | 495 | if ($answerType == HOT_SPOT_DELINEATION) { |
496 | 496 | if ($organs_at_risk_hit > 0) { |
497 | - $message='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
498 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
497 | + $message = '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
498 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
499 | 499 | } else { |
500 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
501 | - $message.=$table_resume; |
|
502 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
500 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
501 | + $message .= $table_resume; |
|
502 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
503 | 503 | } |
504 | - $message.='<p>'.$comment.'</p>'; |
|
504 | + $message .= '<p>'.$comment.'</p>'; |
|
505 | 505 | echo $message; |
506 | 506 | } else { |
507 | 507 | echo '<p>'.$comment.'</p>'; |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | //showing the score |
511 | 511 | $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = ".intval($id)." and question_id= ".intval($questionId).""; |
512 | 512 | $resfree = Database::query($queryfree); |
513 | - $questionScore= Database::result($resfree,0,"marks"); |
|
514 | - $totalScore+=$questionScore; |
|
513 | + $questionScore = Database::result($resfree, 0, "marks"); |
|
514 | + $totalScore += $questionScore; |
|
515 | 515 | $relPath = api_get_path(REL_PATH); |
516 | 516 | echo '</table></td></tr>'; |
517 | 517 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION))) { |
567 | 567 | $url_name = get_lang('EditCommentsAndMarks'); |
568 | 568 | } else { |
569 | - if ($action=='edit') { |
|
569 | + if ($action == 'edit') { |
|
570 | 570 | $url_name = get_lang('EditIndividualComment'); |
571 | 571 | } else { |
572 | 572 | $url_name = get_lang('AddComments'); |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | |
588 | 588 | echo '<div id="'.$name.'" style="display:none">'; |
589 | 589 | $arrid[] = $questionId; |
590 | - $feedback_form = new FormValidator('frmcomments'.$questionId,'post',''); |
|
591 | - $feedback_form->addElement('html','<br>'); |
|
592 | - $renderer =& $feedback_form->defaultRenderer(); |
|
590 | + $feedback_form = new FormValidator('frmcomments'.$questionId, 'post', ''); |
|
591 | + $feedback_form->addElement('html', '<br>'); |
|
592 | + $renderer = & $feedback_form->defaultRenderer(); |
|
593 | 593 | $renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>'); |
594 | 594 | $renderer->setCustomElementTemplate('<div align="left">{element}</div>'); |
595 | 595 | $comnt = Event::get_comments($id, $questionId); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | if ($useAdvancedEditor) { |
599 | 599 | $feedback_form->addElement( |
600 | 600 | 'html_editor', |
601 | - 'comments_' . $questionId, |
|
601 | + 'comments_'.$questionId, |
|
602 | 602 | null, |
603 | 603 | null, |
604 | 604 | array( |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | } else { |
611 | - $feedback_form->addElement('textarea', 'comments_' . $questionId); |
|
611 | + $feedback_form->addElement('textarea', 'comments_'.$questionId); |
|
612 | 612 | } |
613 | - $feedback_form->addElement('html','<br>'); |
|
613 | + $feedback_form->addElement('html', '<br>'); |
|
614 | 614 | $feedback_form->setDefaults($default); |
615 | 615 | $feedback_form->display(); |
616 | 616 | echo '</div>'; |
@@ -632,13 +632,13 @@ discard block |
||
632 | 632 | $arrmarks[] = $questionId; |
633 | 633 | echo get_lang("AssignMarks"); |
634 | 634 | echo " <select name='marks' id='marks'>"; |
635 | - for ($i=0;$i<=$questionWeighting;$i++) { |
|
636 | - echo '<option '.(($i==$questionScore)?"selected='selected'":'').'>'.$i.'</option>'; |
|
635 | + for ($i = 0; $i <= $questionWeighting; $i++) { |
|
636 | + echo '<option '.(($i == $questionScore) ? "selected='selected'" : '').'>'.$i.'</option>'; |
|
637 | 637 | } |
638 | 638 | echo '</select>'; |
639 | 639 | echo '</form><br /></div>'; |
640 | 640 | |
641 | - if ($questionScore == -1 ) { |
|
641 | + if ($questionScore == -1) { |
|
642 | 642 | $questionScore = 0; |
643 | 643 | echo Display::return_message(get_lang('notCorrectedYet')); |
644 | 644 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | } |
675 | 675 | |
676 | 676 | if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { |
677 | - foreach($objQuestionTmp->category_list as $category_id) { |
|
677 | + foreach ($objQuestionTmp->category_list as $category_id) { |
|
678 | 678 | $category_list[$category_id]['score'] += $my_total_score; |
679 | 679 | $category_list[$category_id]['total'] += $my_total_weight; |
680 | 680 | $category_was_added_for_this_test = true; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $total_score_text = null; |
730 | 730 | |
731 | 731 | //Total score |
732 | -if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
732 | +if ($origin != 'learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) { |
|
733 | 733 | if ($show_results || $show_only_total_score) { |
734 | 734 | $total_score_text .= '<div class="question_row">'; |
735 | 735 | $my_total_score_temp = $totalScore; |
@@ -761,13 +761,13 @@ discard block |
||
761 | 761 | |
762 | 762 | if ($isFeedbackAllowed) { |
763 | 763 | if (is_array($arrid) && is_array($arrmarks)) { |
764 | - $strids = implode(",",$arrid); |
|
765 | - $marksid = implode(",",$arrmarks); |
|
764 | + $strids = implode(",", $arrid); |
|
765 | + $marksid = implode(",", $arrmarks); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
769 | 769 | if ($isFeedbackAllowed) { |
770 | - if (in_array($origin, array('tracking_course','user_course','correct_exercise_in_lp'))) { |
|
770 | + if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { |
|
771 | 771 | echo '<form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=2&comments=update&exeid='.$id.'&origin='.$origin.'&details=true&course='.Security::remove_XSS($_GET['cidReq']).$fromlink.'" method="post">'; |
772 | 772 | echo '<input type = "hidden" name="lp_item_id" value="'.$learnpath_id.'">'; |
773 | 773 | echo '<input type = "hidden" name="lp_item_view_id" value="'.$lp_item_view_id.'">'; |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } else { |
778 | 778 | echo ' <form name="myform" id="myform" action="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'&filter=1&comments=update&exeid='.$id.'" method="post">'; |
779 | 779 | } |
780 | - if ($origin !='learnpath' && $origin!='student_progress') { |
|
780 | + if ($origin != 'learnpath' && $origin != 'student_progress') { |
|
781 | 781 | echo '<label><input type= "checkbox" name="send_notification"> '.get_lang('SendEmail').'</label>'; |
782 | 782 | ?> |
783 | 783 | <button type="submit" class="btn btn-primary" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"> |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | } |
790 | 790 | |
791 | 791 | //Came from lpstats in a lp |
792 | -if ($origin =='student_progress') { ?> |
|
792 | +if ($origin == 'student_progress') { ?> |
|
793 | 793 | <button type="button" class="back" onclick="window.history.go(-1);" value="<?php echo get_lang('Back'); ?>" > |
794 | - <?php echo get_lang('Back');?></button> |
|
794 | + <?php echo get_lang('Back'); ?></button> |
|
795 | 795 | <?php |
796 | -} else if($origin=='myprogress') { |
|
796 | +} else if ($origin == 'myprogress') { |
|
797 | 797 | ?> |
798 | 798 | <button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" > |
799 | - <?php echo get_lang('Finish');?> |
|
799 | + <?php echo get_lang('Finish'); ?> |
|
800 | 800 | </button> |
801 | 801 | <?php |
802 | 802 | } |
@@ -806,9 +806,9 @@ discard block |
||
806 | 806 | Display::display_footer(); |
807 | 807 | } else { |
808 | 808 | if (!isset($_GET['fb_type'])) { |
809 | - $lp_mode = $_SESSION['lp_mode']; |
|
809 | + $lp_mode = $_SESSION['lp_mode']; |
|
810 | 810 | $url = '../newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type; |
811 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; |
|
811 | + $href = ($lp_mode == 'fullscreen') ? ' window.opener.location.href="'.$url.'" ' : ' top.location.href="'.$url.'" '; |
|
812 | 812 | echo '<script type="text/javascript">'.$href.'</script>'; |
813 | 813 | // Record the results in the learning path, using the SCORM interface (API) |
814 | 814 | echo "<script>window.parent.API.void_save_asset('$totalScore', '$totalWeighting', 0, 'completed'); </script>"; |