Home > Mobile >  Adding a button in a block that links to a page of another plugin
Adding a button in a block that links to a page of another plugin

Time:08-04

I'm fairly new to moodle and php in general. I created a new block which acts like a display for custom events and reminder. Inside that block is a button that should open the page of another plugin I created when clicked. But I can't manage to set the button with a link that opens the new page. When I press the button, nothing happens. If I enter the address of the page of the other plugin in the address bar, it opens as expected.

    global $CFG;
    global $DB;
    $mform = $this->_form;

    $reminderinfo='';
    $reminder = $DB->get_records('reminder_events');
    foreach ($reminder as $remind){
        $reminderinfo .= $remind->eventname . '  ' . $remind->time . '<br>';
    }

    $manageurl = $CFG->wwwroot . '/local/reminder/manage.php';
    // Add reminderinfo to mform
    $mform->addElement('html', '<input type="button"  value="Add Reminder" onclick=\"location.href="'.$manageurl.'"\">');

Image of Inspector mode: enter image description here

CodePudding user response:

Could you use F12 then checkout what does your button really be like? Take a pic on it then it will be more easier to help you.

  • Related