Skip to content

Commit

Permalink
Merge pull request #16 from andreasschenkel/develop
Browse files Browse the repository at this point in the history
v2.0.5
  • Loading branch information
andreasschenkel authored Feb 2, 2022
2 parents 51c3c7a + c1ffc58 commit 74dcd0e
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 97 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 1. and 2. choice in feedback-generator #
# 1. and 2. ranked choice in feedback-generator #

A: How to use

Expand All @@ -17,7 +17,9 @@ G: Installing manually

### A: How to use ###

Plugin that helps to generate an xml-file to import into activity feedback to support first and second choise feedback.
Plugin that helps to generate an xml-file to import into activity feedback to support ranked first and second choise with the activity feedback.

You can generate the needed XML-file with the questions and then you can import this XML-file into the activity feedback.

See this animated gif to find out, how to use this localplugin as an generator and how to use the generated code as questions in feedback activity in moodle.

Expand Down Expand Up @@ -58,6 +60,11 @@ By default only editing teacher can use this generator. If other roles should be

### D: Changelog ###

[[v2.0.5]]

- fixed: delete "ranked" from pluginname and refactored to previous name feedbackchoicegenerator


[[v2.0.4]]

- fixed: add "ranked" to pluginname and refactored to new name feedbackcankedchoicegenerator
Expand All @@ -70,7 +77,7 @@ By default only editing teacher can use this generator. If other roles should be

[[v2.0.3]]

- setting to allow generator on frontpage with courseid=1. Use URL moodleurl/local/feedbackrankedchoicegenerator/index.php?id=1'
- setting to allow generator on frontpage with courseid=1. Use URL moodleurl/local/feedbackchoicegenerator/index.php?id=1'


[[v2.0.2]]
Expand Down Expand Up @@ -107,7 +114,7 @@ unknown
- 02.12.2021 set capability für role editingteacher instead of teacher
- 02.12.2021 check, if user has capability to view report also by checking the capapility
- 02.12.2021 do not prevent capability for student
- 02.12.2021 added missing languagestring feedbackrankedchoicegenerator:view
- 02.12.2021 added missing languagestring feedbackchoicegenerator:view


[[v1.0.1]] beta
Expand All @@ -131,7 +138,7 @@ unknown

The plugin can be also installed by putting the contents of this directory to

{your/moodle/dirroot}/local/feedbackrankedchoicegenerator
{your/moodle/dirroot}/local/feedbackchoicegenerator

Afterwards, log in to your Moodle site as an admin and go to _Site administration >
Notifications_ to complete the installation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator;
namespace local_feedbackchoicegenerator;

use stdClass;
use moodle_database;

use local_feedbackrankedchoicegenerator\Helper;
use local_feedbackrankedchoicegenerator\Manager;
use local_feedbackchoicegenerator\Helper;
use local_feedbackchoicegenerator\Manager;

