-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated user-picker notification functionnalities
- Loading branch information
Showing
8 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Claroline Connect package. | ||
* | ||
* (c) Claroline Consortium <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Icap\WikiBundle\Listener; | ||
|
||
use Doctrine\ORM\Event\LifecycleEventArgs; | ||
use Icap\WikiBundle\Entity\Contribution; | ||
use JMS\DiExtraBundle\Annotation as DI; | ||
use Icap\NotificationBundle\Manager\NotificationManager as NotificationManager; | ||
|
||
/** | ||
* @DI\Service("icap.wiki_bundle.entity_listener.contribution") | ||
* @DI\Tag("doctrine.entity_listener") | ||
*/ | ||
class ContributionListener | ||
{ | ||
/** @var \Icap\NotificationBundle\Manager\NotificationManager */ | ||
private $notificationManager; | ||
|
||
/** | ||
* @DI\InjectParams({ | ||
* "notificationManager" = @DI\Inject("icap.notification.manager"), | ||
* }) | ||
*/ | ||
public function __construct(NotificationManager $notificationManager) | ||
{ | ||
$this->notificationManager = $notificationManager; | ||
} | ||
|
||
public function postPersist(Contribution $contribution, LifecycleEventArgs $event) | ||
{ | ||
if ($contribution->getUserPicker() != null) { | ||
$section = $contribution->getSection(); | ||
$wiki = $section->getWiki(); | ||
$details = array( | ||
'contribution' => array( | ||
'wiki' => $wiki->getId(), | ||
'section' => $section->getId(), | ||
'id' => $contribution->getId(), | ||
'title' => $contribution->getTitle(), | ||
'text' => $contribution->getText(), | ||
'contributor' => $contribution->getContributor()->getFirstName() . | ||
' ' . | ||
$contribution->getContributor()->getLastName() | ||
), | ||
'resource' => array( | ||
'id' => $wiki->getId(), | ||
'name' => $wiki->getResourceNode()->getName(), | ||
'type' => $wiki->getResourceNode()->getResourceType()->getName() | ||
) | ||
); | ||
$notification = $this->notificationManager->createNotification( | ||
'resource-icap_wiki-user_tagged', | ||
'wiki', | ||
$wiki->getResourceNode()->getId(), | ||
$details, | ||
$contribution->getContributor() | ||
); | ||
$this->notificationManager->notifyUsers($notification, $contribution->getUserPicker()->getUserIds()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
resource-icap_wiki-contribution_create: contributed to '%section%' section of '%wiki%' wiki | ||
resource-icap_wiki-section_create: created a '%section%' to '%wiki%' wiki | ||
resource-icap_wiki-user_tagged: tagged you in '%section%' section of '%wiki%' wiki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
resource-icap_wiki-contribution_create: a contribué a la section '%section%' du '%wiki%' wiki | ||
resource-icap_wiki-section_create: a creé la section '%section%' dans '%wiki%' wiki | ||
resource-icap_wiki-section_create: a creé la section '%section%' dans '%wiki%' wiki | ||
resource-icap_wiki-user_tagged: vous a cité dans la section '%section%' du '%wiki%' wiki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Resources/views/Notification/notification_user_tagged.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<a href="{{ path('icap_wiki_view', {'wikiId' : notification.details.resource.id}) ~ '#section-' ~ notification.details.contribution.section }}">{{ notification.actionKey|trans({'%wiki%' : notification.details.resource.name, '%section%' : notification.details.contribution.title}, 'notification') }}</a> |