示例#1
0
function month_navbar($month, $year)
{
    $html = tag('div', attributes('class="phpc-navbar"'));
    menu_item_append($html, _('last year'), 'display', $year - 1, $month);
    menu_item_append($html, _('last month'), 'display', $year, $month - 1);
    for ($i = 1; $i <= 12; $i++) {
        menu_item_append($html, short_month_name($i), 'display', $year, $i);
    }
    menu_item_append($html, _('next month'), 'display', $year, $month + 1);
    menu_item_append($html, _('next year'), 'display', $year + 1, $month);
    return $html;
}
示例#2
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;
}
示例#3
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;
}
示例#4
0
function navbar()
{
    global $vars, $action, $phpc_year, $phpc_month, $phpc_day, $phpc_cal;
    $html = tag('div', attrs('class="phpc-bar ui-widget-header"'));
    $args = array('year' => $phpc_year, 'month' => $phpc_month, 'day' => $phpc_day);
    // TODO There needs to be a better way to decide what to show
    if (isset($phpc_cal) && $phpc_cal->can_write() && $action != 'add') {
        menu_item_append($html, __('Add Event'), 'event_form', $args);
    }
    if ($action != 'search') {
        menu_item_append($html, __('Search'), 'search', $args);
    }
    if ($action != 'display_month') {
        menu_item_append($html, __('View Month'), 'display_month', $args);
    }
    if ($action == 'display_event') {
        menu_item_append($html, __('View date'), 'display_day', $args);
    }
    if (isset($phpc_cal) && $phpc_cal->can_admin() && $action != 'cadmin') {
        menu_item_append($html, __('Calendar Admin'), 'cadmin');
    }
    if (is_admin() && $action != 'admin') {
        menu_item_append($html, __('Admin'), 'admin');
    }
    return $html;
}
示例#5
0
function navbar()
{
    global $vars, $action, $year, $month, $day, $phpc_cal;
    $html = tag('div', attributes('class="phpc-bar ui-widget-header"'));
    $args = array('year' => $year, 'month' => $month, 'day' => $day);
    if ($phpc_cal->can_write() && $action != 'add') {
        menu_item_append($html, __('Add Event'), 'event_form', $args);
    }
    if ($action != 'search') {
        menu_item_append($html, __('Search'), 'search', $args);
    }
    if ($action != 'display_month') {
        menu_item_append($html, __('View Month'), 'display_month', $args);
    }
    if ($action == 'display_event') {
        menu_item_append($html, __('View date'), 'display_day', $args);
    }
    if ($phpc_cal->can_admin() && $action != 'cadmin') {
        menu_item_append($html, __('Calendar Admin'), 'cadmin');
    }
    if (is_admin() && $action != 'admin') {
        menu_item_append($html, __('Admin'), 'admin');
    }
    return $html;
}