@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | api_protect_global_admin_script(); |
| 15 | 15 | if (!api_get_multiple_access_url()) { |
| 16 | - header('Location: index.php'); |
|
| 17 | - exit; |
|
| 16 | + header('Location: index.php'); |
|
| 17 | + exit; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | $form_sent = 0; |
@@ -44,36 +44,36 @@ discard block |
||
| 44 | 44 | api_display_tool_title($tool_name); |
| 45 | 45 | |
| 46 | 46 | if ($_POST['form_sent']) { |
| 47 | - $form_sent = $_POST['form_sent']; |
|
| 48 | - $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; |
|
| 49 | - $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
| 50 | - $first_letter_user = $_POST['first_letter_user']; |
|
| 47 | + $form_sent = $_POST['form_sent']; |
|
| 48 | + $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ; |
|
| 49 | + $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
| 50 | + $first_letter_user = $_POST['first_letter_user']; |
|
| 51 | 51 | |
| 52 | - foreach($users as $key => $value) { |
|
| 53 | - $users[$key] = intval($value); |
|
| 54 | - } |
|
| 52 | + foreach($users as $key => $value) { |
|
| 53 | + $users[$key] = intval($value); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - if ($form_sent == 1) { |
|
| 57 | - if (count($users) == 0 || count($url_list) == 0) { |
|
| 58 | - Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
| 59 | - } else { |
|
| 60 | - UrlManager::add_users_to_urls($users,$url_list); |
|
| 61 | - Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
| 62 | - } |
|
| 63 | - } |
|
| 56 | + if ($form_sent == 1) { |
|
| 57 | + if (count($users) == 0 || count($url_list) == 0) { |
|
| 58 | + Display :: display_error_message(get_lang('AtLeastOneUserAndOneURL')); |
|
| 59 | + } else { |
|
| 60 | + UrlManager::add_users_to_urls($users,$url_list); |
|
| 61 | + Display :: display_confirmation_message(get_lang('UsersBelongURL')); |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /* Display GUI */ |
| 67 | 67 | if (empty($first_letter_user)) { |
| 68 | - $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
| 69 | - $result = Database::query($sql); |
|
| 70 | - $num_row = Database::fetch_array($result); |
|
| 68 | + $sql = "SELECT count(*) as nb_users FROM $tbl_user"; |
|
| 69 | + $result = Database::query($sql); |
|
| 70 | + $num_row = Database::fetch_array($result); |
|
| 71 | 71 | if ($num_row['nb_users']>1000) { |
| 72 | 72 | //if there are too much users to gracefully handle with the HTML select list, |
| 73 | 73 | // assign a default filter on users names |
| 74 | 74 | $first_letter_user = 'A'; |
| 75 | 75 | } |
| 76 | - unset($result); |
|
| 76 | + unset($result); |
|
| 77 | 77 | } |
| 78 | 78 | $first_letter_user_lower = Database::escape_string(api_strtolower($first_letter_user)); |
| 79 | 79 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | <option value="">--</option> |
| 105 | 105 | <?php |
| 106 | 106 | echo Display :: get_alphabet_options($first_letter_user); |
| 107 | - ?> |
|
| 107 | + ?> |
|
| 108 | 108 | </select> |
| 109 | 109 | </td> |
| 110 | 110 | <td width="20%"> </td> |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | <td width="40%" align="center"> |
| 117 | 117 | <select name="user_list[]" multiple="multiple" size="20" style="width:380px;"> |
| 118 | 118 | <?php |
| 119 | - foreach ($db_users as $user) { |
|
| 120 | - ?> |
|
| 119 | + foreach ($db_users as $user) { |
|
| 120 | + ?> |
|
| 121 | 121 | <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
| 122 | 122 | <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?> |
| 123 | 123 | </option> |
| 124 | 124 | <?php |
| 125 | - } |
|
| 126 | - ?> |
|
| 125 | + } |
|
| 126 | + ?> |
|
| 127 | 127 | </select> |
| 128 | 128 | </td> |
| 129 | 129 | <td width="20%" valign="middle" align="center"> |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | <td width="40%" align="center"> |
| 133 | 133 | <select name="url_list[]" multiple="multiple" size="20" style="width:230px;"> |
| 134 | 134 | <?php |
| 135 | - foreach ($db_urls as $url_obj) { |
|
| 136 | - ?> |
|
| 135 | + foreach ($db_urls as $url_obj) { |
|
| 136 | + ?> |
|
| 137 | 137 | <option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>> |
| 138 | 138 | <?php echo $url_obj['url']; ?> |
| 139 | 139 | </option> |
| 140 | 140 | <?php |
| 141 | - } |
|
| 142 | - ?> |
|
| 141 | + } |
|
| 142 | + ?> |
|
| 143 | 143 | </select> |
| 144 | 144 | </td> |
| 145 | 145 | </tr> |
@@ -6,8 +6,7 @@ |
||
| 6 | 6 | * @author unknown, the initial survey that did not make it in 1.8 because of bad code |
| 7 | 7 | * @author Patrick Cool <[email protected]>, Ghent University: cleanup, refactoring and rewriting large parts of the code |
| 8 | 8 | * @author Julio Montoya Armas <[email protected]>, Chamilo: Personality Test modification and rewriting large parts of the code as well |
| 9 | - |
|
| 10 | -* @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again. |
|
| 9 | + * @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again. |
|
| 11 | 10 | * @todo performance could be improved if not the survey_id was stored with the invitation but the survey_code |
| 12 | 11 | */ |
| 13 | 12 | // Unsetting the course id (because it is in the URL) |
@@ -83,15 +83,15 @@ |
||
| 83 | 83 | |
| 84 | 84 | /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ |
| 85 | 85 | if (!api_is_allowed_to_edit(false, true) || $isDrhOfCourse) { |
| 86 | - Display :: display_header(get_lang('ToolSurvey')); |
|
| 86 | + Display :: display_header(get_lang('ToolSurvey')); |
|
| 87 | 87 | // Show error message if the survey can be seen only by tutors |
| 88 | 88 | if ($survey_data['visible_results'] != SURVEY_VISIBLE_TUTOR) { |
| 89 | 89 | SurveyUtil::handle_reporting_actions($survey_data, $people_filled); |
| 90 | 90 | } else { |
| 91 | 91 | Display :: display_error_message(get_lang('NotAllowed'), false); |
| 92 | 92 | } |
| 93 | - Display :: display_footer(); |
|
| 94 | - exit; |
|
| 93 | + Display :: display_footer(); |
|
| 94 | + exit; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // Database table definitions |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ |
| 21 | 21 | if (!api_is_allowed_to_edit(false, true)) { |
| 22 | - Display :: display_header(); |
|
| 23 | - Display :: display_error_message(get_lang('NotAllowed'), false); |
|
| 24 | - Display :: display_footer(); |
|
| 25 | - exit; |
|
| 22 | + Display :: display_header(); |
|
| 23 | + Display :: display_error_message(get_lang('NotAllowed'), false); |
|
| 24 | + Display :: display_footer(); |
|
| 25 | + exit; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Is valid request |
@@ -42,30 +42,30 @@ discard block |
||
| 42 | 42 | $surveyData = SurveyManager::get_survey($_GET['survey_id']); |
| 43 | 43 | |
| 44 | 44 | if (empty($surveyData)) { |
| 45 | - Display :: display_header(get_lang('ToolSurvey')); |
|
| 46 | - Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 47 | - Display :: display_footer(); |
|
| 48 | - exit; |
|
| 45 | + Display :: display_header(get_lang('ToolSurvey')); |
|
| 46 | + Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 47 | + Display :: display_footer(); |
|
| 48 | + exit; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $urlname = api_substr(api_html_entity_decode($surveyData['title'], ENT_QUOTES), 0, 40); |
| 52 | 52 | if (api_strlen(strip_tags($surveyData['title'])) > 40) { |
| 53 | - $urlname .= '...'; |
|
| 53 | + $urlname .= '...'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if ($surveyData['survey_type'] == 1) { |
| 57 | - $sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).' |
|
| 57 | + $sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).' |
|
| 58 | 58 | WHERE |
| 59 | 59 | c_id = '.$course_id.' AND |
| 60 | 60 | survey_id = '.(int)$_GET['survey_id'].' LIMIT 1'; |
| 61 | - $rs = Database::query($sql); |
|
| 62 | - if (Database::num_rows($rs)===0) { |
|
| 61 | + $rs = Database::query($sql); |
|
| 62 | + if (Database::num_rows($rs)===0) { |
|
| 63 | 63 | Display::addFlash( |
| 64 | 64 | Display::return_message(get_lang('YouNeedToCreateGroups')) |
| 65 | 65 | ); |
| 66 | - header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']); |
|
| 67 | - exit; |
|
| 68 | - } |
|
| 66 | + header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']); |
|
| 67 | + exit; |
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Breadcrumbs |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // Tool name |
| 82 | 82 | if ($_GET['action'] == 'add') { |
| 83 | - $tool_name = get_lang('AddQuestion'); |
|
| 83 | + $tool_name = get_lang('AddQuestion'); |
|
| 84 | 84 | } |
| 85 | 85 | if ($_GET['action'] == 'edit') { |
| 86 | - $tool_name = get_lang('EditQuestion'); |
|
| 86 | + $tool_name = get_lang('EditQuestion'); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // The possible question types |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | // Actions |
| 104 | 104 | $actions = '<div class="actions">'; |
| 105 | 105 | $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'. |
| 106 | - Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 106 | + Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 107 | 107 | $actions .= '</div>'; |
| 108 | 108 | // Checking if it is a valid type |
| 109 | 109 | if (!in_array($_GET['type'], $possible_types)) { |
| 110 | - Display :: display_header($tool_name, 'Survey'); |
|
| 111 | - echo $actions; |
|
| 112 | - Display :: display_error_message(get_lang('TypeDoesNotExist'), false); |
|
| 113 | - Display :: display_footer(); |
|
| 110 | + Display :: display_header($tool_name, 'Survey'); |
|
| 111 | + echo $actions; |
|
| 112 | + Display :: display_error_message(get_lang('TypeDoesNotExist'), false); |
|
| 113 | + Display :: display_footer(); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $error_message = ''; |
@@ -126,27 +126,27 @@ discard block |
||
| 126 | 126 | $formData['answers'] = array('', ''); |
| 127 | 127 | |
| 128 | 128 | if ($_GET['type'] == 'yesno') { |
| 129 | - $formData['answers'][0] = get_lang('Yes'); |
|
| 130 | - $formData['answers'][1] = get_lang('No'); |
|
| 129 | + $formData['answers'][0] = get_lang('Yes'); |
|
| 130 | + $formData['answers'][1] = get_lang('No'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if ($_GET['type'] == 'personality') { |
| 134 | - $formData['answers'][0] = 1; |
|
| 135 | - $formData['answers'][1] = 2; |
|
| 136 | - $formData['answers'][2] = 3; |
|
| 137 | - $formData['answers'][3] = 4; |
|
| 138 | - $formData['answers'][4] = 5; |
|
| 139 | - |
|
| 140 | - $formData['values'][0] = 0; |
|
| 141 | - $formData['values'][1] = 0; |
|
| 142 | - $formData['values'][2] = 1; |
|
| 143 | - $formData['values'][3] = 2; |
|
| 144 | - $formData['values'][4] = 3; |
|
| 134 | + $formData['answers'][0] = 1; |
|
| 135 | + $formData['answers'][1] = 2; |
|
| 136 | + $formData['answers'][2] = 3; |
|
| 137 | + $formData['answers'][3] = 4; |
|
| 138 | + $formData['answers'][4] = 5; |
|
| 139 | + |
|
| 140 | + $formData['values'][0] = 0; |
|
| 141 | + $formData['values'][1] = 0; |
|
| 142 | + $formData['values'][2] = 1; |
|
| 143 | + $formData['values'][3] = 2; |
|
| 144 | + $formData['values'][4] = 3; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // We are editing a question |
| 148 | 148 | if (isset($_GET['question_id']) && !empty($_GET['question_id'])) { |
| 149 | - $formData = SurveyManager::get_question($_GET['question_id']); |
|
| 149 | + $formData = SurveyManager::get_question($_GET['question_id']); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $formData = $surveyQuestion->preSave($formData); |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | $surveyQuestion->renderForm(); |
| 156 | 156 | |
| 157 | 157 | if ($surveyQuestion->getForm()->validate()) { |
| 158 | - $values = $surveyQuestion->getForm()->getSubmitValues(); |
|
| 159 | - $surveyQuestion->save($surveyData, $values); |
|
| 158 | + $values = $surveyQuestion->getForm()->getSubmitValues(); |
|
| 159 | + $surveyQuestion->save($surveyData, $values); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | Display::display_header($tool_name, 'Survey'); |
@@ -1207,16 +1207,16 @@ |
||
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | /** |
| 1210 | - * This function saves the question in the shared database |
|
| 1211 | - * |
|
| 1212 | - * @param array $form_content all the information of the form |
|
| 1213 | - * @param array $survey_data all the information of the survey |
|
| 1214 | - * |
|
| 1215 | - * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1216 | - * @version February 2007 |
|
| 1217 | - * |
|
| 1218 | - * @todo editing of a shared question |
|
| 1219 | - */ |
|
| 1210 | + * This function saves the question in the shared database |
|
| 1211 | + * |
|
| 1212 | + * @param array $form_content all the information of the form |
|
| 1213 | + * @param array $survey_data all the information of the survey |
|
| 1214 | + * |
|
| 1215 | + * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1216 | + * @version February 2007 |
|
| 1217 | + * |
|
| 1218 | + * @todo editing of a shared question |
|
| 1219 | + */ |
|
| 1220 | 1220 | public function save_shared_question($form_content, $survey_data) |
| 1221 | 1221 | { |
| 1222 | 1222 | $_course = api_get_course_info(); |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ |
| 15 | 15 | if (!api_is_allowed_to_edit(false, true)) { |
| 16 | - Display :: display_header(get_lang('ToolSurvey')); |
|
| 17 | - Display :: display_error_message(get_lang('NotAllowed'), false); |
|
| 18 | - Display :: display_footer(); |
|
| 19 | - exit; |
|
| 16 | + Display :: display_header(get_lang('ToolSurvey')); |
|
| 17 | + Display :: display_error_message(get_lang('NotAllowed'), false); |
|
| 18 | + Display :: display_footer(); |
|
| 19 | + exit; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // Database table definitions |
@@ -33,25 +33,25 @@ discard block |
||
| 33 | 33 | // Getting the survey information |
| 34 | 34 | // We exit here if ther is no valid $_GET parameter |
| 35 | 35 | if (!isset($_GET['survey_id']) OR !is_numeric($_GET['survey_id'])) { |
| 36 | - Display :: display_header($tool_name); |
|
| 37 | - Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 38 | - Display :: display_footer(); |
|
| 39 | - exit; |
|
| 36 | + Display :: display_header($tool_name); |
|
| 37 | + Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 38 | + Display :: display_footer(); |
|
| 39 | + exit; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $survey_id = Security::remove_XSS($_GET['survey_id']); |
| 43 | 43 | $survey_data = SurveyManager::get_survey($survey_id); |
| 44 | 44 | |
| 45 | 45 | if (empty($survey_data)) { |
| 46 | - Display :: display_header($tool_name); |
|
| 47 | - Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 48 | - Display :: display_footer(); |
|
| 49 | - exit; |
|
| 46 | + Display :: display_header($tool_name); |
|
| 47 | + Display :: display_error_message(get_lang('InvallidSurvey'), false); |
|
| 48 | + Display :: display_footer(); |
|
| 49 | + exit; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40)); |
| 53 | 53 | if (api_strlen(strip_tags($survey_data['title'])) > 40) { |
| 54 | - $urlname .= '...'; |
|
| 54 | + $urlname .= '...'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Breadcrumbs |
@@ -64,32 +64,32 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | // Checking the parameters |
| 66 | 66 | if (!is_numeric($survey_id)) { |
| 67 | - Display::display_error_message(get_lang('Error'), false); |
|
| 68 | - Display::display_footer(); |
|
| 69 | - exit; |
|
| 67 | + Display::display_error_message(get_lang('Error'), false); |
|
| 68 | + Display::display_footer(); |
|
| 69 | + exit; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Getting all the people who have filled this survey |
| 73 | 73 | $answered_data = SurveyManager::get_people_who_filled_survey($survey_id); |
| 74 | 74 | if ($survey_data['anonymous'] == 1) { |
| 75 | - Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered')); |
|
| 76 | - $answered_data = array(); |
|
| 75 | + Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered')); |
|
| 76 | + $answered_data = array(); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (!isset($_GET['view']) OR $_GET['view'] == 'invited') { |
| 80 | - echo get_lang('ViewInvited'). ' | '; |
|
| 80 | + echo get_lang('ViewInvited'). ' | '; |
|
| 81 | 81 | } else { |
| 82 | - echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=invited">'.get_lang('ViewInvited').'</a> |'; |
|
| 82 | + echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=invited">'.get_lang('ViewInvited').'</a> |'; |
|
| 83 | 83 | } |
| 84 | 84 | if ($_GET['view'] == 'answered') { |
| 85 | - echo get_lang('ViewAnswered').' | '; |
|
| 85 | + echo get_lang('ViewAnswered').' | '; |
|
| 86 | 86 | } else { |
| 87 | - echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=answered">'.get_lang('ViewAnswered').'</a> |'; |
|
| 87 | + echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=answered">'.get_lang('ViewAnswered').'</a> |'; |
|
| 88 | 88 | } |
| 89 | 89 | if ($_GET['view'] == 'unanswered') { |
| 90 | - echo get_lang('ViewUnanswered'); |
|
| 90 | + echo get_lang('ViewUnanswered'); |
|
| 91 | 91 | } else { |
| 92 | - echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=unanswered">'.get_lang('ViewUnanswered').'</a>'; |
|
| 92 | + echo ' <a href="'.api_get_self().'?survey_id='.$survey_id.'&view=unanswered">'.get_lang('ViewUnanswered').'</a>'; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Table header |
@@ -111,32 +111,32 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $res = Database::query($sql); |
| 113 | 113 | while ($row = Database::fetch_assoc($res)) { |
| 114 | - if (!$_GET['view'] || |
|
| 115 | - $_GET['view'] == 'invited' || |
|
| 114 | + if (!$_GET['view'] || |
|
| 115 | + $_GET['view'] == 'invited' || |
|
| 116 | 116 | ($_GET['view'] == 'answered' && in_array($row['user'], $answered_data)) || |
| 117 | 117 | ($_GET['view'] == 'unanswered' && !in_array($row['user'], $answered_data)) |
| 118 | 118 | ) { |
| 119 | - echo '<tr>'; |
|
| 120 | - if (is_numeric($row['user'])) { |
|
| 119 | + echo '<tr>'; |
|
| 120 | + if (is_numeric($row['user'])) { |
|
| 121 | 121 | $userInfo = api_get_user_info($row['user']); |
| 122 | - echo '<td>'; |
|
| 122 | + echo '<td>'; |
|
| 123 | 123 | echo UserManager::getUserProfileLink($userInfo); |
| 124 | 124 | echo '</td>'; |
| 125 | - } else { |
|
| 125 | + } else { |
|
| 126 | 126 | echo '<td>'.$row['user'].'</td>'; |
| 127 | - } |
|
| 128 | - echo ' <td>'.$row['invitation_date'].'</td>'; |
|
| 129 | - echo ' <td>'; |
|
| 130 | - |
|
| 131 | - if (in_array($row['user'], $answered_data)) { |
|
| 132 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'">'.get_lang('ViewAnswers').'</a>'; |
|
| 133 | - } else { |
|
| 134 | - echo '-'; |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - echo ' </td>'; |
|
| 138 | - echo '</tr>'; |
|
| 139 | - } |
|
| 127 | + } |
|
| 128 | + echo ' <td>'.$row['invitation_date'].'</td>'; |
|
| 129 | + echo ' <td>'; |
|
| 130 | + |
|
| 131 | + if (in_array($row['user'], $answered_data)) { |
|
| 132 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'&user='.$row['user'].'">'.get_lang('ViewAnswers').'</a>'; |
|
| 133 | + } else { |
|
| 134 | + echo '-'; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + echo ' </td>'; |
|
| 138 | + echo '</tr>'; |
|
| 139 | + } |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Closing the table |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $result = Database::query($sql); |
| 52 | 52 | if (!list($session_name,$course_title) = Database::fetch_row($result)) { |
| 53 | - header('Location: session_course_list.php?id_session='.$id_session); |
|
| 54 | - exit(); |
|
| 53 | + header('Location: session_course_list.php?id_session='.$id_session); |
|
| 54 | + exit(); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | switch ($action) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page-1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Previous');?></a> |
| 123 | 123 | <?php |
| 124 | 124 | } else { |
| 125 | - echo get_lang('Previous'); |
|
| 125 | + echo get_lang('Previous'); |
|
| 126 | 126 | } |
| 127 | 127 | ?> |
| 128 | 128 | | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | <a href="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo $page+1; ?>&sort=<?php echo $sort; ?>"><?php echo get_lang('Next');?></a> |
| 133 | 133 | <?php |
| 134 | 134 | } else { |
| 135 | - echo get_lang('Next'); |
|
| 135 | + echo get_lang('Next'); |
|
| 136 | 136 | } |
| 137 | 137 | ?> |
| 138 | 138 | </div> |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | $i=0; |
| 155 | 155 | foreach ($users as $key => $enreg) { |
| 156 | 156 | |
| 157 | - if ($key == $limit) { |
|
| 158 | - break; |
|
| 159 | - } |
|
| 157 | + if ($key == $limit) { |
|
| 158 | + break; |
|
| 159 | + } |
|
| 160 | 160 | ?> |
| 161 | 161 | <tr class="<?php echo $i?'row_odd':'row_even'; ?>"> |
| 162 | 162 | <td><input type="checkbox" name="idChecked[]" value="<?php echo $enreg['user_id']; ?>"></td> |
@@ -30,26 +30,26 @@ discard block |
||
| 30 | 30 | $result = Database::query("SELECT name FROM $tbl_session WHERE id='$id_session'"); |
| 31 | 31 | |
| 32 | 32 | if (!list($session_name)=Database::fetch_row($result)) { |
| 33 | - header('Location: session_list.php'); |
|
| 34 | - exit; |
|
| 33 | + header('Location: session_list.php'); |
|
| 34 | + exit; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ($action == 'delete') { |
| 38 | - $idChecked = $_REQUEST['idChecked']; |
|
| 39 | - if (is_array($idChecked) && count($idChecked)>0) { |
|
| 40 | - $my_temp = array(); |
|
| 41 | - foreach ($idChecked as $id){ |
|
| 42 | - $my_temp[]= Database::escape_string($id);// forcing the escape_string |
|
| 43 | - } |
|
| 44 | - $idChecked = $my_temp; |
|
| 45 | - $idChecked="'".implode("','", $idChecked)."'"; |
|
| 46 | - $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
| 47 | - $nbr_affected_rows=Database::affected_rows($result); |
|
| 48 | - Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
| 49 | - Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); |
|
| 50 | - } |
|
| 51 | - header('Location: '.api_get_self().'?id_session='.$id_session.'&sort='.$sort); |
|
| 52 | - exit(); |
|
| 38 | + $idChecked = $_REQUEST['idChecked']; |
|
| 39 | + if (is_array($idChecked) && count($idChecked)>0) { |
|
| 40 | + $my_temp = array(); |
|
| 41 | + foreach ($idChecked as $id){ |
|
| 42 | + $my_temp[]= Database::escape_string($id);// forcing the escape_string |
|
| 43 | + } |
|
| 44 | + $idChecked = $my_temp; |
|
| 45 | + $idChecked="'".implode("','", $idChecked)."'"; |
|
| 46 | + $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
| 47 | + $nbr_affected_rows=Database::affected_rows($result); |
|
| 48 | + Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); |
|
| 49 | + Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); |
|
| 50 | + } |
|
| 51 | + header('Location: '.api_get_self().'?id_session='.$id_session.'&sort='.$sort); |
|
| 52 | + exit(); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $limit = 20; |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | $tableCourses = array(); |
| 83 | 83 | |
| 84 | 84 | foreach ($Courses as $key=>$enreg) { |
| 85 | - $course = array(); |
|
| 86 | - $course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['id'].'">'; |
|
| 87 | - $course[] = api_htmlentities($enreg['title'],ENT_QUOTES,$charset); |
|
| 88 | - $course[] = '<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$enreg['code'].'">'.$enreg['nbr_users'].' '.get_lang('Users').'</a>'; |
|
| 89 | - $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$enreg['code'].'/?id_session='.$id_session.'">'. |
|
| 90 | - Display::return_icon('course_home.gif', get_lang('Course')).'</a> |
|
| 85 | + $course = array(); |
|
| 86 | + $course[] = '<input type="checkbox" name="idChecked[]" value="'.$enreg['id'].'">'; |
|
| 87 | + $course[] = api_htmlentities($enreg['title'],ENT_QUOTES,$charset); |
|
| 88 | + $course[] = '<a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$enreg['code'].'">'.$enreg['nbr_users'].' '.get_lang('Users').'</a>'; |
|
| 89 | + $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$enreg['code'].'/?id_session='.$id_session.'">'. |
|
| 90 | + Display::return_icon('course_home.gif', get_lang('Course')).'</a> |
|
| 91 | 91 | <a href="session_course_edit.php?id_session='.$id_session.'&page=session_course_list.php&course_code='.$enreg['code'].'">'. |
| 92 | - Display::return_icon('edit.png', get_lang('Edit')).'</a> |
|
| 92 | + Display::return_icon('edit.png', get_lang('Edit')).'</a> |
|
| 93 | 93 | <a href="'.api_get_self().'?id_session='.$id_session.'&sort='.$sort.'&action=delete&idChecked[]='.$enreg['id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)).'\')) return false;">'. |
| 94 | - Display::return_icon('delete.png', get_lang('Delete')).'</a>'; |
|
| 95 | - $tableCourses[] = $course; |
|
| 94 | + Display::return_icon('delete.png', get_lang('Delete')).'</a>'; |
|
| 95 | + $tableCourses[] = $course; |
|
| 96 | 96 | } |
| 97 | 97 | echo '<form method="post" action="'.api_get_self().'">'; |
| 98 | 98 | Display :: display_sortable_table($tableHeader, $tableCourses, array (), array ()); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $sessionRepository = Database::getManager()->getRepository('ChamiloCoreBundle:Session'); |
| 156 | 156 | $courses = $sessionRepository->getCoursesOrderedByPosition($session); |
| 157 | 157 | |
| 158 | - foreach ($courses as $course) { |
|
| 158 | + foreach ($courses as $course) { |
|
| 159 | 159 | //select the number of users |
| 160 | 160 | $sql = "SELECT count(*) |
| 161 | 161 | FROM $tbl_session_rel_user sru, |
@@ -167,37 +167,37 @@ discard block |
||
| 167 | 167 | sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND |
| 168 | 168 | srcru.session_id = '".intval($sessionId)."'"; |
| 169 | 169 | |
| 170 | - $rs = Database::query($sql); |
|
| 170 | + $rs = Database::query($sql); |
|
| 171 | 171 | $numberOfUsers = Database::result($rs, 0, 0); |
| 172 | 172 | |
| 173 | - // Get coachs of the courses in session |
|
| 173 | + // Get coachs of the courses in session |
|
| 174 | 174 | |
| 175 | - $sql = "SELECT user.lastname, user.firstname, user.username |
|
| 175 | + $sql = "SELECT user.lastname, user.firstname, user.username |
|
| 176 | 176 | FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user |
| 177 | 177 | WHERE |
| 178 | 178 | session_rcru.user_id = user.user_id AND |
| 179 | 179 | session_rcru.session_id = '".intval($sessionId)."' AND |
| 180 | 180 | session_rcru.c_id ='".intval($course->getId())."' AND |
| 181 | 181 | session_rcru.status=2"; |
| 182 | - $rs = Database::query($sql); |
|
| 182 | + $rs = Database::query($sql); |
|
| 183 | 183 | |
| 184 | - $coachs = array(); |
|
| 185 | - if (Database::num_rows($rs) > 0) { |
|
| 186 | - while($info_coach = Database::fetch_array($rs)) { |
|
| 184 | + $coachs = array(); |
|
| 185 | + if (Database::num_rows($rs) > 0) { |
|
| 186 | + while($info_coach = Database::fetch_array($rs)) { |
|
| 187 | 187 | $coachs[] = api_get_person_name( |
| 188 | 188 | $info_coach['firstname'], |
| 189 | 189 | $info_coach['lastname'] |
| 190 | 190 | ).' ('.$info_coach['username'].')'; |
| 191 | - } |
|
| 192 | - } else { |
|
| 193 | - $coach = get_lang('None'); |
|
| 194 | - } |
|
| 191 | + } |
|
| 192 | + } else { |
|
| 193 | + $coach = get_lang('None'); |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - if (count($coachs) > 0) { |
|
| 197 | - $coach = implode('<br />',$coachs); |
|
| 198 | - } else { |
|
| 199 | - $coach = get_lang('None'); |
|
| 200 | - } |
|
| 196 | + if (count($coachs) > 0) { |
|
| 197 | + $coach = implode('<br />',$coachs); |
|
| 198 | + } else { |
|
| 199 | + $coach = get_lang('None'); |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | 202 | $orderButtons = null; |
| 203 | 203 | |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | $courseUrl = api_get_course_url($course->getCode(), $sessionId); |
| 235 | 235 | |
| 236 | - // hide_course_breadcrumb the parameter has been added to hide the name |
|
| 237 | - // of the course, that appeared in the default $interbreadcrumb |
|
| 236 | + // hide_course_breadcrumb the parameter has been added to hide the name |
|
| 237 | + // of the course, that appeared in the default $interbreadcrumb |
|
| 238 | 238 | $courseItem .= ' |
| 239 | 239 | <tr> |
| 240 | 240 | <td class="title">'.Display::url( |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | </td> |
| 261 | 261 | </tr>'; |
| 262 | 262 | $count++; |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | $courseListToShow .= $courseItem; |
| 265 | 265 | } |
| 266 | 266 | $courseListToShow .= '</table><br />'; |