Add new feed entry web hook when creating a new feed entry

This commit is contained in:
Nicolas Le Goff
2014-03-16 04:40:13 +01:00
parent b23115d38d
commit 9e9cfa3c5f
2 changed files with 9 additions and 6 deletions

View File

@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Exception\RuntimeException;
class API_Webhook
{
const NEW_FEED_ENTRY = "new_feed_entry";
protected $appbox;
protected $id;
protected $type;

View File

@@ -50,7 +50,6 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
);
$dom_xml = new DOMDocument('1.0', 'UTF-8');
$dom_xml->preserveWhiteSpace = false;
$dom_xml->formatOutput = true;
@@ -64,7 +63,9 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
$dom_xml->appendChild($root);
$datas = $dom_xml->saveXml();
$data = $dom_xml->saveXml();
API_Webhook::create($this->app['phraseanet.appbox'], API_Webhook::NEW_FEED_ENTRY, $params);
$Query = new \User_Query($this->app);
@@ -121,7 +122,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
}
}
$this->broker->notify($user_to_notif->get_id(), __CLASS__, $datas, $mailed);
$this->broker->notify($user_to_notif->get_id(), __CLASS__, $data, $mailed);
}
$start += $perLoop;
} while (count($results) > 0);
@@ -131,13 +132,13 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
/**
*
* @param Array $datas
* @param Array $data
* @param boolean $unread
* @return Array
*/
public function datas($datas, $unread)
public function datas($data, $unread)
{
$sx = simplexml_load_string($datas);
$sx = simplexml_load_string($data);
try {
$entry = \Feed_Entry_Adapter::load_from_id($this->app, (int) $sx->entry_id);