@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | $form->addElement('checkbox', 'activate_start_date_check', null,get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
| 161 | 161 | $display_date = 'none'; |
| 162 | 162 | if ($publicated_on!='0000-00-00 00:00:00' && !empty($publicated_on)) { |
| 163 | - $display_date = 'block'; |
|
| 164 | - $defaults['activate_start_date_check'] = 1; |
|
| 163 | + $display_date = 'block'; |
|
| 164 | + $defaults['activate_start_date_check'] = 1; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $form->addElement('html','<div id="start_date_div" style="display:'.$display_date.';">'); |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
| 173 | 173 | $display_date = 'none'; |
| 174 | 174 | if ($expired_on!='0000-00-00 00:00:00' && !empty($expired_on)) { |
| 175 | - $display_date = 'block'; |
|
| 176 | - $defaults['activate_end_date_check'] = 1; |
|
| 175 | + $display_date = 'block'; |
|
| 176 | + $defaults['activate_end_date_check'] = 1; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $form->addElement('html','<div id="end_date_div" style="display:'.$display_date.';">'); |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | //user has submitted a file |
| 50 | 50 | if (isset($_FILES['user_upload'])) { |
| 51 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 52 | - if ($upload_ok) { |
|
| 53 | - //file got on the server without problems, now process it |
|
| 51 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 52 | + if ($upload_ok) { |
|
| 53 | + //file got on the server without problems, now process it |
|
| 54 | 54 | $new_path = handle_uploaded_document( |
| 55 | 55 | $_course, |
| 56 | 56 | $_FILES['user_upload'], |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | $_POST['unzip'], |
| 63 | 63 | $_POST['if_exists'] |
| 64 | 64 | ); |
| 65 | - $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
| 66 | - $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
| 65 | + $new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : ''; |
|
| 66 | + $new_title = isset($_POST['title']) ? trim($_POST['title']) : ''; |
|
| 67 | 67 | |
| 68 | - if ($new_path && ($new_comment || $new_title)) |
|
| 69 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
| 70 | - $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
| 71 | - $ct = ''; |
|
| 72 | - if ($new_comment) $ct .= ", comment='$new_comment'"; |
|
| 73 | - if ($new_title) $ct .= ", title='$new_title'"; |
|
| 74 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
| 75 | - } |
|
| 68 | + if ($new_path && ($new_comment || $new_title)) |
|
| 69 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
| 70 | + $table_document = Database::get_course_table(TABLE_DOCUMENT); |
|
| 71 | + $ct = ''; |
|
| 72 | + if ($new_comment) $ct .= ", comment='$new_comment'"; |
|
| 73 | + if ($new_title) $ct .= ", title='$new_title'"; |
|
| 74 | + Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
| 75 | + } |
|
| 76 | 76 | //check for missing images in html files |
| 77 | 77 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
| 78 | 78 | if ($missing_files) { |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | //they want to create a directory |
| 130 | 130 | if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
| 131 | - $added_slash = ($path=='/')?'':'/'; |
|
| 132 | - $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
| 131 | + $added_slash = ($path=='/')?'':'/'; |
|
| 132 | + $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
|
| 133 | 133 | $created_dir = create_unexisting_directory( |
| 134 | 134 | $_course, |
| 135 | 135 | $_user['user_id'], |
@@ -149,15 +149,15 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | if (isset($_GET['createdir'])) { |
| 152 | - //create the form that asks for the directory name |
|
| 153 | - $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
| 154 | - $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
| 155 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
| 156 | - $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
| 157 | - $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
| 158 | - $new_folder_text .= '</form>'; |
|
| 159 | - //show the form |
|
| 160 | - Display::display_normal_message($new_folder_text); |
|
| 152 | + //create the form that asks for the directory name |
|
| 153 | + $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
|
| 154 | + $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
|
| 155 | + $new_folder_text .= get_lang('NewDir') .' '; |
|
| 156 | + $new_folder_text .= '<input type="text" name="dirname"/>'; |
|
| 157 | + $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
|
| 158 | + $new_folder_text .= '</form>'; |
|
| 159 | + //show the form |
|
| 160 | + Display::display_normal_message($new_folder_text); |
|
| 161 | 161 | } else { //give them a link to create a directory |
| 162 | 162 | ?> |
| 163 | 163 | <p> |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | * @author Yannick Warnier <[email protected]> |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -$courseDir = $_course['path'] . "/document"; |
|
| 12 | +$courseDir = $_course['path']."/document"; |
|
| 13 | 13 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 14 | -$base_work_dir = $sys_course_path . $courseDir; |
|
| 14 | +$base_work_dir = $sys_course_path.$courseDir; |
|
| 15 | 15 | $noPHP_SELF = true; |
| 16 | 16 | $max_filled_space = DocumentManager::get_course_quota(); |
| 17 | 17 | |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $nameTools = get_lang('UplUploadDocument'); |
| 36 | 36 | $interbreadcrumb[] = array( |
| 37 | - "url" => "./document.php?curdirpath=" . urlencode( |
|
| 37 | + "url" => "./document.php?curdirpath=".urlencode( |
|
| 38 | 38 | $path |
| 39 | - ) . $req_gid, |
|
| 39 | + ).$req_gid, |
|
| 40 | 40 | "name" => $langDocuments |
| 41 | 41 | ); |
| 42 | 42 | Display::display_header($nameTools, "Doc"); |
| 43 | 43 | //show the title |
| 44 | -api_display_tool_title($nameTools . $add_group_to_title); |
|
| 44 | +api_display_tool_title($nameTools.$add_group_to_title); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Process |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | $ct = ''; |
| 72 | 72 | if ($new_comment) $ct .= ", comment='$new_comment'"; |
| 73 | 73 | if ($new_title) $ct .= ", title='$new_title'"; |
| 74 | - Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'"); |
|
| 74 | + Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'"); |
|
| 75 | 75 | } |
| 76 | 76 | //check for missing images in html files |
| 77 | 77 | $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path); |
| 78 | - if ($missing_files) { |
|
| 78 | + if ($missing_files) { |
|
| 79 | 79 | //show a form to upload the missing files |
| 80 | 80 | Display::display_normal_message( |
| 81 | 81 | build_missing_files_form( |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | if ($number_of_uploaded_images > 0) { |
| 95 | 95 | //we could also create a function for this, I'm not sure... |
| 96 | 96 | //create a directory for the missing files |
| 97 | - $img_directory = str_replace('.','_',$_POST['related_file']."_files"); |
|
| 97 | + $img_directory = str_replace('.', '_', $_POST['related_file']."_files"); |
|
| 98 | 98 | $folderData = create_unexisting_directory( |
| 99 | 99 | $_course, |
| 100 | 100 | $_user['user_id'], |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | replace_img_path_in_html_file( |
| 121 | 121 | $_POST['img_file_path'], |
| 122 | 122 | $paths_to_replace_in_file, |
| 123 | - $base_work_dir . $_POST['related_file'] |
|
| 123 | + $base_work_dir.$_POST['related_file'] |
|
| 124 | 124 | ); |
| 125 | 125 | //update parent folders |
| 126 | - item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']); |
|
| 126 | + item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | //they want to create a directory |
| 130 | -if (isset($_POST['create_dir']) && $_POST['dirname']!='') { |
|
| 131 | - $added_slash = ($path=='/')?'':'/'; |
|
| 130 | +if (isset($_POST['create_dir']) && $_POST['dirname'] != '') { |
|
| 131 | + $added_slash = ($path == '/') ? '' : '/'; |
|
| 132 | 132 | $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']); |
| 133 | 133 | $created_dir = create_unexisting_directory( |
| 134 | 134 | $_course, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | //create the form that asks for the directory name |
| 153 | 153 | $new_folder_text = '<form action="'.api_get_self().'" method="POST">'; |
| 154 | 154 | $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>'; |
| 155 | - $new_folder_text .= get_lang('NewDir') .' '; |
|
| 155 | + $new_folder_text .= get_lang('NewDir').' '; |
|
| 156 | 156 | $new_folder_text .= '<input type="text" name="dirname"/>'; |
| 157 | 157 | $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>'; |
| 158 | 158 | $new_folder_text .= '</form>'; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | <p> |
| 164 | 164 | <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&createdir=1"> |
| 165 | 165 | <?php echo Display::return_icon('new_folder.gif'); ?> |
| 166 | - <?php echo(get_lang('CreateDir'));?> |
|
| 166 | + <?php echo(get_lang('CreateDir')); ?> |
|
| 167 | 167 | </a> |
| 168 | 168 | </p> |
| 169 | 169 | <?php |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | </td> |
| 187 | 187 | </tr> |
| 188 | 188 | <tr> |
| 189 | -<td><?php echo get_lang('Title');?></td> |
|
| 189 | +<td><?php echo get_lang('Title'); ?></td> |
|
| 190 | 190 | <td><input type="text" size="20" name="title" style="width:300px;"></td> |
| 191 | 191 | </tr> |
| 192 | 192 | <tr> |
| 193 | -<td valign="top"><?php echo get_lang('Comment');?></td> |
|
| 193 | +<td valign="top"><?php echo get_lang('Comment'); ?></td> |
|
| 194 | 194 | <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td> |
| 195 | 195 | </tr> |
| 196 | 196 | <tr> |
@@ -198,22 +198,22 @@ discard block |
||
| 198 | 198 | <?php echo get_lang('Options'); ?> |
| 199 | 199 | </td> |
| 200 | 200 | <td> |
| 201 | -- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/> |
|
| 202 | -- <?php echo (get_lang('UplWhatIfFileExists'));?><br/> |
|
| 203 | - <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/> <?php echo (get_lang('UplDoNothing'));?><br/> |
|
| 204 | - <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/> |
|
| 205 | - <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?> |
|
| 201 | +- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/> |
|
| 202 | +- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/> |
|
| 203 | + <input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/> <?php echo (get_lang('UplDoNothing')); ?><br/> |
|
| 204 | + <input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/> |
|
| 205 | + <input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?> |
|
| 206 | 206 | |
| 207 | 207 | </td> |
| 208 | 208 | </tr> |
| 209 | 209 | </table> |
| 210 | 210 | |
| 211 | -<input type="submit" value="<?php echo(get_lang('Ok'));?>"> |
|
| 211 | +<input type="submit" value="<?php echo(get_lang('Ok')); ?>"> |
|
| 212 | 212 | </form> |
| 213 | 213 | <!-- end upload form --> |
| 214 | 214 | |
| 215 | 215 | <!-- so they can get back to the documents --> |
| 216 | - <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p> |
|
| 216 | + <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p> |
|
| 217 | 217 | <?php |
| 218 | 218 | |
| 219 | 219 | Display::display_footer(); |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * Action controller for the upload process. The display scripts (web forms) redirect |
|
| 5 | - * the process here to do what needs to be done with each file. |
|
| 6 | - * @package chamilo.upload |
|
| 7 | - * @author Yannick Warnier <[email protected]> |
|
| 8 | - */ |
|
| 4 | + * Action controller for the upload process. The display scripts (web forms) redirect |
|
| 5 | + * the process here to do what needs to be done with each file. |
|
| 6 | + * @package chamilo.upload |
|
| 7 | + * @author Yannick Warnier <[email protected]> |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | require_once '../inc/global.inc.php'; |
| 11 | 11 | |
@@ -434,8 +434,7 @@ |
||
| 434 | 434 | } else { |
| 435 | 435 | echo $question->options[2]; |
| 436 | 436 | } |
| 437 | - } |
|
| 438 | - else { |
|
| 437 | + } else { |
|
| 439 | 438 | echo '-'; |
| 440 | 439 | } |
| 441 | 440 | ?> |
@@ -12,21 +12,21 @@ discard block |
||
| 12 | 12 | * @todo convert queries to use Database API |
| 13 | 13 | */ |
| 14 | 14 | /** |
| 15 | - * Class |
|
| 16 | - * @package chamilo.library |
|
| 17 | - */ |
|
| 15 | + * Class |
|
| 16 | + * @package chamilo.library |
|
| 17 | + */ |
|
| 18 | 18 | class ExerciseShowFunctions |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 22 | - * @param string Answer text |
|
| 23 | - * @param int Exercise ID |
|
| 24 | - * @param int Question ID |
|
| 20 | + /** |
|
| 21 | + * Shows the answer to a fill-in-the-blanks question, as HTML |
|
| 22 | + * @param string Answer text |
|
| 23 | + * @param int Exercise ID |
|
| 24 | + * @param int Question ID |
|
| 25 | 25 | * @param int $resultsDisabled |
| 26 | 26 | * @param string $originalStudentAnswer |
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public static function display_fill_in_blanks_answer($feedbackType, $answer, $id, $questionId, $resultsDisabled, $originalStudentAnswer = '') |
|
| 30 | 30 | { |
| 31 | 31 | $answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $resultsDisabled); |
| 32 | 32 | if (strpos($originalStudentAnswer, 'font color') !== false) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | </tr> |
| 56 | 56 | <?php |
| 57 | 57 | } |
| 58 | - } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Shows the answer to a calculated question, as HTML |
@@ -90,14 +90,14 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Shows the answer to a free-answer question, as HTML |
|
| 95 | - * @param string Answer text |
|
| 96 | - * @param int Exercise ID |
|
| 97 | - * @param int Question ID |
|
| 98 | - * @return void |
|
| 99 | - */ |
|
| 100 | - public static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
| 93 | + /** |
|
| 94 | + * Shows the answer to a free-answer question, as HTML |
|
| 95 | + * @param string Answer text |
|
| 96 | + * @param int Exercise ID |
|
| 97 | + * @param int Question ID |
|
| 98 | + * @return void |
|
| 99 | + */ |
|
| 100 | + public static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null) |
|
| 101 | 101 | { |
| 102 | 102 | $comments = Event::get_comments($exe_id, $questionId); |
| 103 | 103 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | echo '</tr>'; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
| 120 | + public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $nano = null) |
|
| 121 | 121 | { |
| 122 | 122 | if (isset($nano)) { |
| 123 | 123 | echo $nano->show_audio_file(); |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Displays the answer to a hotspot question |
|
| 154 | + /** |
|
| 155 | + * Displays the answer to a hotspot question |
|
| 156 | 156 | * @param int $feedback_type |
| 157 | 157 | * @param int $answerId |
| 158 | 158 | * @param string $answer |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param string $in_results_disabled |
| 162 | 162 | * @param int $orderColor |
| 163 | 163 | */ |
| 164 | - public static function display_hotspot_answer( |
|
| 164 | + public static function display_hotspot_answer( |
|
| 165 | 165 | $feedback_type, |
| 166 | 166 | $answerId, |
| 167 | 167 | $answer, |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $hide_expected_answer = true; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $hotspot_colors = array( |
|
| 179 | + $hotspot_colors = array( |
|
| 180 | 180 | "", // $i starts from 1 on next loop (ugly fix) |
| 181 | 181 | "#4271B5", |
| 182 | 182 | "#FE8E16", |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | "#ED2024", |
| 192 | 192 | "#3B3B3B", |
| 193 | 193 | "#F7BDE2"); |
| 194 | - ?> |
|
| 194 | + ?> |
|
| 195 | 195 | <table class="data_table"> |
| 196 | 196 | <tr> |
| 197 | 197 | <td class="text-center" width="5%"> |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | <td class="text-left" width="10%"> |
| 204 | 204 | <?php |
| 205 | 205 | if (!$hide_expected_answer) { |
| 206 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
| 207 | - echo $my_choice; |
|
| 206 | + $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
| 207 | + echo $my_choice; |
|
| 208 | 208 | } |
| 209 | - ?> |
|
| 209 | + ?> |
|
| 210 | 210 | </td> |
| 211 | 211 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 212 | 212 | <td class="text-left" width="60%"> |
@@ -214,29 +214,29 @@ discard block |
||
| 214 | 214 | if ($studentChoice) { |
| 215 | 215 | echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
| 216 | 216 | } |
| 217 | - ?> |
|
| 217 | + ?> |
|
| 218 | 218 | </td> |
| 219 | 219 | <?php } else { ?> |
| 220 | 220 | <td class="text-left" width="60%"> </td> |
| 221 | 221 | <?php } ?> |
| 222 | 222 | </tr> |
| 223 | 223 | <?php |
| 224 | - } |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - /** |
|
| 227 | - * Display the answers to a multiple choice question |
|
| 228 | - * @param int $feedback_type Feedback type |
|
| 229 | - * @param integer Answer type |
|
| 230 | - * @param integer Student choice |
|
| 231 | - * @param string Textual answer |
|
| 232 | - * @param string Comment on answer |
|
| 233 | - * @param string Correct answer comment |
|
| 234 | - * @param integer Exercise ID |
|
| 235 | - * @param integer Question ID |
|
| 236 | - * @param boolean Whether to show the answer comment or not |
|
| 237 | - * @return void |
|
| 238 | - */ |
|
| 239 | - public static function display_unique_or_multiple_answer( |
|
| 226 | + /** |
|
| 227 | + * Display the answers to a multiple choice question |
|
| 228 | + * @param int $feedback_type Feedback type |
|
| 229 | + * @param integer Answer type |
|
| 230 | + * @param integer Student choice |
|
| 231 | + * @param string Textual answer |
|
| 232 | + * @param string Comment on answer |
|
| 233 | + * @param string Correct answer comment |
|
| 234 | + * @param integer Exercise ID |
|
| 235 | + * @param integer Question ID |
|
| 236 | + * @param boolean Whether to show the answer comment or not |
|
| 237 | + * @return void |
|
| 238 | + */ |
|
| 239 | + public static function display_unique_or_multiple_answer( |
|
| 240 | 240 | $feedback_type, |
| 241 | 241 | $answerType, |
| 242 | 242 | $studentChoice, |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | $hide_expected_answer = true; |
| 255 | 255 | } |
| 256 | 256 | $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
| 257 | - $icon .= $studentChoice?'_on':'_off'; |
|
| 258 | - $icon .= '.gif'; |
|
| 257 | + $icon .= $studentChoice?'_on':'_off'; |
|
| 258 | + $icon .= '.gif'; |
|
| 259 | 259 | |
| 260 | - $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 261 | - $iconAnswer .= $answerCorrect?'_on':'_off'; |
|
| 262 | - $iconAnswer .= '.gif'; |
|
| 260 | + $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 261 | + $iconAnswer .= $answerCorrect?'_on':'_off'; |
|
| 262 | + $iconAnswer .= '.gif'; |
|
| 263 | 263 | |
| 264 | - ?> |
|
| 264 | + ?> |
|
| 265 | 265 | <tr> |
| 266 | 266 | <td width="5%"> |
| 267 | 267 | <?php echo Display::return_icon($icon); ?> |
@@ -275,43 +275,43 @@ discard block |
||
| 275 | 275 | </td> |
| 276 | 276 | <td width="40%"> |
| 277 | 277 | <?php |
| 278 | - echo $answer; |
|
| 279 | - ?> |
|
| 278 | + echo $answer; |
|
| 279 | + ?> |
|
| 280 | 280 | </td> |
| 281 | 281 | |
| 282 | 282 | <?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
| 283 | 283 | <td width="20%"> |
| 284 | 284 | <?php |
| 285 | 285 | if ($studentChoice) { |
| 286 | - if ($answerCorrect) { |
|
| 286 | + if ($answerCorrect) { |
|
| 287 | 287 | $color = 'green'; |
| 288 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 289 | - } else { |
|
| 288 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 289 | + } else { |
|
| 290 | 290 | $color = 'black'; |
| 291 | 291 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 294 | 294 | |
| 295 | - } else { |
|
| 296 | - if ($answerCorrect) { |
|
| 297 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 298 | - } else { |
|
| 295 | + } else { |
|
| 296 | + if ($answerCorrect) { |
|
| 297 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 298 | + } else { |
|
| 299 | 299 | //echo '<span style="font-weight: normal; color: #000;">'.nl2br($answerComment).'</span>'; |
| 300 | - } |
|
| 301 | - } |
|
| 302 | - ?> |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + ?> |
|
| 303 | 303 | </td> |
| 304 | 304 | <?php |
| 305 | - if ($ans==1) { |
|
| 306 | - $comm = Event::get_comments($id,$questionId); |
|
| 307 | - } |
|
| 308 | - ?> |
|
| 305 | + if ($ans==1) { |
|
| 306 | + $comm = Event::get_comments($id,$questionId); |
|
| 307 | + } |
|
| 308 | + ?> |
|
| 309 | 309 | <?php } else { ?> |
| 310 | 310 | <td> </td> |
| 311 | 311 | <?php } ?> |
| 312 | 312 | </tr> |
| 313 | 313 | <?php |
| 314 | - } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | 316 | /** |
| 317 | 317 | * Display the answers to a multiple choice question |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if (isset($new_options[$studentChoice])) { |
| 356 | 356 | echo get_lang($new_options[$studentChoice]['name']); |
| 357 | 357 | } else { |
| 358 | - echo '-'; |
|
| 358 | + echo '-'; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | ?> |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | <td width="5%"> |
| 364 | 364 | <?php |
| 365 | 365 | |
| 366 | - //Expected choice |
|
| 366 | + //Expected choice |
|
| 367 | 367 | if (!$hide_expected_answer) { |
| 368 | 368 | if (isset($new_options[$answerCorrect])) { |
| 369 | 369 | echo get_lang($new_options[$answerCorrect]['name']); |
@@ -403,19 +403,19 @@ discard block |
||
| 403 | 403 | <?php |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - /** |
|
| 407 | - * Display the answers to a multiple choice question |
|
| 408 | - * |
|
| 409 | - * @param integer Answer type |
|
| 410 | - * @param integer Student choice |
|
| 411 | - * @param string Textual answer |
|
| 412 | - * @param string Comment on answer |
|
| 413 | - * @param string Correct answer comment |
|
| 414 | - * @param integer Exercise ID |
|
| 415 | - * @param integer Question ID |
|
| 416 | - * @param boolean Whether to show the answer comment or not |
|
| 417 | - * @return void |
|
| 418 | - */ |
|
| 406 | + /** |
|
| 407 | + * Display the answers to a multiple choice question |
|
| 408 | + * |
|
| 409 | + * @param integer Answer type |
|
| 410 | + * @param integer Student choice |
|
| 411 | + * @param string Textual answer |
|
| 412 | + * @param string Comment on answer |
|
| 413 | + * @param string Correct answer comment |
|
| 414 | + * @param integer Exercise ID |
|
| 415 | + * @param integer Question ID |
|
| 416 | + * @param boolean Whether to show the answer comment or not |
|
| 417 | + * @return void |
|
| 418 | + */ |
|
| 419 | 419 | static function display_multiple_answer_combination_true_false( |
| 420 | 420 | $feedback_type, |
| 421 | 421 | $answerType, |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | <tr> |
| 437 | 437 | <td width="5%"> |
| 438 | 438 | <?php |
| 439 | - //Your choice |
|
| 439 | + //Your choice |
|
| 440 | 440 | $question = new MultipleAnswerCombinationTrueFalse(); |
| 441 | 441 | if (isset($question->options[$studentChoice])) { |
| 442 | 442 | echo $question->options[$studentChoice]; |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | </td> |
| 448 | 448 | <td width="5%"> |
| 449 | 449 | <?php |
| 450 | - //Expected choice |
|
| 450 | + //Expected choice |
|
| 451 | 451 | if (!$hide_expected_answer) { |
| 452 | 452 | if (isset($question->options[$answerCorrect])) { |
| 453 | 453 | echo $question->options[$answerCorrect]; |
@@ -472,20 +472,20 @@ discard block |
||
| 472 | 472 | <?php |
| 473 | 473 | //@todo replace this harcoded value |
| 474 | 474 | if ($studentChoice) { |
| 475 | - $color = "black"; |
|
| 475 | + $color = "black"; |
|
| 476 | 476 | if ($studentChoice == $answerCorrect) { |
| 477 | 477 | $color = "green"; |
| 478 | 478 | } |
| 479 | 479 | echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>'; |
| 480 | 480 | } |
| 481 | 481 | if ($studentChoice == 2 || $studentChoice == '') { |
| 482 | - //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 482 | + //echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>'; |
|
| 483 | 483 | } else { |
| 484 | - if ($studentChoice == $answerCorrect) { |
|
| 485 | - //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 486 | - } else { |
|
| 484 | + if ($studentChoice == $answerCorrect) { |
|
| 485 | + //echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>'; |
|
| 486 | + } else { |
|
| 487 | 487 | //echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>'; |
| 488 | - } |
|
| 488 | + } |
|
| 489 | 489 | } |
| 490 | 490 | ?> |
| 491 | 491 | </td> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | </td> |
| 46 | 46 | |
| 47 | 47 | <?php |
| 48 | - if (!api_is_allowed_to_edit(null,true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 48 | + if (!api_is_allowed_to_edit(null, true) && $feedbackType != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 49 | 49 | <td> |
| 50 | 50 | <?php |
| 51 | 51 | $comm = Event::get_comments($id, $questionId); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public static function display_calculated_answer($feedback_type, $answer, $id, $questionId) |
| 68 | 68 | { |
| 69 | 69 | if (empty($id)) { |
| 70 | - echo '<tr><td>'. Security::remove_XSS($answer).'</td></tr>'; |
|
| 70 | + echo '<tr><td>'.Security::remove_XSS($answer).'</td></tr>'; |
|
| 71 | 71 | } else { |
| 72 | 72 | ?> |
| 73 | 73 | <tr> |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | </td> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 81 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?> |
|
| 82 | 82 | <td> |
| 83 | 83 | <?php |
| 84 | - $comm = Event::get_comments($id,$questionId); |
|
| 84 | + $comm = Event::get_comments($id, $questionId); |
|
| 85 | 85 | ?> |
| 86 | 86 | </td> |
| 87 | 87 | <?php } ?> |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | echo '</tr>'; |
| 130 | 130 | if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
| 131 | 131 | echo '<tr>'; |
| 132 | - echo Display::tag('td',get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
| 132 | + echo Display::tag('td', get_lang('notCorrectedYet'), array('width'=>'45%')); |
|
| 133 | 133 | echo '</tr>'; |
| 134 | 134 | } else { |
| 135 | 135 | echo '<tr><td> </td></tr>'; |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | echo '</td>'; |
| 144 | 144 | |
| 145 | - if (!api_is_allowed_to_edit(null,true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
| 145 | + if (!api_is_allowed_to_edit(null, true) && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { |
|
| 146 | 146 | echo '<td>'; |
| 147 | - $comm = Event::get_comments($id,$questionId); |
|
| 147 | + $comm = Event::get_comments($id, $questionId); |
|
| 148 | 148 | echo '</td>'; |
| 149 | 149 | } |
| 150 | 150 | echo '</tr>'; |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | <td class="text-left" width="10%"> |
| 204 | 204 | <?php |
| 205 | 205 | if (!$hide_expected_answer) { |
| 206 | - $my_choice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); |
|
| 206 | + $my_choice = ($studentChoice) ? get_lang('Correct') : get_lang('Fault'); |
|
| 207 | 207 | echo $my_choice; |
| 208 | 208 | } |
| 209 | 209 | ?> |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | if ($feedback_type == 0 && $in_results_disabled == 2) { |
| 254 | 254 | $hide_expected_answer = true; |
| 255 | 255 | } |
| 256 | - $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 257 | - $icon .= $studentChoice?'_on':'_off'; |
|
| 256 | + $icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox'; |
|
| 257 | + $icon .= $studentChoice ? '_on' : '_off'; |
|
| 258 | 258 | $icon .= '.gif'; |
| 259 | 259 | |
| 260 | - $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox'; |
|
| 261 | - $iconAnswer .= $answerCorrect?'_on':'_off'; |
|
| 260 | + $iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio' : 'checkbox'; |
|
| 261 | + $iconAnswer .= $answerCorrect ? '_on' : '_off'; |
|
| 262 | 262 | $iconAnswer .= '.gif'; |
| 263 | 263 | |
| 264 | 264 | ?> |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | ?> |
| 303 | 303 | </td> |
| 304 | 304 | <?php |
| 305 | - if ($ans==1) { |
|
| 306 | - $comm = Event::get_comments($id,$questionId); |
|
| 305 | + if ($ans == 1) { |
|
| 306 | + $comm = Event::get_comments($id, $questionId); |
|
| 307 | 307 | } |
| 308 | 308 | ?> |
| 309 | 309 | <?php } else { ?> |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | <td width="5%"> |
| 348 | 348 | <?php |
| 349 | 349 | |
| 350 | - $question = new MultipleAnswerTrueFalse(); |
|
| 350 | + $question = new MultipleAnswerTrueFalse(); |
|
| 351 | 351 | $course_id = api_get_course_int_id(); |
| 352 | 352 | $new_options = Question::readQuestionOption($questionId, $course_id); |
| 353 | 353 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | ?> |
| 393 | 393 | </td> |
| 394 | 394 | <?php |
| 395 | - if ($ans==1) { |
|
| 395 | + if ($ans == 1) { |
|
| 396 | 396 | $comm = Event::get_comments($id, $questionId); |
| 397 | 397 | } |
| 398 | 398 | ?> |
@@ -490,8 +490,8 @@ discard block |
||
| 490 | 490 | ?> |
| 491 | 491 | </td> |
| 492 | 492 | <?php |
| 493 | - if ($ans==1) { |
|
| 494 | - $comm = Event::get_comments($id,$questionId); |
|
| 493 | + if ($ans == 1) { |
|
| 494 | + $comm = Event::get_comments($id, $questionId); |
|
| 495 | 495 | } |
| 496 | 496 | ?> |
| 497 | 497 | <?php } else { ?> |
@@ -25,38 +25,38 @@ discard block |
||
| 25 | 25 | function store_permissions($content, $id) { |
| 26 | 26 | $course_id = api_get_course_int_id(); |
| 27 | 27 | |
| 28 | - // Which database are we using (depending on the $content parameter) |
|
| 29 | - if ($content=='user') |
|
| 30 | - { |
|
| 31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | - $id_field = user_id; |
|
| 33 | - } |
|
| 34 | - if ($content=='group') |
|
| 35 | - { |
|
| 36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | - $id_field = group_id; |
|
| 38 | - } |
|
| 39 | - if ($content=='role') |
|
| 40 | - { |
|
| 41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | - $id_field = role_id; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - // We first delete all the existing permissions for that user/group/role |
|
| 46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | - $result=Database::query($sql); |
|
| 48 | - |
|
| 49 | - // looping through the post values to find the permission (containing the string permission* ) |
|
| 50 | - foreach ($_POST as $key => $value) |
|
| 51 | - { |
|
| 52 | - if (strstr($key,"permission*")) |
|
| 53 | - { |
|
| 54 | - list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | - $result=Database::query($sql); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - return get_lang('PermissionsStored'); |
|
| 28 | + // Which database are we using (depending on the $content parameter) |
|
| 29 | + if ($content=='user') |
|
| 30 | + { |
|
| 31 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | + $id_field = user_id; |
|
| 33 | + } |
|
| 34 | + if ($content=='group') |
|
| 35 | + { |
|
| 36 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | + $id_field = group_id; |
|
| 38 | + } |
|
| 39 | + if ($content=='role') |
|
| 40 | + { |
|
| 41 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | + $id_field = role_id; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + // We first delete all the existing permissions for that user/group/role |
|
| 46 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | + $result=Database::query($sql); |
|
| 48 | + |
|
| 49 | + // looping through the post values to find the permission (containing the string permission* ) |
|
| 50 | + foreach ($_POST as $key => $value) |
|
| 51 | + { |
|
| 52 | + if (strstr($key,"permission*")) |
|
| 53 | + { |
|
| 54 | + list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | + $result=Database::query($sql); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + return get_lang('PermissionsStored'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -70,50 +70,50 @@ discard block |
||
| 70 | 70 | * @version 1.0 |
| 71 | 71 | */ |
| 72 | 72 | function store_one_permission($content, $action, $id, $tool,$permission) { |
| 73 | - global $rights_full; |
|
| 73 | + global $rights_full; |
|
| 74 | 74 | $course_id = api_get_course_int_id(); |
| 75 | - // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
| 75 | + // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
| 76 | 76 | |
| 77 | - // check |
|
| 78 | - //if(!in_array($permission, $rights_full)) |
|
| 79 | - //{ |
|
| 80 | - // return get_lang('Error'); |
|
| 81 | - //} |
|
| 77 | + // check |
|
| 78 | + //if(!in_array($permission, $rights_full)) |
|
| 79 | + //{ |
|
| 80 | + // return get_lang('Error'); |
|
| 81 | + //} |
|
| 82 | 82 | |
| 83 | - // Which database are we using (depending on the $content parameter) |
|
| 83 | + // Which database are we using (depending on the $content parameter) |
|
| 84 | 84 | |
| 85 | - if ($content=='user') { |
|
| 86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | - $id_field = user_id; |
|
| 88 | - } |
|
| 89 | - if ($content=='group') |
|
| 90 | - { |
|
| 91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | - $id_field = group_id; |
|
| 93 | - } |
|
| 94 | - if ($content=='role') |
|
| 95 | - { |
|
| 96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | - $id_field = role_id; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // grating a right |
|
| 101 | - if ($action=='grant') { |
|
| 102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | - $result=Database::query($sql); |
|
| 104 | - if($result) { |
|
| 105 | - $result_message=get_lang('PermissionGranted'); |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - if ($action=='revoke') |
|
| 109 | - { |
|
| 110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | - $result=Database::query($sql); |
|
| 112 | - if($result) { |
|
| 113 | - $result_message=get_lang('PermissionRevoked'); |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - return $result_message; |
|
| 85 | + if ($content=='user') { |
|
| 86 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | + $id_field = user_id; |
|
| 88 | + } |
|
| 89 | + if ($content=='group') |
|
| 90 | + { |
|
| 91 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | + $id_field = group_id; |
|
| 93 | + } |
|
| 94 | + if ($content=='role') |
|
| 95 | + { |
|
| 96 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | + $id_field = role_id; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // grating a right |
|
| 101 | + if ($action=='grant') { |
|
| 102 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | + $result=Database::query($sql); |
|
| 104 | + if($result) { |
|
| 105 | + $result_message=get_lang('PermissionGranted'); |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + if ($action=='revoke') |
|
| 109 | + { |
|
| 110 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | + $result=Database::query($sql); |
|
| 112 | + if($result) { |
|
| 113 | + $result_message=get_lang('PermissionRevoked'); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + return $result_message; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -125,47 +125,47 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | function get_permissions($content, $id) { |
| 127 | 127 | $course_id = api_get_course_int_id(); |
| 128 | - $currentpermissions=array(); |
|
| 129 | - // Which database are we using (depending on the $content parameter) |
|
| 128 | + $currentpermissions=array(); |
|
| 129 | + // Which database are we using (depending on the $content parameter) |
|
| 130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
| 131 | - if ($content == 'user') |
|
| 132 | - { |
|
| 133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | - $id_field = 'user_id'; |
|
| 135 | - } |
|
| 136 | - elseif ($content == 'group') |
|
| 137 | - { |
|
| 138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | - $id_field = 'group_id'; |
|
| 140 | - } |
|
| 141 | - elseif ($content == 'role') |
|
| 142 | - { |
|
| 143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | - $id_field = 'role_id'; |
|
| 145 | - } |
|
| 146 | - elseif ($content == 'platform_role') |
|
| 147 | - { |
|
| 148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | - $id_field = 'role_id'; |
|
| 131 | + if ($content == 'user') |
|
| 132 | + { |
|
| 133 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | + $id_field = 'user_id'; |
|
| 135 | + } |
|
| 136 | + elseif ($content == 'group') |
|
| 137 | + { |
|
| 138 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | + $id_field = 'group_id'; |
|
| 140 | + } |
|
| 141 | + elseif ($content == 'role') |
|
| 142 | + { |
|
| 143 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | + $id_field = 'role_id'; |
|
| 145 | + } |
|
| 146 | + elseif ($content == 'platform_role') |
|
| 147 | + { |
|
| 148 | + $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | + $id_field = 'role_id'; |
|
| 150 | 150 | $course_id_condition = ''; |
| 151 | - } |
|
| 152 | - elseif ($content == 'task') |
|
| 153 | - { |
|
| 154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | - $id_field = 'task_id'; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - // finding all the permissions. We store this in a multidimensional array |
|
| 159 | - // where the first dimension is the tool. |
|
| 160 | - $sql=" |
|
| 151 | + } |
|
| 152 | + elseif ($content == 'task') |
|
| 153 | + { |
|
| 154 | + $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | + $id_field = 'task_id'; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + // finding all the permissions. We store this in a multidimensional array |
|
| 159 | + // where the first dimension is the tool. |
|
| 160 | + $sql=" |
|
| 161 | 161 | SELECT * FROM " . $table . " |
| 162 | 162 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
| 163 | - $result = Database::query($sql); |
|
| 163 | + $result = Database::query($sql); |
|
| 164 | 164 | |
| 165 | - while($row = Database::fetch_array($result)) |
|
| 166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
| 165 | + while($row = Database::fetch_array($result)) |
|
| 166 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
| 167 | 167 | |
| 168 | - return $currentpermissions; |
|
| 168 | + return $currentpermissions; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -179,38 +179,38 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | function limited_or_full($current_permissions) |
| 181 | 181 | { |
| 182 | - if (api_get_setting('permissions')=='limited') |
|
| 183 | - { |
|
| 184 | - foreach ($current_permissions as $tool=>$tool_rights) |
|
| 185 | - { |
|
| 186 | - // we loop through the possible permissions of a tool and unset the entry if it is view |
|
| 187 | - // if it is visibility or move we have to grant the edit right |
|
| 188 | - foreach ($tool_rights as $key=>$value) |
|
| 189 | - { |
|
| 190 | - if ($value=='View') |
|
| 191 | - { |
|
| 192 | - unset($current_permissions[$tool][$key]); |
|
| 193 | - } |
|
| 194 | - if ($value=='Visibility' OR $value=='Move') |
|
| 195 | - { |
|
| 196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
| 197 | - { |
|
| 198 | - $current_permissions[$tool][]='Edit'; |
|
| 199 | - } |
|
| 200 | - unset($current_permissions[$tool][$key]); |
|
| 201 | - } |
|
| 202 | - //else |
|
| 203 | - //{ |
|
| 204 | - // $current_permissions[$tool][]=$value; |
|
| 205 | - //} |
|
| 206 | - } |
|
| 207 | - } |
|
| 208 | - return $current_permissions; |
|
| 209 | - } |
|
| 210 | - if (api_get_setting('permissions')=='full') |
|
| 211 | - { |
|
| 212 | - return $current_permissions; |
|
| 213 | - } |
|
| 182 | + if (api_get_setting('permissions')=='limited') |
|
| 183 | + { |
|
| 184 | + foreach ($current_permissions as $tool=>$tool_rights) |
|
| 185 | + { |
|
| 186 | + // we loop through the possible permissions of a tool and unset the entry if it is view |
|
| 187 | + // if it is visibility or move we have to grant the edit right |
|
| 188 | + foreach ($tool_rights as $key=>$value) |
|
| 189 | + { |
|
| 190 | + if ($value=='View') |
|
| 191 | + { |
|
| 192 | + unset($current_permissions[$tool][$key]); |
|
| 193 | + } |
|
| 194 | + if ($value=='Visibility' OR $value=='Move') |
|
| 195 | + { |
|
| 196 | + if (!in_array('Edit',$current_permissions[$tool])) |
|
| 197 | + { |
|
| 198 | + $current_permissions[$tool][]='Edit'; |
|
| 199 | + } |
|
| 200 | + unset($current_permissions[$tool][$key]); |
|
| 201 | + } |
|
| 202 | + //else |
|
| 203 | + //{ |
|
| 204 | + // $current_permissions[$tool][]=$value; |
|
| 205 | + //} |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | + return $current_permissions; |
|
| 209 | + } |
|
| 210 | + if (api_get_setting('permissions')=='full') |
|
| 211 | + { |
|
| 212 | + return $current_permissions; |
|
| 213 | + } |
|
| 214 | 214 | } |
| 215 | 215 | /** |
| 216 | 216 | * This function displays a checked or unchecked checkbox. The checkbox will be checked if the |
@@ -224,12 +224,12 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
| 226 | 226 | { |
| 227 | - $checked=""; |
|
| 228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 229 | - { |
|
| 230 | - $checked="checked"; |
|
| 231 | - } |
|
| 232 | - echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
| 227 | + $checked=""; |
|
| 228 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 229 | + { |
|
| 230 | + $checked="checked"; |
|
| 231 | + } |
|
| 232 | + echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
@@ -245,62 +245,62 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
| 247 | 247 | { |
| 248 | - if ($course_admin) { |
|
| 249 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 250 | - } else { |
|
| 251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 252 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 253 | - } else { |
|
| 254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 255 | - if ($editable) { |
|
| 256 | - $url=api_get_self(); |
|
| 257 | - $urlparameters = ''; |
|
| 258 | - foreach($_GET as $key=>$value) { |
|
| 259 | - $parameter[$key]=$value; |
|
| 260 | - } |
|
| 261 | - $parameter['action']='revoke'; |
|
| 262 | - $parameter['permission']=$permission; |
|
| 263 | - $parameter['tool']=$tool; |
|
| 264 | - foreach ($parameter as $key=>$value) { |
|
| 265 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 266 | - } |
|
| 267 | - $url=$url.'?'.$urlparameters; |
|
| 268 | - |
|
| 269 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 270 | - } |
|
| 271 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
| 272 | - if ($editable) { |
|
| 273 | - echo "</a>"; |
|
| 274 | - } |
|
| 275 | - } else { |
|
| 276 | - if ($editable) |
|
| 277 | - { |
|
| 278 | - $url=api_get_self(); |
|
| 279 | - $urlparameters = ''; |
|
| 280 | - foreach ($_GET as $key=>$value) |
|
| 281 | - { |
|
| 282 | - $parameter[$key]=$value; |
|
| 283 | - } |
|
| 284 | - $parameter['action']='grant'; |
|
| 285 | - $parameter['permission']=$permission; |
|
| 286 | - $parameter['tool']=$tool; |
|
| 287 | - foreach ($parameter as $key=>$value) |
|
| 288 | - { |
|
| 289 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 290 | - } |
|
| 291 | - $url=$url.'?'.$urlparameters; |
|
| 292 | - |
|
| 293 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 294 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 295 | - } |
|
| 296 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
| 297 | - if ($editable) |
|
| 298 | - { |
|
| 299 | - echo "</a>"; |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - } |
|
| 303 | - } |
|
| 248 | + if ($course_admin) { |
|
| 249 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 250 | + } else { |
|
| 251 | + if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 252 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 253 | + } else { |
|
| 254 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 255 | + if ($editable) { |
|
| 256 | + $url=api_get_self(); |
|
| 257 | + $urlparameters = ''; |
|
| 258 | + foreach($_GET as $key=>$value) { |
|
| 259 | + $parameter[$key]=$value; |
|
| 260 | + } |
|
| 261 | + $parameter['action']='revoke'; |
|
| 262 | + $parameter['permission']=$permission; |
|
| 263 | + $parameter['tool']=$tool; |
|
| 264 | + foreach ($parameter as $key=>$value) { |
|
| 265 | + $urlparameters.=$key.'='.$value.'&'; |
|
| 266 | + } |
|
| 267 | + $url=$url.'?'.$urlparameters; |
|
| 268 | + |
|
| 269 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 270 | + } |
|
| 271 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
| 272 | + if ($editable) { |
|
| 273 | + echo "</a>"; |
|
| 274 | + } |
|
| 275 | + } else { |
|
| 276 | + if ($editable) |
|
| 277 | + { |
|
| 278 | + $url=api_get_self(); |
|
| 279 | + $urlparameters = ''; |
|
| 280 | + foreach ($_GET as $key=>$value) |
|
| 281 | + { |
|
| 282 | + $parameter[$key]=$value; |
|
| 283 | + } |
|
| 284 | + $parameter['action']='grant'; |
|
| 285 | + $parameter['permission']=$permission; |
|
| 286 | + $parameter['tool']=$tool; |
|
| 287 | + foreach ($parameter as $key=>$value) |
|
| 288 | + { |
|
| 289 | + $urlparameters.=$key.'='.$value.'&'; |
|
| 290 | + } |
|
| 291 | + $url=$url.'?'.$urlparameters; |
|
| 292 | + |
|
| 293 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 294 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 295 | + } |
|
| 296 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
| 297 | + if ($editable) |
|
| 298 | + { |
|
| 299 | + echo "</a>"; |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | |
@@ -318,72 +318,72 @@ discard block |
||
| 318 | 318 | function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
| 319 | 319 | { |
| 320 | 320 | |
| 321 | - if ($course_admin) |
|
| 322 | - { |
|
| 323 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 324 | - } |
|
| 325 | - else |
|
| 326 | - { |
|
| 327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 328 | - { |
|
| 329 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 330 | - } |
|
| 331 | - else |
|
| 332 | - { |
|
| 333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 334 | - { |
|
| 335 | - if ($editable) |
|
| 336 | - { |
|
| 337 | - $url = api_get_self(); |
|
| 338 | - $urlparameters = ''; |
|
| 339 | - foreach($_GET as $key => $value) |
|
| 340 | - { |
|
| 341 | - $parameter[$key] = $value; |
|
| 342 | - } |
|
| 343 | - $parameter['action']='manage_rights'; |
|
| 344 | - $parameter['do']='revoke'; |
|
| 345 | - $parameter['permission']=$permission; |
|
| 346 | - $parameter['tool']=$tool; |
|
| 347 | - $parameter['user_id']=$user_id; |
|
| 348 | - foreach ($parameter as $key=>$value) |
|
| 349 | - { |
|
| 350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 351 | - } |
|
| 352 | - $url = $url . '?' . $urlparameters; |
|
| 353 | - |
|
| 354 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 355 | - } |
|
| 356 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
| 357 | - if ($editable) { |
|
| 358 | - echo "</a>"; |
|
| 359 | - } |
|
| 360 | - } else { |
|
| 361 | - if ($editable) { |
|
| 362 | - $url = api_get_self(); |
|
| 363 | - $urlparameters = ''; |
|
| 364 | - foreach ($_GET as $key=>$value) { |
|
| 365 | - $parameter[$key]=$value; |
|
| 366 | - } |
|
| 367 | - $parameter['action']='manage_rights'; |
|
| 368 | - $parameter['do']='grant'; |
|
| 369 | - $parameter['permission']=$permission; |
|
| 370 | - $parameter['tool']=$tool; |
|
| 371 | - $parameter['user_id']=$user_id; |
|
| 372 | - foreach ($parameter as $key=>$value) { |
|
| 373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 374 | - } |
|
| 375 | - $url=$url.'?'.$urlparameters; |
|
| 376 | - |
|
| 377 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 378 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
| 379 | - } |
|
| 380 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
| 381 | - if ($editable) { |
|
| 382 | - echo "</a>"; |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - } |
|
| 386 | - } |
|
| 321 | + if ($course_admin) |
|
| 322 | + { |
|
| 323 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 324 | + } |
|
| 325 | + else |
|
| 326 | + { |
|
| 327 | + if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 328 | + { |
|
| 329 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
| 330 | + } |
|
| 331 | + else |
|
| 332 | + { |
|
| 333 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 334 | + { |
|
| 335 | + if ($editable) |
|
| 336 | + { |
|
| 337 | + $url = api_get_self(); |
|
| 338 | + $urlparameters = ''; |
|
| 339 | + foreach($_GET as $key => $value) |
|
| 340 | + { |
|
| 341 | + $parameter[$key] = $value; |
|
| 342 | + } |
|
| 343 | + $parameter['action']='manage_rights'; |
|
| 344 | + $parameter['do']='revoke'; |
|
| 345 | + $parameter['permission']=$permission; |
|
| 346 | + $parameter['tool']=$tool; |
|
| 347 | + $parameter['user_id']=$user_id; |
|
| 348 | + foreach ($parameter as $key=>$value) |
|
| 349 | + { |
|
| 350 | + $urlparameters .= $key . '=' . $value . '&'; |
|
| 351 | + } |
|
| 352 | + $url = $url . '?' . $urlparameters; |
|
| 353 | + |
|
| 354 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 355 | + } |
|
| 356 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
| 357 | + if ($editable) { |
|
| 358 | + echo "</a>"; |
|
| 359 | + } |
|
| 360 | + } else { |
|
| 361 | + if ($editable) { |
|
| 362 | + $url = api_get_self(); |
|
| 363 | + $urlparameters = ''; |
|
| 364 | + foreach ($_GET as $key=>$value) { |
|
| 365 | + $parameter[$key]=$value; |
|
| 366 | + } |
|
| 367 | + $parameter['action']='manage_rights'; |
|
| 368 | + $parameter['do']='grant'; |
|
| 369 | + $parameter['permission']=$permission; |
|
| 370 | + $parameter['tool']=$tool; |
|
| 371 | + $parameter['user_id']=$user_id; |
|
| 372 | + foreach ($parameter as $key=>$value) { |
|
| 373 | + $urlparameters .= $key . '=' . $value . '&'; |
|
| 374 | + } |
|
| 375 | + $url=$url.'?'.$urlparameters; |
|
| 376 | + |
|
| 377 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
| 378 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
| 379 | + } |
|
| 380 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
| 381 | + if ($editable) { |
|
| 382 | + echo "</a>"; |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -394,41 +394,41 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function display_role_list($current_course_roles, $current_platform_roles) |
| 396 | 396 | { |
| 397 | - global $setting_visualisation; |
|
| 397 | + global $setting_visualisation; |
|
| 398 | 398 | $course_id = api_get_course_int_id(); |
| 399 | 399 | |
| 400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 401 | - |
|
| 402 | - // course roles |
|
| 403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | - $result=Database::query($sql); |
|
| 405 | - while ($row=Database::fetch_array($result)) |
|
| 406 | - { |
|
| 407 | - if (in_array($row['role_id'], $current_course_roles)) |
|
| 408 | - { |
|
| 409 | - $checked='checked'; |
|
| 410 | - $image='checkbox_on2.gif'; |
|
| 411 | - $action='revoke'; |
|
| 412 | - } |
|
| 413 | - else |
|
| 414 | - { |
|
| 415 | - $checked=''; |
|
| 416 | - $image='wrong.gif'; |
|
| 417 | - $action='grant'; |
|
| 418 | - } |
|
| 419 | - if ($setting_visualisation=='checkbox') |
|
| 420 | - { |
|
| 421 | - echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
| 422 | - } |
|
| 423 | - if ($setting_visualisation=='image') |
|
| 424 | - { |
|
| 425 | - echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - |
|
| 429 | - echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
| 430 | - echo $row['role_comment']."<br />\n"; |
|
| 431 | - } |
|
| 400 | + $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 401 | + |
|
| 402 | + // course roles |
|
| 403 | + $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | + $result=Database::query($sql); |
|
| 405 | + while ($row=Database::fetch_array($result)) |
|
| 406 | + { |
|
| 407 | + if (in_array($row['role_id'], $current_course_roles)) |
|
| 408 | + { |
|
| 409 | + $checked='checked'; |
|
| 410 | + $image='checkbox_on2.gif'; |
|
| 411 | + $action='revoke'; |
|
| 412 | + } |
|
| 413 | + else |
|
| 414 | + { |
|
| 415 | + $checked=''; |
|
| 416 | + $image='wrong.gif'; |
|
| 417 | + $action='grant'; |
|
| 418 | + } |
|
| 419 | + if ($setting_visualisation=='checkbox') |
|
| 420 | + { |
|
| 421 | + echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
| 422 | + } |
|
| 423 | + if ($setting_visualisation=='image') |
|
| 424 | + { |
|
| 425 | + echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + |
|
| 429 | + echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
| 430 | + echo $row['role_comment']."<br />\n"; |
|
| 431 | + } |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | /** |
@@ -442,24 +442,24 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | function get_roles($content,$id, $scope='course') { |
| 444 | 444 | $course_id = api_get_course_int_id(); |
| 445 | - if ($content=='user') { |
|
| 446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | - $id_field = user_id; |
|
| 448 | - } |
|
| 449 | - if ($content=='group') { |
|
| 450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | - $id_field = 'group_id'; |
|
| 452 | - } |
|
| 453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 454 | - |
|
| 455 | - $current_roles=array(); |
|
| 456 | - //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
| 457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | - $result=Database::query($sql); |
|
| 459 | - while ($row=Database::fetch_array($result)) { |
|
| 460 | - $current_roles[]=$row['role_id']; |
|
| 461 | - } |
|
| 462 | - return $current_roles; |
|
| 445 | + if ($content=='user') { |
|
| 446 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | + $id_field = user_id; |
|
| 448 | + } |
|
| 449 | + if ($content=='group') { |
|
| 450 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | + $id_field = 'group_id'; |
|
| 452 | + } |
|
| 453 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 454 | + |
|
| 455 | + $current_roles=array(); |
|
| 456 | + //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
| 457 | + $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | + $result=Database::query($sql); |
|
| 459 | + while ($row=Database::fetch_array($result)) { |
|
| 460 | + $current_roles[]=$row['role_id']; |
|
| 461 | + } |
|
| 462 | + return $current_roles; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | /** |
@@ -472,25 +472,25 @@ discard block |
||
| 472 | 472 | $course_id = api_get_course_int_id(); |
| 473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
| 474 | 474 | |
| 475 | - if ($content=='course') |
|
| 476 | - { |
|
| 477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 478 | - } |
|
| 479 | - if ($content=='platform') |
|
| 480 | - { |
|
| 481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 482 | - $course_id_condition = ''; |
|
| 483 | - } |
|
| 484 | - |
|
| 485 | - $current_roles=array(); |
|
| 486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | - $result=Database::query($sql); |
|
| 488 | - while ($row=Database::fetch_array($result)) |
|
| 489 | - { |
|
| 490 | - $roles[]=$row; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - return $roles; |
|
| 475 | + if ($content=='course') |
|
| 476 | + { |
|
| 477 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 478 | + } |
|
| 479 | + if ($content=='platform') |
|
| 480 | + { |
|
| 481 | + $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 482 | + $course_id_condition = ''; |
|
| 483 | + } |
|
| 484 | + |
|
| 485 | + $current_roles=array(); |
|
| 486 | + $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | + $result=Database::query($sql); |
|
| 488 | + while ($row=Database::fetch_array($result)) |
|
| 489 | + { |
|
| 490 | + $roles[]=$row; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + return $roles; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
@@ -506,34 +506,34 @@ discard block |
||
| 506 | 506 | */ |
| 507 | 507 | function get_roles_permissions($content,$id, $scope='course') { |
| 508 | 508 | $course_id = api_get_course_int_id(); |
| 509 | - if ($content == 'user') { |
|
| 510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | - $id_field = 'user_id'; |
|
| 512 | - } |
|
| 513 | - |
|
| 514 | - if ($content == 'group') { |
|
| 515 | - $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 516 | - $id_field = 'group_id'; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - // course roles or platform roles |
|
| 520 | - $scope = 'course'; |
|
| 521 | - if ($scope == 'course') { |
|
| 522 | - $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 523 | - $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 509 | + if ($content == 'user') { |
|
| 510 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | + $id_field = 'user_id'; |
|
| 512 | + } |
|
| 513 | + |
|
| 514 | + if ($content == 'group') { |
|
| 515 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 516 | + $id_field = 'group_id'; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + // course roles or platform roles |
|
| 520 | + $scope = 'course'; |
|
| 521 | + if ($scope == 'course') { |
|
| 522 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 523 | + $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 524 | 524 | |
| 525 | 525 | $role_condition = " role.c_id = $course_id AND role_permissions.c_id = $course_id AND "; |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | - if ($scope == 'platform') { |
|
| 529 | - $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 530 | - $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 528 | + if ($scope == 'platform') { |
|
| 529 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 530 | + $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 531 | 531 | $role_condition = ''; |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - $current_roles = array(); |
|
| 534 | + $current_roles = array(); |
|
| 535 | 535 | |
| 536 | - $sql = " |
|
| 536 | + $sql = " |
|
| 537 | 537 | SELECT * |
| 538 | 538 | FROM |
| 539 | 539 | " . $table . " role_group_user, |
@@ -547,12 +547,12 @@ discard block |
||
| 547 | 547 | role_group_user.role_id = role.role_id AND |
| 548 | 548 | role.role_id = role_permissions.role_id"; |
| 549 | 549 | |
| 550 | - $result = Database::query($sql); |
|
| 550 | + $result = Database::query($sql); |
|
| 551 | 551 | $current_role_permissions = array(); |
| 552 | - while ($row=Database::fetch_array($result)) { |
|
| 553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 552 | + while ($row=Database::fetch_array($result)) { |
|
| 553 | + $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 554 | 554 | } |
| 555 | - return $current_role_permissions; |
|
| 555 | + return $current_role_permissions; |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /** |
@@ -566,34 +566,34 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | function assign_role($content, $action, $id, $role_id, $scope='course') { |
| 568 | 568 | $course_id = api_get_course_int_id(); |
| 569 | - // Which database are we using (depending on the $content parameter) |
|
| 570 | - if ($content=='user') { |
|
| 571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | - $id_field = 'user_id'; |
|
| 573 | - } elseif($content=='group') { |
|
| 574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | - $id_field = 'group_id'; |
|
| 576 | - } else { |
|
| 577 | - return get_lang('Error'); |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - // grating a right |
|
| 581 | - if ($action=='grant') { |
|
| 582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | - $result=Database::query($sql); |
|
| 584 | - if ($result) { |
|
| 585 | - $result_message=get_lang('RoleGranted'); |
|
| 586 | - } |
|
| 587 | - } |
|
| 569 | + // Which database are we using (depending on the $content parameter) |
|
| 570 | + if ($content=='user') { |
|
| 571 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | + $id_field = 'user_id'; |
|
| 573 | + } elseif($content=='group') { |
|
| 574 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | + $id_field = 'group_id'; |
|
| 576 | + } else { |
|
| 577 | + return get_lang('Error'); |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + // grating a right |
|
| 581 | + if ($action=='grant') { |
|
| 582 | + $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | + $result=Database::query($sql); |
|
| 584 | + if ($result) { |
|
| 585 | + $result_message=get_lang('RoleGranted'); |
|
| 586 | + } |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | - if ($action=='revoke') { |
|
| 590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | - $result=Database::query($sql); |
|
| 592 | - if ($result) { |
|
| 593 | - $result_message=get_lang('RoleRevoked'); |
|
| 594 | - } |
|
| 595 | - } |
|
| 596 | - return $result_message; |
|
| 589 | + if ($action=='revoke') { |
|
| 590 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | + $result=Database::query($sql); |
|
| 592 | + if ($result) { |
|
| 593 | + $result_message=get_lang('RoleRevoked'); |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | + return $result_message; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | |
@@ -603,21 +603,21 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | function permission_array_merge($array1, $array2) |
| 605 | 605 | { |
| 606 | - foreach ($array2 as $tool=>$permissions) |
|
| 607 | - { |
|
| 608 | - foreach ($permissions as $permissionkey=>$permissionvalue) |
|
| 609 | - { |
|
| 610 | - $array1[$tool][]=$permissionvalue; |
|
| 611 | - } |
|
| 612 | - } |
|
| 613 | - return $array1; |
|
| 606 | + foreach ($array2 as $tool=>$permissions) |
|
| 607 | + { |
|
| 608 | + foreach ($permissions as $permissionkey=>$permissionvalue) |
|
| 609 | + { |
|
| 610 | + $array1[$tool][]=$permissionvalue; |
|
| 611 | + } |
|
| 612 | + } |
|
| 613 | + return $array1; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | |
| 617 | 617 | function my_print_r($array) |
| 618 | 618 | { |
| 619 | - echo '<pre>'; |
|
| 620 | - print_r($array); |
|
| 621 | - echo '</pre>'; |
|
| 619 | + echo '<pre>'; |
|
| 620 | + print_r($array); |
|
| 621 | + echo '</pre>'; |
|
| 622 | 622 | } |
| 623 | 623 | ?> |
@@ -26,34 +26,34 @@ discard block |
||
| 26 | 26 | $course_id = api_get_course_int_id(); |
| 27 | 27 | |
| 28 | 28 | // Which database are we using (depending on the $content parameter) |
| 29 | - if ($content=='user') |
|
| 29 | + if ($content == 'user') |
|
| 30 | 30 | { |
| 31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 31 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 32 | 32 | $id_field = user_id; |
| 33 | 33 | } |
| 34 | - if ($content=='group') |
|
| 34 | + if ($content == 'group') |
|
| 35 | 35 | { |
| 36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 36 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 37 | 37 | $id_field = group_id; |
| 38 | 38 | } |
| 39 | - if ($content=='role') |
|
| 39 | + if ($content == 'role') |
|
| 40 | 40 | { |
| 41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 41 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 42 | 42 | $id_field = role_id; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // We first delete all the existing permissions for that user/group/role |
| 46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | - $result=Database::query($sql); |
|
| 46 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
| 47 | + $result = Database::query($sql); |
|
| 48 | 48 | |
| 49 | 49 | // looping through the post values to find the permission (containing the string permission* ) |
| 50 | 50 | foreach ($_POST as $key => $value) |
| 51 | 51 | { |
| 52 | - if (strstr($key,"permission*")) |
|
| 52 | + if (strstr($key, "permission*")) |
|
| 53 | 53 | { |
| 54 | - list($brol,$tool,$action)=explode("*",$key); |
|
| 55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | - $result=Database::query($sql); |
|
| 54 | + list($brol, $tool, $action) = explode("*", $key); |
|
| 55 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
| 56 | + $result = Database::query($sql); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | return get_lang('PermissionsStored'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @author Patrick Cool <[email protected]>, Ghent University |
| 70 | 70 | * @version 1.0 |
| 71 | 71 | */ |
| 72 | -function store_one_permission($content, $action, $id, $tool,$permission) { |
|
| 72 | +function store_one_permission($content, $action, $id, $tool, $permission) { |
|
| 73 | 73 | global $rights_full; |
| 74 | 74 | $course_id = api_get_course_int_id(); |
| 75 | 75 | // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
@@ -82,35 +82,35 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // Which database are we using (depending on the $content parameter) |
| 84 | 84 | |
| 85 | - if ($content=='user') { |
|
| 86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 85 | + if ($content == 'user') { |
|
| 86 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 87 | 87 | $id_field = user_id; |
| 88 | 88 | } |
| 89 | - if ($content=='group') |
|
| 89 | + if ($content == 'group') |
|
| 90 | 90 | { |
| 91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 91 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 92 | 92 | $id_field = group_id; |
| 93 | 93 | } |
| 94 | - if ($content=='role') |
|
| 94 | + if ($content == 'role') |
|
| 95 | 95 | { |
| 96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 96 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 97 | 97 | $id_field = role_id; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // grating a right |
| 101 | - if ($action=='grant') { |
|
| 102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | - $result=Database::query($sql); |
|
| 104 | - if($result) { |
|
| 105 | - $result_message=get_lang('PermissionGranted'); |
|
| 101 | + if ($action == 'grant') { |
|
| 102 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
| 103 | + $result = Database::query($sql); |
|
| 104 | + if ($result) { |
|
| 105 | + $result_message = get_lang('PermissionGranted'); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - if ($action=='revoke') |
|
| 108 | + if ($action == 'revoke') |
|
| 109 | 109 | { |
| 110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | - $result=Database::query($sql); |
|
| 112 | - if($result) { |
|
| 113 | - $result_message=get_lang('PermissionRevoked'); |
|
| 110 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
| 111 | + $result = Database::query($sql); |
|
| 112 | + if ($result) { |
|
| 113 | + $result_message = get_lang('PermissionRevoked'); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return $result_message; |
@@ -125,44 +125,44 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | function get_permissions($content, $id) { |
| 127 | 127 | $course_id = api_get_course_int_id(); |
| 128 | - $currentpermissions=array(); |
|
| 128 | + $currentpermissions = array(); |
|
| 129 | 129 | // Which database are we using (depending on the $content parameter) |
| 130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
| 131 | 131 | if ($content == 'user') |
| 132 | 132 | { |
| 133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 133 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 134 | 134 | $id_field = 'user_id'; |
| 135 | 135 | } |
| 136 | 136 | elseif ($content == 'group') |
| 137 | 137 | { |
| 138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 138 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
| 139 | 139 | $id_field = 'group_id'; |
| 140 | 140 | } |
| 141 | 141 | elseif ($content == 'role') |
| 142 | 142 | { |
| 143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 143 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
| 144 | 144 | $id_field = 'role_id'; |
| 145 | 145 | } |
| 146 | 146 | elseif ($content == 'platform_role') |
| 147 | 147 | { |
| 148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 148 | + $table = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
| 149 | 149 | $id_field = 'role_id'; |
| 150 | 150 | $course_id_condition = ''; |
| 151 | 151 | } |
| 152 | 152 | elseif ($content == 'task') |
| 153 | 153 | { |
| 154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 154 | + $table = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 155 | 155 | $id_field = 'task_id'; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // finding all the permissions. We store this in a multidimensional array |
| 159 | 159 | // where the first dimension is the tool. |
| 160 | - $sql=" |
|
| 161 | - SELECT * FROM " . $table . " |
|
| 162 | - WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
|
| 160 | + $sql = " |
|
| 161 | + SELECT * FROM " . $table." |
|
| 162 | + WHERE $course_id_condition ".$id_field."='".Database::escape_string($id)."'"; |
|
| 163 | 163 | $result = Database::query($sql); |
| 164 | 164 | |
| 165 | - while($row = Database::fetch_array($result)) |
|
| 165 | + while ($row = Database::fetch_array($result)) |
|
| 166 | 166 | $currentpermissions[$row['tool']][] = $row['action']; |
| 167 | 167 | |
| 168 | 168 | return $currentpermissions; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | function limited_or_full($current_permissions) |
| 181 | 181 | { |
| 182 | - if (api_get_setting('permissions')=='limited') |
|
| 182 | + if (api_get_setting('permissions') == 'limited') |
|
| 183 | 183 | { |
| 184 | 184 | foreach ($current_permissions as $tool=>$tool_rights) |
| 185 | 185 | { |
@@ -187,15 +187,15 @@ discard block |
||
| 187 | 187 | // if it is visibility or move we have to grant the edit right |
| 188 | 188 | foreach ($tool_rights as $key=>$value) |
| 189 | 189 | { |
| 190 | - if ($value=='View') |
|
| 190 | + if ($value == 'View') |
|
| 191 | 191 | { |
| 192 | 192 | unset($current_permissions[$tool][$key]); |
| 193 | 193 | } |
| 194 | - if ($value=='Visibility' OR $value=='Move') |
|
| 194 | + if ($value == 'Visibility' OR $value == 'Move') |
|
| 195 | 195 | { |
| 196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
| 196 | + if (!in_array('Edit', $current_permissions[$tool])) |
|
| 197 | 197 | { |
| 198 | - $current_permissions[$tool][]='Edit'; |
|
| 198 | + $current_permissions[$tool][] = 'Edit'; |
|
| 199 | 199 | } |
| 200 | 200 | unset($current_permissions[$tool][$key]); |
| 201 | 201 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | return $current_permissions; |
| 209 | 209 | } |
| 210 | - if (api_get_setting('permissions')=='full') |
|
| 210 | + if (api_get_setting('permissions') == 'full') |
|
| 211 | 211 | { |
| 212 | 212 | return $current_permissions; |
| 213 | 213 | } |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | * @author Patrick Cool <[email protected]>, Ghent University |
| 223 | 223 | * @version 1.0 |
| 224 | 224 | */ |
| 225 | -function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
|
| 225 | +function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array()) |
|
| 226 | 226 | { |
| 227 | - $checked=""; |
|
| 228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 227 | + $checked = ""; |
|
| 228 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
| 229 | 229 | { |
| 230 | - $checked="checked"; |
|
| 230 | + $checked = "checked"; |
|
| 231 | 231 | } |
| 232 | 232 | echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
| 233 | 233 | |
@@ -243,28 +243,28 @@ discard block |
||
| 243 | 243 | * @author Patrick Cool <[email protected]>, Ghent University |
| 244 | 244 | * @version 1.0 |
| 245 | 245 | */ |
| 246 | -function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
| 246 | +function display_image_matrix($permission_array, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
| 247 | 247 | { |
| 248 | 248 | if ($course_admin) { |
| 249 | 249 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 250 | 250 | } else { |
| 251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
| 251 | + if (in_array($permission, $inherited_permissions[$tool])) { |
|
| 252 | 252 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 253 | 253 | } else { |
| 254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
| 254 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) { |
|
| 255 | 255 | if ($editable) { |
| 256 | - $url=api_get_self(); |
|
| 256 | + $url = api_get_self(); |
|
| 257 | 257 | $urlparameters = ''; |
| 258 | - foreach($_GET as $key=>$value) { |
|
| 259 | - $parameter[$key]=$value; |
|
| 258 | + foreach ($_GET as $key=>$value) { |
|
| 259 | + $parameter[$key] = $value; |
|
| 260 | 260 | } |
| 261 | - $parameter['action']='revoke'; |
|
| 262 | - $parameter['permission']=$permission; |
|
| 263 | - $parameter['tool']=$tool; |
|
| 261 | + $parameter['action'] = 'revoke'; |
|
| 262 | + $parameter['permission'] = $permission; |
|
| 263 | + $parameter['tool'] = $tool; |
|
| 264 | 264 | foreach ($parameter as $key=>$value) { |
| 265 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 265 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 266 | 266 | } |
| 267 | - $url=$url.'?'.$urlparameters; |
|
| 267 | + $url = $url.'?'.$urlparameters; |
|
| 268 | 268 | |
| 269 | 269 | echo "\t\t\t <a href=\"".$url."\">"; |
| 270 | 270 | } |
@@ -275,20 +275,20 @@ discard block |
||
| 275 | 275 | } else { |
| 276 | 276 | if ($editable) |
| 277 | 277 | { |
| 278 | - $url=api_get_self(); |
|
| 278 | + $url = api_get_self(); |
|
| 279 | 279 | $urlparameters = ''; |
| 280 | 280 | foreach ($_GET as $key=>$value) |
| 281 | 281 | { |
| 282 | - $parameter[$key]=$value; |
|
| 282 | + $parameter[$key] = $value; |
|
| 283 | 283 | } |
| 284 | - $parameter['action']='grant'; |
|
| 285 | - $parameter['permission']=$permission; |
|
| 286 | - $parameter['tool']=$tool; |
|
| 284 | + $parameter['action'] = 'grant'; |
|
| 285 | + $parameter['permission'] = $permission; |
|
| 286 | + $parameter['tool'] = $tool; |
|
| 287 | 287 | foreach ($parameter as $key=>$value) |
| 288 | 288 | { |
| 289 | - $urlparameters.=$key.'='.$value.'&'; |
|
| 289 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 290 | 290 | } |
| 291 | - $url=$url.'?'.$urlparameters; |
|
| 291 | + $url = $url.'?'.$urlparameters; |
|
| 292 | 292 | |
| 293 | 293 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
| 294 | 294 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @author Patrick Cool <[email protected]>, Ghent University |
| 316 | 316 | * @version 1.0 |
| 317 | 317 | */ |
| 318 | -function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
| 318 | +function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
| 319 | 319 | { |
| 320 | 320 | |
| 321 | 321 | if ($course_admin) |
@@ -324,32 +324,32 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | else |
| 326 | 326 | { |
| 327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
| 327 | + if (!empty($inherited_permissions) and in_array($permission, $inherited_permissions[$tool])) |
|
| 328 | 328 | { |
| 329 | 329 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
| 330 | 330 | } |
| 331 | 331 | else |
| 332 | 332 | { |
| 333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
| 333 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
| 334 | 334 | { |
| 335 | 335 | if ($editable) |
| 336 | 336 | { |
| 337 | 337 | $url = api_get_self(); |
| 338 | 338 | $urlparameters = ''; |
| 339 | - foreach($_GET as $key => $value) |
|
| 339 | + foreach ($_GET as $key => $value) |
|
| 340 | 340 | { |
| 341 | 341 | $parameter[$key] = $value; |
| 342 | 342 | } |
| 343 | - $parameter['action']='manage_rights'; |
|
| 344 | - $parameter['do']='revoke'; |
|
| 345 | - $parameter['permission']=$permission; |
|
| 346 | - $parameter['tool']=$tool; |
|
| 347 | - $parameter['user_id']=$user_id; |
|
| 343 | + $parameter['action'] = 'manage_rights'; |
|
| 344 | + $parameter['do'] = 'revoke'; |
|
| 345 | + $parameter['permission'] = $permission; |
|
| 346 | + $parameter['tool'] = $tool; |
|
| 347 | + $parameter['user_id'] = $user_id; |
|
| 348 | 348 | foreach ($parameter as $key=>$value) |
| 349 | 349 | { |
| 350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 350 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 351 | 351 | } |
| 352 | - $url = $url . '?' . $urlparameters; |
|
| 352 | + $url = $url.'?'.$urlparameters; |
|
| 353 | 353 | |
| 354 | 354 | echo "\t\t\t <a href=\"".$url."\">"; |
| 355 | 355 | } |
@@ -362,17 +362,17 @@ discard block |
||
| 362 | 362 | $url = api_get_self(); |
| 363 | 363 | $urlparameters = ''; |
| 364 | 364 | foreach ($_GET as $key=>$value) { |
| 365 | - $parameter[$key]=$value; |
|
| 365 | + $parameter[$key] = $value; |
|
| 366 | 366 | } |
| 367 | - $parameter['action']='manage_rights'; |
|
| 368 | - $parameter['do']='grant'; |
|
| 369 | - $parameter['permission']=$permission; |
|
| 370 | - $parameter['tool']=$tool; |
|
| 371 | - $parameter['user_id']=$user_id; |
|
| 367 | + $parameter['action'] = 'manage_rights'; |
|
| 368 | + $parameter['do'] = 'grant'; |
|
| 369 | + $parameter['permission'] = $permission; |
|
| 370 | + $parameter['tool'] = $tool; |
|
| 371 | + $parameter['user_id'] = $user_id; |
|
| 372 | 372 | foreach ($parameter as $key=>$value) { |
| 373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
| 373 | + $urlparameters .= $key.'='.$value.'&'; |
|
| 374 | 374 | } |
| 375 | - $url=$url.'?'.$urlparameters; |
|
| 375 | + $url = $url.'?'.$urlparameters; |
|
| 376 | 376 | |
| 377 | 377 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
| 378 | 378 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -397,30 +397,30 @@ discard block |
||
| 397 | 397 | global $setting_visualisation; |
| 398 | 398 | $course_id = api_get_course_int_id(); |
| 399 | 399 | |
| 400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
| 400 | + $coures_roles_table = Database::get_course_table(TABLE_ROLE); |
|
| 401 | 401 | |
| 402 | 402 | // course roles |
| 403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | - $result=Database::query($sql); |
|
| 405 | - while ($row=Database::fetch_array($result)) |
|
| 403 | + $sql = "SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
| 404 | + $result = Database::query($sql); |
|
| 405 | + while ($row = Database::fetch_array($result)) |
|
| 406 | 406 | { |
| 407 | 407 | if (in_array($row['role_id'], $current_course_roles)) |
| 408 | 408 | { |
| 409 | - $checked='checked'; |
|
| 410 | - $image='checkbox_on2.gif'; |
|
| 411 | - $action='revoke'; |
|
| 409 | + $checked = 'checked'; |
|
| 410 | + $image = 'checkbox_on2.gif'; |
|
| 411 | + $action = 'revoke'; |
|
| 412 | 412 | } |
| 413 | 413 | else |
| 414 | 414 | { |
| 415 | - $checked=''; |
|
| 416 | - $image='wrong.gif'; |
|
| 417 | - $action='grant'; |
|
| 415 | + $checked = ''; |
|
| 416 | + $image = 'wrong.gif'; |
|
| 417 | + $action = 'grant'; |
|
| 418 | 418 | } |
| 419 | - if ($setting_visualisation=='checkbox') |
|
| 419 | + if ($setting_visualisation == 'checkbox') |
|
| 420 | 420 | { |
| 421 | 421 | echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
| 422 | 422 | } |
| 423 | - if ($setting_visualisation=='image') |
|
| 423 | + if ($setting_visualisation == 'image') |
|
| 424 | 424 | { |
| 425 | 425 | echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
| 426 | 426 | } |
@@ -440,24 +440,24 @@ discard block |
||
| 440 | 440 | * @author Patrick Cool <[email protected]>, Ghent University |
| 441 | 441 | * @version 1.0 |
| 442 | 442 | */ |
| 443 | -function get_roles($content,$id, $scope='course') { |
|
| 444 | - $course_id = api_get_course_int_id(); |
|
| 445 | - if ($content=='user') { |
|
| 446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 443 | +function get_roles($content, $id, $scope = 'course') { |
|
| 444 | + $course_id = api_get_course_int_id(); |
|
| 445 | + if ($content == 'user') { |
|
| 446 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 447 | 447 | $id_field = user_id; |
| 448 | 448 | } |
| 449 | - if ($content=='group') { |
|
| 450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 449 | + if ($content == 'group') { |
|
| 450 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 451 | 451 | $id_field = 'group_id'; |
| 452 | 452 | } |
| 453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 453 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 454 | 454 | |
| 455 | - $current_roles=array(); |
|
| 455 | + $current_roles = array(); |
|
| 456 | 456 | //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
| 457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | - $result=Database::query($sql); |
|
| 459 | - while ($row=Database::fetch_array($result)) { |
|
| 460 | - $current_roles[]=$row['role_id']; |
|
| 457 | + $sql = "SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
| 458 | + $result = Database::query($sql); |
|
| 459 | + while ($row = Database::fetch_array($result)) { |
|
| 460 | + $current_roles[] = $row['role_id']; |
|
| 461 | 461 | } |
| 462 | 462 | return $current_roles; |
| 463 | 463 | } |
@@ -468,26 +468,26 @@ discard block |
||
| 468 | 468 | * @author Patrick Cool <[email protected]>, Ghent University |
| 469 | 469 | * @version 1.0 |
| 470 | 470 | */ |
| 471 | -function get_all_roles($content='course') { |
|
| 471 | +function get_all_roles($content = 'course') { |
|
| 472 | 472 | $course_id = api_get_course_int_id(); |
| 473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
| 474 | 474 | |
| 475 | - if ($content=='course') |
|
| 475 | + if ($content == 'course') |
|
| 476 | 476 | { |
| 477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
| 477 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
| 478 | 478 | } |
| 479 | - if ($content=='platform') |
|
| 479 | + if ($content == 'platform') |
|
| 480 | 480 | { |
| 481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
| 481 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
| 482 | 482 | $course_id_condition = ''; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - $current_roles=array(); |
|
| 486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | - $result=Database::query($sql); |
|
| 488 | - while ($row=Database::fetch_array($result)) |
|
| 485 | + $current_roles = array(); |
|
| 486 | + $sql = "SELECT * FROM $table_role $course_id_condition "; |
|
| 487 | + $result = Database::query($sql); |
|
| 488 | + while ($row = Database::fetch_array($result)) |
|
| 489 | 489 | { |
| 490 | - $roles[]=$row; |
|
| 490 | + $roles[] = $row; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | return $roles; |
@@ -504,10 +504,10 @@ discard block |
||
| 504 | 504 | * @author Patrick Cool <[email protected]>, Ghent University |
| 505 | 505 | * @version 1.0 |
| 506 | 506 | */ |
| 507 | -function get_roles_permissions($content,$id, $scope='course') { |
|
| 507 | +function get_roles_permissions($content, $id, $scope = 'course') { |
|
| 508 | 508 | $course_id = api_get_course_int_id(); |
| 509 | 509 | if ($content == 'user') { |
| 510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 510 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 511 | 511 | $id_field = 'user_id'; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -536,21 +536,21 @@ discard block |
||
| 536 | 536 | $sql = " |
| 537 | 537 | SELECT * |
| 538 | 538 | FROM |
| 539 | - " . $table . " role_group_user, |
|
| 540 | - " . $table_role . " role, |
|
| 541 | - " . $table_role_permissions . " role_permissions |
|
| 539 | + " . $table." role_group_user, |
|
| 540 | + " . $table_role." role, |
|
| 541 | + " . $table_role_permissions." role_permissions |
|
| 542 | 542 | WHERE |
| 543 | 543 | role_group_user.c_id = $course_id AND |
| 544 | 544 | $role_condition |
| 545 | - role_group_user.scope = '" . $scope . "' AND |
|
| 546 | - role_group_user." . $id_field . " = '" . $id . "' AND |
|
| 545 | + role_group_user.scope = '".$scope."' AND |
|
| 546 | + role_group_user." . $id_field." = '".$id."' AND |
|
| 547 | 547 | role_group_user.role_id = role.role_id AND |
| 548 | 548 | role.role_id = role_permissions.role_id"; |
| 549 | 549 | |
| 550 | 550 | $result = Database::query($sql); |
| 551 | 551 | $current_role_permissions = array(); |
| 552 | - while ($row=Database::fetch_array($result)) { |
|
| 553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
| 552 | + while ($row = Database::fetch_array($result)) { |
|
| 553 | + $current_role_permissions[$row['tool']][] = $row['action']; |
|
| 554 | 554 | } |
| 555 | 555 | return $current_role_permissions; |
| 556 | 556 | } |
@@ -564,33 +564,33 @@ discard block |
||
| 564 | 564 | * @author Patrick Cool <[email protected]>, Ghent University |
| 565 | 565 | */ |
| 566 | 566 | |
| 567 | -function assign_role($content, $action, $id, $role_id, $scope='course') { |
|
| 567 | +function assign_role($content, $action, $id, $role_id, $scope = 'course') { |
|
| 568 | 568 | $course_id = api_get_course_int_id(); |
| 569 | 569 | // Which database are we using (depending on the $content parameter) |
| 570 | - if ($content=='user') { |
|
| 571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
| 570 | + if ($content == 'user') { |
|
| 571 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
| 572 | 572 | $id_field = 'user_id'; |
| 573 | - } elseif($content=='group') { |
|
| 574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 573 | + } elseif ($content == 'group') { |
|
| 574 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
| 575 | 575 | $id_field = 'group_id'; |
| 576 | 576 | } else { |
| 577 | 577 | return get_lang('Error'); |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | // grating a right |
| 581 | - if ($action=='grant') { |
|
| 582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | - $result=Database::query($sql); |
|
| 581 | + if ($action == 'grant') { |
|
| 582 | + $sql = "INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
| 583 | + $result = Database::query($sql); |
|
| 584 | 584 | if ($result) { |
| 585 | - $result_message=get_lang('RoleGranted'); |
|
| 585 | + $result_message = get_lang('RoleGranted'); |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if ($action=='revoke') { |
|
| 590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | - $result=Database::query($sql); |
|
| 589 | + if ($action == 'revoke') { |
|
| 590 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
| 591 | + $result = Database::query($sql); |
|
| 592 | 592 | if ($result) { |
| 593 | - $result_message=get_lang('RoleRevoked'); |
|
| 593 | + $result_message = get_lang('RoleRevoked'); |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | return $result_message; |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | { |
| 608 | 608 | foreach ($permissions as $permissionkey=>$permissionvalue) |
| 609 | 609 | { |
| 610 | - $array1[$tool][]=$permissionvalue; |
|
| 610 | + $array1[$tool][] = $permissionvalue; |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | return $array1; |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | function unset_session_resources() { |
| 27 | - $_SESSION['addedresource']=''; |
|
| 28 | - $_SESSION['addedresourceid']=''; |
|
| 29 | - Session::erase('addedresource'); |
|
| 30 | - Session::erase('addedresourceid'); |
|
| 27 | + $_SESSION['addedresource']=''; |
|
| 28 | + $_SESSION['addedresourceid']=''; |
|
| 29 | + Session::erase('addedresource'); |
|
| 30 | + Session::erase('addedresourceid'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,24 +35,24 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function show_folder_up() |
| 37 | 37 | { |
| 38 | - global $folder; |
|
| 39 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 40 | - |
|
| 41 | - $level = get_levels($folder); |
|
| 42 | - |
|
| 43 | - if ($level == 1) |
|
| 44 | - { |
|
| 45 | - echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
| 46 | - } |
|
| 47 | - if ($level and $level != 0 and $level != 1) |
|
| 48 | - { |
|
| 49 | - $folder_up=$folder; |
|
| 50 | - $folder_temp=explode('/',$folder); |
|
| 51 | - $last=count($folder_temp)-1; |
|
| 52 | - unset($folder_temp[$last]); |
|
| 53 | - $folder_up=implode('/',$folder_temp); |
|
| 54 | - echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&folder=$folder_up&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
| 55 | - } |
|
| 38 | + global $folder; |
|
| 39 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 40 | + |
|
| 41 | + $level = get_levels($folder); |
|
| 42 | + |
|
| 43 | + if ($level == 1) |
|
| 44 | + { |
|
| 45 | + echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
| 46 | + } |
|
| 47 | + if ($level and $level != 0 and $level != 1) |
|
| 48 | + { |
|
| 49 | + $folder_up=$folder; |
|
| 50 | + $folder_temp=explode('/',$folder); |
|
| 51 | + $last=count($folder_temp)-1; |
|
| 52 | + unset($folder_temp[$last]); |
|
| 53 | + $folder_up=implode('/',$folder_temp); |
|
| 54 | + echo "<a href='".api_get_self()."?content=Document&source_forum=".$_GET['source_forum']."&folder=$folder_up&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>"; |
|
| 55 | + } |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -61,23 +61,23 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | function show_documents($folder) |
| 63 | 63 | { |
| 64 | - global $_course; |
|
| 65 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 66 | - |
|
| 67 | - // documents are a special case: the teacher can add an invisible document (it will be viewable by the user) |
|
| 68 | - // other tools do not have this feature. This only counts |
|
| 69 | - if (api_is_allowed_to_edit()) |
|
| 70 | - { |
|
| 71 | - $visibility="ip.visibility<>'2'"; |
|
| 72 | - } |
|
| 73 | - else |
|
| 74 | - { |
|
| 75 | - $visibility="ip.visibility='1'"; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
| 79 | - $document_table = Database::get_course_table(TABLE_DOCUMENT); |
|
| 80 | - $sql = "SELECT * from $document_table docs, $item_property_table ip |
|
| 64 | + global $_course; |
|
| 65 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 66 | + |
|
| 67 | + // documents are a special case: the teacher can add an invisible document (it will be viewable by the user) |
|
| 68 | + // other tools do not have this feature. This only counts |
|
| 69 | + if (api_is_allowed_to_edit()) |
|
| 70 | + { |
|
| 71 | + $visibility="ip.visibility<>'2'"; |
|
| 72 | + } |
|
| 73 | + else |
|
| 74 | + { |
|
| 75 | + $visibility="ip.visibility='1'"; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
| 79 | + $document_table = Database::get_course_table(TABLE_DOCUMENT); |
|
| 80 | + $sql = "SELECT * from $document_table docs, $item_property_table ip |
|
| 81 | 81 | WHERE |
| 82 | 82 | docs.id=ip.ref AND |
| 83 | 83 | ip.tool = '".TOOL_DOCUMENT."' AND |
@@ -85,104 +85,104 @@ discard block |
||
| 85 | 85 | (ip.to_group_id = 0 OR i.to_group_id IS NULL) AND |
| 86 | 86 | ip.to_user_id IS NULL |
| 87 | 87 | ORDER BY docs.path ASC"; |
| 88 | - $result=Database::query($sql); |
|
| 89 | - while ($row=Database::fetch_array($result)) |
|
| 90 | - { |
|
| 91 | - if (!$folder) |
|
| 92 | - { |
|
| 93 | - if (get_levels($row['path'])-1==1) |
|
| 94 | - { |
|
| 95 | - // showing the right icon |
|
| 96 | - if (file_or_folder($row['path'])) |
|
| 97 | - { |
|
| 98 | - echo '<img src="../img/file.gif" align="middle" />'; |
|
| 99 | - } |
|
| 100 | - else |
|
| 101 | - { |
|
| 102 | - $image = choose_image($row['path']); |
|
| 103 | - echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // folders should be clickable |
|
| 107 | - if (file_or_folder($row['path'])) |
|
| 108 | - { |
|
| 109 | - echo "<a href='".api_get_self()."?content=Document"; |
|
| 110 | - echo "&folder=".substr($row['path'],1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".substr($row['path'],1).'</a><br />'; |
|
| 111 | - } |
|
| 112 | - else |
|
| 113 | - { |
|
| 114 | - echo substr($row['path'],1).' '; |
|
| 115 | - echo showorhide_addresourcelink('Document',$row['id']); |
|
| 116 | - echo '<br />'; |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - } |
|
| 120 | - else |
|
| 121 | - { |
|
| 122 | - // we calculate the level we are in by using the $folder in the url |
|
| 123 | - // we put +1 because it does not start with an / and in the database it does |
|
| 124 | - $level=get_levels($folder)+1; |
|
| 125 | - |
|
| 126 | - // we calculate each level of the database entry |
|
| 127 | - $file_level=get_levels($row['path'])-1; |
|
| 128 | - // if the level of the database entry is equal to the level we ar in, we put it into an array |
|
| 129 | - // as this is a potential good entry |
|
| 130 | - if ($file_level==$level) |
|
| 131 | - { |
|
| 132 | - $good_paths[]=$row['path']; |
|
| 133 | - $good_ids[]=$row['id']; |
|
| 134 | - } |
|
| 135 | - //$haystack=$row['path']; |
|
| 136 | - //$conform_folder=strstr($haystack, $folder); |
|
| 137 | - //if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
| 138 | - // { |
|
| 139 | - // $good_folders[]=$row['path']; |
|
| 140 | - //echo str_replace($folder.'/','',$conform_folder); |
|
| 141 | - // echo '<br />'; |
|
| 142 | - // }// if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
| 143 | - } // else (if (!$folder)) |
|
| 144 | - } //while ($row=Database::fetch_array($result)) |
|
| 145 | - |
|
| 146 | - // this is code for the case that we are in a subfolder |
|
| 147 | - if ($good_paths) |
|
| 148 | - { |
|
| 149 | - // we have all the potential good database entries, the good ones are those that start with $folder |
|
| 150 | - foreach ($good_paths as $path) |
|
| 151 | - { |
|
| 152 | - if (strstr($path,$folder)) |
|
| 153 | - { |
|
| 154 | - $good_key=key($good_paths); |
|
| 155 | - // showing the right icon |
|
| 156 | - if (file_or_folder($path)) |
|
| 157 | - { |
|
| 158 | - echo '<img src="../img/file.gif" align="middle" />'; |
|
| 159 | - } |
|
| 160 | - else |
|
| 161 | - { |
|
| 162 | - $image = choose_image($path); |
|
| 163 | - echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - // folders should be clickable |
|
| 167 | - if (file_or_folder($path)) |
|
| 168 | - { |
|
| 169 | - $path=substr($path,1); // remove the first / in folder_up |
|
| 170 | - $uri=str_replace($folder,$path,$_SERVER['REQUEST_URI']); |
|
| 171 | - $newuri=str_replace('add=','addnot=',$uri); |
|
| 172 | - //using the correct name of the folder |
|
| 173 | - $folder_name=str_replace($folder.'/','',$path); |
|
| 174 | - echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
|
| 175 | - } |
|
| 176 | - else |
|
| 177 | - { |
|
| 178 | - echo str_replace("/$folder/", '',$path).' '; |
|
| 179 | - echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
|
| 180 | - echo '<br />'; |
|
| 181 | - } |
|
| 182 | - } |
|
| 183 | - next($good_paths); |
|
| 184 | - } |
|
| 185 | - } |
|
| 88 | + $result=Database::query($sql); |
|
| 89 | + while ($row=Database::fetch_array($result)) |
|
| 90 | + { |
|
| 91 | + if (!$folder) |
|
| 92 | + { |
|
| 93 | + if (get_levels($row['path'])-1==1) |
|
| 94 | + { |
|
| 95 | + // showing the right icon |
|
| 96 | + if (file_or_folder($row['path'])) |
|
| 97 | + { |
|
| 98 | + echo '<img src="../img/file.gif" align="middle" />'; |
|
| 99 | + } |
|
| 100 | + else |
|
| 101 | + { |
|
| 102 | + $image = choose_image($row['path']); |
|
| 103 | + echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // folders should be clickable |
|
| 107 | + if (file_or_folder($row['path'])) |
|
| 108 | + { |
|
| 109 | + echo "<a href='".api_get_self()."?content=Document"; |
|
| 110 | + echo "&folder=".substr($row['path'],1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".substr($row['path'],1).'</a><br />'; |
|
| 111 | + } |
|
| 112 | + else |
|
| 113 | + { |
|
| 114 | + echo substr($row['path'],1).' '; |
|
| 115 | + echo showorhide_addresourcelink('Document',$row['id']); |
|
| 116 | + echo '<br />'; |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | + else |
|
| 121 | + { |
|
| 122 | + // we calculate the level we are in by using the $folder in the url |
|
| 123 | + // we put +1 because it does not start with an / and in the database it does |
|
| 124 | + $level=get_levels($folder)+1; |
|
| 125 | + |
|
| 126 | + // we calculate each level of the database entry |
|
| 127 | + $file_level=get_levels($row['path'])-1; |
|
| 128 | + // if the level of the database entry is equal to the level we ar in, we put it into an array |
|
| 129 | + // as this is a potential good entry |
|
| 130 | + if ($file_level==$level) |
|
| 131 | + { |
|
| 132 | + $good_paths[]=$row['path']; |
|
| 133 | + $good_ids[]=$row['id']; |
|
| 134 | + } |
|
| 135 | + //$haystack=$row['path']; |
|
| 136 | + //$conform_folder=strstr($haystack, $folder); |
|
| 137 | + //if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
| 138 | + // { |
|
| 139 | + // $good_folders[]=$row['path']; |
|
| 140 | + //echo str_replace($folder.'/','',$conform_folder); |
|
| 141 | + // echo '<br />'; |
|
| 142 | + // }// if (str_replace($folder.'/','',$conform_folder)!==$folder) |
|
| 143 | + } // else (if (!$folder)) |
|
| 144 | + } //while ($row=Database::fetch_array($result)) |
|
| 145 | + |
|
| 146 | + // this is code for the case that we are in a subfolder |
|
| 147 | + if ($good_paths) |
|
| 148 | + { |
|
| 149 | + // we have all the potential good database entries, the good ones are those that start with $folder |
|
| 150 | + foreach ($good_paths as $path) |
|
| 151 | + { |
|
| 152 | + if (strstr($path,$folder)) |
|
| 153 | + { |
|
| 154 | + $good_key=key($good_paths); |
|
| 155 | + // showing the right icon |
|
| 156 | + if (file_or_folder($path)) |
|
| 157 | + { |
|
| 158 | + echo '<img src="../img/file.gif" align="middle" />'; |
|
| 159 | + } |
|
| 160 | + else |
|
| 161 | + { |
|
| 162 | + $image = choose_image($path); |
|
| 163 | + echo "<img src=\"../img/$image\" align=\"middle\" />"; |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + // folders should be clickable |
|
| 167 | + if (file_or_folder($path)) |
|
| 168 | + { |
|
| 169 | + $path=substr($path,1); // remove the first / in folder_up |
|
| 170 | + $uri=str_replace($folder,$path,$_SERVER['REQUEST_URI']); |
|
| 171 | + $newuri=str_replace('add=','addnot=',$uri); |
|
| 172 | + //using the correct name of the folder |
|
| 173 | + $folder_name=str_replace($folder.'/','',$path); |
|
| 174 | + echo "<a href='$newuri'>".$folder_name.'</a><br />'; |
|
| 175 | + } |
|
| 176 | + else |
|
| 177 | + { |
|
| 178 | + echo str_replace("/$folder/", '',$path).' '; |
|
| 179 | + echo showorhide_addresourcelink('Document',$good_ids[$good_key]); |
|
| 180 | + echo '<br />'; |
|
| 181 | + } |
|
| 182 | + } |
|
| 183 | + next($good_paths); |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | function file_or_folder($filefolder) |
| 195 | 195 | { |
| 196 | - global $_course; |
|
| 197 | - global $baseServDir; |
|
| 196 | + global $_course; |
|
| 197 | + global $baseServDir; |
|
| 198 | 198 | |
| 199 | - $courseDir = $_course['path'].'/document'; |
|
| 200 | - $baseWorkDir = api_get_path(SYS_COURSE_PATH).$courseDir; |
|
| 199 | + $courseDir = $_course['path'].'/document'; |
|
| 200 | + $baseWorkDir = api_get_path(SYS_COURSE_PATH).$courseDir; |
|
| 201 | 201 | |
| 202 | - return (is_dir($baseWorkDir.$filefolder) ? 1 : 0); |
|
| 202 | + return (is_dir($baseWorkDir.$filefolder) ? 1 : 0); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,23 +210,23 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | function store_resources($source_type, $source_id) |
| 212 | 212 | { |
| 213 | - global $_course; |
|
| 214 | - $resource_table = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 215 | - |
|
| 216 | - $addedresource = $_SESSION['addedresource']; |
|
| 217 | - $addedresourceid = $_SESSION['addedresourceid']; |
|
| 218 | - if ($_SESSION['addedresource']) |
|
| 219 | - { |
|
| 220 | - foreach ($addedresource as $resource_type) |
|
| 221 | - { |
|
| 222 | - $sql="INSERT INTO $resource_table (source_type, source_id, resource_type, resource_id) VALUES ('$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; |
|
| 223 | - Database::query($sql); |
|
| 224 | - $i=key($addedresource); |
|
| 225 | - next($addedresource); |
|
| 226 | - } |
|
| 227 | - $_SESSION['addedresource']=''; |
|
| 228 | - $_SESSION['addedresourceid']=''; |
|
| 229 | - } |
|
| 213 | + global $_course; |
|
| 214 | + $resource_table = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 215 | + |
|
| 216 | + $addedresource = $_SESSION['addedresource']; |
|
| 217 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
| 218 | + if ($_SESSION['addedresource']) |
|
| 219 | + { |
|
| 220 | + foreach ($addedresource as $resource_type) |
|
| 221 | + { |
|
| 222 | + $sql="INSERT INTO $resource_table (source_type, source_id, resource_type, resource_id) VALUES ('$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')"; |
|
| 223 | + Database::query($sql); |
|
| 224 | + $i=key($addedresource); |
|
| 225 | + next($addedresource); |
|
| 226 | + } |
|
| 227 | + $_SESSION['addedresource']=''; |
|
| 228 | + $_SESSION['addedresourceid']=''; |
|
| 229 | + } |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -240,87 +240,87 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function display_addedresource_link($type, $id, $style='') |
| 242 | 242 | { |
| 243 | - global $_course; |
|
| 243 | + global $_course; |
|
| 244 | 244 | |
| 245 | - // styling the link of the added resource |
|
| 246 | - if ($style <> '') |
|
| 247 | - { |
|
| 248 | - $styling = ' class="'.$style.'"'; |
|
| 249 | - } |
|
| 245 | + // styling the link of the added resource |
|
| 246 | + if ($style <> '') |
|
| 247 | + { |
|
| 248 | + $styling = ' class="'.$style.'"'; |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | $course_id = api_get_course_int_id(); |
| 252 | 252 | |
| 253 | - switch ($type) |
|
| 254 | - { |
|
| 255 | - case 'Agenda': |
|
| 256 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 257 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); |
|
| 258 | - $myrow = Database::fetch_array($result); |
|
| 259 | - echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 260 | - break; |
|
| 261 | - case 'Ad_Valvas': |
|
| 262 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 263 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); |
|
| 264 | - $myrow = Database::fetch_array($result); |
|
| 265 | - echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 266 | - break; |
|
| 267 | - case 'Link':Database::get_course_table(TABLE_LINK); |
|
| 268 | - $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
|
| 269 | - $myrow = Database::fetch_array($result); |
|
| 270 | - echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 271 | - break; |
|
| 272 | - case 'Exercise': |
|
| 273 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 274 | - $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
|
| 275 | - $myrow = Database::fetch_array($result); |
|
| 276 | - echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 277 | - break; |
|
| 278 | - case 'Forum': |
|
| 279 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 280 | - $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); |
|
| 281 | - $myrow = Database::fetch_array($result); |
|
| 282 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n"; |
|
| 283 | - break; |
|
| 284 | - case 'Thread': //=topics |
|
| 253 | + switch ($type) |
|
| 254 | + { |
|
| 255 | + case 'Agenda': |
|
| 256 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 257 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id"); |
|
| 258 | + $myrow = Database::fetch_array($result); |
|
| 259 | + echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 260 | + break; |
|
| 261 | + case 'Ad_Valvas': |
|
| 262 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 263 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE c_id = $course_id AND id=$id"); |
|
| 264 | + $myrow = Database::fetch_array($result); |
|
| 265 | + echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 266 | + break; |
|
| 267 | + case 'Link':Database::get_course_table(TABLE_LINK); |
|
| 268 | + $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id"); |
|
| 269 | + $myrow = Database::fetch_array($result); |
|
| 270 | + echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 271 | + break; |
|
| 272 | + case 'Exercise': |
|
| 273 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 274 | + $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id"); |
|
| 275 | + $myrow = Database::fetch_array($result); |
|
| 276 | + echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercise_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n"; |
|
| 277 | + break; |
|
| 278 | + case 'Forum': |
|
| 279 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 280 | + $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id"); |
|
| 281 | + $myrow = Database::fetch_array($result); |
|
| 282 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n"; |
|
| 283 | + break; |
|
| 284 | + case 'Thread': //=topics |
|
| 285 | 285 | //deprecated |
| 286 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 287 | - $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
| 288 | - $TBL_FORUMS = $_course['dbNameGlu'].'bb_forums'; |
|
| 289 | - $result = Database::query("SELECT * FROM $tbl_posts posts, $TBL_FORUMS forum WHERE forum.forum_id=posts.forum_id and post_id=$id"); |
|
| 290 | - $myrow = Database::fetch_array($result); |
|
| 291 | - // grabbing the title of the post |
|
| 292 | - $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
| 293 | - $result_title = Database::query($sql_title); |
|
| 294 | - $myrow_title = Database::fetch_array($result_title); |
|
| 295 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n"; |
|
| 296 | - break; |
|
| 297 | - case 'Post': |
|
| 286 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 287 | + $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
| 288 | + $TBL_FORUMS = $_course['dbNameGlu'].'bb_forums'; |
|
| 289 | + $result = Database::query("SELECT * FROM $tbl_posts posts, $TBL_FORUMS forum WHERE forum.forum_id=posts.forum_id and post_id=$id"); |
|
| 290 | + $myrow = Database::fetch_array($result); |
|
| 291 | + // grabbing the title of the post |
|
| 292 | + $sql_title = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
| 293 | + $result_title = Database::query($sql_title); |
|
| 294 | + $myrow_title = Database::fetch_array($result_title); |
|
| 295 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&forum='.$myrow['forum_id'].'&md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n"; |
|
| 296 | + break; |
|
| 297 | + case 'Post': |
|
| 298 | 298 | //deprecated |
| 299 | - $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
| 300 | - $tbl_post_text = Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE); |
|
| 301 | - $sql = "SELECT * FROM $tbl_post p, $tbl_post_text t WHERE p.post_id = t.post_id AND p.post_id = $id"; |
|
| 302 | - $result = Database::query($sql); |
|
| 303 | - $post = Database::fetch_object($result); |
|
| 304 | - echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />\n"; |
|
| 305 | - break; |
|
| 306 | - case 'Document': |
|
| 307 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 308 | - $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
|
| 309 | - $myrow = Database::fetch_array($result); |
|
| 310 | - $pathname = explode('/',$myrow['path']); // making a correct name for the link |
|
| 311 | - $last = count($pathname) - 1; // making a correct name for the link |
|
| 312 | - $filename = $pathname[$last]; // making a correct name for the link |
|
| 313 | - $image = choose_image($filename); |
|
| 314 | - $ext = explode('.',$filename); |
|
| 315 | - $ext = strtolower($ext[sizeof($ext)-1]); |
|
| 316 | - $myrow['path'] = rawurlencode($myrow['path']); |
|
| 317 | - $in_frames = in_array($ext, array('htm','html','gif','jpg','jpeg','png')); |
|
| 318 | - echo '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />\n"; |
|
| 319 | - break; |
|
| 320 | - case 'Externallink': |
|
| 321 | - echo '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n"; |
|
| 322 | - break; |
|
| 323 | - } |
|
| 299 | + $tbl_post = Database::get_course_table(TABLE_FORUM_POST); |
|
| 300 | + $tbl_post_text = Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE); |
|
| 301 | + $sql = "SELECT * FROM $tbl_post p, $tbl_post_text t WHERE p.post_id = t.post_id AND p.post_id = $id"; |
|
| 302 | + $result = Database::query($sql); |
|
| 303 | + $post = Database::fetch_object($result); |
|
| 304 | + echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$post->topic_id.'&forum='.$post->forum_id.'"'.$styling.'>'.$post->post_title."</a><br />\n"; |
|
| 305 | + break; |
|
| 306 | + case 'Document': |
|
| 307 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 308 | + $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id"); |
|
| 309 | + $myrow = Database::fetch_array($result); |
|
| 310 | + $pathname = explode('/',$myrow['path']); // making a correct name for the link |
|
| 311 | + $last = count($pathname) - 1; // making a correct name for the link |
|
| 312 | + $filename = $pathname[$last]; // making a correct name for the link |
|
| 313 | + $image = choose_image($filename); |
|
| 314 | + $ext = explode('.',$filename); |
|
| 315 | + $ext = strtolower($ext[sizeof($ext)-1]); |
|
| 316 | + $myrow['path'] = rawurlencode($myrow['path']); |
|
| 317 | + $in_frames = in_array($ext, array('htm','html','gif','jpg','jpeg','png')); |
|
| 318 | + echo '<img src="../img/'.$image.'" align="middle" /> <a href="../document/'.($in_frames ? 'showinframes.php?file=' : 'download.php?doc_url=').$myrow['path'].'"'.$styling.'>'.$filename."</a><br />\n"; |
|
| 319 | + break; |
|
| 320 | + case 'Externallink': |
|
| 321 | + echo '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.'>'.$id."</a><br />\n"; |
|
| 322 | + break; |
|
| 323 | + } |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -342,766 +342,766 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) |
| 344 | 344 | { |
| 345 | - global $learnpath_id, $tbl_learnpath_item, $items; |
|
| 346 | - global $_course, $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; |
|
| 347 | - |
|
| 348 | - $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' |
|
| 349 | - |
|
| 350 | - $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
|
| 351 | - |
|
| 352 | - if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 353 | - $linktype = $type; |
|
| 354 | - if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
| 355 | - |
|
| 356 | - switch ($type) |
|
| 357 | - { |
|
| 358 | - case "Agenda": |
|
| 359 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 360 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
| 361 | - $myrow=Database::fetch_array($result); |
|
| 362 | - |
|
| 363 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 364 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 365 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 366 | - $desc=$row['description']; |
|
| 367 | - $agenda_id=$row['item_id']; |
|
| 368 | - echo str_repeat(" >",$level); |
|
| 369 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 370 | - if ($icon != 'nolink') |
|
| 371 | - { |
|
| 372 | - if ($completed=='completed') { |
|
| 373 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 374 | - } else { |
|
| 375 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 376 | - //echo " "; |
|
| 377 | - } |
|
| 378 | - } |
|
| 379 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 380 | - |
|
| 381 | - if ($myrow["title"]=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 382 | - |
|
| 383 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 384 | - if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
|
| 385 | - if ($builder != 'builder') |
|
| 386 | - { |
|
| 387 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 388 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
| 389 | - if ($desc != '') |
|
| 390 | - { |
|
| 391 | - if ($icon != 'wrap') |
|
| 392 | - { |
|
| 393 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 394 | - } |
|
| 395 | - else |
|
| 396 | - { |
|
| 397 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 398 | - } |
|
| 399 | - } |
|
| 400 | - } |
|
| 401 | - else |
|
| 402 | - { |
|
| 403 | - echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 404 | - } |
|
| 405 | - break; |
|
| 406 | - |
|
| 407 | - case "Ad_Valvas": |
|
| 408 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 409 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
| 410 | - $myrow=Database::fetch_array($result); |
|
| 411 | - |
|
| 412 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 413 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 414 | - if ($row['title'] != '') { $myrow["content"]=$row['title']; } |
|
| 415 | - $desc=$row['description']; |
|
| 416 | - $ann_id=$row['item_id']; |
|
| 417 | - echo str_repeat(" >",$level); |
|
| 418 | - |
|
| 419 | - // the title and the text are in the content field and we only want to display the title |
|
| 420 | - list($title, $text)=split('<br>',$myrow['content']); |
|
| 421 | - if ($title=='') { $title=$myrow['content']; } |
|
| 422 | - $title=$myrow['title']; |
|
| 423 | - $text=$myrow['content']; |
|
| 424 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 425 | - if ($icon != 'nolink') |
|
| 426 | - { |
|
| 427 | - if ($completed=='completed') { |
|
| 428 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 429 | - } else { |
|
| 430 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 431 | - //echo " "; |
|
| 432 | - } |
|
| 433 | - } |
|
| 434 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 435 | - |
|
| 436 | - if ($title=='') { |
|
| 437 | - $type="Announcement"; |
|
| 438 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 439 | - return(true); |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
| 443 | - if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
|
| 444 | - if ($builder != 'builder') |
|
| 445 | - { |
|
| 446 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title,($length-3*$level))."</a>"; |
|
| 447 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; |
|
| 448 | - if ($desc != '') |
|
| 449 | - { |
|
| 450 | - if ($icon != 'wrap') |
|
| 451 | - { |
|
| 452 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 453 | - } |
|
| 454 | - else |
|
| 455 | - { |
|
| 456 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - } |
|
| 460 | - else |
|
| 461 | - { |
|
| 462 | - echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
|
| 463 | - } |
|
| 464 | - break; |
|
| 465 | - |
|
| 466 | - case "Link" : |
|
| 467 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 468 | - $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
| 469 | - $myrow=Database::fetch_array($result); |
|
| 470 | - |
|
| 471 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 472 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 473 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 474 | - $desc=$row['description']; |
|
| 475 | - echo str_repeat(" >",$level); |
|
| 476 | - |
|
| 477 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 478 | - if ($icon != 'nolink') |
|
| 479 | - { |
|
| 480 | - if ($completed=='completed') { |
|
| 481 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 482 | - } else { |
|
| 483 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 484 | - //echo " "; |
|
| 485 | - } |
|
| 486 | - } |
|
| 487 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 488 | - |
|
| 489 | - if ($myrow["title"]=='') |
|
| 490 | - { |
|
| 491 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 492 | - return(true); |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 496 | - if ($icon == 'icon') |
|
| 497 | - { |
|
| 498 | - if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
| 499 | - else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 500 | - } |
|
| 501 | - $thelink=$myrow["url"]; |
|
| 502 | - if ($builder != 'builder') |
|
| 503 | - { |
|
| 504 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 505 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
| 506 | - if ($desc != '') |
|
| 507 | - { |
|
| 508 | - if ($icon != 'wrap') |
|
| 509 | - { |
|
| 510 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 511 | - } |
|
| 512 | - else |
|
| 513 | - { |
|
| 514 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 515 | - } |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - else |
|
| 519 | - { |
|
| 520 | - echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 521 | - } |
|
| 522 | - break; |
|
| 523 | - |
|
| 524 | - case "Exercise": |
|
| 525 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 526 | - $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
| 527 | - $myrow=Database::fetch_array($result); |
|
| 528 | - |
|
| 529 | - if ($builder=='builder') { $origin='builder'; } |
|
| 530 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 531 | - |
|
| 532 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 533 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 534 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 535 | - $desc=$row['description']; |
|
| 536 | - echo str_repeat(" >",$level); |
|
| 537 | - |
|
| 538 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 539 | - if ($icon != 'nolink') |
|
| 540 | - { |
|
| 541 | - if ($completed=='completed') { |
|
| 542 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 543 | - } else { |
|
| 544 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 545 | - //echo " "; |
|
| 546 | - } |
|
| 547 | - } |
|
| 548 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 549 | - |
|
| 550 | - if ($myrow["title"]=='') { |
|
| 551 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 552 | - return(true); |
|
| 553 | - } |
|
| 554 | - |
|
| 555 | - if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 556 | - if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
|
| 557 | - if ($builder != 'builder') |
|
| 558 | - { |
|
| 559 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 560 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
| 561 | - if ($desc != '') |
|
| 562 | - { |
|
| 563 | - if ($icon != 'wrap') |
|
| 564 | - { |
|
| 565 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 566 | - } |
|
| 567 | - else |
|
| 568 | - { |
|
| 569 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 570 | - } |
|
| 571 | - } |
|
| 572 | - } |
|
| 573 | - else |
|
| 574 | - { |
|
| 575 | - echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]."\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 576 | - } |
|
| 577 | - break; |
|
| 578 | - |
|
| 579 | - case "HotPotatoes": |
|
| 580 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 581 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 582 | - $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
| 583 | - $myrow= Database::fetch_array($result); |
|
| 584 | - $path=$myrow["path"]; |
|
| 585 | - $name=GetQuizName($path,$documentPath); |
|
| 586 | - |
|
| 587 | - if ($builder=='builder') { $origin='builder'; } |
|
| 588 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 589 | - |
|
| 590 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 591 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 592 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 593 | - $desc=$row['description']; |
|
| 594 | - echo str_repeat(" >",$level); |
|
| 595 | - |
|
| 596 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 597 | - if ($icon != 'nolink') |
|
| 598 | - { |
|
| 599 | - if ($completed=='completed') { |
|
| 600 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 601 | - } else { |
|
| 602 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 603 | - //echo " "; |
|
| 604 | - } |
|
| 605 | - } |
|
| 606 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 607 | - |
|
| 608 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 609 | - |
|
| 610 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 611 | - if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } |
|
| 612 | - |
|
| 613 | - $cid = $_course['official_code']; |
|
| 614 | - |
|
| 615 | - if ($builder != 'builder') |
|
| 616 | - { |
|
| 617 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
| 618 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
| 619 | - if ($desc != '') |
|
| 620 | - { |
|
| 621 | - if ($icon != 'wrap') |
|
| 622 | - { |
|
| 623 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 624 | - } |
|
| 625 | - else |
|
| 626 | - { |
|
| 627 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 628 | - } |
|
| 629 | - } |
|
| 630 | - } |
|
| 631 | - else |
|
| 632 | - { |
|
| 633 | - echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 634 | - } |
|
| 635 | - break; |
|
| 636 | - |
|
| 637 | - case "Forum": |
|
| 638 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 639 | - $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 640 | - $myrow=Database::fetch_array($result); |
|
| 641 | - |
|
| 642 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 643 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 644 | - if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
| 645 | - $desc=$row['description']; |
|
| 646 | - echo str_repeat(" >",$level); |
|
| 647 | - |
|
| 648 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 649 | - if ($icon != 'nolink') |
|
| 650 | - { |
|
| 651 | - if ($completed=='completed') { |
|
| 652 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 653 | - } else { |
|
| 654 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 655 | - //echo " "; |
|
| 656 | - } |
|
| 657 | - } |
|
| 658 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 659 | - |
|
| 660 | - if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 661 | - |
|
| 662 | - if ($icon == 'nolink') { return(shorten($myrow["forum_name"],$length)); } |
|
| 663 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 664 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 665 | - if ($builder != 'builder') |
|
| 666 | - { |
|
| 667 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 668 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
| 669 | - if ($desc != '') |
|
| 670 | - { |
|
| 671 | - if ($icon != 'wrap') |
|
| 672 | - { |
|
| 673 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 674 | - } |
|
| 675 | - else |
|
| 676 | - { |
|
| 677 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - } |
|
| 681 | - else |
|
| 682 | - { |
|
| 683 | - echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 684 | - } |
|
| 685 | - break; |
|
| 686 | - |
|
| 687 | - case "Thread": //forum post |
|
| 345 | + global $learnpath_id, $tbl_learnpath_item, $items; |
|
| 346 | + global $_course, $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; |
|
| 347 | + |
|
| 348 | + $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' |
|
| 349 | + |
|
| 350 | + $length = ((($builder == 'builder') and ($icon == 'nolink')) ? 65 : 32); |
|
| 351 | + |
|
| 352 | + if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view |
|
| 353 | + $linktype = $type; |
|
| 354 | + if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link'; |
|
| 355 | + |
|
| 356 | + switch ($type) |
|
| 357 | + { |
|
| 358 | + case "Agenda": |
|
| 359 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); |
|
| 360 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
| 361 | + $myrow=Database::fetch_array($result); |
|
| 362 | + |
|
| 363 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 364 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 365 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 366 | + $desc=$row['description']; |
|
| 367 | + $agenda_id=$row['item_id']; |
|
| 368 | + echo str_repeat(" >",$level); |
|
| 369 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 370 | + if ($icon != 'nolink') |
|
| 371 | + { |
|
| 372 | + if ($completed=='completed') { |
|
| 373 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 374 | + } else { |
|
| 375 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 376 | + //echo " "; |
|
| 377 | + } |
|
| 378 | + } |
|
| 379 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 380 | + |
|
| 381 | + if ($myrow["title"]=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 382 | + |
|
| 383 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 384 | + if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } |
|
| 385 | + if ($builder != 'builder') |
|
| 386 | + { |
|
| 387 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 388 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
| 389 | + if ($desc != '') |
|
| 390 | + { |
|
| 391 | + if ($icon != 'wrap') |
|
| 392 | + { |
|
| 393 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 394 | + } |
|
| 395 | + else |
|
| 396 | + { |
|
| 397 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 398 | + } |
|
| 399 | + } |
|
| 400 | + } |
|
| 401 | + else |
|
| 402 | + { |
|
| 403 | + echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 404 | + } |
|
| 405 | + break; |
|
| 406 | + |
|
| 407 | + case "Ad_Valvas": |
|
| 408 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 409 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
| 410 | + $myrow=Database::fetch_array($result); |
|
| 411 | + |
|
| 412 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 413 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 414 | + if ($row['title'] != '') { $myrow["content"]=$row['title']; } |
|
| 415 | + $desc=$row['description']; |
|
| 416 | + $ann_id=$row['item_id']; |
|
| 417 | + echo str_repeat(" >",$level); |
|
| 418 | + |
|
| 419 | + // the title and the text are in the content field and we only want to display the title |
|
| 420 | + list($title, $text)=split('<br>',$myrow['content']); |
|
| 421 | + if ($title=='') { $title=$myrow['content']; } |
|
| 422 | + $title=$myrow['title']; |
|
| 423 | + $text=$myrow['content']; |
|
| 424 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 425 | + if ($icon != 'nolink') |
|
| 426 | + { |
|
| 427 | + if ($completed=='completed') { |
|
| 428 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 429 | + } else { |
|
| 430 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 431 | + //echo " "; |
|
| 432 | + } |
|
| 433 | + } |
|
| 434 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 435 | + |
|
| 436 | + if ($title=='') { |
|
| 437 | + $type="Announcement"; |
|
| 438 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 439 | + return(true); |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + if ($icon == 'nolink') { return(shorten($title,$length)); } |
|
| 443 | + if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } |
|
| 444 | + if ($builder != 'builder') |
|
| 445 | + { |
|
| 446 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title,($length-3*$level))."</a>"; |
|
| 447 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path"; |
|
| 448 | + if ($desc != '') |
|
| 449 | + { |
|
| 450 | + if ($icon != 'wrap') |
|
| 451 | + { |
|
| 452 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 453 | + } |
|
| 454 | + else |
|
| 455 | + { |
|
| 456 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + } |
|
| 460 | + else |
|
| 461 | + { |
|
| 462 | + echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title,($length-3*$level))."</a>"; |
|
| 463 | + } |
|
| 464 | + break; |
|
| 465 | + |
|
| 466 | + case "Link" : |
|
| 467 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 468 | + $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
| 469 | + $myrow=Database::fetch_array($result); |
|
| 470 | + |
|
| 471 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 472 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 473 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 474 | + $desc=$row['description']; |
|
| 475 | + echo str_repeat(" >",$level); |
|
| 476 | + |
|
| 477 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 478 | + if ($icon != 'nolink') |
|
| 479 | + { |
|
| 480 | + if ($completed=='completed') { |
|
| 481 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 482 | + } else { |
|
| 483 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 484 | + //echo " "; |
|
| 485 | + } |
|
| 486 | + } |
|
| 487 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 488 | + |
|
| 489 | + if ($myrow["title"]=='') |
|
| 490 | + { |
|
| 491 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 492 | + return(true); |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 496 | + if ($icon == 'icon') |
|
| 497 | + { |
|
| 498 | + if ($linktype=='Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } |
|
| 499 | + else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } |
|
| 500 | + } |
|
| 501 | + $thelink=$myrow["url"]; |
|
| 502 | + if ($builder != 'builder') |
|
| 503 | + { |
|
| 504 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 505 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
| 506 | + if ($desc != '') |
|
| 507 | + { |
|
| 508 | + if ($icon != 'wrap') |
|
| 509 | + { |
|
| 510 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 511 | + } |
|
| 512 | + else |
|
| 513 | + { |
|
| 514 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 515 | + } |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + else |
|
| 519 | + { |
|
| 520 | + echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 521 | + } |
|
| 522 | + break; |
|
| 523 | + |
|
| 524 | + case "Exercise": |
|
| 525 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 526 | + $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
| 527 | + $myrow=Database::fetch_array($result); |
|
| 528 | + |
|
| 529 | + if ($builder=='builder') { $origin='builder'; } |
|
| 530 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 531 | + |
|
| 532 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 533 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 534 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 535 | + $desc=$row['description']; |
|
| 536 | + echo str_repeat(" >",$level); |
|
| 537 | + |
|
| 538 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 539 | + if ($icon != 'nolink') |
|
| 540 | + { |
|
| 541 | + if ($completed=='completed') { |
|
| 542 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 543 | + } else { |
|
| 544 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 545 | + //echo " "; |
|
| 546 | + } |
|
| 547 | + } |
|
| 548 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 549 | + |
|
| 550 | + if ($myrow["title"]=='') { |
|
| 551 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 552 | + return(true); |
|
| 553 | + } |
|
| 554 | + |
|
| 555 | + if ($icon == 'nolink') { return(shorten($myrow["title"],$length)); } |
|
| 556 | + if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } |
|
| 557 | + if ($builder != 'builder') |
|
| 558 | + { |
|
| 559 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 560 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
| 561 | + if ($desc != '') |
|
| 562 | + { |
|
| 563 | + if ($icon != 'wrap') |
|
| 564 | + { |
|
| 565 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 566 | + } |
|
| 567 | + else |
|
| 568 | + { |
|
| 569 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + } |
|
| 573 | + else |
|
| 574 | + { |
|
| 575 | + echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]."\" class='$completed' target='_blank'>".shorten($myrow["title"],($length-3*$level))."</a>"; |
|
| 576 | + } |
|
| 577 | + break; |
|
| 578 | + |
|
| 579 | + case "HotPotatoes": |
|
| 580 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 581 | + $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 582 | + $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
| 583 | + $myrow= Database::fetch_array($result); |
|
| 584 | + $path=$myrow["path"]; |
|
| 585 | + $name=GetQuizName($path,$documentPath); |
|
| 586 | + |
|
| 587 | + if ($builder=='builder') { $origin='builder'; } |
|
| 588 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 589 | + |
|
| 590 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 591 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 592 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 593 | + $desc=$row['description']; |
|
| 594 | + echo str_repeat(" >",$level); |
|
| 595 | + |
|
| 596 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 597 | + if ($icon != 'nolink') |
|
| 598 | + { |
|
| 599 | + if ($completed=='completed') { |
|
| 600 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 601 | + } else { |
|
| 602 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 603 | + //echo " "; |
|
| 604 | + } |
|
| 605 | + } |
|
| 606 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 607 | + |
|
| 608 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 609 | + |
|
| 610 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 611 | + if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } |
|
| 612 | + |
|
| 613 | + $cid = $_course['official_code']; |
|
| 614 | + |
|
| 615 | + if ($builder != 'builder') |
|
| 616 | + { |
|
| 617 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
| 618 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
| 619 | + if ($desc != '') |
|
| 620 | + { |
|
| 621 | + if ($icon != 'wrap') |
|
| 622 | + { |
|
| 623 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 624 | + } |
|
| 625 | + else |
|
| 626 | + { |
|
| 627 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 628 | + } |
|
| 629 | + } |
|
| 630 | + } |
|
| 631 | + else |
|
| 632 | + { |
|
| 633 | + echo " <a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 634 | + } |
|
| 635 | + break; |
|
| 636 | + |
|
| 637 | + case "Forum": |
|
| 638 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 639 | + $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 640 | + $myrow=Database::fetch_array($result); |
|
| 641 | + |
|
| 642 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 643 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 644 | + if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
| 645 | + $desc=$row['description']; |
|
| 646 | + echo str_repeat(" >",$level); |
|
| 647 | + |
|
| 648 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 649 | + if ($icon != 'nolink') |
|
| 650 | + { |
|
| 651 | + if ($completed=='completed') { |
|
| 652 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 653 | + } else { |
|
| 654 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 655 | + //echo " "; |
|
| 656 | + } |
|
| 657 | + } |
|
| 658 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 659 | + |
|
| 660 | + if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 661 | + |
|
| 662 | + if ($icon == 'nolink') { return(shorten($myrow["forum_name"],$length)); } |
|
| 663 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 664 | + $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 665 | + if ($builder != 'builder') |
|
| 666 | + { |
|
| 667 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 668 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
| 669 | + if ($desc != '') |
|
| 670 | + { |
|
| 671 | + if ($icon != 'wrap') |
|
| 672 | + { |
|
| 673 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 674 | + } |
|
| 675 | + else |
|
| 676 | + { |
|
| 677 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + } |
|
| 681 | + else |
|
| 682 | + { |
|
| 683 | + echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>"; |
|
| 684 | + } |
|
| 685 | + break; |
|
| 686 | + |
|
| 687 | + case "Thread": //forum post |
|
| 688 | 688 | //deprecated |
| 689 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 690 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 691 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 692 | - $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 693 | - $result= Database::query($sql); |
|
| 694 | - $myrow=Database::fetch_array($result); |
|
| 695 | - |
|
| 696 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 697 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 698 | - if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; } |
|
| 699 | - $desc=$row['description']; |
|
| 700 | - echo str_repeat(" >",$level); |
|
| 701 | - |
|
| 702 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 703 | - if ($icon != 'nolink') |
|
| 704 | - { |
|
| 705 | - if ($completed=='completed') { |
|
| 706 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 707 | - } else { |
|
| 708 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 709 | - //echo " "; |
|
| 710 | - } |
|
| 711 | - } |
|
| 712 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 713 | - |
|
| 714 | - if ($myrow["topic_title"]=='') { $type="Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 715 | - |
|
| 716 | - if ($icon == 'nolink') { return(shorten($myrow["topic_title"],$length)); } |
|
| 717 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 718 | - if ($builder != 'builder') |
|
| 719 | - { |
|
| 720 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
| 721 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
| 722 | - if ($desc != '') |
|
| 723 | - { |
|
| 724 | - if ($icon != 'wrap') |
|
| 725 | - { |
|
| 726 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 727 | - } |
|
| 728 | - else |
|
| 729 | - { |
|
| 730 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 731 | - } |
|
| 732 | - } |
|
| 733 | - } |
|
| 734 | - else |
|
| 735 | - { |
|
| 736 | - echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
| 737 | - } |
|
| 738 | - break; |
|
| 739 | - |
|
| 740 | - case "Post": |
|
| 689 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 690 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 691 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 692 | + $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 693 | + $result= Database::query($sql); |
|
| 694 | + $myrow=Database::fetch_array($result); |
|
| 695 | + |
|
| 696 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 697 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 698 | + if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; } |
|
| 699 | + $desc=$row['description']; |
|
| 700 | + echo str_repeat(" >",$level); |
|
| 701 | + |
|
| 702 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 703 | + if ($icon != 'nolink') |
|
| 704 | + { |
|
| 705 | + if ($completed=='completed') { |
|
| 706 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 707 | + } else { |
|
| 708 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 709 | + //echo " "; |
|
| 710 | + } |
|
| 711 | + } |
|
| 712 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 713 | + |
|
| 714 | + if ($myrow["topic_title"]=='') { $type="Forum Post"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 715 | + |
|
| 716 | + if ($icon == 'nolink') { return(shorten($myrow["topic_title"],$length)); } |
|
| 717 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 718 | + if ($builder != 'builder') |
|
| 719 | + { |
|
| 720 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
| 721 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
| 722 | + if ($desc != '') |
|
| 723 | + { |
|
| 724 | + if ($icon != 'wrap') |
|
| 725 | + { |
|
| 726 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 727 | + } |
|
| 728 | + else |
|
| 729 | + { |
|
| 730 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 731 | + } |
|
| 732 | + } |
|
| 733 | + } |
|
| 734 | + else |
|
| 735 | + { |
|
| 736 | + echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"],($length-3*$level))."</a>"; |
|
| 737 | + } |
|
| 738 | + break; |
|
| 739 | + |
|
| 740 | + case "Post": |
|
| 741 | 741 | //deprecated |
| 742 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 743 | - $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
| 744 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 745 | - $result= Database::query("SELECT * FROM $tbl_posts where post_id=$id"); |
|
| 746 | - $myrow=Database::fetch_array($result); |
|
| 747 | - // grabbing the title of the post |
|
| 748 | - $sql_titel="SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
| 749 | - $result_titel=Database::query($sql_titel); |
|
| 750 | - $myrow_titel=Database::fetch_array($result_titel); |
|
| 751 | - |
|
| 752 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 753 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 754 | - if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; } |
|
| 755 | - $desc=$row['description']; |
|
| 756 | - echo str_repeat(" >",$level); |
|
| 757 | - |
|
| 758 | - $posternom=$myrow['nom']; $posterprenom=$myrow['prenom']; |
|
| 759 | - $posttime=$myrow['post_time']; $posttext=$myrow_titel['post_text']; |
|
| 760 | - $posttitle=$myrow_titel['post_title']; |
|
| 761 | - $posttext = str_replace('"',"'",$posttext); |
|
| 762 | - |
|
| 763 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 764 | - if ($icon != 'nolink') |
|
| 765 | - { |
|
| 766 | - if ($completed=='completed') { |
|
| 767 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 768 | - } else { |
|
| 769 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 770 | - //echo " "; |
|
| 771 | - } |
|
| 772 | - } |
|
| 773 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 774 | - |
|
| 775 | - if ($myrow_titel["post_title"]=='') |
|
| 776 | - { |
|
| 777 | - $type="Forum"; |
|
| 778 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
| 779 | - } |
|
| 780 | - |
|
| 781 | - if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"],$length)); } |
|
| 782 | - if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 783 | - if ($builder != 'builder') |
|
| 784 | - { |
|
| 785 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; |
|
| 786 | - if ($desc != '') |
|
| 787 | - { |
|
| 788 | - if ($icon != 'wrap') |
|
| 789 | - { |
|
| 790 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 791 | - } |
|
| 792 | - else |
|
| 793 | - { |
|
| 794 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 795 | - } |
|
| 796 | - } |
|
| 797 | - } |
|
| 798 | - else |
|
| 799 | - { |
|
| 800 | - echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; |
|
| 801 | - } |
|
| 802 | - break; |
|
| 803 | - |
|
| 804 | - case "Document": |
|
| 805 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 806 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id"); |
|
| 807 | - $myrow=Database::fetch_array($result); |
|
| 808 | - |
|
| 809 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 810 | - $last=count($pathname)-1; // making a correct name for the link |
|
| 811 | - $filename=$pathname[$last]; // making a correct name for the link |
|
| 812 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 813 | - |
|
| 814 | - echo str_repeat(" >",$level); |
|
| 815 | - |
|
| 816 | - if ($icon != 'nolink') { |
|
| 817 | - if ($completed=='completed') { |
|
| 818 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 819 | - } else { |
|
| 820 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 821 | - //echo " "; |
|
| 822 | - } |
|
| 823 | - } |
|
| 824 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 825 | - $image=choose_image($filename); |
|
| 826 | - |
|
| 827 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 828 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 829 | - if ($row['title'] != '') { $filename=$row['title']; } |
|
| 830 | - $desc=$row['description']; |
|
| 831 | - |
|
| 832 | - if (($myrow["path"]=='') and ($filename=='')) { |
|
| 833 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 834 | - return(true); |
|
| 835 | - } |
|
| 836 | - |
|
| 837 | - if ($icon == 'nolink') { return(shorten($filename,$length)); } |
|
| 838 | - if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
|
| 839 | - if ($builder != 'builder') |
|
| 840 | - { |
|
| 841 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename,($length-3*$level))."</a>"; |
|
| 842 | - if ($desc != '') |
|
| 843 | - { |
|
| 844 | - if ($icon != 'wrap') |
|
| 845 | - { |
|
| 846 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 847 | - } |
|
| 848 | - else |
|
| 849 | - { |
|
| 850 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 851 | - } |
|
| 852 | - } $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
| 853 | - } |
|
| 854 | - else |
|
| 855 | - { |
|
| 856 | - $enableDocumentParsing='yes'; |
|
| 857 | - if (!$enableDocumentParsing) |
|
| 858 | - { //this is the solution for the non-parsing version in the builder |
|
| 859 | - $file=urlencode($myrow["path"]); |
|
| 860 | - echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 861 | - } |
|
| 862 | - else |
|
| 863 | - { |
|
| 864 | - echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 865 | - } |
|
| 866 | - } |
|
| 867 | - break; |
|
| 868 | - |
|
| 869 | - case "Assignments": |
|
| 870 | - $name=get_lang('Assignments'); |
|
| 871 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 872 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 873 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 874 | - $desc=$row['description']; |
|
| 875 | - echo str_repeat(" >",$level); |
|
| 876 | - |
|
| 877 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 878 | - if ($icon != 'nolink') |
|
| 879 | - { |
|
| 880 | - if ($completed=='completed') { |
|
| 881 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 882 | - } else { |
|
| 883 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 884 | - //echo " "; |
|
| 885 | - } |
|
| 886 | - } |
|
| 887 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 888 | - |
|
| 889 | - if ($name=='') |
|
| 890 | - { |
|
| 891 | - echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
| 892 | - } |
|
| 893 | - |
|
| 894 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 895 | - if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
|
| 896 | - if ($builder != 'builder') |
|
| 897 | - { |
|
| 898 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
| 899 | - if ($desc != '') |
|
| 900 | - { |
|
| 901 | - if ($icon != 'wrap') |
|
| 902 | - { |
|
| 903 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 904 | - } |
|
| 905 | - else |
|
| 906 | - { |
|
| 907 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 908 | - } |
|
| 909 | - } |
|
| 910 | - } |
|
| 911 | - else |
|
| 912 | - { |
|
| 913 | - echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 914 | - } |
|
| 915 | - break; |
|
| 916 | - case "Dropbox": |
|
| 917 | - $name=get_lang('Dropbox'); |
|
| 918 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 919 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 920 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 921 | - $desc=$row['description']; |
|
| 922 | - echo str_repeat(" >",$level); |
|
| 923 | - |
|
| 924 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 925 | - if ($icon != 'nolink') { |
|
| 926 | - if ($completed=='completed') { |
|
| 927 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 928 | - } else { |
|
| 929 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 930 | - //echo " "; |
|
| 931 | - } |
|
| 932 | - } |
|
| 933 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 934 | - |
|
| 935 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 936 | - |
|
| 937 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 938 | - if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
|
| 939 | - |
|
| 940 | - if ($builder != 'builder') |
|
| 941 | - { |
|
| 942 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
| 943 | - if ($desc != '') { |
|
| 944 | - if ($icon != 'wrap') { |
|
| 945 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 946 | - else { |
|
| 947 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 948 | - } |
|
| 949 | - } else { |
|
| 950 | - echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 951 | - } |
|
| 952 | - break; |
|
| 953 | - case "Introduction_text": |
|
| 954 | - $name=get_lang('IntroductionText'); |
|
| 955 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 956 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 957 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 958 | - $desc=$row['description']; |
|
| 959 | - echo str_repeat(" >",$level); |
|
| 960 | - |
|
| 961 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 962 | - if ($icon != 'nolink') { |
|
| 963 | - if ($completed=='completed') { |
|
| 964 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 965 | - } else { |
|
| 966 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 967 | - //echo " "; |
|
| 968 | - } |
|
| 969 | - } |
|
| 970 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 971 | - |
|
| 972 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 973 | - |
|
| 974 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 975 | - if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
|
| 976 | - |
|
| 977 | - if ($builder != 'builder') |
|
| 978 | - { |
|
| 979 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
| 980 | - $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
| 981 | - if ($desc != '') { |
|
| 982 | - if ($icon != 'wrap') { |
|
| 983 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 984 | - else { |
|
| 985 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 986 | - } |
|
| 987 | - } else { |
|
| 988 | - $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 989 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 990 | - } |
|
| 991 | - break; |
|
| 992 | - case "Course_description": |
|
| 993 | - $name=get_lang('CourseDescription'); |
|
| 994 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 995 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 996 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 997 | - $desc=$row['description']; |
|
| 998 | - echo str_repeat(" >",$level); |
|
| 999 | - |
|
| 1000 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1001 | - if ($icon != 'nolink') { |
|
| 1002 | - if ($completed=='completed') { |
|
| 1003 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1004 | - } else { |
|
| 1005 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1006 | - //echo " "; |
|
| 1007 | - } |
|
| 1008 | - } |
|
| 1009 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1010 | - |
|
| 1011 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1012 | - |
|
| 1013 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1014 | - if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
|
| 1015 | - |
|
| 1016 | - if ($builder != 'builder') |
|
| 1017 | - { |
|
| 1018 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
| 1019 | - if ($desc != '') { |
|
| 1020 | - if ($icon != 'wrap') { |
|
| 1021 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1022 | - else { |
|
| 1023 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1024 | - } |
|
| 1025 | - } else { |
|
| 1026 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1027 | - echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1028 | - } |
|
| 1029 | - break; |
|
| 1030 | - case "Groups": |
|
| 1031 | - $name=get_lang('Groups'); |
|
| 1032 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1033 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1034 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 1035 | - $desc=$row['description']; |
|
| 1036 | - echo str_repeat(" >",$level); |
|
| 1037 | - |
|
| 1038 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1039 | - if ($icon != 'nolink') { |
|
| 1040 | - if ($completed=='completed') { |
|
| 1041 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1042 | - } else { |
|
| 1043 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1044 | - //echo " "; |
|
| 1045 | - } |
|
| 1046 | - } |
|
| 1047 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1048 | - |
|
| 1049 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1050 | - |
|
| 1051 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1052 | - if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
|
| 1053 | - |
|
| 1054 | - if ($builder != 'builder') |
|
| 1055 | - { |
|
| 1056 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
| 1057 | - if ($desc != '') { |
|
| 1058 | - if ($icon != 'wrap') { |
|
| 1059 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1060 | - else { |
|
| 1061 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1062 | - } |
|
| 1063 | - } else { |
|
| 1064 | - echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1065 | - } |
|
| 1066 | - break; |
|
| 1067 | - case "Users": |
|
| 1068 | - $name=get_lang('Users'); |
|
| 1069 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1070 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1071 | - if ($row['title'] != '') { $name=$row['title']; } |
|
| 1072 | - $desc=$row['description']; |
|
| 1073 | - echo str_repeat(" >",$level); |
|
| 1074 | - |
|
| 1075 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1076 | - if ($icon != 'nolink') { |
|
| 1077 | - if ($completed=='completed') { |
|
| 1078 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1079 | - } else { |
|
| 1080 | - echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1081 | - //echo " "; |
|
| 1082 | - } |
|
| 1083 | - } |
|
| 1084 | - if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1085 | - |
|
| 1086 | - if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1087 | - |
|
| 1088 | - if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1089 | - if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
|
| 1090 | - |
|
| 1091 | - if ($builder != 'builder') |
|
| 1092 | - { |
|
| 1093 | - echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
| 1094 | - if ($desc != '') { |
|
| 1095 | - if ($icon != 'wrap') { |
|
| 1096 | - echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1097 | - else { |
|
| 1098 | - echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1099 | - } |
|
| 1100 | - } else { |
|
| 1101 | - echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1102 | - } |
|
| 1103 | - break; |
|
| 1104 | - }//end huge switch-statement |
|
| 742 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 743 | + $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
|
| 744 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 745 | + $result= Database::query("SELECT * FROM $tbl_posts where post_id=$id"); |
|
| 746 | + $myrow=Database::fetch_array($result); |
|
| 747 | + // grabbing the title of the post |
|
| 748 | + $sql_titel="SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"]; |
|
| 749 | + $result_titel=Database::query($sql_titel); |
|
| 750 | + $myrow_titel=Database::fetch_array($result_titel); |
|
| 751 | + |
|
| 752 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 753 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 754 | + if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; } |
|
| 755 | + $desc=$row['description']; |
|
| 756 | + echo str_repeat(" >",$level); |
|
| 757 | + |
|
| 758 | + $posternom=$myrow['nom']; $posterprenom=$myrow['prenom']; |
|
| 759 | + $posttime=$myrow['post_time']; $posttext=$myrow_titel['post_text']; |
|
| 760 | + $posttitle=$myrow_titel['post_title']; |
|
| 761 | + $posttext = str_replace('"',"'",$posttext); |
|
| 762 | + |
|
| 763 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 764 | + if ($icon != 'nolink') |
|
| 765 | + { |
|
| 766 | + if ($completed=='completed') { |
|
| 767 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 768 | + } else { |
|
| 769 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 770 | + //echo " "; |
|
| 771 | + } |
|
| 772 | + } |
|
| 773 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 774 | + |
|
| 775 | + if ($myrow_titel["post_title"]=='') |
|
| 776 | + { |
|
| 777 | + $type="Forum"; |
|
| 778 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
| 779 | + } |
|
| 780 | + |
|
| 781 | + if ($icon == 'nolink') { return(shorten($myrow_titel["post_title"],$length)); } |
|
| 782 | + if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } |
|
| 783 | + if ($builder != 'builder') |
|
| 784 | + { |
|
| 785 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path"; |
|
| 786 | + if ($desc != '') |
|
| 787 | + { |
|
| 788 | + if ($icon != 'wrap') |
|
| 789 | + { |
|
| 790 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 791 | + } |
|
| 792 | + else |
|
| 793 | + { |
|
| 794 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 795 | + } |
|
| 796 | + } |
|
| 797 | + } |
|
| 798 | + else |
|
| 799 | + { |
|
| 800 | + echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow_titel["post_title"],($length-3*$level))."</a>"; |
|
| 801 | + } |
|
| 802 | + break; |
|
| 803 | + |
|
| 804 | + case "Document": |
|
| 805 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 806 | + $result=Database::query("SELECT * FROM $dbTable WHERE id=$id"); |
|
| 807 | + $myrow=Database::fetch_array($result); |
|
| 808 | + |
|
| 809 | + $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 810 | + $last=count($pathname)-1; // making a correct name for the link |
|
| 811 | + $filename=$pathname[$last]; // making a correct name for the link |
|
| 812 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 813 | + |
|
| 814 | + echo str_repeat(" >",$level); |
|
| 815 | + |
|
| 816 | + if ($icon != 'nolink') { |
|
| 817 | + if ($completed=='completed') { |
|
| 818 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 819 | + } else { |
|
| 820 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 821 | + //echo " "; |
|
| 822 | + } |
|
| 823 | + } |
|
| 824 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 825 | + $image=choose_image($filename); |
|
| 826 | + |
|
| 827 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 828 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 829 | + if ($row['title'] != '') { $filename=$row['title']; } |
|
| 830 | + $desc=$row['description']; |
|
| 831 | + |
|
| 832 | + if (($myrow["path"]=='') and ($filename=='')) { |
|
| 833 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; |
|
| 834 | + return(true); |
|
| 835 | + } |
|
| 836 | + |
|
| 837 | + if ($icon == 'nolink') { return(shorten($filename,$length)); } |
|
| 838 | + if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; } |
|
| 839 | + if ($builder != 'builder') |
|
| 840 | + { |
|
| 841 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename,($length-3*$level))."</a>"; |
|
| 842 | + if ($desc != '') |
|
| 843 | + { |
|
| 844 | + if ($icon != 'wrap') |
|
| 845 | + { |
|
| 846 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 847 | + } |
|
| 848 | + else |
|
| 849 | + { |
|
| 850 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 851 | + } |
|
| 852 | + } $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
| 853 | + } |
|
| 854 | + else |
|
| 855 | + { |
|
| 856 | + $enableDocumentParsing='yes'; |
|
| 857 | + if (!$enableDocumentParsing) |
|
| 858 | + { //this is the solution for the non-parsing version in the builder |
|
| 859 | + $file=urlencode($myrow["path"]); |
|
| 860 | + echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 861 | + } |
|
| 862 | + else |
|
| 863 | + { |
|
| 864 | + echo "<a href=\"../document/download.php?doc_url=".$myrow["path"]."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>"; |
|
| 865 | + } |
|
| 866 | + } |
|
| 867 | + break; |
|
| 868 | + |
|
| 869 | + case "Assignments": |
|
| 870 | + $name=get_lang('Assignments'); |
|
| 871 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 872 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 873 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 874 | + $desc=$row['description']; |
|
| 875 | + echo str_repeat(" >",$level); |
|
| 876 | + |
|
| 877 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 878 | + if ($icon != 'nolink') |
|
| 879 | + { |
|
| 880 | + if ($completed=='completed') { |
|
| 881 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 882 | + } else { |
|
| 883 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 884 | + //echo " "; |
|
| 885 | + } |
|
| 886 | + } |
|
| 887 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 888 | + |
|
| 889 | + if ($name=='') |
|
| 890 | + { |
|
| 891 | + echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); |
|
| 892 | + } |
|
| 893 | + |
|
| 894 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 895 | + if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } |
|
| 896 | + if ($builder != 'builder') |
|
| 897 | + { |
|
| 898 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
| 899 | + if ($desc != '') |
|
| 900 | + { |
|
| 901 | + if ($icon != 'wrap') |
|
| 902 | + { |
|
| 903 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; |
|
| 904 | + } |
|
| 905 | + else |
|
| 906 | + { |
|
| 907 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; |
|
| 908 | + } |
|
| 909 | + } |
|
| 910 | + } |
|
| 911 | + else |
|
| 912 | + { |
|
| 913 | + echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 914 | + } |
|
| 915 | + break; |
|
| 916 | + case "Dropbox": |
|
| 917 | + $name=get_lang('Dropbox'); |
|
| 918 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 919 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 920 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 921 | + $desc=$row['description']; |
|
| 922 | + echo str_repeat(" >",$level); |
|
| 923 | + |
|
| 924 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 925 | + if ($icon != 'nolink') { |
|
| 926 | + if ($completed=='completed') { |
|
| 927 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 928 | + } else { |
|
| 929 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 930 | + //echo " "; |
|
| 931 | + } |
|
| 932 | + } |
|
| 933 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 934 | + |
|
| 935 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 936 | + |
|
| 937 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 938 | + if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } |
|
| 939 | + |
|
| 940 | + if ($builder != 'builder') |
|
| 941 | + { |
|
| 942 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
| 943 | + if ($desc != '') { |
|
| 944 | + if ($icon != 'wrap') { |
|
| 945 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 946 | + else { |
|
| 947 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 948 | + } |
|
| 949 | + } else { |
|
| 950 | + echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 951 | + } |
|
| 952 | + break; |
|
| 953 | + case "Introduction_text": |
|
| 954 | + $name=get_lang('IntroductionText'); |
|
| 955 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 956 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 957 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 958 | + $desc=$row['description']; |
|
| 959 | + echo str_repeat(" >",$level); |
|
| 960 | + |
|
| 961 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 962 | + if ($icon != 'nolink') { |
|
| 963 | + if ($completed=='completed') { |
|
| 964 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 965 | + } else { |
|
| 966 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 967 | + //echo " "; |
|
| 968 | + } |
|
| 969 | + } |
|
| 970 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 971 | + |
|
| 972 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 973 | + |
|
| 974 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 975 | + if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } |
|
| 976 | + |
|
| 977 | + if ($builder != 'builder') |
|
| 978 | + { |
|
| 979 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; |
|
| 980 | + $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
| 981 | + if ($desc != '') { |
|
| 982 | + if ($icon != 'wrap') { |
|
| 983 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 984 | + else { |
|
| 985 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 986 | + } |
|
| 987 | + } else { |
|
| 988 | + $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 989 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 990 | + } |
|
| 991 | + break; |
|
| 992 | + case "Course_description": |
|
| 993 | + $name=get_lang('CourseDescription'); |
|
| 994 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 995 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 996 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 997 | + $desc=$row['description']; |
|
| 998 | + echo str_repeat(" >",$level); |
|
| 999 | + |
|
| 1000 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1001 | + if ($icon != 'nolink') { |
|
| 1002 | + if ($completed=='completed') { |
|
| 1003 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1004 | + } else { |
|
| 1005 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1006 | + //echo " "; |
|
| 1007 | + } |
|
| 1008 | + } |
|
| 1009 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1010 | + |
|
| 1011 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1012 | + |
|
| 1013 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1014 | + if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } |
|
| 1015 | + |
|
| 1016 | + if ($builder != 'builder') |
|
| 1017 | + { |
|
| 1018 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
| 1019 | + if ($desc != '') { |
|
| 1020 | + if ($icon != 'wrap') { |
|
| 1021 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1022 | + else { |
|
| 1023 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1024 | + } |
|
| 1025 | + } else { |
|
| 1026 | + $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1027 | + echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1028 | + } |
|
| 1029 | + break; |
|
| 1030 | + case "Groups": |
|
| 1031 | + $name=get_lang('Groups'); |
|
| 1032 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1033 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1034 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 1035 | + $desc=$row['description']; |
|
| 1036 | + echo str_repeat(" >",$level); |
|
| 1037 | + |
|
| 1038 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1039 | + if ($icon != 'nolink') { |
|
| 1040 | + if ($completed=='completed') { |
|
| 1041 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1042 | + } else { |
|
| 1043 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1044 | + //echo " "; |
|
| 1045 | + } |
|
| 1046 | + } |
|
| 1047 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1048 | + |
|
| 1049 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1050 | + |
|
| 1051 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1052 | + if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } |
|
| 1053 | + |
|
| 1054 | + if ($builder != 'builder') |
|
| 1055 | + { |
|
| 1056 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
| 1057 | + if ($desc != '') { |
|
| 1058 | + if ($icon != 'wrap') { |
|
| 1059 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1060 | + else { |
|
| 1061 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1062 | + } |
|
| 1063 | + } else { |
|
| 1064 | + echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1065 | + } |
|
| 1066 | + break; |
|
| 1067 | + case "Users": |
|
| 1068 | + $name=get_lang('Users'); |
|
| 1069 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1070 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1071 | + if ($row['title'] != '') { $name=$row['title']; } |
|
| 1072 | + $desc=$row['description']; |
|
| 1073 | + echo str_repeat(" >",$level); |
|
| 1074 | + |
|
| 1075 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "<td>"; } |
|
| 1076 | + if ($icon != 'nolink') { |
|
| 1077 | + if ($completed=='completed') { |
|
| 1078 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; |
|
| 1079 | + } else { |
|
| 1080 | + echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; |
|
| 1081 | + //echo " "; |
|
| 1082 | + } |
|
| 1083 | + } |
|
| 1084 | + if (($builder != 'builder') and ($icon != 'wrap')) { echo "</td><td>"; } |
|
| 1085 | + |
|
| 1086 | + if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); } |
|
| 1087 | + |
|
| 1088 | + if ($icon == 'nolink') { return(shorten($name,$length)); } |
|
| 1089 | + if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } |
|
| 1090 | + |
|
| 1091 | + if ($builder != 'builder') |
|
| 1092 | + { |
|
| 1093 | + echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
| 1094 | + if ($desc != '') { |
|
| 1095 | + if ($icon != 'wrap') { |
|
| 1096 | + echo "</tr><tr><td></td><td></td><td><div class='description'> ".shorten($desc,($length-3*$level))."</div></td></tr>"; } |
|
| 1097 | + else { |
|
| 1098 | + echo "<div class='description'> ".shorten($desc,($length-3*$level))."</div>"; } |
|
| 1099 | + } |
|
| 1100 | + } else { |
|
| 1101 | + echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>"; |
|
| 1102 | + } |
|
| 1103 | + break; |
|
| 1104 | + }//end huge switch-statement |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | /** |
@@ -1116,168 +1116,168 @@ discard block |
||
| 1116 | 1116 | */ |
| 1117 | 1117 | function get_addedresource_link_in_learnpath($type, $id, $id_in_path) |
| 1118 | 1118 | { |
| 1119 | - global $_course, $learnpath_id, $tbl_learnpath_item, $items; |
|
| 1120 | - global $curDirPath, $_configuration, $enableDocumentParsing, $_user , $_cid; |
|
| 1121 | - |
|
| 1122 | - $hyperlink_target_parameter = ""; //or e.g. target='_blank' |
|
| 1123 | - $builder = 'player'; |
|
| 1124 | - $origin='learnpath'; |
|
| 1125 | - |
|
| 1126 | - $linktype=$type; |
|
| 1127 | - if (($type=="Link _self") or ($type=="Link _blank")) { $type="Link"; } |
|
| 1128 | - |
|
| 1129 | - $link = ''; |
|
| 1130 | - |
|
| 1131 | - switch ($type) |
|
| 1132 | - { |
|
| 1133 | - case "Agenda": |
|
| 1134 | - $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);; |
|
| 1135 | - $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
| 1136 | - $myrow=Database::fetch_array($result); |
|
| 1137 | - |
|
| 1138 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1139 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1140 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 1141 | - $desc=$row['description']; |
|
| 1142 | - $agenda_id=$row['item_id']; |
|
| 1143 | - |
|
| 1144 | - if ($builder != 'builder') |
|
| 1145 | - { |
|
| 1146 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
| 1147 | - } |
|
| 1148 | - else |
|
| 1149 | - { |
|
| 1150 | - $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; |
|
| 1151 | - } |
|
| 1152 | - break; |
|
| 1153 | - |
|
| 1154 | - case "Ad_Valvas": |
|
| 1155 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 1156 | - $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
| 1157 | - $myrow=Database::fetch_array($result); |
|
| 1158 | - |
|
| 1159 | - if ($builder != 'builder') |
|
| 1160 | - { |
|
| 1161 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; |
|
| 1162 | - } |
|
| 1163 | - else |
|
| 1164 | - { |
|
| 1165 | - $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; |
|
| 1166 | - } |
|
| 1167 | - break; |
|
| 1168 | - |
|
| 1169 | - case "Link" : |
|
| 1170 | - $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 1171 | - $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
| 1172 | - $myrow=Database::fetch_array($result); |
|
| 1173 | - |
|
| 1174 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1175 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1176 | - |
|
| 1177 | - $thelink=$myrow["url"]; |
|
| 1178 | - if ($builder != 'builder') |
|
| 1179 | - { |
|
| 1180 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
| 1181 | - } |
|
| 1182 | - else |
|
| 1183 | - { |
|
| 1184 | - $link .= $thelink; |
|
| 1185 | - } |
|
| 1186 | - break; |
|
| 1187 | - |
|
| 1188 | - case "Exercise": |
|
| 1189 | - $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1190 | - $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
| 1191 | - $myrow=Database::fetch_array($result); |
|
| 1192 | - |
|
| 1193 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1194 | - //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 1195 | - |
|
| 1196 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1197 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1198 | - if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 1199 | - |
|
| 1200 | - if ($builder != 'builder') |
|
| 1201 | - { |
|
| 1202 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
| 1203 | - } |
|
| 1204 | - else |
|
| 1205 | - { |
|
| 1206 | - $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; |
|
| 1207 | - } |
|
| 1208 | - break; |
|
| 1209 | - |
|
| 1210 | - case "HotPotatoes": |
|
| 1211 | - $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1212 | - $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 1213 | - $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
| 1214 | - $myrow= Database::fetch_array($result); |
|
| 1215 | - $path=$myrow["path"]; |
|
| 1216 | - $name=GetQuizName($path,$documentPath); |
|
| 1217 | - |
|
| 1218 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1219 | - |
|
| 1220 | - $cid = $_course['official_code']; |
|
| 1221 | - |
|
| 1222 | - if ($builder != 'builder') |
|
| 1223 | - { |
|
| 1224 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
| 1225 | - } |
|
| 1226 | - else |
|
| 1227 | - { |
|
| 1228 | - $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; |
|
| 1229 | - } |
|
| 1230 | - break; |
|
| 1231 | - |
|
| 1232 | - case "Forum": |
|
| 1119 | + global $_course, $learnpath_id, $tbl_learnpath_item, $items; |
|
| 1120 | + global $curDirPath, $_configuration, $enableDocumentParsing, $_user , $_cid; |
|
| 1121 | + |
|
| 1122 | + $hyperlink_target_parameter = ""; //or e.g. target='_blank' |
|
| 1123 | + $builder = 'player'; |
|
| 1124 | + $origin='learnpath'; |
|
| 1125 | + |
|
| 1126 | + $linktype=$type; |
|
| 1127 | + if (($type=="Link _self") or ($type=="Link _blank")) { $type="Link"; } |
|
| 1128 | + |
|
| 1129 | + $link = ''; |
|
| 1130 | + |
|
| 1131 | + switch ($type) |
|
| 1132 | + { |
|
| 1133 | + case "Agenda": |
|
| 1134 | + $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);; |
|
| 1135 | + $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE id=$id"); |
|
| 1136 | + $myrow=Database::fetch_array($result); |
|
| 1137 | + |
|
| 1138 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1139 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1140 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 1141 | + $desc=$row['description']; |
|
| 1142 | + $agenda_id=$row['item_id']; |
|
| 1143 | + |
|
| 1144 | + if ($builder != 'builder') |
|
| 1145 | + { |
|
| 1146 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path"; |
|
| 1147 | + } |
|
| 1148 | + else |
|
| 1149 | + { |
|
| 1150 | + $link .= "../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id"; |
|
| 1151 | + } |
|
| 1152 | + break; |
|
| 1153 | + |
|
| 1154 | + case "Ad_Valvas": |
|
| 1155 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
| 1156 | + $result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id"); |
|
| 1157 | + $myrow=Database::fetch_array($result); |
|
| 1158 | + |
|
| 1159 | + if ($builder != 'builder') |
|
| 1160 | + { |
|
| 1161 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$id#$id_in_path"; |
|
| 1162 | + } |
|
| 1163 | + else |
|
| 1164 | + { |
|
| 1165 | + $link .= "../announcements/announcements.php?origin=$origin&ann_id=$id"; |
|
| 1166 | + } |
|
| 1167 | + break; |
|
| 1168 | + |
|
| 1169 | + case "Link" : |
|
| 1170 | + $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); |
|
| 1171 | + $result= Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$id"); |
|
| 1172 | + $myrow=Database::fetch_array($result); |
|
| 1173 | + |
|
| 1174 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1175 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1176 | + |
|
| 1177 | + $thelink=$myrow["url"]; |
|
| 1178 | + if ($builder != 'builder') |
|
| 1179 | + { |
|
| 1180 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path"; |
|
| 1181 | + } |
|
| 1182 | + else |
|
| 1183 | + { |
|
| 1184 | + $link .= $thelink; |
|
| 1185 | + } |
|
| 1186 | + break; |
|
| 1187 | + |
|
| 1188 | + case "Exercise": |
|
| 1189 | + $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1190 | + $result= Database::query("SELECT * FROM $TBL_EXERCICES WHERE id=$id"); |
|
| 1191 | + $myrow=Database::fetch_array($result); |
|
| 1192 | + |
|
| 1193 | + if ($builder=='builder') { $origin='builder'; } |
|
| 1194 | + //this is needed for the exercise_submit.php can delete the session info about tests |
|
| 1195 | + |
|
| 1196 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1197 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1198 | + if ($row['title'] != '') { $myrow["title"]=$row['title']; } |
|
| 1199 | + |
|
| 1200 | + if ($builder != 'builder') |
|
| 1201 | + { |
|
| 1202 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path"; |
|
| 1203 | + } |
|
| 1204 | + else |
|
| 1205 | + { |
|
| 1206 | + $link .= "../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow["id"]; |
|
| 1207 | + } |
|
| 1208 | + break; |
|
| 1209 | + |
|
| 1210 | + case "HotPotatoes": |
|
| 1211 | + $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1212 | + $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
| 1213 | + $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE id=$id"); |
|
| 1214 | + $myrow= Database::fetch_array($result); |
|
| 1215 | + $path=$myrow["path"]; |
|
| 1216 | + $name=GetQuizName($path,$documentPath); |
|
| 1217 | + |
|
| 1218 | + if ($builder=='builder') { $origin='builder'; } |
|
| 1219 | + |
|
| 1220 | + $cid = $_course['official_code']; |
|
| 1221 | + |
|
| 1222 | + if ($builder != 'builder') |
|
| 1223 | + { |
|
| 1224 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path"; |
|
| 1225 | + } |
|
| 1226 | + else |
|
| 1227 | + { |
|
| 1228 | + $link .= "../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id'].""; |
|
| 1229 | + } |
|
| 1230 | + break; |
|
| 1231 | + |
|
| 1232 | + case "Forum": |
|
| 1233 | 1233 | //deprecated |
| 1234 | - $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 1235 | - $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 1236 | - $myrow=Database::fetch_array($result); |
|
| 1237 | - |
|
| 1238 | - if ($builder=='builder') { $origin='builder'; } |
|
| 1239 | - |
|
| 1240 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1241 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1242 | - if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
| 1243 | - |
|
| 1244 | - if ($myrow["forum_name"]=='') { $type="Forum"; } |
|
| 1245 | - |
|
| 1246 | - $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1247 | - if ($builder != 'builder') |
|
| 1248 | - { |
|
| 1249 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
| 1250 | - } |
|
| 1251 | - else |
|
| 1252 | - { |
|
| 1253 | - $link .= "../phpbb/viewforum.php?$forumparameters"; |
|
| 1254 | - } |
|
| 1255 | - break; |
|
| 1256 | - |
|
| 1257 | - case "Thread": //forum post |
|
| 1234 | + $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); |
|
| 1235 | + $result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id"); |
|
| 1236 | + $myrow=Database::fetch_array($result); |
|
| 1237 | + |
|
| 1238 | + if ($builder=='builder') { $origin='builder'; } |
|
| 1239 | + |
|
| 1240 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1241 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1242 | + if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; } |
|
| 1243 | + |
|
| 1244 | + if ($myrow["forum_name"]=='') { $type="Forum"; } |
|
| 1245 | + |
|
| 1246 | + $forumparameters="forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1247 | + if ($builder != 'builder') |
|
| 1248 | + { |
|
| 1249 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path"; |
|
| 1250 | + } |
|
| 1251 | + else |
|
| 1252 | + { |
|
| 1253 | + $link .= "../phpbb/viewforum.php?$forumparameters"; |
|
| 1254 | + } |
|
| 1255 | + break; |
|
| 1256 | + |
|
| 1257 | + case "Thread": //forum post |
|
| 1258 | 1258 | //deprecated |
| 1259 | - $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 1260 | - $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 1261 | - $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 1262 | - $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 1263 | - $result= Database::query($sql); |
|
| 1264 | - $myrow=Database::fetch_array($result); |
|
| 1265 | - |
|
| 1266 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1267 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1268 | - |
|
| 1269 | - if ($builder != 'builder') |
|
| 1270 | - { |
|
| 1271 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
| 1272 | - } |
|
| 1273 | - else |
|
| 1274 | - { |
|
| 1275 | - $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1276 | - } |
|
| 1277 | - break; |
|
| 1278 | - |
|
| 1279 | - case "Post": |
|
| 1280 | - /* todo REVIEW THIS SECTION - NOT USING VALID TABLES ANYMORE |
|
| 1259 | + $tbl_topics = $_course['dbNameGlu'].'bb_topics'; |
|
| 1260 | + $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
|
| 1261 | + $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
|
| 1262 | + $sql="SELECT * FROM $tbl_topics where topic_id=$id"; |
|
| 1263 | + $result= Database::query($sql); |
|
| 1264 | + $myrow=Database::fetch_array($result); |
|
| 1265 | + |
|
| 1266 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1267 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1268 | + |
|
| 1269 | + if ($builder != 'builder') |
|
| 1270 | + { |
|
| 1271 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path"; |
|
| 1272 | + } |
|
| 1273 | + else |
|
| 1274 | + { |
|
| 1275 | + $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
|
| 1276 | + } |
|
| 1277 | + break; |
|
| 1278 | + |
|
| 1279 | + case "Post": |
|
| 1280 | + /* todo REVIEW THIS SECTION - NOT USING VALID TABLES ANYMORE |
|
| 1281 | 1281 | $tbl_posts = $_course['dbNameGlu'].'bb_posts'; |
| 1282 | 1282 | $tbl_posts_text = $_course['dbNameGlu'].'bb_posts_text'; |
| 1283 | 1283 | $TBL_FORUMS = $_course['dbNameGlu']."bb_forums"; |
@@ -1308,94 +1308,94 @@ discard block |
||
| 1308 | 1308 | $link .= "../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]; |
| 1309 | 1309 | } |
| 1310 | 1310 | */ |
| 1311 | - break; |
|
| 1312 | - |
|
| 1313 | - case "Document": |
|
| 1314 | - $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | - $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
| 1316 | - $myrow=Database::fetch_array($result); |
|
| 1317 | - |
|
| 1318 | - $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 1319 | - $last=count($pathname)-1; // making a correct name for the link |
|
| 1320 | - $filename=$pathname[$last]; // making a correct name for the link |
|
| 1321 | - |
|
| 1322 | - $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | - $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1324 | - |
|
| 1325 | - if ($builder != 'builder') |
|
| 1326 | - { |
|
| 1327 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
| 1328 | - |
|
| 1329 | - } |
|
| 1330 | - else |
|
| 1331 | - { |
|
| 1332 | - $enableDocumentParsing='yes'; |
|
| 1333 | - if (!$enableDocumentParsing) |
|
| 1334 | - { //this is the solution for the non-parsing version in the builder |
|
| 1335 | - $file=urlencode($myrow["path"]); |
|
| 1336 | - $link .= "../document/showinframes.php?file=$file"; |
|
| 1337 | - } |
|
| 1338 | - else |
|
| 1339 | - { |
|
| 1340 | - $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
| 1341 | - } |
|
| 1342 | - } |
|
| 1343 | - break; |
|
| 1344 | - |
|
| 1345 | - case "Assignments": |
|
| 1346 | - if ($builder != 'builder') |
|
| 1347 | - { |
|
| 1348 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
| 1349 | - } |
|
| 1350 | - else |
|
| 1351 | - { |
|
| 1352 | - $link .= "../work/work.php"; |
|
| 1353 | - } |
|
| 1354 | - break; |
|
| 1355 | - case "Dropbox": |
|
| 1356 | - if ($builder != 'builder') |
|
| 1357 | - { |
|
| 1358 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
| 1359 | - } else { |
|
| 1360 | - $link .= "../dropbox/index.php"; |
|
| 1361 | - } |
|
| 1362 | - break; |
|
| 1363 | - case "Introduction_text": |
|
| 1364 | - if ($builder != 'builder') |
|
| 1365 | - { |
|
| 1366 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
| 1367 | - } else { |
|
| 1368 | - $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 1369 | - $link .= $s; |
|
| 1370 | - } |
|
| 1371 | - break; |
|
| 1372 | - case "Course_description": |
|
| 1373 | - if ($builder != 'builder') |
|
| 1374 | - { |
|
| 1375 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
| 1376 | - } else { |
|
| 1377 | - $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1378 | - $link .= $s; |
|
| 1379 | - } |
|
| 1380 | - break; |
|
| 1381 | - case "Groups": |
|
| 1382 | - |
|
| 1383 | - if ($builder != 'builder') |
|
| 1384 | - { |
|
| 1385 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
| 1386 | - } else { |
|
| 1387 | - $link .= "../group/group.php?origin=$origin"; |
|
| 1388 | - } |
|
| 1389 | - break; |
|
| 1390 | - case "Users": |
|
| 1391 | - if ($builder != 'builder') |
|
| 1392 | - { |
|
| 1393 | - $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
| 1394 | - } else { |
|
| 1395 | - $link .= "../user/user.php?origin=$origin"; |
|
| 1396 | - } |
|
| 1397 | - break; |
|
| 1398 | - }//end huge switch-statement |
|
| 1311 | + break; |
|
| 1312 | + |
|
| 1313 | + case "Document": |
|
| 1314 | + $dbTable = Database::get_course_table(TABLE_DOCUMENT); |
|
| 1315 | + $result=Database::query("SELECT * FROM $dbTable WHERE id=$id",__FILE__,__LINE); |
|
| 1316 | + $myrow=Database::fetch_array($result); |
|
| 1317 | + |
|
| 1318 | + $pathname=explode("/",$myrow["path"]); // making a correct name for the link |
|
| 1319 | + $last=count($pathname)-1; // making a correct name for the link |
|
| 1320 | + $filename=$pathname[$last]; // making a correct name for the link |
|
| 1321 | + |
|
| 1322 | + $sql="select * from $tbl_learnpath_item where id=$id_in_path"; |
|
| 1323 | + $result=Database::query($sql); $row=Database::fetch_array($result); |
|
| 1324 | + |
|
| 1325 | + if ($builder != 'builder') |
|
| 1326 | + { |
|
| 1327 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path"; |
|
| 1328 | + |
|
| 1329 | + } |
|
| 1330 | + else |
|
| 1331 | + { |
|
| 1332 | + $enableDocumentParsing='yes'; |
|
| 1333 | + if (!$enableDocumentParsing) |
|
| 1334 | + { //this is the solution for the non-parsing version in the builder |
|
| 1335 | + $file=urlencode($myrow["path"]); |
|
| 1336 | + $link .= "../document/showinframes.php?file=$file"; |
|
| 1337 | + } |
|
| 1338 | + else |
|
| 1339 | + { |
|
| 1340 | + $link .= "../document/download.php?doc_url=".$myrow["path"]; |
|
| 1341 | + } |
|
| 1342 | + } |
|
| 1343 | + break; |
|
| 1344 | + |
|
| 1345 | + case "Assignments": |
|
| 1346 | + if ($builder != 'builder') |
|
| 1347 | + { |
|
| 1348 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path"; |
|
| 1349 | + } |
|
| 1350 | + else |
|
| 1351 | + { |
|
| 1352 | + $link .= "../work/work.php"; |
|
| 1353 | + } |
|
| 1354 | + break; |
|
| 1355 | + case "Dropbox": |
|
| 1356 | + if ($builder != 'builder') |
|
| 1357 | + { |
|
| 1358 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path"; |
|
| 1359 | + } else { |
|
| 1360 | + $link .= "../dropbox/index.php"; |
|
| 1361 | + } |
|
| 1362 | + break; |
|
| 1363 | + case "Introduction_text": |
|
| 1364 | + if ($builder != 'builder') |
|
| 1365 | + { |
|
| 1366 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path"; |
|
| 1367 | + } else { |
|
| 1368 | + $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1"; |
|
| 1369 | + $link .= $s; |
|
| 1370 | + } |
|
| 1371 | + break; |
|
| 1372 | + case "Course_description": |
|
| 1373 | + if ($builder != 'builder') |
|
| 1374 | + { |
|
| 1375 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path"; |
|
| 1376 | + } else { |
|
| 1377 | + $s=api_get_path(WEB_CODE_PATH)."course_description"; |
|
| 1378 | + $link .= $s; |
|
| 1379 | + } |
|
| 1380 | + break; |
|
| 1381 | + case "Groups": |
|
| 1382 | + |
|
| 1383 | + if ($builder != 'builder') |
|
| 1384 | + { |
|
| 1385 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path"; |
|
| 1386 | + } else { |
|
| 1387 | + $link .= "../group/group.php?origin=$origin"; |
|
| 1388 | + } |
|
| 1389 | + break; |
|
| 1390 | + case "Users": |
|
| 1391 | + if ($builder != 'builder') |
|
| 1392 | + { |
|
| 1393 | + $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path"; |
|
| 1394 | + } else { |
|
| 1395 | + $link .= "../user/user.php?origin=$origin"; |
|
| 1396 | + } |
|
| 1397 | + break; |
|
| 1398 | + }//end huge switch-statement |
|
| 1399 | 1399 | return $link; |
| 1400 | 1400 | } |
| 1401 | 1401 | |
@@ -1404,12 +1404,12 @@ discard block |
||
| 1404 | 1404 | */ |
| 1405 | 1405 | function remove_resource($resource_key) |
| 1406 | 1406 | { |
| 1407 | - $addedresource = $_SESSION['addedresource']; |
|
| 1408 | - $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1409 | - unset($addedresource[$resource_key]); |
|
| 1410 | - unset($addedresourceid[$resource_key]); |
|
| 1411 | - $_SESSION['addedresource']=$addedresource; |
|
| 1412 | - $_SESSION['addedresourceid']=$addedresourceid ; |
|
| 1407 | + $addedresource = $_SESSION['addedresource']; |
|
| 1408 | + $addedresourceid = $_SESSION['addedresourceid']; |
|
| 1409 | + unset($addedresource[$resource_key]); |
|
| 1410 | + unset($addedresourceid[$resource_key]); |
|
| 1411 | + $_SESSION['addedresource']=$addedresource; |
|
| 1412 | + $_SESSION['addedresourceid']=$addedresourceid ; |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | /** |
@@ -1418,8 +1418,8 @@ discard block |
||
| 1418 | 1418 | */ |
| 1419 | 1419 | function show_addresource_button($additionalparameters = '') |
| 1420 | 1420 | { |
| 1421 | - global $charset; |
|
| 1422 | - echo '<label for="addresources"><img src="../img/attachment.gif" /></label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities(get_lang('Attachment'), ENT_QUOTES, $charset).'" '.$additionalparameters.' />'; |
|
| 1421 | + global $charset; |
|
| 1422 | + echo '<label for="addresources"><img src="../img/attachment.gif" /></label><input class="link_alike" type="submit" name="addresources" id="addresources" value="'.api_htmlentities(get_lang('Attachment'), ENT_QUOTES, $charset).'" '.$additionalparameters.' />'; |
|
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | /** |
@@ -1441,11 +1441,11 @@ discard block |
||
| 1441 | 1441 | */ |
| 1442 | 1442 | function delete_added_resource($type, $id) |
| 1443 | 1443 | { |
| 1444 | - global $_course; |
|
| 1445 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1444 | + global $_course; |
|
| 1445 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1446 | 1446 | |
| 1447 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1448 | - Database::query($sql); |
|
| 1447 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1448 | + Database::query($sql); |
|
| 1449 | 1449 | } |
| 1450 | 1450 | |
| 1451 | 1451 | /** |
@@ -1454,12 +1454,12 @@ discard block |
||
| 1454 | 1454 | */ |
| 1455 | 1455 | function delete_all_resources_type($type) |
| 1456 | 1456 | { |
| 1457 | - global $_course; |
|
| 1458 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1457 | + global $_course; |
|
| 1458 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1459 | 1459 | |
| 1460 | - $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1460 | + $sql="DELETE FROM $TABLERESOURCE WHERE source_type='$type'"; |
|
| 1461 | 1461 | |
| 1462 | - Database::query($sql); |
|
| 1462 | + Database::query($sql); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | /** |
@@ -1467,15 +1467,15 @@ discard block |
||
| 1467 | 1467 | */ |
| 1468 | 1468 | function check_added_resources($type, $id) |
| 1469 | 1469 | { |
| 1470 | - global $_course, $origin; |
|
| 1471 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | - $result=Database::query($sql); |
|
| 1474 | - $number_added=Database::num_rows($result); |
|
| 1475 | - if ($number_added<>0) |
|
| 1476 | - return true; |
|
| 1477 | - else |
|
| 1478 | - return false; |
|
| 1470 | + global $_course, $origin; |
|
| 1471 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1472 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1473 | + $result=Database::query($sql); |
|
| 1474 | + $number_added=Database::num_rows($result); |
|
| 1475 | + if ($number_added<>0) |
|
| 1476 | + return true; |
|
| 1477 | + else |
|
| 1478 | + return false; |
|
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | 1481 | |
@@ -1485,18 +1485,18 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | function edit_added_resources($type, $id) |
| 1487 | 1487 | { |
| 1488 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1488 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1489 | 1489 | $course_id = api_get_course_int_id(); |
| 1490 | 1490 | $id = intval($id); |
| 1491 | 1491 | $type = Database::escape_string($type); |
| 1492 | - $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | - $result=Database::query($sql); |
|
| 1494 | - while ($row=Database::fetch_array($result)) { |
|
| 1495 | - $addedresource[]=$row["resource_type"]; |
|
| 1496 | - $addedresourceid[]=$row["resource_id"]; |
|
| 1497 | - } |
|
| 1498 | - $_SESSION['addedresource']=$addedresource; |
|
| 1499 | - $_SESSION['addedresourceid']=$addedresourceid; |
|
| 1492 | + $sql="SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id=$id"; |
|
| 1493 | + $result=Database::query($sql); |
|
| 1494 | + while ($row=Database::fetch_array($result)) { |
|
| 1495 | + $addedresource[]=$row["resource_type"]; |
|
| 1496 | + $addedresourceid[]=$row["resource_id"]; |
|
| 1497 | + } |
|
| 1498 | + $_SESSION['addedresource']=$addedresource; |
|
| 1499 | + $_SESSION['addedresourceid']=$addedresourceid; |
|
| 1500 | 1500 | } |
| 1501 | 1501 | |
| 1502 | 1502 | /** |
@@ -1506,20 +1506,20 @@ discard block |
||
| 1506 | 1506 | */ |
| 1507 | 1507 | function update_added_resources($type, $id) |
| 1508 | 1508 | { |
| 1509 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1509 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1510 | 1510 | $course_id = api_get_course_int_id(); |
| 1511 | 1511 | $id = intval($id); |
| 1512 | 1512 | $type = Database::escape_string($type); |
| 1513 | - // delete all the added resources for this item in the database; |
|
| 1514 | - $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1515 | - //echo $sql; |
|
| 1516 | - Database::query($sql); |
|
| 1513 | + // delete all the added resources for this item in the database; |
|
| 1514 | + $sql="DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' AND source_id='$id'"; |
|
| 1515 | + //echo $sql; |
|
| 1516 | + Database::query($sql); |
|
| 1517 | 1517 | |
| 1518 | - // store the resources from the session into the database |
|
| 1519 | - store_resources($type, $id); |
|
| 1518 | + // store the resources from the session into the database |
|
| 1519 | + store_resources($type, $id); |
|
| 1520 | 1520 | |
| 1521 | - //delete_added_resource_($type, $id); |
|
| 1522 | - unset_session_resources(); |
|
| 1521 | + //delete_added_resource_($type, $id); |
|
| 1522 | + unset_session_resources(); |
|
| 1523 | 1523 | } |
| 1524 | 1524 | |
| 1525 | 1525 | /** |
@@ -1527,25 +1527,25 @@ discard block |
||
| 1527 | 1527 | */ |
| 1528 | 1528 | function display_added_resources($type, $id, $style='') |
| 1529 | 1529 | { |
| 1530 | - // the array containing the icons |
|
| 1531 | - $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
| 1532 | - |
|
| 1533 | - global $_course, $origin; |
|
| 1534 | - $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1535 | - |
|
| 1536 | - $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | - $result=Database::query($sql); |
|
| 1538 | - while ($row=Database::fetch_array($result)) |
|
| 1539 | - { |
|
| 1540 | - if ($origin != 'learnpath') |
|
| 1541 | - { |
|
| 1542 | - display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1543 | - } |
|
| 1544 | - else |
|
| 1545 | - { |
|
| 1546 | - display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1547 | - } |
|
| 1548 | - } |
|
| 1530 | + // the array containing the icons |
|
| 1531 | + $arr_icons=array('Agenda'=>'../img/agenda.gif', 'Ad Valvas'=>'../img/valves.gif', 'Link'=>'../img/links.gif', 'Exercise'=>'../img/quiz.gif' ); |
|
| 1532 | + |
|
| 1533 | + global $_course, $origin; |
|
| 1534 | + $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES); |
|
| 1535 | + |
|
| 1536 | + $sql="SELECT * FROM $TABLERESOURCE WHERE source_type='$type' and source_id='$id'"; |
|
| 1537 | + $result=Database::query($sql); |
|
| 1538 | + while ($row=Database::fetch_array($result)) |
|
| 1539 | + { |
|
| 1540 | + if ($origin != 'learnpath') |
|
| 1541 | + { |
|
| 1542 | + display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ; |
|
| 1543 | + } |
|
| 1544 | + else |
|
| 1545 | + { |
|
| 1546 | + display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>"; |
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | |
@@ -1556,15 +1556,15 @@ discard block |
||
| 1556 | 1556 | */ |
| 1557 | 1557 | function display_resources($showdeleteimg) |
| 1558 | 1558 | { |
| 1559 | - global $action; |
|
| 1560 | - global $resourceaction; |
|
| 1561 | - global $id; |
|
| 1562 | - global $locationkey; |
|
| 1563 | - global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 1564 | - |
|
| 1565 | - if ($resourceaction=="removeresource") |
|
| 1566 | - { |
|
| 1567 | - /* unneccessary because when editing we delete all the added resources from the |
|
| 1559 | + global $action; |
|
| 1560 | + global $resourceaction; |
|
| 1561 | + global $id; |
|
| 1562 | + global $locationkey; |
|
| 1563 | + global $source_id, $action, $learnpath_id, $chapter_id, $originalresource; |
|
| 1564 | + |
|
| 1565 | + if ($resourceaction=="removeresource") |
|
| 1566 | + { |
|
| 1567 | + /* unneccessary because when editing we delete all the added resources from the |
|
| 1568 | 1568 | database and add all these from the session |
| 1569 | 1569 | if ($action=="edit") // we have an edit and thus we delete from the database and from the session |
| 1570 | 1570 | { |
@@ -1580,41 +1580,41 @@ discard block |
||
| 1580 | 1580 | } |
| 1581 | 1581 | else // we remove from the session |
| 1582 | 1582 | {*/ |
| 1583 | - //echo "remove from session"; |
|
| 1584 | - remove_resource($locationkey); |
|
| 1585 | - } |
|
| 1586 | - $addedresource=$_SESSION['addedresource']; |
|
| 1587 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1588 | - if (is_array($addedresource)) |
|
| 1589 | - { |
|
| 1590 | - echo '<table>'; |
|
| 1591 | - foreach ($addedresource as $resource) |
|
| 1592 | - { |
|
| 1593 | - //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
| 1594 | - echo '<tr><td>'; |
|
| 1595 | - display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
| 1596 | - echo '</td><td width="30">'; |
|
| 1597 | - |
|
| 1598 | - // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
| 1599 | - // should also contain this id. |
|
| 1600 | - $test=parse_url($_SERVER['REQUEST_URI']); |
|
| 1601 | - $output = array(); |
|
| 1602 | - parse_str($test['query'],$output); |
|
| 1603 | - |
|
| 1604 | - if ($showdeleteimg==1) |
|
| 1605 | - { |
|
| 1606 | - echo "<a href=".api_get_self()."?showresources=true&source_forum=".$_GET['source_forum']."&resourceaction=removeresource&locationkey=".key($addedresource)."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no><img src='../img/delete.gif' border='0' alt='resource ".get_lang('Delete')."' /></a><br />"; |
|
| 1607 | - } |
|
| 1608 | - echo '</td></tr>'; |
|
| 1609 | - next($addedresource); |
|
| 1610 | - //$_SESSION['edit']==''; |
|
| 1611 | - } |
|
| 1612 | - echo '</table>'; |
|
| 1613 | - } |
|
| 1614 | - else // it is a string |
|
| 1615 | - { |
|
| 1616 | - echo ''; |
|
| 1617 | - } |
|
| 1583 | + //echo "remove from session"; |
|
| 1584 | + remove_resource($locationkey); |
|
| 1585 | + } |
|
| 1586 | + $addedresource=$_SESSION['addedresource']; |
|
| 1587 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1588 | + if (is_array($addedresource)) |
|
| 1589 | + { |
|
| 1590 | + echo '<table>'; |
|
| 1591 | + foreach ($addedresource as $resource) |
|
| 1592 | + { |
|
| 1593 | + //echo $resource.":".$addedresourceid[key($addedresource)]; |
|
| 1594 | + echo '<tr><td>'; |
|
| 1595 | + display_addedresource_link($resource,$addedresourceid[key($addedresource)]); |
|
| 1596 | + echo '</td><td width="30">'; |
|
| 1597 | + |
|
| 1598 | + // if $_SERVER['REQUEST_URI'] contains and ?id=xx we have an edit and the url for deleting a session added resource |
|
| 1599 | + // should also contain this id. |
|
| 1600 | + $test=parse_url($_SERVER['REQUEST_URI']); |
|
| 1601 | + $output = array(); |
|
| 1602 | + parse_str($test['query'],$output); |
|
| 1603 | + |
|
| 1604 | + if ($showdeleteimg==1) |
|
| 1605 | + { |
|
| 1606 | + echo "<a href=".api_get_self()."?showresources=true&source_forum=".$_GET['source_forum']."&resourceaction=removeresource&locationkey=".key($addedresource)."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no><img src='../img/delete.gif' border='0' alt='resource ".get_lang('Delete')."' /></a><br />"; |
|
| 1607 | + } |
|
| 1608 | + echo '</td></tr>'; |
|
| 1609 | + next($addedresource); |
|
| 1610 | + //$_SESSION['edit']==''; |
|
| 1611 | + } |
|
| 1612 | + echo '</table>'; |
|
| 1613 | + } |
|
| 1614 | + else // it is a string |
|
| 1615 | + { |
|
| 1616 | + echo ''; |
|
| 1617 | + } |
|
| 1618 | 1618 | } // end of the display_resources function |
| 1619 | 1619 | |
| 1620 | 1620 | |
@@ -1626,49 +1626,49 @@ discard block |
||
| 1626 | 1626 | */ |
| 1627 | 1627 | function showorhide_addresourcelink($type, $id) |
| 1628 | 1628 | { |
| 1629 | - global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
| 1630 | - //global $_SESSION['addresource']; |
|
| 1631 | - //global $_SESSION['addresourceid']; |
|
| 1632 | - $addedresource=$_SESSION['addedresource']; |
|
| 1633 | - $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1634 | - |
|
| 1635 | - if (is_array($_SESSION['addedresource'])) |
|
| 1636 | - { |
|
| 1637 | - foreach ($addedresource as $toolcompare) |
|
| 1638 | - { |
|
| 1639 | - //echo $toolcompare; |
|
| 1640 | - //echo "/".$type."/".$id."****"; |
|
| 1641 | - //$key=key($addedresource); |
|
| 1642 | - //echo $addedresourceid[$key]; |
|
| 1643 | - //print_r($addedresourceid); |
|
| 1644 | - //echo "<br>"; |
|
| 1645 | - |
|
| 1646 | - if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
| 1647 | - { |
|
| 1648 | - $show=0; |
|
| 1649 | - } |
|
| 1650 | - next($addedresource); |
|
| 1651 | - } |
|
| 1652 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1653 | - if ($show!==0) |
|
| 1654 | - { |
|
| 1655 | - if ($type=="Document") |
|
| 1656 | - { |
|
| 1657 | - echo "<a href=".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".$lang_add_it_or_resource."</a>"; |
|
| 1658 | - } |
|
| 1659 | - else |
|
| 1660 | - { |
|
| 1661 | - echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
| 1662 | - } |
|
| 1663 | - } |
|
| 1664 | - } |
|
| 1665 | - else // if it is not an array, it is a string |
|
| 1666 | - { |
|
| 1667 | - if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
| 1668 | - { |
|
| 1669 | - if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1670 | - echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
| 1671 | - } |
|
| 1672 | - } |
|
| 1629 | + global $from_learnpath, $source_id, $action, $learnpath_id, $chapter_id, $originalresource, $folder, $content, $target; |
|
| 1630 | + //global $_SESSION['addresource']; |
|
| 1631 | + //global $_SESSION['addresourceid']; |
|
| 1632 | + $addedresource=$_SESSION['addedresource']; |
|
| 1633 | + $addedresourceid=$_SESSION['addedresourceid']; |
|
| 1634 | + |
|
| 1635 | + if (is_array($_SESSION['addedresource'])) |
|
| 1636 | + { |
|
| 1637 | + foreach ($addedresource as $toolcompare) |
|
| 1638 | + { |
|
| 1639 | + //echo $toolcompare; |
|
| 1640 | + //echo "/".$type."/".$id."****"; |
|
| 1641 | + //$key=key($addedresource); |
|
| 1642 | + //echo $addedresourceid[$key]; |
|
| 1643 | + //print_r($addedresourceid); |
|
| 1644 | + //echo "<br>"; |
|
| 1645 | + |
|
| 1646 | + if ($toolcompare==$type and $addedresourceid[key($addedresource)]==$id) |
|
| 1647 | + { |
|
| 1648 | + $show=0; |
|
| 1649 | + } |
|
| 1650 | + next($addedresource); |
|
| 1651 | + } |
|
| 1652 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1653 | + if ($show!==0) |
|
| 1654 | + { |
|
| 1655 | + if ($type=="Document") |
|
| 1656 | + { |
|
| 1657 | + echo "<a href=".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no>".$lang_add_it_or_resource."</a>"; |
|
| 1658 | + } |
|
| 1659 | + else |
|
| 1660 | + { |
|
| 1661 | + echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
| 1662 | + } |
|
| 1663 | + } |
|
| 1664 | + } |
|
| 1665 | + else // if it is not an array, it is a string |
|
| 1666 | + { |
|
| 1667 | + if ($_SESSION['addedresource']!==$type or $_SESSION['addedresourceid']!==$id) |
|
| 1668 | + { |
|
| 1669 | + if ($from_learnpath) { $lang_add_it_or_resource=get_lang('AddIt'); } else { $lang_add_it_or_resource=get_lang('AddResource'); } |
|
| 1670 | + echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>"; |
|
| 1671 | + } |
|
| 1672 | + } |
|
| 1673 | 1673 | } |
| 1674 | 1674 | ?> |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class CourseSelectForm |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Display the form |
|
| 16 | - * @param array $hidden_fiels Hidden fields to add to the form. |
|
| 17 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
| 18 | - */ |
|
| 19 | - static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
| 14 | + /** |
|
| 15 | + * Display the form |
|
| 16 | + * @param array $hidden_fiels Hidden fields to add to the form. |
|
| 17 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
| 18 | + */ |
|
| 19 | + static function display_form($course, $hidden_fields = null, $avoid_serialize = false) |
|
| 20 | 20 | { |
| 21 | 21 | global $charset; |
| 22 | 22 | $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); |
@@ -134,50 +134,50 @@ discard block |
||
| 134 | 134 | </script> |
| 135 | 135 | <?php |
| 136 | 136 | |
| 137 | - //get destination course title |
|
| 138 | - if (!empty($hidden_fields['destination_course'])) { |
|
| 137 | + //get destination course title |
|
| 138 | + if (!empty($hidden_fields['destination_course'])) { |
|
| 139 | 139 | $sessionTitle = !empty($hidden_fields['destination_session']) ? ' (' . api_get_session_name( |
| 140 | 140 | $hidden_fields['destination_session'] |
| 141 | 141 | ) . ')' : null; |
| 142 | 142 | |
| 143 | 143 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
| 144 | - echo '<h3>'; |
|
| 145 | - echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
| 146 | - echo '</h3>'; |
|
| 147 | - } |
|
| 144 | + echo '<h3>'; |
|
| 145 | + echo get_lang('DestinationCourse').' : '.$course_infos['title'] . ' ('.$course_infos['code'].') '.$sessionTitle; |
|
| 146 | + echo '</h3>'; |
|
| 147 | + } |
|
| 148 | 148 | echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
| 149 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
| 149 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
| 150 | 150 | $icon = Display::returnIconPath('myprogress_bar.gif'); |
| 151 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
| 152 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
| 151 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="javascript: myUpload.start(\'dynamic_div\',\''.$icon.',\''.get_lang('PleaseStandBy', '').'\',\'upload_form\')">'; |
|
| 152 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
| 153 | 153 | |
| 154 | - if (!empty($hidden_fields['destination_course']) && |
|
| 154 | + if (!empty($hidden_fields['destination_course']) && |
|
| 155 | 155 | !empty($hidden_fields['origin_course']) && |
| 156 | 156 | !empty($hidden_fields['destination_session']) && |
| 157 | 157 | !empty($hidden_fields['origin_session']) |
| 158 | 158 | ) { |
| 159 | - echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
| 160 | - echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
| 161 | - echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
| 162 | - echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
| 163 | - } |
|
| 159 | + echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>'; |
|
| 160 | + echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>'; |
|
| 161 | + echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>'; |
|
| 162 | + echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>'; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - $element_count = 0; |
|
| 165 | + $element_count = 0; |
|
| 166 | 166 | $forum_categories = array(); |
| 167 | 167 | $forums = array(); |
| 168 | 168 | $forum_topics = array(); |
| 169 | 169 | |
| 170 | 170 | echo '<p>'; |
| 171 | - echo get_lang('SelectResources'); |
|
| 172 | - echo '</p>'; |
|
| 171 | + echo get_lang('SelectResources'); |
|
| 172 | + echo '</p>'; |
|
| 173 | 173 | |
| 174 | 174 | Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
| 175 | 175 | |
| 176 | 176 | foreach ($course->resources as $type => $resources) { |
| 177 | 177 | if (count($resources) > 0) { |
| 178 | - switch ($type) { |
|
| 179 | - //Resources to avoid |
|
| 180 | - case RESOURCE_FORUMCATEGORY: |
|
| 178 | + switch ($type) { |
|
| 179 | + //Resources to avoid |
|
| 180 | + case RESOURCE_FORUMCATEGORY: |
|
| 181 | 181 | foreach ($resources as $id => $resource) { |
| 182 | 182 | $forum_categories[$id] = $resource; |
| 183 | 183 | } |
@@ -196,49 +196,49 @@ discard block |
||
| 196 | 196 | $element_count++; |
| 197 | 197 | break; |
| 198 | 198 | case RESOURCE_LINKCATEGORY: |
| 199 | - case RESOURCE_FORUMPOST: |
|
| 200 | - case RESOURCE_QUIZQUESTION: |
|
| 201 | - case RESOURCE_SURVEYQUESTION: |
|
| 202 | - case RESOURCE_SURVEYINVITATION: |
|
| 203 | - case RESOURCE_SCORM: |
|
| 204 | - break; |
|
| 199 | + case RESOURCE_FORUMPOST: |
|
| 200 | + case RESOURCE_QUIZQUESTION: |
|
| 201 | + case RESOURCE_SURVEYQUESTION: |
|
| 202 | + case RESOURCE_SURVEYINVITATION: |
|
| 203 | + case RESOURCE_SCORM: |
|
| 204 | + break; |
|
| 205 | 205 | default : |
| 206 | - echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
| 207 | - echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
| 208 | - echo '<div id="div_'.$type.'">'; |
|
| 209 | - if ($type == RESOURCE_LEARNPATH) { |
|
| 210 | - Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
| 211 | - Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
| 212 | - } |
|
| 213 | - if ($type == RESOURCE_DOCUMENT) { |
|
| 206 | + echo '<img id="img_'.$type.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$type'".');" /> '; |
|
| 207 | + echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />'; |
|
| 208 | + echo '<div id="div_'.$type.'">'; |
|
| 209 | + if ($type == RESOURCE_LEARNPATH) { |
|
| 210 | + Display::display_warning_message(get_lang('ToExportLearnpathWithQuizYouHaveToSelectQuiz')); |
|
| 211 | + Display::display_warning_message(get_lang('IfYourLPsHaveAudioFilesIncludedYouShouldSelectThemFromTheDocuments')); |
|
| 212 | + } |
|
| 213 | + if ($type == RESOURCE_DOCUMENT) { |
|
| 214 | 214 | if (api_get_setting('show_glossary_in_documents') != 'none') { |
| 215 | 215 | Display::display_warning_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
| 216 | 216 | } |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - echo '<blockquote>'; |
|
| 219 | + echo '<blockquote>'; |
|
| 220 | 220 | echo '<div class="btn-group">'; |
| 221 | - echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
| 221 | + echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a>"; |
|
| 222 | 222 | echo "<a class=\"btn btn-default\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>"; |
| 223 | - echo '</div><br />'; |
|
| 223 | + echo '</div><br />'; |
|
| 224 | 224 | |
| 225 | - foreach ($resources as $id => $resource) { |
|
| 225 | + foreach ($resources as $id => $resource) { |
|
| 226 | 226 | if ($resource) { |
| 227 | - // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
| 227 | + // Event obj in 1.9.x in 1.10.x the class is CalendarEvent |
|
| 228 | 228 | Coursecopy\Resource::setClassType($resource); |
| 229 | 229 | echo '<label class="checkbox">'; |
| 230 | 230 | echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />'; |
| 231 | 231 | $resource->show(); |
| 232 | 232 | echo '</label>'; |
| 233 | 233 | } |
| 234 | - } |
|
| 235 | - echo '</blockquote>'; |
|
| 236 | - echo '</div>'; |
|
| 237 | - echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
| 238 | - $element_count++; |
|
| 234 | + } |
|
| 235 | + echo '</blockquote>'; |
|
| 236 | + echo '</div>'; |
|
| 237 | + echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
| 238 | + $element_count++; |
|
| 239 | 239 | } |
| 240 | - } |
|
| 241 | - } |
|
| 240 | + } |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | 243 | //Fixes forum order |
| 244 | 244 | if (!empty($forum_categories)) { |
@@ -294,65 +294,65 @@ discard block |
||
| 294 | 294 | echo '<script language="javascript">exp('."'$type'".')</script>'; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if ($avoid_serialize) { |
|
| 298 | - /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
| 297 | + if ($avoid_serialize) { |
|
| 298 | + /*Documents are avoided due the huge amount of memory that the serialize php function "eats" |
|
| 299 | 299 | (when there are directories with hundred/thousand of files) */ |
| 300 | - // this is a known issue of serialize |
|
| 301 | - $course->resources['document']= null; |
|
| 302 | - } |
|
| 300 | + // this is a known issue of serialize |
|
| 301 | + $course->resources['document']= null; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
| 304 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
| 305 | 305 | |
| 306 | - if (is_array($hidden_fields)) { |
|
| 307 | - foreach ($hidden_fields as $key => $value) { |
|
| 308 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
| 309 | - } |
|
| 310 | - } |
|
| 306 | + if (is_array($hidden_fields)) { |
|
| 307 | + foreach ($hidden_fields as $key => $value) { |
|
| 308 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | 312 | $recycleOption = isset($_POST['recycle_option']) ? true : false; |
| 313 | 313 | |
| 314 | - if (empty($element_count)) { |
|
| 315 | - Display::display_warning_message(get_lang('NoDataAvailable')); |
|
| 316 | - } else { |
|
| 317 | - if (!empty($hidden_fields['destination_session'])) { |
|
| 318 | - echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
| 314 | + if (empty($element_count)) { |
|
| 315 | + Display::display_warning_message(get_lang('NoDataAvailable')); |
|
| 316 | + } else { |
|
| 317 | + if (!empty($hidden_fields['destination_session'])) { |
|
| 318 | + echo '<br /><button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES, $charset))."'".')) return false;" >'. |
|
| 319 | 319 | get_lang('Ok').'</button>'; |
| 320 | - } else { |
|
| 320 | + } else { |
|
| 321 | 321 | if ($recycleOption) { |
| 322 | 322 | echo '<br /><button class="save" type="submit">'. |
| 323 | 323 | get_lang('Ok').'</button>'; |
| 324 | 324 | } else { |
| 325 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
| 325 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'. |
|
| 326 | 326 | get_lang('Ok').'</button>'; |
| 327 | 327 | } |
| 328 | - } |
|
| 329 | - } |
|
| 328 | + } |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
| 332 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
| 333 | - echo '</form>'; |
|
| 334 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
| 335 | - } |
|
| 331 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
| 332 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
| 333 | + echo '</form>'; |
|
| 334 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | 338 | * @param $course |
| 339 | 339 | */ |
| 340 | 340 | static function display_hidden_quiz_questions($course) |
| 341 | 341 | { |
| 342 | - if(is_array($course->resources)){ |
|
| 343 | - foreach ($course->resources as $type => $resources) { |
|
| 344 | - if (count($resources) > 0) { |
|
| 345 | - switch ($type) { |
|
| 346 | - case RESOURCE_QUIZQUESTION: |
|
| 347 | - foreach ($resources as $id => $resource) { |
|
| 348 | - echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
| 349 | - } |
|
| 350 | - break; |
|
| 351 | - } |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - } |
|
| 355 | - } |
|
| 342 | + if(is_array($course->resources)){ |
|
| 343 | + foreach ($course->resources as $type => $resources) { |
|
| 344 | + if (count($resources) > 0) { |
|
| 345 | + switch ($type) { |
|
| 346 | + case RESOURCE_QUIZQUESTION: |
|
| 347 | + foreach ($resources as $id => $resource) { |
|
| 348 | + echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; |
|
| 349 | + } |
|
| 350 | + break; |
|
| 351 | + } |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | /** |
| 358 | 358 | * @param $course |
@@ -360,30 +360,30 @@ discard block |
||
| 360 | 360 | static function display_hidden_scorm_directories($course) |
| 361 | 361 | { |
| 362 | 362 | if (is_array($course->resources)){ |
| 363 | - foreach ($course->resources as $type => $resources) { |
|
| 364 | - if (count($resources) > 0) { |
|
| 365 | - switch($type) { |
|
| 366 | - case RESOURCE_SCORM: |
|
| 367 | - foreach ($resources as $id => $resource) { |
|
| 368 | - echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
| 369 | - } |
|
| 370 | - break; |
|
| 371 | - } |
|
| 372 | - } |
|
| 373 | - } |
|
| 374 | - } |
|
| 375 | - } |
|
| 363 | + foreach ($course->resources as $type => $resources) { |
|
| 364 | + if (count($resources) > 0) { |
|
| 365 | + switch($type) { |
|
| 366 | + case RESOURCE_SCORM: |
|
| 367 | + foreach ($resources as $id => $resource) { |
|
| 368 | + echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
| 369 | + } |
|
| 370 | + break; |
|
| 371 | + } |
|
| 372 | + } |
|
| 373 | + } |
|
| 374 | + } |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | - /** |
|
| 378 | - * Get the posted course |
|
| 379 | - * @param string $from who calls the function? |
|
| 377 | + /** |
|
| 378 | + * Get the posted course |
|
| 379 | + * @param string $from who calls the function? |
|
| 380 | 380 | * It can be copy_course, create_backup, import_backup or recycle_course |
| 381 | 381 | * @param int $session_id |
| 382 | 382 | * @param string $course_code |
| 383 | - * @return course The course-object with all resources selected by the user |
|
| 384 | - * in the form given by display_form(...) |
|
| 385 | - */ |
|
| 386 | - public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
| 383 | + * @return course The course-object with all resources selected by the user |
|
| 384 | + * in the form given by display_form(...) |
|
| 385 | + */ |
|
| 386 | + public static function get_posted_course($from = '', $session_id = 0, $course_code = '') |
|
| 387 | 387 | { |
| 388 | 388 | $course = null; |
| 389 | 389 | |
@@ -393,30 +393,30 @@ discard block |
||
| 393 | 393 | return false; |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - // Create the resource DOCUMENT objects |
|
| 397 | - // Loading the results from the checkboxes of ethe javascript |
|
| 398 | - $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
| 396 | + // Create the resource DOCUMENT objects |
|
| 397 | + // Loading the results from the checkboxes of ethe javascript |
|
| 398 | + $resource = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
| 399 | 399 | |
| 400 | - $course_info = api_get_course_info($course_code); |
|
| 401 | - $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
| 402 | - $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
| 403 | - $course_id = $course_info['real_id']; |
|
| 400 | + $course_info = api_get_course_info($course_code); |
|
| 401 | + $table_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
| 402 | + $table_prop = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
| 403 | + $course_id = $course_info['real_id']; |
|
| 404 | 404 | |
| 405 | - /* Searching the documents resource that have been set to null because |
|
| 405 | + /* Searching the documents resource that have been set to null because |
|
| 406 | 406 | $avoid_serialize is true in the display_form() function*/ |
| 407 | - if ($from == 'copy_course') { |
|
| 408 | - if (is_array($resource)) { |
|
| 409 | - $resource = array_keys($resource); |
|
| 407 | + if ($from == 'copy_course') { |
|
| 408 | + if (is_array($resource)) { |
|
| 409 | + $resource = array_keys($resource); |
|
| 410 | 410 | |
| 411 | - foreach ($resource as $resource_item) { |
|
| 411 | + foreach ($resource as $resource_item) { |
|
| 412 | 412 | |
| 413 | - $condition_session = ''; |
|
| 414 | - if (!empty($session_id)) { |
|
| 415 | - $session_id = intval($session_id); |
|
| 416 | - $condition_session = ' AND d.session_id ='.$session_id; |
|
| 417 | - } |
|
| 413 | + $condition_session = ''; |
|
| 414 | + if (!empty($session_id)) { |
|
| 415 | + $session_id = intval($session_id); |
|
| 416 | + $condition_session = ' AND d.session_id ='.$session_id; |
|
| 417 | + } |
|
| 418 | 418 | |
| 419 | - $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
| 419 | + $sql = 'SELECT d.id, d.path, d.comment, d.title, d.filetype, d.size |
|
| 420 | 420 | FROM '.$table_doc.' d, '.$table_prop.' p |
| 421 | 421 | WHERE |
| 422 | 422 | d.c_id = '.$course_id.' AND |
@@ -425,8 +425,8 @@ discard block |
||
| 425 | 425 | p.ref = d.id AND p.visibility != 2 AND |
| 426 | 426 | d.id = '.$resource_item.$condition_session.' |
| 427 | 427 | ORDER BY path'; |
| 428 | - $db_result = Database::query($sql); |
|
| 429 | - while ($obj = Database::fetch_object($db_result)) { |
|
| 428 | + $db_result = Database::query($sql); |
|
| 429 | + while ($obj = Database::fetch_object($db_result)) { |
|
| 430 | 430 | $doc = new Document( |
| 431 | 431 | $obj->id, |
| 432 | 432 | $obj->path, |
@@ -450,25 +450,25 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | $course->resources[RESOURCE_DOCUMENT][$resource_item]->item_properties = $all_properties; |
| 452 | 452 | } |
| 453 | - } |
|
| 454 | - } |
|
| 455 | - } |
|
| 456 | - } |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + } |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | - if (is_array($course->resources)) { |
|
| 459 | - foreach ($course->resources as $type => $resources) { |
|
| 458 | + if (is_array($course->resources)) { |
|
| 459 | + foreach ($course->resources as $type => $resources) { |
|
| 460 | 460 | |
| 461 | - switch ($type) { |
|
| 462 | - case RESOURCE_SURVEYQUESTION: |
|
| 463 | - foreach($resources as $id => $obj) { |
|
| 464 | - if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
| 461 | + switch ($type) { |
|
| 462 | + case RESOURCE_SURVEYQUESTION: |
|
| 463 | + foreach($resources as $id => $obj) { |
|
| 464 | + if (isset($_POST['resource'][RESOURCE_SURVEY]) && |
|
| 465 | 465 | is_array($_POST['resource'][RESOURCE_SURVEY]) && |
| 466 | 466 | !in_array($obj->survey_id, array_keys($_POST['resource'][RESOURCE_SURVEY])) |
| 467 | 467 | ) { |
| 468 | - unset($course->resources[$type][$id]); |
|
| 469 | - } |
|
| 470 | - } |
|
| 471 | - break; |
|
| 468 | + unset($course->resources[$type][$id]); |
|
| 469 | + } |
|
| 470 | + } |
|
| 471 | + break; |
|
| 472 | 472 | case RESOURCE_FORUMTOPIC: |
| 473 | 473 | case RESOURCE_FORUMPOST: |
| 474 | 474 | //Add post from topic |
@@ -520,62 +520,62 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | - case RESOURCE_LINKCATEGORY : |
|
| 524 | - case RESOURCE_FORUMCATEGORY : |
|
| 525 | - case RESOURCE_QUIZQUESTION : |
|
| 526 | - case RESOURCE_DOCUMENT: |
|
| 527 | - // Mark folders to import which are not selected by the user to import, |
|
| 528 | - // but in which a document was selected. |
|
| 529 | - $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
| 530 | - if (!empty($resources) && is_array($resources)) |
|
| 531 | - foreach ($resources as $id => $obj) { |
|
| 532 | - if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
| 523 | + case RESOURCE_LINKCATEGORY : |
|
| 524 | + case RESOURCE_FORUMCATEGORY : |
|
| 525 | + case RESOURCE_QUIZQUESTION : |
|
| 526 | + case RESOURCE_DOCUMENT: |
|
| 527 | + // Mark folders to import which are not selected by the user to import, |
|
| 528 | + // but in which a document was selected. |
|
| 529 | + $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
|
| 530 | + if (!empty($resources) && is_array($resources)) |
|
| 531 | + foreach ($resources as $id => $obj) { |
|
| 532 | + if (isset($obj->file_type) && $obj->file_type == 'folder' && |
|
| 533 | 533 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
| 534 | 534 | is_array($documents) |
| 535 | 535 | ) { |
| 536 | - foreach ($documents as $id_to_check => $post_value) { |
|
| 537 | - $obj_to_check = $resources[$id_to_check]; |
|
| 538 | - $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
| 539 | - if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
| 540 | - $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
| 541 | - break; |
|
| 542 | - } |
|
| 543 | - } |
|
| 544 | - } |
|
| 545 | - } |
|
| 546 | - default : |
|
| 547 | - if (!empty($resources) && is_array($resources)) { |
|
| 548 | - foreach ($resources as $id => $obj) { |
|
| 549 | - $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
| 550 | - // check if document is in a quiz (audio/video) |
|
| 551 | - if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
| 552 | - foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
| 536 | + foreach ($documents as $id_to_check => $post_value) { |
|
| 537 | + $obj_to_check = $resources[$id_to_check]; |
|
| 538 | + $shared_path_part = substr($obj_to_check->path,0,strlen($obj->path)); |
|
| 539 | + if ($id_to_check != $id && $obj->path == $shared_path_part) { |
|
| 540 | + $_POST['resource'][RESOURCE_DOCUMENT][$id] = 1; |
|
| 541 | + break; |
|
| 542 | + } |
|
| 543 | + } |
|
| 544 | + } |
|
| 545 | + } |
|
| 546 | + default : |
|
| 547 | + if (!empty($resources) && is_array($resources)) { |
|
| 548 | + foreach ($resources as $id => $obj) { |
|
| 549 | + $resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
| 550 | + // check if document is in a quiz (audio/video) |
|
| 551 | + if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
| 552 | + foreach($course->resources[RESOURCE_QUIZ] as $quiz) { |
|
| 553 | 553 | $quiz = $quiz->obj; |
| 554 | - if (isset($quiz->media) && $quiz->media == $id) { |
|
| 555 | - $resource_is_used_elsewhere = true; |
|
| 556 | - } |
|
| 557 | - } |
|
| 558 | - } |
|
| 559 | - if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
| 560 | - unset($course->resources[$type][$id]); |
|
| 561 | - } |
|
| 562 | - } |
|
| 563 | - } |
|
| 564 | - } |
|
| 565 | - } |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - return $course; |
|
| 569 | - } |
|
| 570 | - |
|
| 571 | - /** |
|
| 572 | - * Display the form session export |
|
| 573 | - * @param array $hidden_fiels Hidden fields to add to the form. |
|
| 574 | - * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
| 575 | - */ |
|
| 576 | - public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
| 577 | - { |
|
| 578 | - ?> |
|
| 554 | + if (isset($quiz->media) && $quiz->media == $id) { |
|
| 555 | + $resource_is_used_elsewhere = true; |
|
| 556 | + } |
|
| 557 | + } |
|
| 558 | + } |
|
| 559 | + if (!isset($_POST['resource'][$type][$id]) && !$resource_is_used_elsewhere) { |
|
| 560 | + unset($course->resources[$type][$id]); |
|
| 561 | + } |
|
| 562 | + } |
|
| 563 | + } |
|
| 564 | + } |
|
| 565 | + } |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + return $course; |
|
| 569 | + } |
|
| 570 | + |
|
| 571 | + /** |
|
| 572 | + * Display the form session export |
|
| 573 | + * @param array $hidden_fiels Hidden fields to add to the form. |
|
| 574 | + * @param boolean the document array will be serialize. This is used in the course_copy.php file |
|
| 575 | + */ |
|
| 576 | + public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false) |
|
| 577 | + { |
|
| 578 | + ?> |
|
| 579 | 579 | <script> |
| 580 | 580 | function exp(item) { |
| 581 | 581 | el = document.getElementById('div_'+item); |
@@ -617,65 +617,65 @@ discard block |
||
| 617 | 617 | </script> |
| 618 | 618 | <?php |
| 619 | 619 | |
| 620 | - //get destination course title |
|
| 621 | - if(!empty($hidden_fields['destination_course'])) { |
|
| 622 | - if (!empty($hidden_fields['destination_session'])) { |
|
| 623 | - $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
| 624 | - } else { |
|
| 625 | - $sessionTitle = null; |
|
| 626 | - } |
|
| 620 | + //get destination course title |
|
| 621 | + if(!empty($hidden_fields['destination_course'])) { |
|
| 622 | + if (!empty($hidden_fields['destination_session'])) { |
|
| 623 | + $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')'; |
|
| 624 | + } else { |
|
| 625 | + $sessionTitle = null; |
|
| 626 | + } |
|
| 627 | 627 | $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']); |
| 628 | - echo '<h3>'; |
|
| 629 | - echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
| 630 | - echo '</h3>'; |
|
| 631 | - } |
|
| 628 | + echo '<h3>'; |
|
| 629 | + echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle; |
|
| 630 | + echo '</h3>'; |
|
| 631 | + } |
|
| 632 | 632 | |
| 633 | - echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
| 634 | - echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
| 633 | + echo '<script src="'.api_get_path(WEB_CODE_PATH).'inc/lib/javascript/upload.js" type="text/javascript"></script>'; |
|
| 634 | + echo '<script type="text/javascript">var myUpload = new upload(1000);</script>'; |
|
| 635 | 635 | $icon = Display::returnIconPath('progress_bar.gif'); |
| 636 | - echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
| 637 | - echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
| 638 | - foreach ($list_course as $course){ |
|
| 639 | - foreach ($course->resources as $type => $resources) { |
|
| 640 | - if (count($resources) > 0) { |
|
| 641 | - echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
| 642 | - echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
| 643 | - echo '<div id="div_'.$course->code.'">'; |
|
| 644 | - echo '<blockquote>'; |
|
| 636 | + echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\''.$icon.'\',\''.get_lang('PleaseStandBy').'\',\'upload_form\')">'; |
|
| 637 | + echo '<input type="hidden" name="action" value="course_select_form"/>'; |
|
| 638 | + foreach ($list_course as $course){ |
|
| 639 | + foreach ($course->resources as $type => $resources) { |
|
| 640 | + if (count($resources) > 0) { |
|
| 641 | + echo '<img id="img_'.$course->code.'" src="'.Display::returnIconPath('1.gif').'" onclick="javascript:exp('."'$course->code'".');" />'; |
|
| 642 | + echo '<b onclick="javascript:exp('."'$course->code'".');" > '.$course->code.'</b><br />'; |
|
| 643 | + echo '<div id="div_'.$course->code.'">'; |
|
| 644 | + echo '<blockquote>'; |
|
| 645 | 645 | |
| 646 | 646 | echo '<div class="btn-group">'; |
| 647 | - echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
| 647 | + echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',true);\" >".get_lang('All')."</a>"; |
|
| 648 | 648 | echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('".$course->code."',false);\" >".get_lang('None')."</a>"; |
| 649 | - echo '</div><br />'; |
|
| 649 | + echo '</div><br />'; |
|
| 650 | 650 | |
| 651 | - foreach ($resources as $id => $resource) { |
|
| 652 | - echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
| 651 | + foreach ($resources as $id => $resource) { |
|
| 652 | + echo '<label class="checkbox" for="resource['.$course->code.']['.$id.']">'; |
|
| 653 | 653 | echo '<input type="checkbox" name="resource['.$course->code.']['.$id.']" id="resource['.$course->code.']['.$id.']"/>'; |
| 654 | - $resource->show(); |
|
| 655 | - echo '</label>'; |
|
| 656 | - } |
|
| 657 | - echo '</blockquote>'; |
|
| 658 | - echo '</div>'; |
|
| 659 | - echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
| 660 | - } |
|
| 661 | - } |
|
| 662 | - } |
|
| 663 | - if ($avoid_serialize) { |
|
| 664 | - //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
| 665 | - // this is a known issue of serialize |
|
| 666 | - $course->resources['document']= null; |
|
| 667 | - } |
|
| 668 | - echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
| 669 | - if (is_array($hidden_fields)) { |
|
| 670 | - foreach ($hidden_fields as $key => $value) { |
|
| 671 | - echo "\n"; |
|
| 672 | - echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
| 673 | - } |
|
| 674 | - } |
|
| 675 | - echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
| 676 | - CourseSelectForm :: display_hidden_quiz_questions($course); |
|
| 677 | - CourseSelectForm :: display_hidden_scorm_directories($course); |
|
| 678 | - echo '</form>'; |
|
| 679 | - echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
| 680 | - } |
|
| 654 | + $resource->show(); |
|
| 655 | + echo '</label>'; |
|
| 656 | + } |
|
| 657 | + echo '</blockquote>'; |
|
| 658 | + echo '</div>'; |
|
| 659 | + echo '<script type="text/javascript">exp('."'$course->code'".')</script>'; |
|
| 660 | + } |
|
| 661 | + } |
|
| 662 | + } |
|
| 663 | + if ($avoid_serialize) { |
|
| 664 | + //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) |
|
| 665 | + // this is a known issue of serialize |
|
| 666 | + $course->resources['document']= null; |
|
| 667 | + } |
|
| 668 | + echo '<input type="hidden" name="course" value="'.base64_encode(Course::serialize($course)).'"/>'; |
|
| 669 | + if (is_array($hidden_fields)) { |
|
| 670 | + foreach ($hidden_fields as $key => $value) { |
|
| 671 | + echo "\n"; |
|
| 672 | + echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; |
|
| 673 | + } |
|
| 674 | + } |
|
| 675 | + echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; |
|
| 676 | + CourseSelectForm :: display_hidden_quiz_questions($course); |
|
| 677 | + CourseSelectForm :: display_hidden_scorm_directories($course); |
|
| 678 | + echo '</form>'; |
|
| 679 | + echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
| 680 | + } |
|
| 681 | 681 | } |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | $course_code = Database::escape_string($course_code); |
| 78 | 78 | if (!empty($link_id)) { |
| 79 | 79 | $link_id = intval($link_id); |
| 80 | - $sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . ' |
|
| 81 | - SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . ' |
|
| 82 | - WHERE course_code = "' . $course_code . '" AND id = ' . $link_id; |
|
| 80 | + $sql = 'UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).' |
|
| 81 | + SET weight = ' . "'".Database::escape_string((float) $weight)."'".' |
|
| 82 | + WHERE course_code = "' . $course_code.'" AND id = '.$link_id; |
|
| 83 | 83 | Database::query($sql); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // TODO find the corresponding category (the first one for this course, ordered by ID) |
| 101 | 101 | $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
| 102 | - $sql = "DELETE FROM $l WHERE id = ".(int)$link_id; |
|
| 102 | + $sql = "DELETE FROM $l WHERE id = ".(int) $link_id; |
|
| 103 | 103 | Database::query($sql); |
| 104 | 104 | |
| 105 | 105 | return true; |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible'; |
| 196 | 196 | $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible'; |
| 197 | 197 | |
| 198 | - $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . |
|
| 199 | - Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 198 | + $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'. |
|
| 199 | + Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 200 | 200 | |
| 201 | 201 | if (!api_is_allowed_to_edit(null, true)) { |
| 202 | 202 | $modify_icons .= Display::url( |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | '', |
| 207 | 207 | ICON_SIZE_SMALL |
| 208 | 208 | ), |
| 209 | - 'personal_stats.php?' . http_build_query([ |
|
| 209 | + 'personal_stats.php?'.http_build_query([ |
|
| 210 | 210 | 'selectcat' => $cat->get_id() |
| 211 | - ]) . '&' . api_get_cidreq(), |
|
| 211 | + ]).'&'.api_get_cidreq(), |
|
| 212 | 212 | [ |
| 213 | 213 | 'class' => 'ajax', |
| 214 | 214 | 'data-title' => get_lang('FlatView') |
@@ -222,16 +222,16 @@ discard block |
||
| 222 | 222 | if (api_get_setting('gradebook_locking_enabled') == 'true') { |
| 223 | 223 | if ($cat->is_locked()) { |
| 224 | 224 | if (api_is_platform_admin()) { |
| 225 | - $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">' . |
|
| 226 | - Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 225 | + $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">'. |
|
| 226 | + Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 227 | 227 | } else { |
| 228 | - $modify_icons .= ' <a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 228 | + $modify_icons .= ' <a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 229 | 229 | } |
| 230 | - $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>'; |
|
| 230 | + $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>'; |
|
| 231 | 231 | } else { |
| 232 | - $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">' . |
|
| 233 | - Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 234 | - $modify_icons .= ' <a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 232 | + $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">'. |
|
| 233 | + Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 234 | + $modify_icons .= ' <a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -239,44 +239,44 @@ discard block |
||
| 239 | 239 | if ($cat->is_locked() && !api_is_platform_admin()) { |
| 240 | 240 | $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
| 241 | 241 | } else { |
| 242 | - $modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
| 242 | + $modify_icons .= '<a href="gradebook_edit_cat.php?'.'editcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
| 243 | 243 | Display::return_icon( |
| 244 | 244 | 'edit.png', |
| 245 | 245 | get_lang('Modify'), |
| 246 | 246 | '', |
| 247 | 247 | ICON_SIZE_SMALL |
| 248 | - ) . '</a>'; |
|
| 248 | + ).'</a>'; |
|
| 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'), |
| 256 | 256 | '', |
| 257 | 257 | ICON_SIZE_SMALL |
| 258 | - ) . '</a>'; |
|
| 258 | + ).'</a>'; |
|
| 259 | 259 | |
| 260 | - $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
| 260 | + $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
| 261 | 261 | Display::return_icon( |
| 262 | 262 | 'stats.png', |
| 263 | 263 | get_lang('FlatView'), |
| 264 | 264 | '', |
| 265 | 265 | ICON_SIZE_SMALL |
| 266 | - ) . '</a>'; |
|
| 267 | - $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(). '">' . |
|
| 266 | + ).'</a>'; |
|
| 267 | + $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().'">'. |
|
| 268 | 268 | Display::return_icon( |
| 269 | - $visibility_icon . '.png', |
|
| 269 | + $visibility_icon.'.png', |
|
| 270 | 270 | get_lang('Visible'), |
| 271 | 271 | '', |
| 272 | 272 | ICON_SIZE_SMALL |
| 273 | - ) . '</a>'; |
|
| 273 | + ).'</a>'; |
|
| 274 | 274 | |
| 275 | 275 | if ($cat->is_locked() && !api_is_platform_admin()) { |
| 276 | 276 | $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL); |
| 277 | 277 | } else { |
| 278 | - $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();">' . |
|
| 279 | - Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 278 | + $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();">'. |
|
| 279 | + Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 280 | 280 | } |
| 281 | 281 | } |
| 282 | 282 | |
@@ -303,21 +303,21 @@ discard block |
||
| 303 | 303 | if ($is_locked && !api_is_platform_admin()) { |
| 304 | 304 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
| 305 | 305 | } else { |
| 306 | - $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
| 307 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 306 | + $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
| 307 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' . |
|
| 311 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 310 | + $modify_icons .= ' <a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$eval->getSessionId().' ">'. |
|
| 311 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 312 | 312 | if (api_is_allowed_to_edit(null, true)) { |
| 313 | - $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
| 314 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 313 | + $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
| 314 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | if ($is_locked && !api_is_platform_admin()) { |
| 318 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
| 318 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
| 319 | 319 | } else { |
| 320 | - $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>'; |
|
| 320 | + $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>'; |
|
| 321 | 321 | } |
| 322 | 322 | return $modify_icons; |
| 323 | 323 | } |
@@ -347,21 +347,21 @@ discard block |
||
| 347 | 347 | if ($is_locked && !api_is_platform_admin()) { |
| 348 | 348 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
| 349 | 349 | } else { |
| 350 | - $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' . |
|
| 351 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 350 | + $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
| 351 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 352 | 352 | } |
| 353 | - $modify_icons .= ' <a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' . |
|
| 354 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 355 | - $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(). '">' . |
|
| 356 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 353 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$link->get_session_id().' ">'. |
|
| 354 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 355 | + $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().'">'. |
|
| 356 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 357 | 357 | |
| 358 | 358 | //If a work is added in a gradebook you can only delete the link in the work tool |
| 359 | 359 | |
| 360 | 360 | if ($is_locked && !api_is_platform_admin()) { |
| 361 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
| 361 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
| 362 | 362 | } else { |
| 363 | - $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();">' . |
|
| 364 | - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 363 | + $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();">'. |
|
| 364 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 365 | 365 | } |
| 366 | 366 | return $modify_icons; |
| 367 | 367 | } |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | $sql = "SELECT * FROM $table l |
| 383 | 383 | WHERE |
| 384 | 384 | course_code = '$course_code' AND |
| 385 | - type = ".(int)$resource_type . " AND |
|
| 386 | - ref_id = " . (int)$resource_id; |
|
| 385 | + type = ".(int) $resource_type." AND |
|
| 386 | + ref_id = " . (int) $resource_id; |
|
| 387 | 387 | $res = Database::query($sql); |
| 388 | 388 | |
| 389 | 389 | if (Database::num_rows($res) < 1) { |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | // TODO find the corresponding category (the first one for this course, ordered by ID) |
| 407 | 407 | $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
| 408 | - $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id; |
|
| 408 | + $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id; |
|
| 409 | 409 | $res = Database::query($sql); |
| 410 | 410 | $row = array(); |
| 411 | 411 | if (Database::num_rows($res) > 0) { |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | { |
| 424 | 424 | $course_table = Database::get_main_table(TABLE_MAIN_COURSE); |
| 425 | 425 | $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
| 426 | - $sql = 'SELECT c.id FROM ' . $course_table . ' c |
|
| 427 | - INNER JOIN ' . $tbl_grade_links . ' l |
|
| 426 | + $sql = 'SELECT c.id FROM '.$course_table.' c |
|
| 427 | + INNER JOIN ' . $tbl_grade_links.' l |
|
| 428 | 428 | ON c.code = l.course_code |
| 429 | - WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link); |
|
| 429 | + WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link); |
|
| 430 | 430 | $res = Database::query($sql); |
| 431 | 431 | $array = Database::fetch_array($res, 'ASSOC'); |
| 432 | 432 | return $array['id']; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | { |
| 536 | 536 | $result = Result :: load($resid); |
| 537 | 537 | if ($importscore > $eval_max) { |
| 538 | - header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax='); |
|
| 538 | + header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax='); |
|
| 539 | 539 | exit; |
| 540 | 540 | } |
| 541 | 541 | $result[0]->set_score($importscore); |
@@ -576,8 +576,8 @@ discard block |
||
| 576 | 576 | { |
| 577 | 577 | $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
| 578 | 578 | $sql = 'SELECT COUNT(*) as count |
| 579 | - FROM ' . $table . ' gc |
|
| 580 | - WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" '; |
|
| 579 | + FROM ' . $table.' gc |
|
| 580 | + WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" '; |
|
| 581 | 581 | $rs_exist = Database::query($sql); |
| 582 | 582 | $row = Database::fetch_array($rs_exist); |
| 583 | 583 | if ($row['count'] == 0) { |
@@ -600,8 +600,8 @@ discard block |
||
| 600 | 600 | public static function get_certificate_by_user_id($cat_id, $user_id) |
| 601 | 601 | { |
| 602 | 602 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
| 603 | - $sql = 'SELECT * FROM ' . $table_certificate . ' |
|
| 604 | - WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; |
|
| 603 | + $sql = 'SELECT * FROM '.$table_certificate.' |
|
| 604 | + WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"'; |
|
| 605 | 605 | |
| 606 | 606 | $result = Database::query($sql); |
| 607 | 607 | $row = Database::fetch_array($result, 'ASSOC'); |
@@ -620,18 +620,18 @@ discard block |
||
| 620 | 620 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
| 621 | 621 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
| 622 | 622 | $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username |
| 623 | - FROM ' . $table_user . ' u |
|
| 624 | - INNER JOIN ' . $table_certificate . ' gc |
|
| 623 | + FROM ' . $table_user.' u |
|
| 624 | + INNER JOIN ' . $table_certificate.' gc |
|
| 625 | 625 | ON u.user_id=gc.user_id '; |
| 626 | 626 | if (!is_null($cat_id) && $cat_id > 0) { |
| 627 | - $sql.=' WHERE cat_id=' . intval($cat_id); |
|
| 627 | + $sql .= ' WHERE cat_id='.intval($cat_id); |
|
| 628 | 628 | } |
| 629 | 629 | if (!empty($userList)) { |
| 630 | 630 | $userList = array_map('intval', $userList); |
| 631 | 631 | $userListCondition = implode("','", $userList); |
| 632 | 632 | $sql .= " AND u.user_id IN ('$userListCondition')"; |
| 633 | 633 | } |
| 634 | - $sql.=' ORDER BY u.firstname'; |
|
| 634 | + $sql .= ' ORDER BY u.firstname'; |
|
| 635 | 635 | $rs = Database::query($sql); |
| 636 | 636 | |
| 637 | 637 | $list_users = array(); |
@@ -652,10 +652,10 @@ discard block |
||
| 652 | 652 | { |
| 653 | 653 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
| 654 | 654 | $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id |
| 655 | - FROM ' . $table_certificate . ' gc |
|
| 656 | - WHERE gc.user_id="' . intval($user_id) . '" '; |
|
| 655 | + FROM ' . $table_certificate.' gc |
|
| 656 | + WHERE gc.user_id="' . intval($user_id).'" '; |
|
| 657 | 657 | if (!is_null($cat_id) && $cat_id > 0) { |
| 658 | - $sql.=' AND cat_id=' . intval($cat_id); |
|
| 658 | + $sql .= ' AND cat_id='.intval($cat_id); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | $rs = Database::query($sql); |
@@ -693,12 +693,12 @@ discard block |
||
| 693 | 693 | $variables = $content_html['variables']; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery'; |
|
| 696 | + $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery'; |
|
| 697 | 697 | $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html); |
| 698 | 698 | |
| 699 | - $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document'; |
|
| 699 | + $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; |
|
| 700 | 700 | $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html); |
| 701 | - $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
| 701 | + $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
| 702 | 702 | |
| 703 | 703 | //add print header |
| 704 | 704 | if ($hide_print_button == false) { |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | // Add header |
| 712 | - $new_content_html = $contentHead. $print . '</head>' . $new_content_html; |
|
| 712 | + $new_content_html = $contentHead.$print.'</head>'.$new_content_html; |
|
| 713 | 713 | |
| 714 | 714 | return array( |
| 715 | 715 | 'content' => $new_content_html, |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | $session_id = api_get_session_id(); |
| 732 | 732 | |
| 733 | 733 | $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
| 734 | - $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' "; |
|
| 734 | + $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' "; |
|
| 735 | 735 | if (!empty($session_id)) { |
| 736 | - $sql .= " AND session_id = " . (int) $session_id; |
|
| 736 | + $sql .= " AND session_id = ".(int) $session_id; |
|
| 737 | 737 | } else { |
| 738 | 738 | $sql .= " AND (session_id IS NULL OR session_id = 0) "; |
| 739 | 739 | } |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | if (!empty($session_id)) { |
| 746 | 746 | $my_session_id = api_get_session_id(); |
| 747 | 747 | $s_name = api_get_session_name($my_session_id); |
| 748 | - $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name); |
|
| 748 | + $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name); |
|
| 749 | 749 | $cat->set_session_id($session_id); |
| 750 | 750 | } else { |
| 751 | 751 | $cat->set_name($course_code); |
@@ -867,13 +867,13 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | if ($use_grade_model) { |
| 869 | 869 | if ($parent_id == 0) { |
| 870 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
| 870 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
| 871 | 871 | } else { |
| 872 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; |
|
| 872 | + $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')'; |
|
| 873 | 873 | } |
| 874 | 874 | } else { |
| 875 | 875 | if ($parent_id == 0) { |
| 876 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
| 876 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
| 877 | 877 | } else { |
| 878 | 878 | $title = api_strtoupper(get_lang('Average')); |
| 879 | 879 | } |
@@ -927,11 +927,11 @@ discard block |
||
| 927 | 927 | } else { |
| 928 | 928 | $column = 0; |
| 929 | 929 | $table->setCellContents($row, $column, get_lang('NoResults')); |
| 930 | - $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); |
|
| 930 | + $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | $pdfParams = array( |
| 934 | - 'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), |
|
| 934 | + 'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(), |
|
| 935 | 935 | 'pdf_title' => $title, |
| 936 | 936 | 'course_code' => $course_code, |
| 937 | 937 | 'add_signatures' => true |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | $a_students = array(); |
| 1017 | 1017 | while ($user = Database::fetch_array($result)) { |
| 1018 | 1018 | if (!array_key_exists($user['user_id'], $a_students)) { |
| 1019 | - $a_current_student = array (); |
|
| 1019 | + $a_current_student = array(); |
|
| 1020 | 1020 | $a_current_student[] = $user['user_id']; |
| 1021 | 1021 | $a_current_student[] = $user['username']; |
| 1022 | 1022 | $a_current_student[] = $user['lastname']; |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | foreach ($links as $link) { |
| 1075 | 1075 | // links are always in a course |
| 1076 | 1076 | $coursecode = $link->get_course_code(); |
| 1077 | - if (!array_key_exists($coursecode,$coursecodes)) { |
|
| 1077 | + if (!array_key_exists($coursecode, $coursecodes)) { |
|
| 1078 | 1078 | $coursecodes[$coursecode] = '1'; |
| 1079 | 1079 | $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode)); |
| 1080 | 1080 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | * Search students matching a given last name and/or first name |
| 1088 | 1088 | * @author Bert Steppé |
| 1089 | 1089 | */ |
| 1090 | - public static function find_students($mask= '') |
|
| 1090 | + public static function find_students($mask = '') |
|
| 1091 | 1091 | { |
| 1092 | 1092 | // students shouldn't be here // don't search if mask empty |
| 1093 | 1093 | if (!api_is_allowed_to_edit() || empty ($mask)) { |
@@ -1098,23 +1098,23 @@ discard block |
||
| 1098 | 1098 | $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
| 1099 | 1099 | $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
| 1100 | 1100 | $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code |
| 1101 | - FROM ' . $tbl_user . ' user'; |
|
| 1101 | + FROM ' . $tbl_user.' user'; |
|
| 1102 | 1102 | if (!api_is_platform_admin()) { |
| 1103 | - $sql .= ', ' . $tbl_cru . ' cru'; |
|
| 1103 | + $sql .= ', '.$tbl_cru.' cru'; |
|
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 1106 | - $sql .= ' WHERE user.status = ' . STUDENT; |
|
| 1107 | - $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'"; |
|
| 1108 | - $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')"; |
|
| 1106 | + $sql .= ' WHERE user.status = '.STUDENT; |
|
| 1107 | + $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'"; |
|
| 1108 | + $sql .= ' OR user.firstname LIKE '."'%".$mask."%')"; |
|
| 1109 | 1109 | |
| 1110 | 1110 | if (!api_is_platform_admin()) { |
| 1111 | 1111 | $sql .= ' AND user.user_id = cru.user_id AND |
| 1112 | 1112 | cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND |
| 1113 | 1113 | cru.c_id in ( |
| 1114 | - SELECT c_id FROM '.$tbl_cru . ' |
|
| 1114 | + SELECT c_id FROM '.$tbl_cru.' |
|
| 1115 | 1115 | WHERE |
| 1116 | - user_id = ' . api_get_user_id() . ' AND |
|
| 1117 | - status = ' . COURSEMANAGER . ' |
|
| 1116 | + user_id = ' . api_get_user_id().' AND |
|
| 1117 | + status = ' . COURSEMANAGER.' |
|
| 1118 | 1118 | ) |
| 1119 | 1119 | '; |
| 1120 | 1120 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | $sql = 'SELECT ref_id FROM '.$table_link.' |
| 1158 | 1158 | WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE; |
| 1159 | 1159 | |
| 1160 | - $rs_attendance = Database::query($sql); |
|
| 1160 | + $rs_attendance = Database::query($sql); |
|
| 1161 | 1161 | if (Database::num_rows($rs_attendance) > 0) { |
| 1162 | 1162 | $row_attendance = Database::fetch_array($rs_attendance); |
| 1163 | 1163 | $sql = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.$weight.' |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | 'course' => $courseInfo['title'], |
| 1244 | 1244 | 'score' => $certificateInfo['score_certificate'], |
| 1245 | 1245 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
| 1246 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
| 1246 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
| 1247 | 1247 | ]; |
| 1248 | 1248 | } |
| 1249 | 1249 | |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | 'course' => $course['title'], |
| 1308 | 1308 | 'score' => $certificateInfo['score_certificate'], |
| 1309 | 1309 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
| 1310 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
| 1310 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
| 1311 | 1311 | ]; |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
@@ -20,37 +20,37 @@ discard block |
||
| 20 | 20 | if (api_is_allowed_to_edit(null, true)) { |
| 21 | 21 | $header = '<div class="actions">'; |
| 22 | 22 | if ($page != 'statistics') { |
| 23 | - $header .= '<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&'.api_get_cidreq().'">' . |
|
| 24 | - Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 23 | + $header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'&'.api_get_cidreq().'">'. |
|
| 24 | + Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 25 | 25 | if ($evalobj->get_course_code() == null) { |
| 26 | 26 | |
| 27 | 27 | } elseif (!$evalobj->has_results()) { |
| 28 | - $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat=' . $selectcat . '&selecteval=' . $evalobj->get_id() . '"> |
|
| 29 | - ' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 28 | + $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat='.$selectcat.'&selecteval='.$evalobj->get_id().'"> |
|
| 29 | + ' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (api_is_platform_admin() || $evalobj->is_locked() == false) { |
| 33 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&import=">' . |
|
| 34 | - Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 33 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&import=">'. |
|
| 34 | + Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ($evalobj->has_results()) { |
| 38 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&export=">' . |
|
| 39 | - Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 38 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&export=">'. |
|
| 39 | + Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 40 | 40 | |
| 41 | 41 | if (api_is_platform_admin() || $evalobj->is_locked() == false) { |
| 42 | - $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '">' . |
|
| 43 | - Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 44 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">' . |
|
| 45 | - Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 42 | + $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'">'. |
|
| 43 | + Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 44 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&deleteall=" onclick="return confirmationall();">'. |
|
| 45 | + Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selecteval=' . $evalobj->get_id() . '" target="_blank">' . |
|
| 50 | - Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 49 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selecteval='.$evalobj->get_id().'" target="_blank">'. |
|
| 50 | + Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 51 | 51 | } else { |
| 52 | - $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' . |
|
| 53 | - Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 52 | + $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '. |
|
| 53 | + Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 54 | 54 | } |
| 55 | 55 | $header .= '</div>'; |
| 56 | 56 | } |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | $score = $evalobj->calc_score(); |
| 70 | 70 | |
| 71 | 71 | if ($score != null) { |
| 72 | - $average = get_lang('Average') . ' :<b> ' . $scoredisplay->display_score($score, SCORE_AVERAGE) . '</b>'; |
|
| 72 | + $average = get_lang('Average').' :<b> '.$scoredisplay->display_score($score, SCORE_AVERAGE).'</b>'; |
|
| 73 | 73 | $student_score = $evalobj->calc_score(api_get_user_id()); |
| 74 | 74 | $student_score = Display::tag( |
| 75 | 75 | 'h3', |
| 76 | - get_lang('Score') . ': ' . $scoredisplay->display_score($student_score, SCORE_DIV_PERCENT) |
|
| 76 | + get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT) |
|
| 77 | 77 | ); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | $description = ""; |
| 81 | 81 | if (!$evalobj->get_description() == '') { |
| 82 | - $description = get_lang('Description') . ' :<b> ' . $evalobj->get_description() . '</b><br>'; |
|
| 82 | + $description = get_lang('Description').' :<b> '.$evalobj->get_description().'</b><br>'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if ($evalobj->get_course_code() == null) { |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $evalinfo = '<table width="100%" border="0"><tr><td>'; |
| 92 | - $evalinfo .= '<h2>' . $evalobj->get_name() . '</h2><hr>'; |
|
| 92 | + $evalinfo .= '<h2>'.$evalobj->get_name().'</h2><hr>'; |
|
| 93 | 93 | $evalinfo .= $description; |
| 94 | - $evalinfo .= get_lang('Course') . ' :<b> ' . $course . '</b><br />'; |
|
| 95 | - $evalinfo .= get_lang('QualificationNumeric') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $average; |
|
| 94 | + $evalinfo .= get_lang('Course').' :<b> '.$course.'</b><br />'; |
|
| 95 | + $evalinfo .= get_lang('QualificationNumeric').' :<b> '.$evalobj->get_max().'</b><br>'.$average; |
|
| 96 | 96 | |
| 97 | 97 | if (!api_is_allowed_to_edit()) { |
| 98 | 98 | $evalinfo .= $student_score; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (!$evalobj->has_results()) { |
| 102 | - $evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>'; |
|
| 102 | + $evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>'; |
|
| 103 | 103 | } elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') { |
| 104 | 104 | if (api_is_allowed_to_edit(null, true)) { |
| 105 | 105 | if ($page != 'statistics') { |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | if ($page != 'statistics') { |
| 111 | 111 | if (api_is_allowed_to_edit(null, true)) { |
| 112 | - $evalinfo .= '<br /><a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' . |
|
| 113 | - Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 112 | + $evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '. |
|
| 113 | + Display::return_icon('statistics.png', get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $evalinfo .= '</td><td>'.Display::return_icon('tutorial.gif', '', ['style' => 'float:right; position:relative;']).'</td></table>'; |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | public function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form) |
| 128 | 128 | { |
| 129 | 129 | $header = '<table border="0" cellpadding="5">'; |
| 130 | - $header .= '<td style="vertical-align: top;"><a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '">' . Display::return_icon('gradebook.gif') . get_lang('Gradebook') . '</a></td>'; |
|
| 131 | - $header .= '<td style="vertical-align: top;">' . get_lang('FilterCategory') . '</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">'; |
|
| 130 | + $header .= '<td style="vertical-align: top;"><a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('gradebook.gif').get_lang('Gradebook').'</a></td>'; |
|
| 131 | + $header .= '<td style="vertical-align: top;">'.get_lang('FilterCategory').'</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">'; |
|
| 132 | 132 | $cats = Category :: load(); |
| 133 | 133 | $tree = $cats[0]->get_tree(); |
| 134 | 134 | unset($cats); |
@@ -137,35 +137,35 @@ discard block |
||
| 137 | 137 | $line .= '—'; |
| 138 | 138 | } |
| 139 | 139 | if ($_GET['selectcat'] == $cat[0]) { |
| 140 | - $header .= '<option selected="selected" value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 140 | + $header .= '<option selected="selected" value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 141 | 141 | } else { |
| 142 | - $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 142 | + $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 143 | 143 | } |
| 144 | 144 | $line = ''; |
| 145 | 145 | } |
| 146 | 146 | $header .= '</td></select></form>'; |
| 147 | 147 | if (!$catobj->get_id() == '0') { |
| 148 | - $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">'; |
|
| 148 | + $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'; |
|
| 149 | 149 | $header .= Display::return_icon('gradebook.gif', get_lang('Up')); |
| 150 | 150 | $header .= '</a></td>'; |
| 151 | 151 | } |
| 152 | - $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>'; |
|
| 152 | + $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>'; |
|
| 153 | 153 | $header .= '<td style="vertical-align: top;"> |
| 154 | - <a href="' . api_get_self() . '?exportpdf=&offset=' . Security::remove_XSS($_GET['offset']) . '&search=' . Security::remove_XSS($_GET['search']) . '&selectcat=' . $catobj->get_id() . '"> |
|
| 154 | + <a href="' . api_get_self().'?exportpdf=&offset='.Security::remove_XSS($_GET['offset']).'&search='.Security::remove_XSS($_GET['search']).'&selectcat='.$catobj->get_id().'"> |
|
| 155 | 155 | '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).' |
| 156 | - ' . get_lang('ExportPDF') . '</a>'; |
|
| 156 | + ' . get_lang('ExportPDF').'</a>'; |
|
| 157 | 157 | $header .= '<td style="vertical-align: top;"> |
| 158 | - <a href="' . api_get_self() . '?print=&selectcat=' . $catobj->get_id() . '" target="_blank"> |
|
| 158 | + <a href="' . api_get_self().'?print=&selectcat='.$catobj->get_id().'" target="_blank"> |
|
| 159 | 159 | '.Display::return_icon('printer.png', get_lang('Print'), [], ICON_SIZE_MEDIUM).' |
| 160 | - ' . get_lang('Print') . '</a>'; |
|
| 160 | + ' . get_lang('Print').'</a>'; |
|
| 161 | 161 | $header .= '</td></tr></table>'; |
| 162 | 162 | if (!$catobj->get_id() == '0') { |
| 163 | - $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="' . api_get_self() . '?selectcat=' . $catobj->get_id() . '"> |
|
| 164 | - <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '') . '>Show Evaluations '; |
|
| 165 | - $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" ' . (($showlink == '1') ? 'checked' : '') . '>' . get_lang('ShowLinks') . '</form></td></tr></table>'; |
|
| 163 | + $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="'.api_get_self().'?selectcat='.$catobj->get_id().'"> |
|
| 164 | + <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '').'>Show Evaluations '; |
|
| 165 | + $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" '.(($showlink == '1') ? 'checked' : '').'>'.get_lang('ShowLinks').'</form></td></tr></table>'; |
|
| 166 | 166 | } |
| 167 | 167 | if (isset($_GET['search'])) { |
| 168 | - $header .= '<b>' . get_lang('SearchResults') . ' :</b>'; |
|
| 168 | + $header .= '<b>'.get_lang('SearchResults').' :</b>'; |
|
| 169 | 169 | } |
| 170 | 170 | echo $header; |
| 171 | 171 | } |
@@ -186,23 +186,23 @@ discard block |
||
| 186 | 186 | $select_cat = $catobj->get_parent_id(); |
| 187 | 187 | $url = 'gradebook_flatview.php'; |
| 188 | 188 | } |
| 189 | - $header .= '<a href="' . $url . '?' . api_get_cidreq() . '&selectcat=' . $select_cat . '">' . |
|
| 190 | - Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 189 | + $header .= '<a href="'.$url.'?'.api_get_cidreq().'&selectcat='.$select_cat.'">'. |
|
| 190 | + Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 191 | 191 | |
| 192 | 192 | $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : ''; |
| 193 | 193 | $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : ''; |
| 194 | 194 | $offset = isset($_GET['offset']) ? $_GET['offset'] : '0'; |
| 195 | 195 | |
| 196 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat=' . $catobj->get_id() . '">' . |
|
| 197 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 198 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat=' . $catobj->get_id() . '">' . |
|
| 199 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 200 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat=' . $catobj->get_id() . '">' . |
|
| 201 | - Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 202 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selectcat=' . $catobj->get_id() . '" target="_blank">' . |
|
| 203 | - Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 204 | - $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&exportpdf=&selectcat=' . $catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >' . |
|
| 205 | - Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 196 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat='.$catobj->get_id().'">'. |
|
| 197 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 198 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat='.$catobj->get_id().'">'. |
|
| 199 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 200 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat='.$catobj->get_id().'">'. |
|
| 201 | + Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 202 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selectcat='.$catobj->get_id().'" target="_blank">'. |
|
| 203 | + Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 204 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&exportpdf=&selectcat='.$catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >'. |
|
| 205 | + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 206 | 206 | $header .= '</div>'; |
| 207 | 207 | echo $header; |
| 208 | 208 | } |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | $item = $evals_links[$count]; |
| 244 | 244 | $score = $item->calc_score($user_id); |
| 245 | 245 | $my_score_denom = ($score[1] == 0) ? 1 : $score[1]; |
| 246 | - $item_value+=$score[0] / $my_score_denom * $item->get_weight(); |
|
| 247 | - $item_total+=$item->get_weight(); |
|
| 246 | + $item_value += $score[0] / $my_score_denom * $item->get_weight(); |
|
| 247 | + $item_total += $item->get_weight(); |
|
| 248 | 248 | } |
| 249 | 249 | $item_value = number_format($item_value, 2, '.', ' '); |
| 250 | 250 | $total_score = array($item_value, $item_total); |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | $cattotal = Category :: load(0); |
| 254 | 254 | $scoretotal = $cattotal[0]->calc_score(api_get_user_id()); |
| 255 | 255 | $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable')); |
| 256 | - $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . api_get_person_name($user['firstname'], $user['lastname']) . '</b><br />'; |
|
| 256 | + $scoreinfo = get_lang('StatsStudent').' :<b> '.api_get_person_name($user['firstname'], $user['lastname']).'</b><br />'; |
|
| 257 | 257 | if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) { |
| 258 | - $scoreinfo.= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>'; |
|
| 258 | + $scoreinfo .= '<h2>'.get_lang('Total').' : '.$scorecourse_display.'</h2>'; |
|
| 259 | 259 | } |
| 260 | 260 | Display :: display_normal_message($scoreinfo, false); |
| 261 | 261 | } |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | if (($showtree == '1') || (isset($_GET['studentoverview']))) { |
| 266 | 266 | $header .= '<tr>'; |
| 267 | 267 | if (!$selectcat == '0') { |
| 268 | - $header .= '<td style=" "><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>'; |
|
| 268 | + $header .= '<td style=" "><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>'; |
|
| 269 | 269 | } |
| 270 | - $header .= '<td style=" ">' . get_lang('CurrentCategory') . '</td>' . |
|
| 270 | + $header .= '<td style=" ">'.get_lang('CurrentCategory').'</td>'. |
|
| 271 | 271 | '<td style=" "><form name="selector"><select name="selectcat" onchange="document.selector.submit()">'; |
| 272 | 272 | $cats = Category :: load(); |
| 273 | 273 | |
@@ -280,15 +280,15 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | $line = isset($line) ? $line : ''; |
| 282 | 282 | if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) { |
| 283 | - $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 283 | + $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 284 | 284 | } else { |
| 285 | - $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 285 | + $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 286 | 286 | } |
| 287 | 287 | $line = ''; |
| 288 | 288 | } |
| 289 | 289 | $header .= '</select></form></td>'; |
| 290 | 290 | if (!empty($simple_search_form) && $message_resource === false) { |
| 291 | - $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>'; |
|
| 291 | + $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>'; |
|
| 292 | 292 | } else { |
| 293 | 293 | $header .= '<td></td>'; |
| 294 | 294 | } |
@@ -298,13 +298,13 @@ discard block |
||
| 298 | 298 | } elseif (!(isset($_GET['studentoverview']))) { |
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | - $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank"> |
|
| 301 | + $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank"> |
|
| 302 | 302 | '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).' |
| 303 | - ' . get_lang('ExportPDF') . '</a>'; |
|
| 303 | + ' . get_lang('ExportPDF').'</a>'; |
|
| 304 | 304 | } |
| 305 | 305 | $header .= '</td></tr>'; |
| 306 | 306 | } |
| 307 | - $header.='</table></div>'; |
|
| 307 | + $header .= '</table></div>'; |
|
| 308 | 308 | |
| 309 | 309 | // for course admin & platform admin add item buttons are added to the header |
| 310 | 310 | $header .= '<div class="actions">'; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $my_category = $catobj->shows_all_information_an_category($catobj->get_id()); |
| 325 | 325 | $my_api_cidreq = api_get_cidreq(); |
| 326 | 326 | if ($my_api_cidreq == '') { |
| 327 | - $my_api_cidreq = 'cidReq=' . $my_category['course_code']; |
|
| 327 | + $my_api_cidreq = 'cidReq='.$my_category['course_code']; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | if (!$message_resource) { |
@@ -333,24 +333,24 @@ discard block |
||
| 333 | 333 | $my_course_id = api_get_course_id(); |
| 334 | 334 | $my_file = substr($_SESSION['gradebook_dest'], 0, 5); |
| 335 | 335 | |
| 336 | - $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 337 | - Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 338 | - $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&cat_id=' . (int) $_GET['selectcat'] . '">' . |
|
| 339 | - Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 336 | + $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 337 | + Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 338 | + $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&cat_id='.(int) $_GET['selectcat'].'">'. |
|
| 339 | + Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 340 | 340 | |
| 341 | 341 | $visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible'; |
| 342 | 342 | $visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible'; |
| 343 | 343 | |
| 344 | 344 | //Right icons |
| 345 | - $modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 345 | + $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 346 | 346 | if ($catobj->get_name() != api_get_course_id()) { |
| 347 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletecat=' . $catobj->get_id() . '&selectcat=0&cidReq=' . $catobj->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 347 | + $modify_icons .= ' <a href="'.api_get_self().'?deletecat='.$catobj->get_id().'&selectcat=0&cidReq='.$catobj->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 348 | 348 | } |
| 349 | 349 | $header .= Display::div($modify_icons, array('class' => 'right')); |
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | } elseif (isset($_GET['search'])) { |
| 353 | - $header .= '<b>' . get_lang('SearchResults') . ' :</b>'; |
|
| 353 | + $header .= '<b>'.get_lang('SearchResults').' :</b>'; |
|
| 354 | 354 | } |
| 355 | 355 | $header .= '</div>'; |
| 356 | 356 | echo $header; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : ''; |
| 463 | 463 | $aditionalButtons .= '</div>'; |
| 464 | 464 | } |
| 465 | - $scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons). '</strong>'; |
|
| 465 | + $scoreinfo .= '<strong>'.sprintf(get_lang('TotalX'), $scorecourse_display.$aditionalButtons).'</strong>'; |
|
| 466 | 466 | |
| 467 | 467 | } |
| 468 | 468 | Display :: display_normal_message($scoreinfo, false); |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | $header = '<div class="actions"><table>'; |
| 474 | 474 | $header .= '<tr>'; |
| 475 | 475 | if (!$selectcat == '0') { |
| 476 | - $header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . |
|
| 477 | - Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>'; |
|
| 476 | + $header .= '<td><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'. |
|
| 477 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>'; |
|
| 478 | 478 | } |
| 479 | - $header .= '<td>' . get_lang('CurrentCategory') . '</td>' . |
|
| 479 | + $header .= '<td>'.get_lang('CurrentCategory').'</td>'. |
|
| 480 | 480 | '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">'; |
| 481 | 481 | $cats = Category :: load(); |
| 482 | 482 | |
@@ -489,15 +489,15 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | $line = isset($line) ? $line : ''; |
| 491 | 491 | if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) { |
| 492 | - $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 492 | + $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 493 | 493 | } else { |
| 494 | - $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>'; |
|
| 494 | + $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>'; |
|
| 495 | 495 | } |
| 496 | 496 | $line = ''; |
| 497 | 497 | } |
| 498 | 498 | $header .= '</select></form></td>'; |
| 499 | 499 | if (!empty($simple_search_form) && $message_resource === false) { |
| 500 | - $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>'; |
|
| 500 | + $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>'; |
|
| 501 | 501 | } else { |
| 502 | 502 | $header .= '<td></td>'; |
| 503 | 503 | } |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | } elseif (!(isset($_GET['studentoverview']))) { |
| 509 | 509 | |
| 510 | 510 | } else { |
| 511 | - $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank"> |
|
| 511 | + $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank"> |
|
| 512 | 512 | '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).' |
| 513 | - ' . get_lang('ExportPDF') . '</a>'; |
|
| 513 | + ' . get_lang('ExportPDF').'</a>'; |
|
| 514 | 514 | } |
| 515 | 515 | $header .= '</td></tr>'; |
| 516 | 516 | $header .= '</table></div>'; |
@@ -525,33 +525,33 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | if (api_is_allowed_to_edit(null, true)) { |
| 527 | 527 | if (empty($grade_model_id) || $grade_model_id == -1) { |
| 528 | - $actionsLeft .= '<a href="gradebook_add_cat.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 529 | - Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '</a></td>'; |
|
| 528 | + $actionsLeft .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'. |
|
| 529 | + Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).'</a></td>'; |
|
| 530 | 530 | } |
| 531 | 531 | if ($selectcat == '0') { |
| 532 | 532 | |
| 533 | 533 | } else { |
| 534 | 534 | $my_category = $catobj->shows_all_information_an_category($catobj->get_id()); |
| 535 | 535 | if ($my_api_cidreq == '') { |
| 536 | - $my_api_cidreq = 'cidReq=' . $my_category['course_code']; |
|
| 536 | + $my_api_cidreq = 'cidReq='.$my_category['course_code']; |
|
| 537 | 537 | } |
| 538 | 538 | if ($show_add_link && !$message_resource) { |
| 539 | - $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' . |
|
| 540 | - Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 539 | + $actionsLeft .= '<a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'" >'. |
|
| 540 | + Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 541 | 541 | $cats = Category :: load($selectcat); |
| 542 | 542 | |
| 543 | 543 | if ($cats[0]->get_course_code() != null && !$message_resource) { |
| 544 | - $actionsLeft .= '<a href="gradebook_add_link.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 545 | - Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 544 | + $actionsLeft .= '<a href="gradebook_add_link.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 545 | + Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 546 | 546 | } else { |
| 547 | - $actionsLeft .= '<a href="gradebook_add_link_select_course.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 548 | - Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 547 | + $actionsLeft .= '<a href="gradebook_add_link_select_course.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 548 | + Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | if (!$message_resource) { |
| 553 | - $actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 554 | - Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 553 | + $actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 554 | + Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 555 | 555 | |
| 556 | 556 | if ($my_category['generate_certificates'] == 1) { |
| 557 | 557 | $actionsLeft .= Display::url( |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | '', |
| 562 | 562 | ICON_SIZE_MEDIUM |
| 563 | 563 | ), |
| 564 | - "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . intval($_GET['selectcat']) |
|
| 564 | + "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".intval($_GET['selectcat']) |
|
| 565 | 565 | ); |
| 566 | 566 | } |
| 567 | 567 | |
@@ -572,30 +572,30 @@ discard block |
||
| 572 | 572 | '', |
| 573 | 573 | ICON_SIZE_MEDIUM |
| 574 | 574 | ), |
| 575 | - "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . intval($_GET['selectcat']) |
|
| 575 | + "gradebook_display_summary.php?$my_api_cidreq&selectcat=".intval($_GET['selectcat']) |
|
| 576 | 576 | ); |
| 577 | 577 | |
| 578 | 578 | |
| 579 | 579 | // Right icons |
| 580 | - $actionsRight = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . |
|
| 581 | - Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 582 | - $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&' . $my_api_cidreq . '&origin=gradebook&selectcat=' . $catobj->get_id() . '">' . |
|
| 583 | - Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 580 | + $actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'. |
|
| 581 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 582 | + $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'. |
|
| 583 | + Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 584 | 584 | |
| 585 | 585 | if (empty($categories)) { |
| 586 | - $actionsRight .= '<a href="gradebook_edit_all.php?id_session=' . api_get_session_id() . '&' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 587 | - Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 586 | + $actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 587 | + Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 588 | 588 | } |
| 589 | 589 | $score_display_custom = api_get_setting('gradebook_score_display_custom'); |
| 590 | 590 | if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') { |
| 591 | - $actionsRight .= '<a href="gradebook_scoring_system.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 592 | - Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 591 | + $actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 592 | + Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | } elseif (isset($_GET['search'])) { |
| 598 | - echo $header = '<b>' . get_lang('SearchResults') . ' :</b>'; |
|
| 598 | + echo $header = '<b>'.get_lang('SearchResults').' :</b>'; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( |
@@ -604,26 +604,26 @@ discard block |
||
| 604 | 604 | ); |
| 605 | 605 | |
| 606 | 606 | if ($isDrhOfCourse) { |
| 607 | - $$actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . |
|
| 608 | - Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 607 | + $$actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'. |
|
| 608 | + Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if (api_is_allowed_to_edit(null, true)){ |
|
| 612 | - echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight )); |
|
| 611 | + if (api_is_allowed_to_edit(null, true)) { |
|
| 612 | + echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight)); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if (api_is_allowed_to_edit(null, true)) { |
| 616 | 616 | $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0; |
| 617 | - $weight = '<strong>' . get_lang('TotalWeight') . ' : </strong>' . $weight; |
|
| 617 | + $weight = '<strong>'.get_lang('TotalWeight').' : </strong>'.$weight; |
|
| 618 | 618 | |
| 619 | 619 | $min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0); |
| 620 | - $min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification; |
|
| 621 | - $edit_icon = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . |
|
| 622 | - Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 620 | + $min_certification = get_lang('CertificateMinScore').' : '.$min_certification; |
|
| 621 | + $edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'. |
|
| 622 | + Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 623 | 623 | //$msg = Display::tag('h3', $weight.' - '.$min_certification); |
| 624 | - $msg = $weight . ' - ' . $min_certification . $edit_icon; |
|
| 624 | + $msg = $weight.' - '.$min_certification.$edit_icon; |
|
| 625 | 625 | //@todo show description |
| 626 | - $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>' . get_lang('GradebookDescriptionLog') . '</strong>' . ': ' . $catobj->get_description()); |
|
| 626 | + $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.$catobj->get_description()); |
|
| 627 | 627 | Display::display_normal_message($msg, false); |
| 628 | 628 | if (!empty($description)) { |
| 629 | 629 | echo Display::div($description, array()); |
@@ -651,24 +651,24 @@ discard block |
||
| 651 | 651 | $cattotal = Category :: load(0); |
| 652 | 652 | $scoretotal = $cattotal[0]->calc_score(api_get_user_id()); |
| 653 | 653 | $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable')); |
| 654 | - $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />'; |
|
| 654 | + $scoreinfo = get_lang('StatsStudent').' :<b> '.$user['complete_name'].'</b><br />'; |
|
| 655 | 655 | if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) |
| 656 | - $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>'; |
|
| 657 | - $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>'; |
|
| 656 | + $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>'; |
|
| 657 | + $scoreinfo .= '<br />'.get_lang('Total').' : <b>'.$scoretotal_display.'</b>'; |
|
| 658 | 658 | Display :: display_normal_message($scoreinfo, false); |
| 659 | 659 | } |
| 660 | 660 | // show navigation tree and buttons? |
| 661 | 661 | $header = '<div class="actions">'; |
| 662 | 662 | |
| 663 | 663 | if ($is_course_admin) { |
| 664 | - $header .= '<a href="gradebook_flatview.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 665 | - $header .= '<a href="gradebook_scoring_system.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 664 | + $header .= '<a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 665 | + $header .= '<a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 666 | 666 | } elseif (!(isset($_GET['studentoverview']))) { |
| 667 | - $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('view_list.gif', get_lang('FlatView')) . ' ' . get_lang('FlatView') . '</a>'; |
|
| 667 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat='.$catobj->get_id().'">'.Display::return_icon('view_list.gif', get_lang('FlatView')).' '.get_lang('FlatView').'</a>'; |
|
| 668 | 668 | } else { |
| 669 | - $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
| 669 | + $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">'.Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 670 | 670 | } |
| 671 | - $header.='</div>'; |
|
| 671 | + $header .= '</div>'; |
|
| 672 | 672 | echo $header; |
| 673 | 673 | } |
| 674 | 674 | |
@@ -695,8 +695,8 @@ discard block |
||
| 695 | 695 | $item = $evals_links[$count]; |
| 696 | 696 | $score = $item->calc_score($user_id); |
| 697 | 697 | $my_score_denom = ($score[1] == 0) ? 1 : $score[1]; |
| 698 | - $item_value+=$score[0] / $my_score_denom * $item->get_weight(); |
|
| 699 | - $item_total+=$item->get_weight(); |
|
| 698 | + $item_value += $score[0] / $my_score_denom * $item->get_weight(); |
|
| 699 | + $item_total += $item->get_weight(); |
|
| 700 | 700 | //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT); |
| 701 | 701 | } |
| 702 | 702 | $item_value = number_format($item_value, 2, '.', ' '); |
@@ -711,17 +711,17 @@ discard block |
||
| 711 | 711 | $imageUrl = UserManager::getUserPicture($userid); |
| 712 | 712 | |
| 713 | 713 | $info = '<div class="row"><div class="col-md-3">'; |
| 714 | - $info .= '<div class="thumbnail"><img src="' . $imageUrl . '" /></div>'; |
|
| 714 | + $info .= '<div class="thumbnail"><img src="'.$imageUrl.'" /></div>'; |
|
| 715 | 715 | $info .= '</div>'; |
| 716 | 716 | $info .= '<div class="col-md-6">'; |
| 717 | - $info .= get_lang('Name') . ' : <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userid . '"> ' . |
|
| 718 | - $user['complete_name'] . '</a><br />'; |
|
| 717 | + $info .= get_lang('Name').' : <a target="_blank" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userid.'"> '. |
|
| 718 | + $user['complete_name'].'</a><br />'; |
|
| 719 | 719 | |
| 720 | 720 | if (api_get_setting('show_email_addresses') == 'true') { |
| 721 | - $info .= get_lang('Email') . ' : <a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a><br />'; |
|
| 721 | + $info .= get_lang('Email').' : <a href="mailto:'.$user['email'].'">'.$user['email'].'</a><br />'; |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - $info .= get_lang('TotalUser') . ' : <b>' . $scorecourse_display . '</b>'; |
|
| 724 | + $info .= get_lang('TotalUser').' : <b>'.$scorecourse_display.'</b>'; |
|
| 725 | 725 | $info .= '</div>'; |
| 726 | 726 | $info .= '</div>'; |
| 727 | 727 | |