You are here

function course_iframe in Course 8.2

Same name and namespace in other branches
  1. 8.3 course.module \course_iframe()
  2. 6 course.module \course_iframe()
  3. 7.2 course.module \course_iframe()
  4. 7 course.module \course_iframe()
  5. 3.x course.module \course_iframe()

Generic Course IFrame function.

Parameters

string $url: An iframe HTML element src attribute.

string $height: A string representing an iframe height.

string $class: A HTML class attribute for the iframe.

2 calls to course_iframe()
CourseObject::takeObject in src/Entity/CourseObject.php
Take a course object.
course_object_reports_page in includes/course.reports.inc
Page handler for course object reports.

File

./course.module, line 361
course.module Core functionality for Courses.

Code

function course_iframe($url = NULL, $height = '600px', $class = NULL) {
  $style = 'border:none; margin:0; width:100%; height:' . $height . ';';
  $iframe = '<iframe id="course-viewer" src="' . $url . '" style="' . $style . '" class="' . $class . '" scrolling="no" frameborder="0" onload="resizeFrame(this);"></iframe>';

  // Add JS to resize parent frame. This assumes additional JS on the targeted iframe content.
  drupal_add_js(drupal_get_path('module', 'course') . '/js/resizeframe.js');
  return $iframe;
}