Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.Dismiss Notice
Introduction(top)The birthday element provides three dropdowns enabling users to select a date (which may or may not be their birthday!)
Options - Labels(top)
- Day label - The label for the day drop down
- Month label - The label for the month drop down.
- Year label - The label for the year drop down.
Options - form(top)
- List generation method- Defines how the year dropdown list is populated.
- Number of years - how many previous years should the dropdown contains. E.g. if 100 entered and this year is 2013, then there will be 100 options with the oldest year being 1913
- Since year - Enter the oldest year at which the select list will start from in 'Number of years /start year'
- Number of years / start year - Value to define the oldest year to show in the year select list. See 'List generation method' for examples of what can be used in this field.
- Years forward / backward - Define an offset for the most recent year to show in the year select list. The default is 0, that means the list ends with current year. Negative number means years backward, e.g -10 means in 2012 that the list ends with year 2002
Options - details(top)
- Date format - the format to use for the date when showing in the details view
- Append age - should the date's age also be appended to the date.
Options - list(top)
- Date format - The date format to use when rendering the date in the list view
- Age / anniversary- Choose whether to append the age or an anniversary to the date.
- Only date - don't append the age
- Show only the age / anniversary without date
- or how to combine age/anv with dates.
- Combinations of dates use the same date format, which you have previously selected
- Save empty dates as null - Sometimes is useful that 'no date' means NULL value in database, sometimes you may prefer null dates ('0000-00-00'). <br />YES is recommended when you use Fabrik to work with another component's data, e.g EventList where empty date MUST BE NULL. <br />NO is recommended when this element is in joined repeated group AND shown in list view in merged mode AND you submit/edit its data using this list's original form. When you have earlier submitted empty data and you decide to change this option then you should resave them to get '0000-00-00' instead of NULL or vice versa.
A brief tutorial(top)
List view of people and their birthdays (anniversaries) is present, the format / detail views as well. But how to show the list next year's jubilees?
1) Make a copy of the existing Fabrik table
2) in your new table, find the Birthday element which shows the birthday's. Open it and remove the link to the parent element. Now you can change the properties of that element.
3) in 'List View: age / anniversary' select 'Next year's anniversaries'
Now your new table shows all at all bd-s/anv-s what bd/anv would be next year and also their birth dates (format depends of your chosen date format). Example: 44 (23.06.1967) Jubilarian's bd/anv is highlighted (bold text). Example: 500 (June 23, 1511)
OK, but you only want jubilarians?
In this case, you need to add a pre-filter to this table view: 'tables_pk' 'IN', 'SELECT FROM table WHERE tables_pk SUBSTRING ((YEAR (DATE_ADD (CURDATE (), INTERVAL 1 YEAR)) - YEAR (anv_field)), -2) IN ('00' , '10 ', '20', '25 ', '30', '40 ', '50', '60 ', '70', '75 ', '80', '90 ')' and as value type select 'Query'.
Check if older than 18(top)
$bd = new DateTime();
$bits = explode('-', $data);
$year = JArrayHelper::getValue($bits, 0, '');
$month = JArrayHelper::getValue($bits, 1, '');
$day = JArrayHelper::getValue($bits, 2, '');
$bd->setDate($year, $month, $day);
$limit = new DateTime();
return $bd <= $limit;
daydah likes this.