first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Privacy Subsystem implementation for repository_areafiles.
*
* @package repository_areafiles
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_areafiles\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_areafiles implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Plugin capabilities for repository_areafiles
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'repository/areafiles:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'user' => CAP_ALLOW
)
)
);
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Creating a default instance of areafiles repository on install
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_repository_areafiles_install() {
global $CFG;
$result = true;
require_once($CFG->dirroot.'/repository/lib.php');
$areafiles_plugin = new repository_type('areafiles', array(), true);
if(!$id = $areafiles_plugin->create(true)) {
$result = false;
}
return $result;
}
@@ -0,0 +1,29 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'repository_areafiles'
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['areafiles:view'] = 'View repository Embedded files';
$string['configplugin'] = 'Configuration for repository Embedded files';
$string['pluginname_help'] = 'Files embedded in the current text editor';
$string['pluginname'] = 'Embedded files';
$string['privacy:metadata'] = 'The Embedded files repository plugin does not store or transmit any personal data.';
+136
View File
@@ -0,0 +1,136 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class repository_areafiles
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/repository/lib.php');
/**
* Main class responsible for files listing in repostiory_areafiles
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_areafiles extends repository {
/**
* Areafiles plugin doesn't require login, so list all files
*
* @return mixed
*/
public function print_login() {
return $this->get_listing();
}
/**
* Get file listing
*
* @param string $path
* @param string $path not used by this plugin
* @return mixed
*/
public function get_listing($path = '', $page = '') {
global $USER, $OUTPUT;
$itemid = optional_param('itemid', 0, PARAM_INT);
$env = optional_param('env', 'filepicker', PARAM_ALPHA);
$ret = array(
'dynload' => true,
'nosearch' => true,
'nologin' => true,
'list' => array(),
);
if (empty($itemid) || $env !== 'editor') {
return $ret;
}
// In the most cases files embedded in textarea do not have subfolders. Do not show path by default.
$retpath = array(array('name' => get_string('files'), 'path' => ''));
if (!empty($path)) {
$pathchunks = preg_split('|/|', trim($path, '/'));
foreach ($pathchunks as $i => $chunk) {
$retpath[] = array(
'name' => $chunk,
'path' => '/'. join('/', array_slice($pathchunks, 0, $i + 1)). '/'
);
}
$ret['path'] = $retpath; // Show path if already inside subfolder.
}
$context = context_user::instance($USER->id);
$fs = get_file_storage();
$files = $fs->get_directory_files($context->id, 'user', 'draft', $itemid,
empty($path) ? '/' : $path, false, true);
foreach ($files as $file) {
if ($file->is_directory()) {
$node = array(
'title' => basename($file->get_filepath()),
'path' => $file->get_filepath(),
'children' => array(),
'datemodified' => $file->get_timemodified(),
'datecreated' => $file->get_timecreated(),
'icon' => $OUTPUT->image_url(file_folder_icon())->out(false),
'thumbnail' => $OUTPUT->image_url(file_folder_icon())->out(false)
);
$ret['list'][] = $node;
$ret['path'] = $retpath; // Show path if subfolders exist.
continue;
}
$fileurl = moodle_url::make_draftfile_url($itemid, $file->get_filepath(), $file->get_filename());
$node = array(
'title' => $file->get_filename(),
'size' => $file->get_filesize(),
'source' => $fileurl->out(),
'datemodified' => $file->get_timemodified(),
'datecreated' => $file->get_timecreated(),
'author' => $file->get_author(),
'license' => $file->get_license(),
'isref' => $file->is_external_file(),
'iscontrolledlink' => $file->is_controlled_link(),
'icon' => $OUTPUT->image_url(file_file_icon($file))->out(false),
'thumbnail' => $OUTPUT->image_url(file_file_icon($file))->out(false)
);
if ($file->get_status() == 666) {
$node['originalmissing'] = true;
}
if ($imageinfo = $file->get_imageinfo()) {
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb', 'oid' => $file->get_timemodified()));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
$ret['list'][] = $node;
}
$ret['list'] = array_filter($ret['list'], array($this, 'filter'));
return $ret;
}
/**
* This plugin only can return link
*
* @return int
*/
public function supported_returntypes() {
return FILE_EXTERNAL;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

+29
View File
@@ -0,0 +1,29 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Version information for plugin repository_areafiles
*
* @package repository_areafiles
* @copyright 2013 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'repository_areafiles'; // Full name of the plugin (used for diagnostics)