function display()
 {
     global $CFG;
     $formatoptions = new object();
     $formatoptions->noclean = true;
     /// Are we displaying the course blocks?
     if ($this->resource->options == 'showblocks') {
         parent::display_course_blocks_start();
         if (trim(strip_tags($this->resource->alltext))) {
             echo format_text($this->resource->alltext, FORMAT_MOODLE, $formatoptions, $this->course->id);
         }
         parent::display_course_blocks_end();
     } 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));
         $inpopup = optional_param('inpopup', '', PARAM_BOOL);
         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->reference, $formatoptions, $course->id), "center", "", "", "20");
                 print_footer($course);
             } else {
                 /// Make a page and a pop-up window
                 $navigation = build_navigation($this->navlinks, $cm);
                 print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
                 echo "\n<script type=\"text/javascript\">";
                 echo "\n//<![CDATA[\n";
                 echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
                 echo "\n//]]>\n";
                 echo '</script>';
                 if (trim(strip_tags($resource->summary))) {
                     print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
                 }
                 $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
                 echo '<div class="popupnotice">';
                 print_string('popupresource', 'resource');
                 echo '<br />';
                 print_string('popupresourcelink', 'resource', $link);
                 echo '</div>';
                 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);
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
             print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id), "center", "", "", "20");
             $strlastmodified = get_string("lastmodified");
             echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
             print_footer($course);
         }
     }
 }
