0
class block_image extends block_base {

function init() {
    $this->title = get_string('pluginname', 'block_image');

}

function applicable_formats() {
    return array('all' => true, 'tag' => false);
}

function specialization() {
    $this->title = isset($this->config->title) ? $this->config->title : get_string('newblock', 'block_image');
}

function instance_allow_multiple() {
    return true;
}

function get_content()
{

    global $USER, $DB;

    if ($this->content !== NULL) {
        return $this->content;
    }

    $this->content = new stdClass();
    $this->content->footer ="Hello Image ";
    return $this->content;
}




function has_config() {return true;}
}    


class block_image_edit_form extends block_edit_form{


protected function specific_definition($mform){
    $maxbytes =100;
    $mform->addElement('filepicker', 'userfile', get_string('file'), null,
               array('maxbytes' => $maxbytes, 'accepted_types' => '*'));
    $success = $this->save_file('userfile', 'C:\Users\R.C\Desktop', false);
    $content = $this->get_file_content('userfile');
}
}

These code are stored in two separated files, i tried almost everything but i unable to do this, i am newbie in moodle as well as on php, kindly help me this, i am trying to store image and show in footer.

0 Answers0