Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
/**
* Book import form
*
* @package booktool_importhtml
* @copyright 2004-2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir.'/formslib.php');
class booktool_importhtml_form extends moodleform {
function definition() {
$mform = $this->_form;
$data = $this->_customdata;
$mform->addElement('header', 'general', get_string('import', 'booktool_importhtml'));
$options = array(
// '0'=>get_string('typeonefile', 'booktool_importhtml'),
'1'=>get_string('typezipdirs', 'booktool_importhtml'),
'2'=>get_string('typezipfiles', 'booktool_importhtml'),
);
$mform->addElement('select', 'type', get_string('type', 'booktool_importhtml'), $options);
$mform->setDefault('type', 2);
$mform->addElement('filepicker', 'importfile', get_string('ziparchive', 'booktool_importhtml'));
$mform->addHelpButton('importfile', 'ziparchive', 'booktool_importhtml');
$mform->addRule('importfile', null, 'required');
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'chapterid');
$mform->setType('chapterid', PARAM_INT);
$this->add_action_buttons(true, get_string('doimport', 'booktool_importhtml'));
$this->set_data($data);
}
function validation($data, $files) {
global $USER;
if ($errors = parent::validation($data, $files)) {
return $errors;
}
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
if (!$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['importfile'], 'id', false)) {
$errors['importfile'] = get_string('required');
return $errors;
} else {
$file = reset($files);
if ($file->get_mimetype() != 'application/zip') {
$errors['importfile'] = get_string('invalidfiletype', 'error', $file->get_filename());
// better delete current file, it is not usable anyway
$fs->delete_area_files($usercontext->id, 'user', 'draft', $data['importfile']);
} else {
if (!$chpterfiles = toolbook_importhtml_get_chapter_files($file, $data['type'])) {
$errors['importfile'] = get_string('errornochapters', 'booktool_importhtml');
}
}
}
return $errors;
}
}