Skip to content

Commit

Permalink
Merge pull request #7 from andreasschenkel/develop
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
andreasschenkel authored Dec 31, 2021
2 parents 997a7d6 + 202aff7 commit e30d677
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 73 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Plugin that helps to generate an xml-file to import into activity feedback to su

## Changelog ##

[[v2.0.1]]

- 31.12.2021 css and layout improvements, add link back to the course, bug with activating generator in settings-page of the plugin

[[v2.0.0]]

- 12.12.2021 to support moodle styleguide use code checker to find codebeautyfing issues
Expand Down
7 changes: 4 additions & 3 deletions classes/View/FeedbackChoiceGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public function init() {
$size = 3;
}



if ($size > $maxlength) {
$size = $maxlength;
}
Expand Down Expand Up @@ -125,6 +123,8 @@ public function init() {
'local_feedbackchoicegenerator/mainpage',
[
'courseid' => $this->courseid,
'backtocourselabel' => get_string('backtocourselabel', 'local_feedbackchoicegenerator'),

'title' => $this->get_page()->get_title(),
'header3' => get_string('header3', 'local_feedbackchoicegenerator'),
'summary' => get_string('summary', 'local_feedbackchoicegenerator'),
Expand All @@ -133,7 +133,7 @@ public function init() {
'sizelabel' => get_string('sizelabel', 'local_feedbackchoicegenerator'),
'maxlength' => $maxlength,

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

'size' => $size,
Expand All @@ -143,6 +143,7 @@ public function init() {
'textareacontent' => $textareacontent,
'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
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
$feedbackchoicegeneratorinstance = new FeedbackChoiceGenerator($db, $courseid, $page, $output);

global $CFG;
$isactive = true;
// $isactive = $CFG->local_feedbackchoicegenerator_isactive;

$isactive = $CFG->local_feedbackchoicegenerator_isactive;
if ($isactive) {
$feedbackchoicegeneratorinstance->init();
} else {
Expand Down
10 changes: 6 additions & 4 deletions lang/de/local_feedbackchoicegenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@
$string['summary'] = 'Ein Generator für die Aktivität Feedback, um eine 1. und 2. Wahl umzusetzen.';

$string['courseidlabel'] = 'Kursid';
$string['backtocourselabel'] = 'zurück zum Kurs';
$string['sizelabel'] = 'Anzahl der Optionen';

$string['optionsheader'] = 'Eingabebereich der Optionen:';
$string['optionslengthinfo'] = 'max. Zeichenanzahl je Option:';

$string['description'] = 'Den hier erzeugten xml-Code mit Hilfe des Download-Buttons herunterladen (rechte Maustaste nutzen und Speichern unter wählen).
$string['description'] = 'Den hier erzeugten xml-Code mit Hilfe des Download-Links herunterladen (rechte Maustaste "Ziel speichern unter..." nutzen).
Alternativ den xml-Code in einer Textdatei kopieren und mit der Endung .xml speichern.';

$string['buttonlabel'] = 'XML erzeugen oder aktualisieren';
$string['downloadbuttonlabel'] = 'Download (rechte Maustaste speichern und unter)';
$string['buttonlabel'] = 'XML erzeugen';
$string['updatebuttonlabel'] = 'aktualisieren';
$string['downloadbuttonlabel'] = 'XML-Download (rechte Maustaste "Ziel speichern unter...")';
$string['resetbuttonlabel'] = 'Eingaben zurücksetzen';

$string['selectlabel'] = 'auswählen';
10 changes: 6 additions & 4 deletions lang/en/local_feedbackchoicegenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
$string['summary'] = 'Generating import-file for activity feedback';

$string['courseidlabel'] = 'course id';
$string['backtocourselabel'] = 'Back to the course';
$string['sizelabel'] = 'How many options';

$string['optionsheader'] = 'Enter options';
$string['optionslengthinfo'] = 'Max. inputlength for each option:';

$string['description'] = 'Download the generated code or put the generated xml-Code in to a textfile with the extension .xml.';
$string['description'] = 'Download the generated code "Save link as ..." or put the generated xml-Code in to a textfile with the extension .xml.';

$string['buttonlabel'] = 'generate XML or update';
$string['downloadbuttonlabel'] = 'download with right click and save';
$string['buttonlabel'] = 'generate XML';
$string['updatebuttonlabel'] = 'update';
$string['downloadbuttonlabel'] = 'download with right click and "save link as..."';
$string['resetbuttonlabel'] = 'reset';

$string['selectlabel'] = 'select';
48 changes: 26 additions & 22 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,36 @@
*/
function local_feedbackchoicegenerator_extend_navigation_course($navigation, $course, $context) {
global $CFG;
$page = $GLOBALS['PAGE'];
$url = new moodle_url('/local/feedbackchoicegenerator/index.php', array('id' => $course->id));
$isactive = false;
$isactive = $CFG->local_feedbackchoicegenerator_isactive;
if ($isactive) {
$page = $GLOBALS['PAGE'];
$url = new moodle_url('/local/feedbackchoicegenerator/index.php', array('id' => $course->id));

$feedbackchoicegeneratornode = $page->navigation->find($course->id, navigation_node::TYPE_COURSE);
$feedbackchoicegeneratornode = $page->navigation->find($course->id, navigation_node::TYPE_COURSE);

$collection = $feedbackchoicegeneratornode->children;
$collection = $feedbackchoicegeneratornode->children;

foreach ($collection->getIterator() as $child) {
$key = $child->key;
// position of node before this note
if ($key === 'participants') {
break;
foreach ($collection->getIterator() as $child) {
$key = $child->key;
// position of node before this note
if ($key === 'participants') {
break;
}
}
}

$node = $feedbackchoicegeneratornode->create(get_string('pluginname', 'local_feedbackchoicegenerator'),
$url, navigation_node::NODETYPE_LEAF, null, 'feedbackchoicegenerator', new pix_icon('i/report', 'grades'));
$feedbackchoicegeneratornode->add_node($node, $key);

$navigation->add(
get_string('pluginname', 'local_feedbackchoicegenerator'),
$url,
navigation_node::TYPE_SETTING,
null,
null,
new pix_icon('i/report', '')
);
$node = $feedbackchoicegeneratornode->create(get_string('pluginname', 'local_feedbackchoicegenerator'),
$url, navigation_node::NODETYPE_LEAF, null, 'feedbackchoicegenerator', new pix_icon('i/report', 'grades'));
$feedbackchoicegeneratornode->add_node($node, $key);

$navigation->add(
get_string('pluginname', 'local_feedbackchoicegenerator'),
$url,
navigation_node::TYPE_SETTING,
null,
null,
new pix_icon('i/report', '')
);
}

}
15 changes: 13 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
.feedbackchoicegenerator h3 {
#feedbackchoicegenerator {
background-color: rgb(223, 242, 247);
padding: 10px;
}
}

#feedbackchoicegenerator h3 {
padding: 10px;
background-color: rgb(35, 65, 163);
color: #fff;
}

#feedbackchoicegenerator .row {
margin-left: 0px;
}
84 changes: 49 additions & 35 deletions templates/mainpage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,54 @@
}}

<?php session_start(); ?>
<a href="/course/view.php?id={{courseid}}">{{backtocourselabel}}</a>
<div id='feedbackchoicegenerator'>
<h3>{{header3}}</h3>
<div class="summary">
{{summary}}
</div>
<div class="optionslengthinfo">
{{optionslengthinfo}} {{maxoptionslength}}
</div>




<form action="index.php?id={{courseid}}" method="post">
<input name='courseid' type='hidden' value='{{courseid}}' disabled>

<div class="row mb-2">
<div class="col">
{{sizelabel}} (max. {{maxlength}}):&nbsp;
<input name='size' type='number' value='{{size}}' max='{{maxlength}}' size='5'>
<button id='update_feedbackchoicegenerator' class='btn btn-primary' type='submit'>{{updatebuttonlabel}}</button>
</div>
</div>

<div class="row mb-2">
<div class="col">
{{#options}}
{{{optionlabel}}}:&nbsp;<input name='{{{optionname}}}' value='{{{optionvalue}}}' maxlength='{{maxoptionslength}}'><br>
{{/options}}
</div>
</div>
<div class="row mb-2">
<div class="col">
<button id='input_feedbackchoicegenerator' class='btn btn-primary' type='submit'>{{buttonlabel}}</button>

<a class='btn btn-danger' href='index.php?id={{courseid}}'>{{resetbuttonlabel}}</a><br>
<a class='download_feedbackchoicegenerator' href='{{dataurl}}' type='application/xml'>{{downloadbuttonlabel}}</a>
</div>
</div>

</form>

<div class="row mb-2">
{{description}}
</div>

<textarea id="textarea_feedbackchoicegenerator" name="textarea_feedbackchoicegenerator" rows="20" cols="100" readonly >
{{textareacontent}}
</textarea>

<h3>{{header3}}</h3>
<div class="form-row mb-2">
{{summary}}
</div>

<form action="index.php?id={{courseid}}" method="post">
<input name='courseid' type='hidden' value='{{courseid}}' disabled>

<div class="form-row mb-2">
<b>{{optionsheader}} (maxoptionslength {{maxoptionslength}})</b><br>
</div>

<div class="form-row mb-2">
{{sizelabel}}:&nbsp;<input name='size' type='number' value='{{size}}' max='{{maxlength}}' size='5'> (max. {{maxlength}})
</div>

{{#options}}
{{{optionlabel}}}:&nbsp;<input name='{{{optionname}}}' value='{{{optionvalue}}}' maxlength='{{maxoptionslength}}'><br>
{{/options}}

<br>
<div class="form-row mb-2">
<button id='input_feedbackchoicegenerator' class='btn btn-primary' type='submit'>{{buttonlabel}}</button>
<a class='btn btn-warning' href='{{dataurl}}' type='application/xml'>{{downloadbuttonlabel}}</a>
<a class='btn btn-danger' href='index.php?id={{courseid}}'>{{resetbuttonlabel}}</a>
</div>

</form>

<div class="form-row mb-2">
{{description}}
</div>

<textarea id="textarea_feedbackchoicegenerator" name="textarea_feedbackchoicegenerator" rows="20" cols="100" readonly >
{{textareacontent}}
</textarea>
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
$plugin->version = 2021121301;
$plugin->component = 'local_feedbackchoicegenerator';
$plugin->requires = 2017111300;
$plugin->release = 'v0.0.1';
$plugin->release = 'v2.0.1';

0 comments on commit e30d677

Please sign in to comment.