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,74 @@
<?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 for exporting a feedback completion record.
*
* @package mod_feedback
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_feedback\external;
defined('MOODLE_INTERNAL') || die();
use core\external\exporter;
/**
* Class for exporting a feedback completion record.
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class feedback_completed_exporter extends exporter {
/**
* Return the list of properties.
*
* @return array list of properties
*/
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The record id.',
),
'feedback' => array(
'type' => PARAM_INT,
'description' => 'The feedback instance id this records belongs to.',
),
'userid' => array(
'type' => PARAM_INT,
'description' => 'The user who completed the feedback (0 for anonymous).',
),
'timemodified' => array(
'type' => PARAM_INT,
'description' => 'The last time the feedback was completed.',
),
'random_response' => array(
'type' => PARAM_INT,
'description' => 'The response number (used when shuffling anonymous responses).',
),
'anonymous_response' => array(
'type' => PARAM_INT,
'description' => 'Whether is an anonymous response.',
),
'courseid' => array(
'type' => PARAM_INT,
'description' => 'The course id where the feedback was completed.',
),
);
}
}
@@ -0,0 +1,78 @@
<?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 for exporting a feedback temporary completion record.
*
* @package mod_feedback
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_feedback\external;
defined('MOODLE_INTERNAL') || die();
use core\external\exporter;
/**
* Class for exporting a feedback temporary completion record.
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class feedback_completedtmp_exporter extends exporter {
/**
* Return the list of properties.
*
* @return array list of properties
*/
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The record id.',
),
'feedback' => array(
'type' => PARAM_INT,
'description' => 'The feedback instance id this records belongs to.',
),
'userid' => array(
'type' => PARAM_INT,
'description' => 'The user who completed the feedback (0 for anonymous).',
),
'guestid' => array(
'type' => PARAM_RAW,
'description' => 'For guests, this is the session key.',
),
'timemodified' => array(
'type' => PARAM_INT,
'description' => 'The last time the feedback was completed.',
),
'random_response' => array(
'type' => PARAM_INT,
'description' => 'The response number (used when shuffling anonymous responses).',
),
'anonymous_response' => array(
'type' => PARAM_INT,
'description' => 'Whether is an anonymous response.',
),
'courseid' => array(
'type' => PARAM_INT,
'description' => 'The course id where the feedback was completed.',
),
);
}
}
+177
View File
@@ -0,0 +1,177 @@
<?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 for exporting a feedback item (question).
*
* @package mod_feedback
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_feedback\external;
defined('MOODLE_INTERNAL') || die();
use core\external\exporter;
use renderer_base;
use core_files\external\stored_file_exporter;
/**
* Class for exporting a feedback item (question).
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class feedback_item_exporter extends exporter {
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The record id.',
),
'feedback' => array(
'type' => PARAM_INT,
'description' => 'The feedback instance id this records belongs to.',
'default' => 0,
),
'template' => array(
'type' => PARAM_INT,
'description' => 'If it belogns to a template, the template id.',
'default' => 0,
),
'name' => array(
'type' => PARAM_RAW,
'description' => 'The item name.',
),
'label' => array(
'type' => PARAM_NOTAGS,
'description' => 'The item label.',
),
'presentation' => array(
'type' => PARAM_RAW,
'description' => 'The text describing the item or the available possible answers.',
),
'typ' => array(
'type' => PARAM_ALPHA,
'description' => 'The type of the item.',
),
'hasvalue' => array(
'type' => PARAM_INT,
'description' => 'Whether it has a value or not.',
'default' => 0,
),
'position' => array(
'type' => PARAM_INT,
'description' => 'The position in the list of questions.',
'default' => 0,
),
'required' => array(
'type' => PARAM_BOOL,
'description' => 'Whether is a item (question) required or not.',
'default' => 0,
),
'dependitem' => array(
'type' => PARAM_INT,
'description' => 'The item id this item depend on.',
'default' => 0,
),
'dependvalue' => array(
'type' => PARAM_RAW,
'description' => 'The depend value.',
),
'options' => array(
'type' => PARAM_ALPHA,
'description' => 'Different additional settings for the item (question).',
),
);
}
protected static function define_related() {
return array(
'context' => 'context',
'itemnumber' => 'int?'
);
}
protected static function define_other_properties() {
return array(
'itemfiles' => array(
'type' => stored_file_exporter::read_properties_definition(),
'multiple' => true
),
'itemnumber' => array(
'type' => PARAM_INT,
'description' => 'The item position number',
'null' => NULL_ALLOWED
),
'otherdata' => array(
'type' => PARAM_RAW,
'description' => 'Additional data that may be required by external functions',
'null' => NULL_ALLOWED
),
);
}
protected function get_other_values(renderer_base $output) {
$context = $this->related['context'];
$itemobj = feedback_get_item_class($this->data->typ);
$values = array(
'itemfiles' => array(),
'itemnumber' => $this->related['itemnumber'],
'otherdata' => $itemobj->get_data_for_external($this->data),
);
$fs = get_file_storage();
$files = array();
$itemfiles = $fs->get_area_files($context->id, 'mod_feedback', 'item', $this->data->id, 'filename', false);
if (!empty($itemfiles)) {
foreach ($itemfiles as $storedfile) {
$fileexporter = new stored_file_exporter($storedfile, array('context' => $context));
$files[] = $fileexporter->export($output);
}
$values['itemfiles'] = $files;
}
return $values;
}
/**
* Get the formatting parameters for the name.
*
* @return array
*/
protected function get_format_parameters_for_name() {
return [
'component' => 'mod_feedback',
'filearea' => 'item',
'itemid' => $this->data->id
];
}
/**
* Get the formatting parameters for the presentation.
*
* @return array
*/
protected function get_format_parameters_for_presentation() {
return [
'component' => 'mod_feedback',
'filearea' => 'item',
'itemid' => $this->data->id
];
}
}
@@ -0,0 +1,190 @@
<?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/>.
namespace mod_feedback\external;
use core\external\exporter;
use renderer_base;
use core_external\util as external_util;
use core_external\external_files;
/**
* Class for exporting partial feedback data (some fields are only viewable by admins).
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package mod_feedback
*/
class feedback_summary_exporter extends exporter {
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The primary key of the record.',
),
'course' => array(
'type' => PARAM_INT,
'description' => 'Course id this feedback is part of.',
),
'name' => array(
'type' => PARAM_TEXT,
'description' => 'Feedback name.',
),
'intro' => array(
'default' => '',
'type' => PARAM_RAW,
'description' => 'Feedback introduction text.',
),
'introformat' => array(
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
'type' => PARAM_INT,
'default' => FORMAT_MOODLE,
'description' => 'Feedback intro text format.',
),
'lang' => array(
'type' => PARAM_LANG,
'description' => 'Forced activity language',
'null' => NULL_ALLOWED,
),
'anonymous' => array(
'type' => PARAM_INT,
'description' => 'Whether the feedback is anonymous.',
),
'email_notification' => array(
'type' => PARAM_BOOL,
'optional' => true,
'description' => 'Whether email notifications will be sent to teachers.',
),
'multiple_submit' => array(
'default' => 1,
'type' => PARAM_BOOL,
'description' => 'Whether multiple submissions are allowed.',
),
'autonumbering' => array(
'default' => 1,
'type' => PARAM_BOOL,
'description' => 'Whether questions should be auto-numbered.',
),
'site_after_submit' => array(
'type' => PARAM_TEXT,
'optional' => true,
'description' => 'Link to next page after submission.',
),
'page_after_submit' => array(
'type' => PARAM_RAW,
'optional' => true,
'description' => 'Text to display after submission.',
),
'page_after_submitformat' => array(
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
'type' => PARAM_INT,
'default' => FORMAT_MOODLE,
'description' => 'Text to display after submission format.',
),
'publish_stats' => array(
'default' => 0,
'type' => PARAM_BOOL,
'description' => 'Whether stats should be published.',
),
'timeopen' => array(
'type' => PARAM_INT,
'optional' => true,
'description' => 'Allow answers from this time.',
),
'timeclose' => array(
'type' => PARAM_INT,
'optional' => true,
'description' => 'Allow answers until this time.',
),
'timemodified' => array(
'type' => PARAM_INT,
'optional' => true,
'description' => 'The time this record was modified.',
),
'completionsubmit' => array(
'default' => 0,
'type' => PARAM_BOOL,
'description' => 'If this field is set to 1, then the activity will be automatically marked as complete on submission.',
),
);
}
protected static function define_related() {
return array(
'context' => 'context'
);
}
protected static function define_other_properties() {
return array(
'coursemodule' => array(
'type' => PARAM_INT
),
'introfiles' => array(
'type' => external_files::get_properties_for_exporter(),
'multiple' => true
),
'pageaftersubmitfiles' => array(
'type' => external_files::get_properties_for_exporter(),
'multiple' => true,
'optional' => true
),
);
}
protected function get_other_values(renderer_base $output) {
$context = $this->related['context'];
$values = array(
'coursemodule' => $context->instanceid,
);
$values['introfiles'] = external_util::get_area_files($context->id, 'mod_feedback', 'intro', false, false);
if (!empty($this->data->page_after_submit)) {
$values['pageaftersubmitfiles'] = external_util::get_area_files($context->id, 'mod_feedback', 'page_after_submit');
}
return $values;
}
/**
* Get the formatting parameters for the intro.
*
* @return array
*/
protected function get_format_parameters_for_intro() {
return [
'component' => 'mod_feedback',
'filearea' => 'intro',
'options' => array('noclean' => true),
];
}
/**
* Get the formatting parameters for the page_after_submit.
*
* @return array
*/
protected function get_format_parameters_for_page_after_submit() {
return [
'component' => 'mod_feedback',
'filearea' => 'page_after_submit',
'itemid' => 0
];
}
}
@@ -0,0 +1,70 @@
<?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 for exporting a feedback response.
*
* @package mod_feedback
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_feedback\external;
defined('MOODLE_INTERNAL') || die();
use core\external\exporter;
/**
* Class for exporting a feedback response.
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class feedback_value_exporter extends exporter {
/**
* Return the list of properties.
*
* @return array list of properties
*/
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The record id.',
),
'course_id' => array(
'type' => PARAM_INT,
'description' => 'The course id this record belongs to.',
),
'item' => array(
'type' => PARAM_INT,
'description' => 'The item id that was responded.',
),
'completed' => array(
'type' => PARAM_INT,
'description' => 'Reference to the feedback_completed table.',
),
'tmp_completed' => array(
'type' => PARAM_INT,
'description' => 'Old field - not used anymore.',
),
'value' => array(
'type' => PARAM_RAW,
'description' => 'The response value.',
),
);
}
}
@@ -0,0 +1,70 @@
<?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 for exporting a feedback tmp response.
*
* @package mod_feedback
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_feedback\external;
defined('MOODLE_INTERNAL') || die();
use core\external\exporter;
/**
* Class for exporting a feedback tmp response.
*
* @copyright 2017 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class feedback_valuetmp_exporter extends exporter {
/**
* Return the list of properties.
*
* @return array list of properties
*/
protected static function define_properties() {
return array(
'id' => array(
'type' => PARAM_INT,
'description' => 'The record id.',
),
'course_id' => array(
'type' => PARAM_INT,
'description' => 'The course id this record belongs to.',
),
'item' => array(
'type' => PARAM_INT,
'description' => 'The item id that was responded.',
),
'completed' => array(
'type' => PARAM_INT,
'description' => 'Reference to the feedback_completedtmp table.',
),
'tmp_completed' => array(
'type' => PARAM_INT,
'description' => 'Old field - not used anymore.',
),
'value' => array(
'type' => PARAM_RAW,
'description' => 'The response value.',
),
);
}
}