예제 #1
0
function display_month()
{
    global $phpc_month, $phpc_year, $phpc_home_url, $phpcid;
    $months = array();
    for ($i = 1; $i <= 12; $i++) {
        $m = month_name($i);
        $months["{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$i}&amp;year={$phpc_year}"] = $m;
    }
    $years = array();
    for ($i = $phpc_year - 5; $i <= $phpc_year + 5; $i++) {
        $years["{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$phpc_month}&amp;year={$i}"] = $i;
    }
    $next_month = $phpc_month + 1;
    $next_year = $phpc_year;
    if ($next_month > 12) {
        $next_month -= 12;
        $next_year++;
    }
    $prev_month = $phpc_month - 1;
    $prev_year = $phpc_year;
    if ($prev_month < 1) {
        $prev_month += 12;
        $prev_year--;
    }
    $heading = tag('', tag('a', attrs('class="phpc-icon-link"', "href=\"{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$prev_month}&amp;year={$prev_year}\""), tag('span', attrs('class="fa fa-chevron-left"'), '')), create_dropdown_list(month_name($phpc_month), $months), create_dropdown_list($phpc_year, $years), tag('a', attrs('class="phpc-icon-link"', "href=\"{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$next_month}&amp;year={$next_year}\""), tag('span', attrs('class="fa fa-chevron-right"'), '')));
    return create_display_table($heading, create_month($phpc_month, $phpc_year));
}
예제 #2
0
function display_month()
{
    global $month, $year, $phpc_home_url, $phpcid;
    $heading_html = tag('tr');
    $heading_html->add(tag('th', __p('Week', 'W')));
    for ($i = 0; $i < 7; $i++) {
        $d = ($i + day_of_week_start()) % 7;
        $heading_html->add(tag('th', day_name($d)));
    }
    $months = array();
    for ($i = 1; $i <= 12; $i++) {
        $m = month_name($i);
        $months["{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$i}&amp;year={$year}"] = $m;
    }
    $years = array();
    for ($i = $year - 5; $i <= $year + 5; $i++) {
        $years["{$phpc_home_url}?action=display_month&amp;phpcid={$phpcid}&amp;month={$month}&amp;year={$i}"] = $i;
    }
    return tag('', tag("div", attributes('id="phpc-summary-view"'), tag("div", attributes('id="phpc-summary-head"'), tag("div", attributes('id="phpc-summary-title"'), ''), tag("div", attributes('id="phpc-summary-author"'), ''), tag("div", attributes('id="phpc-summary-category"'), ''), tag("div", attributes('id="phpc-summary-time"'), '')), tag("div", attributes('id="phpc-summary-body"'), '')), tag('table', attributes('class="phpc-main phpc-calendar"'), tag('caption', create_dropdown_list(month_name($month), $months), create_dropdown_list($year, $years)), tag('colgroup', tag('col', attributes('class="phpc-week"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"')), tag('col', attributes('class="phpc-day"'))), tag('thead', $heading_html), create_month($month, $year)));
}
예제 #3
0
        $name = $_SESSION['USER_LOGGED_IN']['Username'];
        $check = $phpcdb->get_user_by_name($name);
        $_SESSION['USER_LOGGED_IN']['calid'] = $check->uid;
        if ($check) {
            login_user($name);
        } else {
            $phpcdb->create_user($name, '123456', 0);
            login_user($name);
        }
    }
    $calendars = $phpcdb->get_calendars();
    $list = array();
    foreach ($calendars as $calendar) {
        $list["{$phpc_home_url}?phpcid={$calendar->get_cid()}"] = $calendar->get_title();
    }
    $calendar_title = $phpc_cal->get_title();
    $content = tag('div', attributes('class="php-calendar ui-widget"'), tag('br', attrs('style="clear:both;"')), tag('h1', attrs('class="ui-widget-header"'), create_dropdown_list(tag('a', attrs("href='{$phpc_home_url}?phpcid={$phpc_cal->get_cid()}'", 'class="phpc-dropdown-list-title"'), $calendar_title), $list)), display_phpc());
} catch (Exception $e) {
    $calendar_title = $e->getMessage();
    $content = tag('div', attributes('class="php-calendar"'), $e->getMessage());
}
$html = tag('html', attrs("lang=\"{$phpc_lang}\""), tag('head', tag('title', $calendar_title), tag('link', attrs('rel="icon"', "href=\"static/office-calendar.png\"")), get_header_tags("static"), tag('meta', attrs('http-equiv="Content-Type"', 'content="text/html; charset=UTF-8"'))), tag('body', $content));
echo '<!DOCTYPE html>', "\n", $html->toString();
?>

	<?php 
include "../../../includes/scripts.php";
?>
	
<?php 
include "../../includes/endBody.php";
예제 #4
0
function display_phpc()
{
    global $phpc_messages, $phpc_redirect, $phpc_script, $phpc_prefix, $phpc_title, $phpcdb, $phpc_cal, $phpc_home_url;
    $navbar = false;
    try {
        $calendars = $phpcdb->get_calendars();
        $list = array();
        if (isset($phpc_cal)) {
            $phpc_title = $phpc_cal->get_title();
            $title_link = tag('a', attrs("href='{$phpc_home_url}?phpcid={$phpc_cal->get_cid()}'", 'class="phpc-dropdown-list-title"'), $phpc_title);
        } else {
            $phpc_title = __("(No calendars)");
            $title_link = $phpc_title;
        }
        foreach ($calendars as $calendar) {
            $list["{$phpc_home_url}?phpcid={$calendar->get_cid()}"] = $calendar->get_title();
        }
        if (sizeof($calendars) > 1) {
            $title_tag = create_dropdown_list($title_link, $list);
        } else {
            $title_tag = $title_link;
        }
        $content = do_action();
        if (sizeof($phpc_messages) > 0) {
            $messages = tag('div');
            foreach ($phpc_messages as $message) {
                $messages->add($message);
            }
            // If we're redirecting, the messages might not get
            //   seen, so don't clear them
            if (empty($phpc_redirect)) {
                $_SESSION["{$phpc_prefix}messages"] = NULL;
            }
        } else {
            $messages = '';
        }
        return tag('div', attrs('class="php-calendar ui-widget"'), userMenu(), tag('br', attrs('style="clear:both;"')), tag('div', attrs('class="phpc-title ui-widget-header"'), $title_tag), navbar(), $messages, $content, footer());
    } catch (PermissionException $e) {
        $msg = __('You do not have permission to do that: ') . $e->getMessage();
        if (is_user()) {
            return error_message_redirect($msg, $phpc_script);
        } else {
            return error_message_redirect($msg, "{$phpc_script}?action=login");
        }
    } catch (InvalidInputException $e) {
        return error_message_redirect($e->getMessage(), $e->target);
    } catch (Exception $e) {
        return display_exception($e, $navbar);
    }
}