Own blocks creation with course

Own blocks creation with course

by Bob S -
Number of replies: 2

I want to create a block with the name of each course in that.

<?php
class block_ban extends block_base {
    function init() {
        $this->title = get_string('Mijn Academie', 'block_ban');
        $this->version = 2004111200;
    }
 
 function instance_allow_config() {
    return true;
}
 
 function get_content() {
    if ($this->content !== NULL) {
        return $this->content;
    }
 
 
    $this->content = new stdClass;
    $this->content->text = $this->config->text;    
     return $this->content;
 }
 
}
?>

How can I display the name of the course,
bacause I want to link (by default) in my own block.

If I have one cource named: VBA then i would create a link by default in my block <a href="vba/test.html">Test</a>

And when I open this block in another cource then autmatically:

If I have one cource named: VBAXX then i would create a link by default in my block <a href="vbaxx/test.html">Test</a>

Understand, can somebody help me? I think it easy for somebody

Average of ratings: -
In reply to Bob S

Re: Own blocks creation with course

by Bob S -

this was what i m looking for:

$deCursus = get_record('course', 'id', $_REQUEST['id']);

In reply to Bob S

Re: Own blocks creation with course

by John Papaioannou -
There's a recommended way to do this, which should be "better" to use. Take a look here, Appendix B section 2.