本文整理汇总了PHP中Agenda::get_event方法的典型用法代码示例。如果您正苦于以下问题:PHP Agenda::get_event方法的具体用法?PHP Agenda::get_event怎么用?PHP Agenda::get_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agenda
的用法示例。
在下文中一共展示了Agenda::get_event方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
if (empty($_GET['id'])) {
api_not_allowed();
}
$id = explode('_', $_GET['id']);
$type = $id[0];
$id = $id[1];
$agenda = new Agenda();
$agenda->type = $type;
//course,admin or personal
if (isset($_GET['course_id'])) {
$course_info = api_get_course_info_by_id($_GET['course_id']);
if (!empty($course_info)) {
$agenda->set_course($course_info);
}
}
$event = $agenda->get_event($id);
if (!empty($event)) {
define('ICAL_LANG', api_get_language_isocode());
$ical = new vcalendar();
$ical->setConfig('unique_id', api_get_path(WEB_PATH));
$ical->setProperty('method', 'PUBLISH');
$ical->setConfig('url', api_get_path(WEB_PATH));
$vevent = new vevent();
switch ($_GET['class']) {
case 'public':
$vevent->setClass('PUBLIC');
break;
case 'private':
$vevent->setClass('PRIVATE');
break;
case 'confidential':
示例2: show_add_form
/**
* Show the form for adding a new agenda item. This is the same function that is used whenever we are editing an
* agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and
* we have to retrieve the information that is in the database and use this information in the forms.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param integer id, the id of the agenda item we are editing. By default this is empty which means that we are adding an
* agenda item.
* @deprecated
*/
function show_add_form($id = '', $type = null)
{
$htmlHeadXtra[] = to_javascript();
$course_info = null;
$agendaObj = new Agenda();
// if the id is set then we are editing an agenda item
if (!empty($id)) {
$course_info = api_get_course_info();
if (!empty($course_info)) {
$agendaObj->set_course($course_info);
$agendaObj->type = 'course';
} else {
if (api_is_platform_admin() && $type == 'platform') {
$agendaObj->type = 'admin';
} else {
$agendaObj->type = 'personal';
}
}
$agendaItem = $agendaObj->get_event($id);
$title = $agendaItem['title'];
$content = $agendaItem['description'];
// start date
if ($agendaItem['start_date'] != '0000-00-00 00:00:00') {
$agendaItem['start_date'] = api_get_local_time($agendaItem['start_date']);
list($datepart, $timepart) = explode(" ", $agendaItem['start_date']);
list($year, $month, $day) = explode("-", $datepart);
list($hours, $minutes, $seconds) = explode(":", $timepart);
}
// end date
if (!empty($agendaItem['end_date']) && $agendaItem['end_date'] != '0000-00-00 00:00:00') {
$agendaItem['end_date'] = api_get_local_time($agendaItem['end_date']);
list($datepart, $timepart) = explode(" ", $agendaItem['end_date']);
list($end_year, $end_month, $end_day) = explode("-", $datepart);
list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
} else {
if ($agendaItem['all_day']) {
$end_year = $year;
$end_month = $month;
$end_day = $day;
$end_hours = $hours;
$end_minutes = $minutes;
$end_seconds = $seconds;
}
}
// attachments
//edit_added_resources("Agenda", $id);
//$to = $item_2_edit['to'];
} else {
$to = load_edit_users(TOOL_CALENDAR_EVENT, $id);
}
// we start a completely new item, we do not come from the resource linker
if (isset($_GET['originalresource']) && $_GET['originalresource'] !== "no" and $_GET['action'] == "add") {
$_SESSION["formelements"] = null;
unset_session_resources();
}
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$idAttach = isset($_GET['id_attach']) ? Security::remove_XSS($_GET['id_attach']) : null;
$course_url = empty($course_info) ? null : api_get_cidreq();
$id = isset($id) ? intval($id) : null;
$url = api_get_self() . '?type=' . Security::remove_XSS($type) . '&origin=' . $origin . '&' . $course_url . '&sort=asc&toolgroup=' . api_get_group_id() . '&action=' . Security::remove_XSS($_GET['action']);
$form = new FormValidator('new_calendar_item', 'post', $url, null, array('enctype' => 'multipart/form-data'));
$form->addElement('hidden', 'id', $id);
$form->addElement('hidden', 'action', $action);
$form->addElement('hidden', 'id_attach', $idAttach);
$form->addElement('hidden', 'sort', 'asc');
$form->addElement('hidden', 'submit_event', 'ok');
// The form title
if (isset($id) and $id != '') {
$form_title = get_lang('ModifyCalendarItem');
} else {
$form_title = get_lang('AddCalendarItem');
}
$form->addElement('header', $form_title);
$form->addElement('text', 'title', get_lang('ItemTitle'));
// selecting the users / groups
$group_id = api_get_group_id();
if (empty($id)) {
if (isset($group_id) && !empty($group_id)) {
$form->addElement('hidden', 'selected_form[0]', "GROUP:'.{$group_id}.'");
$form->addElement('hidden', 'To', 'true');
//$form .= '<input type="hidden" name="selected_form[0]" value="GROUP:'.$group_id.'"/>';
//$form .= '<input type="hidden" name="To" value="true"/>';
} else {
$agendaObj->show_to_form($form, $to);
}
}
// start date and time
$form->addElement('text', 'start_date', get_lang('StartDate'));
$form->addElement('text', 'end_date', get_lang('EndDate'));
// Repeating the calendar item
//.........这里部分代码省略.........
示例3: substr
$endDate = substr($values['repeat_end_day'], 0, 10) . ' 23:59:59';
$agenda->addRepeatedItem($eventId, $values['repeat_type'], $endDate, $values['users_to_send']);
}
Display::return_message(get_lang('AddSuccess'), 'confirmation');
if ($sendEmail) {
Display::return_message(get_lang('AdditionalMailWasSentToSelectedUsers'), 'confirmation');
}
header("Location: {$agendaUrl}");
exit;
} else {
$content = $form->return_form();
}
break;
case 'edit':
$actionName = get_lang('Edit');
$event = $agenda->get_event($eventId);
if (empty($event)) {
api_not_allowed(true);
}
$event['action'] = 'edit';
$event['id'] = $eventId;
$form = $agenda->getForm($event);
if ($form->validate()) {
$values = $form->getSubmitValues();
$allDay = isset($values['all_day']) ? 'true' : 'false';
$startDate = $values['date_range_start'];
$endDate = $values['date_range_end'];
$sendAttachment = isset($_FILES['user_upload']) ? true : false;
$attachment = $sendAttachment ? $_FILES['user_upload'] : null;
$attachmentComment = isset($values['file_comment']) ? $values['file_comment'] : null;
$comment = isset($values['comment']) ? $values['comment'] : null;
示例4: show_add_form
/**
* Show the form for adding a new agenda item. This is the same function that is used whenever we are editing an
* agenda item. When the id parameter is empty (default behaviour), then we show an empty form, else we are editing and
* we have to retrieve the information that is in the database and use this information in the forms.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @param integer id, the id of the agenda item we are editing. By default this is empty which means that we are adding an
* agenda item.
*/
function show_add_form($id = '', $type = null)
{
$showImg = Display::return_icon('div_show.gif');
$hideImg = Display::return_icon('div_hide.gif');
$MonthsLong = api_get_months_long();
$htmlHeadXtra[] = to_javascript();
// the default values for the forms
if (!isset($_GET['originalresource'])) {
$day = date('d');
$month = date('m');
$year = date('Y');
$hours = 9;
$minutes = '00';
$title = null;
$content = null;
$repeat = false;
} else {
// we are coming from the resource linker so there might already have been some information in the form.
// When we clicked on the button to add resources we stored every form information into a session and now we
// are doing the opposite thing: getting the information out of the session and putting it into variables to
// display it in the forms.
$title = $form_elements['title'];
$content = $form_elements['content'];
$id = $form_elements['id'];
$to = $form_elements['to'];
$repeat = $form_elements['repeat'];
}
// switching the send to all/send to groups/send to users
if (isset($_POST['To']) && $_POST['To']) {
$day = $_POST['fday'];
$month = $_POST['fmonth'];
$year = $_POST['fyear'];
$hours = $_POST['fhour'];
$minutes = $_POST['fminute'];
$end_day = $_POST['end_fday'];
$end_month = $_POST['end_fmonth'];
$end_year = $_POST['end_fyear'];
$end_hours = $_POST['end_fhour'];
$end_minutes = $_POST['end_fminute'];
$title = $_POST['title'];
$content = $_POST['content'];
// the invisible fields
$action = $_POST['action'];
$id = $_POST['id'];
$repeat = !empty($_POST['repeat']) ? true : false;
}
$default_no_empty_end_date = 0;
$course_info = null;
// if the id is set then we are editing an agenda item
if (!empty($id)) {
$course_info = api_get_course_info();
$agendaObj = new Agenda();
if (!empty($course_info)) {
$agendaObj->set_course($course_info);
$agendaObj->type = 'course';
} else {
if (api_is_platform_admin() && $type == 'platform') {
$agendaObj->type = 'admin';
} else {
$agendaObj->type = 'personal';
}
}
$agendaItem = $agendaObj->get_event($id);
$title = $agendaItem['title'];
$content = $agendaItem['description'];
// start date
if ($agendaItem['start_date'] != '0000-00-00 00:00:00') {
$agendaItem['start_date'] = api_get_local_time($agendaItem['start_date']);
list($datepart, $timepart) = explode(" ", $agendaItem['start_date']);
list($year, $month, $day) = explode("-", $datepart);
list($hours, $minutes, $seconds) = explode(":", $timepart);
}
// end date
if (!empty($agendaItem['end_date']) && $agendaItem['end_date'] != '0000-00-00 00:00:00') {
$agendaItem['end_date'] = api_get_local_time($agendaItem['end_date']);
list($datepart, $timepart) = explode(" ", $agendaItem['end_date']);
list($end_year, $end_month, $end_day) = explode("-", $datepart);
list($end_hours, $end_minutes, $end_seconds) = explode(":", $timepart);
}
} else {
$to = load_edit_users(TOOL_CALENDAR_EVENT, $id);
}
$content = stripslashes($content);
$title = stripslashes($title);
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
$course_url = empty($course_info) ? null : api_get_cidreq();
// The form title
if (isset($id) and $id != '') {
$form_title = get_lang('ModifyCalendarItem');
} else {
$form_title = get_lang('AddCalendarItem');
}
//.........这里部分代码省略.........