You are here

public function CourseObjectPoll::getReport in Course 7

Same name and namespace in other branches
  1. 6 modules/course_poll/course_poll.classes.inc \CourseObjectPoll::getReport()
  2. 7.2 modules/course_poll/course_poll.classes.inc \CourseObjectPoll::getReport()

Let the course object provide its own reports.

Return value

array An array containing:

  • title: The title of this report as show on the page
  • content: Content to be displayed.
  • url: URL to be loaded in an iframe.

Reports should return either 'content' or 'url'.

Overrides CourseObject::getReport

See also

CourseObjectQuiz::getReports()

File

modules/course_poll/course_poll.classes.inc, line 51

Class

CourseObjectPoll
Parent class for poll tracking.

Code

public function getReport($key) {
  module_load_include('inc', 'poll', 'poll.pages');
  switch ($key) {
    case 'results':
      return array(
        'title' => $this->node->title,
        'content' => poll_view_results($this->node, NULL, NULL, NULL),
      );
    case 'all':
      $out = poll_votes($this->node);
      return array(
        'title' => 'All votes',
        'content' => drupal_render($out),
      );
  }
  return parent::getReport($key);
}