Birthday block: Difference between revisions

From MoodleDocs
No edit summary
 
m (added link to spanish translation of document)
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
--Birthday Block--
==Birthday Block==


In Moodle 1.8, if you use the user profile field to store a user's birthday or some type of anniversary date (formatted either as ISO YYYY-MM-DD, USA m.d.Y, or EUR d.m.Y), the Birthday Block (based off of the site_online_users block) will query the specified and configurable user profile field for the users whose birthday (or anniversary date) have the same month and day as the server's current time. The Birthday Block alphabettically displays the user's full name with picture and the ability to click on the send message icon to directly send the user a Moodle message.  
The Birthday Block makes use of a user profile date field to store the date of birth (or anniversary) for each user. The Birthday Block alphabettically displays the user's full name with picture and the ability to click on the send message icon to directly send the user a Moodle message.  


The Birthday Block makes use of the custom user profile fields and allow you to create a field to hold the date of birth (or anniversary) for the user. The assumed, default shortname of the custom user profile field is DOB (i.e. date of birth). However, the birthday block allows for the custom user profile field's shortname to be configured so you can use Anniversary or any other descriptive name you choose. Since the data stored in the custom user profile fields is a text value (and not an actual date), the birthday block assumes that the data entered conforms to a valid date format (i.e. ISO, USA, or EUR). There is no data validation when the user enters the data and therefore I would recommend that the user not be able to edit the custom user profile field used by the Birthday Block.  
The settings page allows the site admin to select which user profile date field to use (currently only one can be used throughout the site). The data stored in the user profile date field is now a unix timestamp (this was not the case in the 1.9 version). Typically institutions auto-populate this field using a CSV upload of the data and then prevent the users from editing the data.  


---Installation---
===Installation===


Copy the files into the \blocks folder.  
*Copy the files into the \blocks folder.  
Go to the \admin page and allow the block to be installed
*Go to the \admin page and allow the block to be installed
Go to Users, Accounts, User profile fields
*Go to Users, Accounts, User profile fields
Create a new profile field of type text input
*Create a new user profile date field  
Input the Shortname (for this block the default is DOB), Name (for example, Birthday), a description
*Input a Shortname (for example, dob), Name (for example, Birthday), and a Description
I recommend that the field not be required, that it be locked, and visible to user
*Generally speaking, it is recommended that the field not be required, that it be locked, and visible to user
I have used the default category; however, you are free to organize these fields however you wish.
*Click on the Save Changes button
I recommend a blank default value, display size of 10, and maximum length of 10.
*In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
Click on the Save Changes button
*Select the newly created user profile date field you wish to use to store the birth dates
In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
*Enter the Birth Dates into the created user profile date field (or upload them via a CSV file)
Input the shortname of the profile field you created to store the birth dates
*Add the Birthday block to your page to see a list of those celebrating birthdays
Enter the Birth Dates into the created user profile field
Add the Birthday block to your page to see a list of those celebrating birthdays


---Languages---
===Languages===


Thanks to the generosity of translators, the Birthday Block is available in:
Thanks to the generosity of translators, the Birthday Block is available in many languages:
English
*English
Spanish
*Spanish
French
*French
Japanese
*Japanese
German
*German
Italian
*Italian
hu_utf8
*and many more
sv_utf8


---Advanced Options---
If the block is not available in your language feel free to contact me so that we can create one.


It is possible to mass import the custom user profile field data when importing users. More detailed instructions are forthcoming.
===Importing data===


---To Do List---
It is possible to mass import the user profile date field data when importing users. More detailed instructions are available on the [https://docs.moodle.org/20/en/Upload_users#Fields_that_can_be_included Upload users] page. In 1.9, the data imported was a text string of a date in either ISO, EUR, or USA format. In 2.0 and beyond, the data imported for the date of birth should be a Unix timestamp.


I would like to include the formating from styles.layout.css for the site_online_block directly into the block; however, I am not sure how best to accomplish this. I'm not sure how to possibly use html_attributes to get an effect similar to:
===Styling===


.block_birthday .listentry div.message {
Styling varies from theme to theme. The following has been setup in the birthday block's styles.php file:
  float:right;
}


.block_birthday .listentry div.user {
.block_birthday .listentry div.user { float: left; }
  float:left;
.block_birthday .listentry div.message { float: right; }
  font-size:0.75em;
}


Ultimately, I want to make sure that it is formatted identically to the site_online_users block. Any help with that would be greatly appreciated.  
Some themes allow for the styles.css to be overridden or added to.  


===Contributor/Maintainer===
The Birthday Block was contributed and is maintained by [https://docs.moodle.org/20/en/User:Anthony_Borrow Anthony Borrow].


---Contributor/Maintainer---
===See also===
The Birthday Block was contributed and is maintained by Anthony Borrow.
[http://moodle.org/mod/data/view.php?d=13&rid=901 Birthday block's Modules and Plugins database entry]
 
[[Category:Contributed code]]
 
[[es:Bloque cumpleaños]]

Latest revision as of 01:38, 30 December 2013

Birthday Block

The Birthday Block makes use of a user profile date field to store the date of birth (or anniversary) for each user. The Birthday Block alphabettically displays the user's full name with picture and the ability to click on the send message icon to directly send the user a Moodle message.

The settings page allows the site admin to select which user profile date field to use (currently only one can be used throughout the site). The data stored in the user profile date field is now a unix timestamp (this was not the case in the 1.9 version). Typically institutions auto-populate this field using a CSV upload of the data and then prevent the users from editing the data.

Installation

  • Copy the files into the \blocks folder.
  • Go to the \admin page and allow the block to be installed
  • Go to Users, Accounts, User profile fields
  • Create a new user profile date field
  • Input a Shortname (for example, dob), Name (for example, Birthday), and a Description
  • Generally speaking, it is recommended that the field not be required, that it be locked, and visible to user
  • Click on the Save Changes button
  • In the Site Administration Block, click on Modules, Blocks, and the settings link for the Birthday block
  • Select the newly created user profile date field you wish to use to store the birth dates
  • Enter the Birth Dates into the created user profile date field (or upload them via a CSV file)
  • Add the Birthday block to your page to see a list of those celebrating birthdays

Languages

Thanks to the generosity of translators, the Birthday Block is available in many languages:

  • English
  • Spanish
  • French
  • Japanese
  • German
  • Italian
  • and many more

If the block is not available in your language feel free to contact me so that we can create one.

Importing data

It is possible to mass import the user profile date field data when importing users. More detailed instructions are available on the Upload users page. In 1.9, the data imported was a text string of a date in either ISO, EUR, or USA format. In 2.0 and beyond, the data imported for the date of birth should be a Unix timestamp.

Styling

Styling varies from theme to theme. The following has been setup in the birthday block's styles.php file:

.block_birthday .listentry div.user { float: left; } .block_birthday .listentry div.message { float: right; }

Some themes allow for the styles.css to be overridden or added to.

Contributor/Maintainer

The Birthday Block was contributed and is maintained by Anthony Borrow.

See also

Birthday block's Modules and Plugins database entry