Example #1
0
$day_month = elgg_echo("date:month:" . str_pad($date_array["mon"], 2, 0, STR_PAD_LEFT), array($date_array["mday"]));
$day_month_year = $day_month . " " . $date_array["year"];
$old_style = elgg_view("output/date", array("value" => time()));
$output_format_options = array($day_month => "day_month", $day_month_year => "day_month_year", $old_style => "old_style");
$yesno_options = array("yes" => elgg_echo("option:yes"), "no" => elgg_echo("option:no"));
// field selection
$field_selection = "<div>" . elgg_echo("birthdays:settings:field_selection:description") . "</div>";
if (!empty($available_fields)) {
    $options = array(elgg_echo("birthdays:settings:field_selection:none") => "");
    foreach ($available_fields as $metadata_name => $type) {
        $label = $metadata_name;
        if (elgg_echo("profile:" . $metadata_name) != "profile:" . $metadata_name) {
            $label = elgg_echo("profile:" . $metadata_name);
        }
        $options[$label] = $metadata_name;
    }
    $field_selection .= elgg_view("input/radio", array("name" => "params[birthday_field]", "options" => $options, "value" => $plugin->birthday_field));
} else {
    $field_selection .= "<div>" . elgg_echo("notfound") . "</div>";
}
echo elgg_view_module("inline", elgg_echo("birthdays:settings:field_selection"), $field_selection);
// output format
$output_format = "<div>" . elgg_echo("birthdays:settings:output_format:description") . "</div>";
$output_format .= elgg_view("input/radio", array("name" => "params[output_format]", "options" => $output_format_options, "value" => birthdays_get_output_date_format()));
echo elgg_view_module("inline", elgg_echo("birthdays:settings:output_format"), $output_format);
// other
$other = "<div>";
$other .= elgg_echo("birthdays:settings:other:limit_upcoming");
$other .= "&nbsp;" . elgg_view("input/dropdown", array("name" => "params[limit_upcoming]", "options_values" => $yesno_options, "value" => $plugin->limit_upcoming));
$other .= "</div>";
echo elgg_view_module("inline", elgg_echo("birthdays:settings:other"), $other);
Example #2
0
<?php

/**
 * This is a wrapper view for output/date, to be sure when something changes in Elgg core you don't have to change your profile configuration
 *
 * @uses $vars['value'] 	the value of the bithday field
 *
 * Supports values in the following formats:
 * - unix timestamp
 * - yyyy-mm-dd
 */
$output_format = birthdays_get_output_date_format();
if ($output_format == "old_style") {
    echo elgg_view("output/date", $vars);
} else {
    $value = elgg_extract("value", $vars);
    if (is_numeric($value)) {
        // unix timestamp
        $date_array = getdate($value);
    } else {
        // asume yyyy-mm-dd
        $date_array = getdate(strtotime($value));
    }
    $string = elgg_echo("date:month:" . str_pad($date_array["mon"], 2, 0, STR_PAD_LEFT), array($date_array["mday"]));
    if ($output_format == "day_month_year") {
        $string .= " " . $date_array["year"];
    }
    echo $string;
}