���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/viewcreator.tar
���ѧ٧ѧ�
tests/behat/view_view_creator_column.feature 0000644 00000002736 15152234023 0015453 0 ustar 00 @qbank @qbank_viewcreator Feature: Use the qbank plugin manager page for viewcreator plugin In order to check the plugin behaviour with enable and disable Background: Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | And the following "activities" exist: | activity | name | course | idnumber | | quiz | Test quiz | C1 | quiz1 | And the following "question categories" exist: | contextlevel | reference | name | | Course | C1 | Test questions | And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | truefalse | First question | Answer the first question | Scenario: Enable/disable viewcreator column from the base view Given I log in as "admin" And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration And I should see "View creator" When I click on "Disable" "link" in the "View creator" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page Then I should not see "Created by" And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration And I click on "Enable" "link" in the "View creator" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page Then I should see "Created by" tests/behat/modified_by_column.feature 0000644 00000006217 15152234023 0014200 0 ustar 00 @qbank @qbank_viewcreator Feature: Question bank Modified by column In order to help keep track of the changes of the question version in the question bank As a teacher I need to know who modified the question and when the modification made in the question bank Background: Given the following "courses" exist: | fullname | shortname | category | | Course 1 | C1 | 0 | And the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher1 | 1 | teacher1@example.com | | teacher2 | Teacher2 | 2 | teacher2@example.com | And the following "course enrolments" exist: | user | course | role | | teacher1 | C1 | editingteacher | | teacher2 | C1 | editingteacher | And the following "activities" exist: | activity | name | course | idnumber | | quiz | Test quiz | C1 | quiz1 | And the following "question categories" exist: | contextlevel | reference | name | | Activity module | quiz1 | Test questions | And the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | truefalse | First question | Answer the first question | @javascript Scenario: Enable/disable modified by column from the base view Given I log in as "admin" And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration And I should see "View creator" When I click on "Disable" "link" in the "View creator" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page And I set the field "Select a category" to "Test questions" Then I should not see "Modified by" And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration And I click on "Enable" "link" in the "View creator" "table_row" And I am on the "Test quiz" "mod_quiz > question bank" page And I set the field "Select a category" to "Test questions" Then I should see "Modified by" @javascript Scenario: Editing a question shows the modifier of the question And I log in as "teacher1" And I am on the "Test quiz" "mod_quiz > question bank" page And I set the field "Select a category" to "Test questions" And I should see "First question" And I choose "Edit question" action for "First question" in the question bank And I should see "Version 1" And I set the field "id_name" to "Renamed question v2" And I set the field "id_questiontext" to "edited question" And I press "id_submitbutton" And I should see "Teacher1" And I log in as "teacher2" And I am on the "Test quiz" "mod_quiz > question bank" page And I set the field "Select a category" to "Test questions" And I choose "Edit question" action for "Renamed question v2" in the question bank Then I should see "Version 2" And I set the field "id_name" to "Renamed question v3" And I set the field "id_questiontext" to "edited question v3" And I press "id_submitbutton" And I should not see "Teacher1" And I should see "Teacher2" templates/version_info.mustache 0000644 00000002270 15152234023 0012773 0 ustar 00 {{! 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/>. }} {{! @template qbank_editquestion/version_info Example context (json): { "addquestiondata": [ { "versionnumber": 1, "createdby": "Admin User on Wednesday, 20 October 2021, 5:33 AM" } ] } }} <div class="question-version-number"> <a><u>{{#str}} version, qbank_viewcreator, {{versionnumber}} {{/str}}</u></a> </div> {{#createdby}} <div class="question-creator-info"> <a>{{{createdby}}}</a> </div> {{/createdby}} templates/creator_display.mustache 0000644 00000002020 15152234023 0013450 0 ustar 00 {{! 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/>. }} {{! @template qbank_viewcreator/creator_display Example context (json): { "displaydata": [ { "creator": "Marc Ghaly", "date": "2 June 2021, 5:32 PM", } ] } }} <span class="qbank-creator-name"> {{creator}} </span> <br> <span class="date"> {{date}} </span> lib.php 0000644 00000003354 15152234023 0006025 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/>. /** * Helper functions and callbacks. * * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Safat Shahin <safatshahin@catalyst-au.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Edit page callback for information. * * @param object $question * @return string */ function qbank_viewcreator_edit_form_display($question): string { global $DB, $PAGE; $versiondata = []; $questionversion = $DB->get_record('question_versions', ['questionid' => $question->id])->version; $versiondata['versionnumber'] = $questionversion; if (!empty($question->createdby)) { $a = new stdClass(); $a->time = userdate($question->timecreated); $a->user = fullname($DB->get_record('user', ['id' => $question->createdby])); $versiondata['createdby'] = get_string('created', 'question') . ' ' . get_string('byandon', 'question', $a); } return $PAGE->get_renderer('qbank_viewcreator')->render_version_info($versiondata); } version.php 0000644 00000002211 15152234023 0006733 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/>. /** * Version information for qbank_viewcreator. * * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'qbank_viewcreator'; $plugin->version = 2022112800; $plugin->requires = 2022111800; $plugin->maturity = MATURITY_STABLE; classes/output/renderer.php 0000644 00000003051 15152234023 0012054 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 qbank_viewcreator\output; /** * Class renderer. * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class renderer extends \plugin_renderer_base { /** * Render question creator. * * @param array $displaydata * @return string */ public function render_creator_name($displaydata) { return $this->render_from_template('qbank_viewcreator/creator_display', $displaydata); } /** * Render question edit form callback. * * @param array $displaydata * @return string */ public function render_version_info($displaydata) { return $this->render_from_template('qbank_viewcreator/version_info', $displaydata); } } classes/modifier_name_column.php 0000644 00000005345 15152234023 0013071 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 qbank_viewcreator; use core_question\local\bank\column_base; /** * A column for info of the question modifier. * * @package qbank_viewcreator * @copyright 2022 Catalyst IT Australia Pty Ltd * @author Safat Shahin <safatshahin@catalyst-au.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class modifier_name_column extends column_base { public function get_name(): string { return 'modifiername'; } public function get_title(): string { return get_string('modifiedby', 'qbank_viewcreator'); } protected function display_content($question, $rowclasses): void { global $PAGE; $displaydata = []; if (!empty($question->modifierfirstname) && !empty($question->modifierlastname)) { $u = new \stdClass(); $u = username_load_fields_from_object($u, $question, 'modifier'); $displaydata['date'] = userdate($question->timemodified, get_string('strftimedatetime', 'langconfig')); $displaydata['creator'] = fullname($u); echo $PAGE->get_renderer('qbank_viewcreator')->render_creator_name($displaydata); } } public function get_extra_joins(): array { return ['um' => 'LEFT JOIN {user} um ON um.id = q.modifiedby']; } public function get_required_fields(): array { $allnames = \core_user\fields::get_name_fields(); $requiredfields = []; foreach ($allnames as $allname) { $requiredfields[] = 'um.' . $allname . ' AS modifier' . $allname; } $requiredfields[] = 'q.timemodified'; return $requiredfields; } public function is_sortable(): array { return [ 'firstname' => ['field' => 'um.firstname', 'title' => get_string('firstname')], 'lastname' => ['field' => 'um.lastname', 'title' => get_string('lastname')], 'timemodified' => ['field' => 'q.timemodified', 'title' => get_string('date')] ]; } public function get_extra_classes(): array { return ['pr-3']; } } classes/privacy/provider.php 0000644 00000002264 15152234023 0012222 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 qbank_viewcreator\privacy; /** * Privacy Subsystem for qbank_viewcreator implementing null_provider. * * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { public static function get_reason(): string { return 'privacy:metadata'; } } classes/creator_name_column.php 0000644 00000005325 15152234023 0012730 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 qbank_viewcreator; use core_question\local\bank\column_base; /** * A column type for the name of the question creator. * * @package qbank_viewcreator * @copyright 2009 Tim Hunt * @author 2021 Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class creator_name_column extends column_base { public function get_name(): string { return 'creatorname'; } public function get_title(): string { return get_string('createdby', 'question'); } protected function display_content($question, $rowclasses): void { global $PAGE; $displaydata = []; if (!empty($question->creatorfirstname) && !empty($question->creatorlastname)) { $u = new \stdClass(); $u = username_load_fields_from_object($u, $question, 'creator'); $displaydata['date'] = userdate($question->timecreated, get_string('strftimedatetime', 'langconfig')); $displaydata['creator'] = fullname($u); echo $PAGE->get_renderer('qbank_viewcreator')->render_creator_name($displaydata); } } public function get_extra_joins(): array { return ['uc' => 'LEFT JOIN {user} uc ON uc.id = q.createdby']; } public function get_required_fields(): array { $allnames = \core_user\fields::get_name_fields(); $requiredfields = []; foreach ($allnames as $allname) { $requiredfields[] = 'uc.' . $allname . ' AS creator' . $allname; } $requiredfields[] = 'q.timecreated'; return $requiredfields; } public function is_sortable(): array { return [ 'firstname' => ['field' => 'uc.firstname', 'title' => get_string('firstname')], 'lastname' => ['field' => 'uc.lastname', 'title' => get_string('lastname')], 'timecreated' => ['field' => 'q.timecreated', 'title' => get_string('date')] ]; } public function get_extra_classes(): array { return ['pr-3']; } } classes/plugin_feature.php 0000644 00000002435 15152234023 0011724 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 qbank_viewcreator; use core_question\local\bank\plugin_features_base; /** * Class plugin_feature is the entrypoint for the columns. * * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class plugin_feature extends plugin_features_base { public function get_question_columns($qbank): array { return [ new creator_name_column($qbank), new modifier_name_column($qbank), ]; } } lang/en/qbank_viewcreator.php 0000644 00000002272 15152234023 0012306 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/>. /** * Strings for component qbank_viewcreator, language 'en' * * @package qbank_viewcreator * @copyright 2021 Catalyst IT Australia Pty Ltd * @author Ghaly Marc-Alexandre <marc-alexandreghaly@catalyst-ca.net> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['modifiedby'] = 'Modified by'; $string['pluginname'] = 'View creator'; $string['privacy:metadata'] = 'The View creator question bank plugin does not store any personal data.'; $string['version'] = 'Version {$a}';
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