Skip to content

Commit

Permalink
Merge pull request #761 from dpalou/ionic7
Browse files Browse the repository at this point in the history
Adapt mobile code to ionic 7
  • Loading branch information
danmarsden authored Jul 22, 2024
2 parents 01e20ad + 8f88779 commit 2671efb
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 197 deletions.
7 changes: 3 additions & 4 deletions classes/output/mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public static function mobile_view_activity($args) {

require_once($CFG->dirroot.'/mod/attendance/locallib.php');

$versionname = $args['appversioncode'] >= 3950 ? 'latest' : 'ionic3';
$cmid = $args['cmid'];
$courseid = $args['courseid'];
$takenstatus = empty($args['status']) ? '' : $args['status'];
Expand Down Expand Up @@ -252,7 +251,7 @@ public static function mobile_view_activity($args) {
'templates' => [
[
'id' => 'main',
'html' => $OUTPUT->render_from_template("mod_attendance/mobile_view_page_$versionname", $data),
'html' => $OUTPUT->render_from_template("mod_attendance/mobile_view_page_latest", $data),
],
],
'javascript' => '',
Expand All @@ -272,7 +271,7 @@ public static function mobile_user_form($args) {
require_once($CFG->dirroot.'/mod/attendance/locallib.php');

$args = (object) $args;
$versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3';
$versionname = $args->appversioncode >= 44000 ? 'latest' : 'ionic5';
$cmid = $args->cmid;
$courseid = $args->courseid;
$sessid = $args->sessid;
Expand Down Expand Up @@ -374,7 +373,7 @@ public static function mobile_teacher_form($args) {
require_once($CFG->dirroot.'/mod/attendance/locallib.php');

$args = (object) $args;
$versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3';
$versionname = $args->appversioncode >= 44000 ? 'latest' : 'ionic5';
$cmid = $args->cmid;
$courseid = $args->courseid;
$sessid = $args->sessid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,53 @@
<%#showmessage%>
<%#messages%>
<span class="messages">
<ion-item>
{{ 'plugin.mod_attendance.<% string %>' | translate }}
<ion-item class="ion-text-wrap">
<ion-label>{{ 'plugin.mod_attendance.<% string %>' | translate }}</ion-label>
</ion-item>
</span>
<%/messages%>
<%/showmessage%>
<span class="attendance_selectall">
<ion-item>
{{ 'plugin.mod_attendance.setallstatuses' | translate }}
</ion-item>
<ion-list radio-group [(ngModel)]="CONTENT_OTHERDATA.statusall" (ionChange)="<% selectall %>">
<ion-item class="ion-text-wrap">
<ion-label>{{ 'plugin.mod_attendance.setallstatuses' | translate }}</ion-label>
</ion-item>
<ion-radio-group [(ngModel)]="CONTENT_OTHERDATA.statusall" (ionChange)="<% selectall %>">
<%#statuses%>

<span class="radiolabel">
<ion-item>
<span class="radiolabel">
<ion-item class="ion-text-wrap">
<ion-label><% acronym %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
</ion-item>
</span>
<%/statuses%>
</ion-list>
</ion-radio-group>
</span>
<%#users%>
<span class="attendance_user_row">
<!-- User and status of the submission. -->
<span ion-item text-wrap title="<% fullname %>">
<ion-avatar item-start>
<ion-item class="ion-text-wrap" title="<% fullname %>">
<ion-avatar slot="start">
<img src="<% profileimageurl %>" core-external-content role="presentation" onError="this.src='assets/img/user-avatar.png'">
</ion-avatar>
<h2><% fullname %></h2>
</span>
<ion-list radio-group [(ngModel)]="CONTENT_OTHERDATA.status<% userid %>">
<ion-label>
<h2><% fullname %></h2>
</ion-label>
</ion-item>
<ion-radio-group [(ngModel)]="CONTENT_OTHERDATA.status<% userid %>">
<%#statuses%>
<span class="radiolabel">
<ion-item>
<ion-label><% acronym %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
</ion-item>
</span>
<ion-item class="ion-text-wrap">
<ion-label><% acronym %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
</ion-item>
</span>
<%/statuses%>
</ion-list>
</ion-radio-group>
</span>
<%/users%>
<ion-item>
<button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %><% btnargs %>}">
{{ 'plugin.mod_attendance.submitattendance' | translate }}
</button>
</ion-item>
<ion-button class="ion-margin" expand="block" core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %><% btnargs %>}">
{{ 'plugin.mod_attendance.submitattendance' | translate }}
</ion-button>

</div>
18 changes: 12 additions & 6 deletions templates/mobile_teacher_form_latest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@
}}
{{=<% %>=}}
<div class="attendance_mobile_teacher_form">
<%#attendance.intro%>
<span class="description">
<core-course-module-description description="<% attendance.intro %>" component="mod_attendance" componentId="<% cmid %>"></core-course-module-description>
<ion-card>
<ion-item class="ion-text-wrap">
<ion-label>
<core-format-text text="<%attendance.intro%>" component="mod_attendance" componentId="<%cmid%>" collapsible-item />
</ion-label>
</ion-item>
</ion-card>
</span>
<%/attendance.intro%>
<%#showmessage%>
<%#messages%>
<span class="messages">
Expand All @@ -67,8 +75,7 @@

