本文整理汇总了PHP中Calendar::addEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::addEvent方法的具体用法?PHP Calendar::addEvent怎么用?PHP Calendar::addEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::addEvent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XMLTimeTableToICAL
/**
* Convert an XML timetable to ICAL
*/
function XMLTimeTableToICAL($raw)
{
global $CAMPUSM_XML;
$cal = new Calendar();
// This is a bit of a mess
$parsed = new SimpleXMLElement($raw);
// Extract the children of the children with the correct namespace
$entries = $parsed->children($CAMPUSM_XML)->children($CAMPUSM_XML);
foreach ($entries->calitem as $calitem) {
$cal->addEvent(new CalendarEvent($calitem->desc1, $calitem->locCode, new DateTime($calitem->start), new DateTime($calitem->end), $calitem->desc2));
}
return $cal;
}
示例2: addEvent
/**
* Add an event to the array of active events
* @param object
* @param integer
* @param integer
* @param string
* @param string
*/
protected function addEvent($objEvent, $intStart, $intEnd, $strUrl, $strLink)
{
parent::addEvent($objEvent, $intStart, $intEnd, $strUrl, $strLink);
if ($GLOBALS['tags']['showInFeeds']) {
if ($intStart < time()) {
return;
}
$intKey = date('Ymd', $intStart);
$lastindex = count($this->arrEvents[$intKey][$intStart]) - 1;
$tags = $this->getTagsForTableAndId('tl_calendar_events', $objEvent->id);
if (strlen($tags)) {
$this->arrEvents[$intKey][$intStart][$lastindex]['description'] .= $tags;
}
}
}
示例3: elseif
} elseif ($e['appointment_status'] === "student_arrived") {
$category = "st-arrived";
} elseif ($e['appointment_status'] === "follow_up_complete") {
$category = "follow-up-complete";
}
if ($e['appointment_description'] == null) {
$e['appointment_description'] = "";
}
//Create the event array the itself holds event objects
$event_array[] = array('id' => $e['event_id'], 'parent_event_id' => $e['parent_event_id'], 'emp_id' => $e['emp_id'], 'last_modified' => $e['last_modified'], 'lm_fname' => $e['lm_fname'], 'lm_lname' => $e['lm_lname'], 'updated_on' => $l10nDate->format($e['updated_on'], 'date_time'), 'series' => $e['recurrence_parent_event_id'], 'invited' => "", 'creator_alt' => "", 'invited_alt' => "", 'cfname' => $e['first_name'], 'clname' => $e['last_name'], 'title' => $e['label'], 'type' => $e['appointment_type_id'], 'start' => $e['appointment_start'], 'end' => $e['appointment_end'], 'className' => $category, 'description' => $e['appointment_description'], 'sname' => $e['st_fname'] . ' ' . $e['st_lname'], 'snumber' => $e['student'], 'estatus' => $e['appointment_status'], 'arrivalstatus' => $e['student_arrival_status'], 'allDay' => $e['all_day'] === "1" ? true : false, 'color' => $e['background_color'], 'textColor' => $e['text_color'], 'borderColor' => "white", 'dass_alert' => $e['dass_alert'], 'dass_count' => $e['dass_count']);
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($event_array);
exit;
} elseif ($_GET['page'] === "add-event") {
$cal->addEvent($_POST);
$loggers['audit']->info("Event added to calendar");
} elseif ($_GET['page'] === "delete-event") {
if ($_POST['series'] !== 'true') {
$cal->deleteEvent($_POST['event_id']);
$loggers['audit']->info("Event {$_POST['event_id']} deleted from calendar");
} else {
$cal->deleteFutureEvents($_POST['event_id'], $_POST['recurrence_parent_event_id']);
$loggers['audit']->info("All future events of recurrence parent event {$_POST['event_id']} deleted from calendar");
}
} elseif ($_GET['page'] === "update-event") {
if (isset($_POST['update_recurring']) && $_POST['update_recurring'] === 'all-future') {
$cal->updateFutureEvents($_POST['event_id'], $_POST);
$loggers['audit']->info("All future events of recurrence parent event {$_POST['event_id']} updated in calendar");
} else {
$cal->updateEvent($_POST['event_id'], $_POST);
示例4: Calendar
</form></div></div>-->
<?php
$cal = new Calendar($this->curDate);
// $cal->addEvent('event 1');
// $cal->addEvent('event 2', 10);
//$cal->addEvent('event 3', 10, 10);
// $cal->addEvent('event 4', 10, 10, 10);
foreach ($this->event as $val) {
$event = $val['keterangan'];
$tgl = str_replace("-", "", $val['tgl']);
$date = substr($tgl, -2);
$month = substr($tgl, 4, 2);
$year = substr($tgl, 2, 2);
// echo $year.'-'.$month.'-'.$date.'-'.$event;
$cal->addEvent($event, $date, $month, $year);
}
echo "<div id=table-wrapper>";
$cal->makeCalendar();
//$cal->makeEvents();
echo "</div>";
?>
<!-- </td></tr></table>-->
<script>
$(document).ready(function(){
// $('#form-wrapper').fadeOut(0);
$('#warning').fadeOut(0);
});
示例5: _addActivityScheduleEvent
//.........这里部分代码省略.........
}
/* Bail out if we don't have a valid event type. */
if (!$this->isRequiredIDValid('eventTypeID', $_POST)) {
CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid event type ID.');
}
/* Bail out if we don't have a valid time format ID. */
if (!isset($_POST['allDay']) || $_POST['allDay'] != '0' && $_POST['allDay'] != '1') {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid time format ID.');
}
$eventTypeID = $_POST['eventTypeID'];
if ($_POST['allDay'] == 1) {
$allDay = true;
} else {
$allDay = false;
}
$publicEntry = $this->isChecked('publicEntry', $_POST);
$reminderEnabled = $this->isChecked('reminderToggle', $_POST);
$reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
$reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
$duration = -1;
/* Is this a scheduled event or an all day event? */
if ($allDay) {
$date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD);
$hour = 12;
$minute = 0;
$meridiem = 'AM';
} else {
/* Bail out if we don't have a valid hour. */
if (!isset($_POST['hour'])) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.');
}
/* Bail out if we don't have a valid minute. */
if (!isset($_POST['minute'])) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.');
}
/* Bail out if we don't have a valid meridiem value. */
if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid meridiem value.');
}
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$meridiem = $_POST['meridiem'];
/* Convert formatted time to UNIX timestamp. */
$time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem));
/* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
$date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time));
}
$description = $this->getTrimmedInput('description', $_POST);
$title = $this->getTrimmedInput('title', $_POST);
/* Bail out if any of the required fields are empty. */
if (empty($title)) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.');
}
if ($regardingID > 0) {
$eventJobOrderID = $regardingID;
} else {
$eventJobOrderID = -1;
}
$calendar = new Calendar($this->_siteID);
$eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $contactID, DATA_ITEM_CONTACT, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset());
if ($eventID <= 0) {
CommonErrors::fatalModal(COMMONERROR_RECORDERROR, $this, 'Failed to add calendar event.');
}
/* Extract the date parts from the specified date. */
$parsedDate = strtotime($date);
$formattedDate = date('l, F jS, Y', $parsedDate);
$calendar = new Calendar($this->_siteID);
$calendarEventTypes = $calendar->getAllEventTypes();
$eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description');
$eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate));
$eventScheduled = true;
} else {
$eventHTML = '<p>No event has been scheduled.</p>';
$eventScheduled = false;
}
if (isset($_GET['onlyScheduleEvent'])) {
$onlyScheduleEvent = true;
} else {
$onlyScheduleEvent = false;
}
if (!$activityAdded && !$eventScheduled) {
$changesMade = false;
} else {
$changesMade = true;
}
if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) {
return;
}
$this->_template->assign('contactID', $contactID);
$this->_template->assign('regardingID', $regardingID);
$this->_template->assign('activityAdded', $activityAdded);
$this->_template->assign('activityDescription', $activityNote);
$this->_template->assign('activityType', $activityTypeDescription);
$this->_template->assign('eventScheduled', $eventScheduled);
$this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
$this->_template->assign('eventHTML', $eventHTML);
$this->_template->assign('changesMade', $changesMade);
$this->_template->assign('isFinishedMode', true);
$this->_template->display('./modules/contacts/AddActivityScheduleEventModal.tpl');
}
示例6: get_view
/**
* Return the calendar
*/
public function get_view($date = '', $type = '', $widget = 0, $ecwd_views, $preview)
{
require_once 'calendar-class.php';
$categories = get_categories(array('taxonomy' => ECWD_PLUGIN_PREFIX . '_event_category'));
$tags = get_terms('ecwd_event_tag', array('hide_empty' => false));
//Get events data
//Generate the calendar markup and return it
$cal = new Calendar($type, $date, '', $widget, $this->page_items, $this->page, $this->displays, $this->filters, $this->event_search, array(), $preview);
$search_params = $this->search;
if (is_array($search_params) && (isset($search_params['query']) && $search_params['query'] !== '' || isset($search_params['category']) && $search_params['category'] > 0 || isset($search_params['tag']) && $search_params['tag'] > 0) || isset($search_params['venue']) && $search_params['venue'] > 0 || isset($search_params['organizer']) && $search_params['organizer'] > 0) {
$cal->search_params = $this->search;
}
if ($categories) {
$cal->add_terms('categories', $categories);
}
if ($tags) {
$cal->add_terms('tags', $tags);
}
$args = array('post_type' => ECWD_PLUGIN_PREFIX . '_venue', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => 1);
$venues = get_posts($args);
if ($venues) {
$cal->add_terms('venues', $venues);
}
$args = array('post_type' => ECWD_PLUGIN_PREFIX . '_organizer', 'post_status' => 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => 1);
$organizers = get_posts($args);
if ($organizers) {
$cal->add_terms('organizers', $organizers);
}
if ($this->events) {
foreach ($this->events as $id => $event) {
$cal->addEvent($event);
}
}
return $cal->showcal();
}
示例7: onAddEvent
//.........这里部分代码省略.........
$reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
$reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
// FIXME: Reminder time must be an integer!
/* Bail out if any of the required fields are empty. */
if (empty($title))
{
CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.');
}
/* Is this a scheduled event or an all day event? */
if ($allDay)
{
$date = DateUtility::convert(
'-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD
);
$hour = 12;
$minute = 0;
$meridiem = 'AM';
}
else
{
/* Bail out if we don't have a valid hour. */
if (!isset($_POST['hour']))
{
CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid hour.');
}
/* Bail out if we don't have a valid minute. */
if (!isset($_POST['minute']))
{
CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid minute.');
}
/* Bail out if we don't have a valid meridiem value. */
if (!isset($_POST['meridiem']) ||
($_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM'))
{
CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid meridiem value.');
}
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$meridiem = $_POST['meridiem'];
/* Convert formatted time to UNIX timestamp. */
$time = strtotime(
sprintf('%s:%s %s', $hour, $minute, $meridiem)
);
/* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
$date = sprintf(
'%s %s',
DateUtility::convert(
'-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD
),
date('H:i:00', $time)
);
}
$timeZoneOffset = $_SESSION['CATS']->getTimeZoneOffset();
if (!eval(Hooks::get('CALENDAR_ADD_PRE'))) return;
$calendar = new Calendar($this->_siteID);
$eventID = $calendar->addEvent(
$type, $date, $description, $allDay, $this->_userID, -1, -1, -1,
$title, $duration, $reminderEnabled, $reminderEmail, $reminderTime,
$publicEntry, $timeZoneOffset
);
if ($eventID <= 0)
{
CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add calendar event.');
}
/* Extract the date parts from the specified date. */
$parsedDate = strtotime($date);
$day = date('j', $parsedDate);
$month = date('n', $parsedDate);
$year = date('Y', $parsedDate);
/* Transfer to same url without a=addEvent. */
$newGet = $_GET;
$newParams = array();
unset($newGet['a']);
$newGet['showEvent'] = $eventID;
foreach ($newGet AS $name => $value)
{
$newParams[] = urlencode($name) . '=' . urlencode($value);
}
if (!eval(Hooks::get('CALENDAR_ADD_POST'))) return;
CATSUtility::transferRelativeURI(implode('&', $newParams));
}
示例8: _addActivityChangeStatus
//.........这里部分代码省略.........
$eventTypeID = $_POST['eventTypeID'];
if ($_POST['allDay'] == 1) {
$allDay = true;
} else {
$allDay = false;
}
$publicEntry = $this->isChecked('publicEntry', $_POST);
$reminderEnabled = $this->isChecked('reminderToggle', $_POST);
$reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
$reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
$duration = $this->getTrimmedInput('duration', $_POST);
/* Is this a scheduled event or an all day event? */
if ($allDay) {
$date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD);
$hour = 12;
$minute = 0;
$meridiem = 'AM';
} else {
/* Bail out if we don't have a valid hour. */
if (!isset($_POST['hour'])) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.');
}
/* Bail out if we don't have a valid minute. */
if (!isset($_POST['minute'])) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.');
}
/* Bail out if we don't have a valid meridiem value. */
if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') {
$this->fatalModal('Invalid meridiem value.', $moduleDirectory);
}
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$meridiem = $_POST['meridiem'];
/* Convert formatted time to UNIX timestamp. */
$time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem));
/* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
$date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time));
}
$description = $this->getTrimmedInput('description', $_POST);
$title = $this->getTrimmedInput('title', $_POST);
/* Bail out if any of the required fields are empty. */
if (empty($title)) {
CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this);
return;
/*$this->fatalModal(
'Required fields are missing.', $moduleDirectory
);*/
}
if ($regardingID > 0) {
$eventJobOrderID = $regardingID;
} else {
$eventJobOrderID = -1;
}
$calendar = new Calendar($this->_siteID);
$eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $candidateID, DATA_ITEM_CANDIDATE, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset());
if ($eventID <= 0) {
$this->fatalModal('Failed to add calendar event.', $moduleDirectory);
}
/* Extract the date parts from the specified date. */
$parsedDate = strtotime($date);
$formattedDate = date('l, F jS, Y', $parsedDate);
$calendar = new Calendar($this->_siteID);
$calendarEventTypes = $calendar->getAllEventTypes();
$eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description');
$eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate));
$eventScheduled = true;
} else {
$eventHTML = '<p>No event has been scheduled.</p>';
$eventScheduled = false;
}
if (isset($_GET['onlyScheduleEvent'])) {
$onlyScheduleEvent = true;
} else {
$onlyScheduleEvent = false;
}
if (!$statusChanged && !$activityAdded && !$eventScheduled) {
$changesMade = false;
} else {
$changesMade = true;
}
if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) {
return;
}
$this->_template->assign('candidateID', $candidateID);
$this->_template->assign('regardingID', $regardingID);
$this->_template->assign('oldStatusDescription', $oldStatusDescription);
$this->_template->assign('newStatusDescription', $newStatusDescription);
$this->_template->assign('statusChanged', $statusChanged);
$this->_template->assign('activityAdded', $activityAdded);
$this->_template->assign('activityDescription', $activityNote);
$this->_template->assign('activityType', $activityTypeDescription);
$this->_template->assign('eventScheduled', $eventScheduled);
$this->_template->assign('eventHTML', $eventHTML);
$this->_template->assign('notificationHTML', $notificationHTML);
$this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
$this->_template->assign('changesMade', $changesMade);
$this->_template->assign('isFinishedMode', true);
$this->_template->assign('isJobOrdersMode', $isJobOrdersMode);
$this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl');
}