本文整理汇总了PHP中calendar::get_calendar_by_name方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::get_calendar_by_name方法的具体用法?PHP calendar::get_calendar_by_name怎么用?PHP calendar::get_calendar_by_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar
的用法示例。
在下文中一共展示了calendar::get_calendar_by_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
//get the calendar properties and check permissions
if ($calendar_id != 0 && ($calendar = $cal->get_calendar($calendar_id))) {
$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']) {
//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;
示例2: unlink
if ($cal->import_ical_file($GO_SECURITY->user_id, $_FILES['ical_file']['tmp_name'], $calendar_id)) {
$feedback = '<p class="Success">' . $cal_import_success . '</p>';
} else {
$feedback = '<p class="Error">' . $strDataError . '</p>';
}
unlink($_FILES['ical_file']['tmp_name']);
}
break;
case 'save':
$name = smart_addslashes(trim($_POST['name']));
if ($name != "") {
if ($_POST['calendar_start_hour'] > $_POST['calendar_end_hour']) {
$feedback = '<p class="Error">' . $error_invalid_hour_range . '</p>';
} else {
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();