commit
56bbcd7edf
|
@ -13,11 +13,13 @@
|
||||||
"addon.block_myoverview.all": "block_myoverview",
|
"addon.block_myoverview.all": "block_myoverview",
|
||||||
"addon.block_myoverview.future": "block_myoverview",
|
"addon.block_myoverview.future": "block_myoverview",
|
||||||
"addon.block_myoverview.inprogress": "block_myoverview",
|
"addon.block_myoverview.inprogress": "block_myoverview",
|
||||||
|
"addon.block_myoverview.lastaccessed": "block_myoverview",
|
||||||
"addon.block_myoverview.morecourses": "block_myoverview",
|
"addon.block_myoverview.morecourses": "block_myoverview",
|
||||||
"addon.block_myoverview.nocoursesfuture": "block_myoverview",
|
"addon.block_myoverview.nocoursesfuture": "block_myoverview",
|
||||||
"addon.block_myoverview.nocoursesinprogress": "block_myoverview",
|
"addon.block_myoverview.nocoursesinprogress": "block_myoverview",
|
||||||
"addon.block_myoverview.nocoursespast": "block_myoverview",
|
"addon.block_myoverview.nocoursespast": "block_myoverview",
|
||||||
"addon.block_myoverview.past": "block_myoverview",
|
"addon.block_myoverview.past": "block_myoverview",
|
||||||
|
"addon.block_myoverview.title": "block_myoverview",
|
||||||
"addon.block_timeline.duedate": "block_timeline",
|
"addon.block_timeline.duedate": "block_timeline",
|
||||||
"addon.block_timeline.next30days": "block_timeline",
|
"addon.block_timeline.next30days": "block_timeline",
|
||||||
"addon.block_timeline.next3months": "block_timeline",
|
"addon.block_timeline.next3months": "block_timeline",
|
||||||
|
|
|
@ -6,22 +6,31 @@
|
||||||
</core-navbar-buttons>
|
</core-navbar-buttons>
|
||||||
|
|
||||||
<core-loading [hideUntil]="loaded" class="core-loading-center">
|
<core-loading [hideUntil]="loaded" class="core-loading-center">
|
||||||
|
<div padding ion-row justify-content-end [hidden]="showFilter">
|
||||||
<!-- "Time" selector. -->
|
<!-- "Time" selector. -->
|
||||||
<div padding class="clearfix" [hidden]="showFilter" ion-row justify-content-end>
|
<ion-col [hidden]="!showSelectorFilter">
|
||||||
<ion-select [hidden]="!showSelectorFilter" [title]="'core.show' | translate" [(ngModel)]="selectedFilter" ion-col (ngModelChange)="selectedChanged()" interface="popover" class="core-button-select">
|
<ion-select text-start [title]="'core.show' | translate" [(ngModel)]="selectedFilter" ion-col (ngModelChange)="selectedChanged()" interface="popover" class="core-button-select">
|
||||||
<ion-option value="all">{{ 'addon.block_myoverview.all' | translate }}</ion-option>∫
|
<ion-option value="all">{{ 'addon.block_myoverview.all' | translate }}</ion-option>∫
|
||||||
<ion-option value="inprogress">{{ 'addon.block_myoverview.inprogress' | translate }}</ion-option>
|
<ion-option value="inprogress">{{ 'addon.block_myoverview.inprogress' | translate }}</ion-option>
|
||||||
<ion-option value="future">{{ 'addon.block_myoverview.future' | translate }}</ion-option>
|
<ion-option value="future">{{ 'addon.block_myoverview.future' | translate }}</ion-option>
|
||||||
<ion-option value="past">{{ 'addon.block_myoverview.past' | translate }}</ion-option>
|
<ion-option value="past">{{ 'addon.block_myoverview.past' | translate }}</ion-option>
|
||||||
</ion-select>
|
</ion-select>
|
||||||
|
</ion-col>
|
||||||
|
<!-- "Sort" selector. -->
|
||||||
|
<ion-col [hidden]="!showSortFilter">
|
||||||
|
<ion-select text-start [(ngModel)]="sort" (ngModelChange)="switchSort()" interface="popover" class="core-button-select">
|
||||||
|
<ion-option value="title">{{ 'addon.block_myoverview.title' | translate }}</ion-option>
|
||||||
|
<ion-option value="lastaccess">{{ 'addon.block_myoverview.lastaccessed' | translate }}</ion-option>
|
||||||
|
</ion-select>
|
||||||
|
</ion-col>
|
||||||
<!-- Download all courses. -->
|
<!-- Download all courses. -->
|
||||||
<div *ngIf="downloadAllCoursesEnabled && courses[selectedFilter] && courses[selectedFilter].length > 1" class="core-button-spinner" ion-col text-end col-1>
|
<ion-col *ngIf="downloadAllCoursesEnabled && courses[selectedFilter] && courses[selectedFilter].length > 1" class="core-button-spinner" text-end col-1>
|
||||||
<button *ngIf="prefetchCoursesData[selectedFilter].icon && prefetchCoursesData[selectedFilter].icon != 'spinner'" ion-button icon-only clear color="dark" (click)="prefetchCourses()">
|
<button *ngIf="prefetchCoursesData[selectedFilter].icon && prefetchCoursesData[selectedFilter].icon != 'spinner'" ion-button icon-only clear color="dark" (click)="prefetchCourses()">
|
||||||
<core-icon [name]="prefetchCoursesData[selectedFilter].icon"></core-icon>
|
<core-icon [name]="prefetchCoursesData[selectedFilter].icon"></core-icon>
|
||||||
</button>
|
</button>
|
||||||
<ion-badge class="core-course-download-courses-progress" *ngIf="prefetchCoursesData[selectedFilter].badge">{{prefetchCoursesData[selectedFilter].badge}}</ion-badge>
|
<ion-badge class="core-course-download-courses-progress" *ngIf="prefetchCoursesData[selectedFilter].badge">{{prefetchCoursesData[selectedFilter].badge}}</ion-badge>
|
||||||
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
<ion-spinner *ngIf="!prefetchCoursesData[selectedFilter].icon || prefetchCoursesData[selectedFilter].icon == 'spinner'"></ion-spinner>
|
||||||
</div>
|
</ion-col>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="courses[selectedFilter].length == 0">
|
<ng-container *ngIf="courses[selectedFilter].length == 0">
|
||||||
<core-empty-box *ngIf="selectedFilter == 'inprogress'" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocoursesinprogress' | translate"></core-empty-box>
|
<core-empty-box *ngIf="selectedFilter == 'inprogress'" image="assets/img/icons/courses.svg" [message]="'addon.block_myoverview.nocoursesinprogress' | translate"></core-empty-box>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { Searchbar } from 'ionic-angular';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { CoreEventsProvider } from '@providers/events';
|
import { CoreEventsProvider } from '@providers/events';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
||||||
import { CoreCoursesHelperProvider } from '@core/courses/providers/helper';
|
import { CoreCoursesHelperProvider } from '@core/courses/providers/helper';
|
||||||
import { CoreCourseHelperProvider } from '@core/course/providers/helper';
|
import { CoreCourseHelperProvider } from '@core/course/providers/helper';
|
||||||
|
@ -42,6 +43,8 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
future: []
|
future: []
|
||||||
};
|
};
|
||||||
selectedFilter = 'inprogress';
|
selectedFilter = 'inprogress';
|
||||||
|
sort = 'title';
|
||||||
|
currentSite: any;
|
||||||
downloadAllCoursesEnabled: boolean;
|
downloadAllCoursesEnabled: boolean;
|
||||||
filteredCourses: any[];
|
filteredCourses: any[];
|
||||||
prefetchCoursesData = {
|
prefetchCoursesData = {
|
||||||
|
@ -52,6 +55,7 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
};
|
};
|
||||||
showFilter = false;
|
showFilter = false;
|
||||||
showSelectorFilter = false;
|
showSelectorFilter = false;
|
||||||
|
showSortFilter = false;
|
||||||
|
|
||||||
protected prefetchIconsInitialized = false;
|
protected prefetchIconsInitialized = false;
|
||||||
protected isDestroyed;
|
protected isDestroyed;
|
||||||
|
@ -62,7 +66,8 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
constructor(injector: Injector, private coursesProvider: CoreCoursesProvider,
|
constructor(injector: Injector, private coursesProvider: CoreCoursesProvider,
|
||||||
private courseCompletionProvider: AddonCourseCompletionProvider, private eventsProvider: CoreEventsProvider,
|
private courseCompletionProvider: AddonCourseCompletionProvider, private eventsProvider: CoreEventsProvider,
|
||||||
private courseHelper: CoreCourseHelperProvider, private utils: CoreUtilsProvider,
|
private courseHelper: CoreCourseHelperProvider, private utils: CoreUtilsProvider,
|
||||||
private courseOptionsDelegate: CoreCourseOptionsDelegate, private coursesHelper: CoreCoursesHelperProvider) {
|
private courseOptionsDelegate: CoreCourseOptionsDelegate, private coursesHelper: CoreCoursesHelperProvider,
|
||||||
|
private sitesProvider: CoreSitesProvider) {
|
||||||
|
|
||||||
super(injector, 'AddonBlockMyOverviewComponent');
|
super(injector, 'AddonBlockMyOverviewComponent');
|
||||||
}
|
}
|
||||||
|
@ -85,7 +90,19 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.currentSite = this.sitesProvider.getCurrentSite();
|
||||||
|
|
||||||
|
const promises = [];
|
||||||
|
promises.push(this.currentSite.getLocalSiteConfig('AddonBlockMyOverviewSort', this.sort).then((value) => {
|
||||||
|
this.sort = value;
|
||||||
|
}));
|
||||||
|
promises.push(this.currentSite.getLocalSiteConfig('AddonBlockMyOverviewFilter', this.selectedFilter).then((value) => {
|
||||||
|
this.selectedFilter = value;
|
||||||
|
}));
|
||||||
|
|
||||||
|
Promise.all(promises).finally(() => {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,29 +156,18 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}).then((courses) => {
|
}).then((courses) => {
|
||||||
const today = moment().unix();
|
this.showSortFilter = courses.length > 0 && typeof courses[0].lastaccess != 'undefined';
|
||||||
|
|
||||||
this.courses.all = courses;
|
this.sortCourses(courses);
|
||||||
this.courses.past = [];
|
|
||||||
this.courses.inprogress = [];
|
|
||||||
this.courses.future = [];
|
|
||||||
|
|
||||||
courses.forEach((course) => {
|
|
||||||
if ((course.enddate && course.enddate < today) || course.completed) {
|
|
||||||
// Courses that have already ended.
|
|
||||||
this.courses.past.push(course);
|
|
||||||
} else if (course.startdate > today) {
|
|
||||||
// Courses that have not started yet.
|
|
||||||
this.courses.future.push(course);
|
|
||||||
} else {
|
|
||||||
// Courses still in progress.
|
|
||||||
this.courses.inprogress.push(course);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.courses.filter = '';
|
this.courses.filter = '';
|
||||||
this.showFilter = false;
|
this.showFilter = false;
|
||||||
this.showSelectorFilter = (this.courses.past.length + this.courses.future.length) > 0;
|
this.showSelectorFilter = this.courses.past.length > 0 || this.courses.future.length > 0 || (courses.length > 0 &&
|
||||||
|
typeof courses[0].enddate != 'undefined');
|
||||||
|
if (!this.showSelectorFilter) {
|
||||||
|
// No selector, show all.
|
||||||
|
this.selectedFilter = 'all';
|
||||||
|
}
|
||||||
this.filteredCourses = this.courses[this.selectedFilter];
|
this.filteredCourses = this.courses[this.selectedFilter];
|
||||||
|
|
||||||
this.initPrefetchCoursesIcons();
|
this.initPrefetchCoursesIcons();
|
||||||
|
@ -243,12 +249,61 @@ export class AddonBlockMyOverviewComponent extends AddonBlockComponent implement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The selected courses have changed.
|
* The selected courses filter have changed.
|
||||||
*/
|
*/
|
||||||
selectedChanged(): void {
|
selectedChanged(): void {
|
||||||
|
this.currentSite.setLocalSiteConfig('AddonBlockMyOverviewFilter', this.selectedFilter);
|
||||||
this.filteredCourses = this.courses[this.selectedFilter];
|
this.filteredCourses = this.courses[this.selectedFilter];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort and init courses filters.
|
||||||
|
* @param {any[]} courses Courses to sort.
|
||||||
|
*/
|
||||||
|
sortCourses(courses: any[]): void {
|
||||||
|
if (this.showSortFilter) {
|
||||||
|
if (this.sort == 'lastaccess') {
|
||||||
|
courses.sort((a, b) => {
|
||||||
|
return b.lastaccess - a.lastaccess;
|
||||||
|
});
|
||||||
|
} else if (this.sort == 'title') {
|
||||||
|
courses.sort((a, b) => {
|
||||||
|
const compareA = a.fullname.toLowerCase(),
|
||||||
|
compareB = b.fullname.toLowerCase();
|
||||||
|
|
||||||
|
return compareA.localeCompare(compareB);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.courses.all = courses;
|
||||||
|
this.courses.past = [];
|
||||||
|
this.courses.inprogress = [];
|
||||||
|
this.courses.future = [];
|
||||||
|
|
||||||
|
const today = moment().unix();
|
||||||
|
courses.forEach((course) => {
|
||||||
|
if ((course.enddate && course.enddate < today) || course.completed) {
|
||||||
|
// Courses that have already ended.
|
||||||
|
this.courses.past.push(course);
|
||||||
|
} else if (course.startdate > today) {
|
||||||
|
// Courses that have not started yet.
|
||||||
|
this.courses.future.push(course);
|
||||||
|
} else {
|
||||||
|
// Courses still in progress.
|
||||||
|
this.courses.inprogress.push(course);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The selected courses sort filter have changed.
|
||||||
|
*/
|
||||||
|
switchSort(): void {
|
||||||
|
this.currentSite.setLocalSiteConfig('AddonBlockMyOverviewSort', this.sort);
|
||||||
|
this.sortCourses(this.courses.all);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show or hide the filter.
|
* Show or hide the filter.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,5 +6,7 @@
|
||||||
"morecourses": "More courses",
|
"morecourses": "More courses",
|
||||||
"nocoursesfuture": "No future courses",
|
"nocoursesfuture": "No future courses",
|
||||||
"nocoursesinprogress": "No in progress courses",
|
"nocoursesinprogress": "No in progress courses",
|
||||||
"nocoursespast": "No past courses"
|
"nocoursespast": "No past courses",
|
||||||
|
"lastaccessed": "Last accessed",
|
||||||
|
"title": "Title"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
import { Component, OnInit, Injector } from '@angular/core';
|
import { Component, OnInit, Injector } from '@angular/core';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { CoreUtilsProvider } from '@providers/utils/utils';
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
||||||
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
||||||
import { CoreCoursesHelperProvider } from '@core/courses/providers/helper';
|
import { CoreCoursesHelperProvider } from '@core/courses/providers/helper';
|
||||||
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
|
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
|
||||||
|
@ -31,6 +32,7 @@ import { AddonBlockTimelineProvider } from '../../providers/timeline';
|
||||||
export class AddonBlockTimelineComponent extends AddonBlockComponent implements OnInit {
|
export class AddonBlockTimelineComponent extends AddonBlockComponent implements OnInit {
|
||||||
sort = 'sortbydates';
|
sort = 'sortbydates';
|
||||||
filter = 'next30days';
|
filter = 'next30days';
|
||||||
|
currentSite: any;
|
||||||
timeline = {
|
timeline = {
|
||||||
events: [],
|
events: [],
|
||||||
loaded: false,
|
loaded: false,
|
||||||
|
@ -49,7 +51,7 @@ export class AddonBlockTimelineComponent extends AddonBlockComponent implements
|
||||||
|
|
||||||
constructor(injector: Injector, private coursesProvider: CoreCoursesProvider, private utils: CoreUtilsProvider,
|
constructor(injector: Injector, private coursesProvider: CoreCoursesProvider, private utils: CoreUtilsProvider,
|
||||||
private timelineProvider: AddonBlockTimelineProvider, private courseOptionsDelegate: CoreCourseOptionsDelegate,
|
private timelineProvider: AddonBlockTimelineProvider, private courseOptionsDelegate: CoreCourseOptionsDelegate,
|
||||||
private coursesHelper: CoreCoursesHelperProvider) {
|
private coursesHelper: CoreCoursesHelperProvider, private sitesProvider: CoreSitesProvider) {
|
||||||
|
|
||||||
super(injector, 'AddonBlockTimelineComponent');
|
super(injector, 'AddonBlockTimelineComponent');
|
||||||
}
|
}
|
||||||
|
@ -58,8 +60,15 @@ export class AddonBlockTimelineComponent extends AddonBlockComponent implements
|
||||||
* Component being initialized.
|
* Component being initialized.
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.currentSite = this.sitesProvider.getCurrentSite();
|
||||||
|
this.currentSite.getLocalSiteConfig('AddonBlockTimelineFilter', this.filter).then((value) => {
|
||||||
|
this.filter = value;
|
||||||
this.switchFilter();
|
this.switchFilter();
|
||||||
|
});
|
||||||
|
this.currentSite.getLocalSiteConfig('AddonBlockTimelineSort', this.sort).then((value) => {
|
||||||
|
this.sort = value;
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,6 +176,7 @@ export class AddonBlockTimelineComponent extends AddonBlockComponent implements
|
||||||
* Change timeline filter being viewed.
|
* Change timeline filter being viewed.
|
||||||
*/
|
*/
|
||||||
switchFilter(): void {
|
switchFilter(): void {
|
||||||
|
this.currentSite.setLocalSiteConfig('AddonBlockTimelineFilter', this.filter);
|
||||||
switch (this.filter) {
|
switch (this.filter) {
|
||||||
case 'overdue':
|
case 'overdue':
|
||||||
this.dataFrom = -14;
|
this.dataFrom = -14;
|
||||||
|
@ -200,6 +210,7 @@ export class AddonBlockTimelineComponent extends AddonBlockComponent implements
|
||||||
* Change timeline sort being viewed.
|
* Change timeline sort being viewed.
|
||||||
*/
|
*/
|
||||||
switchSort(): void {
|
switchSort(): void {
|
||||||
|
this.currentSite.setLocalSiteConfig('AddonBlockTimelineSort', this.sort);
|
||||||
if (!this.timeline.loaded && this.sort == 'sortbydates') {
|
if (!this.timeline.loaded && this.sort == 'sortbydates') {
|
||||||
this.fetchContent();
|
this.fetchContent();
|
||||||
} else if (!this.timelineCourses.loaded && this.sort == 'sortbycourses') {
|
} else if (!this.timelineCourses.loaded && this.sort == 'sortbycourses') {
|
||||||
|
|
|
@ -13,11 +13,13 @@
|
||||||
"addon.block_myoverview.all": "All",
|
"addon.block_myoverview.all": "All",
|
||||||
"addon.block_myoverview.future": "Future",
|
"addon.block_myoverview.future": "Future",
|
||||||
"addon.block_myoverview.inprogress": "In progress",
|
"addon.block_myoverview.inprogress": "In progress",
|
||||||
|
"addon.block_myoverview.lastaccessed": "Last accessed",
|
||||||
"addon.block_myoverview.morecourses": "More courses",
|
"addon.block_myoverview.morecourses": "More courses",
|
||||||
"addon.block_myoverview.nocoursesfuture": "No future courses",
|
"addon.block_myoverview.nocoursesfuture": "No future courses",
|
||||||
"addon.block_myoverview.nocoursesinprogress": "No in progress courses",
|
"addon.block_myoverview.nocoursesinprogress": "No in progress courses",
|
||||||
"addon.block_myoverview.nocoursespast": "No past courses",
|
"addon.block_myoverview.nocoursespast": "No past courses",
|
||||||
"addon.block_myoverview.past": "Past",
|
"addon.block_myoverview.past": "Past",
|
||||||
|
"addon.block_myoverview.title": "Title",
|
||||||
"addon.block_timeline.duedate": "Due date",
|
"addon.block_timeline.duedate": "Due date",
|
||||||
"addon.block_timeline.next30days": "Next 30 days",
|
"addon.block_timeline.next30days": "Next 30 days",
|
||||||
"addon.block_timeline.next3months": "Next 3 months",
|
"addon.block_timeline.next3months": "Next 3 months",
|
||||||
|
@ -1070,7 +1072,7 @@
|
||||||
"core.areyousure": "Are you sure?",
|
"core.areyousure": "Are you sure?",
|
||||||
"core.back": "Back",
|
"core.back": "Back",
|
||||||
"core.cancel": "Cancel",
|
"core.cancel": "Cancel",
|
||||||
"core.cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 2.4 or later.",
|
"core.cannotconnect": "Cannot connect: verify that you have typed correctly the URL.",
|
||||||
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
"core.cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.",
|
||||||
"core.captureaudio": "Record audio",
|
"core.captureaudio": "Record audio",
|
||||||
"core.capturedimage": "Taken picture.",
|
"core.capturedimage": "Taken picture.",
|
||||||
|
@ -1354,6 +1356,7 @@
|
||||||
"core.login.selectsite": "Please select your site:",
|
"core.login.selectsite": "Please select your site:",
|
||||||
"core.login.signupplugindisabled": "{{$a}} is not enabled.",
|
"core.login.signupplugindisabled": "{{$a}} is not enabled.",
|
||||||
"core.login.siteaddress": "Site address",
|
"core.login.siteaddress": "Site address",
|
||||||
|
"core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.",
|
||||||
"core.login.siteinmaintenance": "Your site is in maintenance mode",
|
"core.login.siteinmaintenance": "Your site is in maintenance mode",
|
||||||
"core.login.sitepolicynotagreederror": "Site policy not agreed.",
|
"core.login.sitepolicynotagreederror": "Site policy not agreed.",
|
||||||
"core.login.siteurl": "Site URL",
|
"core.login.siteurl": "Site URL",
|
||||||
|
@ -1408,6 +1411,7 @@
|
||||||
"core.more": "more",
|
"core.more": "more",
|
||||||
"core.mygroups": "My groups",
|
"core.mygroups": "My groups",
|
||||||
"core.name": "Name",
|
"core.name": "Name",
|
||||||
|
"core.networkerroriframemsg": "This content is not available offline. Please connect to the internet and try again.",
|
||||||
"core.networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.",
|
"core.networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.",
|
||||||
"core.never": "Never",
|
"core.never": "Never",
|
||||||
"core.next": "Next",
|
"core.next": "Next",
|
||||||
|
|
|
@ -167,7 +167,9 @@ export class CoreSite {
|
||||||
|
|
||||||
// Variables for the database.
|
// Variables for the database.
|
||||||
protected WS_CACHE_TABLE = 'wscache';
|
protected WS_CACHE_TABLE = 'wscache';
|
||||||
protected tableSchema = {
|
protected CONFIG_TABLE = 'core_site_config';
|
||||||
|
protected tableSchemas = [
|
||||||
|
{
|
||||||
name: this.WS_CACHE_TABLE,
|
name: this.WS_CACHE_TABLE,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -188,7 +190,23 @@ export class CoreSite {
|
||||||
type: 'INTEGER'
|
type: 'INTEGER'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
},
|
||||||
|
{
|
||||||
|
name: this.CONFIG_TABLE,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
type: 'TEXT',
|
||||||
|
unique: true,
|
||||||
|
notNull: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'value'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
// Versions of Moodle releases.
|
// Versions of Moodle releases.
|
||||||
protected MOODLE_RELEASES = {
|
protected MOODLE_RELEASES = {
|
||||||
|
@ -248,7 +266,7 @@ export class CoreSite {
|
||||||
*/
|
*/
|
||||||
initDB(): void {
|
initDB(): void {
|
||||||
this.db = this.dbProvider.getDB('Site-' + this.id);
|
this.db = this.dbProvider.getDB('Site-' + this.id);
|
||||||
this.db.createTableFromSchema(this.tableSchema);
|
this.db.createTablesFromSchema(this.tableSchemas);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1544,4 +1562,44 @@ export class CoreSite {
|
||||||
|
|
||||||
return this.MOODLE_RELEASES[releases[position + 1]];
|
return this.MOODLE_RELEASES[releases[position + 1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a site setting.
|
||||||
|
*
|
||||||
|
* @param {string} name The config name.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
deleteSiteConfig(name: string): Promise<any> {
|
||||||
|
return this.db.deleteRecords(this.CONFIG_TABLE, { name: name });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a site setting on local device.
|
||||||
|
*
|
||||||
|
* @param {string} name The config name.
|
||||||
|
* @param {any} [defaultValue] Default value to use if the entry is not found.
|
||||||
|
* @return {Promise<any>} Resolves upon success along with the config data. Reject on failure.
|
||||||
|
*/
|
||||||
|
getLocalSiteConfig(name: string, defaultValue?: any): Promise<any> {
|
||||||
|
return this.db.getRecord(this.CONFIG_TABLE, { name: name }).then((entry) => {
|
||||||
|
return entry.value;
|
||||||
|
}).catch((error) => {
|
||||||
|
if (typeof defaultValue != 'undefined') {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a site setting on local device.
|
||||||
|
*
|
||||||
|
* @param {string} name The config name.
|
||||||
|
* @param {number|string} value The config value. Can only store number or strings.
|
||||||
|
* @return {Promise<any>} Promise resolved when done.
|
||||||
|
*/
|
||||||
|
setLocalSiteConfig(name: string, value: number | string): Promise<any> {
|
||||||
|
return this.db.insertRecord(this.CONFIG_TABLE, { name: name, value: value });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
$core-progress-bar-height: 10px !default;
|
$core-progress-bar-height: 8px !default;
|
||||||
|
|
||||||
ion-app.app-root core-progress-bar {
|
ion-app.app-root core-progress-bar {
|
||||||
@include padding(null, 55px, null, null);
|
@include padding(null, 55px, null, null);
|
||||||
|
@ -11,7 +11,7 @@ ion-app.app-root core-progress-bar {
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
color: $gray-darker;
|
color: $gray-darker;
|
||||||
@include position(-15px, 10px, null, null);
|
@include position(-16px, 10px, null, null);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ ion-app.app-root core-progress-bar {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
height: $core-progress-bar-height;
|
height: $core-progress-bar-height;
|
||||||
margin: 15px 0;
|
margin: 16px 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -27,15 +27,15 @@ ion-app.app-root core-progress-bar {
|
||||||
.progress-bar-fallback,
|
.progress-bar-fallback,
|
||||||
&[value]::-webkit-progress-bar {
|
&[value]::-webkit-progress-bar {
|
||||||
background-color: $gray-lighter;
|
background-color: $gray-lighter;
|
||||||
border-radius: 999px;
|
border-radius: 0;
|
||||||
border: 1px solid $gray-light;
|
border:0;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar-fallback span,
|
.progress-bar-fallback span,
|
||||||
&[value]::-webkit-progress-value {
|
&[value]::-webkit-progress-value {
|
||||||
background-color: $core-progressbar-color;
|
background-color: $core-progressbar-color;
|
||||||
border-radius: 999px;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar-fallback {
|
.progress-bar-fallback {
|
||||||
|
|
|
@ -8,11 +8,6 @@ ion-app.app-root core-courses-course-progress {
|
||||||
.core-course-thumb {
|
.core-course-thumb {
|
||||||
background: nth($core-course-image-background, $i + 1);
|
background: nth($core-course-image-background, $i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
progress .progress-bar-fallback span,
|
|
||||||
progress[value]::-webkit-progress-value {
|
|
||||||
background-color: nth($core-course-image-background, $i + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue