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


TypeScript CoreSitesProvider.getCurrentSiteId方法代码示例

本文整理汇总了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());
    }
开发者ID:SATS-Seminary,项目名称:moodlemobile2,代码行数:31,代码来源:user.module.ts

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

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

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

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

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

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

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

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


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