private function setup_plugin($comment) {
        global $DB;
        $this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
        if (!$this->context) {
            return false;
        }
        switch ($this->context->contextlevel) {
            case CONTEXT_BLOCK:
                if ($block = $DB->get_record('block_instances', array('id' => $this->context->instanceid))) {
                    $this->plugintype = 'block';
                    $this->pluginname = $block->blockname;
                } else {
                    return false;
                }
                break;
            case CONTEXT_MODULE:
                $this->plugintype = 'mod';
                $this->cm = get_coursemodule_from_id('', $this->context->instanceid);
                $this->setup_course($this->cm->course);
                $this->modinfo = get_fast_modinfo($this->course);
                $this->pluginname = $this->modinfo->cms[$this->cm->id]->modname;
                break;
        }
        return true;
    }
private function setup_plugin($comment) {
        global $DB;
        $this->context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
        if (!$this->context) {
            return false;
        }
        switch ($this->context->contextlevel) {
            case CONTEXT_BLOCK:
                if ($block = $DB->get_record('block_instances', array('id' => $this->context->instanceid))) {
                    $this->plugintype = 'block';
                    $this->pluginname = $block->blockname;
                } else {
                    return false;
                }
                break;
            case CONTEXT_MODULE:
                $this->plugintype = 'mod';
                $this->cm = get_coursemodule_from_id('', $this->context->instanceid);
                $this->setup_course($this->cm->course);
                $this->modinfo = get_fast_modinfo($this->course);
                $this->pluginname = $this->modinfo->cms[$this->cm->id]->modname;
                break;
        }
        return true;
    }
private function setup_plugin ( $ comment ) { global $ DB ; $ this -> context = context :: instance_by_id ( $ comment -> contextid , IGNORE_MISSING ) ; if ( ! $ this -> context ) { return false ; } switch ( $ this -> context -> contextlevel ) { case CONTEXT_BLOCK : if ( $ block = $ DB -> get_record ( 'block_instances' , array ( 'id' => $ this -> context -> instanceid ) ) ) { $ this -> plugintype = 'block' ; $ this -> pluginname = $ block -> blockname ; } else { return false ; } break ; case CONTEXT_MODULE : $ this -> plugintype = 'mod' ; $ this -> cm = get_coursemodule_from_id ( '' , $ this -> context -> instanceid ) ; $ this -> setup_course ( $ this -> cm -> course ) ; $ this -> modinfo = get_fast_modinfo ( $ this -> course ) ; $ this -> pluginname = $ this -> modinfo -> cms [ $ this -> cm -> id ] -> modname ; break ; } return true ; }
Sets up the module or block information for a comment

@global moodle_database $DB
@param stdClass $comment
@return bool
Sets up the module or block information for a comment