本文整理匯總了TypeScript中@providers/sites.CoreSitesProvider.getCurrentSiteId方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript CoreSitesProvider.getCurrentSiteId方法的具體用法?TypeScript CoreSitesProvider.getCurrentSiteId怎麽用?TypeScript CoreSitesProvider.getCurrentSiteId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@providers/sites.CoreSitesProvider
的用法示例。
在下文中一共展示了CoreSitesProvider.getCurrentSiteId方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(userDelegate: CoreUserDelegate, userProfileMailHandler: CoreUserProfileMailHandler,
eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider, userProvider: CoreUserProvider,
contentLinksDelegate: CoreContentLinksDelegate, userLinkHandler: CoreUserProfileLinkHandler,
courseOptionHandler: CoreUserParticipantsCourseOptionHandler, linkHandler: CoreUserParticipantsLinkHandler,
courseOptionsDelegate: CoreCourseOptionsDelegate) {
userDelegate.registerHandler(userProfileMailHandler);
courseOptionsDelegate.registerHandler(courseOptionHandler);
contentLinksDelegate.registerHandler(userLinkHandler);
contentLinksDelegate.registerHandler(linkHandler);
eventsProvider.on(CoreEventsProvider.USER_DELETED, (data) => {
// Search for userid in params.
const params = data.params;
let userId = 0;
if (params.userid) {
userId = params.userid;
} else if (params.userids) {
userId = params.userids[0];
} else if (params.field === 'id' && params.values && params.values.length) {
userId = params.values[0];
} else if (params.userlist && params.userlist.length) {
userId = params.userlist[0].userid;
}
if (userId > 0) {
userProvider.deleteStoredUser(userId, data.siteId);
}
}, sitesProvider.getCurrentSiteId());
}
示例2:
}).then(() => {
if (addingSite == data.siteId) {
addingSite = false;
}
// User has logged in, remove tmp styles and enable loaded styles.
if (data.siteId == sitesProvider.getCurrentSiteId()) {
remoteThemesProvider.unloadTmpStyles();
remoteThemesProvider.enable(data.siteId);
}
});
示例3: constructor
constructor(eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider) {
this.siteId = sitesProvider.getCurrentSiteId();
// Update split view or navigate.
this.loadSplitViewObserver = eventsProvider.on(AddonMessagesProvider.SPLIT_VIEW_LOAD_EVENT, (data) => {
if (data.discussion && (this.splitviewCtrl.isOn() || !data.onlyWithSplitView)) {
this.gotoDiscussion(data.discussion, data.message);
}
}, this.siteId);
}
示例4: getEditDataFromForm
/**
* Retrieve the entered data in the edit form.
* We don't use ng-model because it doesn't detect changes done by JavaScript.
*
* @param {any} inputData Array with the entered form values.
* @param {Array} fields Fields that defines every content in the entry.
* @param {number} [dataId] Database Id. If set, files will be uploaded and itemId set.
* @param {number} entryId Entry Id.
* @param {any} entryContents Original entry contents indexed by field id.
* @param {boolean} offline True to prepare the data for an offline uploading, false otherwise.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} That contains object with the answers.
*/
getEditDataFromForm(inputData: any, fields: any, dataId: number, entryId: number, entryContents: any, offline: boolean = false,
siteId?: string): Promise<any> {
if (!inputData) {
return Promise.resolve({});
}
siteId = siteId || this.sitesProvider.getCurrentSiteId();
// Filter and translate fields to each field plugin.
const edit = [],
promises = [];
fields.forEach((field) => {
promises.push(Promise.resolve(this.fieldsDelegate.getFieldEditData(field, inputData, entryContents[field.id]))
.then((fieldData) => {
if (fieldData) {
const proms = [];
fieldData.forEach((data) => {
let dataProm;
// Upload Files if asked.
if (dataId && data.files) {
dataProm = this.uploadOrStoreFiles(dataId, 0, entryId, data.fieldid, data.files, offline, siteId)
.then((filesResult) => {
delete data.files;
data.value = filesResult;
});
} else {
dataProm = Promise.resolve();
}
proms.push(dataProm.then(() => {
if (data.value) {
data.value = JSON.stringify(data.value);
}
if (typeof data.subfield == 'undefined') {
data.subfield = '';
}
// WS wants values in Json format.
edit.push(data);
}));
});
return Promise.all(proms);
}
}));
});
return Promise.all(promises).then(() => {
return edit;
});
}
示例5: constructor
constructor(mainMenuDelegate: CoreMainMenuDelegate, gradesMenuHandler: CoreGradesMainMenuHandler,
courseOptionHandler: CoreGradesCourseOptionHandler, courseOptionsDelegate: CoreCourseOptionsDelegate,
contentLinksDelegate: CoreContentLinksDelegate, userLinkHandler: CoreGradesUserLinkHandler,
overviewLinkHandler: CoreGradesOverviewLinkHandler, userHandler: CoreGradesUserHandler,
userDelegate: CoreUserDelegate, eventsProvider: CoreEventsProvider, sitesProvider: CoreSitesProvider) {
// Register handlers.
mainMenuDelegate.registerHandler(gradesMenuHandler);
courseOptionsDelegate.registerHandler(courseOptionHandler);
contentLinksDelegate.registerHandler(userLinkHandler);
contentLinksDelegate.registerHandler(overviewLinkHandler);
userDelegate.registerHandler(userHandler);
// Clear user profile handler cache.
eventsProvider.on(CoreUserProvider.PROFILE_REFRESHED, (data) => {
userHandler.clearViewGradesCache(data.courseId, data.userId);
}, sitesProvider.getCurrentSiteId());
eventsProvider.on(CoreEventsProvider.LOGOUT, () => {
userHandler.clearViewGradesCache();
}, sitesProvider.getCurrentSiteId());
}
示例6: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
super.ngOnInit();
this.hasOffline = false;
this.syncIcon = 'spinner';
this.siteId = this.sitesProvider.getCurrentSiteId();
this.moduleName = this.courseProvider.translateModuleName(this.moduleName);
if (this.syncEventName) {
// Refresh data if this discussion is synchronized automatically.
this.syncObserver = this.eventsProvider.on(this.syncEventName, (data) => {
this.autoSyncEventReceived(data);
}, this.siteId);
}
}
示例7: getReviewerAssessments
/**
* Retrieves the assessment of the given user and all the related data.
*
* @param {number} workshopId Workshop ID.
* @param {number} [userId=0] User ID. If not defined, current user.
* @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache.
* @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down).
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any[]>} Promise resolved when the workshop data is retrieved.
*/
getReviewerAssessments(workshopId: number, userId: number = 0, offline: boolean = false, ignoreCache: boolean = false,
siteId?: string): Promise<any[]> {
siteId = siteId || this.sitesProvider.getCurrentSiteId();
return this.workshopProvider.getReviewerAssessments(workshopId, userId, offline, ignoreCache, siteId)
.then((assessments) => {
const promises = assessments.map((assessment) => {
return this.getSubmissionById(workshopId, assessment.submissionid, siteId).then((submission) => {
assessment.submission = submission;
});
});
return Promise.all(promises).then(() => {
return assessments;
});
});
}
示例8: ngOnInit
ngOnInit(): void {
this.selectedSite = this.initialSite || this.sitesProvider.getCurrentSiteId();
// Load the sites.
this.sitesProvider.getSites().then((sites) => {
const promises = [];
sites.forEach((site: any) => {
// Format the site name.
promises.push(this.textUtils.formatText(site.siteName, true, true).catch(() => {
return site.siteName;
}).then((formatted) => {
site.fullNameAndSiteName = this.translate.instant('core.fullnameandsitename',
{ fullname: site.fullName, sitename: formatted });
}));
});
return Promise.all(promises).then(() => {
this.sites = sites;
});
});
}
示例9: constructor
constructor(protected injector: Injector, protected dataProvider: AddonModDataProvider,
protected dataOffline: AddonModDataOfflineProvider, protected eventsProvider: CoreEventsProvider,
sitesProvider: CoreSitesProvider, protected userProvider: CoreUserProvider) {
this.rootUrl = sitesProvider.getCurrentSite().getURL();
this.siteId = sitesProvider.getCurrentSiteId();
}