Buenas a todos,
Estoy creando un bloque,
necesito luego poder mostrar las imagenes que guardo con este form.
require_once("{$CFG->libdir}/formslib.php");
class myblock_form extends moodleform {
function definition() {
$mform = & $this->_form;
$mform->addElement('header', 'displayinfo', get_string('header_form', 'block_myblock'));
$mform->addElement('text', 'name', get_string('namemyThing', 'block_myblock'));
$mform->setType('description', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->addElement('text', 'url', get_string('urlmyThing', 'block_myblock'));
$mform->setType('description', PARAM_PATH);
$mform->addRule('url', null, 'required', null, 'client');
// add filename selection.
$mform->addElement('filepicker', 'image', get_string('filelogo','block_myblock'), null, array('accepted_types' => 'image'));
$this->add_action_buttons();
}
y después trato con
if (!$DB->insert_record('block_mitabla', $fromform)) {
print_error('inserterror', 'block_myblock');
}
eso "funciona", seguro que falta cargar la imagen a la bd ya que solo hago el $DB->insert_record(...), pero luego desde lib.php como muestro esta imagen?
solo encuentro por la documentación de moodle esto
$content = $mform->get_file_content('userfile');
pero yo no quiero mostrarlo a través de un form
Gracias por la ayuda.