$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);
示例#2
0
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) {
        echo '<p>' . $captionstring . '<p>';