示例#1
0
 /**
  * Constructor
  *
  * @param moodle_page $page
  * @param string      $target one of rendering target constants
  */
 public function __construct(moodle_page $page, $target)
 {
     global $opencast, $SESSION;
     $SESSION->opencastid = $opencast->id;
     $this->series = new mod_opencast_series();
     $this->series->fetch($opencast->id);
     $this->scuser = new mod_opencast_user();
     $this->displayed_userids = [];
     parent::__construct($page, $target);
 }
示例#2
0
 public function __construct(moodle_page $page, $target)
 {
     parent::__construct($page, $target);
     $this->context = $page->context;
     $this->can_viewdiff = has_capability('plagiarism/moss:viewdiff', $this->context);
     $this->can_viewunconfirmed = has_capability('plagiarism/moss:viewunconfirmed', $this->context);
     $this->can_confirm = has_capability('plagiarism/moss:confirm', $this->context);
     $this->can_grade = has_capability('mod/assignment:grade', $this->context);
     $this->showidnumber = get_config('plagiarism_moss', 'showidnumber');
     $this->confirm_htmls = array($this->pix_icon('i/completion-manual-n', get_string('unconfirmed', 'plagiarism_moss')), $this->pix_icon('i/completion-manual-y', get_string('confirmed', 'plagiarism_moss')));
 }
示例#3
0
 /**
  * Returns rendered widget.
  *
  * Add another error catching layer for
  * rendering reports.
  *
  * @param renderable $widget instance with renderable interface
  * @return string
  */
 public function render(renderable $widget)
 {
     try {
         return parent::render($widget);
     } catch (coding_exception $e) {
         if ($widget instanceof mr_report_abstract) {
             return $this->render_mr_report_abstract($widget);
         }
         // Re-throw original error
         throw $e;
     }
 }
 /**
  * Constructor
  *
  * The constructor takes two arguments. The first is the page that the renderer
  * has been created to assist with, and the second is the target.
  * The target is an additional identifier that can be used to load different
  * renderers for different options.
  *
  * In order to create and initialize the appropriate arrays for resources, activities, assignments and icons,
  * we must update the declared constructor of the parent class, and since we can't just update it, we declare it again
  * adding the appropriate commands that suit our purpose.
  *
  * @param moodle_page $page the page we are doing output for.
  * @param string $target one of rendering target constants
  * @see core:renderer::__construct()
  */
 public function __construct(moodle_page $page, $target)
 {
     // Find and update course modules ids.
     global $DB;
     $this->chatmoduleid = $DB->get_field_sql('SELECT id FROM {modules} WHERE name="chat"', null);
     $this->forummoduleid = $DB->get_field_sql('SELECT id FROM {modules} WHERE name="forum"', null);
     $this->oldassignmoduleid = $DB->get_field_sql('SELECT id FROM {modules} WHERE name="assignment"', null);
     $this->newassignmoduleid = $DB->get_field_sql('SELECT id FROM {modules} WHERE name="assign"', null);
     $this->labelmoduleid = $DB->get_field_sql('SELECT id FROM {modules} WHERE name="label"', null);
     // Use the Label module id, to exclude it from course resources.
     $this->output = $page->get_renderer('core', null, $target);
     parent::__construct($page, $target);
     // These are needed for the enriched rubric renderer construction.
     $this->resources = $this->get_modules_array('resources', $this->moduleicon);
     $this->assignments = $this->get_modules_array('assignments', $this->moduleicon);
     $this->activities = $this->get_modules_array('activities', $this->moduleicon);
 }
示例#5
0
 /**
  * Override the constructor so that we can initialise the string cache
  *
  * @param moodle_page $page
  * @param string $target
  */
 public function __construct(moodle_page $page, $target)
 {
     $this->strings = new stdClass();
     parent::__construct($page, $target);
     $this->add_modchoosertoggle();
 }
 /**
  * Constructor method, calls the parent constructor
  *
  * @param moodle_page $page
  * @param string $target one of rendering target constants
  */
 public function __construct(moodle_page $page, $target)
 {
     parent::__construct($page, $target);
     $this->courserenderer = $this->page->get_renderer('core', 'course');
 }
示例#7
0
 /**
  * Override the constructor so that we can initialise the string cache
  *
  * @param moodle_page $page
  * @param string $target
  */
 public function __construct(moodle_page $page, $target) {
     $this->strings = new stdClass;
     parent::__construct($page, $target);
 }
 /**
  * Defer to template.                                                                                                           
  *                                                                                                                              
  * @param treasurehunt_play_page $page                                                                                                      
  *                                                                                                                              
  * @return string html for the page                                                                                             
  */
 public function render_treasurehunt_play_page(treasurehunt_play_page $page)
 {
     $data = $page->export_for_template($this);
     return parent::render_from_template('mod_treasurehunt/play_page', $data);
 }
 /**
  * Override render method.
  *
  * @return string
  */
 public function render(renderable $renderable, $options = array())
 {
     if ($renderable instanceof block_xp_rule_base) {
         return $this->render_block_xp_rule($renderable, $options);
     } else {
         if ($renderable instanceof block_xp_ruleset) {
             return $this->render_block_xp_ruleset($renderable, $options);
         }
     }
     return parent::render($renderable);
 }
示例#10
0
 /**
  * heading
  *
  * @global object $hotpot
  * @return string
  */
 public function heading($hotpot)
 {
     $text = format_string($hotpot->name);
     if ($hotpot->can_manage()) {
         $text .= $this->modedit_icon($hotpot);
     }
     return parent::heading($text);
 }
 /**
  * Sets $this->output to the global print renderer
  *
  * @param moodle_page $page
  * @param string $target
  */
 public function __construct(moodle_page $page, $target)
 {
     global $output;
     parent::__construct($page, $target);
     $this->output = $output;
 }
 /**
  * The widget renderer for theme elegance generates the additional features this
  * theme contains which are non-standard in Moodle. It renders banners, marketing spots,
  * message menus and more.
  * For each of the public methods used in this class there is a Mustache template
  * located in the /templates folder
  */
 public function __construct(moodle_page $page, $target)
 {
     $this->theme = theme_config::load('elegance');
     $this->settings = $this->theme->settings;
     parent::__construct($page, $target);
 }