2016-03-30 10 views
2

私は現在Moodle Pluginを開発中です。私は、moodleブロックを設定し、それをインストールするためのドキュメンテーションに従ってきました。しかし、プラグインファイルを私のMoodleのブロックフォルダに入れた後は、それを登録せず、インストールすることができません。私のコード/ファイル構造が間違っているのか、間違っているのか教えてもらえますか?事前Moodle Block Upload

File structure of Plugin

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; 
     } 
    public function instance_config_save($data, $nolongerused = false) // 
    { 
     $data = stripslashes_recursive($data); 
     $this->config = $data; 
     return set_field('block_instance', 
         'configdata', 
          base64_encode(serialize($data)), 
         'id', 
         $this->instance->id); 
    } 

     } 

    // Here's the closing bracket for the class definition 
    ?> 
    <p> this is a test </p> 

<form> 
    <input type="button" name="Teacher" value="Teacher"> //These buttons are tests 
</form> 
<form> 
    <input type="button" name="Pupil" value="Pupil"> //These buttons are tests 
</form> 
<form> 
    <input type="button" name="School" value="School"> //These buttons are tests 
</form> 
</body> 

答えて

0

おかげで私はあなたが

block_QEUMS.php

を作成するために忘れてしまったと思いますディレクトリツリー内のファイル

+0

こんにちは@icsbcnあなたのご関心とご協力ありがとうございます。私はインデックスファイルの名前をblock_qeimsに変更しました。これは、上に投稿したすべてのコードです – borson89

+0

こんにちは@ borson89。私の答えがあなたにとって有益だったら、それを「受け入れられる」とマークできますか? すべてのコードを 'block_qeims.php'に移動した後、結果はOKですか? – icsbcn