Exemplo n.º 1
0
function create_day_menu()
{
    global $phpc_month, $phpc_day, $phpc_year;
    $html = tag('div', attrs('class="phpc-bar ui-widget-content"'));
    $monthname = month_name($phpc_month);
    $lasttime = mktime(0, 0, 0, $phpc_month, $phpc_day - 1, $phpc_year);
    $lastday = date('j', $lasttime);
    $lastmonth = date('n', $lasttime);
    $lastyear = date('Y', $lasttime);
    $lastmonthname = month_name($lastmonth);
    $last_args = array('year' => $lastyear, 'month' => $lastmonth, 'day' => $lastday);
    menu_item_prepend($html, "{$lastmonthname} {$lastday}", 'display_day', $last_args);
    $nexttime = mktime(0, 0, 0, $phpc_month, $phpc_day + 1, $phpc_year);
    $nextday = date('j', $nexttime);
    $nextmonth = date('n', $nexttime);
    $nextyear = date('Y', $nexttime);
    $nextmonthname = month_name($nextmonth);
    $next_args = array('year' => $nextyear, 'month' => $nextmonth, 'day' => $nextday);
    menu_item_append($html, "{$nextmonthname} {$nextday}", 'display_day', $next_args);
    return $html;
}
Exemplo n.º 2
0
function navbar()
{
    global $vars, $action, $config, $year, $month, $day;
    $html = tag('div', attributes('class="phpc-navbar"'));
    if (can_add_event() && $action != 'add') {
        menu_item_append($html, _('Add Event'), 'event_form', $year, $month, $day);
    }
    if ($action != 'search') {
        menu_item_append($html, _('Search'), 'search', $year, $month, $day);
    }
    if (!empty($vars['day']) || !empty($vars['id']) || $action != 'display') {
        menu_item_append($html, _('Back to Calendar'), 'display', $year, $month);
    }
    if ($action != 'display' || !empty($vars['id'])) {
        menu_item_append($html, _('View date'), 'display', $year, $month, $day);
    }
    if (is_user()) {
        menu_item_append($html, _('Log out'), 'logout', empty($vars['year']) ? false : $year, empty($vars['month']) ? false : $month, empty($vars['day']) ? false : $day, $action);
    } else {
        menu_item_append($html, _('Log in'), 'login', empty($vars['year']) ? false : $year, empty($vars['month']) ? false : $month, empty($vars['day']) ? false : $day, $action);
    }
    if (is_admin() && $action != 'admin') {
        menu_item_append($html, _('Admin'), 'admin');
    }
    if (isset($var['display']) && $var['display'] == 'day') {
        $monthname = month_name($month);
        $lasttime = mktime(0, 0, 0, $month, $day - 1, $year);
        $lastday = date('j', $lasttime);
        $lastmonth = date('n', $lasttime);
        $lastyear = date('Y', $lasttime);
        $lastmonthname = month_name($lastmonth);
        $nexttime = mktime(0, 0, 0, $month, $day + 1, $year);
        $nextday = date('j', $nexttime);
        $nextmonth = date('n', $nexttime);
        $nextyear = date('Y', $nexttime);
        $nextmonthname = month_name($nextmonth);
        menu_item_prepend($html, "{$lastmonthname} {$lastday}", 'display', $lastyear, $lastmonth, $lastday);
        menu_item_append($html, "{$nextmonthname} {$nextday}", 'display', $nextyear, $nextmonth, $nextday);
    }
    return $html;
}