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?

על ידי wz z בתאריך
מספר תגובות: 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 ~

ממוצע דרוגים: -
בתגובה ל: wz z

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

על ידי Dominique Palumbo בתאריך
תמונה של Particularly helpful Moodlers תמונה של 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.
בתגובה ל: Dominique Palumbo

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

על ידי wz z בתאריך
Thank you very much!
בתגובה ל: wz z

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

על ידי 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.