<?php /** * Celebrations Plugin * * Index page Todays Celebrations widget for Widget Manager plugin * */ //filtered users $filterid = (int) $vars['entity']->index_todayfilterid; if (!$filterid) { $filterid = 0; } print '<div class="user_settings"><p style="text-align:right">' . elgg_echo('today_celebrations:today') . ' <strong>' . printcelebrationsdate(1, time()) . '</strong></p>'; $row_celebrations = user_celebrations(0, 'next', $filterid); // list of celebrations if (!empty($row_celebrations)) { print '<table width="100%">'; foreach ($row_celebrations as $key => $val) { $sendcelebrationsmessage = ''; if ($val['type'] != 'dieday' && $val['id'] != elgg_get_logged_in_user_guid()) { $sendcelebrationsmessage = '<a class="privatemessages" href="' . elgg_get_site_url() . 'messages/compose?send_to=' . $val['id'] . '" > </a>'; } if (elgg_get_plugin_setting("replaceage", "celebrations") == 'yes' && $val['type'] == 'birthdate') { $age = showage($val['date']) . ' ' . elgg_echo('celebrations:age'); } else { $age = ''; } $even_odd = 'F3F3F3' != $even_odd ? 'F3F3F3' : 'FFFFFF'; echo "<tr bgcolor=\"#{$even_odd}\">"; print '<td><img class="user_mini_avatar" src="' . $val['icon'] . '"> <a href="' . $val['url'] . '" title="' . $val['fullname'] . '">' . $val['name'] . '</a></td><td align="right">' . elgg_echo('today_celebrations:' . $val['type']) . '</td><td align="right">' . $age . '</td><td align="right">' . $sendcelebrationsmessage . '</td></tr>';
$celebrations_day = date('d', $val['date']); } $val['rest'] = $celebrations_day; $row2[$key] = $val; } uasort($row2, 'orderdate'); //sort by day if (!empty($row2)) { foreach ($row2 as $key => $val) { $even_odd = 'F3F3F3' != $even_odd ? 'F3F3F3' : 'FFFFFF'; // Let's call it for individual lines so we can add extra info like marriages, children, links etc. $celebrations_day = gmdate('d', $val['date']); $current_day = date('d', time()); $celebrations_month = gmdate('m', $val['date']); $current_month = date('m', time()); $celebrations_date = printcelebrationsdate(2, $val['date']); // now display a single line echo "<tr bgcolor=\"#{$even_odd}\">"; echo '<td>' . elgg_echo('celebrations:day') . ': ' . $val['rest'] . '</td><td>'; echo '<img class="user_mini_avatar" src="' . $val['icon'] . '"> <a href="' . $val['url'] . '">' . $val['fullname'] . '</a>'; echo '</td>'; // show type of celebration echo '<td>' . elgg_echo('today_celebrations:' . $val['type']) . '</td>'; if ($val['format'] == 'day_anniversary') { if (elgg_get_plugin_setting("replaceage", "celebrations") == 'yes' && $val['type'] == 'birthdate') { echo "<td>" . showage($val['date']) . ' ' . elgg_echo('celebrations:age') . "</td>"; } else { echo "<td>" . $celebrations_date . "</td>"; } } else { echo "<td> </td>";
if (!$show_today) { $show_today = 0; } //draw celebrations if (!empty($row_celebrations)) { print '<table width="100%">'; foreach ($row_celebrations as $key => $val) { if ($show_today == 1 || $val['rest'] >= 1) { $even_odd = 'F3F3F3' != $even_odd ? 'F3F3F3' : 'FFFFFF'; echo "<tr bgcolor=\"#{$even_odd}\">"; $sendcelebrationsmessage = ''; if ($val['rest'] == 0) { if ($val['type'] != 'dieday' && $val['id'] != elgg_get_logged_in_user_guid()) { $sendcelebrationsmessage = '<a class="privatemessages" href="' . elgg_get_site_url() . 'messages/compose?send_to=' . $val['id'] . '" > </a>'; } $daysleftshow = elgg_echo('next_celebrations:today'); } else { if ($val['rest'] == 1) { $daysleftshow = '<abbr title="' . printcelebrationsdate(1, $val['date']) . '">(' . elgg_echo('next_celebrations:dayleft') . ')</abbr>'; } else { $daysleftshow = '<abbr title="' . printcelebrationsdate(1, $val['date']) . '">(' . $val['rest'] . ' ' . elgg_echo('next_celebrations:daysleft') . ')</abbr>'; } } print '<td><img class="user_mini_avatar" src="' . $val['icon'] . '"> <a href="' . $val['url'] . '" title="' . $val['fullname'] . '">' . $val['name'] . '</a></td><td align="right">' . elgg_echo('today_celebrations:' . $val['type']) . '</td><td align="right">' . $daysleftshow . '</td><td align="right">' . $sendcelebrationsmessage . '</td></tr>'; } } print '</table>'; } else { print "<p>" . elgg_echo('next_celebrations:nocelebrations', array($num)) . "</p>"; } print '</div>';
<?php /** * today celebrations output * Displays a date output field * * @package celebrations * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Fernando Graells * @copyright Fernando Graells 2009 * * for Elgg 1.8 and newer by iionly * @copyright iionly 2012 * iionly@gmx.de * * @uses $vars['value'] The current value, if any * */ $birthdate = printcelebrationsdate(2, $vars['value']); $odd_even = $vars['odd_even']; echo htmlentities($birthdate, ENT_QUOTES, 'UTF-8'); // $vars['value'];