How to write custom SQL to query upcoming events, site notifications and site messages?

How to write custom SQL to query upcoming events, site notifications and site messages?

von wz z -
Anzahl Antworten: 3

Thank you very much! I investigated into the mdl_notificatoins, mdl_message tables, they seems have more content than I want. I just want those displayed in webpage rather than in emails.

And there is no such a table for upcoming events.  So please help me ~

Als Antwort auf wz z

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

von Dominique Palumbo -
Nutzerbild von Particularly helpful Moodlers Nutzerbild von Plugin developers
Hi,

You've already a block that do that for upcoming events.
You'll find all the code you need.
\blocks\calendar_upcoming

For the table is mdl_event

SELECT * from mdl_event WHERE timestart > extract(epoch from now()) -- for pgsql
SELECT * from mdl_event WHERE timestart > unix_timestamp(now()) -- for mysql

Hope it's helped.

Dominique.
Als Antwort auf Dominique Palumbo

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

von wz z -
Thank you very much!
Als Antwort auf wz z

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

von Taranveer Singh -
  • Click in the SQL Query area and type your SQL command. Optionally, double-click on a table name or field from the field list to include it in your query at the cursor location.
  • Click Run to run the query against your database. View the results in the Results area.
  • SQL Runner will load up to 5000 rows of the query’s result set.
  • For SQL dialects that support streaming, you can download the set from the sql server to access the full report.