Пример #2
0
 function display()
 {
     ///Display the resource
     global $CFG;
     fb('display was called');
     parent::display();
 }
 function display()
 {
     global $CFG;
     $formatoptions = new object();
     $formatoptions->noclean = true;
     /// Are we displaying the course blocks?
     if ($this->resource->options == 'showblocks') {
         parent::display_course_blocks_start();
         $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id");
         if (trim(strip_tags($this->resource->alltext))) {
             echo $entry->title;
             $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
             $formatoptions = new object();
             $formatoptions->noclean = true;
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
             if ($resource->alltext) {
                 echo '<input style="margin-top:20px;" type="button" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
             }
             //            echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
         }
         parent::display_course_blocks_end();
     } 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;
         $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}");
         $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
         $inpopup = optional_param('inpopup', '', PARAM_BOOL);
         add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         if (trim(strip_tags($this->resource->alltext))) {
             echo $entry->title;
         }
         $formatoptions = new object();
         $formatoptions->noclean = true;
         print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
         if (trim(strip_tags($this->resource->alltext))) {
             $player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
             if ($resource->alltext) {
                 echo '<input type="button" style="margin-top:20px;"  value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
             }
             //          echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
         }
         /*       print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id),
                         "center", "", "", "20");
         */
         $strlastmodified = get_string("lastmodified");
         echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
         print_footer($course);
     }
 }
 function display()
 {
     global $CFG;
     $formatoptions = new object();
     $formatoptions->noclean = true;
     /// Are we displaying the course blocks?
     if ($this->resource->options == 'showblocks') {
         parent::display_course_blocks_start();
         $entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id");
         if (trim(strip_tags($this->resource->alltext))) {
             echo $entry->title;
             $context = get_context_instance(CONTEXT_COURSE, $this->course->id);
             $formatoptions = new object();
             $formatoptions->noclean = true;
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
             if (has_capability('moodle/course:manageactivities', $context)) {
                 echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
             } else {
                 echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
             }
         }
         parent::display_course_blocks_end();
     } 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;
         $entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}");
         $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
         $inpopup = optional_param('inpopup', '', PARAM_BOOL);
         add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         if (trim(strip_tags($this->resource->alltext))) {
             echo $entry->title;
             $context = get_context_instance(CONTEXT_COURSE, $this->course->id);
             $formatoptions = new object();
             $formatoptions->noclean = true;
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
             if (has_capability('moodle/course:manageactivities', $context)) {
                 echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), $entry->entry_type, $entry->design, true);
             } else {
                 echo embed_kaltura($resource->alltext, get_width($entry), get_height($entry), KalturaEntryType::MEDIA_CLIP, $entry->design, true);
             }
         }
         /*       print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id),
                         "center", "", "", "20");
         */
         $strlastmodified = get_string("lastmodified");
         echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
         print_footer($course);
     }
 }
 /**
  * Display the file resource
  *
  * Displays a file resource embedded, in a frame, or in a popup.
  * Output depends on type of file resource.
  *
  * @param    CFG     global object
  */
 function display()
 {
     global $CFG, $THEME, $USER;
     /// 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;
     $this->set_parameters();
     // set the parameters array
     ///////////////////////////////////////////////
     /// Possible display modes are:
     /// File displayed in a frame in a normal window
     /// File displayed embedded in a normal page
     /// File displayed in a popup window
     /// File displayed emebedded in a popup window
     /// First, find out what sort of file we are dealing with.
     require_once $CFG->libdir . '/filelib.php';
     $querystring = '';
     $resourcetype = '';
     $embedded = false;
     $mimetype = mimeinfo("type", $resource->reference);
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $formatoptions = new object();
     $formatoptions->noclean = true;
     if ($resource->options != "bogusoption_usedtobe_frame") {
         // TODO nicolasconnault 14-03-07: This option should be renamed "embed"
         if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
             // It's an image
             $resourcetype = "image";
             $embedded = true;
         } else {
             if ($mimetype == "audio/mp3") {
                 // It's an MP3 audio file
                 $resourcetype = "mp3";
                 $embedded = true;
             } else {
                 if ($mimetype == "video/x-flv") {
                     // It's a Flash video file
                     $resourcetype = "flv";
                     $embedded = true;
                 } else {
                     if (substr($mimetype, 0, 10) == "video/x-ms") {
                         // It's a Media Player file
                         $resourcetype = "mediaplayer";
                         $embedded = true;
                     } else {
                         if ($mimetype == "video/quicktime") {
                             // It's a Quicktime file
                             $resourcetype = "quicktime";
                             $embedded = true;
                         } else {
                             if ($mimetype == "application/x-shockwave-flash") {
                                 // It's a Flash file
                                 $resourcetype = "flash";
                                 $embedded = true;
                             } else {
                                 if ($mimetype == "video/mpeg") {
                                     // It's a Mpeg file
                                     $resourcetype = "mpeg";
                                     $embedded = true;
                                 } else {
                                     if ($mimetype == "text/html") {
                                         // It's a web page
                                         $resourcetype = "html";
                                     } else {
                                         if ($mimetype == "application/zip") {
                                             // It's a zip archive
                                             $resourcetype = "zip";
                                             $embedded = true;
                                         } else {
                                             if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') {
                                                 $resourcetype = "pdf";
                                                 $embedded = true;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $isteamspeak = stripos($resource->reference, 'teamspeak://') === 0;
     /// Form the parse string
     if (!empty($resource->alltext)) {
         $querys = array();
         $parray = explode(',', $resource->alltext);
         foreach ($parray as $fieldstring) {
             $field = explode('=', $fieldstring);
             $querys[] = urlencode($field[1]) . '=' . urlencode($this->parameters[$field[0]]['value']);
         }
         if ($isteamspeak) {
             $querystring = implode('?', $querys);
         } else {
             $querystring = implode('&amp;', $querys);
         }
     }
     /// Set up some variables
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     if (resource_is_url($resource->reference)) {
         $fullurl = $resource->reference;
         if (!empty($querystring)) {
             $urlpieces = parse_url($resource->reference);
             if (empty($urlpieces['query']) or $isteamspeak) {
                 $fullurl .= '?' . $querystring;
             } else {
                 $fullurl .= '&amp;' . $querystring;
             }
         }
     } else {
         if ($CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
             // Localpath
             $localpath = get_user_preferences('resource_localpath', 'D:');
             $relativeurl = str_replace(RESOURCE_LOCALPATH, $localpath, $resource->reference);
             if ($querystring) {
                 $relativeurl .= '?' . $querystring;
             }
             $relativeurl = str_replace('\\', '/', $relativeurl);
             $relativeurl = str_replace(' ', '%20', $relativeurl);
             $fullurl = 'file:///' . htmlentities($relativeurl);
             $localpath = true;
         } else {
             // Normal uploaded file
             if ($CFG->slasharguments) {
                 $relativeurl = "/file.php/{$course->id}/{$resource->reference}";
                 if ($querystring) {
                     $relativeurl .= '?' . $querystring;
                 }
             } else {
                 $relativeurl = "/file.php?file=/{$course->id}/{$resource->reference}";
                 if ($querystring) {
                     $relativeurl .= '&amp;' . $querystring;
                 }
             }
             $fullurl = "{$CFG->wwwroot}{$relativeurl}";
         }
     }
     /// Print a notice and redirect if we are trying to access a file on a local file system
     /// and the config setting has been disabled
     if (!$CFG->resource_allowlocalfiles and strpos($resource->reference, RESOURCE_LOCALPATH) === 0) {
         if ($inpopup) {
             print_header($pagetitle, $course->fullname);
         } else {
             $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
             $this->navigation = build_navigation($this->navlinks);
             print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         }
         notify(get_string('notallowedlocalfileaccess', 'resource', ''));
         if ($inpopup) {
             close_window_button();
         }
         print_footer('none');
         die;
     }
     /// Check whether this is supposed to be a popup, but was called directly
     if ($resource->popup and !$inpopup) {
         /// Make a page and a pop-up window
         $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
         $this->navigation = build_navigation($this->navlinks);
         print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
         echo '<div class="popupnotice">';
         print_string('popupresource', 'resource');
         echo '<br />';
         print_string('popupresourcelink', 'resource', $link);
         echo '</div>';
         print_footer($course);
         exit;
     }
     /// Now check whether we need to display a frameset
     $frameset = optional_param('frameset', '', PARAM_ALPHA);
     if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" and empty($USER->screenreader)) {
         @header('Content-Type: text/html; charset=utf-8');
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
         echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
         echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n";
         echo "<frameset rows=\"{$CFG->resource_framesize},*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         if (!empty($localpath)) {
             // Show it like this so we interpose some HTML
             echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;inpopup=true\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         } else {
             echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         }
         echo "</frameset>";
         echo "</html>";
         exit;
     }
     /// We can only get here once per resource, so add an entry to the log
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     /// If we are in a frameset, just print the top of it
     if (!empty($frameset) and $frameset == "top") {
         $this->navlinks[] = array('name' => format_string($resource->name), 'link' => null, 'type' => 'misc');
         $this->navigation = build_navigation($this->navlinks);
         print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
         $options = new object();
         $options->para = false;
         echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $options) . '</div>';
         if (!empty($localpath)) {
             // Show some help
             echo '<div align="right" class="helplink">';
             link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource'));
             echo '</div>';
         }
         echo '</div></div></body></html>';
         exit;
     }
     /// Display the actual resource
     if ($embedded) {
         // Display resource embedded in page
         $strdirectlink = get_string("directlink", "resource");
         if ($inpopup) {
             print_header($pagetitle);
         } else {
             $this->navlinks[] = array('name' => format_string($resource->name, true), 'link' => $fullurl, 'type' => 'misc');
             $this->navigation = build_navigation($this->navlinks);
             print_header_simple($pagetitle, '', $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
         }
         if ($resourcetype == "image") {
             echo '<div class="resourcecontent resourceimg">';
             echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />";
             echo '</div>';
         } else {
             if ($resourcetype == "mp3") {
                 if (!empty($THEME->resource_mp3player_colors)) {
                     $c = $THEME->resource_mp3player_colors;
                     // You can set this up in your theme/xxx/config.php
                 } else {
                     $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=FF33FF&buffer=10&waitForPlay=no&autoPlay=yes';
                 }
                 $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource');
                 $c = htmlentities($c);
                 $id = 'filter_mp3_' . time();
                 //we need something unique because it might be stored in text cache
                 $cleanurl = addslashes_js($fullurl);
                 // If we have Javascript, use UFO to embed the MP3 player, otherwise depend on plugins
                 echo '<div class="resourcecontent resourcemp3">';
                 echo '<span class="mediaplugin mediaplugin_mp3" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $cleanurl . '",' . "\n" . 'width:"600", height:"70", majorversion:"6", build:"40", flashvars:"' . $c . '", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                 echo '<noscript>';
                 echo "<object type=\"audio/mpeg\" data=\"{$fullurl}\" width=\"600\" height=\"70\">";
                 echo "<param name=\"src\" value=\"{$fullurl}\" />";
                 echo '<param name="quality" value="high" />';
                 echo '<param name="autoplay" value="true" />';
                 echo '<param name="autostart" value="true" />';
                 echo '</object>';
                 echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                 echo '</noscript>';
                 echo '</div>';
             } else {
                 if ($resourcetype == "flv") {
                     $id = 'filter_flv_' . time();
                     //we need something unique because it might be stored in text cache
                     $cleanurl = addslashes_js($fullurl);
                     // If we have Javascript, use UFO to embed the FLV player, otherwise depend on plugins
                     echo '<div class="resourcecontent resourceflv">';
                     echo '<span class="mediaplugin mediaplugin_flv" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/filter/mediaplugin/flvplayer.swf?file=' . $cleanurl . '",' . "\n" . 'width:"600", height:"400", majorversion:"6", build:"40", allowscriptaccess:"never", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                     echo '<noscript>';
                     echo "<object type=\"video/x-flv\" data=\"{$fullurl}\" width=\"600\" height=\"400\">";
                     echo "<param name=\"src\" value=\"{$fullurl}\" />";
                     echo '<param name="quality" value="high" />';
                     echo '<param name="autoplay" value="true" />';
                     echo '<param name="autostart" value="true" />';
                     echo '</object>';
                     echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                     echo '</noscript>';
                     echo '</div>';
                 } else {
                     if ($resourcetype == "mediaplayer") {
                         echo '<div class="resourcecontent resourcewmv">';
                         echo '<object type="video/x-ms-wmv" data="' . $fullurl . '">';
                         echo '<param name="controller" value="true" />';
                         echo '<param name="autostart" value="true" />';
                         echo "<param name=\"src\" value=\"{$fullurl}\" />";
                         echo '<param name="scale" value="noScale" />';
                         echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                         echo '</object>';
                         echo '</div>';
                     } else {
                         if ($resourcetype == "mpeg") {
                             echo '<div class="resourcecontent resourcempeg">';
                             echo '<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
                           codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701"
                           type="application/x-oleobject">';
                             echo "<param name=\"fileName\" value=\"{$fullurl}\" />";
                             echo '<param name="autoStart" value="true" />';
                             echo '<param name="animationatStart" value="true" />';
                             echo '<param name="transparentatStart" value="true" />';
                             echo '<param name="showControls" value="true" />';
                             echo '<param name="Volume" value="-450" />';
                             echo '<!--[if !IE]>-->';
                             echo '<object type="video/mpeg" data="' . $fullurl . '">';
                             echo '<param name="controller" value="true" />';
                             echo '<param name="autostart" value="true" />';
                             echo "<param name=\"src\" value=\"{$fullurl}\" />";
                             echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                             echo '<!--<![endif]-->';
                             echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                             echo '<!--[if !IE]>-->';
                             echo '</object>';
                             echo '<!--<![endif]-->';
                             echo '</object>';
                             echo '</div>';
                         } else {
                             if ($resourcetype == "quicktime") {
                                 echo '<style type="text/css">';
                                 echo '/* class to hide nested objects in IE */';
                                 echo '/* hides the second object from all versions of IE */';
                                 echo '* html object.hiddenObjectForIE { display: none; }';
                                 echo '/* display the second object only for IE5 Mac */';
                                 echo '/* IE Mac \\*//*/';
                                 echo '* html object.hiddenObjectForIE { display: inline; }';
                                 echo '/**/';
                                 echo '</style>';
                                 echo '<div class="resourcecontent resourceqt">';
                                 echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
                                 echo '        codebase="http://www.apple.com/qtactivex/qtplugin.cab">';
                                 echo "<param name=\"src\" value=\"{$fullurl}\" />";
                                 echo '<param name="autoplay" value="true" />';
                                 echo '<param name="loop" value="true" />';
                                 echo '<param name="controller" value="true" />';
                                 echo '<param name="scale" value="aspect" />';
                                 echo "<object class=\"hiddenObjectForIE\" type=\"video/quicktime\" data=\"{$fullurl}\">";
                                 echo '<param name="controller" value="true" />';
                                 echo '<param name="autoplay" value="true" />';
                                 echo '<param name="loop" value="true" />';
                                 echo '<param name="scale" value="aspect" />';
                                 echo '</object>';
                                 echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                 echo '</object>';
                                 echo '</div>';
                             } else {
                                 if ($resourcetype == "flash") {
                                     echo '<div class="resourcecontent resourceswf">';
                                     echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
                                     echo "<param name=\"movie\" value=\"{$fullurl}\" />";
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--[if !IE]>-->';
                                     echo "<object type=\"application/x-shockwave-flash\" data=\"{$fullurl}\">";
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--<![endif]-->';
                                     echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                     echo '<!--[if !IE]>-->';
                                     echo '</object>';
                                     echo '<!--<![endif]-->';
                                     echo '</object>';
                                     echo '</div>';
                                 } elseif ($resourcetype == 'zip') {
                                     echo '<div class="resourcepdf">';
                                     echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>';
                                     echo '</div>';
                                 } elseif ($resourcetype == 'pdf') {
                                     echo '<div class="resourcepdf">';
                                     echo '<object data="' . $fullurl . '" type="application/pdf">';
                                     echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>';
                                     echo '</object>';
                                     echo '</div>';
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (trim($resource->summary)) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         }
         if ($inpopup) {
             echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</div>";
         } else {
             print_spacer(20, 20);
             print_footer($course);
         }
     } else {
         // Display the resource on it's own
         if (!empty($localpath)) {
             // Show a link to help work around browser security
             echo '<div align="right" class="helplink">';
             link_to_popup_window('/mod/resource/type/file/localpath.php', get_string('localfile', 'resource'), get_string('localfilehelp', 'resource'), 400, 500, get_string('localfilehelp', 'resource'));
             echo '</div>';
             echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$fullurl}</a>)</div>";
         }
         redirect($fullurl);
     }
 }
Пример #6
0
 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;
     require_once $CFG->libdir . '/filelib.php';
     $subdir = optional_param('subdir', '', PARAM_PATH);
     $resource->reference = clean_param($resource->reference, PARAM_PATH);
     $formatoptions = new object();
     $formatoptions->noclean = true;
     $formatoptions->para = false;
     // MDL-12061, <p> in html editor breaks xhtml strict
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     if ($resource->reference) {
         $relativepath = "{$course->id}/{$resource->reference}";
     } else {
         $relativepath = "{$course->id}";
     }
     if ($subdir) {
         $relativepath = "{$relativepath}{$subdir}";
         if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
             error("Access not allowed!");
         }
         $subs = explode('/', $subdir);
         array_shift($subs);
         $countsubs = count($subs);
         $count = 0;
         $backsub = '';
         foreach ($subs as $sub) {
             $count++;
             if ($count < $countsubs) {
                 $backsub .= "/{$sub}";
                 $this->navlinks[] = array('name' => $sub, 'link' => "view.php?id={$cm->id}", 'type' => 'title');
             } else {
                 $this->navlinks[] = array('name' => $sub, 'link' => '', 'type' => 'title');
             }
         }
     }
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $update = update_module_button($cm->id, $course->id, $this->strresource);
     if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
         $options = array('id' => $course->id, 'wdir' => '/' . $resource->reference . $subdir);
         $editfiles = print_single_button("{$CFG->wwwroot}/files/index.php", $options, get_string("editfiles"), 'get', '', true);
         $update = $editfiles . $update;
     }
     $navigation = build_navigation($this->navlinks, $cm);
     print_header($pagetitle, $course->fullname, $navigation, "", "", true, $update, navmenu($course, $cm));
     if (trim(strip_tags($resource->summary))) {
         print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         print_spacer(10, 10);
     }
     $files = get_directory_list("{$CFG->dataroot}/{$relativepath}", array($CFG->moddata, 'backupdata'), false, true, true);
     if (!$files) {
         print_heading(get_string("nofilesyet"));
         print_footer($course);
         exit;
     }
     print_simple_box_start("center", "", "", '0');
     $strftime = get_string('strftimedatetime');
     $strname = get_string("name");
     $strsize = get_string("size");
     $strmodified = get_string("modified");
     $strfolder = get_string("folder");
     $strfile = get_string("file");
     echo '<table cellpadding="4" cellspacing="1" class="files" summary="">';
     echo "<tr><th class=\"header name\" scope=\"col\">{$strname}</th>" . "<th align=\"right\" colspan=\"2\" class=\"header size\" scope=\"col\">{$strsize}</th>" . "<th align=\"right\" class=\"header date\" scope=\"col\">{$strmodified}</th>" . "</tr>";
     foreach ($files as $file) {
         if (is_dir("{$CFG->dataroot}/{$relativepath}/{$file}")) {
             // Must be a directory
             $icon = "folder.gif";
             $relativeurl = "/view.php?blah";
             $filesize = display_size(get_directory_size("{$CFG->dataroot}/{$relativepath}/{$file}"));
         } else {
             $icon = mimeinfo("icon", $file);
             $relativeurl = get_file_url("{$relativepath}/{$file}");
             $filesize = display_size(filesize("{$CFG->dataroot}/{$relativepath}/{$file}"));
         }
         if ($icon == 'folder.gif') {
             echo '<tr class="folder">';
             echo '<td class="name">';
             echo "<a href=\"view.php?id={$cm->id}&amp;subdir={$subdir}/{$file}\">";
             echo "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfolder}\" />&nbsp;{$file}</a>";
         } else {
             echo '<tr class="file">';
             echo '<td class="name">';
             link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />&nbsp;{$file}", 450, 600, '');
         }
         echo '</td>';
         echo '<td>&nbsp;</td>';
         echo '<td align="right" class="size">';
         echo $filesize;
         echo '</td>';
         echo '<td align="right" class="date">';
         echo userdate(filemtime("{$CFG->dataroot}/{$relativepath}/{$file}"), $strftime);
         echo '</td>';
         echo '</tr>';
     }
     echo '</table>';
     print_simple_box_end();
     print_footer($course);
 }
Пример #7
0
 /**
  * Display the file resource
  *
  * Displays a file resource embedded, in a frame, or in a popup.
  * Output depends on type of file resource.
  *
  * @param    CFG     global object
  */
 function display()
 {
     global $CFG, $THEME, $USER;
     require_once $CFG->libdir . '/filelib.php';
     /// 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;
     /// Fetch parameters
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     $page = optional_param('page', 0, PARAM_INT);
     $frameset = optional_param('frameset', '', PARAM_ALPHA);
     /// Init some variables
     $errorcode = 0;
     $buttontext = 0;
     $querystring = '';
     $resourcetype = '';
     $mimetype = mimeinfo("type", $resource->reference);
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $formatoptions = new object();
     $formatoptions->noclean = true;
     /// Cache this per request
     static $items;
     /// Check for errors
     $errorcode = $this->check4errors($resource->reference, $course, $resource);
     /// If there are any error, show it instead of the resource page
     if ($errorcode) {
         if (!has_capability('moodle/course:activityvisibility', get_context_instance(CONTEXT_COURSE, $course->id))) {
             /// Resource not available page
             $errortext = get_string('resourcenotavailable', 'resource');
         } else {
             /// Depending of the error, show different messages and pages
             if ($errorcode == 1) {
                 $errortext = get_string('invalidfiletype', 'error', $resource->reference);
             } else {
                 if ($errorcode == 2) {
                     $errortext = get_string('filenotfound', 'error', $resource->reference);
                 } else {
                     if ($errorcode == 3) {
                         $errortext = get_string('packagenotdeplyed', 'resource');
                     } else {
                         if ($errorcode == 4) {
                             $errortext = get_string('packagechanged', 'resource');
                         } else {
                             if ($errorcode == 5) {
                                 $errortext = get_string('packagenotdeplyed', 'resource');
                                 // no button though since from repository.
                             }
                         }
                     }
                 }
             }
         }
         /// Display the error and exit
         if ($inpopup) {
             print_header($pagetitle, $course->fullname . ' : ' . $resource->name);
         } else {
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
         }
         print_simple_box_start('center', '60%');
         echo '<p align="center">' . $errortext . '</p>';
         /// If errors were 3 or 4 and isteacheredit(), show the deploy button
         if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id)) && ($errorcode == 3 || $errorcode == 4)) {
             $link = 'type/ims/deploy.php';
             $options['courseid'] = $course->id;
             $options['cmid'] = $cm->id;
             $options['file'] = $resource->reference;
             $options['sesskey'] = $USER->sesskey;
             $options['inpopup'] = $inpopup;
             if ($errorcode == 3) {
                 $label = get_string('deploy', 'resource');
             } else {
                 if ($errorcode == 4) {
                     $label = get_string('redeploy', 'resource');
                 }
             }
             $method = 'post';
             /// Let's go with the button
             echo '<center>';
             print_single_button($link, $options, $label, $method);
             echo '</center>';
         }
         print_simple_box_end();
         /// Close button if inpopup
         if ($inpopup) {
             close_window_button();
         }
         print_footer();
         exit;
     }
     /// Load serialized IMS CP index to memory only once.
     if (empty($items)) {
         if (!$this->isrepository) {
             $resourcedir = $CFG->dataroot . '/' . $course->id . '/' . $CFG->moddata . '/resource/' . $resource->id;
         } else {
             $resourcedir = $CFG->repository . $resource->reference;
         }
         if (!($items = ims_load_serialized_file($resourcedir . '/moodle_inx.ser'))) {
             error(get_string('errorreadingfile', 'error', 'moodle_inx.ser'));
         }
     }
     /// Check whether this is supposed to be a popup, but was called directly
     if (empty($frameset) && $resource->popup && !$inpopup) {
         /// Make a page and a pop-up window
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
         echo "<p>&nbsp;</p>";
         echo '<p align="center">';
         print_string('popupresource', 'resource');
         echo '<br />';
         print_string('popupresourcelink', 'resource', $link);
         echo "</p>";
         print_footer($course);
         exit;
     }
     /// No frames or framesets anymore, except iframe. in print_ims, iframe filled.
     /// needs callback to this file to display table of contents in the iframe so
     /// $frameset = 'toc' leads to output of toc and blank or 'ims' produces the
     /// iframe.
     if (empty($frameset) || $frameset == 'ims') {
         /// Conditional argument to pass to IMS JavaScript. Need to be global to retrieve it from our custom javascript! :-(
         global $jsarg;
         $jsarg = 'false';
         if (!empty($this->parameters->navigationmenu)) {
             $jsarg = 'true';
         }
         /// Define $CFG->javascript to use our custom javascript. Save the original one to add it from ours. Global too! :-(
         global $standard_javascript;
         $standard_javascript = $CFG->javascript;
         // Save original javascript file
         $CFG->javascript = $CFG->dirroot . '/mod/resource/type/ims/javascript.php';
         //Use our custom IMS javascript code
         /// moodle header
         if ($resource->popup) {
             //print_header($pagetitle, $course->fullname.' : '.$resource->name);
             print_header();
         } else {
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), user_login_string($course) . '<hr style="width:95%">' . navmenu($course, $cm, "parent"));
         }
         /// content - this produces everything else
         $this->print_ims($cm, $course, $items, $resource, $page);
         print_footer('empty');
         /// log it.
         add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
         exit;
     }
     if ($frameset == 'toc') {
         print_header();
         $this->print_toc($items, $resource, $page);
         echo '</div></div></body></html>';
         exit;
     }
 }
 /**
  * Display the file resource
  *
  * Displays a file resource embedded, in a frame, or in a popup.
  * Output depends on type of file resource.
  *
  * @param    CFG     global object
  */
 function display()
 {
     global $CFG, $THEME, $USER;
     /// 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;
     $this->set_parameters();
     // set the parameters array
     ///////////////////////////////////////////////
     /// Possible display modes are:
     /// File displayed embedded in a normal page
     /// File displayed in a popup window
     /// File displayed embedded in a popup window
     /// File not displayed at all, but downloaded
     /// First, find out what sort of file we are dealing with.
     require_once $CFG->libdir . '/filelib.php';
     $querystring = '';
     $resourcetype = '';
     $embedded = false;
     $mimetype = mimeinfo("type", $resource->reference);
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $formatoptions = new object();
     $formatoptions->noclean = true;
     if ($resource->options != "forcedownload") {
         // TODO nicolasconnault 14-03-07: This option should be renamed "embed"
         if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
             // It's an image
             $resourcetype = "image";
             $embedded = true;
         } else {
             if ($mimetype == "audio/mp3") {
                 // It's an MP3 audio file
                 $resourcetype = "mp3";
                 $embedded = true;
             } else {
                 if ($mimetype == "video/x-flv") {
                     // It's a Flash video file
                     $resourcetype = "flv";
                     $embedded = true;
                 } else {
                     if (substr($mimetype, 0, 10) == "video/x-ms") {
                         // It's a Media Player file
                         $resourcetype = "mediaplayer";
                         $embedded = true;
                     } else {
                         if ($mimetype == "video/quicktime") {
                             // It's a Quicktime file
                             $resourcetype = "quicktime";
                             $embedded = true;
                         } else {
                             if ($mimetype == "application/x-shockwave-flash") {
                                 // It's a Flash file
                                 $resourcetype = "flash";
                                 $embedded = true;
                             } else {
                                 if ($mimetype == "video/mpeg") {
                                     // It's a Mpeg file
                                     $resourcetype = "mpeg";
                                     $embedded = true;
                                 } else {
                                     if ($mimetype == "text/html") {
                                         // It's a web page
                                         $resourcetype = "html";
                                     } else {
                                         if ($mimetype == "application/zip") {
                                             // It's a zip archive
                                             $resourcetype = "zip";
                                             $embedded = true;
                                         } else {
                                             if ($mimetype == 'application/pdf' || $mimetype == 'application/x-pdf') {
                                                 $resourcetype = "pdf";
                                                 //no need embedded, html file types behave like unknown file type
                                             } else {
                                                 if ($mimetype == "audio/x-pn-realaudio-plugin") {
                                                     // It's a realmedia file
                                                     $resourcetype = "rm";
                                                     $embedded = true;
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $isteamspeak = stripos($resource->reference, 'teamspeak://') === 0;
     /// Form the parse string
     $querys = array();
     if (!empty($resource->alltext)) {
         $parray = explode(',', $resource->alltext);
         foreach ($parray as $fieldstring) {
             list($moodleparam, $urlname) = explode('=', $fieldstring);
             $value = urlencode($this->parameters[$moodleparam]['value']);
             $querys[urlencode($urlname)] = $value;
             $querysbits[] = urlencode($urlname) . '=' . $value;
         }
         if ($isteamspeak) {
             $querystring = implode('?', $querysbits);
         } else {
             $querystring = implode('&amp;', $querysbits);
         }
     }
     /// Set up some variables
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     if (resource_is_url($resource->reference)) {
         $fullurl = $resource->reference;
         if (!empty($querystring)) {
             $urlpieces = parse_url($resource->reference);
             if (empty($urlpieces['query']) or $isteamspeak) {
                 $fullurl .= '?' . $querystring;
             } else {
                 $fullurl .= '&amp;' . $querystring;
             }
         }
     } else {
         // Normal uploaded file
         $forcedownloadsep = '?';
         if ($resource->options == 'forcedownload') {
             $querys['forcedownload'] = '1';
         }
         $fullurl = get_file_url($course->id . '/' . $resource->reference, $querys);
     }
     /// Check whether this is supposed to be a popup, but was called directly
     if ($resource->popup and !$inpopup) {
         /// Make a page and a pop-up window
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" " . "onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', " . "'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
         echo '<div class="popupnotice">';
         print_string('popupresource', 'resource');
         echo '<br />';
         print_string('popupresourcelink', 'resource', $link);
         echo '</div>';
         print_footer($course);
         exit;
     }
     /// Now check whether we need to display a frameset
     $frameset = optional_param('frameset', '', PARAM_ALPHA);
     if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" || $resource->options == "objectframe" and empty($USER->screenreader)) {
         /// display the resource into a object tag
         if ($resource->options == "objectframe") {
             /// Yahoo javascript libaries for updating embedded object size
             require_js(array('yui_utilities'));
             require_js(array('yui_container'));
             require_js(array('yui_dom-event'));
             require_js(array('yui_dom'));
             /// Moodle Header and navigation bar
             $navigation = build_navigation($this->navlinks, $cm);
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
             $options = new object();
             $options->para = false;
             echo '</div></div>';
             /// embedded file into iframe if the resource is on another domain
             ///
             /// This case is not XHTML strict but there is no alternative
             /// The object tag alternative is XHTML strict, however IE6-7 displays a blank object on accross domain by default,
             /// so we decided to use iframe for accross domain MDL-10021
             if (!stristr($fullurl, $CFG->wwwroot)) {
                 echo '<p><iframe id="embeddedhtml" src ="' . $fullurl . '" width="100%" height="600"></iframe></p>';
             } else {
                 /// embedded HTML file into an object tag
                 echo '<p><object id="embeddedhtml" data="' . $fullurl . '" type="' . $mimetype . '" width="800" height="600">
                         alt : <a href="' . $fullurl . '">' . $fullurl . '</a>
                       </object></p>';
             }
             /// add some javascript in order to fit this object tag into the browser window
             echo '<script type="text/javascript">
                          //<![CDATA[
                          function resizeEmbeddedHtml() {
                          //calculate new embedded html height size
                  ';
             if (!empty($resource->summary)) {
                 echo '    objectheight =  YAHOO.util.Dom.getViewportHeight() - 230;
                     ';
             } else {
                 echo '    objectheight =  YAHOO.util.Dom.getViewportHeight() - 120;
                      ';
             }
             echo '       //the object tag cannot be smaller than a human readable size
                          if (objectheight < 200) {
                              objectheight = 200;
                          }
                          //resize the embedded html object
                          YAHOO.util.Dom.setStyle("embeddedhtml", "height", objectheight+"px");
                          YAHOO.util.Dom.setStyle("embeddedhtml", "width", "100%");
                       }
                       resizeEmbeddedHtml();
                       YAHOO.widget.Overlay.windowResizeEvent.subscribe(resizeEmbeddedHtml);
                       //]]>
                    </script>
                 ';
             /// print the summary
             if (!empty($resource->summary)) {
                 print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
             }
             echo "</body></html>";
             add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
             exit;
         } else {
             @header('Content-Type: text/html; charset=utf-8');
             echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
             echo "<html dir=\"ltr\">\n";
             echo '<head>';
             echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
             echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n";
             echo "<frameset rows=\"{$CFG->resource_framesize},*\">";
             echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>";
             echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>";
             echo "</frameset>";
             echo "</html>";
             exit;
         }
     }
     /// We can only get here once per resource, so add an entry to the log
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     /// If we are in a frameset, just print the top of it
     if (!empty($frameset) and $frameset == "top") {
         // Force target atttributes on links.  Not Strict but we are already using frames anyway! MDL-20327
         $CFG->frametarget = ' target="' . $CFG->framename . '" ';
         $navigation = build_navigation($this->navlinks, $cm);
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
         $options = new object();
         $options->para = false;
         echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $options) . '</div>';
         print_footer('empty');
         exit;
     }
     /// Display the actual resource
     if ($embedded) {
         // Display resource embedded in page
         $strdirectlink = get_string("directlink", "resource");
         if ($inpopup) {
             print_header($pagetitle);
         } else {
             $navigation = build_navigation($this->navlinks, $cm);
             print_header_simple($pagetitle, '', $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
         }
         if ($resourcetype == "image") {
             echo '<div class="resourcecontent resourceimg">';
             echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />";
             echo '</div>';
         } else {
             if ($resourcetype == "mp3") {
                 if (!empty($THEME->resource_mp3player_colors)) {
                     $c = $THEME->resource_mp3player_colors;
                     // You can set this up in your theme/xxx/config.php
                 } else {
                     $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=FF33FF&buffer=10&waitForPlay=no&autoPlay=yes';
                 }
                 $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource');
                 $c = htmlentities($c);
                 $id = 'filter_mp3_' . time();
                 //we need something unique because it might be stored in text cache
                 $cleanurl = addslashes_js($fullurl);
                 // If we have Javascript, use UFO to embed the MP3 player, otherwise depend on plugins
                 echo '<div class="resourcecontent resourcemp3">';
                 echo '<span class="mediaplugin mediaplugin_mp3" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $cleanurl . '",' . "\n" . 'width:"600", height:"70", majorversion:"6", build:"40", flashvars:"' . $c . '", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                 echo '<noscript>';
                 echo "<object type=\"audio/mpeg\" data=\"{$fullurl}\" width=\"600\" height=\"70\">";
                 echo "<param name=\"src\" value=\"{$fullurl}\" />";
                 echo '<param name="quality" value="high" />';
                 echo '<param name="autoplay" value="true" />';
                 echo '<param name="autostart" value="true" />';
                 echo '</object>';
                 echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                 echo '</noscript>';
                 echo '</div>';
             } else {
                 if ($resourcetype == "flv") {
                     $id = 'filter_flv_' . time();
                     //we need something unique because it might be stored in text cache
                     $cleanurl = addslashes_js($fullurl);
                     // If we have Javascript, use UFO to embed the FLV player, otherwise depend on plugins
                     echo '<div class="resourcecontent resourceflv">';
                     echo '<span class="mediaplugin mediaplugin_flv" id="' . $id . '"></span>' . '<script type="text/javascript">' . "\n" . '//<![CDATA[' . "\n" . 'var FO = { movie:"' . $CFG->wwwroot . '/filter/mediaplugin/flvplayer.swf?file=' . $cleanurl . '",' . "\n" . 'width:"600", height:"400", majorversion:"6", build:"40", allowscriptaccess:"never", allowfullscreen:"true", quality: "high" };' . "\n" . 'UFO.create(FO, "' . $id . '");' . "\n" . '//]]>' . "\n" . '</script>' . "\n";
                     echo '<noscript>';
                     echo "<object type=\"video/x-flv\" data=\"{$fullurl}\" width=\"600\" height=\"400\">";
                     echo "<param name=\"src\" value=\"{$fullurl}\" />";
                     echo '<param name="quality" value="high" />';
                     echo '<param name="autoplay" value="true" />';
                     echo '<param name="autostart" value="true" />';
                     echo '</object>';
                     echo '<p><a href="' . $fullurl . '">' . $fullurl . '</a></p>';
                     echo '</noscript>';
                     echo '</div>';
                 } else {
                     if ($resourcetype == "mediaplayer") {
                         echo '<div class="resourcecontent resourcewmv">';
                         echo '<object type="video/x-ms-wmv" data="' . $fullurl . '">';
                         echo '<param name="controller" value="true" />';
                         echo '<param name="autostart" value="true" />';
                         echo "<param name=\"src\" value=\"{$fullurl}\" />";
                         echo '<param name="scale" value="noScale" />';
                         echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                         echo '</object>';
                         echo '</div>';
                     } else {
                         if ($resourcetype == "mpeg") {
                             echo '<div class="resourcecontent resourcempeg">';
                             echo '<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
                           codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsm p2inf.cab#Version=5,1,52,701"
                           type="application/x-oleobject">';
                             echo "<param name=\"fileName\" value=\"{$fullurl}\" />";
                             echo '<param name="autoStart" value="true" />';
                             echo '<param name="animationatStart" value="true" />';
                             echo '<param name="transparentatStart" value="true" />';
                             echo '<param name="showControls" value="true" />';
                             echo '<param name="Volume" value="-450" />';
                             echo '<!--[if !IE]>-->';
                             echo '<object type="video/mpeg" data="' . $fullurl . '">';
                             echo '<param name="controller" value="true" />';
                             echo '<param name="autostart" value="true" />';
                             echo "<param name=\"src\" value=\"{$fullurl}\" />";
                             echo "<a href=\"{$fullurl}\">{$fullurl}</a>";
                             echo '<!--<![endif]-->';
                             echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                             echo '<!--[if !IE]>-->';
                             echo '</object>';
                             echo '<!--<![endif]-->';
                             echo '</object>';
                             echo '</div>';
                         } else {
                             if ($resourcetype == "rm") {
                                 echo '<div class="resourcecontent resourcerm">';
                                 echo '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="320" height="240">';
                                 echo '<param name="src" value="' . $fullurl . '" />';
                                 echo '<param name="controls" value="All" />';
                                 echo '<!--[if !IE]>-->';
                                 echo '<object type="audio/x-pn-realaudio-plugin" data="' . $fullurl . '" width="320" height="240">';
                                 echo '<param name="controls" value="All" />';
                                 echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                 echo '</object>';
                                 echo '<!--<![endif]-->';
                                 echo '</object>';
                                 echo '</div>';
                             } else {
                                 if ($resourcetype == "quicktime") {
                                     echo '<div class="resourcecontent resourceqt">';
                                     echo '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
                                     echo '        codebase="http://www.apple.com/qtactivex/qtplugin.cab">';
                                     echo "<param name=\"src\" value=\"{$fullurl}\" />";
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--[if !IE]>-->';
                                     echo "<object type=\"video/quicktime\" data=\"{$fullurl}\">";
                                     echo '<param name="controller" value="true" />';
                                     echo '<param name="autoplay" value="true" />';
                                     echo '<param name="loop" value="true" />';
                                     echo '<param name="scale" value="aspect" />';
                                     echo '<!--<![endif]-->';
                                     echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                     echo '<!--[if !IE]>-->';
                                     echo '</object>';
                                     echo '<!--<![endif]-->';
                                     echo '</object>';
                                     echo '</div>';
                                 } else {
                                     if ($resourcetype == "flash") {
                                         echo '<div class="resourcecontent resourceswf">';
                                         echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
                                         echo "<param name=\"movie\" value=\"{$fullurl}\" />";
                                         echo '<param name="autoplay" value="true" />';
                                         echo '<param name="loop" value="true" />';
                                         echo '<param name="controller" value="true" />';
                                         echo '<param name="scale" value="aspect" />';
                                         echo '<param name="base" value="." />';
                                         echo '<!--[if !IE]>-->';
                                         echo "<object type=\"application/x-shockwave-flash\" data=\"{$fullurl}\">";
                                         echo '<param name="controller" value="true" />';
                                         echo '<param name="autoplay" value="true" />';
                                         echo '<param name="loop" value="true" />';
                                         echo '<param name="scale" value="aspect" />';
                                         echo '<param name="base" value="." />';
                                         echo '<!--<![endif]-->';
                                         echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
                                         echo '<!--[if !IE]>-->';
                                         echo '</object>';
                                         echo '<!--<![endif]-->';
                                         echo '</object>';
                                         echo '</div>';
                                     } elseif ($resourcetype == 'zip') {
                                         echo '<div class="resourcepdf">';
                                         echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . format_string($resource->name) . '</a>';
                                         echo '</div>';
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (trim($resource->summary)) {
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         }
         if ($inpopup) {
             echo "<div class=\"popupnotice\">(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</div>";
             print_footer($course);
             // MDL-12098
         } else {
             print_spacer(20, 20);
             print_footer($course);
         }
     } else {
         // Display the resource on it's own
         redirect($fullurl);
     }
 }
 /**
 * Display the repository resource
 *
 * Displays a repository resource embedded, in a frame, or in a popup.
 * Output depends on type of file resource.
 *
 * @param    CFG     global object
 */
 function display()
 {
     global $CFG, $THEME, $SESSION;
     /// 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;
     $this->set_parameters();
     // set the parameters array
     ///////////////////////////////////////////////
     /// Possible display modes are:
     /// File displayed in a frame in a normal window
     /// File displayed embedded in a normal page
     /// File displayed in a popup window
     /// File displayed emebedded in a popup window
     /// First, find out what sort of file we are dealing with.
     require_once $CFG->libdir . '/filelib.php';
     $querystring = '';
     $resourcetype = '';
     $embedded = false;
     $mimetype = mimeinfo("type", $resource->reference);
     $pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
     $formatoptions = new object();
     $formatoptions->noclean = true;
     if ($resource->options != "frame") {
         if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
             // It's an image
             $resourcetype = "image";
             $embedded = true;
         } else {
             if ($mimetype == "audio/mp3") {
                 // It's an MP3 audio file
                 $resourcetype = "mp3";
                 $embedded = true;
             } else {
                 if (substr($mimetype, 0, 10) == "video/x-ms") {
                     // It's a Media Player file
                     $resourcetype = "mediaplayer";
                     $embedded = true;
                 } else {
                     if ($mimetype == "video/quicktime") {
                         // It's a Quicktime file
                         $resourcetype = "quicktime";
                         $embedded = true;
                     } else {
                         if ($mimetype == "text/html") {
                             // It's a web page
                             $resourcetype = "html";
                         }
                     }
                 }
             }
         }
     }
     $navigation = build_navigation($this->navlinks, $cm);
     /// Form the parse string
     if (!empty($resource->alltext)) {
         $querys = array();
         $parray = explode(',', $resource->alltext);
         foreach ($parray as $fieldstring) {
             $field = explode('=', $fieldstring);
             $querys[] = urlencode($field[1]) . '=' . urlencode($this->parameters[$field[0]]['value']);
         }
         $querystring = implode('&amp;', $querys);
     }
     /// Set up some variables
     $inpopup = optional_param('inpopup', 0, PARAM_BOOL);
     $fullurl = $resource->reference . '&amp;HIVE_SESSION=' . $SESSION->HIVE_SESSION;
     if (!empty($querystring)) {
         $urlpieces = parse_url($resource->reference);
         if (empty($urlpieces['query'])) {
             $fullurl .= '?' . $querystring;
         } else {
             $fullurl .= '&amp;' . $querystring;
         }
     }
     /// MW check that the HIVE_SESSION is there
     if (empty($SESSION->HIVE_SESSION)) {
         if ($inpopup) {
             print_header($pagetitle, $course->fullname);
         } else {
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         }
         notify('You do not have access to HarvestRoad Hive. This resource is unavailable.');
         if ($inpopup) {
             close_window_button();
         }
         print_footer('none');
         die;
     }
     /// MW END
     /// Check whether this is supposed to be a popup, but was called directly
     if ($resource->popup and !$inpopup) {
         /// Make a page and a pop-up window
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
         echo "\n<script type=\"text/javascript\">";
         echo "\n<!--\n";
         echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
         echo "\n-->\n";
         echo '</script>';
         if (trim(strip_tags($resource->summary))) {
             $formatoptions->noclean = true;
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions), "center");
         }
         $link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&amp;id={$cm->id}\" target=\"resource{$resource->id}\" onclick=\"return openpopup('/mod/resource/view.php?inpopup=true&amp;id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
         echo "<p>&nbsp;</p>";
         echo '<p align="center">';
         print_string('popupresource', 'resource');
         echo '<br />';
         print_string('popupresourcelink', 'resource', $link);
         echo "</p>";
         print_footer($course);
         exit;
     }
     /// Now check whether we need to display a frameset
     $frameset = optional_param('frameset', '', PARAM_ALPHA);
     if (empty($frameset) and !$embedded and !$inpopup and $resource->options == "frame" and empty($USER->screenreader)) {
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
         echo '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />';
         echo "<title>" . format_string($course->shortname) . ": " . strip_tags(format_string($resource->name, true)) . "</title></head>\n";
         echo "<frameset rows=\"{$CFG->resource_framesize},*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         echo "<frame src=\"{$fullurl}\" title=\"" . get_string('modulename', 'resource') . "\"/>";
         echo "</frameset>";
         echo "</html>";
         exit;
     }
     /// We can only get here once per resource, so add an entry to the log
     add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
     /// If we are in a frameset, just print the top of it
     if (!empty($frameset) and $frameset == "top") {
         print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
         echo '<div class="summary">' . format_text($resource->summary, FORMAT_HTML, $formatoptions) . '</div>';
         echo '</body></html>';
         exit;
     }
     /// Display the actual resource
     if ($embedded) {
         // Display resource embedded in page
         $strdirectlink = get_string("directlink", "resource");
         if ($inpopup) {
             print_header($pagetitle);
         } else {
             print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "self"));
         }
         if ($resourcetype == "image") {
             echo "<center><p>";
             echo "<img title=\"" . strip_tags(format_string($resource->name, true)) . "\" class=\"resourceimage\" src=\"{$fullurl}\" alt=\"\" />";
             echo "</p></center>";
         } else {
             if ($resourcetype == "mp3") {
                 if (!empty($THEME->resource_mp3player_colors)) {
                     $c = $THEME->resource_mp3player_colors;
                     // You can set this up in your theme/xxx/config.php
                 } else {
                     $c = 'bgColour=000000&btnColour=ffffff&btnBorderColour=cccccc&iconColour=000000&' . 'iconOverColour=00cc00&trackColour=cccccc&handleColour=ffffff&loaderColour=ffffff&' . 'font=Arial&fontColour=3333FF&buffer=10&waitForPlay=no&autoPlay=yes';
                 }
                 $c .= '&volText=' . get_string('vol', 'resource') . '&panText=' . get_string('pan', 'resource');
                 $c = htmlentities($c);
                 echo '<div class="mp3player" align="center">';
                 echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
                 echo '        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
                 echo '        width="600" height="70" id="mp3player" align="">';
                 echo '<param name="movie" value="' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $fullurl . '">';
                 echo '<param name="quality" value="high">';
                 echo '<param name="bgcolor" value="#333333">';
                 echo '<param name="flashvars" value="' . $c . '&amp;" />';
                 echo '<embed src="' . $CFG->wwwroot . '/lib/mp3player/mp3player.swf?src=' . $fullurl . '" ';
                 echo ' quality="high" bgcolor="#333333" width="600" height="70" name="mp3player" ';
                 echo ' type="application/x-shockwave-flash" ';
                 echo ' flashvars="' . $c . '&amp;" ';
                 echo ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
                 echo '</embed>';
                 echo '</object>';
                 echo '</div>';
             } else {
                 if ($resourcetype == "mediaplayer") {
                     echo "<center><p>";
                     echo '<object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"';
                     echo '        codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ';
                     echo '        standby="Loading Microsoft� Windows� Media Player components..." ';
                     echo '        id="msplayer" align="" type="application/x-oleobject">';
                     echo "<param name=\"Filename\" value=\"{$fullurl}\">";
                     echo '<param name="ShowControls" value="true" />';
                     echo '<param name="AutoRewind" value="true" />';
                     echo '<param name="AutoStart" value="true" />';
                     echo '<param name="Autosize" value="true" />';
                     echo '<param name="EnableContextMenu" value="true" />';
                     echo '<param name="TransparentAtStart" value="false" />';
                     echo '<param name="AnimationAtStart" value="false" />';
                     echo '<param name="ShowGotoBar" value="false" />';
                     echo '<param name="EnableFullScreenControls" value="true" />';
                     echo "\n<embed src=\"{$fullurl}\" name=\"msplayer\" type=\"{$mimetype}\" ";
                     echo ' ShowControls="1" AutoRewind="1" AutoStart="1" Autosize="0" EnableContextMenu="1"';
                     echo ' TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1"';
                     echo ' pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">';
                     echo '</embed>';
                     echo '</object>';
                     echo "</p></center>";
                 } else {
                     if ($resourcetype == "quicktime") {
                         echo "<center><p>";
                         echo '<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"';
                         echo '        codebase="http://www.apple.com/qtactivex/qtplugin.cab" ';
                         echo '        height="450" width="600"';
                         echo '        id="quicktime" align="" type="application/x-oleobject">';
                         echo "<param name=\"src\" value=\"{$fullurl}\" />";
                         echo '<param name="autoplay" value="true" />';
                         echo '<param name="loop" value="true" />';
                         echo '<param name="controller" value="true" />';
                         echo '<param name="scale" value="aspect" />';
                         echo "\n<embed src=\"{$fullurl}\" name=\"quicktime\" type=\"{$mimetype}\" ";
                         echo ' height="450" width="600" scale="aspect"';
                         echo ' autoplay="true" controller="true" loop="true" ';
                         echo ' pluginspage="http://quicktime.apple.com/">';
                         echo '</embed>';
                         echo '</object>';
                         echo "</p></center>";
                     }
                 }
             }
         }
         if (trim($resource->summary)) {
             $formatoptions->noclean = true;
             print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
         }
         if ($inpopup) {
             echo "<center><p>(<a href=\"{$fullurl}\">{$strdirectlink}</a>)</p></center>";
         } else {
             print_spacer(20, 20);
             print_footer($course);
         }
     } else {
         // Display the resource on it's own
         redirect($fullurl);
     }
 }