diff --git a/mod/resource/type/html/html.html b/mod/resource/type/html/html.html index 3d24f135e5b..ac64c7c99bf 100644 --- a/mod/resource/type/html/html.html +++ b/mod/resource/type/html/html.html @@ -64,11 +64,19 @@
+ + options == "showblocks") ? "checked=\"checked\"" : "" ?> alt="" /> + ++
- \ No newline at end of file + diff --git a/mod/resource/type/html/resource.class.php b/mod/resource/type/html/resource.class.php index 7c922587525..4eea11cb340 100644 --- a/mod/resource/type/html/resource.class.php +++ b/mod/resource/type/html/resource.class.php @@ -30,6 +30,10 @@ function add_instance($resource) { $resource->popup = ""; } + if (isset($resource->blockdisplay)) { + $resource->options = 'showblocks'; + } + if (isset($resource->parametersettingspref)) { set_user_preference('resource_parametersettingspref', $resource->parametersettingspref); } @@ -64,6 +68,10 @@ function update_instance($resource) { $resource->popup = ""; } + if (isset($resource->blockdisplay)) { + $resource->options = 'showblocks'; + } + if (isset($resource->parametersettingspref)) { set_user_preference('resource_parametersettingspref', $resource->parametersettingspref); } @@ -79,67 +87,82 @@ function update_instance($resource) { function display() { global $CFG; -/// Set up generic stuff first, including checking for access - parent::display(); + /// Are we displaying the course blocks? + if ($this->resource->options == 'showblocks') { -/// Set up some shorthand variables - $cm = $this->cm; - $course = $this->course; - $resource = $this->resource; + parent::display_course_blocks_start(); - $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name)); - $formatoptions->noclean = true; - $inpopup_param = optional_param( 'inpopup','' ); - $inpopup = !empty($inpopup_param); + $formatoptions->noclean = true; + print_simple_box(format_text($this->resource->alltext, FORMAT_HTML, $formatoptions, $this->course->id), "center", "", "", "20"); - if ($resource->popup) { - if ($inpopup) { /// Popup only - add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); - print_header(); - print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), - "center", "", "", "20"); - print_footer($course); - } else { /// Make a page and a pop-up window + parent::display_course_blocks_end(); - print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), - "", "", true, update_module_button($cm->id, $course->id, $this->strresource), - navmenu($course, $cm)); + } else { - echo "\n'; - - if (trim(strip_tags($resource->summary))) { - print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); + /// Set up generic stuff first, including checking for access + parent::display(); + + /// Set up some shorthand variables + $cm = $this->cm; + $course = $this->course; + $resource = $this->resource; + + $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name)); + $formatoptions->noclean = true; + $inpopup_param = optional_param( 'inpopup','' ); + $inpopup = !empty($inpopup_param); + + if ($resource->popup) { + if ($inpopup) { /// Popup only + add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); + print_header(); + print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), + "center", "", "", "20"); + print_footer($course); + } else { /// Make a page and a pop-up window + + print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), + "", "", true, update_module_button($cm->id, $course->id, $this->strresource), + navmenu($course, $cm)); + + echo "\n'; + + if (trim(strip_tags($resource->summary))) { + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); + } + + $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true).""; + + echo " 
"; + echo ''; + print_string('popupresource', 'resource'); + echo '
"; + + print_footer($course); } - - $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true).""; - - echo "
'; + print_string('popupresourcelink', 'resource', $link); + echo " 
"; - echo ''; - print_string('popupresource', 'resource'); - echo '
"; - + } else { /// not a popup at all + + add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); + print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), + "", "", true, update_module_button($cm->id, $course->id, $this->strresource), + navmenu($course, $cm)); + + print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "", "20"); + + $strlastmodified = get_string("lastmodified"); + echo "
'; - print_string('popupresourcelink', 'resource', $link); - echo ""; + print_footer($course); } - } else { /// not a popup at all - add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); - print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), - "", "", true, update_module_button($cm->id, $course->id, $this->strresource), - navmenu($course, $cm)); - - print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center", "", "", "20"); - - $strlastmodified = get_string("lastmodified"); - echo " $strlastmodified: ".userdate($resource->timemodified)."
"; - - print_footer($course); } + } @@ -164,9 +187,9 @@ function setup($form) { $jsoption[] = "\"$optionname\""; } - $frameoption = "\"framepage\""; + $blockoption = "\"blockdisplay\""; $popupoptions = implode(",", $jsoption); - $jsoption[] = $frameoption; + $jsoption[] = $blockoption; $alloptions = implode(",", $jsoption); if ($form->instance) { // Re-editing diff --git a/mod/resource/type/text/resource.class.php b/mod/resource/type/text/resource.class.php index 3f7ce76c23d..94752de2638 100644 --- a/mod/resource/type/text/resource.class.php +++ b/mod/resource/type/text/resource.class.php @@ -31,6 +31,10 @@ function add_instance($resource) { $resource->popup = ""; } + if (isset($resource->blockdisplay)) { + $resource->options = 'showblocks'; + } + if (isset($resource->parametersettingspref)) { set_user_preference('resource_parametersettingspref', $resource->parametersettingspref); } @@ -64,6 +68,10 @@ function update_instance($resource) { $resource->popup = ""; } + if (isset($resource->blockdisplay)) { + $resource->options = 'showblocks'; + } + if (isset($resource->parametersettingspref)) { set_user_preference('resource_parametersettingspref', $resource->parametersettingspref); } @@ -77,68 +85,86 @@ function update_instance($resource) { function display() { global $CFG; -/// Set up generic stuff first, including checking for access - parent::display(); -/// Set up some shorthand variables - $cm = $this->cm; - $course = $this->course; - $resource = $this->resource; + /// Are we displaying the course blocks? + if ($this->resource->options == 'showblocks') { - $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name)); - $formatoptions->noclean = true; - $inpopup_param = optional_param( 'inpopup', '' ); - $inpopup = !empty($inpopup_param); + parent::display_course_blocks_start(); - if ($resource->popup) { - if ($inpopup) { /// Popup only - add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", - $resource->id, $cm->id); - print_header(); - print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), - "center", "", "", "20"); - print_footer($course); - } else { /// Make a page and a pop-up window + $formatoptions->noclean = true; + + if (trim(strip_tags($this->resource->summary))) { + echo format_text($this->resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id); + } - print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), - "", "", true, update_module_button($cm->id, $course->id, $this->strresource), - navmenu($course, $cm)); + parent::display_course_blocks_end(); - echo "\n'; - - if (trim(strip_tags($resource->summary))) { - print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); + } else { + + /// Set up generic stuff first, including checking for access + parent::display(); + + /// Set up some shorthand variables + $cm = $this->cm; + $course = $this->course; + $resource = $this->resource; + + $pagetitle = strip_tags($course->shortname.': '.format_string($resource->name)); + $formatoptions->noclean = true; + $inpopup_param = optional_param( 'inpopup', '' ); + $inpopup = !empty($inpopup_param); + + if ($resource->popup) { + if ($inpopup) { /// Popup only + add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", + $resource->id, $cm->id); + print_header(); + print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), + "center", "", "", "20"); + print_footer($course); + } else { /// Make a page and a pop-up window + + print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), + "", "", true, update_module_button($cm->id, $course->id, $this->strresource), + navmenu($course, $cm)); + + echo "\n'; + + if (trim(strip_tags($resource->summary))) { + print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center"); + } + + $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true).""; + + echo " $strlastmodified: ".userdate($resource->timemodified)."
 
"; + echo ''; + print_string('popupresource', 'resource'); + echo '
"; + + print_footer($course); } - - $link = "wwwroot/mod/resource/view.php?inpopup=true&id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">".format_string($resource->name,true).""; - - echo "
'; + print_string('popupresourcelink', 'resource', $link); + echo " 
"; - echo ''; - print_string('popupresource', 'resource'); - echo '
"; - + } else { /// not a popup at all + + add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); + print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), + "", "", true, update_module_button($cm->id, $course->id, $this->strresource), + navmenu($course, $cm)); + + print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), + "center", "", "", "20"); + + $strlastmodified = get_string("lastmodified"); + echo "
'; - print_string('popupresourcelink', 'resource', $link); - echo ""; + print_footer($course); } - } else { /// not a popup at all - add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id); - print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), - "", "", true, update_module_button($cm->id, $course->id, $this->strresource), - navmenu($course, $cm)); - - print_simple_box(format_text($resource->alltext, $resource->options, $formatoptions, $course->id), - "center", "", "", "20"); - - $strlastmodified = get_string("lastmodified"); - echo " $strlastmodified: ".userdate($resource->timemodified)."
"; - - print_footer($course); } } @@ -166,9 +192,9 @@ function setup($form) { $jsoption[] = "\"$optionname\""; } - $frameoption = "\"framepage\""; + $blockoption = "\"blockdisplay\""; $popupoptions = implode(",", $jsoption); - $jsoption[] = $frameoption; + $jsoption[] = $blockoption; $alloptions = implode(",", $jsoption); if ($form->instance) { // Re-editing diff --git a/mod/resource/type/text/text.html b/mod/resource/type/text/text.html index 59f6eaafd2c..2723292f65c 100644 --- a/mod/resource/type/text/text.html +++ b/mod/resource/type/text/text.html @@ -77,12 +77,20 @@ $strlastmodified: ".userdate($resource->timemodified)."
" - onclick="return lockoptions('form', 'windowpopup[1]', popupitems);" /> + onclick="lockoptions('form', 'windowpopup[0]', blockitem); + return lockoptions('form', 'windowpopup[1]', popupitems);" /> "> + @@ -90,7 +98,8 @@+ + options == "showblocks") ? "checked=\"checked\"" : "" ?> alt="" /> + ++- onclick=" return lockoptions('form', 'windowpopup[1]', popupitems);" /> + onclick="lockoptions('form', 'windowpopup[0]', blockitem); + return lockoptions('form', 'windowpopup[1]', popupitems);" />