In short, I want an announcement database that displays like the social forum but with some extra fields, such as Year Level.
Any ideas? I have a field for Start Date and End Date and can display those in the List View, but it will theoretically hold those forever, whereas some of them need only have a life of a single day.
Looking forward to some ideas...Regards, Shane
@Itamar
Great to see this discussion on categories for announcements! I've been searching for a similar solution too - my situation sounds exactly like Shane's.
I have considered the different forums feeding into one - however I have an issue - our announcements sometimes apply only to one class (Ex: freshman) but other times they apply to multiple or all grade levels. Thus, if someone wants an announcement about a club to show up on all 4 grade level newsfeeds, he/she would have to post it 4 different times = no practical.
Ideally, a staff member would be able to fill out a text box, set the date of announcement, and check boxes off next to each grade level he/she would like for it to appear it. Fast forward to afternoon announcements, and the 9th grade advisory teacher would be able to simply pull up the 9th grade feed and see any and everything that applies - while 10th-12th grade announcements are filtered out.
Any ideas?
Itamar : Thanks for the suggestion. I have tried this just now, thinking that I might hav emissed something BUT...
We are running v1.9.8 and RSS blocks only go to the side columns, yes? So 100 Notices is not going to format too well...Cron only runs every 30 mins or so, and even if I run it more regularly, it is still not a totally current display.
If I could get the RSS into the centre, maybe I would keep looking. Ideas?
Thanks again, Shane
You can also use the database for entering those announcements and generating manually the RSS (so as to update upon changes and not only new entries as the database RSS currently works) which you can then display wherever you want using one of the solutions described in the link above.
1. The beauty of the "normal" forum is that the message displays immediately, whereas a combo RSS block, with all forum RSS feeds, is reliant upon Cron happening. A message added at 0800 may not display in the summary until 0830 or whatever...So unless Cron updates all the time, or is manually triggered all the time...
2. I need to also figure out the formatting of the RSS and have posted to that forum. Is it dependant on the theme?
Using Flexpage I was able to get the RSS block into the centre.
I am still looking for a solution to this. Regards, Shane
The good:
-No need to repost reminders about an announcement – it will stay near the top until more recent news overtake it
The bad:
-Need to set some limit to how “in advance” an announcement can be posted – if people post a bunch of news for the next month, it will obviously overcrowd the top of the newsfeed.
For the sorting
-The user just has to open up the database and under advanced search you can order the entries by date – and just check the box next to the grade level you want to see.
I included fields for a small picture and two file attachments – which will be perfect for when we have permission slips or whatever else that needs to be easily distributed. The picture will go a long way for imaging/logos – hopefully each club/team can grab a simple image to post with every update – so users can easily find what their looking for in the list.
I attached a copy of the present to this post – let me know what you think. I’ll try to get some of my summer school teachers to use it for few weeks to tweak a bit more.
Thanks!
Chris
(oh - I only formatted the list, single, and add templates - need to tweak the rss)
Chris ( and others) : I will attach a screenshot of what I have done with my own database but it is the date thing which is most annoying. The screen does not show the start and end date fields (start and end) but they are present when adding an entry. I would have expected to be able to create some code/hack which only displays (in list view) when end is less than Today; ie it has expired.
Could that be a possibility?
My entries are grouped according to Year Level.
Regards, Shane
Add to the footer section in the list template the following code:
<script type="text/javascript">This code assumes that the table of items is called 'itemlist', that it has <tbody>, that the first row is a header row, and that the end date is in cell 8. Of course, you can select another name and put the end date in another cell, in which case simply change the corresponding parts of the code. The table should also be set to display:none so that it will be displayed only after the filtering.
var today=new Date();
var myList=document.getElementById('itemList');
var myRows=myList.firstChild.rows;
for (var i=1;i<myRows.length;i++){
var endDate=new Date(myRows[i].cells[8].innerHTML);
if (endDate.getTime()>today.getTime()) myRows[i].className='iamexpired';
}
myList.style.display='';
</script>
The code does traverses the rows in the display and checks whether endDate of a record is bigger than today, and if so it assigns the css class 'iamexpired' to that row.
Now add to the css template the following class definition:
.iamexpired{display:none;}
Clear cache and try. With a bit of luck it will work.
(P.S. goes without saying that all entries should reside in one table, but said just in case
1. The table of items? in the MySQL database? or within the actual Moodle database as displayed in the database module GUI? My database is called "Notices" so is that what goes in there?
2. The end date is in cell 8? Do you mean the 8th field in the Moodle database activity? or is this again in the MySQL?
3. The CSS template you refer to is that in Database activity, yes?
I have tried to get this to work at home on a local install using MAMP but have had no luck deciphering the MySQL data. Where do I begin looking? The database activity is not in the Course folder in my moodledata folder so where does it store itself?
Sorry for the ignorance and I get the feeling that the javascript will do what I need but I just can't figure out how to use it!
Regards, Shane
- That's the table of items in the list view which you set up in the list view template. You have to disable the editor for doing that and once it is done you cannot use the editor for modification but will have to switch to text mode. See this thread for related discussion.
- Given the table, cell 8 is the ninth td tag in the repeated entry section which is also the ninth column (the first td tag is cell 0). Of course it can be any column you want. Also you don't have to display it, in which case the td tag may look like:
<td style="display:none;">||EndDate||</td> - Yes.
Footer I have also placed the css as suggested. Any ideas? Is it something minor, like a number in the wrong place? The table as displayed should be fairly simple with probably 3 columns (Year | Subject | Message). There are other fields but I am just trying to get the old material to not display... Regards, Shane
Sorry for the other post, Itamar. I pasted the code in and it displayed funny. Here is a screenshot of the code. Hope that helps.
Shane
Now, in the Repeated entry box delete the first line (<div class="defaulttemplate"><table cellpadding="5">) and the last line (</table><div><hr />).
Then, in the Header box add the line:
<table id="itemlist" cellpadding="5" style="display:none;"><tbody>
and in the Footer box add before the script tag the line:
</tbody></table>
Remember to disable editor before making any changes.
Let me know if that worked.
Anyway, I can't get it. The List table seems to hit the display:none in the header area and that kills the display totally. If I remove that code, the whole thing displays with no filtering.
I have followed the instructions to the letter but of course, I have been wrong before. Does the name of the variable endDate matter? If I have the field called end in my table? Does the javascript rely on the database fields being called anything specific, or does it make its own naming in the variables?
Regards, Shane
<table id="Notices" cellpadding="5" style="display:none;"><tbody>
var EndDate=new Date(myRows[i].cells[5].innerHTML);
should be
var EndDate=new Date(myRows[i].cells[4].innerHTML);
Itamar : getting closer all the time...But still nothing. I get 5 notices, now, but the new ones are not displaying.
Code is attached. It is very simple at the moment so I must be missing a simple thing, like a comma or something!
Regards and many thanks for your time so far! Shane