本文整理汇总了PHP中calendar::add_calendar方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::add_calendar方法的具体用法?PHP calendar::add_calendar怎么用?PHP calendar::add_calendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar
的用法示例。
在下文中一共展示了calendar::add_calendar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
if (!$calendar['read_permission'] && !$calendar['write_permission']) {
//hmm no calendar_id given and default calendar is set
//Does this user even have calendars?
$cal->get_user_calendars($GO_SECURITY->user_id);
if ($cal->next_record()) {
//yes he does so set it default
$calendar_id = $cal->f('id');
} else {
$calendar_name = $_SESSION['GO_SESSION']['name'];
$new_calendar_name = $calendar_name;
$x = 1;
while ($cal->get_calendar_by_name($new_calendar_name)) {
$new_calendar_name = $calendar_name . ' (' . $x . ')';
$x++;
}
if (!($calendar_id = $cal->add_calendar($GO_SECURITY->user_id, addslashes($new_calendar_name), 7, 20))) {
$feedback = '<p class="Error">' . $strSaveError . '</p>';
}
}
$calendar = $cal->get_calendar($calendar_id);
if ($calendar) {
$calendar['read_permission'] = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $calendar['acl_read']);
$calendar['write_permission'] = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $calendar['acl_write']);
}
if (!$calendar['read_permission'] && !$calendar['write_permission']) {
header('Location: ' . $GO_CONFIG->host . 'error_docs/401.php');
exit;
}
}
$title = $calendar['name'];
$cal_start_hour = $calendar['start_hour'];
示例2: header
if ($calendar_id > 0) {
$existing_calendar = $cal->get_calendar_by_name($name);
if ($existing_calendar && $existing_calendar['id'] != $calendar_id) {
$feedback = "<p class=\"Error\">" . $sc_calendar_exists . "</p>";
} else {
$cal->update_calendar($calendar_id, $name, $_POST['calendar_start_hour'], $_POST['calendar_end_hour']);
if ($_POST['close'] == 'true') {
header('Location: ' . $return_to);
exit;
}
}
} else {
if ($cal->get_calendar_by_name($name)) {
$feedback = "<p class=\"Error\">" . $sc_calendar_exists . "</p>";
} else {
if ($calendar_id = $cal->add_calendar($GO_SECURITY->user_id, $name, $_POST['calendar_start_hour'], $_POST['calendar_end_hour'])) {
$db = new db();
$db->query("INSERT INTO cal_config VALUES ('" . $GO_SECURITY->user_id . "','" . $calendar_id . "')");
if ($_POST['close'] == 'true') {
header('Location: ' . $return_to);
exit;
}
} else {
$feedback = "<p class=\"Error\">" . $strSaveError . "</p>";
}
}
}
}
} else {
$feedback = "<p class=\"Error\">" . $error_missing_field . "</p>";
}