} sort($filearray); if ($slideshow->centred) { echo '<div align="center">'; } if ($img_count) { // // $slideshow->layout defines thumbnail position - 1 is on top, 2 is bottom // $slideshow->filename defines the position of captions. 1 is on top, 2 is bottom, 3 is on the right // if ($slideshow->layout == 1) { // print thumbnail row slideshow_display_thumbs($filearray); } // process caption text $currentimage = slideshow_filetidy($filearray[$img_num]); $caption_array[$currentimage] = slideshow_caption_array($slideshow->id, $currentimage); if (isset($caption_array[$currentimage])) { $captionstring = $caption_array[$currentimage]['caption']; $titlestring = $caption_array[$currentimage]['title']; } else { $captionstring = $currentimage; $titlestring = ''; } // // if there is a title, show it! if ($titlestring) { echo format_text('<h1>' . $titlestring . '</h1>'); } echo '<p style="margin-left : 5px">'; if ($slideshow->filename == 1) {
$file_records = $DB->get_records('files', $conditions); $captions = array(); foreach ($file_records as $filerecord) { $filename = $filerecord->filename; if (eregi("\\.jpe?g\$", $filename) || eregi("\\.gif\$", $filename) || eregi("\\.png\$", $filename)) { if (eregi("^thumb_", $filename)) { continue; } if (eregi("^resized_", $filename)) { if ($slideshow->keeporiginals) { continue; } else { $filename = str_replace('resized_', '', $filename); } } $image = slideshow_filetidy($filename); $captions[$image] = slideshow_caption_array($slideshow->id, $image); } } sort($captions); require_once 'edit_form.php'; echo $OUTPUT->heading(get_string('edit_captions', 'slideshow', '')); echo get_string('captiontext', 'slideshow', ''); $htmledit = isset($slideshow->htmlcaptions) ? $slideshow->htmlcaptions : 0; $mform = new mod_slideshow_edit_form('captions.php', array('captions' => $captions, 'htmledit' => $htmledit, 'context' => $context, 'slideshowid' => $slideshow->id)); $mform->display(); } else { echo get_string('noauth', 'slideshow', ''); } /// Finish the page echo $OUTPUT->footer($course);
//$piclist[$img_count] = $filename; if (!file_exists($my_thumbdir . '/' . $filename)) { slideshow_thumbnail($course_dir, $slideshow->location, $filename); } $currentimage = slideshow_filetidy($filename); if ($caption_array[$currentimage]['image'] != '') { $captionstring = $caption_array[$currentimage]['caption']; $titlestring = $caption_array[$currentimage]['title']; } else { $captionstring = $currentimage; $titlestring = ''; } echo '<tr><td align = "right"><img src="' . $urlroot . '/moddata/' . $slideshow_thumbdir . '/' . $slideshow->location . '/' . $filename . '" alt="' . htmlentities($captionstring) . '"></td>' . "\n"; echo '<td>'; if (isteacher($course->id)) { echo '<input type = "hidden" name="image' . ++$img_count . '" value="' . slideshow_filetidy($filename) . '"> ' . "\n"; echo 'Title: <input type = "text" name="title' . $img_count . '" value="' . str_replace("\"", """, $titlestring) . '" size="40">'; echo '<br>Caption: <input type = "text" name="caption' . $img_count . '" value="' . str_replace("\"", """, $captionstring) . '" size="80">'; } else { echo $captionstring; } echo '</td></tr>' . "\n"; } echo '</table>'; } else { // NO GD! /////////////////////////////////////// error('Sorry, You need to enable GD to use this module'); } if (isteacher($course->id)) { echo '<input type = "hidden" name="captions" value="captions">'; echo '<p><input type = "submit" value="' . get_string('save_changes', 'slideshow') . '">';