<span class="radiolabel">
<ion-item class="ion-text-wrap">
<ion-label><% acronym %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
<ion-radio value="<% stid %>"><% acronym %></ion-radio>
</ion-item>
</span>
<%/statuses%>
Expand All @@ -89,8 +96,7 @@
<%#statuses%>
<span class="radiolabel">
<ion-item class="ion-text-wrap">
<ion-label><% acronym %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
<ion-radio value="<% stid %>"><% acronym %></ion-radio>
</ion-item>
</span>
<%/statuses%>
Expand All @@ -101,4 +107,4 @@
{{ 'plugin.mod_attendance.submitattendance' | translate }}
</ion-button>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,34 @@
<%#showmessage%>
<%#messages%>
<span class="messages">
<ion-item>
{{ 'plugin.mod_attendance.<% string %>' | translate }}
<ion-item class="ion-text-wrap">
<ion-label>{{ 'plugin.mod_attendance.<% string %>' | translate }}</ion-label>
</ion-item>
</span>
<%/messages%>
<%/showmessage%>
<%#showpassword%>
<ion-list [(ngModel)]="studentpass">
<ion-item>
<ion-label>{{ 'plugin.mod_attendance.enterpassword' | translate }}:</ion-label>
<ion-input type="text" name="studentpass"></ion-input>
<ion-input type="text" name="studentpass" [(ngModel)]="studentpass"></ion-input>
</ion-item>
</ion-list>
<%/showpassword%>
<%#showstatuses%>
<ion-list radio-group [(ngModel)]="status">
<ion-radio-group [(ngModel)]="status" name="status">
<%#statuses%>
<ion-item>
<ion-item class="ion-text-wrap">
<ion-label><% description %></ion-label>
<ion-radio value="<% stid %>"></ion-radio>
<ion-radio slot="end" value="<% stid %>"></ion-radio>
</ion-item>
<%/statuses%>
</ion-list>
<button ion-button core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %>, status: status, studentpass: studentpass}">
</ion-radio-group>
<ion-button class="ion-margin" expand="block" core-site-plugins-new-content component="mod_attendance" method="mobile_view_activity" [args]="{cmid: <% cmid %>, courseid: <% courseid %>, sessid: <% sessid %>, status: status, studentpass: studentpass}">
{{ 'plugin.mod_attendance.submitattendance' | translate }}
</button>
</ion-button>
<%/showstatuses%>
<%#disabledduetotime%>
{{ 'plugin.mod_attendance.somedisabledstatus' | translate }}
<ion-item>
<ion-label>{{ 'plugin.mod_attendance.somedisabledstatus' | translate }}</ion-label>
</ion-item>
<%/disabledduetotime%>
</div>
15 changes: 11 additions & 4 deletions templates/mobile_user_form_latest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
}}
{{=<% %>=}}
<div class="attendance_mobile_user_form">
<core-course-module-description description="<% attendance.intro %>" component="mod_attendance" componentId="<% cmid %>"></core-course-module-description>
<%#attendance.intro%>
<ion-card>
<ion-item class="ion-text-wrap">
<ion-label>
<core-format-text text="<%attendance.intro%>" component="mod_attendance" componentId="<%cmid%>" collapsible-item />
</ion-label>
</ion-item>
</ion-card>
<%/attendance.intro%>
<%#showmessage%>
<%#messages%>
<span class="messages">
Expand All @@ -65,8 +73,7 @@
<ion-radio-group [(ngModel)]="status" name="status">
<%#statuses%>
<ion-item class="ion-text-wrap">
<ion-label><% description %></ion-label>
<ion-radio slot="end" value="<% stid %>"></ion-radio>
<ion-radio value="<% stid %>"><% description %></ion-radio>
</ion-item>
<%/statuses%>
</ion-radio-group>
Expand All @@ -79,4 +86,4 @@
<ion-label>{{ 'plugin.mod_attendance.somedisabledstatus' | translate }}</ion-label>
</ion-item>
<%/disabledduetotime%>
</div>
</div>
144 changes: 0 additions & 144 deletions templates/mobile_view_page_ionic3.mustache

This file was deleted.

Loading

0 comments on commit 2671efb

Please sign in to comment.