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發表於
Number of replies: 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 ~

評比平均分數: -
In reply to 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.
評比平均分數:Useful (2)
In reply to Dominique Palumbo

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

wz z發表於
Thank you very much!
In reply to 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.