/**
  * override the parent get function
  * to make sure when we're asked for a course
  * we retrieve the object from the database as needed
  */
 public function get($key)
 {
     if ($key != 'course') {
         return parent::get($key);
     }
     global $DB;
     if (empty($this->course)) {
         $this->course = $DB->get_record('course', array('id' => $this->cm->course));
     }
     return $this->course;
 }
Ejemplo n.º 2
0
/**
 * Setup page export
 *
 * @param moodle_page $PAGE global variable from page object
 * @param portfolio_caller_base $caller plugin type caller
 */
function portfolio_export_pagesetup($PAGE, $caller)
{
    // set up the context so that build_navigation works nice
    $caller->set_context($PAGE);
    list($extranav, $cm) = $caller->get_navigation();
    // and now we know the course for sure and maybe the cm, call require_login with it
    require_login($PAGE->course, false, $cm);
    foreach ($extranav as $navitem) {
        $PAGE->navbar->add($navitem['name']);
    }
    $PAGE->navbar->add(get_string('exporting', 'portfolio'));
}