Permalink
Browse files

Added slideshow name to page title in captions, media and autopopup w…

…indow.
  • Loading branch information...
1 parent ed6994a commit 18956d553e89425b9b645eda126d3179dd0e5cf7 John committed Dec 29, 2012
Showing with 104 additions and 102 deletions.
  1. +1 −0 captions.php
  2. +102 −101 media.php
  3. +1 −1 view.php
View
@@ -35,6 +35,7 @@
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->set_title(get_string('pluginname', 'mod_slideshow') . ': ' . $slideshow->name);
$PAGE->navbar->add($slideshow->name);
echo $OUTPUT->header();
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
View
203 media.php
@@ -1,101 +1,102 @@
-<?php
-
-/// This page prints a form to edit media and titles for the images in the slideshow folder
- global $DB;
- global $PAGE;
- require_once("../../config.php");
- require_once("lib.php");
-
- $id = optional_param('id',0,PARAM_INT);
- $a = optional_param('a',0,PARAM_INT);
- $img_num = optional_param('img_num',0,PARAM_INT);
-
- if ($a) { // Two ways to specify the module
- $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", "media", "media.php?id=$cm->id", "$slideshow->id");
-
- $form = data_submitted();
- if ($form) {
- if (isset($form->cancel)) {
- redirect("view.php?id=$id");
- die;
- }
- if(isset($form->mediadelete) && $form->mediadelete) {
- if($media = slideshow_slide_get_media($form->slideshowid, $form->slidenumber)) {
- if(! $DB->delete_records("slideshow_media", array('slideshowid' => $form->slideshowid, 'slidenumber' => $form->slidenumber))) {
- print_error("Error deleting media.");
- }
- }
- }
- else {
- slideshow_write_media($form, $slideshow);
- }
- redirect("view.php?id=$id&img_num=$form->slidenumber");
- die;
- }
- add_to_log($course->id, "slideshow", "media", "media.php?id=$cm->id", "$slideshow->id");
- // Print header.
- $PAGE->set_url('/mod/slideshow/media.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);
-
- // Javascript to allow positioning of media on slide.
- $jsmodule = array(
- 'name' => 'mod_slideshow',
- 'fullpath' => '/mod/slideshow/module.js',
- 'requires' => array("node", "dd-plugin"));
- $PAGE->requires->js_init_call('M.local_slideshow.init',
- null, false, $jsmodule);
-
- // Print the main part of the page
- $img_count = 0;
- $img_filename = "";
- 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);
- $captions = array();
- foreach ($file_records as $filerecord) {
- $filename = $filerecord->filename;
- if ( preg_match("#\.jpe?g$#i", $filename) || preg_match("#\.gif$#i", $filename) || preg_match("#\.png$#i", $filename)) {
- if (preg_match("#^thumb_?#i", $filename)) {
- continue;
- }
- if (preg_match("#^resized_#i", $filename)) {
- if ($slideshow->keeporiginals) {
- continue;
- }else{
- $filename = str_replace('resized_','',$filename);
- }
- }
- $img_filename = $filename;
- $image = slideshow_filetidy($filename);
- $captions[$image] = slideshow_caption_array($slideshow->id,$image);
- }
- }
- sort($captions);
-
- // Display the actual form.
- require_once('edit_form.php');
- echo $OUTPUT->heading(get_string('media_add', 'slideshow'));
- echo get_string('media_instructions', 'slideshow');
- $img_filename = pathinfo($img_filename, PATHINFO_FILENAME);
- $media = slideshow_slide_get_media($slideshow->id, $img_num);
- $mform = new mod_slideshow_media_form('media.php', array('context' => $context, 'slideshowid' => $slideshow->id, 'slidenumber' => $img_num, 'imgfilename' => $img_filename, 'media' => $media));
- $mform->display();
- } else {
- echo get_string('noauth','slideshow','');
- }
-/// Finish the page
- echo $OUTPUT->footer($course);
-?>
+<?php
+
+/// This page prints a form to edit media and titles for the images in the slideshow folder
+ global $DB;
+ global $PAGE;
+ require_once("../../config.php");
+ require_once("lib.php");
+
+ $id = optional_param('id',0,PARAM_INT);
+ $a = optional_param('a',0,PARAM_INT);
+ $img_num = optional_param('img_num',0,PARAM_INT);
+
+ if ($a) { // Two ways to specify the module
+ $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", "media", "media.php?id=$cm->id", "$slideshow->id");
+
+ $form = data_submitted();
+ if ($form) {
+ if (isset($form->cancel)) {
+ redirect("view.php?id=$id");
+ die;
+ }
+ if(isset($form->mediadelete) && $form->mediadelete) {
+ if($media = slideshow_slide_get_media($form->slideshowid, $form->slidenumber)) {
+ if(! $DB->delete_records("slideshow_media", array('slideshowid' => $form->slideshowid, 'slidenumber' => $form->slidenumber))) {
+ print_error("Error deleting media.");
+ }
+ }
+ }
+ else {
+ slideshow_write_media($form, $slideshow);
+ }
+ redirect("view.php?id=$id&img_num=$form->slidenumber");
+ die;
+ }
+ add_to_log($course->id, "slideshow", "media", "media.php?id=$cm->id", "$slideshow->id");
+ // Print header.
+ $PAGE->set_url('/mod/slideshow/media.php',array('id' => $cm->id));
+ $PAGE->set_title(get_string('pluginname', 'mod_slideshow') . ': ' . $slideshow->name);
+ $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);
+
+ // Javascript to allow positioning of media on slide.
+ $jsmodule = array(
+ 'name' => 'mod_slideshow',
+ 'fullpath' => '/mod/slideshow/module.js',
+ 'requires' => array("node", "dd-plugin"));
+ $PAGE->requires->js_init_call('M.local_slideshow.init',
+ null, false, $jsmodule);
+
+ // Print the main part of the page
+ $img_count = 0;
+ $img_filename = "";
+ 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);
+ $captions = array();
+ foreach ($file_records as $filerecord) {
+ $filename = $filerecord->filename;
+ if ( preg_match("#\.jpe?g$#i", $filename) || preg_match("#\.gif$#i", $filename) || preg_match("#\.png$#i", $filename)) {
+ if (preg_match("#^thumb_?#i", $filename)) {
+ continue;
+ }
+ if (preg_match("#^resized_#i", $filename)) {
+ if ($slideshow->keeporiginals) {
+ continue;
+ }else{
+ $filename = str_replace('resized_','',$filename);
+ }
+ }
+ $img_filename = $filename;
+ $image = slideshow_filetidy($filename);
+ $captions[$image] = slideshow_caption_array($slideshow->id,$image);
+ }
+ }
+ sort($captions);
+
+ // Display the actual form.
+ require_once('edit_form.php');
+ echo $OUTPUT->heading(get_string('media_add', 'slideshow'));
+ echo get_string('media_instructions', 'slideshow');
+ $img_filename = pathinfo($img_filename, PATHINFO_FILENAME);
+ $media = slideshow_slide_get_media($slideshow->id, $img_num);
+ $mform = new mod_slideshow_media_form('media.php', array('context' => $context, 'slideshowid' => $slideshow->id, 'slidenumber' => $img_num, 'imgfilename' => $img_filename, 'media' => $media));
+ $mform->display();
+ } else {
+ echo get_string('noauth','slideshow','');
+ }
+/// Finish the page
+ echo $OUTPUT->footer($course);
+?>
View
@@ -51,7 +51,7 @@
$PAGE->set_title(get_string('pluginname', 'mod_slideshow') . ': ' . $slideshow->name);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'slideshow'));
if ($autoshow) { // auto progress of images, no crumb trail
- echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>';
+ echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>' . $slideshow->name . '</title></head><body>';
$slideshow->layout = 9; //layout 9 prevents thumbnails being created
if (!$pause){
if(!($autodelay = $slideshow->delaytime)>0) { // set seconds wait for auto popup progress

0 comments on commit 18956d5

Please sign in to comment.