当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript user.CoreUserProvider类代码示例

本文整理汇总了TypeScript中@core/user/providers/user.CoreUserProvider的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreUserProvider类的具体用法?TypeScript CoreUserProvider怎么用?TypeScript CoreUserProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CoreUserProvider类的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;
     }
 }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:29,代码来源:action.ts

示例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;
        });
    }
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:18,代码来源:helper.ts

示例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;
        });
    }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:55,代码来源:helper.ts

示例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 });
                });
            });
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:21,代码来源:module-completion.ts


注:本文中的@core/user/providers/user.CoreUserProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。