本文整理汇总了PHP中Notifier::notifEventAssistance方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::notifEventAssistance方法的具体用法?PHP Notifier::notifEventAssistance怎么用?PHP Notifier::notifEventAssistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifier
的用法示例。
在下文中一共展示了Notifier::notifEventAssistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: change_invitation_state
function change_invitation_state($attendance = null, $event_id = null, $user_id = null) {
$from_post_get = $attendance == null || $event_id == null;
// Take variables from post
if ($attendance == null) $attendance = array_var($_POST, 'event_attendance');
if ($event_id == null) $event_id = array_var($_POST, 'event_id');
if ($user_id == null) $user_id = array_var($_POST, 'user_id');
// If post is empty, take variables from get
if ($attendance == null) $attendance = array_var($_GET, 'at');
if ($event_id == null) $event_id = array_var($_GET, 'e');
if ($user_id == null) $user_id = array_var($_GET, 'u');
if ($attendance == null || $event_id == null) {
flash_error('Missing parameters');
ajx_current("back");
} else {
$conditions = array('conditions' => "`event_id` = " . DB::escape($event_id) . " AND `contact_id` = ". DB::escape($user_id));
$inv = EventInvitations::findOne($conditions);
$conditions_all = array('conditions' => "`event_id` = " . DB::escape($event_id));
$invs = EventInvitations::findAll($conditions_all);
if ($inv != null) {
if ($inv->getContactId() != logged_user()->getId()) {
flash_error(lang('no access permissions'));
self::view_calendar();
return;
}
try {
DB::beginWork();
$inv->setInvitationState($attendance);
$inv->save();
DB::commit();
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
return;
}
}
if ($from_post_get) {
// Notify creator (only when invitation is accepted or declined)
$event = ProjectEvents::findById(array('id' => $event_id));
if ($inv->getInvitationState() == 1 || $inv->getInvitationState() == 2) {
$user = Contacts::findById(array('id' => $user_id));
session_commit();
Notifier::notifEventAssistance($event, $inv, $user, $invs);
if ($inv->getInvitationState() == 1) flash_success(lang('invitation accepted'));
else flash_success(lang('invitation rejected'));
} else {
flash_success(lang('success edit event', $event instanceof ProjectEvent ? clean($event->getObjectName()) : ''));
}
if (array_var($_GET, 'at')) {
self::view_calendar();
} else {
ajx_current("reload");
}
}
}
}