本文整理汇总了TypeScript中@core/user/providers/user.CoreUserProvider.getProfile方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreUserProvider.getProfile方法的具体用法?TypeScript CoreUserProvider.getProfile怎么用?TypeScript CoreUserProvider.getProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@core/user/providers/user.CoreUserProvider
的用法示例。
在下文中一共展示了CoreUserProvider.getProfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
/**
* Component being initialized.
*/
ngOnInit(): void {
switch (this.action) {
case 'more':
this.url = this.rootUrl + '/mod/data/view.php?d= ' + this.entry.dataid + '&rid=' + this.entry.id;
break;
case 'edit':
this.url = this.rootUrl + '/mod/data/edit.php?d= ' + this.entry.dataid + '&rid=' + this.entry.id;
break;
case 'delete':
this.url = this.rootUrl + '/mod/data/view.php?d= ' + this.entry.dataid + '&delete=' + this.entry.id;
break;
case 'approve':
this.url = this.rootUrl + '/mod/data/view.php?d= ' + this.entry.dataid + '&approve=' + this.entry.id;
break;
case 'disapprove':
this.url = this.rootUrl + '/mod/data/view.php?d= ' + this.entry.dataid + '&disapprove=' + this.entry.id;
break;
case 'userpicture':
this.userProvider.getProfile(this.entry.userid, this.database.courseid).then((profile) => {
this.userPicture = profile.profileimageurl;
});
break;
default:
break;
}
}
示例2: getProfile
/**
* Convenient helper to get the user profile image.
*
* @param {number} userId User Id
* @return {Promise<any>} User profile Image URL or true if default icon.
*/
getProfile(userId: number): Promise<any> {
if (!userId || userId == this.sitesProvider.getCurrentSiteUserId()) {
return Promise.resolve(false);
}
// Get the user profile to retrieve the user image.
return this.userProvider.getProfile(userId, null, true).then((user) => {
user.profileimageurl = user.profileimageurl || true;
return user;
});
}
示例3: convertOfflineReplyToOnline
/**
* Convert offline reply to online format in order to be compatible with them.
*
* @param {any} offlineReply Offline version of the reply.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the object converted to Online.
*/
convertOfflineReplyToOnline(offlineReply: any, siteId?: string): Promise<any> {
const reply: any = {
attachments: [],
canreply: false,
children: [],
created: offlineReply.timecreated,
discussion: offlineReply.discussionid,
id: false,
mailed: 0,
mailnow: 0,
message: offlineReply.message,
messageformat: 1,
messagetrust: 0,
modified: false,
parent: offlineReply.postid,
postread: false,
subject: offlineReply.subject,
totalscore: 0,
userid: offlineReply.userid
},
promises = [];
// Treat attachments if any.
if (offlineReply.options && offlineReply.options.attachmentsid) {
reply.attachments = offlineReply.options.attachmentsid.online || [];
if (offlineReply.options.attachmentsid.offline) {
promises.push(this.getReplyStoredFiles(offlineReply.forumid, reply.parent, siteId, reply.userid)
.then((files) => {
reply.attachments = reply.attachments.concat(files);
}));
}
}
// Get user data.
promises.push(this.userProvider.getProfile(offlineReply.userid, offlineReply.courseid, true).then((user) => {
reply.userfullname = user.fullname;
reply.userpictureurl = user.profileimageurl;
}).catch(() => {
// Ignore errors.
}));
return Promise.all(promises).then(() => {
reply.attachment = reply.attachments.length > 0 ? 1 : 0;
return reply;
});
}
示例4:
this.textUtils.formatText(moduleName, true, true, 50).then((modNameFormatted) => {
let promise;
if (this.completion.overrideby > 0) {
langKey += '-override';
promise = this.userProvider.getProfile(this.completion.overrideby, this.completion.courseId, true).then(
(profile) => {
return {
overrideuser: profile.fullname,
modname: modNameFormatted
};
});
} else {
promise = Promise.resolve(modNameFormatted);
}
return promise.then((translateParams) => {
this.completionDescription = this.translate.instant(langKey, { $a: translateParams });
});
});