@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | * an up and down icon except for the first (no up icon) and the last (no down icon) |
1059 | 1059 | * The key of this $list array is the id of the item. |
1060 | 1060 | * |
1061 | - * @return void HTML |
|
1061 | + * @return string HTML |
|
1062 | 1062 | **/ |
1063 | 1063 | function return_up_down_icon($content, $id, $list) |
1064 | 1064 | { |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | * This function retrieves forum thread users details |
2012 | 2012 | * @param int Thread ID |
2013 | 2013 | * @param string Course DB name (optional) |
2014 | - * @return resource array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2014 | + * @return Doctrine\DBAL\Driver\Statement|null array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2015 | 2015 | * @author Christian Fasanando <[email protected]>, |
2016 | 2016 | * @todo this function need to be improved |
2017 | 2017 | * @version octubre 2008, dokeos 1.8 |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | * This function retrieves forum thread users qualify |
2067 | 2067 | * @param int Thread ID |
2068 | 2068 | * @param string Course DB name (optional) |
2069 | - * @return array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2069 | + * @return Doctrine\DBAL\Driver\Statement|null Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2070 | 2070 | * @author Jhon Hinojosa |
2071 | 2071 | * @todo this function need to be improved |
2072 | 2072 | */ |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | * This function retrieves forum thread users not qualify |
2134 | 2134 | * @param int Thread ID |
2135 | 2135 | * @param string Course DB name (optional) |
2136 | - * @return array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2136 | + * @return Doctrine\DBAL\Driver\Statement|null Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[]) |
|
2137 | 2137 | * @author Jhon Hinojosa<[email protected]>, |
2138 | 2138 | * @version oct 2008, dokeos 1.8 |
2139 | 2139 | */ |
@@ -3163,6 +3163,10 @@ discard block |
||
3163 | 3163 | * @param integer contains the information the current user id |
3164 | 3164 | * @param integer contains the information the current thread id |
3165 | 3165 | * @param integer contains the information the current qualify |
3166 | + * @param string $option |
|
3167 | + * @param integer $course_id |
|
3168 | + * @param integer $user_id |
|
3169 | + * @param integer $thread_id |
|
3166 | 3170 | * @return void |
3167 | 3171 | * <code>$option=1 obtained the qualification of the current thread</code> |
3168 | 3172 | * @author Isaac Flores <[email protected]>, U.N.A.S University |
@@ -3722,6 +3726,8 @@ discard block |
||
3722 | 3726 | * |
3723 | 3727 | * @author Patrick Cool <[email protected]>, Ghent University |
3724 | 3728 | * @version february 2006, dokeos 1.8 |
3729 | + * @param string $last_post_id |
|
3730 | + * @param string $post_date |
|
3725 | 3731 | */ |
3726 | 3732 | function updateThreadInfo($thread_id, $last_post_id, $post_date) |
3727 | 3733 | { |
@@ -4025,6 +4031,8 @@ discard block |
||
4025 | 4031 | * |
4026 | 4032 | * @param string Content type (post, thread, forum, forum_category) |
4027 | 4033 | * @param int Item DB ID |
4034 | + * @param string $content |
|
4035 | + * @param integer $id |
|
4028 | 4036 | * @return string language variable |
4029 | 4037 | * @author Patrick Cool <[email protected]>, Ghent University |
4030 | 4038 | * @version february 2006, dokeos 1.8 |
@@ -4461,6 +4469,7 @@ discard block |
||
4461 | 4469 | /** |
4462 | 4470 | * Display the search results |
4463 | 4471 | * @param string |
4472 | + * @param string $search_term |
|
4464 | 4473 | * @return void display the results |
4465 | 4474 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
4466 | 4475 | * @version march 2008, dokeos 1.8.5 |
@@ -4590,7 +4599,7 @@ discard block |
||
4590 | 4599 | * This function adds an attachment file into a forum |
4591 | 4600 | * @param string $file_comment a comment about file |
4592 | 4601 | * @param int $last_id from forum_post table |
4593 | - * @return int|bool |
|
4602 | + * @return false|null |
|
4594 | 4603 | */ |
4595 | 4604 | function add_forum_attachment_file($file_comment, $last_id) |
4596 | 4605 | { |
@@ -4801,7 +4810,7 @@ discard block |
||
4801 | 4810 | * @param post id |
4802 | 4811 | * @param int $id_attach |
4803 | 4812 | * @param bool $display to show or not result message |
4804 | - * @return void |
|
4813 | + * @return integer |
|
4805 | 4814 | * @author Julio Montoya Dokeos |
4806 | 4815 | * @version october 2014, chamilo 1.9.8 |
4807 | 4816 | */ |
@@ -5083,7 +5092,7 @@ discard block |
||
5083 | 5092 | * @param integer $forum_id the id of the forum |
5084 | 5093 | * @param integer $thread_id the id of the thread |
5085 | 5094 | * @param integer $post_id the id of the post |
5086 | - * @return bool |
|
5095 | + * @return false|null |
|
5087 | 5096 | * |
5088 | 5097 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
5089 | 5098 | * @version May 2008, dokeos 1.8.5 |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | var l = $(this); |
64 | 64 | var id = l.closest("tr").attr("id"); |
65 | 65 | var filename = l.closest("tr").find(".attachFilename").html(); |
66 | - if (confirm("' . get_lang('AreYouSureToDeleteJS') . '", filename)) { |
|
66 | + if (confirm("' . get_lang('AreYouSureToDeleteJS').'", filename)) { |
|
67 | 67 | $.ajax({ |
68 | 68 | type: "POST", |
69 | - url: "'.api_get_path(WEB_AJAX_PATH) . 'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId .'&forum='.$forumId .'", |
|
69 | + url: "'.api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&a=delete_file&attachId=" + id +"&thread='.$threadId.'&forum='.$forumId.'", |
|
70 | 70 | dataType: "json", |
71 | 71 | success: function(data) { |
72 | 72 | if (data.error == false) { |
@@ -973,24 +973,24 @@ discard block |
||
973 | 973 | $html = ''; |
974 | 974 | $id = Security::remove_XSS($id); |
975 | 975 | if ($current_visibility_status == '1') { |
976 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&'; |
|
976 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
|
977 | 977 | if (is_array($additional_url_parameters)) { |
978 | 978 | foreach ($additional_url_parameters as $key => $value) { |
979 | - $html .= $key . '=' . $value . '&'; |
|
979 | + $html .= $key.'='.$value.'&'; |
|
980 | 980 | } |
981 | 981 | } |
982 | - $html.='action=invisible&content='.$content.'&id='.$id.'">'. |
|
982 | + $html .= 'action=invisible&content='.$content.'&id='.$id.'">'. |
|
983 | 983 | Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>'; |
984 | 984 | } |
985 | 985 | if ($current_visibility_status == '0') { |
986 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&'; |
|
986 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
|
987 | 987 | if (is_array($additional_url_parameters)) { |
988 | 988 | foreach ($additional_url_parameters as $key => $value) { |
989 | - $html .= $key . '=' . $value . '&'; |
|
989 | + $html .= $key.'='.$value.'&'; |
|
990 | 990 | } |
991 | 991 | } |
992 | - $html .= 'action=visible&content=' . $content . '&id=' . $id . '">' . |
|
993 | - Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
992 | + $html .= 'action=visible&content='.$content.'&id='.$id.'">'. |
|
993 | + Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL).'</a>'; |
|
994 | 994 | } |
995 | 995 | return $html; |
996 | 996 | } |
@@ -1011,21 +1011,21 @@ discard block |
||
1011 | 1011 | $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
1012 | 1012 | if (is_array($additional_url_parameters)) { |
1013 | 1013 | foreach ($additional_url_parameters as $key => $value) { |
1014 | - $html .= $key . '=' . $value . '&'; |
|
1014 | + $html .= $key.'='.$value.'&'; |
|
1015 | 1015 | } |
1016 | 1016 | } |
1017 | - $html.= 'action=unlock&content='.$content.'&id='.$id.'">'. |
|
1017 | + $html .= 'action=unlock&content='.$content.'&id='.$id.'">'. |
|
1018 | 1018 | Display::return_icon('lock.png', get_lang('Unlock'), array(), ICON_SIZE_SMALL).'</a>'; |
1019 | 1019 | } |
1020 | 1020 | if ($current_lock_status == '0') { |
1021 | 1021 | $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&'; |
1022 | 1022 | if (is_array($additional_url_parameters)) { |
1023 | 1023 | foreach ($additional_url_parameters as $key => $value) { |
1024 | - $html .= $key . '=' . $value . '&'; |
|
1024 | + $html .= $key.'='.$value.'&'; |
|
1025 | 1025 | } |
1026 | 1026 | } |
1027 | - $html .= 'action=lock&content=' . $content . '&id=' . $id . '">' . |
|
1028 | - Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
1027 | + $html .= 'action=lock&content='.$content.'&id='.$id.'">'. |
|
1028 | + Display::return_icon('unlock.png', get_lang('Lock'), array(), ICON_SIZE_SMALL).'</a>'; |
|
1029 | 1029 | } |
1030 | 1030 | return $html; |
1031 | 1031 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | forum_categories.c_id = $course_id AND |
1229 | 1229 | item_properties.c_id = $course_id AND |
1230 | 1230 | forum_categories.cat_id=item_properties.ref AND |
1231 | - item_properties.tool='" . TOOL_FORUM_CATEGORY . "' |
|
1231 | + item_properties.tool='".TOOL_FORUM_CATEGORY."' |
|
1232 | 1232 | ORDER BY forum_categories.cat_order $sort_direction"; |
1233 | 1233 | } |
1234 | 1234 | if ($content == 'forum') { |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | FROM $table |
1237 | 1237 | WHERE |
1238 | 1238 | c_id = $course_id AND |
1239 | - forum_category='" . Database::escape_string($forum_category) . "' |
|
1239 | + forum_category='".Database::escape_string($forum_category)."' |
|
1240 | 1240 | ORDER BY forum_order $sort_direction"; |
1241 | 1241 | } |
1242 | 1242 | // Finding the items that need to be switched. |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | { |
1294 | 1294 | $current_visibility_status = intval($current_visibility_status); |
1295 | 1295 | if ($current_visibility_status == 0) { |
1296 | - $status='invisible'; |
|
1296 | + $status = 'invisible'; |
|
1297 | 1297 | return $status; |
1298 | 1298 | } |
1299 | 1299 | } |
@@ -2202,7 +2202,7 @@ discard block |
||
2202 | 2202 | { |
2203 | 2203 | $table_forums = Database :: get_course_table(TABLE_FORUM); |
2204 | 2204 | $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
2205 | - $courseId = empty($courseId) ? api_get_course_int_id(): intval($courseId); |
|
2205 | + $courseId = empty($courseId) ? api_get_course_int_id() : intval($courseId); |
|
2206 | 2206 | $forum_id = intval($forum_id); |
2207 | 2207 | |
2208 | 2208 | $sql = "SELECT * |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | */ |
2362 | 2362 | function store_thread($current_forum, $values, $courseInfo = array(), $showMessage = true) |
2363 | 2363 | { |
2364 | - $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo ; |
|
2364 | + $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo; |
|
2365 | 2365 | $_user = api_get_user_info(); |
2366 | 2366 | $course_id = $courseInfo['real_id']; |
2367 | 2367 | $courseCode = $courseInfo['code']; |
@@ -2603,11 +2603,11 @@ discard block |
||
2603 | 2603 | $form = new FormValidator( |
2604 | 2604 | 'thread', |
2605 | 2605 | 'post', |
2606 | - api_get_self() . '?' . http_build_query([ |
|
2606 | + api_get_self().'?'.http_build_query([ |
|
2607 | 2607 | 'forum' => $myForum, |
2608 | 2608 | 'gradebook' => $myGradebook, |
2609 | 2609 | 'thread' => $myThread, |
2610 | - ]) . '&' . api_get_cidreq() |
|
2610 | + ]).'&'.api_get_cidreq() |
|
2611 | 2611 | ); |
2612 | 2612 | |
2613 | 2613 | $form->addElement('header', get_lang('EditThread')); |
@@ -2671,7 +2671,7 @@ discard block |
||
2671 | 2671 | $form->addElement('html', '</div>'); |
2672 | 2672 | |
2673 | 2673 | if (!empty($formValues)) { |
2674 | - $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0 ; |
|
2674 | + $defaults['thread_qualify_gradebook'] = ($formValues['threadQualifyMax'] > 0 && empty($_POST)) ? 1 : 0; |
|
2675 | 2675 | $defaults['thread_title'] = prepare4display($formValues['threadTitle']); |
2676 | 2676 | $defaults['thread_sticky'] = strval(intval($formValues['threadSticky'])); |
2677 | 2677 | $defaults['thread_peer_qualify'] = intval($formValues['threadPeerQualify']); |
@@ -2743,13 +2743,13 @@ discard block |
||
2743 | 2743 | $form = new FormValidator( |
2744 | 2744 | 'thread', |
2745 | 2745 | 'post', |
2746 | - api_get_self() . '?' . http_build_query([ |
|
2746 | + api_get_self().'?'.http_build_query([ |
|
2747 | 2747 | 'forum' => intval($my_forum), |
2748 | 2748 | 'gradebook' => $my_gradebook, |
2749 | 2749 | 'thread' => intval($myThread), |
2750 | 2750 | 'post' => intval($my_post), |
2751 | 2751 | 'action' => $action, |
2752 | - ]) . '&' . api_get_cidreq() |
|
2752 | + ]).'&'.api_get_cidreq() |
|
2753 | 2753 | ); |
2754 | 2754 | $form->setConstants(array('forum' => '5')); |
2755 | 2755 | |
@@ -3012,7 +3012,7 @@ discard block |
||
3012 | 3012 | |
3013 | 3013 | if ($row[0] == 0) { |
3014 | 3014 | $sql = "INSERT INTO $table_threads_qualify (c_id, user_id, thread_id,qualify,qualify_user_id,qualify_time,session_id) |
3015 | - VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float)$thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')"; |
|
3015 | + VALUES (".$course_id.", '".$user_id."','".$thread_id."',".(float) $thread_qualify.", '".$currentUserId."','".$qualify_time."','".$session_id."')"; |
|
3016 | 3016 | Database::query($sql); |
3017 | 3017 | |
3018 | 3018 | $insertId = Database::insert_id(); |
@@ -4678,9 +4678,9 @@ discard block |
||
4678 | 4678 | continue; |
4679 | 4679 | } |
4680 | 4680 | |
4681 | - $course_dir = $_course['path'] . '/upload/forum'; |
|
4681 | + $course_dir = $_course['path'].'/upload/forum'; |
|
4682 | 4682 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
4683 | - $updir = $sys_course_path . $course_dir; |
|
4683 | + $updir = $sys_course_path.$course_dir; |
|
4684 | 4684 | |
4685 | 4685 | // Try to add an extension to the file if it hasn't one. |
4686 | 4686 | $new_file_name = add_ext_on_mime( |
@@ -4697,7 +4697,7 @@ discard block |
||
4697 | 4697 | } |
4698 | 4698 | |
4699 | 4699 | $new_file_name = uniqid(''); |
4700 | - $new_path = $updir . '/' . $new_file_name; |
|
4700 | + $new_path = $updir.'/'.$new_file_name; |
|
4701 | 4701 | $result = @move_uploaded_file($attachment['tmp_name'], $new_path); |
4702 | 4702 | $safe_file_comment = Database::escape_string($file_comment); |
4703 | 4703 | $safe_file_name = Database::escape_string($file_name); |
@@ -4862,16 +4862,16 @@ discard block |
||
4862 | 4862 | $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
4863 | 4863 | $course_id = api_get_course_int_id(); |
4864 | 4864 | |
4865 | - $cond = (!empty($id_attach)) ? " iid = " . (int) $id_attach . "" : " post_id = " . (int) $post_id . ""; |
|
4865 | + $cond = (!empty($id_attach)) ? " iid = ".(int) $id_attach."" : " post_id = ".(int) $post_id.""; |
|
4866 | 4866 | $sql = "SELECT path FROM $forum_table_attachment WHERE c_id = $course_id AND $cond"; |
4867 | 4867 | $res = Database::query($sql); |
4868 | 4868 | $row = Database::fetch_array($res); |
4869 | 4869 | |
4870 | - $course_dir = $_course['path'] . '/upload/forum'; |
|
4870 | + $course_dir = $_course['path'].'/upload/forum'; |
|
4871 | 4871 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
4872 | - $updir = $sys_course_path . $course_dir; |
|
4872 | + $updir = $sys_course_path.$course_dir; |
|
4873 | 4873 | $my_path = isset($row['path']) ? $row['path'] : null; |
4874 | - $file = $updir . '/' . $my_path; |
|
4874 | + $file = $updir.'/'.$my_path; |
|
4875 | 4875 | if (Security::check_abs_path($file, $updir)) { |
4876 | 4876 | @unlink($file); |
4877 | 4877 | } |
@@ -5419,35 +5419,35 @@ discard block |
||
5419 | 5419 | $post_list = get_thread_user_post_limit($course_code, $thread['thread_id'], $user_id, 1); |
5420 | 5420 | $post_counter = count($post_list); |
5421 | 5421 | if (is_array($post_list) && count($post_list) > 0) { |
5422 | - $hand_forums.= '<div id="social-thread">'; |
|
5423 | - $hand_forums.= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM); |
|
5424 | - $hand_forums.= ' '.Security::remove_XSS($thread['thread_title'], STUDENT); |
|
5425 | - $hand_forums.= '</div>'; |
|
5422 | + $hand_forums .= '<div id="social-thread">'; |
|
5423 | + $hand_forums .= Display::return_icon('thread.png', get_lang('Thread'), '', ICON_SIZE_MEDIUM); |
|
5424 | + $hand_forums .= ' '.Security::remove_XSS($thread['thread_title'], STUDENT); |
|
5425 | + $hand_forums .= '</div>'; |
|
5426 | 5426 | |
5427 | 5427 | foreach ($post_list as $posts) { |
5428 | - $hand_forums.= '<div id="social-post">'; |
|
5429 | - $hand_forums.= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>'; |
|
5430 | - $hand_forums.= '<br / >'; |
|
5431 | - $hand_forums.= Security::remove_XSS($posts['post_text'], STUDENT); |
|
5432 | - $hand_forums.= '</div>'; |
|
5433 | - $hand_forums.= '<br / >'; |
|
5428 | + $hand_forums .= '<div id="social-post">'; |
|
5429 | + $hand_forums .= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>'; |
|
5430 | + $hand_forums .= '<br / >'; |
|
5431 | + $hand_forums .= Security::remove_XSS($posts['post_text'], STUDENT); |
|
5432 | + $hand_forums .= '</div>'; |
|
5433 | + $hand_forums .= '<br / >'; |
|
5434 | 5434 | } |
5435 | 5435 | } |
5436 | 5436 | } |
5437 | 5437 | $i++; |
5438 | 5438 | } |
5439 | - $forum_results .='<div id="social-forum">'; |
|
5440 | - $forum_results .='<div class="clear"></div><br />'; |
|
5441 | - $forum_results .='<div id="social-forum-title">'. |
|
5439 | + $forum_results .= '<div id="social-forum">'; |
|
5440 | + $forum_results .= '<div class="clear"></div><br />'; |
|
5441 | + $forum_results .= '<div id="social-forum-title">'. |
|
5442 | 5442 | Display::return_icon('forum.gif', get_lang('Forum')).' '.Security::remove_XSS($forum['forum_title'], STUDENT). |
5443 | 5443 | '<div style="float:right;margin-top:-35px"> |
5444 | 5444 | <a href="../forum/viewforum.php?cidReq='.$course_code.'&gidReq=&forum='.$forum['forum_id'].' " >'.get_lang('SeeForum').'</a> |
5445 | 5445 | </div></div>'; |
5446 | - $forum_results .='<br / >'; |
|
5446 | + $forum_results .= '<br / >'; |
|
5447 | 5447 | if ($post_counter > 0) { |
5448 | - $forum_results .=$hand_forums; |
|
5448 | + $forum_results .= $hand_forums; |
|
5449 | 5449 | } |
5450 | - $forum_results .='</div>'; |
|
5450 | + $forum_results .= '</div>'; |
|
5451 | 5451 | }$j++; |
5452 | 5452 | } |
5453 | 5453 | } |
@@ -5588,16 +5588,16 @@ discard block |
||
5588 | 5588 | $courseId = intval($courseId); |
5589 | 5589 | if (empty($courseId)) { |
5590 | 5590 | // $courseId can be null, use api method |
5591 | - $courseId= api_get_course_int_id(); |
|
5591 | + $courseId = api_get_course_int_id(); |
|
5592 | 5592 | } |
5593 | 5593 | /* |
5594 | 5594 | * Check if Attachment ID and Course ID are greater than zero |
5595 | 5595 | * and array of field values is not empty |
5596 | 5596 | */ |
5597 | 5597 | if ($id > 0 && $courseId > 0 && !empty($array) && is_array($array)) { |
5598 | - foreach($array as $key => &$item) { |
|
5598 | + foreach ($array as $key => &$item) { |
|
5599 | 5599 | $item = Database::escape_string($item); |
5600 | - $setString .= $key . ' = "' .$item . '", '; |
|
5600 | + $setString .= $key.' = "'.$item.'", '; |
|
5601 | 5601 | } |
5602 | 5602 | // Delete last comma |
5603 | 5603 | $setString = substr($setString, 0, strlen($setString) - 2); |
@@ -5641,7 +5641,7 @@ discard block |
||
5641 | 5641 | return ''; |
5642 | 5642 | } |
5643 | 5643 | |
5644 | - $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum=' . $forumId . '&thread=' . $threadId . '&postId=' . $postId . '&a=upload_file'; |
|
5644 | + $url = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'&postId='.$postId.'&a=upload_file'; |
|
5645 | 5645 | |
5646 | 5646 | $multipleForm = new FormValidator('post'); |
5647 | 5647 | $multipleForm->addMultipleUpload($url); |
@@ -5682,10 +5682,10 @@ discard block |
||
5682 | 5682 | foreach ($uploadedFiles as $k => $uploadedFile) { |
5683 | 5683 | if (!empty($uploadedFile) && in_array($uploadedFile['id'], $attachIds)) { |
5684 | 5684 | // Buil html table including an input with attachmentID |
5685 | - $fileDataContent .= '<tr id="' . $uploadedFile['id'] . '" ><td>' . $uploadedFile['name'] . '</td><td>' . $uploadedFile['size'] . '</td><td> ' . $uploadedFile['result'] . |
|
5686 | - ' </td><td> <input style="width:90%;" type="text" value="' . $uploadedFile['comment'] . '" name="file_comments[]"> </td><td>' . |
|
5687 | - $uploadedFile['delete'] . '</td>' . |
|
5688 | - '<input type="hidden" value="' . $uploadedFile['id'] .'" name="file_ids[]">' . '</tr>'; |
|
5685 | + $fileDataContent .= '<tr id="'.$uploadedFile['id'].'" ><td>'.$uploadedFile['name'].'</td><td>'.$uploadedFile['size'].'</td><td> '.$uploadedFile['result']. |
|
5686 | + ' </td><td> <input style="width:90%;" type="text" value="'.$uploadedFile['comment'].'" name="file_comments[]"> </td><td>'. |
|
5687 | + $uploadedFile['delete'].'</td>'. |
|
5688 | + '<input type="hidden" value="'.$uploadedFile['id'].'" name="file_ids[]">'.'</tr>'; |
|
5689 | 5689 | } else { |
5690 | 5690 | /* |
5691 | 5691 | * If attachment data is empty, then delete it from $_SESSION |
@@ -5698,7 +5698,7 @@ discard block |
||
5698 | 5698 | $style = empty($fileDataContent) ? 'display: none;' : ''; |
5699 | 5699 | // Forum attachment Ajax table |
5700 | 5700 | $fileData = ' |
5701 | - <div class="control-group " style="'. $style . '"> |
|
5701 | + <div class="control-group " style="'. $style.'"> |
|
5702 | 5702 | <label class="control-label">'.get_lang('AttachmentList').'</label> |
5703 | 5703 | <div class="controls"> |
5704 | 5704 | <table id="attachmentFileList" class="files data_table span10"> |
@@ -5770,7 +5770,7 @@ discard block |
||
5770 | 5770 | // name contains an URL to download attachment file and its filename |
5771 | 5771 | $json['name'] = Display::url( |
5772 | 5772 | api_htmlentities($row['filename']), |
5773 | - api_get_path(WEB_CODE_PATH) . 'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(), |
|
5773 | + api_get_path(WEB_CODE_PATH).'forum/download.php?file='.$row['path'].'&'.api_get_cidreq(), |
|
5774 | 5774 | array('target'=>'_blank', 'class' => 'attachFilename') |
5775 | 5775 | ); |
5776 | 5776 | $json['id'] = $row['iid']; |
@@ -5781,9 +5781,9 @@ discard block |
||
5781 | 5781 | if (!empty($row) && is_array($row)) { |
5782 | 5782 | // Set result as success and bring delete URL |
5783 | 5783 | $json['result'] = Display::return_icon('accept.png', get_lang('Uploaded')); |
5784 | - $url = api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&action=delete_attach&forum=' . $forumId . '&thread=' . $threadId.'&id_attach=' . $row['iid']; |
|
5784 | + $url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid']; |
|
5785 | 5785 | $json['delete'] = Display::url( |
5786 | - Display::return_icon('delete.png',get_lang('Delete'), array(), ICON_SIZE_SMALL), |
|
5786 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), |
|
5787 | 5787 | $url, |
5788 | 5788 | array('class' => 'deleteLink') |
5789 | 5789 | ); |
@@ -5872,7 +5872,7 @@ discard block |
||
5872 | 5872 | WHERE c_id = $courseId AND post_id = $postId"; |
5873 | 5873 | $result = Database::query($sql); |
5874 | 5874 | if ($result !== false && Database::num_rows($result) > 0) { |
5875 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
5875 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
5876 | 5876 | $array[] = $row['id']; |
5877 | 5877 | } |
5878 | 5878 | } |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | $html .= $key . '=' . $value . '&'; |
988 | 988 | } |
989 | 989 | } |
990 | - $html.='action=invisible&content='.$content.'&id='.$id.'">'. |
|
991 | - Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>'; |
|
990 | + $html.='action=invisible&content='.$content.'&id='.$id.'">'. |
|
991 | + Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_SMALL).'</a>'; |
|
992 | 992 | } |
993 | 993 | if ($current_visibility_status == '0') { |
994 | 994 | $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&'; |
@@ -997,8 +997,8 @@ discard block |
||
997 | 997 | $html .= $key . '=' . $value . '&'; |
998 | 998 | } |
999 | 999 | } |
1000 | - $html .= 'action=visible&content=' . $content . '&id=' . $id . '">' . |
|
1001 | - Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
1000 | + $html .= 'action=visible&content=' . $content . '&id=' . $id . '">' . |
|
1001 | + Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
1002 | 1002 | } |
1003 | 1003 | return $html; |
1004 | 1004 | } |
@@ -372,7 +372,7 @@ |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
375 | - * @return array|string |
|
375 | + * @return string |
|
376 | 376 | */ |
377 | 377 | public function get_type_name() |
378 | 378 | { |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | in exercice/exercice.php, look for note-query-exe-results marker*/ |
195 | 195 | $session_id = api_get_session_id(); |
196 | 196 | $courseId = $this->getCourseId(); |
197 | - $exercise = new Exercise($courseId); |
|
197 | + $exercise = new Exercise($courseId); |
|
198 | 198 | $exercise->read($this->get_ref_id()); |
199 | 199 | |
200 | 200 | if (!$this->is_hp) { |
201 | 201 | |
202 | - if ($exercise->exercise_was_added_in_lp == false) { |
|
203 | - $sql = "SELECT * FROM $tblStats |
|
202 | + if ($exercise->exercise_was_added_in_lp == false) { |
|
203 | + $sql = "SELECT * FROM $tblStats |
|
204 | 204 | WHERE |
205 | 205 | exe_exo_id = ".intval($this->get_ref_id())." AND |
206 | 206 | orig_lp_id = 0 AND |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | session_id = $session_id AND |
210 | 210 | c_id = $courseId |
211 | 211 | "; |
212 | - } else { |
|
213 | - $lpId = null; |
|
214 | - if (!empty($exercise->lpList)) { |
|
215 | - // Taking only the first LP |
|
216 | - $lpId = current($exercise->lpList); |
|
217 | - $lpId = $lpId['lp_id']; |
|
218 | - } |
|
219 | - |
|
220 | - $sql = "SELECT * FROM $tblStats |
|
212 | + } else { |
|
213 | + $lpId = null; |
|
214 | + if (!empty($exercise->lpList)) { |
|
215 | + // Taking only the first LP |
|
216 | + $lpId = current($exercise->lpList); |
|
217 | + $lpId = $lpId['lp_id']; |
|
218 | + } |
|
219 | + |
|
220 | + $sql = "SELECT * FROM $tblStats |
|
221 | 221 | WHERE |
222 | 222 | exe_exo_id = ".intval($this->get_ref_id())." AND |
223 | 223 | orig_lp_id = $lpId AND |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | session_id = $session_id AND |
226 | 226 | c_id = $courseId |
227 | 227 | "; |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | if (!empty($stud_id) && $type != 'ranking') { |
231 | 231 | $sql .= " AND exe_user_id = $stud_id "; |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | SELECT ref_id FROM '.$tbl_grade_links.' |
46 | 46 | WHERE |
47 | 47 | type = '.LINK_EXERCISE." AND |
48 | - c_id = '" . intval($this->course_id) . "' |
|
48 | + c_id = '" . intval($this->course_id)."' |
|
49 | 49 | ) AND |
50 | 50 | exe.c_id = ".$this->course_id; |
51 | 51 | |
52 | 52 | $result = Database::query($sql); |
53 | 53 | $cats = array(); |
54 | - while ($data=Database::fetch_array($result)) { |
|
55 | - $cats[] = array ($data['id'], $data['title']); |
|
54 | + while ($data = Database::fetch_array($result)) { |
|
55 | + $cats[] = array($data['id'], $data['title']); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | return $cats; |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $cats = array(); |
117 | 117 | if (isset($result)) { |
118 | 118 | if (Database::num_rows($result) > 0) { |
119 | - while ($data=Database::fetch_array($result)) { |
|
120 | - $cats[] = array ($data['id'], $data['title']); |
|
119 | + while ($data = Database::fetch_array($result)) { |
|
120 | + $cats[] = array($data['id'], $data['title']); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
125 | 125 | if (isset($result2)) { |
126 | 126 | if (Database::num_rows($result2) > 0) { |
127 | - while ($row=Database::fetch_array($result2)) { |
|
127 | + while ($row = Database::fetch_array($result2)) { |
|
128 | 128 | /*$path = $data['path']; |
129 | 129 | $fname = GetQuizName($path,$documentPath); |
130 | 130 | $cats[] = array ($data['id'], $fname);*/ |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | WHERE |
171 | 171 | session_id = $session_id AND |
172 | 172 | c_id = $course_id AND |
173 | - exe_exo_id = ".(int)$this->get_ref_id(); |
|
173 | + exe_exo_id = ".(int) $this->get_ref_id(); |
|
174 | 174 | $result = Database::query($sql); |
175 | - $number=Database::fetch_row($result); |
|
175 | + $number = Database::fetch_row($result); |
|
176 | 176 | return ($number[0] != 0); |
177 | 177 | } |
178 | 178 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } else { |
255 | 255 | // all students -> get average |
256 | 256 | // normal way of getting the info |
257 | - $students = array(); // user list, needed to make sure we only |
|
257 | + $students = array(); // user list, needed to make sure we only |
|
258 | 258 | // take first attempts into account |
259 | 259 | $student_count = 0; |
260 | 260 | $sum = 0; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | /*if (empty($count)) { |
290 | 290 | return null; |
291 | 291 | }*/ |
292 | - return array($sumResult/$count , $weight); |
|
292 | + return array($sumResult / $count, $weight); |
|
293 | 293 | break; |
294 | 294 | case 'ranking': |
295 | 295 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $session_id = api_get_session_id(); |
320 | 320 | |
321 | 321 | $url = api_get_path(WEB_CODE_PATH).'gradebook/exercise_jump.php?session_id='.$session_id.'&cidReq='.$this->get_course_code().'&gradebook=view&exerciseId='.$this->get_ref_id().'&type='.$this->get_type(); |
322 | - if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user!=1) { |
|
322 | + if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user != 1) { |
|
323 | 323 | $url .= '&doexercise='.$this->get_ref_id(); |
324 | 324 | } |
325 | 325 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | public function is_valid_link() |
365 | 365 | { |
366 | 366 | $sql = 'SELECT count(id) from '.$this->get_exercise_table().' |
367 | - WHERE c_id = '.$this->course_id.' AND id = '.(int)$this->get_ref_id().' '; |
|
367 | + WHERE c_id = '.$this->course_id.' AND id = '.(int) $this->get_ref_id().' '; |
|
368 | 368 | $result = Database::query($sql); |
369 | 369 | $number = Database::fetch_row($result); |
370 | 370 |
@@ -121,7 +121,7 @@ |
||
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Has anyone done this exercise yet ? |
124 | - * @return int |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | public function has_results() |
127 | 127 | { |
@@ -10,54 +10,54 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class ForumThreadLink extends AbstractLink |
12 | 12 | { |
13 | - private $forum_thread_table = null; |
|
14 | - private $itemprop_table = null; |
|
15 | - |
|
16 | - /** |
|
17 | - * Constructor |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->set_type(LINK_FORUM_THREAD); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * @return string |
|
27 | - */ |
|
28 | - public function get_type_name() |
|
29 | - { |
|
30 | - return get_lang('ForumThreads'); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @return bool |
|
35 | - */ |
|
36 | - public function is_allowed_to_change_name() |
|
37 | - { |
|
38 | - return false; |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Generate an array of exercises that a teacher hasn't created a link for. |
|
43 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
44 | - */ |
|
45 | - public function get_not_created_links() |
|
46 | - { |
|
47 | - if (empty($this->course_code)) { |
|
48 | - die('Error in get_not_created_links() : course code not set'); |
|
49 | - } |
|
50 | - |
|
51 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
52 | - |
|
53 | - $sql = 'SELECT thread_id,thread_title,thread_title_qualify FROM '.$this->get_forum_thread_table() |
|
54 | - .' forum_thread WHERE thread_id NOT IN' |
|
55 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
56 | - .' WHERE type = '.LINK_FORUM_THREAD |
|
57 | - ." AND c_id = ".intval($this->course_id) |
|
58 | - .') AND forum_thread.session_id='.api_get_session_id().''; |
|
59 | - |
|
60 | - $result = Database::query($sql); |
|
13 | + private $forum_thread_table = null; |
|
14 | + private $itemprop_table = null; |
|
15 | + |
|
16 | + /** |
|
17 | + * Constructor |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->set_type(LINK_FORUM_THREAD); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * @return string |
|
27 | + */ |
|
28 | + public function get_type_name() |
|
29 | + { |
|
30 | + return get_lang('ForumThreads'); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @return bool |
|
35 | + */ |
|
36 | + public function is_allowed_to_change_name() |
|
37 | + { |
|
38 | + return false; |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Generate an array of exercises that a teacher hasn't created a link for. |
|
43 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
44 | + */ |
|
45 | + public function get_not_created_links() |
|
46 | + { |
|
47 | + if (empty($this->course_code)) { |
|
48 | + die('Error in get_not_created_links() : course code not set'); |
|
49 | + } |
|
50 | + |
|
51 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
52 | + |
|
53 | + $sql = 'SELECT thread_id,thread_title,thread_title_qualify FROM '.$this->get_forum_thread_table() |
|
54 | + .' forum_thread WHERE thread_id NOT IN' |
|
55 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
56 | + .' WHERE type = '.LINK_FORUM_THREAD |
|
57 | + ." AND c_id = ".intval($this->course_id) |
|
58 | + .') AND forum_thread.session_id='.api_get_session_id().''; |
|
59 | + |
|
60 | + $result = Database::query($sql); |
|
61 | 61 | |
62 | 62 | $cats = array(); |
63 | 63 | while ($data = Database::fetch_array($result)) { |
@@ -72,29 +72,29 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | return $cats; |
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Generate an array of all exercises available. |
|
79 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
80 | - */ |
|
81 | - public function get_all_links() |
|
82 | - { |
|
83 | - if (empty($this->course_code)) { |
|
84 | - die('Error in get_not_created_links() : course code not set'); |
|
85 | - } |
|
86 | - |
|
87 | - $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | - $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
89 | - $session_id = api_get_session_id(); |
|
90 | - |
|
91 | - if ($session_id) { |
|
92 | - $session_condition = 'tl.session_id='.api_get_session_id(); |
|
93 | - } else { |
|
94 | - $session_condition = '(tl.session_id = 0 OR tl.session_id IS NULL)'; |
|
95 | - } |
|
96 | - |
|
97 | - $sql = 'SELECT tl.thread_id, tl.thread_title, tl.thread_title_qualify |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Generate an array of all exercises available. |
|
79 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
80 | + */ |
|
81 | + public function get_all_links() |
|
82 | + { |
|
83 | + if (empty($this->course_code)) { |
|
84 | + die('Error in get_not_created_links() : course code not set'); |
|
85 | + } |
|
86 | + |
|
87 | + $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | + $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
89 | + $session_id = api_get_session_id(); |
|
90 | + |
|
91 | + if ($session_id) { |
|
92 | + $session_condition = 'tl.session_id='.api_get_session_id(); |
|
93 | + } else { |
|
94 | + $session_condition = '(tl.session_id = 0 OR tl.session_id IS NULL)'; |
|
95 | + } |
|
96 | + |
|
97 | + $sql = 'SELECT tl.thread_id, tl.thread_title, tl.thread_title_qualify |
|
98 | 98 | FROM '.$tbl_grade_links.' tl INNER JOIN '.$tbl_item_property.' ip |
99 | 99 | ON (tl.thread_id = ip.ref AND tl.c_id = ip.c_id ) |
100 | 100 | WHERE |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | '.$session_condition.' |
106 | 106 | '; |
107 | 107 | |
108 | - $result = Database::query($sql); |
|
108 | + $result = Database::query($sql); |
|
109 | 109 | |
110 | - while ($data = Database::fetch_array($result)) { |
|
111 | - if ( isset($data['thread_title_qualify']) and $data['thread_title_qualify']!=""){ |
|
112 | - $cats[] = array ($data['thread_id'], $data['thread_title_qualify']); |
|
113 | - } else { |
|
114 | - $cats[] = array ($data['thread_id'], $data['thread_title']); |
|
115 | - } |
|
116 | - } |
|
117 | - $my_cats = isset($cats) ? $cats : null; |
|
110 | + while ($data = Database::fetch_array($result)) { |
|
111 | + if ( isset($data['thread_title_qualify']) and $data['thread_title_qualify']!=""){ |
|
112 | + $cats[] = array ($data['thread_id'], $data['thread_title_qualify']); |
|
113 | + } else { |
|
114 | + $cats[] = array ($data['thread_id'], $data['thread_title']); |
|
115 | + } |
|
116 | + } |
|
117 | + $my_cats = isset($cats) ? $cats : null; |
|
118 | 118 | |
119 | - return $my_cats; |
|
120 | - } |
|
119 | + return $my_cats; |
|
120 | + } |
|
121 | 121 | |
122 | 122 | /** |
123 | - * Has anyone done this exercise yet ? |
|
124 | - * @return int |
|
125 | - */ |
|
123 | + * Has anyone done this exercise yet ? |
|
124 | + * @return int |
|
125 | + */ |
|
126 | 126 | public function has_results() |
127 | 127 | { |
128 | 128 | $table = Database :: get_course_table(TABLE_FORUM_POST); |
@@ -134,40 +134,40 @@ discard block |
||
134 | 134 | $number = Database::fetch_row($result); |
135 | 135 | |
136 | 136 | return $number[0] != 0; |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * @param int $stud_id |
|
139 | + /** |
|
140 | + * @param int $stud_id |
|
141 | 141 | * @param string $type |
142 | 142 | * |
143 | - * @return array|null |
|
144 | - */ |
|
145 | - public function calc_score($stud_id = null, $type = null) |
|
146 | - { |
|
143 | + * @return array|null |
|
144 | + */ |
|
145 | + public function calc_score($stud_id = null, $type = null) |
|
146 | + { |
|
147 | 147 | require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; |
148 | 148 | $threadInfo = get_thread_information($this->get_ref_id()); |
149 | 149 | |
150 | - $thread_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY); |
|
150 | + $thread_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY); |
|
151 | 151 | |
152 | - $sql = 'SELECT thread_qualify_max |
|
152 | + $sql = 'SELECT thread_qualify_max |
|
153 | 153 | FROM '.Database :: get_course_table(TABLE_FORUM_THREAD)." |
154 | 154 | WHERE c_id = ".$this->course_id." AND thread_id = '".$this->get_ref_id()."'"; |
155 | - $query = Database::query($sql); |
|
156 | - $assignment = Database::fetch_array($query); |
|
155 | + $query = Database::query($sql); |
|
156 | + $assignment = Database::fetch_array($query); |
|
157 | 157 | |
158 | - $sql = "SELECT * FROM $thread_qualify |
|
158 | + $sql = "SELECT * FROM $thread_qualify |
|
159 | 159 | WHERE c_id = ".$this->course_id." AND thread_id = ".$this->get_ref_id(); |
160 | - if (isset($stud_id)) { |
|
161 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
162 | - } |
|
160 | + if (isset($stud_id)) { |
|
161 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
162 | + } |
|
163 | 163 | |
164 | - // order by id, that way the student's first attempt is accessed first |
|
165 | - $sql .= ' ORDER BY qualify_time DESC'; |
|
164 | + // order by id, that way the student's first attempt is accessed first |
|
165 | + $sql .= ' ORDER BY qualify_time DESC'; |
|
166 | 166 | |
167 | - $scores = Database::query($sql); |
|
167 | + $scores = Database::query($sql); |
|
168 | 168 | |
169 | - // for 1 student |
|
170 | - if (isset($stud_id)) { |
|
169 | + // for 1 student |
|
170 | + if (isset($stud_id)) { |
|
171 | 171 | if ($threadInfo['thread_peer_qualify'] == 0) { |
172 | 172 | // Classic way of calculate score |
173 | 173 | if ($data = Database::fetch_array($scores)) { |
@@ -195,174 +195,174 @@ discard block |
||
195 | 195 | } |
196 | 196 | return [$score/$counter, $assignment['thread_qualify_max']]; |
197 | 197 | } |
198 | - } else { |
|
199 | - // All students -> get average |
|
200 | - $students = array(); // user list, needed to make sure we only |
|
201 | - // take first attempts into account |
|
202 | - $counter = 0; |
|
203 | - $sum = 0; |
|
204 | - $bestResult = 0; |
|
205 | - $weight = 0; |
|
206 | - $sumResult = 0; |
|
207 | - |
|
208 | - while ($data = Database::fetch_array($scores)) { |
|
209 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
210 | - if ($assignment['thread_qualify_max'] != 0) { |
|
211 | - $students[$data['user_id']] = $data['qualify']; |
|
212 | - $counter++; |
|
213 | - $sum += $data['qualify'] / $assignment['thread_qualify_max']; |
|
214 | - $sumResult += $data['qualify']; |
|
215 | - if ($data['qualify'] > $bestResult) { |
|
216 | - $bestResult = $data['qualify']; |
|
217 | - } |
|
218 | - $weight = $assignment['thread_qualify_max']; |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
222 | - |
|
223 | - if ($counter == 0) { |
|
224 | - return null; |
|
225 | - } else { |
|
226 | - switch ($type) { |
|
227 | - case 'best': |
|
228 | - return array($bestResult, $weight); |
|
229 | - break; |
|
230 | - case 'average': |
|
231 | - return array($sumResult/$counter, $weight); |
|
232 | - break; |
|
233 | - case 'ranking': |
|
234 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
235 | - break; |
|
236 | - default: |
|
237 | - return array($sum, $counter); |
|
238 | - break; |
|
239 | - } |
|
240 | - } |
|
241 | - } |
|
242 | - } |
|
243 | - |
|
244 | - /** |
|
245 | - * Lazy load function to get the database table of the student publications |
|
246 | - */ |
|
247 | - private function get_forum_thread_table() |
|
248 | - { |
|
249 | - return $this->forum_thread_table = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
250 | - } |
|
251 | - |
|
252 | - public function needs_name_and_description() |
|
253 | - { |
|
254 | - return false; |
|
255 | - } |
|
256 | - |
|
257 | - public function needs_max() |
|
258 | - { |
|
259 | - return false; |
|
260 | - } |
|
261 | - |
|
262 | - public function needs_results() |
|
263 | - { |
|
264 | - return false; |
|
265 | - } |
|
198 | + } else { |
|
199 | + // All students -> get average |
|
200 | + $students = array(); // user list, needed to make sure we only |
|
201 | + // take first attempts into account |
|
202 | + $counter = 0; |
|
203 | + $sum = 0; |
|
204 | + $bestResult = 0; |
|
205 | + $weight = 0; |
|
206 | + $sumResult = 0; |
|
207 | + |
|
208 | + while ($data = Database::fetch_array($scores)) { |
|
209 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
210 | + if ($assignment['thread_qualify_max'] != 0) { |
|
211 | + $students[$data['user_id']] = $data['qualify']; |
|
212 | + $counter++; |
|
213 | + $sum += $data['qualify'] / $assignment['thread_qualify_max']; |
|
214 | + $sumResult += $data['qualify']; |
|
215 | + if ($data['qualify'] > $bestResult) { |
|
216 | + $bestResult = $data['qualify']; |
|
217 | + } |
|
218 | + $weight = $assignment['thread_qualify_max']; |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | + |
|
223 | + if ($counter == 0) { |
|
224 | + return null; |
|
225 | + } else { |
|
226 | + switch ($type) { |
|
227 | + case 'best': |
|
228 | + return array($bestResult, $weight); |
|
229 | + break; |
|
230 | + case 'average': |
|
231 | + return array($sumResult/$counter, $weight); |
|
232 | + break; |
|
233 | + case 'ranking': |
|
234 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
235 | + break; |
|
236 | + default: |
|
237 | + return array($sum, $counter); |
|
238 | + break; |
|
239 | + } |
|
240 | + } |
|
241 | + } |
|
242 | + } |
|
243 | + |
|
244 | + /** |
|
245 | + * Lazy load function to get the database table of the student publications |
|
246 | + */ |
|
247 | + private function get_forum_thread_table() |
|
248 | + { |
|
249 | + return $this->forum_thread_table = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
250 | + } |
|
251 | + |
|
252 | + public function needs_name_and_description() |
|
253 | + { |
|
254 | + return false; |
|
255 | + } |
|
256 | + |
|
257 | + public function needs_max() |
|
258 | + { |
|
259 | + return false; |
|
260 | + } |
|
261 | + |
|
262 | + public function needs_results() |
|
263 | + { |
|
264 | + return false; |
|
265 | + } |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * @return string |
269 | 269 | */ |
270 | - public function get_name() |
|
271 | - { |
|
272 | - $this->get_exercise_data(); |
|
273 | - $thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | - $thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | - if ( isset($thread_title_qualify) && $thread_title_qualify!="") { |
|
276 | - return $this->exercise_data['thread_title_qualify']; |
|
277 | - } else { |
|
278 | - return $thread_title; |
|
279 | - } |
|
280 | - } |
|
270 | + public function get_name() |
|
271 | + { |
|
272 | + $this->get_exercise_data(); |
|
273 | + $thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | + $thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | + if ( isset($thread_title_qualify) && $thread_title_qualify!="") { |
|
276 | + return $this->exercise_data['thread_title_qualify']; |
|
277 | + } else { |
|
278 | + return $thread_title; |
|
279 | + } |
|
280 | + } |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * @return string |
284 | 284 | */ |
285 | - public function get_description() |
|
286 | - { |
|
287 | - return '';//$this->exercise_data['description']; |
|
288 | - } |
|
289 | - |
|
290 | - /** |
|
291 | - * Check if this still links to an exercise |
|
292 | - */ |
|
293 | - public function is_valid_link() |
|
294 | - { |
|
295 | - $sql = 'SELECT count(id) from '.$this->get_forum_thread_table().' |
|
285 | + public function get_description() |
|
286 | + { |
|
287 | + return '';//$this->exercise_data['description']; |
|
288 | + } |
|
289 | + |
|
290 | + /** |
|
291 | + * Check if this still links to an exercise |
|
292 | + */ |
|
293 | + public function is_valid_link() |
|
294 | + { |
|
295 | + $sql = 'SELECT count(id) from '.$this->get_forum_thread_table().' |
|
296 | 296 | WHERE c_id = '.$this->course_id.' AND thread_id = '.$this->get_ref_id().' AND session_id='.api_get_session_id().''; |
297 | - $result = Database::query($sql); |
|
298 | - $number = Database::fetch_row($result); |
|
299 | - return ($number[0] != 0); |
|
300 | - } |
|
301 | - |
|
302 | - public function get_test_id() |
|
303 | - { |
|
304 | - return 'DEBUG:ID'; |
|
305 | - } |
|
306 | - |
|
307 | - public function get_link() |
|
308 | - { |
|
309 | - //it was extracts the forum id |
|
310 | - $sql = 'SELECT * FROM '.$this->get_forum_thread_table()." |
|
297 | + $result = Database::query($sql); |
|
298 | + $number = Database::fetch_row($result); |
|
299 | + return ($number[0] != 0); |
|
300 | + } |
|
301 | + |
|
302 | + public function get_test_id() |
|
303 | + { |
|
304 | + return 'DEBUG:ID'; |
|
305 | + } |
|
306 | + |
|
307 | + public function get_link() |
|
308 | + { |
|
309 | + //it was extracts the forum id |
|
310 | + $sql = 'SELECT * FROM '.$this->get_forum_thread_table()." |
|
311 | 311 | WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".api_get_session_id().""; |
312 | - $result = Database::query($sql); |
|
313 | - $row = Database::fetch_array($result,'ASSOC'); |
|
314 | - $forum_id=$row['forum_id']; |
|
315 | - |
|
316 | - $url = api_get_path(WEB_PATH).'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id; |
|
317 | - return $url; |
|
318 | - } |
|
319 | - |
|
320 | - private function get_exercise_data() |
|
321 | - { |
|
322 | - $session_id = api_get_session_id(); |
|
323 | - if ($session_id) { |
|
324 | - $session_condition = 'session_id='.api_get_session_id(); |
|
325 | - } else { |
|
326 | - $session_condition = '(session_id = 0 OR session_id IS NULL)'; |
|
327 | - } |
|
328 | - |
|
329 | - if (!isset($this->exercise_data)) { |
|
330 | - $sql = 'SELECT * FROM '.$this->get_forum_thread_table().' |
|
312 | + $result = Database::query($sql); |
|
313 | + $row = Database::fetch_array($result,'ASSOC'); |
|
314 | + $forum_id=$row['forum_id']; |
|
315 | + |
|
316 | + $url = api_get_path(WEB_PATH).'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id; |
|
317 | + return $url; |
|
318 | + } |
|
319 | + |
|
320 | + private function get_exercise_data() |
|
321 | + { |
|
322 | + $session_id = api_get_session_id(); |
|
323 | + if ($session_id) { |
|
324 | + $session_condition = 'session_id='.api_get_session_id(); |
|
325 | + } else { |
|
326 | + $session_condition = '(session_id = 0 OR session_id IS NULL)'; |
|
327 | + } |
|
328 | + |
|
329 | + if (!isset($this->exercise_data)) { |
|
330 | + $sql = 'SELECT * FROM '.$this->get_forum_thread_table().' |
|
331 | 331 | WHERE c_id = '.$this->course_id.' AND thread_id = '.$this->get_ref_id().' AND '.$session_condition; |
332 | - $query = Database::query($sql); |
|
333 | - $this->exercise_data = Database::fetch_array($query); |
|
334 | - } |
|
335 | - return $this->exercise_data; |
|
336 | - } |
|
337 | - |
|
338 | - public function get_icon_name() |
|
339 | - { |
|
340 | - return 'forum'; |
|
341 | - } |
|
342 | - |
|
343 | - function save_linked_data() |
|
344 | - { |
|
345 | - $weight = (float)$this->get_weight(); |
|
346 | - $ref_id = $this->get_ref_id(); |
|
347 | - |
|
348 | - if (!empty($ref_id)) { |
|
349 | - $sql = 'UPDATE '.$this->get_forum_thread_table().' SET thread_weight='.$weight.' |
|
332 | + $query = Database::query($sql); |
|
333 | + $this->exercise_data = Database::fetch_array($query); |
|
334 | + } |
|
335 | + return $this->exercise_data; |
|
336 | + } |
|
337 | + |
|
338 | + public function get_icon_name() |
|
339 | + { |
|
340 | + return 'forum'; |
|
341 | + } |
|
342 | + |
|
343 | + function save_linked_data() |
|
344 | + { |
|
345 | + $weight = (float)$this->get_weight(); |
|
346 | + $ref_id = $this->get_ref_id(); |
|
347 | + |
|
348 | + if (!empty($ref_id)) { |
|
349 | + $sql = 'UPDATE '.$this->get_forum_thread_table().' SET thread_weight='.$weight.' |
|
350 | 350 | WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id; |
351 | - Database::query($sql); |
|
352 | - } |
|
353 | - } |
|
354 | - |
|
355 | - function delete_linked_data() |
|
356 | - { |
|
357 | - $ref_id = $this->get_ref_id(); |
|
358 | - if (!empty($ref_id)) { |
|
359 | - //Cleans forum |
|
360 | - $sql = 'UPDATE '.$this->get_forum_thread_table().' SET |
|
351 | + Database::query($sql); |
|
352 | + } |
|
353 | + } |
|
354 | + |
|
355 | + function delete_linked_data() |
|
356 | + { |
|
357 | + $ref_id = $this->get_ref_id(); |
|
358 | + if (!empty($ref_id)) { |
|
359 | + //Cleans forum |
|
360 | + $sql = 'UPDATE '.$this->get_forum_thread_table().' SET |
|
361 | 361 | thread_qualify_max = 0, |
362 | 362 | thread_weight = 0, |
363 | 363 | thread_title_qualify = "" |
364 | 364 | WHERE c_id = '.$this->course_id.' AND thread_id= '.$ref_id; |
365 | - Database::query($sql); |
|
366 | - } |
|
367 | - } |
|
365 | + Database::query($sql); |
|
366 | + } |
|
367 | + } |
|
368 | 368 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | die('Error in get_not_created_links() : course code not set'); |
85 | 85 | } |
86 | 86 | |
87 | - $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | - $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
87 | + $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | + $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
89 | 89 | $session_id = api_get_session_id(); |
90 | 90 | |
91 | 91 | if ($session_id) { |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | $result = Database::query($sql); |
109 | 109 | |
110 | 110 | while ($data = Database::fetch_array($result)) { |
111 | - if ( isset($data['thread_title_qualify']) and $data['thread_title_qualify']!=""){ |
|
112 | - $cats[] = array ($data['thread_id'], $data['thread_title_qualify']); |
|
111 | + if (isset($data['thread_title_qualify']) and $data['thread_title_qualify'] != "") { |
|
112 | + $cats[] = array($data['thread_id'], $data['thread_title_qualify']); |
|
113 | 113 | } else { |
114 | - $cats[] = array ($data['thread_id'], $data['thread_title']); |
|
114 | + $cats[] = array($data['thread_id'], $data['thread_title']); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | $my_cats = isset($cats) ? $cats : null; |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | if (empty($counter) || $counter <= 2) { |
194 | 194 | return array(0, $assignment['thread_qualify_max']); |
195 | 195 | } |
196 | - return [$score/$counter, $assignment['thread_qualify_max']]; |
|
196 | + return [$score / $counter, $assignment['thread_qualify_max']]; |
|
197 | 197 | } |
198 | 198 | } else { |
199 | 199 | // All students -> get average |
200 | - $students = array(); // user list, needed to make sure we only |
|
200 | + $students = array(); // user list, needed to make sure we only |
|
201 | 201 | // take first attempts into account |
202 | 202 | $counter = 0; |
203 | 203 | $sum = 0; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return array($bestResult, $weight); |
229 | 229 | break; |
230 | 230 | case 'average': |
231 | - return array($sumResult/$counter, $weight); |
|
231 | + return array($sumResult / $counter, $weight); |
|
232 | 232 | break; |
233 | 233 | case 'ranking': |
234 | 234 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | public function get_name() |
271 | 271 | { |
272 | 272 | $this->get_exercise_data(); |
273 | - $thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | - $thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | - if ( isset($thread_title_qualify) && $thread_title_qualify!="") { |
|
273 | + $thread_title = isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | + $thread_title_qualify = isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | + if (isset($thread_title_qualify) && $thread_title_qualify != "") { |
|
276 | 276 | return $this->exercise_data['thread_title_qualify']; |
277 | 277 | } else { |
278 | 278 | return $thread_title; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_description() |
286 | 286 | { |
287 | - return '';//$this->exercise_data['description']; |
|
287 | + return ''; //$this->exercise_data['description']; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | $sql = 'SELECT * FROM '.$this->get_forum_thread_table()." |
311 | 311 | WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".api_get_session_id().""; |
312 | 312 | $result = Database::query($sql); |
313 | - $row = Database::fetch_array($result,'ASSOC'); |
|
314 | - $forum_id=$row['forum_id']; |
|
313 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
314 | + $forum_id = $row['forum_id']; |
|
315 | 315 | |
316 | 316 | $url = api_get_path(WEB_PATH).'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id; |
317 | 317 | return $url; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | function save_linked_data() |
344 | 344 | { |
345 | - $weight = (float)$this->get_weight(); |
|
345 | + $weight = (float) $this->get_weight(); |
|
346 | 346 | $ref_id = $this->get_ref_id(); |
347 | 347 | |
348 | 348 | if (!empty($ref_id)) { |
@@ -95,7 +95,7 @@ |
||
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Get the progress of this learnpath. Only the last attempt are taken into account. |
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
98 | + * @param integer $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | 99 | * @return array (score, max) if student is given |
100 | 100 | * array (sum of scores, number of scores) otherwise |
101 | 101 | * or null if no scores available |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_array($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -9,260 +9,260 @@ |
||
9 | 9 | */ |
10 | 10 | class LearnpathLink extends AbstractLink |
11 | 11 | { |
12 | - private $course_info = null; |
|
13 | - private $learnpath_table = null; |
|
14 | - private $learnpath_data = null; |
|
15 | - |
|
16 | - /** |
|
17 | - * Constructor |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->set_type(LINK_LEARNPATH); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | - */ |
|
29 | - public function get_not_created_links() |
|
30 | - { |
|
31 | - return false; |
|
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
34 | - |
|
35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | - |
|
37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
12 | + private $course_info = null; |
|
13 | + private $learnpath_table = null; |
|
14 | + private $learnpath_data = null; |
|
15 | + |
|
16 | + /** |
|
17 | + * Constructor |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->set_type(LINK_LEARNPATH); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | + */ |
|
29 | + public function get_not_created_links() |
|
30 | + { |
|
31 | + return false; |
|
32 | + if (empty($this->course_code)) |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + |
|
35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | + |
|
37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | - .' WHERE type = '.LINK_LEARNPATH |
|
41 | - ." AND c_id = '" . intval($this->course_id) . "'" |
|
42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
43 | - |
|
44 | - $result = Database::query($sql); |
|
45 | - |
|
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
49 | - } |
|
50 | - |
|
51 | - return $cats; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Generate an array of all learnpaths available. |
|
56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | - */ |
|
58 | - public function get_all_links() |
|
59 | - { |
|
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
62 | - |
|
63 | - $session_id = api_get_session_id(); |
|
64 | - if (empty($session_id)) { |
|
65 | - $session_condition = api_get_session_condition(0, true); |
|
66 | - } else { |
|
67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | - } |
|
69 | - |
|
70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | + .' WHERE type = '.LINK_LEARNPATH |
|
41 | + ." AND c_id = '" . intval($this->course_id) . "'" |
|
42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
43 | + |
|
44 | + $result = Database::query($sql); |
|
45 | + |
|
46 | + $cats=array(); |
|
47 | + while ($data=Database::fetch_array($result)) { |
|
48 | + $cats[] = array ($data['id'], $data['name']); |
|
49 | + } |
|
50 | + |
|
51 | + return $cats; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Generate an array of all learnpaths available. |
|
56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | + */ |
|
58 | + public function get_all_links() |
|
59 | + { |
|
60 | + if (empty($this->course_code)) |
|
61 | + die('Error in get_not_created_links() : course code not set'); |
|
62 | + |
|
63 | + $session_id = api_get_session_id(); |
|
64 | + if (empty($session_id)) { |
|
65 | + $session_condition = api_get_session_condition(0, true); |
|
66 | + } else { |
|
67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | + } |
|
69 | + |
|
70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
72 | - $result = Database::query($sql); |
|
72 | + $result = Database::query($sql); |
|
73 | 73 | |
74 | - $cats = array(); |
|
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
77 | - } |
|
74 | + $cats = array(); |
|
75 | + while ($data=Database::fetch_array($result)) { |
|
76 | + $cats[] = array ($data['id'], $data['name']); |
|
77 | + } |
|
78 | 78 | |
79 | - return $cats; |
|
80 | - } |
|
79 | + return $cats; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Has anyone used this learnpath yet ? |
|
85 | - */ |
|
86 | - public function has_results() |
|
87 | - { |
|
88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
83 | + /** |
|
84 | + * Has anyone used this learnpath yet ? |
|
85 | + */ |
|
86 | + public function has_results() |
|
87 | + { |
|
88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | - $result = Database::query($sql); |
|
92 | - $number = Database::fetch_array($result,'NUM'); |
|
93 | - return ($number[0] != 0); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | - * @return array (score, max) if student is given |
|
100 | - * array (sum of scores, number of scores) otherwise |
|
101 | - * or null if no scores available |
|
102 | - */ |
|
103 | - public function calc_score($stud_id = null, $type = null) |
|
104 | - { |
|
105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | - $session_id = api_get_session_id(); |
|
107 | - |
|
108 | - $sql = "SELECT * FROM $tbl_stats |
|
91 | + $result = Database::query($sql); |
|
92 | + $number = Database::fetch_array($result,'NUM'); |
|
93 | + return ($number[0] != 0); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | + * @return array (score, max) if student is given |
|
100 | + * array (sum of scores, number of scores) otherwise |
|
101 | + * or null if no scores available |
|
102 | + */ |
|
103 | + public function calc_score($stud_id = null, $type = null) |
|
104 | + { |
|
105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | + $session_id = api_get_session_id(); |
|
107 | + |
|
108 | + $sql = "SELECT * FROM $tbl_stats |
|
109 | 109 | WHERE |
110 | 110 | c_id = ".$this->course_id." AND |
111 | 111 | lp_id = ".$this->get_ref_id()." AND |
112 | 112 | session_id = $session_id "; |
113 | 113 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | - |
|
117 | - // order by id, that way the student's first attempt is accessed first |
|
118 | - $sql .= ' ORDER BY view_count DESC'; |
|
119 | - |
|
120 | - $scores = Database::query($sql); |
|
121 | - // for 1 student |
|
122 | - if (isset($stud_id)) { |
|
123 | - if ($data = Database::fetch_array($scores)) { |
|
124 | - return array ($data['progress'], 100); |
|
125 | - } else |
|
126 | - return null; |
|
127 | - } else { |
|
128 | - // all students -> get average |
|
129 | - $students = array(); // user list, needed to make sure we only |
|
130 | - // take first attempts into account |
|
131 | - $rescount = 0; |
|
132 | - $sum = 0; |
|
133 | - $bestResult = 0; |
|
134 | - $sumResult = 0; |
|
135 | - while ($data = Database::fetch_array($scores)) { |
|
136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | - $students[$data['user_id']] = $data['progress']; |
|
138 | - $rescount++; |
|
139 | - $sum += $data['progress'] / 100; |
|
140 | - $sumResult += $data['progress']; |
|
141 | - |
|
142 | - if ($data['progress'] > $bestResult) { |
|
143 | - $bestResult = $data['progress']; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ($rescount == 0) { |
|
149 | - return null; |
|
150 | - } else { |
|
151 | - |
|
152 | - switch ($type) { |
|
153 | - case 'best': |
|
154 | - return array($bestResult, 100); |
|
155 | - break; |
|
156 | - case 'average': |
|
157 | - return array($sumResult/$rescount, 100); |
|
158 | - break; |
|
159 | - case 'ranking': |
|
160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | - break; |
|
162 | - default: |
|
163 | - return array($sum, $rescount); |
|
164 | - break; |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Get URL where to go to if the user clicks on the link. |
|
172 | - */ |
|
173 | - public function get_link() |
|
174 | - { |
|
175 | - $url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq='.$this->get_course_code().'&gradebook=view'; |
|
176 | - $session_id = api_get_session_id(); |
|
177 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
178 | - $url .= '&action=view&session_id='.$session_id.'&lp_id='.$this->get_ref_id(); |
|
179 | - } else { |
|
180 | - $url .= '&action=build&session_id='.$session_id.'&lp_id='.$this->get_ref_id(); |
|
181 | - } |
|
182 | - return $url; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Get name to display: same as learnpath title |
|
187 | - */ |
|
188 | - public function get_name() |
|
189 | - { |
|
190 | - $data = $this->get_learnpath_data(); |
|
191 | - return $data['name']; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Get description to display: same as learnpath description |
|
196 | - */ |
|
197 | - public function get_description() |
|
198 | - { |
|
199 | - $data = $this->get_learnpath_data(); |
|
200 | - return $data['description']; |
|
201 | - } |
|
202 | - |
|
203 | - /** |
|
204 | - * Check if this still links to a learnpath |
|
205 | - */ |
|
206 | - public function is_valid_link() { |
|
207 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
114 | + if (isset($stud_id)) |
|
115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + |
|
117 | + // order by id, that way the student's first attempt is accessed first |
|
118 | + $sql .= ' ORDER BY view_count DESC'; |
|
119 | + |
|
120 | + $scores = Database::query($sql); |
|
121 | + // for 1 student |
|
122 | + if (isset($stud_id)) { |
|
123 | + if ($data = Database::fetch_array($scores)) { |
|
124 | + return array ($data['progress'], 100); |
|
125 | + } else |
|
126 | + return null; |
|
127 | + } else { |
|
128 | + // all students -> get average |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | + // take first attempts into account |
|
131 | + $rescount = 0; |
|
132 | + $sum = 0; |
|
133 | + $bestResult = 0; |
|
134 | + $sumResult = 0; |
|
135 | + while ($data = Database::fetch_array($scores)) { |
|
136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | + $students[$data['user_id']] = $data['progress']; |
|
138 | + $rescount++; |
|
139 | + $sum += $data['progress'] / 100; |
|
140 | + $sumResult += $data['progress']; |
|
141 | + |
|
142 | + if ($data['progress'] > $bestResult) { |
|
143 | + $bestResult = $data['progress']; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ($rescount == 0) { |
|
149 | + return null; |
|
150 | + } else { |
|
151 | + |
|
152 | + switch ($type) { |
|
153 | + case 'best': |
|
154 | + return array($bestResult, 100); |
|
155 | + break; |
|
156 | + case 'average': |
|
157 | + return array($sumResult/$rescount, 100); |
|
158 | + break; |
|
159 | + case 'ranking': |
|
160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | + break; |
|
162 | + default: |
|
163 | + return array($sum, $rescount); |
|
164 | + break; |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Get URL where to go to if the user clicks on the link. |
|
172 | + */ |
|
173 | + public function get_link() |
|
174 | + { |
|
175 | + $url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq='.$this->get_course_code().'&gradebook=view'; |
|
176 | + $session_id = api_get_session_id(); |
|
177 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
178 | + $url .= '&action=view&session_id='.$session_id.'&lp_id='.$this->get_ref_id(); |
|
179 | + } else { |
|
180 | + $url .= '&action=build&session_id='.$session_id.'&lp_id='.$this->get_ref_id(); |
|
181 | + } |
|
182 | + return $url; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Get name to display: same as learnpath title |
|
187 | + */ |
|
188 | + public function get_name() |
|
189 | + { |
|
190 | + $data = $this->get_learnpath_data(); |
|
191 | + return $data['name']; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Get description to display: same as learnpath description |
|
196 | + */ |
|
197 | + public function get_description() |
|
198 | + { |
|
199 | + $data = $this->get_learnpath_data(); |
|
200 | + return $data['description']; |
|
201 | + } |
|
202 | + |
|
203 | + /** |
|
204 | + * Check if this still links to a learnpath |
|
205 | + */ |
|
206 | + public function is_valid_link() { |
|
207 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
208 | 208 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
209 | - $result = Database::query($sql); |
|
210 | - $number = Database::fetch_row($result,'NUM'); |
|
211 | - return ($number[0] != 0); |
|
212 | - } |
|
213 | - |
|
214 | - public function get_type_name() |
|
215 | - { |
|
216 | - return get_lang('LearningPaths'); |
|
217 | - } |
|
218 | - |
|
219 | - public function needs_name_and_description() |
|
220 | - { |
|
221 | - return false; |
|
222 | - } |
|
223 | - |
|
224 | - public function needs_max() |
|
225 | - { |
|
226 | - return false; |
|
227 | - } |
|
228 | - |
|
229 | - public function needs_results() |
|
230 | - { |
|
231 | - return false; |
|
232 | - } |
|
233 | - |
|
234 | - public function is_allowed_to_change_name() |
|
235 | - { |
|
236 | - return false; |
|
237 | - } |
|
238 | - |
|
239 | - // INTERNAL FUNCTIONS |
|
240 | - |
|
241 | - /** |
|
242 | - * Lazy load function to get the database table of the learnpath |
|
243 | - */ |
|
244 | - private function get_learnpath_table() |
|
245 | - { |
|
246 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
247 | - return $this->learnpath_table; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * Lazy load function to get the database contents of this learnpath |
|
252 | - */ |
|
253 | - private function get_learnpath_data() |
|
254 | - { |
|
255 | - if (!isset($this->learnpath_data)) { |
|
256 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
209 | + $result = Database::query($sql); |
|
210 | + $number = Database::fetch_row($result,'NUM'); |
|
211 | + return ($number[0] != 0); |
|
212 | + } |
|
213 | + |
|
214 | + public function get_type_name() |
|
215 | + { |
|
216 | + return get_lang('LearningPaths'); |
|
217 | + } |
|
218 | + |
|
219 | + public function needs_name_and_description() |
|
220 | + { |
|
221 | + return false; |
|
222 | + } |
|
223 | + |
|
224 | + public function needs_max() |
|
225 | + { |
|
226 | + return false; |
|
227 | + } |
|
228 | + |
|
229 | + public function needs_results() |
|
230 | + { |
|
231 | + return false; |
|
232 | + } |
|
233 | + |
|
234 | + public function is_allowed_to_change_name() |
|
235 | + { |
|
236 | + return false; |
|
237 | + } |
|
238 | + |
|
239 | + // INTERNAL FUNCTIONS |
|
240 | + |
|
241 | + /** |
|
242 | + * Lazy load function to get the database table of the learnpath |
|
243 | + */ |
|
244 | + private function get_learnpath_table() |
|
245 | + { |
|
246 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
247 | + return $this->learnpath_table; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * Lazy load function to get the database contents of this learnpath |
|
252 | + */ |
|
253 | + private function get_learnpath_data() |
|
254 | + { |
|
255 | + if (!isset($this->learnpath_data)) { |
|
256 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
257 | 257 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
258 | - $result = Database::query($sql); |
|
259 | - $this->learnpath_data = Database::fetch_array($result); |
|
260 | - } |
|
261 | - return $this->learnpath_data; |
|
262 | - } |
|
263 | - |
|
264 | - public function get_icon_name() |
|
265 | - { |
|
266 | - return 'learnpath'; |
|
267 | - } |
|
258 | + $result = Database::query($sql); |
|
259 | + $this->learnpath_data = Database::fetch_array($result); |
|
260 | + } |
|
261 | + return $this->learnpath_data; |
|
262 | + } |
|
263 | + |
|
264 | + public function get_icon_name() |
|
265 | + { |
|
266 | + return 'learnpath'; |
|
267 | + } |
|
268 | 268 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
39 | 39 | .' (SELECT ref_id FROM '.$tbl_grade_links |
40 | 40 | .' WHERE type = '.LINK_LEARNPATH |
41 | - ." AND c_id = '" . intval($this->course_id) . "'" |
|
41 | + ." AND c_id = '".intval($this->course_id)."'" |
|
42 | 42 | .') AND lp.session_id='.api_get_session_id().''; |
43 | 43 | |
44 | 44 | $result = Database::query($sql); |
45 | 45 | |
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
46 | + $cats = array(); |
|
47 | + while ($data = Database::fetch_array($result)) { |
|
48 | + $cats[] = array($data['id'], $data['name']); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $cats; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | $result = Database::query($sql); |
73 | 73 | |
74 | 74 | $cats = array(); |
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
75 | + while ($data = Database::fetch_array($result)) { |
|
76 | + $cats[] = array($data['id'], $data['name']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $cats; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $sql = "SELECT count(id) AS number FROM $tbl_stats |
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | 91 | $result = Database::query($sql); |
92 | - $number = Database::fetch_array($result,'NUM'); |
|
92 | + $number = Database::fetch_array($result, 'NUM'); |
|
93 | 93 | return ($number[0] != 0); |
94 | 94 | } |
95 | 95 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | // for 1 student |
122 | 122 | if (isset($stud_id)) { |
123 | 123 | if ($data = Database::fetch_array($scores)) { |
124 | - return array ($data['progress'], 100); |
|
124 | + return array($data['progress'], 100); |
|
125 | 125 | } else |
126 | 126 | return null; |
127 | 127 | } else { |
128 | 128 | // all students -> get average |
129 | - $students = array(); // user list, needed to make sure we only |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | 130 | // take first attempts into account |
131 | 131 | $rescount = 0; |
132 | 132 | $sum = 0; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return array($bestResult, 100); |
155 | 155 | break; |
156 | 156 | case 'average': |
157 | - return array($sumResult/$rescount, 100); |
|
157 | + return array($sumResult / $rescount, 100); |
|
158 | 158 | break; |
159 | 159 | case 'ranking': |
160 | 160 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
208 | 208 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
209 | 209 | $result = Database::query($sql); |
210 | - $number = Database::fetch_row($result,'NUM'); |
|
210 | + $number = Database::fetch_row($result, 'NUM'); |
|
211 | 211 | return ($number[0] != 0); |
212 | 212 | } |
213 | 213 |
@@ -59,6 +59,9 @@ |
||
59 | 59 | $this->evaluation = $evaluation_id; |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $creation_date |
|
64 | + */ |
|
62 | 65 | public function set_date($creation_date) |
63 | 66 | { |
64 | 67 | $this->created_at = $creation_date; |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | if (is_null($id) && is_null($user_id) && !is_null($evaluation_id)) { |
91 | 91 | // Verified_if_exist_evaluation |
92 | 92 | $sql = 'SELECT COUNT(*) AS count |
93 | - FROM ' . $tbl_grade_results . ' |
|
94 | - WHERE evaluation_id="' . Database::escape_string($evaluation_id) . '";'; |
|
93 | + FROM ' . $tbl_grade_results.' |
|
94 | + WHERE evaluation_id="' . Database::escape_string($evaluation_id).'";'; |
|
95 | 95 | $result = Database::query($sql); |
96 | 96 | $existEvaluation = Database::result($result, 0, 0); |
97 | 97 | |
98 | 98 | if ($existEvaluation != 0) { |
99 | 99 | if ($sessionId) { |
100 | 100 | $sql = 'SELECT c_id, user_id as user_id, status |
101 | - FROM ' . $tbl_session_rel_course_user . ' |
|
101 | + FROM ' . $tbl_session_rel_course_user.' |
|
102 | 102 | WHERE |
103 | 103 | status= 0 AND |
104 | - c_id = "' . api_get_course_int_id() . '" AND |
|
104 | + c_id = "' . api_get_course_int_id().'" AND |
|
105 | 105 | session_id = ' . $sessionId; |
106 | 106 | } else { |
107 | 107 | $sql = 'SELECT c_id, user_id, status |
108 | - FROM ' . $tbl_course_rel_course . ' |
|
109 | - WHERE status ="' . STUDENT . '" AND c_id = "' . api_get_course_int_id() . '" '; |
|
108 | + FROM ' . $tbl_course_rel_course.' |
|
109 | + WHERE status ="' . STUDENT.'" AND c_id = "'.api_get_course_int_id().'" '; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $res_course_rel_user = Database::query($sql); |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $current_date = api_get_utc_datetime(); |
117 | 117 | for ($i = 0; $i < count($list_user_course_list); $i++) { |
118 | 118 | $sql_verified = 'SELECT COUNT(*) AS count |
119 | - FROM ' . $tbl_grade_results . ' |
|
119 | + FROM ' . $tbl_grade_results.' |
|
120 | 120 | WHERE |
121 | - user_id="' . intval($list_user_course_list[$i]['user_id']) . '" AND |
|
122 | - evaluation_id="' . intval($evaluation_id) . '";'; |
|
121 | + user_id="' . intval($list_user_course_list[$i]['user_id']).'" AND |
|
122 | + evaluation_id="' . intval($evaluation_id).'";'; |
|
123 | 123 | $res_verified = Database::query($sql_verified); |
124 | 124 | $info_verified = Database::result($res_verified, 0, 0); |
125 | 125 | if ($info_verified == 0) { |
126 | - $sql_insert = 'INSERT INTO ' . $tbl_grade_results . '(user_id,evaluation_id,created_at,score) |
|
127 | - VALUES ("' . intval($list_user_course_list[$i]['user_id']) . '","' . intval($evaluation_id) . '","' . $current_date . '",0);'; |
|
126 | + $sql_insert = 'INSERT INTO '.$tbl_grade_results.'(user_id,evaluation_id,created_at,score) |
|
127 | + VALUES ("' . intval($list_user_course_list[$i]['user_id']).'","'.intval($evaluation_id).'","'.$current_date.'",0);'; |
|
128 | 128 | Database::query($sql_insert); |
129 | 129 | } |
130 | 130 | } |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | |
149 | 149 | $paramcount = 0; |
150 | 150 | if (!empty($id)) { |
151 | - $sql.= ' WHERE gr.id = ' . intval($id); |
|
152 | - $paramcount ++; |
|
151 | + $sql .= ' WHERE gr.id = '.intval($id); |
|
152 | + $paramcount++; |
|
153 | 153 | } |
154 | 154 | if (!empty($user_id)) { |
155 | 155 | if ($paramcount != 0) |
156 | 156 | $sql .= ' AND'; |
157 | 157 | else |
158 | 158 | $sql .= ' WHERE'; |
159 | - $sql .= ' gr.user_id = ' . intval($user_id); |
|
160 | - $paramcount ++; |
|
159 | + $sql .= ' gr.user_id = '.intval($user_id); |
|
160 | + $paramcount++; |
|
161 | 161 | } |
162 | 162 | if (!empty($evaluation_id)) { |
163 | 163 | if ($paramcount != 0) { |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | } else { |
166 | 166 | $sql .= ' WHERE'; |
167 | 167 | } |
168 | - $sql .= ' gr.evaluation_id = ' . intval($evaluation_id); |
|
169 | - $paramcount ++; |
|
168 | + $sql .= ' gr.evaluation_id = '.intval($evaluation_id); |
|
169 | + $paramcount++; |
|
170 | 170 | } |
171 | 171 | $sql .= ' ORDER BY u.lastname, u.firstname'; |
172 | 172 | $result = Database::query($sql); |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | { |
192 | 192 | if (isset($this->user_id) && isset($this->evaluation)) { |
193 | 193 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
194 | - $sql = "INSERT INTO " . $tbl_grade_results |
|
194 | + $sql = "INSERT INTO ".$tbl_grade_results |
|
195 | 195 | . " (user_id, evaluation_id, |
196 | 196 | created_at"; |
197 | 197 | if (isset($this->score)) { |
198 | 198 | $sql .= ",score"; |
199 | 199 | } |
200 | 200 | $sql .= ") VALUES |
201 | - (" . (int) $this->get_user_id() . ", " . (int) $this->get_evaluation_id() |
|
202 | - . ", '" . $this->get_date() . "' "; |
|
201 | + (" . (int) $this->get_user_id().", ".(int) $this->get_evaluation_id() |
|
202 | + . ", '".$this->get_date()."' "; |
|
203 | 203 | if (isset($this->score)) { |
204 | - $sql .= ", " . $this->get_score(); |
|
204 | + $sql .= ", ".$this->get_score(); |
|
205 | 205 | } |
206 | 206 | $sql .= ")"; |
207 | 207 | Database::query($sql); |
@@ -222,16 +222,16 @@ discard block |
||
222 | 222 | $arr_result = $result->load(null, $userid, $evaluationid); |
223 | 223 | $arr = get_object_vars($arr_result[0]); |
224 | 224 | |
225 | - $sql = 'INSERT INTO ' . $tbl_grade_results_log |
|
225 | + $sql = 'INSERT INTO '.$tbl_grade_results_log |
|
226 | 226 | . ' (id_result,user_id, evaluation_id,created_at'; |
227 | 227 | if (isset($arr['score'])) { |
228 | 228 | $sql .= ',score'; |
229 | 229 | } |
230 | 230 | $sql .= ') VALUES |
231 | - (' . (int) $arr['id'] . ',' . (int) $arr['user_id'] . ', ' . (int) $arr['evaluation'] |
|
232 | - . ", '" . api_get_utc_datetime() . "'"; |
|
231 | + (' . (int) $arr['id'].','.(int) $arr['user_id'].', '.(int) $arr['evaluation'] |
|
232 | + . ", '".api_get_utc_datetime()."'"; |
|
233 | 233 | if (isset($arr['score'])) { |
234 | - $sql .= ', ' . $arr['score']; |
|
234 | + $sql .= ', '.$arr['score']; |
|
235 | 235 | } |
236 | 236 | $sql .= ')'; |
237 | 237 | |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | public function save() |
248 | 248 | { |
249 | 249 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
250 | - $sql = 'UPDATE ' . $tbl_grade_results . ' |
|
250 | + $sql = 'UPDATE '.$tbl_grade_results.' |
|
251 | 251 | SET user_id = ' . $this->get_user_id() |
252 | - . ', evaluation_id = ' . $this->get_evaluation_id() |
|
252 | + . ', evaluation_id = '.$this->get_evaluation_id() |
|
253 | 253 | . ', score = '; |
254 | 254 | if (isset($this->score)) { |
255 | 255 | $sql .= $this->get_score(); |
256 | 256 | } else { |
257 | 257 | $sql .= 'null'; |
258 | 258 | } |
259 | - $sql .= ' WHERE id = ' . $this->id; |
|
259 | + $sql .= ' WHERE id = '.$this->id; |
|
260 | 260 | // no need to update creation date |
261 | 261 | Database::query($sql); |
262 | 262 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function delete() |
268 | 268 | { |
269 | 269 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
270 | - $sql = 'DELETE FROM ' . $tbl_grade_results . ' WHERE id = ' . $this->id; |
|
270 | + $sql = 'DELETE FROM '.$tbl_grade_results.' WHERE id = '.$this->id; |
|
271 | 271 | Database::query($sql); |
272 | 272 | } |
273 | 273 | } |
@@ -152,10 +152,11 @@ |
||
152 | 152 | $paramcount ++; |
153 | 153 | } |
154 | 154 | if (!empty($user_id)) { |
155 | - if ($paramcount != 0) |
|
156 | - $sql .= ' AND'; |
|
157 | - else |
|
158 | - $sql .= ' WHERE'; |
|
155 | + if ($paramcount != 0) { |
|
156 | + $sql .= ' AND'; |
|
157 | + } else { |
|
158 | + $sql .= ' WHERE'; |
|
159 | + } |
|
159 | 160 | $sql .= ' gr.user_id = ' . intval($user_id); |
160 | 161 | $paramcount ++; |
161 | 162 | } |
@@ -32,6 +32,8 @@ discard block |
||
32 | 32 | * @param array $evals |
33 | 33 | * @param array $links |
34 | 34 | * @param null $addparams |
35 | + * @param boolean $showTeacherView |
|
36 | + * @param integer $userId |
|
35 | 37 | */ |
36 | 38 | public function __construct( |
37 | 39 | $currentcat, |
@@ -895,7 +897,7 @@ discard block |
||
895 | 897 | |
896 | 898 | /** |
897 | 899 | * @param $item |
898 | - * @return mixed |
|
900 | + * @return string|null |
|
899 | 901 | */ |
900 | 902 | private function build_course_code($item) |
901 | 903 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->set_additional_parameters($addparams); |
72 | 72 | } |
73 | 73 | |
74 | - $column= 0; |
|
74 | + $column = 0; |
|
75 | 75 | if ($this->teacherView) { |
76 | 76 | if ($this->exportToPdf == false) { |
77 | 77 | $this->set_header($column++, '', '', 'width="25px"'); |
@@ -283,13 +283,13 @@ discard block |
||
283 | 283 | $main_categories[$item->get_id()]['name'] = $item->get_name(); |
284 | 284 | } else { |
285 | 285 | $name = $this->build_name_link($item, $type); |
286 | - $row[] = $invisibility_span_open.$name. $invisibility_span_close; |
|
286 | + $row[] = $invisibility_span_open.$name.$invisibility_span_close; |
|
287 | 287 | $main_categories[$item->get_id()]['name'] = $name; |
288 | 288 | } |
289 | 289 | |
290 | 290 | $this->dataForGraph['categories'][] = $item->get_name(); |
291 | 291 | |
292 | - $main_categories[$item->get_id()]['weight']= $item->get_weight(); |
|
292 | + $main_categories[$item->get_id()]['weight'] = $item->get_weight(); |
|
293 | 293 | $total_categories_weight += $item->get_weight(); |
294 | 294 | |
295 | 295 | // Description. |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | ); |
310 | 310 | |
311 | 311 | if ($this->teacherView) { |
312 | - $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
312 | + $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
313 | 313 | } else { |
314 | - $row[] = $invisibility_span_open .$weight.$invisibility_span_close; |
|
314 | + $row[] = $invisibility_span_open.$weight.$invisibility_span_close; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | $category_weight = $item->get_weight(); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | if (!empty($score[1])) { |
339 | 339 | $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT); |
340 | - $score = $score[0]/$score[1]*$item->get_weight(); |
|
340 | + $score = $score[0] / $score[1] * $item->get_weight(); |
|
341 | 341 | $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE); |
342 | 342 | $scoreToDisplay = Display::tip($score, $completeScore); |
343 | 343 | } else { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE)); |
374 | 374 | $this->dataForGraph['my_result'][] = (float) str_replace('%', '', $totalResultAverageValue); |
375 | 375 | $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); |
376 | - $this->dataForGraph['average'][] = (float) str_replace('%', '', $totalAverageValue); |
|
376 | + $this->dataForGraph['average'][] = (float) str_replace('%', '', $totalAverageValue); |
|
377 | 377 | // Ranking |
378 | 378 | $row[] = $ranking; |
379 | 379 | // Best |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); |
457 | 457 | |
458 | 458 | // Name. |
459 | - $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type) . $invisibility_span_close; |
|
459 | + $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type).$invisibility_span_close; |
|
460 | 460 | |
461 | 461 | // Description. |
462 | 462 | if ($this->exportToPdf == false) { |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | // Students get the results and certificates columns |
495 | 495 | $eval_n_links = array_merge($alleval, $alllink); |
496 | 496 | |
497 | - if (count($eval_n_links)> 0) { |
|
497 | + if (count($eval_n_links) > 0) { |
|
498 | 498 | $value_data = isset($data[4]) ? $data[4] : null; |
499 | 499 | |
500 | 500 | if (!is_null($value_data)) { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $row = array( |
594 | 594 | null, |
595 | 595 | null, |
596 | - '<strong>' . get_lang('Total') . '</strong>', |
|
596 | + '<strong>'.get_lang('Total').'</strong>', |
|
597 | 597 | null, |
598 | 598 | $total |
599 | 599 | ); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | if ($this->exportToPdf) { |
664 | 664 | $row = array( |
665 | 665 | null, |
666 | - '<h3>' . get_lang('Total') . '</h3>', |
|
666 | + '<h3>'.get_lang('Total').'</h3>', |
|
667 | 667 | $main_weight, |
668 | 668 | $totalResult, |
669 | 669 | $totalRanking, |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | } else { |
674 | 674 | $row = array( |
675 | 675 | null, |
676 | - '<h3>' . get_lang('Total') . '</h3>', |
|
676 | + '<h3>'.get_lang('Total').'</h3>', |
|
677 | 677 | null, |
678 | 678 | $main_weight, |
679 | 679 | $totalResult, |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | // Warning messages |
691 | - $view = isset($_GET['view']) ? $_GET['view']: null; |
|
691 | + $view = isset($_GET['view']) ? $_GET['view'] : null; |
|
692 | 692 | |
693 | 693 | if ($this->teacherView) { |
694 | 694 | if (isset($_GET['selectcat']) && |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | $weight_category = intval($this->build_weight($category[0])); |
702 | 702 | |
703 | 703 | $course_code = $this->build_course_code($category[0]); |
704 | - $weight_total_links = round($weight_total_links); |
|
704 | + $weight_total_links = round($weight_total_links); |
|
705 | 705 | |
706 | 706 | if ($weight_total_links > $weight_category || |
707 | 707 | $weight_total_links < $weight_category || |
708 | 708 | $weight_total_links > $weight_category |
709 | 709 | ) { |
710 | 710 | $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category); |
711 | - $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
711 | + $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
712 | 712 | Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>'; |
713 | 713 | $warning_message .= $modify_icons; |
714 | 714 | Display::display_warning_message($warning_message, false); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | ); |
722 | 722 | |
723 | 723 | if (!empty($content_html)) { |
724 | - $new_content = explode('</head>',$content_html['content']); |
|
724 | + $new_content = explode('</head>', $content_html['content']); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | if (empty($new_content[0])) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | is_array($course_codes) |
756 | 756 | ) { |
757 | 757 | $warning_message = ''; |
758 | - for ($x = 0; $x<count($weight_categories);$x++) { |
|
758 | + for ($x = 0; $x < count($weight_categories); $x++) { |
|
759 | 759 | $weight_category = intval($weight_categories[$x]); |
760 | 760 | $certificate_min_score = intval($certificate_min_scores[$x]); |
761 | 761 | $course_code = $course_codes[$x]; |
@@ -763,12 +763,12 @@ discard block |
||
763 | 763 | if (empty($certificate_min_score) || |
764 | 764 | ($certificate_min_score > $weight_category) |
765 | 765 | ) { |
766 | - $warning_message .= $course_code .' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
766 | + $warning_message .= $course_code.' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
770 | 770 | if (!empty($warning_message)) { |
771 | - Display::display_warning_message($warning_message,false); |
|
771 | + Display::display_warning_message($warning_message, false); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | } |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | $pChart->Antialias = FALSE; |
813 | 813 | |
814 | 814 | /* Add a border to the picture */ |
815 | - $pChart->drawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0)); |
|
815 | + $pChart->drawRectangle(0, 0, $xSize - 10, $ySize - 10, array("R"=>0, "G"=>0, "B"=>0)); |
|
816 | 816 | |
817 | - $pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT)); |
|
817 | + $pChart->drawText(10, 16, get_lang('Results'), array("FontSize"=>11, "Align"=>TEXT_ALIGN_BOTTOMLEFT)); |
|
818 | 818 | |
819 | - $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50); |
|
819 | + $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50); |
|
820 | 820 | |
821 | 821 | $pChart->setFontProperties( |
822 | 822 | array( |
823 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
823 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
824 | 824 | 'FontSize' => 10, |
825 | 825 | ) |
826 | 826 | ); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | |
841 | 841 | /* Draw the line chart */ |
842 | 842 | $pChart->drawLineChart(); |
843 | - $pChart->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80)); |
|
843 | + $pChart->drawPlotChart(array("DisplayValues"=>TRUE, "PlotBorder"=>TRUE, "BorderSize"=>2, "Surrounding"=>-60, "BorderAlpha"=>80)); |
|
844 | 844 | |
845 | 845 | /* Write the chart legend */ |
846 | 846 | $pChart->drawLegend( |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | $chartHash = $myCache->getHash($dataSet); |
861 | 861 | |
862 | 862 | $myCache->writeToCache($chartHash, $pChart); |
863 | - $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
863 | + $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
864 | 864 | $myCache->saveFromCache($chartHash, $imgSysPath); |
865 | - $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
865 | + $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
866 | 866 | |
867 | 867 | if (file_exists($imgSysPath)) { |
868 | 868 | $result = '<div id="contentArea" style="text-align: center;" >'; |
869 | - $result .= '<img src="' . $imgWebPath.'" >'; |
|
869 | + $result .= '<img src="'.$imgWebPath.'" >'; |
|
870 | 870 | $result .= '</div>'; |
871 | 871 | return $result; |
872 | 872 | } |
@@ -911,13 +911,13 @@ discard block |
||
911 | 911 | switch ($item->get_item_type()) { |
912 | 912 | // category |
913 | 913 | case 'C' : |
914 | - return 'CATE' . $item->get_id(); |
|
914 | + return 'CATE'.$item->get_id(); |
|
915 | 915 | // evaluation |
916 | 916 | case 'E' : |
917 | - return 'EVAL' . $item->get_id(); |
|
917 | + return 'EVAL'.$item->get_id(); |
|
918 | 918 | // link |
919 | 919 | case 'L' : |
920 | - return 'LINK' . $item->get_id(); |
|
920 | + return 'LINK'.$item->get_id(); |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | switch ($item->get_item_type()) { |
946 | 946 | // category |
947 | 947 | case 'C' : |
948 | - $prms_uri='?selectcat=' . $item->get_id() . '&view='.$view; |
|
948 | + $prms_uri = '?selectcat='.$item->get_id().'&view='.$view; |
|
949 | 949 | |
950 | 950 | if (isset($_GET['isStudentView'])) { |
951 | - if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) { |
|
952 | - $prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
951 | + if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) { |
|
952 | + $prms_uri = $prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | 956 | $cat = new Category(); |
957 | - $show_message=$cat->show_message_resource_delete($item->get_course_code()); |
|
957 | + $show_message = $cat->show_message_resource_delete($item->get_course_code()); |
|
958 | 958 | return ' <a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">' |
959 | 959 | . $item->get_name() |
960 | 960 | . '</a>' |
961 | - . ($item->is_course() ? ' [' . $item->get_course_code() . ']'.$show_message : ''); |
|
961 | + . ($item->is_course() ? ' ['.$item->get_course_code().']'.$show_message : ''); |
|
962 | 962 | // evaluation |
963 | 963 | case 'E' : |
964 | 964 | $cat = new Category(); |
@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | $show_message = $cat->show_message_resource_delete($course_id); |
967 | 967 | |
968 | 968 | // course/platform admin can go to the view_results page |
969 | - if (api_is_allowed_to_edit() && $show_message===false) { |
|
969 | + if (api_is_allowed_to_edit() && $show_message === false) { |
|
970 | 970 | if ($item->get_type() == 'presence') { |
971 | 971 | return ' ' |
972 | - . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">' |
|
972 | + . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval='.$item->get_id().'">' |
|
973 | 973 | . $item->get_name() |
974 | 974 | . '</a>'; |
975 | 975 | } else { |
@@ -978,20 +978,20 @@ discard block |
||
978 | 978 | $extra = ''; |
979 | 979 | } |
980 | 980 | return ' ' |
981 | - . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
981 | + . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
982 | 982 | . $item->get_name() |
983 | 983 | . '</a> '.$extra; |
984 | 984 | } |
985 | - } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) { |
|
985 | + } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) { |
|
986 | 986 | // students can go to the statistics page (if custom display enabled) |
987 | 987 | return ' ' |
988 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
988 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
989 | 989 | . $item->get_name() |
990 | 990 | . '</a>'; |
991 | 991 | |
992 | 992 | } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) { |
993 | 993 | return ' ' |
994 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
994 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
995 | 995 | . $item->get_name() |
996 | 996 | . '</a>'; |
997 | 997 | } else { |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | $url = $item->get_link(); |
1007 | 1007 | |
1008 | 1008 | if (isset($url) && $show_message === false) { |
1009 | - $text = ' <a href="' . $item->get_link() . '">' |
|
1009 | + $text = ' <a href="'.$item->get_link().'">' |
|
1010 | 1010 | . $item->get_name() |
1011 | 1011 | . '</a>'; |
1012 | 1012 | } else { |
@@ -256,10 +256,11 @@ |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | // Categories. |
259 | - if (!empty($data_array)) |
|
260 | - foreach ($data_array as $data) { |
|
259 | + if (!empty($data_array)) { |
|
260 | + foreach ($data_array as $data) { |
|
261 | 261 | // list of items inside the gradebook (exercises, lps, forums, etc) |
262 | 262 | $row = array(); |
263 | + } |
|
263 | 264 | /** @var AbstractLink $item */ |
264 | 265 | $item = $mainCategory = $data[0]; |
265 | 266 |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | -use ChamiloSession as Session; |
|
5 | 4 | use Symfony\Component\Finder\Finder; |
6 | 5 | |
7 | 6 | require_once '../inc/global.inc.php'; |
@@ -124,8 +124,8 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $link |
|
128 | - * @param $courseCode |
|
127 | + * @param integer $link |
|
128 | + * @param null|string $courseCode |
|
129 | 129 | * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
130 | 130 | */ |
131 | 131 | private function createLink($link, $courseCode) |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | |
57 | 57 | protected function build_move() |
58 | 58 | { |
59 | - $renderer =& $this->defaultRenderer(); |
|
59 | + $renderer = & $this->defaultRenderer(); |
|
60 | 60 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
61 | - $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | - $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | - $select = $this->addElement('select','move_cat',null,null); |
|
61 | + $this->addElement('static', null, null, '"'.$this->link_object->get_name().'" '); |
|
62 | + $this->addElement('static', null, null, get_lang('MoveTo').' : '); |
|
63 | + $select = $this->addElement('select', 'move_cat', null, null); |
|
64 | 64 | $line = ''; |
65 | 65 | foreach ($this->link_object->get_target_categories() as $cat) { |
66 | - for ($i=0;$i<$cat[2];$i++) { |
|
66 | + for ($i = 0; $i < $cat[2]; $i++) { |
|
67 | 67 | $line .= '—'; |
68 | 68 | } |
69 | - $select->addoption($line.' '.$cat[1],$cat[0]); |
|
69 | + $select->addoption($line.' '.$cat[1], $cat[0]); |
|
70 | 70 | $line = ''; |
71 | 71 | } |
72 | 72 | $this->addElement('submit', null, get_lang('Ok')); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $link = LinkFactory::create($link); |
134 | 134 | if (!empty($courseCode)) { |
135 | 135 | $link->set_course_code($courseCode); |
136 | - } elseif(!empty($_GET['course_code'])) { |
|
136 | + } elseif (!empty($_GET['course_code'])) { |
|
137 | 137 | $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
138 | 138 | } |
139 | 139 |
@@ -10,133 +10,133 @@ |
||
10 | 10 | */ |
11 | 11 | class LinkForm extends FormValidator |
12 | 12 | { |
13 | - const TYPE_CREATE = 1; |
|
14 | - const TYPE_MOVE = 2; |
|
15 | - /** @var Category */ |
|
16 | - private $category_object; |
|
17 | - private $link_object; |
|
18 | - private $extra; |
|
13 | + const TYPE_CREATE = 1; |
|
14 | + const TYPE_MOVE = 2; |
|
15 | + /** @var Category */ |
|
16 | + private $category_object; |
|
17 | + private $link_object; |
|
18 | + private $extra; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Builds a form containing form items based on a given parameter |
|
22 | - * @param int form_type 1=choose link |
|
23 | - * @param obj cat_obj the category object |
|
24 | - * @param string form name |
|
25 | - * @param method |
|
26 | - * @param action |
|
27 | - */ |
|
28 | - public function __construct( |
|
29 | - $form_type, |
|
30 | - $category_object, |
|
31 | - $link_object, |
|
32 | - $form_name, |
|
33 | - $method = 'post', |
|
34 | - $action = null, |
|
35 | - $extra = null |
|
36 | - ) { |
|
37 | - parent :: __construct($form_name, $method, $action); |
|
20 | + /** |
|
21 | + * Builds a form containing form items based on a given parameter |
|
22 | + * @param int form_type 1=choose link |
|
23 | + * @param obj cat_obj the category object |
|
24 | + * @param string form name |
|
25 | + * @param method |
|
26 | + * @param action |
|
27 | + */ |
|
28 | + public function __construct( |
|
29 | + $form_type, |
|
30 | + $category_object, |
|
31 | + $link_object, |
|
32 | + $form_name, |
|
33 | + $method = 'post', |
|
34 | + $action = null, |
|
35 | + $extra = null |
|
36 | + ) { |
|
37 | + parent :: __construct($form_name, $method, $action); |
|
38 | 38 | |
39 | - if (isset ($category_object)) { |
|
40 | - $this->category_object = $category_object; |
|
41 | - } else { |
|
42 | - if (isset($link_object)) { |
|
43 | - $this->link_object = $link_object; |
|
44 | - } |
|
45 | - } |
|
39 | + if (isset ($category_object)) { |
|
40 | + $this->category_object = $category_object; |
|
41 | + } else { |
|
42 | + if (isset($link_object)) { |
|
43 | + $this->link_object = $link_object; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - if (isset ($extra)) { |
|
48 | - $this->extra = $extra; |
|
49 | - } |
|
50 | - if ($form_type == self :: TYPE_CREATE) { |
|
51 | - $this->build_create(); |
|
52 | - } elseif ($form_type == self :: TYPE_MOVE) { |
|
53 | - $this->build_move(); |
|
54 | - } |
|
55 | - } |
|
47 | + if (isset ($extra)) { |
|
48 | + $this->extra = $extra; |
|
49 | + } |
|
50 | + if ($form_type == self :: TYPE_CREATE) { |
|
51 | + $this->build_create(); |
|
52 | + } elseif ($form_type == self :: TYPE_MOVE) { |
|
53 | + $this->build_move(); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - protected function build_move() |
|
58 | - { |
|
59 | - $renderer =& $this->defaultRenderer(); |
|
60 | - $renderer->setCustomElementTemplate('<span>{element}</span> '); |
|
61 | - $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | - $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | - $select = $this->addElement('select','move_cat',null,null); |
|
64 | - $line = ''; |
|
65 | - foreach ($this->link_object->get_target_categories() as $cat) { |
|
66 | - for ($i=0;$i<$cat[2];$i++) { |
|
67 | - $line .= '—'; |
|
68 | - } |
|
69 | - $select->addoption($line.' '.$cat[1],$cat[0]); |
|
70 | - $line = ''; |
|
71 | - } |
|
72 | - $this->addElement('submit', null, get_lang('Ok')); |
|
73 | - } |
|
57 | + protected function build_move() |
|
58 | + { |
|
59 | + $renderer =& $this->defaultRenderer(); |
|
60 | + $renderer->setCustomElementTemplate('<span>{element}</span> '); |
|
61 | + $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | + $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | + $select = $this->addElement('select','move_cat',null,null); |
|
64 | + $line = ''; |
|
65 | + foreach ($this->link_object->get_target_categories() as $cat) { |
|
66 | + for ($i=0;$i<$cat[2];$i++) { |
|
67 | + $line .= '—'; |
|
68 | + } |
|
69 | + $select->addoption($line.' '.$cat[1],$cat[0]); |
|
70 | + $line = ''; |
|
71 | + } |
|
72 | + $this->addElement('submit', null, get_lang('Ok')); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Builds the form |
|
77 | - */ |
|
78 | - protected function build_create() |
|
79 | - { |
|
80 | - $this->addElement('header', get_lang('MakeLink')); |
|
81 | - $select = $this->addElement( |
|
82 | - 'select', |
|
83 | - 'select_link', |
|
84 | - get_lang('ChooseLink'), |
|
85 | - null, |
|
86 | - array('onchange' => 'document.create_link.submit()') |
|
87 | - ); |
|
75 | + /** |
|
76 | + * Builds the form |
|
77 | + */ |
|
78 | + protected function build_create() |
|
79 | + { |
|
80 | + $this->addElement('header', get_lang('MakeLink')); |
|
81 | + $select = $this->addElement( |
|
82 | + 'select', |
|
83 | + 'select_link', |
|
84 | + get_lang('ChooseLink'), |
|
85 | + null, |
|
86 | + array('onchange' => 'document.create_link.submit()') |
|
87 | + ); |
|
88 | 88 | |
89 | - $linkTypes = LinkFactory::get_all_types(); |
|
89 | + $linkTypes = LinkFactory::get_all_types(); |
|
90 | 90 | |
91 | - $select->addoption('['.get_lang('ChooseLink').']', 0); |
|
91 | + $select->addoption('['.get_lang('ChooseLink').']', 0); |
|
92 | 92 | |
93 | - $courseCode = $this->category_object->get_course_code(); |
|
93 | + $courseCode = $this->category_object->get_course_code(); |
|
94 | 94 | |
95 | - foreach ($linkTypes as $linkType) { |
|
96 | - // The hot potatoe link will be added "inside" the exercise option. |
|
97 | - if ($linkType == LINK_HOTPOTATOES) { |
|
98 | - continue; |
|
99 | - } |
|
100 | - $link = $this->createLink($linkType, $courseCode); |
|
101 | - // disable this element if the link works with a dropdownlist |
|
102 | - // and if there are no links left |
|
103 | - if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') { |
|
104 | - $select->addoption($link->get_type_name(), $linkType, 'disabled'); |
|
105 | - } else { |
|
106 | - if ($link->get_type() == LINK_EXERCISE) { |
|
107 | - // Adding exercise |
|
108 | - $select->addoption($link->get_type_name(), $linkType); |
|
109 | - // Adding hot potatoes |
|
110 | - $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode); |
|
111 | - $select->addoption( |
|
112 | - ' '.$linkHot->get_type_name(), |
|
113 | - LINK_HOTPOTATOES |
|
114 | - ); |
|
115 | - } else { |
|
116 | - $select->addoption($link->get_type_name(), $linkType); |
|
117 | - } |
|
118 | - } |
|
119 | - } |
|
95 | + foreach ($linkTypes as $linkType) { |
|
96 | + // The hot potatoe link will be added "inside" the exercise option. |
|
97 | + if ($linkType == LINK_HOTPOTATOES) { |
|
98 | + continue; |
|
99 | + } |
|
100 | + $link = $this->createLink($linkType, $courseCode); |
|
101 | + // disable this element if the link works with a dropdownlist |
|
102 | + // and if there are no links left |
|
103 | + if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') { |
|
104 | + $select->addoption($link->get_type_name(), $linkType, 'disabled'); |
|
105 | + } else { |
|
106 | + if ($link->get_type() == LINK_EXERCISE) { |
|
107 | + // Adding exercise |
|
108 | + $select->addoption($link->get_type_name(), $linkType); |
|
109 | + // Adding hot potatoes |
|
110 | + $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode); |
|
111 | + $select->addoption( |
|
112 | + ' '.$linkHot->get_type_name(), |
|
113 | + LINK_HOTPOTATOES |
|
114 | + ); |
|
115 | + } else { |
|
116 | + $select->addoption($link->get_type_name(), $linkType); |
|
117 | + } |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - if (isset($this->extra)) { |
|
122 | - $this->setDefaults(array('select_link' => $this->extra)); |
|
123 | - } |
|
124 | - } |
|
121 | + if (isset($this->extra)) { |
|
122 | + $this->setDefaults(array('select_link' => $this->extra)); |
|
123 | + } |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * @param $link |
|
128 | - * @param $courseCode |
|
129 | - * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
|
130 | - */ |
|
131 | - private function createLink($link, $courseCode) |
|
132 | - { |
|
133 | - $link = LinkFactory::create($link); |
|
134 | - if (!empty($courseCode)) { |
|
135 | - $link->set_course_code($courseCode); |
|
136 | - } elseif(!empty($_GET['course_code'])) { |
|
137 | - $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
|
138 | - } |
|
126 | + /** |
|
127 | + * @param $link |
|
128 | + * @param $courseCode |
|
129 | + * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
|
130 | + */ |
|
131 | + private function createLink($link, $courseCode) |
|
132 | + { |
|
133 | + $link = LinkFactory::create($link); |
|
134 | + if (!empty($courseCode)) { |
|
135 | + $link->set_course_code($courseCode); |
|
136 | + } elseif(!empty($_GET['course_code'])) { |
|
137 | + $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
|
138 | + } |
|
139 | 139 | |
140 | - return $link; |
|
141 | - } |
|
140 | + return $link; |
|
141 | + } |
|
142 | 142 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Exports the complete report as an XLS file |
79 | - * @return boolean False on error |
|
79 | + * @return boolean|null False on error |
|
80 | 80 | */ |
81 | 81 | public function exportCompleteReportXLS($data) |
82 | 82 | { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * constructor of the class |
16 | 16 | */ |
17 | - public function __construct($get_questions=false,$get_answers=false) |
|
17 | + public function __construct($get_questions = false, $get_answers = false) |
|
18 | 18 | { |
19 | 19 | } |
20 | 20 | |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | //titles |
37 | 37 | |
38 | 38 | foreach ($dato[0] as $header_col) { |
39 | - if(!empty($header_col)) { |
|
40 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($header_col))).';'; |
|
39 | + if (!empty($header_col)) { |
|
40 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($header_col))).';'; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - $data .="\r\n"; |
|
44 | + $data .= "\r\n"; |
|
45 | 45 | $cant_students = count($dato[1]); |
46 | 46 | //print_r($data); exit(); |
47 | 47 | |
48 | - for($i=0;$i<$cant_students;$i++) { |
|
48 | + for ($i = 0; $i < $cant_students; $i++) { |
|
49 | 49 | $column = 0; |
50 | - foreach($dato[1][$i] as $col_name) { |
|
51 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($col_name))).';'; |
|
50 | + foreach ($dato[1][$i] as $col_name) { |
|
51 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($col_name))).';'; |
|
52 | 52 | } |
53 | - $data .="\r\n"; |
|
53 | + $data .= "\r\n"; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //output the results |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | for ($i = 0; $i < $cant_students; $i++) { |
102 | 102 | $column = 0; |
103 | 103 | foreach ($data[1][$i] as $col_name) { |
104 | - $worksheet->SetCellValueByColumnAndRow($line,$column, html_entity_decode(strip_tags($col_name))); |
|
104 | + $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($col_name))); |
|
105 | 105 | $column++; |
106 | 106 | } |
107 | 107 | $line++; |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | 'border_sz' => 20 |
138 | 138 | ); |
139 | 139 | $lines = 0; |
140 | - $values[] = implode("\t",$data[0]); |
|
140 | + $values[] = implode("\t", $data[0]); |
|
141 | 141 | foreach ($data[1] as $line) { |
142 | - $values[] = implode("\t",$line); |
|
142 | + $values[] = implode("\t", $line); |
|
143 | 143 | $lines++; |
144 | 144 | } |
145 | 145 | //$data = array(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // 'right' => 4000, |
155 | 155 | // 'left' => 4000 |
156 | 156 | ); |
157 | - $docx->createDocx($filepath,$paramsPage); |
|
157 | + $docx->createDocx($filepath, $paramsPage); |
|
158 | 158 | //output the results |
159 | 159 | $data = file_get_contents($filepath.'.docx'); |
160 | 160 | $len = strlen($data); |
@@ -19,6 +19,7 @@ discard block |
||
19 | 19 | * @param int Visibility (0 hidden, 1 shown) |
20 | 20 | * @param int Session ID (optional or 0 if not defined) |
21 | 21 | * @param int |
22 | + * @param integer $resource_type |
|
22 | 23 | * @return boolean True on success, false on failure |
23 | 24 | */ |
24 | 25 | public static function add_resource_to_course_gradebook( |
@@ -117,7 +118,6 @@ discard block |
||
117 | 118 | |
118 | 119 | /** |
119 | 120 | * Builds an img tag for a gradebook item |
120 | - * @param string $type value returned by a gradebookitem's get_icon_name() |
|
121 | 121 | */ |
122 | 122 | public static function build_type_icon_tag($kind, $attributes = array()) |
123 | 123 | { |
@@ -382,6 +382,7 @@ discard block |
||
382 | 382 | * @param int Resource type (use constants defined in linkfactory.class.php) |
383 | 383 | * @param int Resource ID in the corresponding tool |
384 | 384 | * @param int Session ID (optional - 0 if not defined) |
385 | + * @param integer $resource_type |
|
385 | 386 | * @return int false on error or array of resource |
386 | 387 | */ |
387 | 388 | public static function is_resource_in_course_gradebook($course_code, $resource_type, $resource_id, $session_id = 0) |
@@ -579,6 +580,9 @@ discard block |
||
579 | 580 | * @param int The user id |
580 | 581 | * @param float The score obtained for certified |
581 | 582 | * @param Datetime The date when you obtained the certificate |
583 | + * @param integer $cat_id |
|
584 | + * @param integer $user_id |
|
585 | + * @param string $date_certificate |
|
582 | 586 | * @return void() |
583 | 587 | */ |
584 | 588 | public static function register_user_info_about_certificate($cat_id, $user_id, $score_certificate, $date_certificate) |
@@ -955,7 +959,7 @@ discard block |
||
955 | 959 | } |
956 | 960 | |
957 | 961 | /** |
958 | - * @param array $list_values |
|
962 | + * @param string[] $list_values |
|
959 | 963 | * @return string |
960 | 964 | */ |
961 | 965 | public static function score_badges($list_values) |
@@ -1015,7 +1019,7 @@ discard block |
||
1015 | 1019 | } |
1016 | 1020 | |
1017 | 1021 | /** |
1018 | - * @param $result |
|
1022 | + * @param Doctrine\DBAL\Driver\Statement|null $result |
|
1019 | 1023 | * @return array |
1020 | 1024 | */ |
1021 | 1025 | public static function get_user_array_from_sql_result($result) |
@@ -249,7 +249,7 @@ |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
252 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
253 | 253 | Display::return_icon( |
254 | 254 | 'percentage.png', |
255 | 255 | get_lang('EditAllWeights'), |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible'; |
214 | 214 | $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible'; |
215 | 215 | |
216 | - $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . |
|
217 | - Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>'; |
|
216 | + $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'. |
|
217 | + Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>'; |
|
218 | 218 | |
219 | 219 | if (!api_is_allowed_to_edit(null, true)) { |
220 | 220 | $modify_icons .= Display::url( |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | '', |
225 | 225 | ICON_SIZE_SMALL |
226 | 226 | ), |
227 | - 'personal_stats.php?' . http_build_query([ |
|
227 | + 'personal_stats.php?'.http_build_query([ |
|
228 | 228 | 'selectcat' => $cat->get_id() |
229 | - ]) . '&' . api_get_cidreq(), |
|
229 | + ]).'&'.api_get_cidreq(), |
|
230 | 230 | [ |
231 | 231 | 'class' => 'ajax', |
232 | 232 | 'data-title' => get_lang('FlatView') |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | ) { |
244 | 244 | if ($cat->is_locked()) { |
245 | 245 | if (api_is_platform_admin()) { |
246 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' . |
|
247 | - Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
246 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'. |
|
247 | + Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
248 | 248 | } else { |
249 | - $modify_icons .= ' <a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>'; |
|
249 | + $modify_icons .= ' <a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>'; |
|
250 | 250 | } |
251 | - $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
251 | + $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
252 | 252 | } else { |
253 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' . |
|
254 | - Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
255 | - $modify_icons .= ' <a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
253 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'. |
|
254 | + Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
255 | + $modify_icons .= ' <a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -260,44 +260,44 @@ discard block |
||
260 | 260 | if ($cat->is_locked() && !api_is_platform_admin()) { |
261 | 261 | $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
262 | 262 | } else { |
263 | - $modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
263 | + $modify_icons .= '<a href="gradebook_edit_cat.php?'.'editcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
264 | 264 | Display::return_icon( |
265 | 265 | 'edit.png', |
266 | 266 | get_lang('Modify'), |
267 | 267 | '', |
268 | 268 | ICON_SIZE_SMALL |
269 | - ) . '</a>'; |
|
269 | + ).'</a>'; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
273 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
274 | 274 | Display::return_icon( |
275 | 275 | 'percentage.png', |
276 | 276 | get_lang('EditAllWeights'), |
277 | 277 | '', |
278 | 278 | ICON_SIZE_SMALL |
279 | - ) . '</a>'; |
|
279 | + ).'</a>'; |
|
280 | 280 | |
281 | - $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
281 | + $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
282 | 282 | Display::return_icon( |
283 | 283 | 'stats.png', |
284 | 284 | get_lang('FlatView'), |
285 | 285 | '', |
286 | 286 | ICON_SIZE_SMALL |
287 | - ) . '</a>'; |
|
288 | - $modify_icons .= ' <a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
287 | + ).'</a>'; |
|
288 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
289 | 289 | Display::return_icon( |
290 | - $visibility_icon . '.png', |
|
290 | + $visibility_icon.'.png', |
|
291 | 291 | get_lang('Visible'), |
292 | 292 | '', |
293 | 293 | ICON_SIZE_SMALL |
294 | - ) . '</a>'; |
|
294 | + ).'</a>'; |
|
295 | 295 | |
296 | 296 | if ($cat->is_locked() && !api_is_platform_admin()) { |
297 | 297 | $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL); |
298 | 298 | } else { |
299 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '" onclick="return confirmation();">' . |
|
300 | - Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>'; |
|
299 | + $modify_icons .= ' <a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'" onclick="return confirmation();">'. |
|
300 | + Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>'; |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
@@ -324,21 +324,21 @@ discard block |
||
324 | 324 | if ($is_locked && !api_is_platform_admin()) { |
325 | 325 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
326 | 326 | } else { |
327 | - $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
328 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
327 | + $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
328 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
329 | 329 | } |
330 | 330 | |
331 | - $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' . |
|
332 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
331 | + $modify_icons .= ' <a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$eval->getSessionId().' ">'. |
|
332 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
333 | 333 | if (api_is_allowed_to_edit(null, true)) { |
334 | - $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
335 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
334 | + $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
335 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | if ($is_locked && !api_is_platform_admin()) { |
339 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
339 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
340 | 340 | } else { |
341 | - $modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
341 | + $modify_icons .= ' <a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
342 | 342 | } |
343 | 343 | return $modify_icons; |
344 | 344 | } |
@@ -368,21 +368,21 @@ discard block |
||
368 | 368 | if ($is_locked && !api_is_platform_admin()) { |
369 | 369 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
370 | 370 | } else { |
371 | - $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' . |
|
372 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
371 | + $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
372 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
373 | 373 | } |
374 | - $modify_icons .= ' <a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' . |
|
375 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
376 | - $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' . |
|
377 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
374 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$link->get_session_id().' ">'. |
|
375 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
376 | + $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
377 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
378 | 378 | |
379 | 379 | //If a work is added in a gradebook you can only delete the link in the work tool |
380 | 380 | |
381 | 381 | if ($is_locked && !api_is_platform_admin()) { |
382 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
382 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
383 | 383 | } else { |
384 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '" onclick="return confirmation();">' . |
|
385 | - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
384 | + $modify_icons .= ' <a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'" onclick="return confirmation();">'. |
|
385 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
386 | 386 | } |
387 | 387 | return $modify_icons; |
388 | 388 | } |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | { |
624 | 624 | $result = Result :: load($resid); |
625 | 625 | if ($importscore > $eval_max) { |
626 | - header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax='); |
|
626 | + header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax='); |
|
627 | 627 | exit; |
628 | 628 | } |
629 | 629 | $result[0]->set_score($importscore); |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | { |
665 | 665 | $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
666 | 666 | $sql = 'SELECT COUNT(*) as count |
667 | - FROM ' . $table . ' gc |
|
668 | - WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" '; |
|
667 | + FROM ' . $table.' gc |
|
668 | + WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" '; |
|
669 | 669 | $rs_exist = Database::query($sql); |
670 | 670 | $row = Database::fetch_array($rs_exist); |
671 | 671 | if ($row['count'] == 0) { |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | public static function get_certificate_by_user_id($cat_id, $user_id) |
689 | 689 | { |
690 | 690 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
691 | - $sql = 'SELECT * FROM ' . $table_certificate . ' |
|
692 | - WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; |
|
691 | + $sql = 'SELECT * FROM '.$table_certificate.' |
|
692 | + WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"'; |
|
693 | 693 | |
694 | 694 | $result = Database::query($sql); |
695 | 695 | $row = Database::fetch_array($result, 'ASSOC'); |
@@ -708,18 +708,18 @@ discard block |
||
708 | 708 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
709 | 709 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
710 | 710 | $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username |
711 | - FROM ' . $table_user . ' u |
|
712 | - INNER JOIN ' . $table_certificate . ' gc |
|
711 | + FROM ' . $table_user.' u |
|
712 | + INNER JOIN ' . $table_certificate.' gc |
|
713 | 713 | ON u.user_id=gc.user_id '; |
714 | 714 | if (!is_null($cat_id) && $cat_id > 0) { |
715 | - $sql.=' WHERE cat_id=' . intval($cat_id); |
|
715 | + $sql .= ' WHERE cat_id='.intval($cat_id); |
|
716 | 716 | } |
717 | 717 | if (!empty($userList)) { |
718 | 718 | $userList = array_map('intval', $userList); |
719 | 719 | $userListCondition = implode("','", $userList); |
720 | 720 | $sql .= " AND u.user_id IN ('$userListCondition')"; |
721 | 721 | } |
722 | - $sql.=' ORDER BY u.firstname'; |
|
722 | + $sql .= ' ORDER BY u.firstname'; |
|
723 | 723 | $rs = Database::query($sql); |
724 | 724 | |
725 | 725 | $list_users = array(); |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | { |
741 | 741 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
742 | 742 | $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id |
743 | - FROM ' . $table_certificate . ' gc |
|
744 | - WHERE gc.user_id="' . intval($user_id) . '" '; |
|
743 | + FROM ' . $table_certificate.' gc |
|
744 | + WHERE gc.user_id="' . intval($user_id).'" '; |
|
745 | 745 | if (!is_null($cat_id) && $cat_id > 0) { |
746 | - $sql.=' AND cat_id=' . intval($cat_id); |
|
746 | + $sql .= ' AND cat_id='.intval($cat_id); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | $rs = Database::query($sql); |
@@ -781,12 +781,12 @@ discard block |
||
781 | 781 | $variables = $content_html['variables']; |
782 | 782 | } |
783 | 783 | |
784 | - $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery'; |
|
784 | + $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery'; |
|
785 | 785 | $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html); |
786 | 786 | |
787 | - $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document'; |
|
787 | + $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; |
|
788 | 788 | $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html); |
789 | - $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
789 | + $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
790 | 790 | |
791 | 791 | //add print header |
792 | 792 | if ($hide_print_button == false) { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | } |
798 | 798 | |
799 | 799 | // Add header |
800 | - $new_content_html = $contentHead. $print . '</head>' . $new_content_html; |
|
800 | + $new_content_html = $contentHead.$print.'</head>'.$new_content_html; |
|
801 | 801 | |
802 | 802 | return array( |
803 | 803 | 'content' => $new_content_html, |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | if (!empty($session_id)) { |
852 | 852 | $my_session_id = api_get_session_id(); |
853 | 853 | $s_name = api_get_session_name($my_session_id); |
854 | - $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name); |
|
854 | + $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name); |
|
855 | 855 | $cat->set_session_id($session_id); |
856 | 856 | } else { |
857 | 857 | $cat->set_name($course_code); |
@@ -975,13 +975,13 @@ discard block |
||
975 | 975 | |
976 | 976 | if ($use_grade_model) { |
977 | 977 | if ($parent_id == 0) { |
978 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
978 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
979 | 979 | } else { |
980 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; |
|
980 | + $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')'; |
|
981 | 981 | } |
982 | 982 | } else { |
983 | 983 | if ($parent_id == 0) { |
984 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
984 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
985 | 985 | } else { |
986 | 986 | $title = api_strtoupper(get_lang('Average')); |
987 | 987 | } |
@@ -1035,11 +1035,11 @@ discard block |
||
1035 | 1035 | } else { |
1036 | 1036 | $column = 0; |
1037 | 1037 | $table->setCellContents($row, $column, get_lang('NoResults')); |
1038 | - $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); |
|
1038 | + $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | $pdfParams = array( |
1042 | - 'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), |
|
1042 | + 'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(), |
|
1043 | 1043 | 'pdf_title' => $title, |
1044 | 1044 | 'course_code' => $course_code, |
1045 | 1045 | 'add_signatures' => true |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | $a_students = array(); |
1125 | 1125 | while ($user = Database::fetch_array($result)) { |
1126 | 1126 | if (!array_key_exists($user['user_id'], $a_students)) { |
1127 | - $a_current_student = array (); |
|
1127 | + $a_current_student = array(); |
|
1128 | 1128 | $a_current_student[] = $user['user_id']; |
1129 | 1129 | $a_current_student[] = $user['username']; |
1130 | 1130 | $a_current_student[] = $user['lastname']; |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | foreach ($links as $link) { |
1183 | 1183 | // links are always in a course |
1184 | 1184 | $coursecode = $link->get_course_code(); |
1185 | - if (!array_key_exists($coursecode,$coursecodes)) { |
|
1185 | + if (!array_key_exists($coursecode, $coursecodes)) { |
|
1186 | 1186 | $coursecodes[$coursecode] = '1'; |
1187 | 1187 | $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode)); |
1188 | 1188 | } |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | * Search students matching a given last name and/or first name |
1196 | 1196 | * @author Bert Steppé |
1197 | 1197 | */ |
1198 | - public static function find_students($mask= '') |
|
1198 | + public static function find_students($mask = '') |
|
1199 | 1199 | { |
1200 | 1200 | // students shouldn't be here // don't search if mask empty |
1201 | 1201 | if (!api_is_allowed_to_edit() || empty ($mask)) { |
@@ -1206,23 +1206,23 @@ discard block |
||
1206 | 1206 | $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
1207 | 1207 | $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
1208 | 1208 | $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code |
1209 | - FROM ' . $tbl_user . ' user'; |
|
1209 | + FROM ' . $tbl_user.' user'; |
|
1210 | 1210 | if (!api_is_platform_admin()) { |
1211 | - $sql .= ', ' . $tbl_cru . ' cru'; |
|
1211 | + $sql .= ', '.$tbl_cru.' cru'; |
|
1212 | 1212 | } |
1213 | 1213 | |
1214 | - $sql .= ' WHERE user.status = ' . STUDENT; |
|
1215 | - $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'"; |
|
1216 | - $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')"; |
|
1214 | + $sql .= ' WHERE user.status = '.STUDENT; |
|
1215 | + $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'"; |
|
1216 | + $sql .= ' OR user.firstname LIKE '."'%".$mask."%')"; |
|
1217 | 1217 | |
1218 | 1218 | if (!api_is_platform_admin()) { |
1219 | 1219 | $sql .= ' AND user.user_id = cru.user_id AND |
1220 | 1220 | cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND |
1221 | 1221 | cru.c_id in ( |
1222 | - SELECT c_id FROM '.$tbl_cru . ' |
|
1222 | + SELECT c_id FROM '.$tbl_cru.' |
|
1223 | 1223 | WHERE |
1224 | - user_id = ' . api_get_user_id() . ' AND |
|
1225 | - status = ' . COURSEMANAGER . ' |
|
1224 | + user_id = ' . api_get_user_id().' AND |
|
1225 | + status = ' . COURSEMANAGER.' |
|
1226 | 1226 | ) |
1227 | 1227 | '; |
1228 | 1228 | } |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | 'course' => $courseInfo['title'], |
1365 | 1365 | 'score' => $certificateInfo['score_certificate'], |
1366 | 1366 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1367 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1367 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1368 | 1368 | ]; |
1369 | 1369 | } |
1370 | 1370 | |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | 'course' => $course['title'], |
1429 | 1429 | 'score' => $certificateInfo['score_certificate'], |
1430 | 1430 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1431 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1431 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1432 | 1432 | ]; |
1433 | 1433 | } |
1434 | 1434 | } |