MoodleApp compatible image rotator without a plugin

MoodleApp compatible image rotator without a plugin

von Josh Manders -
Anzahl Antworten: 2
I've hit my frustration tipping point with trying to get what I see as standard interactive elements to display through the app. We have a paid version for basic customization (CSS + branding) but aren't in the position (nor do we desire to) build and deploy our own custom app.

Basic need: show a specific static image + text "teaser" or card layout on the site home page that automatically changes depending on where we are in the term/semester. You know... basic promotional advertising.

Things I've tried:
  • Javascript: This would be my first choice but either I'm not able to find documentation on the java libraries available and/or can't initialize the most simplest of javascript functions within an inline <script> such as:
    var date = new Date(); document.getElementById("p1").innerHTML = date;
  • H5P: I went down this road thinking maybe I could smash something together and have a nice way to edit and create the content for the widget. However, the embedded H5P in the mobile app doesn't automatically play(unless it's an activity).
  • IonicFramework/CSS: I can create graphical elements but can't create any of the logic behind displaying it. Yes, I could use moodle's restrict access settings and make 10 separate label blocks on the homepage but that's ridiculously messy and causes other problems with updating the dates every term.
  • iframe + external system: my last attempt. According to ionic folks, generally not a great approach — but I'll do it if it works. Height with responsive size = always a pain in the butt (especially when the app isn't liking the javascript I put in front of it). Cross-website tracking is enabled by default on iOS devices which will prevent most of the content from loading (unless internal in Moodle). Skimming as much information as I can, it appears the app maybe uses Cordova-in-app-browser to render. Limited testing = works for for an embedded google form.
I'm aware there's a couple plugins that might be able to do what I'm after because the plugin developers have some additional scripting baked in. However, we are locked out of installing any new plugins from our host (OpenLMS).

I'm open for any/all creative suggestions or reality check condolences. 🤕
Als Antwort auf Josh Manders

Re: MoodleApp compatible image rotator without a plugin

von Dani Palou -
Nutzerbild von Core developers Nutzerbild von Moodle HQ Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers

Hi Josh,

sorry for the delay in answering.

The iframe solution is probably the easiest, but it will only work online.

About the inline <script> in Moodle HTML content, AFAIK inline scripts don't run even if the app adds them to the DOM, I guess Angular blocks them for security reasons.

If your content is only HTML (it doesn't require JS after rendering), I guess you could create a filter plugin that uses PHP code to determine the content to display. The app receives the content already filtered, so it should only receive the filtered HTML (the one for the current term).

If you need JS code, then IMO the nicest solution would be to create your own block plugin and adapt it to work in the app following this guide. Plugins adapted to the app can run JS code. This solution requires more work.

Kind regards,

Dani

Als Antwort auf Dani Palou

Re: MoodleApp compatible image rotator without a plugin

von Josh Manders -
Thanks Dani — this is what I needed to know. Project is dead in the water unless someone wants to create a custom banner ad platform for simple iframe embedding :-| We have a digital sign platform but the similar to our institutional events calendar, it relies on several scripts after rendering.