@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null; |
16 | 16 | |
17 | 17 | if (empty($slide_id)) { |
18 | - $edit_slide_id = 1; |
|
18 | + $edit_slide_id = 1; |
|
19 | 19 | } else { |
20 | - $edit_slide_id = $slide_id; |
|
20 | + $edit_slide_id = $slide_id; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if ($path != '/') { |
24 | - $folder = $path.'/'; |
|
24 | + $folder = $path.'/'; |
|
25 | 25 | } else { |
26 | - $folder = '/'; |
|
26 | + $folder = '/'; |
|
27 | 27 | } |
28 | 28 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
29 | 29 | |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | |
42 | 42 | // Loading the slides from the session |
43 | 43 | if (isset($_SESSION['image_files_only'])) { |
44 | - $image_files_only = $_SESSION['image_files_only']; |
|
44 | + $image_files_only = $_SESSION['image_files_only']; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Calculating the current slide, next slide, previous slide and the number of slides |
48 | 48 | $slide = null; |
49 | 49 | if ($slide_id != 'all') { |
50 | - $slide = $slide_id ? $slide_id : 0; |
|
51 | - $previous_slide = $slide - 1; |
|
52 | - $next_slide = $slide + 1; |
|
50 | + $slide = $slide_id ? $slide_id : 0; |
|
51 | + $previous_slide = $slide - 1; |
|
52 | + $next_slide = $slide + 1; |
|
53 | 53 | } |
54 | 54 | $total_slides = count($image_files_only); |
55 | 55 | ?> |
@@ -62,62 +62,62 @@ discard block |
||
62 | 62 | <?php |
63 | 63 | |
64 | 64 | if ($slide_id != 'all') { |
65 | - $image = null; |
|
66 | - if (isset($image_files_only[$slide])) { |
|
67 | - $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
68 | - } |
|
69 | - if (file_exists($image)) { |
|
70 | - echo '<div class="actions-pagination">'; |
|
71 | - |
|
72 | - // Back forward buttons |
|
73 | - if ($slide == 0) { |
|
74 | - $imgp = 'action_prev_na.png'; |
|
75 | - $first = Display::return_icon('action_first_na.png'); |
|
76 | - } else { |
|
77 | - $imgp = 'action_prev.png'; |
|
78 | - $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
65 | + $image = null; |
|
66 | + if (isset($image_files_only[$slide])) { |
|
67 | + $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
68 | + } |
|
69 | + if (file_exists($image)) { |
|
70 | + echo '<div class="actions-pagination">'; |
|
71 | + |
|
72 | + // Back forward buttons |
|
73 | + if ($slide == 0) { |
|
74 | + $imgp = 'action_prev_na.png'; |
|
75 | + $first = Display::return_icon('action_first_na.png'); |
|
76 | + } else { |
|
77 | + $imgp = 'action_prev.png'; |
|
78 | + $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
79 | 79 | '.Display::return_icon('action_first.png', get_lang('FirstSlide')).' |
80 | 80 | </a>'; |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - // First slide |
|
84 | - echo $first; |
|
83 | + // First slide |
|
84 | + echo $first; |
|
85 | 85 | |
86 | - // Previous slide |
|
87 | - if ($slide > 0) { |
|
88 | - echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
89 | - } |
|
86 | + // Previous slide |
|
87 | + if ($slide > 0) { |
|
88 | + echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
89 | + } |
|
90 | 90 | |
91 | 91 | echo Display::return_icon($imgp, get_lang('Previous')); |
92 | - if ($slide > 0) { |
|
93 | - echo '</a>'; |
|
94 | - } |
|
95 | - |
|
96 | - // Divider |
|
97 | - echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
98 | - |
|
99 | - // Next slide |
|
100 | - if ($slide < $total_slides - 1) { |
|
101 | - echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
102 | - } |
|
103 | - if ($slide == $total_slides - 1) { |
|
104 | - $imgn = 'action_next_na.png'; |
|
92 | + if ($slide > 0) { |
|
93 | + echo '</a>'; |
|
94 | + } |
|
95 | + |
|
96 | + // Divider |
|
97 | + echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
98 | + |
|
99 | + // Next slide |
|
100 | + if ($slide < $total_slides - 1) { |
|
101 | + echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
102 | + } |
|
103 | + if ($slide == $total_slides - 1) { |
|
104 | + $imgn = 'action_next_na.png'; |
|
105 | 105 | $last = Display::return_icon('action_last_na.png', get_lang('LastSlide')); |
106 | - } else { |
|
107 | - $imgn = 'action_next.png'; |
|
108 | - $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
106 | + } else { |
|
107 | + $imgn = 'action_next.png'; |
|
108 | + $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
109 | 109 | '.Display::return_icon('action_last.png', get_lang('LastSlide')).' |
110 | 110 | </a>'; |
111 | - } |
|
111 | + } |
|
112 | 112 | echo Display::return_icon($imgn, get_lang('Next')); |
113 | - if ($slide > 0) { |
|
114 | - echo '</a>'; |
|
115 | - } |
|
116 | - |
|
117 | - // Last slide |
|
118 | - echo $last; |
|
119 | - echo '</div>'; |
|
120 | - } |
|
113 | + if ($slide > 0) { |
|
114 | + echo '</a>'; |
|
115 | + } |
|
116 | + |
|
117 | + // Last slide |
|
118 | + echo $last; |
|
119 | + echo '</div>'; |
|
120 | + } |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Exit the slideshow |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | // Show thumbnails |
128 | 128 | if ($slide_id != 'all') { |
129 | - echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
129 | + echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
130 | 130 | Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
131 | 131 | } else { |
132 | - echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
132 | + echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
133 | 133 | } |
134 | 134 | // Slideshow options |
135 | 135 | echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
@@ -142,24 +142,24 @@ discard block |
||
142 | 142 | |
143 | 143 | // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options |
144 | 144 | if (isset($_POST['Submit'])) { |
145 | - // We come from slideshowoptions.php |
|
146 | - //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
147 | - $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
148 | - if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
149 | - //echo "resizing"; |
|
150 | - $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
151 | - $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
152 | - } else { |
|
153 | - //echo "unsetting the session heighte and width"; |
|
154 | - $_SESSION["image_resizing_width"] = null; |
|
155 | - $_SESSION["image_resizing_height"] = null; |
|
156 | - } |
|
145 | + // We come from slideshowoptions.php |
|
146 | + //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
147 | + $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
148 | + if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
149 | + //echo "resizing"; |
|
150 | + $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
151 | + $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
152 | + } else { |
|
153 | + //echo "unsetting the session heighte and width"; |
|
154 | + $_SESSION["image_resizing_width"] = null; |
|
155 | + $_SESSION["image_resizing_height"] = null; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | $target_width = $target_height = null; |
159 | 159 | // The target height and width depends if we choose resizing or no resizing |
160 | 160 | if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
161 | - $target_width = $_SESSION["image_resizing_width"]; |
|
162 | - $target_height = $_SESSION["image_resizing_height"]; |
|
161 | + $target_width = $_SESSION["image_resizing_width"]; |
|
162 | + $target_height = $_SESSION["image_resizing_height"]; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /* THUMBNAIL VIEW */ |
@@ -169,59 +169,59 @@ discard block |
||
169 | 169 | $html = ''; |
170 | 170 | if ($slide_id == 'all') { |
171 | 171 | |
172 | - // Config for make thumbnails |
|
172 | + // Config for make thumbnails |
|
173 | 173 | $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png'); |
174 | - $max_thumbnail_width = 250; |
|
175 | - $max_thumbnail_height = 250; |
|
176 | - $png_compression = 0; // 0(none)-9 |
|
177 | - $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
174 | + $max_thumbnail_width = 250; |
|
175 | + $max_thumbnail_height = 250; |
|
176 | + $png_compression = 0; // 0(none)-9 |
|
177 | + $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
178 | 178 | |
179 | - $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
179 | + $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
180 | 180 | |
181 | - //Other parameters only for show tumbnails |
|
182 | - $row_items = 4;//only in slideshow.php |
|
183 | - $number_image = 7;//num icons cols to show |
|
184 | - $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
185 | - $thumbnail_height_frame = $max_thumbnail_height; |
|
181 | + //Other parameters only for show tumbnails |
|
182 | + $row_items = 4;//only in slideshow.php |
|
183 | + $number_image = 7;//num icons cols to show |
|
184 | + $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
185 | + $thumbnail_height_frame = $max_thumbnail_height; |
|
186 | 186 | |
187 | - // Create the template_thumbnails folder (if no exist) |
|
187 | + // Create the template_thumbnails folder (if no exist) |
|
188 | 188 | |
189 | - if (!file_exists($directory_thumbnails)) { |
|
190 | - @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
189 | + if (!file_exists($directory_thumbnails)) { |
|
190 | + @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
191 | 191 | } |
192 | 192 | |
193 | - // check files and thumbnails |
|
194 | - if (is_array($image_files_only)) { |
|
193 | + // check files and thumbnails |
|
194 | + if (is_array($image_files_only)) { |
|
195 | 195 | |
196 | - foreach ($image_files_only as $one_image_file) { |
|
197 | - $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
198 | - $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
196 | + foreach ($image_files_only as $one_image_file) { |
|
197 | + $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
198 | + $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
199 | 199 | |
200 | - if (file_exists($image)) { |
|
201 | - //check thumbnail |
|
202 | - $imagetype = explode(".", $image); |
|
200 | + if (file_exists($image)) { |
|
201 | + //check thumbnail |
|
202 | + $imagetype = explode(".", $image); |
|
203 | 203 | //or check $imagetype = image_type_to_extension(exif_imagetype($image), false); |
204 | - $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
204 | + $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
205 | 205 | |
206 | - if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
207 | - if (!file_exists($image_thumbnail)){ |
|
206 | + if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
207 | + if (!file_exists($image_thumbnail)){ |
|
208 | 208 | //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail |
209 | - $original_image_size = api_getimagesize($image); |
|
210 | - |
|
211 | - switch($imagetype) { |
|
212 | - case 'gif': |
|
213 | - $source_img = imagecreatefromgif($image); |
|
214 | - break; |
|
215 | - case 'jpg': |
|
216 | - $source_img = imagecreatefromjpeg($image); |
|
217 | - break; |
|
218 | - case 'jpeg': |
|
219 | - $source_img = imagecreatefromjpeg($image); |
|
220 | - break; |
|
221 | - case 'png': |
|
222 | - $source_img = imagecreatefrompng($image); |
|
223 | - break; |
|
224 | - } |
|
209 | + $original_image_size = api_getimagesize($image); |
|
210 | + |
|
211 | + switch($imagetype) { |
|
212 | + case 'gif': |
|
213 | + $source_img = imagecreatefromgif($image); |
|
214 | + break; |
|
215 | + case 'jpg': |
|
216 | + $source_img = imagecreatefromjpeg($image); |
|
217 | + break; |
|
218 | + case 'jpeg': |
|
219 | + $source_img = imagecreatefromjpeg($image); |
|
220 | + break; |
|
221 | + case 'png': |
|
222 | + $source_img = imagecreatefrompng($image); |
|
223 | + break; |
|
224 | + } |
|
225 | 225 | |
226 | 226 | $new_thumbnail_size = api_calculate_image_size( |
227 | 227 | $original_image_size['width'], |
@@ -229,33 +229,33 @@ discard block |
||
229 | 229 | $max_thumbnail_width, |
230 | 230 | $max_thumbnail_height |
231 | 231 | ); |
232 | - if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
233 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
234 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
235 | - } |
|
236 | - |
|
237 | - $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
238 | - |
|
239 | - // preserve transparency |
|
240 | - if ($imagetype == "png"){ |
|
241 | - imagesavealpha($crop, true); |
|
242 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
243 | - imagefill($crop, 0, 0, $color); |
|
244 | - } |
|
245 | - |
|
246 | - if ($imagetype == "gif") { |
|
247 | - $transindex = imagecolortransparent($source_img); |
|
232 | + if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
233 | + $new_thumbnail_size['width']=$original_image_size['width']; |
|
234 | + $new_thumbnail_size['height']=$original_image_size['height']; |
|
235 | + } |
|
236 | + |
|
237 | + $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
238 | + |
|
239 | + // preserve transparency |
|
240 | + if ($imagetype == "png"){ |
|
241 | + imagesavealpha($crop, true); |
|
242 | + $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
243 | + imagefill($crop, 0, 0, $color); |
|
244 | + } |
|
245 | + |
|
246 | + if ($imagetype == "gif") { |
|
247 | + $transindex = imagecolortransparent($source_img); |
|
248 | 248 | $palletsize = imagecolorstotal($source_img); |
249 | - //GIF89a for transparent and anim (first clip), either GIF87a |
|
250 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
251 | - $transcol = imagecolorsforindex($source_img, $transindex); |
|
252 | - $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
253 | - imagefill($crop, 0, 0, $transindex); |
|
254 | - imagecolortransparent($crop, $transindex); |
|
255 | - } |
|
256 | - } |
|
257 | - |
|
258 | - //resampled image |
|
249 | + //GIF89a for transparent and anim (first clip), either GIF87a |
|
250 | + if ($transindex >= 0 && $transindex < $palletsize){ |
|
251 | + $transcol = imagecolorsforindex($source_img, $transindex); |
|
252 | + $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
253 | + imagefill($crop, 0, 0, $transindex); |
|
254 | + imagecolortransparent($crop, $transindex); |
|
255 | + } |
|
256 | + } |
|
257 | + |
|
258 | + //resampled image |
|
259 | 259 | imagecopyresampled( |
260 | 260 | $crop, |
261 | 261 | $source_img, |
@@ -269,69 +269,69 @@ discard block |
||
269 | 269 | $original_image_size['height'] |
270 | 270 | ); |
271 | 271 | |
272 | - switch ($imagetype) { |
|
273 | - case 'gif': |
|
274 | - imagegif($crop,$image_thumbnail); |
|
275 | - break; |
|
276 | - case 'jpg': |
|
277 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
278 | - break; |
|
279 | - case 'jpeg': |
|
280 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
281 | - break; |
|
282 | - case 'png': |
|
283 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
284 | - break; |
|
285 | - } |
|
286 | - |
|
287 | - //clean memory |
|
288 | - imagedestroy($crop); |
|
289 | - }//end !exist thumbnail |
|
290 | - |
|
291 | - //show thumbnail and link |
|
292 | - |
|
293 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
294 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
295 | - $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
296 | - } else { |
|
297 | - //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
298 | - if ($imagetype=="bmp") { |
|
272 | + switch ($imagetype) { |
|
273 | + case 'gif': |
|
274 | + imagegif($crop,$image_thumbnail); |
|
275 | + break; |
|
276 | + case 'jpg': |
|
277 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
278 | + break; |
|
279 | + case 'jpeg': |
|
280 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
281 | + break; |
|
282 | + case 'png': |
|
283 | + imagepng($crop,$image_thumbnail,$png_compression); |
|
284 | + break; |
|
285 | + } |
|
286 | + |
|
287 | + //clean memory |
|
288 | + imagedestroy($crop); |
|
289 | + }//end !exist thumbnail |
|
290 | + |
|
291 | + //show thumbnail and link |
|
292 | + |
|
293 | + $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
294 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
295 | + $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
296 | + } else { |
|
297 | + //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
298 | + if ($imagetype=="bmp") { |
|
299 | 299 | // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy |
300 | - $original_image_size = getimagesize($image); |
|
301 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
302 | - $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
303 | - $image_height = $thumbnail_size['height']; |
|
304 | - $image_width = $thumbnail_size['width']; |
|
305 | - } else { |
|
306 | - $image_height=$original_image_size[0]; |
|
307 | - $image_width=$original_image_size[1]; |
|
308 | - } |
|
309 | - } else { |
|
310 | - //example for svg files,... |
|
311 | - $image_width=$max_thumbnail_width; |
|
312 | - $image_height=$max_thumbnail_height; |
|
313 | - } |
|
314 | - |
|
315 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
316 | - $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
317 | - |
|
318 | - }//end allowed image types |
|
319 | - }//end if exist file image |
|
320 | - }//end foreach |
|
321 | - }//end image files only |
|
322 | - |
|
323 | - // Creating the table |
|
324 | - $html_table = ''; |
|
325 | - |
|
326 | - $i = 0; |
|
327 | - $count_image = count($image_tag); |
|
328 | - $number_iteration = ceil($count_image/$number_image); |
|
329 | - $p = 0; |
|
300 | + $original_image_size = getimagesize($image); |
|
301 | + if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
302 | + $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
303 | + $image_height = $thumbnail_size['height']; |
|
304 | + $image_width = $thumbnail_size['width']; |
|
305 | + } else { |
|
306 | + $image_height=$original_image_size[0]; |
|
307 | + $image_width=$original_image_size[1]; |
|
308 | + } |
|
309 | + } else { |
|
310 | + //example for svg files,... |
|
311 | + $image_width=$max_thumbnail_width; |
|
312 | + $image_height=$max_thumbnail_height; |
|
313 | + } |
|
314 | + |
|
315 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
316 | + $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
317 | + |
|
318 | + }//end allowed image types |
|
319 | + }//end if exist file image |
|
320 | + }//end foreach |
|
321 | + }//end image files only |
|
322 | + |
|
323 | + // Creating the table |
|
324 | + $html_table = ''; |
|
325 | + |
|
326 | + $i = 0; |
|
327 | + $count_image = count($image_tag); |
|
328 | + $number_iteration = ceil($count_image/$number_image); |
|
329 | + $p = 0; |
|
330 | 330 | $html = ''; |
331 | 331 | $html .= '<div class="gallery">'; |
332 | - for ($k = 0; $k < $number_iteration; $k++) { |
|
333 | - for ($i = 0; $i < $number_image; $i++) { |
|
334 | - if (isset($image_tag[$p])) { |
|
332 | + for ($k = 0; $k < $number_iteration; $k++) { |
|
333 | + for ($i = 0; $i < $number_image; $i++) { |
|
334 | + if (isset($image_tag[$p])) { |
|
335 | 335 | $html .= '<div class="col-xs-6 col-sm-3 col-md-2">'; |
336 | 336 | $html .= '<div class="canvas-one">'; |
337 | 337 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | $html .= '</a>'; |
344 | 344 | $html .= '</div>'; |
345 | 345 | $html .= '</div>'; |
346 | - } |
|
347 | - $p++; |
|
348 | - } |
|
349 | - } |
|
346 | + } |
|
347 | + $p++; |
|
348 | + } |
|
349 | + } |
|
350 | 350 | $html .= '</div>'; |
351 | 351 | |
352 | 352 | }//end slide==all |
@@ -357,43 +357,43 @@ discard block |
||
357 | 357 | // This is for viewing all the images in the slideshow one at a time. |
358 | 358 | |
359 | 359 | if ($slide_id != 'all' && !empty($image_files_only)) { |
360 | - if (file_exists($image) && is_file($image)) { |
|
361 | - $image_height_width = resize_image($image, $target_width, $target_height); |
|
362 | - |
|
363 | - $image_height = $image_height_width[0]; |
|
364 | - $image_width = $image_height_width[1]; |
|
365 | - |
|
366 | - $height_width_tags = null; |
|
367 | - if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
368 | - $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
369 | - } |
|
370 | - |
|
371 | - // This is done really quickly and should be cleaned up a little bit using the API functions |
|
372 | - $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
373 | - if ($path == '/') { |
|
374 | - $pathpart = '/'; |
|
375 | - } else { |
|
376 | - $pathpart = $path.'/'; |
|
377 | - } |
|
378 | - $sql = "SELECT * FROM $tbl_documents |
|
360 | + if (file_exists($image) && is_file($image)) { |
|
361 | + $image_height_width = resize_image($image, $target_width, $target_height); |
|
362 | + |
|
363 | + $image_height = $image_height_width[0]; |
|
364 | + $image_width = $image_height_width[1]; |
|
365 | + |
|
366 | + $height_width_tags = null; |
|
367 | + if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
368 | + $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
369 | + } |
|
370 | + |
|
371 | + // This is done really quickly and should be cleaned up a little bit using the API functions |
|
372 | + $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
373 | + if ($path == '/') { |
|
374 | + $pathpart = '/'; |
|
375 | + } else { |
|
376 | + $pathpart = $path.'/'; |
|
377 | + } |
|
378 | + $sql = "SELECT * FROM $tbl_documents |
|
379 | 379 | WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'"; |
380 | - $result = Database::query($sql); |
|
381 | - $row = Database::fetch_array($result); |
|
380 | + $result = Database::query($sql); |
|
381 | + $row = Database::fetch_array($result); |
|
382 | 382 | |
383 | 383 | echo '<div class="thumbnail">'; |
384 | - if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
385 | - echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
386 | - } else { |
|
387 | - echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
388 | - } |
|
384 | + if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
385 | + echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
386 | + } else { |
|
387 | + echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
388 | + } |
|
389 | 389 | if ($path == '/') { |
390 | - $path = ''; |
|
390 | + $path = ''; |
|
391 | 391 | } |
392 | 392 | |
393 | - list($width, $height) = getimagesize($image); |
|
394 | - // Auto resize |
|
395 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
396 | - ?> |
|
393 | + list($width, $height) = getimagesize($image); |
|
394 | + // Auto resize |
|
395 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
396 | + ?> |
|
397 | 397 | |
398 | 398 | <script type="text/javascript"> |
399 | 399 | var initial_width='<?php echo $width; ?>'; |
@@ -446,21 +446,21 @@ discard block |
||
446 | 446 | |
447 | 447 | </script> |
448 | 448 | <?php |
449 | - } else { |
|
450 | - echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
451 | - } |
|
449 | + } else { |
|
450 | + echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
451 | + } |
|
452 | 452 | |
453 | - echo '</a>'; |
|
453 | + echo '</a>'; |
|
454 | 454 | echo '<div class="caption text-center">'; |
455 | 455 | echo Display::tag('h3', $row['title']); |
456 | 456 | echo '<p>' . $row['comment'] . '</p>'; |
457 | 457 | echo '</div>'; |
458 | 458 | echo '</div>'; |
459 | 459 | |
460 | - if (api_is_allowed_to_edit(null, true)) { |
|
460 | + if (api_is_allowed_to_edit(null, true)) { |
|
461 | 461 | echo '<ul class="list-unstyled">'; |
462 | - $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
463 | - $ext = $aux[count($aux) - 1]; |
|
462 | + $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
463 | + $ext = $aux[count($aux) - 1]; |
|
464 | 464 | |
465 | 465 | if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
466 | 466 | $resize_info = get_lang('Resizing').'<br />'; |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | $resize_height = get_lang('Auto'); |
473 | 473 | } else { |
474 | 474 | $resize_info = get_lang('NoResizing').'<br />'; |
475 | - $resize_width = ''; |
|
476 | - $resize_height = ''; |
|
475 | + $resize_width = ''; |
|
476 | + $resize_height = ''; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | echo '<li class="text-center">'; |
@@ -493,16 +493,16 @@ discard block |
||
493 | 493 | ); |
494 | 494 | echo '</li>'; |
495 | 495 | echo '<li class="text-center">' . $width.' x '.$height . '</li>'; |
496 | - echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
496 | + echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>'; |
|
497 | 497 | echo '<li class="text-center">' . $resize_info . '</li>'; |
498 | - echo '<li class="text-center">' . $resize_width . '</li>'; |
|
499 | - echo '<li class="text-center">' . $resize_height . '</li>'; |
|
498 | + echo '<li class="text-center">' . $resize_width . '</li>'; |
|
499 | + echo '<li class="text-center">' . $resize_height . '</li>'; |
|
500 | 500 | echo '</ul>'; |
501 | - } |
|
501 | + } |
|
502 | 502 | |
503 | - } else { |
|
504 | - Display::display_warning_message(get_lang('FileNotFound')); |
|
505 | - } |
|
503 | + } else { |
|
504 | + Display::display_warning_message(get_lang('FileNotFound')); |
|
505 | + } |
|
506 | 506 | } else { |
507 | 507 | if ($slide_id != 'all') { |
508 | 508 | Display::display_warning_message(get_lang('NoDataAvailable')); |
@@ -24,12 +24,12 @@ |
||
24 | 24 | $actions = array('listing', 'add', 'edit', 'delete', 'history'); |
25 | 25 | $action = 'listing'; |
26 | 26 | if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { |
27 | - $action = $_GET['action']; |
|
27 | + $action = $_GET['action']; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $description_type = ''; |
31 | 31 | if (isset($_GET['description_type'])) { |
32 | - $description_type = intval($_GET['description_type']); |
|
32 | + $description_type = intval($_GET['description_type']); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $id = null; |
@@ -13,39 +13,39 @@ discard block |
||
13 | 13 | // display categories |
14 | 14 | $categories = array (); |
15 | 15 | foreach ($default_description_titles as $id => $title) { |
16 | - $categories[$id] = $title; |
|
16 | + $categories[$id] = $title; |
|
17 | 17 | } |
18 | 18 | $categories[ADD_BLOCK] = get_lang('NewBloc'); |
19 | 19 | |
20 | 20 | $i=1; |
21 | 21 | echo '<div class="actions" style="margin-bottom:30px">'; |
22 | 22 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
23 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | - '</a>'; |
|
23 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | + '</a>'; |
|
25 | 25 | ksort($categories); |
26 | 26 | foreach ($categories as $id => $title) { |
27 | - if ($i == ADD_BLOCK) { |
|
28 | - echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | - Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | - break; |
|
31 | - } else { |
|
32 | - echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | - Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | - $i++; |
|
35 | - } |
|
27 | + if ($i == ADD_BLOCK) { |
|
28 | + echo '<a href="index.php?'.api_get_cidreq().'&action=add">'. |
|
29 | + Display::return_icon($default_description_icon[$id], $title, '',ICON_SIZE_MEDIUM).'</a>'; |
|
30 | + break; |
|
31 | + } else { |
|
32 | + echo '<a href="index.php?action=edit&'.api_get_cidreq().'&description_type='.$id.'">'. |
|
33 | + Display::return_icon($default_description_icon[$id], $title,'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | + $i++; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | echo '</div>'; |
38 | 38 | |
39 | 39 | // error messages |
40 | 40 | if (isset($error) && intval($error) == 1) { |
41 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
41 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // default header title form |
45 | 45 | $header = ''; |
46 | 46 | $description_type = intval($description_type); |
47 | 47 | if ($description_type >= ADD_BLOCK) { |
48 | - $header = $default_description_titles[ADD_BLOCK]; |
|
48 | + $header = $default_description_titles[ADD_BLOCK]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // display form |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | |
75 | 75 | // display default questions |
76 | 76 | if (isset ($question[$description_type])) { |
77 | - $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
78 | - $message .= $question[$description_type]; |
|
79 | - Display::display_normal_message($message, false); |
|
77 | + $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
78 | + $message .= $question[$description_type]; |
|
79 | + Display::display_normal_message($message, false); |
|
80 | 80 | } |
81 | 81 | $form->display(); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $reports_template['exercicesMultiCourses'] = array( |
4 | - 'description' => 'Result of each test per student', |
|
5 | - 'getSQL' => 'reports_template_exercicesMultiCourses_getSQL', |
|
6 | - 'wizard' => |
|
4 | + 'description' => 'Result of each test per student', |
|
5 | + 'getSQL' => 'reports_template_exercicesMultiCourses_getSQL', |
|
6 | + 'wizard' => |
|
7 | 7 | ' |
8 | 8 | <span id="exercicesMultiCourses" class="step"> |
9 | 9 | <span class="font_normal_07em_black">Result of each test per student</span><br /> |
@@ -32,39 +32,39 @@ discard block |
||
32 | 32 | '); |
33 | 33 | |
34 | 34 | function reports_template_exercicesMultiCourses_getSQL() { |
35 | - // foreach quiz |
|
36 | - $result = array(); |
|
37 | - $columns = Database::query('select r.id as kid, c.title as course, '. |
|
38 | - 'r.child_name as test from '. |
|
39 | - Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '. |
|
40 | - Database::get_main_table(TABLE_MAIN_COURSE).' c '. |
|
41 | - 'where r.course_id=c.id and r.tool_id='. |
|
42 | - reports_getToolId(TOOL_QUIZ). |
|
43 | - ' order by r.course_id, r.child_name'); |
|
44 | - if (Database::num_rows($columns) == 0) |
|
45 | - die('<b>'.get_lang('no data found').'</b>'); |
|
46 | - $query = 'select u.lastname Name, u.firstname Firstname'; |
|
47 | - $columns = Database::store_result($columns); |
|
48 | - if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
|
49 | - $function = $_REQUEST['tattempt']; |
|
50 | - else |
|
51 | - $function = 'avg'; |
|
52 | - foreach ($columns as $key => $column) |
|
53 | - $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
54 | - $column['course'].' - '. |
|
55 | - $column['test'].'` '; |
|
56 | - $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
|
57 | - foreach ($columns as $key => $column) // fixme sessions |
|
58 | - $query .= 'left outer join '. |
|
59 | - Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
|
60 | - ' k'.$key. |
|
61 | - ' on k'.$key.'.key_id = '.$column['kid']. |
|
62 | - ' and k'.$key.'.user_id = u.user_id '; |
|
63 | - $query .= ' group by '; |
|
64 | - foreach ($columns as $key => $column) // grouping attempt |
|
65 | - $query .= 'k'.$key.'.attempt, '; |
|
66 | - $query = substr($query, 0, -2); // removing last ', '; |
|
35 | + // foreach quiz |
|
36 | + $result = array(); |
|
37 | + $columns = Database::query('select r.id as kid, c.title as course, '. |
|
38 | + 'r.child_name as test from '. |
|
39 | + Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '. |
|
40 | + Database::get_main_table(TABLE_MAIN_COURSE).' c '. |
|
41 | + 'where r.course_id=c.id and r.tool_id='. |
|
42 | + reports_getToolId(TOOL_QUIZ). |
|
43 | + ' order by r.course_id, r.child_name'); |
|
44 | + if (Database::num_rows($columns) == 0) |
|
45 | + die('<b>'.get_lang('no data found').'</b>'); |
|
46 | + $query = 'select u.lastname Name, u.firstname Firstname'; |
|
47 | + $columns = Database::store_result($columns); |
|
48 | + if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
|
49 | + $function = $_REQUEST['tattempt']; |
|
50 | + else |
|
51 | + $function = 'avg'; |
|
52 | + foreach ($columns as $key => $column) |
|
53 | + $query .= ', '.$function.'(k'.$key.'.score) as `'. |
|
54 | + $column['course'].' - '. |
|
55 | + $column['test'].'` '; |
|
56 | + $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
|
57 | + foreach ($columns as $key => $column) // fixme sessions |
|
58 | + $query .= 'left outer join '. |
|
59 | + Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
|
60 | + ' k'.$key. |
|
61 | + ' on k'.$key.'.key_id = '.$column['kid']. |
|
62 | + ' and k'.$key.'.user_id = u.user_id '; |
|
63 | + $query .= ' group by '; |
|
64 | + foreach ($columns as $key => $column) // grouping attempt |
|
65 | + $query .= 'k'.$key.'.attempt, '; |
|
66 | + $query = substr($query, 0, -2); // removing last ', '; |
|
67 | 67 | |
68 | 68 | |
69 | - return $query; |
|
69 | + return $query; |
|
70 | 70 | } |
@@ -31,27 +31,27 @@ discard block |
||
31 | 31 | function search_coachs($needle) |
32 | 32 | { |
33 | 33 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
34 | - $xajax_response = new xajaxResponse(); |
|
35 | - $return = ''; |
|
34 | + $xajax_response = new xajaxResponse(); |
|
35 | + $return = ''; |
|
36 | 36 | |
37 | - if (!empty($needle)) { |
|
38 | - $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
37 | + if (!empty($needle)) { |
|
38 | + $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
|
39 | 39 | |
40 | - // search users where username or firstname or lastname begins likes $needle |
|
41 | - $sql = 'SELECT username, lastname, firstname |
|
40 | + // search users where username or firstname or lastname begins likes $needle |
|
41 | + $sql = 'SELECT username, lastname, firstname |
|
42 | 42 | FROM '.$tbl_user.' user |
43 | 43 | WHERE (username LIKE "'.$needle.'%" |
44 | 44 | OR firstname LIKE "'.$needle.'%" |
45 | 45 | OR lastname LIKE "'.$needle.'%") |
46 | 46 | AND status=1'. |
47 | - $order_clause. |
|
48 | - ' LIMIT 10'; |
|
49 | - |
|
50 | - if (api_is_multiple_url_enabled()) { |
|
51 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
52 | - $access_url_id = api_get_current_access_url_id(); |
|
53 | - if ($access_url_id != -1) { |
|
54 | - $sql = 'SELECT username, lastname, firstname |
|
47 | + $order_clause. |
|
48 | + ' LIMIT 10'; |
|
49 | + |
|
50 | + if (api_is_multiple_url_enabled()) { |
|
51 | + $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
52 | + $access_url_id = api_get_current_access_url_id(); |
|
53 | + if ($access_url_id != -1) { |
|
54 | + $sql = 'SELECT username, lastname, firstname |
|
55 | 55 | FROM '.$tbl_user.' user |
56 | 56 | INNER JOIN '.$tbl_user_rel_access_url.' url_user |
57 | 57 | ON (url_user.user_id=user.user_id) |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | AND status=1'. |
66 | 66 | $order_clause.' |
67 | 67 | LIMIT 10'; |
68 | - } |
|
69 | - } |
|
70 | - |
|
71 | - $rs = Database::query($sql); |
|
72 | - while ($user = Database :: fetch_array($rs)) { |
|
73 | - $return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />'; |
|
74 | - } |
|
75 | - } |
|
76 | - $xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return)); |
|
77 | - return $xajax_response; |
|
68 | + } |
|
69 | + } |
|
70 | + |
|
71 | + $rs = Database::query($sql); |
|
72 | + while ($user = Database :: fetch_array($rs)) { |
|
73 | + $return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />'; |
|
74 | + } |
|
75 | + } |
|
76 | + $xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return)); |
|
77 | + return $xajax_response; |
|
78 | 78 | } |
79 | 79 | $xajax -> processRequests(); |
80 | 80 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | </script>"; |
118 | 118 | |
119 | 119 | if (isset($_POST['formSent']) && $_POST['formSent']) { |
120 | - $formSent = 1; |
|
120 | + $formSent = 1; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $tool_name = get_lang('AddSession'); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | Display::display_header($tool_name); |
210 | 210 | |
211 | 211 | if (!empty($return)) { |
212 | - Display::display_error_message($return, false); |
|
212 | + Display::display_error_message($return, false); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | echo '<div class="actions">'; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | exit; |
58 | 58 | break; |
59 | 59 | case 'create_subgroups': |
60 | - GroupManager::create_subgroups( |
|
61 | - $_POST['base_group'], |
|
62 | - $_POST['number_of_groups'] |
|
63 | - ); |
|
60 | + GroupManager::create_subgroups( |
|
61 | + $_POST['base_group'], |
|
62 | + $_POST['number_of_groups'] |
|
63 | + ); |
|
64 | 64 | Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); |
65 | 65 | header("Location: ".$currentUrl); |
66 | 66 | exit; |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | if (isset($_POST['number_of_groups'])) { |
85 | 85 | if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { |
86 | 86 | Display :: display_error_message( |
87 | - get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
87 | + get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
88 | 88 | <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', |
89 | - false |
|
90 | - ); |
|
89 | + false |
|
90 | + ); |
|
91 | 91 | } else { |
92 | 92 | $number_of_groups = intval($_POST['number_of_groups']); |
93 | 93 | if ($number_of_groups > 1) { |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | } |
126 | 126 | </script> |
127 | 127 | <?php |
128 | - } |
|
129 | - $group_categories = GroupManager::get_categories(); |
|
130 | - $group_id = GroupManager :: get_number_of_groups() + 1; |
|
131 | - $cat_options = []; |
|
132 | - foreach ($group_categories as $index => $category) { |
|
133 | - $cat_options[$category['id']] = $category['title']; |
|
134 | - } |
|
128 | + } |
|
129 | + $group_categories = GroupManager::get_categories(); |
|
130 | + $group_id = GroupManager :: get_number_of_groups() + 1; |
|
131 | + $cat_options = []; |
|
132 | + foreach ($group_categories as $index => $category) { |
|
133 | + $cat_options[$category['id']] = $category['title']; |
|
134 | + } |
|
135 | 135 | $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); |
136 | 136 | |
137 | - // Modify the default templates |
|
138 | - $renderer = $form->defaultRenderer(); |
|
139 | - $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
140 | - $renderer->setFormTemplate($form_template); |
|
141 | - $element_template = <<<EOT |
|
137 | + // Modify the default templates |
|
138 | + $renderer = $form->defaultRenderer(); |
|
139 | + $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
140 | + $renderer->setFormTemplate($form_template); |
|
141 | + $element_template = <<<EOT |
|
142 | 142 | <tr class="separate"> |
143 | 143 | <td> |
144 | 144 | <!-- BEGIN required --> |
@@ -151,35 +151,35 @@ discard block |
||
151 | 151 | </tr> |
152 | 152 | |
153 | 153 | EOT; |
154 | - $renderer->setCustomElementTemplate($element_template); |
|
154 | + $renderer->setCustomElementTemplate($element_template); |
|
155 | 155 | $form->addElement('header', $nameTools); |
156 | - $form->addElement('hidden', 'action'); |
|
157 | - $form->addElement('hidden', 'number_of_groups'); |
|
158 | - $defaults = array(); |
|
159 | - // Table heading |
|
160 | - $group_el = array(); |
|
161 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
156 | + $form->addElement('hidden', 'action'); |
|
157 | + $form->addElement('hidden', 'number_of_groups'); |
|
158 | + $defaults = array(); |
|
159 | + // Table heading |
|
160 | + $group_el = array(); |
|
161 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
162 | 162 | |
163 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
164 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
165 | - } |
|
166 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
167 | - $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
168 | - // Checkboxes |
|
169 | - if ($_POST['number_of_groups'] > 1) { |
|
170 | - $group_el = array (); |
|
171 | - $group_el[] = $form->createElement('static', null, null, ' '); |
|
172 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
173 | - $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
174 | - } |
|
175 | - $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
176 | - $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
177 | - } |
|
178 | - // Properties for all groups |
|
179 | - for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
180 | - $group_el = array(); |
|
181 | - $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
182 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
163 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
164 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
165 | + } |
|
166 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
167 | + $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
168 | + // Checkboxes |
|
169 | + if ($_POST['number_of_groups'] > 1) { |
|
170 | + $group_el = array (); |
|
171 | + $group_el[] = $form->createElement('static', null, null, ' '); |
|
172 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
173 | + $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
174 | + } |
|
175 | + $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
176 | + $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
177 | + } |
|
178 | + // Properties for all groups |
|
179 | + for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
180 | + $group_el = array(); |
|
181 | + $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
182 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
183 | 183 | $group_el[] = $form->createElement( |
184 | 184 | 'select', |
185 | 185 | 'group_'.$group_number.'_category', |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $cat_options, |
188 | 188 | array('id' => 'category_'.$group_number) |
189 | 189 | ); |
190 | - } |
|
190 | + } |
|
191 | 191 | $group_el[] = $form->createElement( |
192 | 192 | 'text', |
193 | 193 | 'group_'.$group_number.'_places', |
@@ -195,111 +195,111 @@ discard block |
||
195 | 195 | array('class' => 'span1', 'id' => 'places_'.$group_number) |
196 | 196 | ); |
197 | 197 | |
198 | - if ($_POST['number_of_groups'] < 10000) { |
|
199 | - if ($group_id < 10) { |
|
200 | - $prev = '000'; |
|
201 | - } elseif ($group_id < 100) { |
|
202 | - $prev = '00'; |
|
203 | - } elseif ($group_id<1000) { |
|
204 | - $prev = '0'; |
|
205 | - } else { |
|
206 | - $prev = ''; |
|
207 | - } |
|
208 | - } |
|
198 | + if ($_POST['number_of_groups'] < 10000) { |
|
199 | + if ($group_id < 10) { |
|
200 | + $prev = '000'; |
|
201 | + } elseif ($group_id < 100) { |
|
202 | + $prev = '00'; |
|
203 | + } elseif ($group_id<1000) { |
|
204 | + $prev = '0'; |
|
205 | + } else { |
|
206 | + $prev = ''; |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | - $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
211 | - $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
212 | - } |
|
213 | - $defaults['action'] = 'create_groups'; |
|
214 | - $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
215 | - $form->setDefaults($defaults); |
|
216 | - $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
210 | + $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
211 | + $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
212 | + } |
|
213 | + $defaults['action'] = 'create_groups'; |
|
214 | + $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
215 | + $form->setDefaults($defaults); |
|
216 | + $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
217 | 217 | $form->display(); |
218 | - } |
|
218 | + } |
|
219 | 219 | } else { |
220 | - /* |
|
220 | + /* |
|
221 | 221 | * Show form to generate new groups |
222 | 222 | */ |
223 | 223 | |
224 | - $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
225 | - $create_groups_form->addElement('header', $nameTools); |
|
224 | + $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
225 | + $create_groups_form->addElement('header', $nameTools); |
|
226 | 226 | $create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1')); |
227 | 227 | $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary'); |
228 | - $defaults = array(); |
|
229 | - $defaults['number_of_groups'] = 1; |
|
230 | - $create_groups_form->setDefaults($defaults); |
|
231 | - $create_groups_form->display(); |
|
228 | + $defaults = array(); |
|
229 | + $defaults['number_of_groups'] = 1; |
|
230 | + $create_groups_form->setDefaults($defaults); |
|
231 | + $create_groups_form->display(); |
|
232 | 232 | |
233 | - /* |
|
233 | + /* |
|
234 | 234 | * Show form to generate subgroups |
235 | 235 | */ |
236 | - if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
237 | - $base_group_options = array (); |
|
238 | - $groups = GroupManager :: get_group_list(); |
|
239 | - foreach ($groups as $index => $group) { |
|
240 | - $number_of_students = GroupManager :: number_of_students($group['id']); |
|
241 | - if ($number_of_students > 0) { |
|
242 | - $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
243 | - } |
|
244 | - } |
|
245 | - if (count($base_group_options) > 0) { |
|
246 | - $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
236 | + if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
237 | + $base_group_options = array (); |
|
238 | + $groups = GroupManager :: get_group_list(); |
|
239 | + foreach ($groups as $index => $group) { |
|
240 | + $number_of_students = GroupManager :: number_of_students($group['id']); |
|
241 | + if ($number_of_students > 0) { |
|
242 | + $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
243 | + } |
|
244 | + } |
|
245 | + if (count($base_group_options) > 0) { |
|
246 | + $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
247 | 247 | $create_subgroups_form->addElement('header', get_lang('CreateSubgroups')); |
248 | 248 | $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo')); |
249 | - $create_subgroups_form->addElement('hidden', 'action'); |
|
250 | - $group_el = array(); |
|
251 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
252 | - $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
253 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
254 | - $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
255 | - $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
256 | - $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
257 | - $defaults = array(); |
|
258 | - $defaults['action'] = 'create_subgroups'; |
|
259 | - $create_subgroups_form->setDefaults($defaults); |
|
260 | - $create_subgroups_form->display(); |
|
261 | - } |
|
262 | - } |
|
249 | + $create_subgroups_form->addElement('hidden', 'action'); |
|
250 | + $group_el = array(); |
|
251 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
252 | + $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
253 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
254 | + $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
255 | + $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
256 | + $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
257 | + $defaults = array(); |
|
258 | + $defaults['action'] = 'create_subgroups'; |
|
259 | + $create_subgroups_form->setDefaults($defaults); |
|
260 | + $create_subgroups_form->display(); |
|
261 | + } |
|
262 | + } |
|
263 | 263 | |
264 | - /* |
|
264 | + /* |
|
265 | 265 | * Show form to generate groups from classes subscribed to the course |
266 | 266 | */ |
267 | 267 | $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id()); |
268 | 268 | $obj = new UserGroup(); |
269 | 269 | $classes = $obj->getUserGroupInCourse($options); |
270 | - if (count($classes) > 0) { |
|
271 | - echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
272 | - echo '<blockquote>'; |
|
273 | - echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
274 | - echo '<ul>'; |
|
275 | - foreach ($classes as $index => $class) { |
|
276 | - $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
277 | - echo '<li>'; |
|
278 | - echo $class['name']; |
|
279 | - echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
280 | - echo '</li>'; |
|
281 | - } |
|
282 | - echo '</ul>'; |
|
270 | + if (count($classes) > 0) { |
|
271 | + echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
272 | + echo '<blockquote>'; |
|
273 | + echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
274 | + echo '<ul>'; |
|
275 | + foreach ($classes as $index => $class) { |
|
276 | + $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
277 | + echo '<li>'; |
|
278 | + echo $class['name']; |
|
279 | + echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
280 | + echo '</li>'; |
|
281 | + } |
|
282 | + echo '</ul>'; |
|
283 | 283 | |
284 | - $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
285 | - $create_class_groups_form->addElement('hidden', 'action'); |
|
286 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
287 | - $group_categories = GroupManager :: get_categories(); |
|
288 | - $cat_options = array(); |
|
289 | - foreach ($group_categories as $index => $category) { |
|
290 | - $cat_options[$category['id']] = $category['title']; |
|
291 | - } |
|
292 | - $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
293 | - } else { |
|
294 | - $create_class_groups_form->addElement('hidden', 'group_category'); |
|
295 | - } |
|
296 | - $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
297 | - $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
298 | - $defaults['action'] = 'create_class_groups'; |
|
299 | - $create_class_groups_form->setDefaults($defaults); |
|
300 | - $create_class_groups_form->display(); |
|
301 | - echo '</blockquote>'; |
|
302 | - } |
|
284 | + $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
285 | + $create_class_groups_form->addElement('hidden', 'action'); |
|
286 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
287 | + $group_categories = GroupManager :: get_categories(); |
|
288 | + $cat_options = array(); |
|
289 | + foreach ($group_categories as $index => $category) { |
|
290 | + $cat_options[$category['id']] = $category['title']; |
|
291 | + } |
|
292 | + $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
293 | + } else { |
|
294 | + $create_class_groups_form->addElement('hidden', 'group_category'); |
|
295 | + } |
|
296 | + $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
297 | + $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
298 | + $defaults['action'] = 'create_class_groups'; |
|
299 | + $create_class_groups_form->setDefaults($defaults); |
|
300 | + $create_class_groups_form->display(); |
|
301 | + echo '</blockquote>'; |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | Display :: display_footer(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function print_table($data_array,$header_names,$view,$coursename) |
16 | 16 | { |
17 | - $printdata = '<!DOCTYPE html |
|
17 | + $printdata = '<!DOCTYPE html |
|
18 | 18 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
19 | 19 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
20 | 20 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.api_get_language_isocode().'" lang="'.api_get_language_isocode().'"> |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | */ |
98 | 98 | function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf) |
99 | 99 | { |
100 | - $mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L'); |
|
101 | - $mpdf->useOnlyCoreFonts = true; |
|
102 | - $mpdf->mirrorMargins = 0; |
|
100 | + $mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L'); |
|
101 | + $mpdf->useOnlyCoreFonts = true; |
|
102 | + $mpdf->mirrorMargins = 0; |
|
103 | 103 | // Use different Odd/Even headers and footers and mirror margins |
104 | 104 | |
105 | - if (is_array($headers_pdf)) { |
|
106 | - // preparing headers pdf |
|
107 | - $header = ' |
|
105 | + if (is_array($headers_pdf)) { |
|
106 | + // preparing headers pdf |
|
107 | + $header = ' |
|
108 | 108 | <table width="100%" cellspacing="1" cellpadding="1" border="0" class="strong"> |
109 | 109 | <tr> |
110 | 110 | <td ROWSPAN="3" style="text-align: left;" class="title"> |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $items_per_page = count($data_table); |
159 | 159 | } |
160 | 160 | |
161 | - $count_pages = ceil(count($data_table) / $items_per_page); |
|
161 | + $count_pages = ceil(count($data_table) / $items_per_page); |
|
162 | 162 | $content_table = ''; |
163 | 163 | for ($x = 0; $x<$count_pages; $x++) { |
164 | 164 | $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">'; |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | */ |
327 | 327 | function export_pdf($pdf, $newarray, $header_names, $format) |
328 | 328 | { |
329 | - $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm'); |
|
330 | - $pdf->ezSetCmMargins(0,0,0,0); |
|
331 | - $pdf->ezSetY(($format=='portrait')?'820':'570'); |
|
332 | - $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm'); |
|
329 | + $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm'); |
|
330 | + $pdf->ezSetCmMargins(0,0,0,0); |
|
331 | + $pdf->ezSetY(($format=='portrait')?'820':'570'); |
|
332 | + $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm'); |
|
333 | 333 | if ($format == 'portrait') { |
334 | 334 | $pdf->line(40, 790, 540, 790); |
335 | 335 | $pdf->line(40, 40, 540, 40); |
@@ -345,5 +345,5 @@ discard block |
||
345 | 345 | 'rowGap' => 3, |
346 | 346 | 'width' => (($format == 'portrait') ? '500' : '750'), |
347 | 347 | )); |
348 | - $pdf->ezStream(); |
|
348 | + $pdf->ezStream(); |
|
349 | 349 | } |
@@ -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 | ?> |
@@ -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 | ?> |