mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
"MDL-18520, file system, supported choose a subdirectory"
This commit is contained in:
parent
a1b53dcf3f
commit
93e9aa2792
@ -68,7 +68,9 @@ if (!empty($edit) || !empty($new)) {
|
||||
if ($edit) {
|
||||
$settings = array();
|
||||
foreach($configs as $config) {
|
||||
$settings[$config] = $fromform->$config;
|
||||
if (!empty($fromform->$config)) {
|
||||
$settings[$config] = $fromform->$config;
|
||||
}
|
||||
}
|
||||
$instanceoptionnames = repository::static_function($edit, 'get_instance_option_names');
|
||||
if (!empty($instanceoptionnames)) {
|
||||
|
@ -100,8 +100,6 @@ if (!empty($edit) || !empty($new)) {
|
||||
print_error('confirmsesskeybad', '', $baseurl);
|
||||
}
|
||||
$instance = repository::get_type_by_typename($hide);
|
||||
var_dump($instance);
|
||||
var_dump($hide);
|
||||
$instance->hide();
|
||||
$return = true;
|
||||
} else if (!empty($delete)) {
|
||||
|
@ -14,12 +14,14 @@ class repository_filesystem extends repository {
|
||||
global $CFG;
|
||||
parent::__construct($repositoryid, $context, $options);
|
||||
$this->root_path = $CFG->dataroot.'/repository/';
|
||||
$this->root_path .= ($this->options['fs_path'] . '/');
|
||||
if (!empty($options['ajax'])) {
|
||||
if (!is_dir($this->root_path)) {
|
||||
$created = mkdir($this->root_path, 0700);
|
||||
$ret = array();
|
||||
$ret['msg'] = get_string('invalidpath', 'repository_filesystem');
|
||||
$ret['nosearch'] = true;
|
||||
if ($options['ajax']) {
|
||||
if ($options['ajax'] && !$created) {
|
||||
echo json_encode($ret);
|
||||
exit;
|
||||
}
|
||||
@ -110,7 +112,7 @@ class repository_filesystem extends repository {
|
||||
}
|
||||
|
||||
public static function get_instance_option_names() {
|
||||
return null;
|
||||
return array('fs_path');
|
||||
}
|
||||
|
||||
public static function get_type_option_names() {
|
||||
@ -118,4 +120,19 @@ class repository_filesystem extends repository {
|
||||
}
|
||||
public function type_config_form(&$mform) {
|
||||
}
|
||||
public function instance_config_form(&$mform) {
|
||||
global $CFG;
|
||||
$path = $CFG->dataroot . '/repository/';
|
||||
if ($handle = opendir($path)) {
|
||||
$fieldname = get_string('path', 'repository_filesystem');
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (is_dir($path.$file) && $file != '.' && $file!= '..') {
|
||||
$mform->addElement('radio', 'fs_path', $fieldname, $file, $file);
|
||||
$fieldname = '';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
$mform->addElement('static', null, '', get_string('information','repository_filesystem'));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user