Dear visitor, welcome to WoltLab Community Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
This post has been edited 1 times, last edit by "Eagel" (Mar 9th 2012, 7:20pm)

|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php
require_once(WCF_DIR.'lib/system/event/EventListener.class.php');
require_once(WCF_DIR.'lib/data/message/pm/PMEditor.class.php');
class CalendarCommentNotificationListener implements EventListener {
public function execute($eventObj, $className, $eventName) {
if($eventObj->object->eventID) {
$post = new PMEditor($eventObj->object->eventID);
$subject = 'Neuer Kommentar im Kalender';
$text = 'Ein Benutzer hat einen Kommentar in Ihrem Kalendereintrag hinterlassen.';
$post->create($post->recipients.$eventObj->object->userID, $post->subject.$subject, $post->text.$text, array('time' => TIME_NOW, 'userID' => WCF::getUser()->userID, 'username' => WCF::getUser()->username));
}
}
}
?>
|
|
|
XML |
1 2 3 4 5 6 7 8 9 10 |
<?xml version="1.0" encoding="UTF-8"?> <data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com/XSD/event-listener.xsd"> <import> <eventlistener> <eventclassname>CalendarEventCommentAddForm</eventclassname> <eventname>saved</eventname> <listenerclassfile>lib/system/event/listener/CalendarCommentNotificationListener.class.php</listenerclassfile> </eventlistener> </import> </data> |
This post has been edited 2 times, last edit by "Sebastian S." (Mar 10th 2012, 4:17am)
|
|
PHP Source code |
104 |
public static function create($draft, $recipients, $blindCopies, $subject, $text, $userID, $username, $options = array(), $attachments = null, $parentPmID = 0) {
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php
require_once(WCF_DIR.'lib/system/event/EventListener.class.php');
require_once(WCF_DIR.'lib/data/message/pm/PMEditor.class.php');
class CalendarCommentNotificationListener implements EventListener {
public function execute($eventObj, $className, $eventName) {
if($eventObj->object->eventID) {
$post = new PMEditor($eventObj->object->userID);
$subject = 'Neuer Kommentar im Kalender';
$text = 'Ein Benutzer hat einen Kommentar in Ihrem Kalendereintrag hinterlassen.';
$options = array('enableSmilies' => $post->enableSmilies, 'enableHtml' => $post->enableHtml, 'enableBBCodes' => $post->enableBBCodes, 'showSignature' => $post->showSignature);
$parentPmID = 0;
$draft = 0;
$post->create($draft, $post->recipients.$eventObj->object->userID, null, $post->subject.$subject, $post->text.$text, $post->userID.WCF::getUser()->userID, $post->username.WCF::getUser()->username, $options, null, $parentPmID);
}
}
}
?>
|
This post has been edited 1 times, last edit by "Sebastian S." (Mar 10th 2012, 5:16am)
|
|
PHP Source code |
1 |
PMEditor::create()
|
Ideal wäre wenn der Ersteller des Termins, sowie alle Benutzer die mit JA, VIELLEICHT, und NEIN im Termin gelistet sind...Außerdem ist die Fragen, wem du diese PM nun zusendest ($eventObj->object->userID - wahrscheinlich dem, der dsa Kommentar erstellt?). Ich würde mit der eventID eine neue Event-Klasse erstellen, alle User dieses Events abfragen und denen dann (möglicherweise auch noch eine Option einbauen, wo die User entscheiden können ob sie eine Benachrichtigung erhalten) eine Nachricht schicken.

|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<?php
require_once(WCF_DIR.'lib/system/event/EventListener.class.php');
require_once(WCF_DIR.'lib/data/message/pm/PMEditor.class.php');
class CalendarCommentNotificationListener implements EventListener {
public function execute($eventObj, $className, $eventName) {
$recipient = array();
$recipient[] = array('userID'=> $eventObj->event->userID, 'username'=> $eventObj->event->username);
if(isset($eventObj->event->participation->participants)){
$participants = $eventObj->event->participation->participants;
$answers = array('yes','no','maybe');
foreach($answers as $answer){
if(isset($participants[$answer])){
foreach($participants[$answer] as $user){
$recipient[] = array('userID'=> $participants->userID, 'username'=> $participants->userID);
}
}
}
}
$recipient = array_unique($recipient);
$draft = 0;
$subject = 'Neuer Kommentar im Kalender';
$msgtext = 'Hallo,'."\n"."\n".$eventObj->event->username.' hat einen Kommentar in Ihrem Kalendereintrag hinterlassen.';
PMEditor::create($draft, $recipient, array(), $subject, $msgtext, $eventObj->event->userID, $eventObj->event->username);
}
}
?>
|
Hallo,
ja das Plugin kann dafür verwendet werden. Dazu ist es ja da. Die Implementierung kann analog zu meinem Plugin bei der Gäastebuchbenachrichtigung erfolgen. Man könnte damit dann auch zu anderen Ereignisses im Kalender Benachrichtigungen erstellen.
This post has been edited 1 times, last edit by "Eagel" (Mar 10th 2012, 1:25pm)
Forum Software: Burning Board® 3.1.7, developed by WoltLab® GmbH