/**
* @package local_feedbackrankedchoicegenerator
* Class FeedbackrankedChoiceGenerator
* @package local_feedbackchoicegenerator
* Class FeedbackChoiceGenerator
*/
class FeedbackrankedChoiceGenerator
class FeedbackChoiceGenerator
{

/**
Expand All @@ -46,7 +46,7 @@ class FeedbackrankedChoiceGenerator
private $apim;

/**
* FeedbackrankedChoiceGenerator constructor.
* FeedbackChoiceGenerator constructor.
* @param moodle_database $db
* @param int $courseid
* @param moodle_page $page
Expand Down Expand Up @@ -77,10 +77,10 @@ public function get_page(): Page {
*/
public function init() {
global $CFG;
$maxlength = (int)$CFG->local_feedbackrankedchoicegenerator_maxlength;
$maxoptionslength = (int)$CFG->local_feedbackrankedchoicegenerator_maxoptionslength;
$maxlength = (int)$CFG->local_feedbackchoicegenerator_maxlength;
$maxoptionslength = (int)$CFG->local_feedbackchoicegenerator_maxoptionslength;
$optionlabel = '';
$optionlabel = get_string('optionlabel', 'local_feedbackrankedchoicegenerator');
$optionlabel = get_string('optionlabel', 'local_feedbackchoicegenerator');

$this->apim->security()->user_is_allowed_to_view_the_course_and_has_capability_to_use_generator($this->courseid);

Expand Down Expand Up @@ -125,32 +125,32 @@ public function init() {
$wwwroot = $CFG->wwwroot;

echo $this->get_page()->get_output()->render_from_template(
'local_feedbackrankedchoicegenerator/mainpage',
'local_feedbackchoicegenerator/mainpage',
[
'wwwroot' => $wwwroot,
'courseid' => $this->courseid,
'backtocourselabel' => get_string('backtocourselabel', 'local_feedbackrankedchoicegenerator'),
'backtocourselabel' => get_string('backtocourselabel', 'local_feedbackchoicegenerator'),

'title' => $this->get_page()->get_title(),
'header3' => get_string('header3', 'local_feedbackrankedchoicegenerator'),
'summary' => get_string('summary', 'local_feedbackrankedchoicegenerator'),
'header3' => get_string('header3', 'local_feedbackchoicegenerator'),
'summary' => get_string('summary', 'local_feedbackchoicegenerator'),

'courseidlabel' => get_string('courseidlabel', 'local_feedbackrankedchoicegenerator'),
'sizelabel' => get_string('sizelabel', 'local_feedbackrankedchoicegenerator'),
'courseidlabel' => get_string('courseidlabel', 'local_feedbackchoicegenerator'),
'sizelabel' => get_string('sizelabel', 'local_feedbackchoicegenerator'),
'maxlength' => $maxlength,

'optionslengthinfo' => get_string('optionslengthinfo', 'local_feedbackrankedchoicegenerator'),
'description' => get_string('description', 'local_feedbackrankedchoicegenerator'),
'optionslengthinfo' => get_string('optionslengthinfo', 'local_feedbackchoicegenerator'),
'description' => get_string('description', 'local_feedbackchoicegenerator'),

'size' => $size,
'filename' => $filename,
'options' => $options,
'maxoptionslength' => $maxoptionslength,
'textareacontent' => $textareacontent,
'buttonlabel' => get_string('buttonlabel', 'local_feedbackrankedchoicegenerator'),
'downloadbuttonlabel' => get_string('downloadbuttonlabel', 'local_feedbackrankedchoicegenerator'),
'updatebuttonlabel' => get_string('updatebuttonlabel', 'local_feedbackrankedchoicegenerator'),
'resetbuttonlabel' => get_string('resetbuttonlabel', 'local_feedbackrankedchoicegenerator'),
'buttonlabel' => get_string('buttonlabel', 'local_feedbackchoicegenerator'),
'downloadbuttonlabel' => get_string('downloadbuttonlabel', 'local_feedbackchoicegenerator'),
'updatebuttonlabel' => get_string('updatebuttonlabel', 'local_feedbackchoicegenerator'),
'resetbuttonlabel' => get_string('resetbuttonlabel', 'local_feedbackchoicegenerator'),
'dataurl' => $dataurl
]
);
Expand Down
10 changes: 5 additions & 5 deletions classes/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator;
namespace local_feedbackchoicegenerator;
defined('MOODLE_INTERNAL') || die;
use html_writer;

Expand Down Expand Up @@ -111,12 +111,12 @@ public static function generate_selection_overview($level,
$itemnumber,
$firstchoicereferencenumber,
$alloptionstoadd, $option) {
$selectlabel = get_string('selectlabel', 'local_feedbackrankedchoicegenerator');
$selectlabel = get_string('selectlabel', 'local_feedbackchoicegenerator');
if ($level === 1) {
$choicelabel = get_string('firstchoicelabel', 'local_feedbackrankedchoicegenerator');
$choicelabel = get_string('firstchoicelabel', 'local_feedbackchoicegenerator');
$firstchoicereferencenumber = 0;
} else {
$choicelabel = get_string('secondchoicelabel', 'local_feedbackrankedchoicegenerator');;
$choicelabel = get_string('secondchoicelabel', 'local_feedbackchoicegenerator');;
}
$output = "";
$output = $output . html_writer::start_tag('ITEM', array('TYPE' => 'multichoice', 'REQUIRED' => '0')) . "\n";
Expand Down Expand Up @@ -145,7 +145,7 @@ public static function generate_label($itemnumber, $firstchoicereferencenumber,
$output = $output . html_writer::tag('ITEMTEXT', "<![CDATA[]]>") . "\n";
$output = $output . html_writer::tag('ITEMLABEL', "<![CDATA[]]>") . "\n";
$output = $output . html_writer::tag('PRESENTATION',
"<![CDATA[$option " . get_string('firstchoicelabel', 'local_feedbackrankedchoicegenerator') . "]]>") . "\n";
"<![CDATA[$option " . get_string('firstchoicelabel', 'local_feedbackchoicegenerator') . "]]>") . "\n";
$output = $output . html_writer::tag('OPTIONS', "<![CDATA[]]>") . "\n";
$output = $output . html_writer::tag('DEPENDITEM', "<![CDATA[$firstchoicereferencenumber]]>") . "\n";
$output = $output . html_writer::tag('DEPENDVALUE', "<![CDATA[$option]]>") . "\n";
Expand Down
8 changes: 4 additions & 4 deletions classes/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator;
namespace local_feedbackchoicegenerator;
defined('MOODLE_INTERNAL') || die;
use moodle_database;
use local_feedbackrankedchoicegenerator\local\Database\Factory as DatabaseFactory;
use local_feedbackrankedchoicegenerator\Security;
use local_feedbackchoicegenerator\local\Database\Factory as DatabaseFactory;
use local_feedbackchoicegenerator\Security;

defined('MOODLE_INTERNAL') || die();

/**
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* Class manager
*/
class Manager
Expand Down
6 changes: 3 additions & 3 deletions classes/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator;
namespace local_feedbackchoicegenerator;

defined('MOODLE_INTERNAL') || die;
use moodle_url;
Expand All @@ -36,10 +36,10 @@ public function __construct($page, $course, $courseid, $output) {
$this->page = $page;
$this->output = $output;
$this->course = $course;
$this->title = get_string('pluginname', 'local_feedbackrankedchoicegenerator');
$this->title = get_string('pluginname', 'local_feedbackchoicegenerator');

$page->set_context(\context_course::instance($courseid));
$page->set_url(new moodle_url('/local/feedbackrankedchoicegenerator/index.php', ['id' => $courseid]));
$page->set_url(new moodle_url('/local/feedbackchoicegenerator/index.php', ['id' => $courseid]));
$page->set_title($this->get_title());
$page->set_heading($course->fullname);
$page->set_pagelayout('incourse');
Expand Down
6 changes: 3 additions & 3 deletions classes/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator;
namespace local_feedbackchoicegenerator;

defined('MOODLE_INTERNAL') || die;
use coding_exception;
Expand All @@ -25,7 +25,7 @@
use stdClass;

/**
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* Class Security
*/
class Security
Expand Down Expand Up @@ -56,6 +56,6 @@ public function user_is_allowed_to_view_the_course_and_has_capability_to_use_gen
require_login($course);

$coursecontext = context_course::instance($courseid);
require_capability('local/feedbackrankedchoicegenerator:view', $coursecontext);
require_capability('local/feedbackchoicegenerator:view', $coursecontext);
}
}
4 changes: 2 additions & 2 deletions classes/local/Database/DataFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator\local\Database;
namespace local_feedbackchoicegenerator\local\Database;
defined('MOODLE_INTERNAL') || die();
use moodle_database;

/**
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* This class provides high-level functionality for the module. Concepts like
* enumerating files belonging to a specific component are mapped to the
* relevant SQL queries, therefore encapsulating low-level database access inside
Expand Down
4 changes: 2 additions & 2 deletions classes/local/Database/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

namespace local_feedbackrankedchoicegenerator\local\Database;
namespace local_feedbackchoicegenerator\local\Database;
defined('MOODLE_INTERNAL') || die;
use moodle_database;

/**
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* This is a straightfoward implementation of the Factory Pattern. The
* class provides access to objects that are necessary for interaction
* with the Moodle database via a DataFiles abstraction.
Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace local_feedbackrankedchoicegenerator\privacy;
namespace local_feedbackchoicegenerator\privacy;

class provider implements
// This plugin does not store any personal user data.
Expand Down
4 changes: 2 additions & 2 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Plugin capabilities are defined here.
*
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* @category access
* @copyright Andreas Schenkel
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();

$capabilities = [
'local/feedbackrankedchoicegenerator:view' => [
'local/feedbackchoicegenerator:view' => [
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [
Expand Down
12 changes: 6 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
require_once(__DIR__ . '/../../config.php');
require_login();

use local_feedbackrankedchoicegenerator\FeedbackRankedChoiceGenerator;
use local_feedbackchoicegenerator\FeedbackChoiceGenerator;

// Assign global variables to local (parameter) variables.
// At the moment, this approach is used for documentation purposes.
Expand All @@ -25,22 +25,22 @@
$output = $OUTPUT;
$db = $DB;

$feedbackrankedchoicegeneratorinstance = new FeedbackRankedChoiceGenerator($db, $courseid, $page, $output);
$feedbackchoicegeneratorinstance = new FeedbackChoiceGenerator($db, $courseid, $page, $output);

global $CFG;

$isallowedonfrontpage = $CFG->local_feedbackrankedchoicegenerator_isallowedonfrontpage;
$isactive = $CFG->local_feedbackrankedchoicegenerator_isactive;
$isallowedonfrontpage = $CFG->local_feedbackchoicegenerator_isallowedonfrontpage;
$isactive = $CFG->local_feedbackchoicegenerator_isactive;

if ($isactive) {
if ($courseid === (int)'1') {
if ($isallowedonfrontpage) {
$feedbackrankedchoicegeneratorinstance->init();
$feedbackchoicegeneratorinstance->init();
} else {
echo "not supported on frontpage";
}
} else {
$feedbackrankedchoicegeneratorinstance->init();
$feedbackchoicegeneratorinstance->init();
}
} else {
echo "is not activ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Plugin strings are defined here.
*
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* @category string
* @copyright Andreas Schenkel
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -27,14 +27,14 @@

$string['pluginname'] = '1./2. Wahl Feedback-Generator';

$string['feedbackrankedchoicegenerator:view'] = '1./2. Wahl Feedback-Generator anzeigen';
$string['feedbackchoicegenerator:view'] = '1./2. Wahl Feedback-Generator anzeigen';

$string['isactive'] = 'Generator aktivieren';
$string['configisactive'] = 'Wenn aktiviert kann der Generator bei vorhandenen Berechtigungen im der Kursnavigation aufgerufen werden.';

$string['isallowedonfrontpage'] = 'Generator auf Startseite mit Kursid=1 erlauben';
$string['configisallowedonfrontpage'] = 'Wenn aktiviert kann der Generator auf der Startseite aufgerufen werden.
Link wird allerdings nicht angezeigt. URL ist: moodleurl/local/feedbackrankedchoicegenerator/index.php?id=1';
Link wird allerdings nicht angezeigt. URL ist: moodleurl/local/feedbackchoicegenerator/index.php?id=1';

$string['maxoptionslength'] = 'Max. Länge der Optionen';
$string['configmaxoptionslength'] = 'Bis zu dieser Länge kann der Text einer Option eingegeben werden.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Plugin strings are defined here.
*
* @package local_feedbackrankedchoicegenerator
* @package local_feedbackchoicegenerator
* @category string
* @copyright Andreas Schenkel
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -27,7 +27,7 @@

$string['pluginname'] = '1./2. ranked-choise-generator for feedback';

$string['feedbackrankedchoicegenerator:view'] = 'see 1./2-ranked-choice-generator for feedback';
$string['feedbackchoicegenerator:view'] = 'see 1./2-ranked-choice-generator for feedback';

$string['isactive'] = 'Activate generator';
$string['configisactive'] = 'When activated, the generator can be started in the navigation drawer of the course.';
Expand Down
Loading

0 comments on commit 74dcd0e

Please sign in to comment.