Пример #1
0
    $slideshow = $DB->get_record('slideshow', array('id' => $a), '*', MUST_EXIST);
    $cm = get_coursemodule_from_instance('slideshow', $slideshow->id, $slideshow->course, false, MUST_EXIST);
} else {
    $cm = get_coursemodule_from_id('slideshow', $id, 0, false, MUST_EXIST);
    $slideshow = $DB->get_record('slideshow', array('id' => $cm->instance), '*', MUST_EXIST);
}
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course->id);
add_to_log($course->id, "slideshow", "captions", "captions.php?id={$cm->id}", "{$slideshow->id}");
$form = data_submitted();
if ($form) {
    if (isset($form->cancel)) {
        redirect("view.php?id={$id}");
        die;
    }
    slideshow_write_captions($form, $slideshow);
    redirect("view.php?id={$id}");
    die;
}
add_to_log($course->id, "slideshow", "captions", "captions.php?id={$cm->id}", "{$slideshow->id}");
/// Print header.
$PAGE->set_url('/mod/slideshow/captions.php', array('id' => $cm->id));
$PAGE->navbar->add($slideshow->name);
echo $OUTPUT->header();
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// Print the main part of the page
$img_count = 0;
if (has_capability('moodle/course:update', $coursecontext)) {
    $conditions = array('contextid' => $context->id, 'component' => 'mod_slideshow', 'filearea' => 'content', 'itemid' => 0);
    $file_records = $DB->get_records('files', $conditions);
Пример #2
0
require_login($course->id);
add_to_log($course->id, "slideshow", "captions", "captions.php?id={$cm->id}", "{$slideshow->id}");
/// 1.8 compatible?
/// Print header.
$strslideshows = get_string("modulenameplural", "slideshow");
$navigation = "<a href=\"index.php?id={$course->id}\">{$strslideshows}</a> ->";
print_header_simple(format_string($slideshow->name), "", "{$navigation} <a href=\"view.php?id={$cm->id}\">" . format_string($slideshow->name) . '</a>', "", "", true, $buttontext, navmenu($course, $cm));
/// Print the main part of the page
$course_dir = $CFG->dataroot . '/' . $course->id;
$showdir = $slideshow->location;
//echo '<br>$course_dir: '.$course_dir.'<br>$showdir: '.$showdir;
$img_count = 0;
if ($_POST["captions"]) {
    echo '<div align="center">';
    if (isteacher($course->id)) {
        slideshow_write_captions($_POST);
        //
        //
        echo '<p>' . get_string('saved', 'slideshow');
    }
    echo '<p><form method = "post" action = "view.php?id=' . $cm->id . '"><input type = "submit" value = "' . get_string('continue', 'slideshow') . '"></form></div>';
} else {
    echo '<p style="margin-left : 5px">' . get_string('captiontext', 'slideshow');
    if ($dh = opendir($course_dir . '/' . $showdir)) {
        $img_count = 0;
        $mythumbdir = $course_dir . '/moddata/' . $slideshow_thumbdir . '/' . $showdir;
        if ($CFG->slasharguments) {
            $urlroot = $CFG->wwwroot . '/file.php/' . $course->id;
        } else {
            $urlroot = $CFG->wwwroot . '/file.php?file=/' . $course->id;
        }