Problem Description
I am currently developing a Moodle Plugin. I have followed the documentation for setting up a moodle block, and installing it. However after I have put the plugin file into the block folder of my Moodle, it does not register it, and I am unable to install it. Can someone tell me if my code/ file structure is incorrect or where I am going wrong please?
Thanks in advance
[File structure of Plugin][1]
[1]: https://i.sstatic.net/LLgsY.png
x<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
//Block class Definition
class block_QEIMS extends block_list {
//init method that gives values to any clas member variables that need instantiating
public function init() {
$this-> title = get_string('QEIMS', 'block_QEIMS');
}
public function get_content() {
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text = array();
$this->content->icons = array();
$this->content->footer = 'Footer here...';
$this->content->items[] = html_writer::tag('a', 'School', [href=>'School.php']);
$this->content->items[] = html_writer::tag('b', 'Teacher', [href=>'Teacher.php']);
$this->content->items[] = html_writer::tag('c', 'Pupils', [href=>'Pupils.php']);
return $this->content;
}
public function specialization() //Loads congifuration data
{
if (isset($this->config))
{
if (empty($this->config->title))
{
$this->title = get_string('defaulttitle', 'block_qeims');
} else
{
$this->title = $this->config->title;
}
if (empty($this->config->text))
{
$this->config->text = get_string('defaulttext', 'block_qeims');
}
}
}
public function instance_allow_multiple() //This method allows the user to add multiple versions of this block
{
return true;
}
function preferred_width()
{
// Default case: the block wants to be 180 pixels wide
return 180;
}
function refresh_content()
{
// Nothing special here, depends on content()
$this->content = NULL;
return $this->get_content();
}
/**
* Allow the block to have a configuration page
*
* @return boolean
*/
public function has_config() {
return true;
}...
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?