Файловый менеджер - Редактировать - /home/harasnat/www/mf/external.tar
Назад
comment_area_exporter.php 0000604 00000011133 15062141252 0011630 0 ustar 00 <?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/>. /** * Exporting a comment area. * * A comment area is the set of information about a defined comments area. * * @package core_comment * @copyright 2015 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_comment\external; defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/comment/lib.php'); use comment; use renderer_base; use stdClass; /** * Class for exporting a comment area. * * @package core_comment * @copyright 2015 Frédéric Massart - FMCorz.net * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class comment_area_exporter extends \core\external\exporter { /** @var comment The comment instance. */ protected $comment = null; public function __construct(comment $comment, $related = array()) { $this->comment = $comment; $data = new stdClass(); $data->component = $comment->get_component(); $data->commentarea = $comment->get_commentarea(); $data->itemid = $comment->get_itemid(); $data->courseid = $comment->get_courseid(); $data->contextid = $comment->get_context()->id; $data->cid = $comment->get_cid(); parent::__construct($data, $related); } protected static function define_properties() { return array( 'component' => array( 'type' => PARAM_COMPONENT, ), 'commentarea' => array( 'type' => PARAM_AREA, ), 'itemid' => array( 'type' => PARAM_INT, ), 'courseid' => array( 'type' => PARAM_INT, ), 'contextid' => array( 'type' => PARAM_INT, ), 'cid' => array( 'type' => PARAM_ALPHANUMEXT, ), ); } protected static function define_other_properties() { return array( 'autostart' => array( 'type' => PARAM_BOOL, ), 'canpost' => array( 'type' => PARAM_BOOL, ), 'canview' => array( 'type' => PARAM_BOOL, ), 'count' => array( 'type' => PARAM_INT, ), 'collapsediconkey' => array( 'type' => PARAM_RAW, ), 'displaytotalcount' => array( 'type' => PARAM_BOOL, ), 'displaycancel' => array( 'type' => PARAM_BOOL, ), 'fullwidth' => array( 'type' => PARAM_BOOL, ), 'linktext' => array( 'type' => PARAM_RAW, ), 'notoggle' => array( 'type' => PARAM_BOOL, ), 'template' => array( 'type' => PARAM_RAW, ), 'canpostorhascomments' => array( 'type' => PARAM_BOOL ) ); } public function get_other_values(renderer_base $output) { $values = array(); $values['autostart'] = $this->comment->get_autostart(); $values['canpost'] = $this->comment->can_post(); $values['canview'] = $this->comment->can_view(); $values['collapsediconkey'] = right_to_left() ? 't/collapsed_rtl' : 't/collapsed'; $values['count'] = $this->comment->count(); $values['displaycancel'] = $this->comment->get_displaycancel(); $values['displaytotalcount'] = $this->comment->get_displaytotalcount(); $values['fullwidth'] = $this->comment->get_fullwidth(); $values['linktext'] = $this->comment->get_linktext(); $values['notoggle'] = $this->comment->get_notoggle(); $values['template'] = $this->comment->get_template(); $values['canpostorhascomments'] = $values['canpost'] || ($values['canview'] && $values['count'] > 0); return $values; } } feedback_summary_exporter.php 0000604 00000015102 15062275476 0012517 0 ustar 00 <?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 ]; } } feedback_value_exporter.php 0000604 00000004410 15062275476 0012136 0 ustar 00 <?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.', ), ); } } feedback_valuetmp_exporter.php 0000604 00000004426 15062275476 0012666 0 ustar 00 <?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.', ), ); } } feedback_completed_exporter.php 0000604 00000005053 15062275476 0013002 0 ustar 00 <?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.', ), ); } } feedback_item_exporter.php 0000604 00000013502 15062275476 0011762 0 ustar 00 <?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 ]; } } feedback_completedtmp_exporter.php 0000604 00000005337 15062275476 0013530 0 ustar 00 <?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.', ), ); } } tag_item_exporter.php 0000604 00000005645 15062325021 0011000 0 ustar 00 <?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/>. /** * Contains related class for displaying information of a tag item. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_tag\external; defined('MOODLE_INTERNAL') || die(); use core\external\exporter; /** * Contains related class for displaying information of a tag item. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class tag_item_exporter extends exporter { /** * Return the list of properties. * * @return array */ protected static function define_properties() { return [ 'id' => [ 'type' => PARAM_INT, 'description' => 'Tag id.', ], 'name' => [ 'type' => PARAM_TAG, 'description' => 'Tag name.', ], 'rawname' => [ 'type' => PARAM_RAW, 'description' => 'The raw, unnormalised name for the tag as entered by users.', ], 'isstandard' => [ 'type' => PARAM_BOOL, 'description' => 'Whether this tag is standard.', 'default' => false, ], 'tagcollid' => [ 'type' => PARAM_INT, 'description' => 'Tag collection id.', ], 'taginstanceid' => [ 'type' => PARAM_INT, 'description' => 'Tag instance id.', ], 'taginstancecontextid' => [ 'type' => PARAM_INT, 'description' => 'Context the tag instance belongs to.', ], 'itemid' => [ 'type' => PARAM_INT, 'description' => 'Id of the record tagged.', ], 'ordering' => [ 'type' => PARAM_INT, 'description' => 'Tag ordering.', ], 'flag' => [ 'type' => PARAM_INT, 'description' => 'Whether the tag is flagged as inappropriate.', 'default' => 0, 'null' => NULL_ALLOWED, ], ]; } } util.php 0000604 00000004213 15062325021 0006222 0 ustar 00 <?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 core_tag\external; use core_tag_tag; /** * Tag external functions utility class. * * @package core_tag * @copyright 2019 Juan Leyva * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 3.7 */ class util { /** * Get the array of core_tag_tag objects for external functions associated with an item (instances). * * @param string $component component responsible for tagging. For BC it can be empty but in this case the * query will be slow because DB index will not be used. * @param string $itemtype type of the tagged item * @param int $itemid * @param int $standardonly wether to return only standard tags or any * @param int $tiuserid tag instance user id, only needed for tag areas with user tagging * @return array tags for external functions */ public static function get_item_tags( $component, $itemtype, $itemid, $standardonly = core_tag_tag::BOTH_STANDARD_AND_NOT, $tiuserid = 0 ) { global $PAGE; $output = $PAGE->get_renderer('core'); $tagitems = core_tag_tag::get_item_tags($component, $itemtype, $itemid, $standardonly, $tiuserid); $exportedtags = []; foreach ($tagitems as $tagitem) { $exporter = new tag_item_exporter($tagitem->to_object()); $exportedtags[] = (array) $exporter->export($output); } return $exportedtags; } } tag_area_exporter.php 0000604 00000007206 15062325021 0010745 0 ustar 00 <?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/>. /** * Contains related class for displaying information of a tag area. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_tag\external; defined('MOODLE_INTERNAL') || die(); use core\external\exporter; use renderer_base; /** * Contains related class for displaying information of a tag area. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class tag_area_exporter extends exporter { /** * Return the list of properties. * * @return array */ protected static function define_properties() { return [ 'id' => [ 'type' => PARAM_INT, 'description' => 'Area id.', ], 'component' => [ 'type' => PARAM_COMPONENT, 'description' => 'Component the area is related to.', ], 'itemtype' => [ 'type' => PARAM_ALPHANUMEXT, 'description' => 'Type of item in the component.', ], 'enabled' => [ 'type' => PARAM_BOOL, 'description' => 'Whether this area is enabled.', 'default' => true, ], 'tagcollid' => [ 'type' => PARAM_INT, 'description' => 'The tag collection this are belongs to.', ], 'callback' => [ 'type' => PARAM_RAW, 'description' => 'Component callback for processing tags.', 'null' => NULL_ALLOWED, ], 'callbackfile' => [ 'type' => PARAM_RAW, 'description' => 'Component callback file.', 'null' => NULL_ALLOWED, ], 'showstandard' => [ 'type' => PARAM_INT, 'description' => 'Return whether to display only standard, only non-standard or both tags.', 'default' => 0, ], 'multiplecontexts' => [ 'type' => PARAM_BOOL, 'description' => 'Whether the tag area allows tag instances to be created in multiple contexts. ', 'default' => false, ], ]; } protected static function define_related() { return array( 'locked' => 'bool?' ); } protected static function define_other_properties() { return array( 'locked' => [ 'type' => PARAM_BOOL, 'description' => 'Whether the area is locked.', 'null' => NULL_ALLOWED, 'default' => false, 'optional' => true, ] ); } protected function get_other_values(renderer_base $output) { $values['locked'] = $this->related['locked'] ? true : false; return $values; } } tag_collection_exporter.php 0000604 00000005230 15062325021 0012163 0 ustar 00 <?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/>. /** * Contains related class for displaying information of a tag collection. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_tag\external; defined('MOODLE_INTERNAL') || die(); use core\external\exporter; /** * Contains related class for displaying information of a tag collection. * * @package core_tag * @copyright 2019 Juan Leyva <juan@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class tag_collection_exporter extends exporter { /** * Return the list of properties. * * @return array */ protected static function define_properties() { return [ 'id' => [ 'type' => PARAM_INT, 'description' => 'Collection id.', ], 'name' => [ 'type' => PARAM_NOTAGS, 'description' => 'Collection name.', 'null' => NULL_ALLOWED, ], 'isdefault' => [ 'type' => PARAM_BOOL, 'description' => 'Whether is the default collection.', 'default' => false, ], 'component' => [ 'type' => PARAM_COMPONENT, 'description' => 'Component the collection is related to.', 'null' => NULL_ALLOWED, ], 'sortorder' => [ 'type' => PARAM_INT, 'description' => 'Collection ordering in the list.', ], 'searchable' => [ 'type' => PARAM_BOOL, 'description' => 'Whether the tag collection is searchable.', 'default' => true, ], 'customurl' => [ 'type' => PARAM_NOTAGS, 'description' => 'Custom URL for the tag page instead of /tag/index.php.', 'null' => NULL_ALLOWED, ], ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка