2016-03-30 19 views
2

Şu anda bir Moodle Eklentisi geliştiriyorum. Moodle bloğu kurmak ve yüklemek için belgeleri takip ettim. Ancak eklenti dosyasını Moodle'ımın blok klasörüne yerleştirdikten sonra, onu kaydetmez ve yükleyemiyorum. Birisi benim kod/dosya yapısının yanlış olup olmadığını veya yanlış gittiğimi söyler misiniz lütfen? peşinMoodle 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> 

cevap

0

yılında

teşekkürler Sana

block_QEUMS.php

oluşturmak için unuttum düşünüyorum Dizin ağacında

dosya.

+0

Merhaba @icsbcn İlginiz ve yardımınız için teşekkür ederiz. Ben indeks dosyamı block_qeims olarak yeniden adlandırdım, burada – borson89

+0

Hi @ borson89'un üzerine yazdığım tüm kodlar. Cevabım sizin için yardımcı olduysa, onu "kabul edildi" olarak işaretler misiniz? Tüm kodları 'block_qeims.php' konumuna taşıdıktan sonra sonuç tamam mı? – icsbcn