Skip to content

Commit

Permalink
Merge pull request #80 from Wunderbyte-GmbH/feature_subscription
Browse files Browse the repository at this point in the history
Feature subscription
  • Loading branch information
cbadusch authored Mar 21, 2024
2 parents 044b743 + 03256ed commit 49a0445
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 5 deletions.
9 changes: 7 additions & 2 deletions classes/mooduell.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ public function display_page(bool $inline = null, string $pagename = null, $game
switch ($pagename) {
case null:
// Create the list of open games we can pass on to the renderer.
$qrcode = new qr_code();
$qrcodeimage = $qrcode->generate_qr_code();
$data['qrimage'] = $qrcodeimage;
$data['opengames'] = [];
$data['finishedgames'] = [];
$data['warnings'] = $this->check_quiz();
Expand Down Expand Up @@ -453,7 +456,6 @@ public static function update_all_subscriptions() {
$udpatedentry = $returnitem;
$udpatedentry->validuntil = time() + (60 * 60 * 24);
$DB->update_record('mooduell_purchase', $udpatedentry);
return;
} else if ($singleproduct->isExpired === true) {
// Delete Cancel etc.
$udpatedentry = $returnitem;
Expand All @@ -469,8 +471,11 @@ public static function update_all_subscriptions() {
$udpatedentry = $returnitem;
$udpatedentry->productid = 'notvalid';
$DB->update_record('mooduell_purchase', $udpatedentry);
} else {
$udpatedentry = $returnitem;
$udpatedentry->validuntil = time() + (60 * 60 * 24);
$DB->update_record('mooduell_purchase', $udpatedentry);
}
return;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions classes/output/overview_teacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
namespace mod_mooduell\output;

use mod_mooduell\mooduell;
use mod_mooduell\qr_code;
use mod_mooduell\tables\table_games;
use mod_mooduell\tables\table_highscores;
use mod_mooduell\tables\table_questions;
Expand Down Expand Up @@ -56,6 +57,13 @@ class overview_teacher implements renderable, templatable {
public function __construct(mooduell $mooduell = null) {

$data = [];
$qrcode = new qr_code();
$qrcodeimage = $qrcode->generate_qr_code();
// Create the list of open games we can pass on to the renderer.
$data['qrimage'] = $qrcodeimage;

$data['appstorelink'] = get_config('mooduell', 'appstoreurl');
$data['playstorelink'] = get_config('mooduell', 'playstoreurl');

$data['opengames'] = $this->render_open_games_table($mooduell);
$data['finishedgames'] = $this->render_finished_games_table($mooduell);
Expand Down
4 changes: 2 additions & 2 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@
'mooduell/appstoreurl',
get_string('appstoreurl', 'mod_mooduell'),
'',
'https://apps.apple.com/kw/app/u-mooduell/id1596475094',
'https://apps.apple.com/at/app/mooduell/id1598911543',
PARAM_URL
));

$settings->add(new admin_setting_configtext(
'mooduell/playstoreurl',
get_string('playstoreurl', 'mod_mooduell'),
'',
'https://play.google.com/store/apps/details?id=at.ac.univie.uwmooduell',
'https://play.google.com/store/apps/details?id=at.wunderbyte.mooduellapp',
PARAM_URL
));

Expand Down
65 changes: 65 additions & 0 deletions templates/overview_teachers.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,71 @@
{{/warnings}}
</ul>

{{#statistics}}
{{#str}} downloaduniviemoduell, mod_mooduell {{/str}}
<br>
<br>
<div class="container-fluid">
<div class="row">
<div class="col-md">
<div class="row">
{{#appstorelink}}
<div class="col-md">
{{#str}} univiemooduellappstore, mod_mooduell {{/str}}
</div>
<div class="col-md" style="display: flex; justify-content:center; align-items: center;">
<a href='{{appstorelink}}'><img style="width: 140px; max-width: 100%" alt='Download from Apple App Store' src='https://developer.apple.com/app-store/marketing/guidelines/images/badge-download-on-the-app-store.svg'/></a>
</div>
{{/appstorelink}}
</div>
<div class="row">
{{#playstorelink}}
<div class="col-md">
{{#str}} univiemooduellplaystore, mod_mooduell {{/str}}
</div>
<div class="col-md" style="display: flex; justify-content:center; align-items: center;">
<a href='{{playstorelink}}'><img style="width: 160px; max-width: 100%" alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png'/></a>
</div>
{{/playstorelink}}
</div>
</div>
<div class="col-md" style="display: flex; justify-content:center; align-items: center; margin-bottom: 10px">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
{{#str}} showqr, mod_mooduell {{/str}}
</button>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">QR Code Login</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="col-md">
<h4>{{#str}} qrtitle, mod_mooduell {{/str}}</h4>
<p>{{#str}} qrdesc, mod_mooduell {{/str}}</p>
<p>{{#str}} qrshare, mod_mooduell {{/str}}</p>
</div>
{{#qrimage}}
<div class="col-md" style="text-align: center">
<img style="width:200px" src="{{qrimage}}" />
</div>
{{/qrimage}}
</div>
<div class="modal-footer qrcode">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{#str}} close, mod_mooduell {{/str}}</button>
</div>
</div>
</div>
</div>
</div>
{{/statistics}}

<ul class="nav nav-tabs" id="mooduellTab" role="tablist">
<li class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/mooduell_interface.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Feature: See user stats
And I should see "Username 2"
And I click on "td.columnclass.action a" "css_element"
And I should see "No image"
And I click on "div.modal-footer button" "css_element"
And I click on ".wunderbyte-table-table div.modal-footer button" "css_element"
And I follow "Finished games"
And I follow "Highscores"

Expand Down

0 comments on commit 49a0445

Please sign in to comment.