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


TypeScript CoreSitesProvider.getSite方法代码示例

本文整理汇总了TypeScript中@providers/sites.CoreSitesProvider.getSite方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CoreSitesProvider.getSite方法的具体用法?TypeScript CoreSitesProvider.getSite怎么用?TypeScript CoreSitesProvider.getSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@providers/sites.CoreSitesProvider的用法示例。


在下文中一共展示了CoreSitesProvider.getSite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: ionViewDidLoad

    /**
     * View loaded.
     */
    ionViewDidLoad(): void {
        if (this.siteConfig) {
            this.identityProviders = this.loginHelper.getValidIdentityProviders(this.siteConfig);
        }

        this.sitesProvider.getSite(this.siteId).then((site) => {
            this.site = {
                id: site.id,
                fullname: site.infos.fullname,
                avatar: site.infos.userpictureurl
            };

            this.username = site.infos.username;
            this.siteUrl = site.infos.siteurl;
            this.siteName = site.infos.sitename;

            // Check logoURL if user avatar is not set.
            if (this.site.avatar.startsWith(site.infos.siteurl + '/theme/image.php')) {
                this.site.avatar = false;

                return site.getPublicConfig().then((config) => {
                    this.logoUrl = config.logourl || config.compactlogourl;
                }).catch(() => {
                    // Ignore errors.
                });
            }
        }).catch(() => {
            // Shouldn't happen. Just leave the view.
            this.cancel();
        });

    }
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:35,代码来源:reconnect.ts

示例2: getEntry

    /**
     * Get an online or offline entry.
     *
     * @param  {any} data             Database.
     * @param  {number} entryId       Entry ID.
     * @param  {any} [offlineActions] Offline data with the actions done. Required for offline entries.
     * @param  {string} [siteId]      Site ID. If not defined, current site.
     * @return {Promise<any>}         Promise resolved with the entry.
     */
    getEntry(data: any, entryId: number, offlineActions?: any, siteId?: string): Promise<any> {
        if (entryId > 0) {
            // It's an online entry, get it from WS.
            return this.dataProvider.getEntry(data.id, entryId, siteId);
        }

        // It's an offline entry, search it in the offline actions.
        return this.sitesProvider.getSite(siteId).then((site) => {
            const offlineEntry = offlineActions.find((offlineAction) => offlineAction.action == 'add');

            if (offlineEntry) {
                const siteInfo = site.getInfo();

                return {entry: {
                        id: offlineEntry.entryid,
                        canmanageentry: true,
                        approved: !data.approval || data.manageapproved,
                        dataid: offlineEntry.dataid,
                        groupid: offlineEntry.groupid,
                        timecreated: -offlineEntry.entryid,
                        timemodified: -offlineEntry.entryid,
                        userid: siteInfo.userid,
                        fullname: siteInfo.fullname,
                        contents: {}
                    }
                };
            }
        });
    }
开发者ID:jleyva,项目名称:moodlemobile2,代码行数:38,代码来源:helper.ts


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