-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added notification configuration for core and resources
- Loading branch information
Showing
55 changed files
with
2,662 additions
and
1,059 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,75 @@ | ||
<?php | ||
/** | ||
* This file is part of the Claroline Connect package | ||
* | ||
* (c) Claroline Consortium <[email protected]> | ||
* | ||
* Author: Panagiotis TSAVDARIS | ||
* | ||
* Date: 4/8/15 | ||
*/ | ||
|
||
namespace Icap\NotificationBundle\Controller; | ||
|
||
use Claroline\CoreBundle\Entity\User; | ||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
|
||
class NotificationUserParametersController extends Controller | ||
{ | ||
/** | ||
* @Route("/parameters", name="icap_notification_user_parameters") | ||
* @Method({"GET"}) | ||
* @Template("IcapNotificationBundle:Parameters:config.html.twig") | ||
* @ParamConverter("user", options={"authenticatedUser" = true}) | ||
*/ | ||
public function getAction(User $user) | ||
{ | ||
$parametersManager = $this->getParametersManager(); | ||
$parameters = $parametersManager->getParametersByUserId($user->getId()); | ||
$types = $parametersManager->allTypesList($parameters); | ||
|
||
return array('types' => $types, 'rssId' => $parameters->getRssId()); | ||
} | ||
|
||
/** | ||
* @Route("/parameters", name="icap_notification_save_user_parameters") | ||
* @Method({"POST"}) | ||
* @Template("IcapNotificationBundle:Parameters:config.html.twig") | ||
* @ParamConverter("user", options={"authenticatedUser" = true}) | ||
*/ | ||
public function postAction(Request $request, User $user) | ||
{ | ||
$this->getParametersManager()->processUpdate($request->request->all(), $user->getId()); | ||
|
||
return new RedirectResponse($this->generateUrl("claro_desktop_parameters_menu")); | ||
} | ||
|
||
/** | ||
* @Route("/regenerate_rss", name="icap_notification_regenerate_rss_url") | ||
* @Template("IcapNotificationBundle:Parameters:config.html.twig") | ||
* @ParamConverter("user", options={"authenticatedUser" = true}) | ||
*/ | ||
public function regenerateRssUrlAction(User $user) | ||
{ | ||
$parametersManager = $this->getParametersManager(); | ||
$parameters = $parametersManager->regenerateRssId($user->getId()); | ||
$types = $parametersManager->allTypesList($parameters); | ||
|
||
return array('types' => $types, 'rssId' => $parameters->getRssId()); | ||
} | ||
|
||
/** | ||
* @return \Icap\NotificationBundle\Manager\NotificationUserParametersManager | ||
*/ | ||
private function getParametersManager() | ||
{ | ||
return $this->get("icap.notification.manager.notification_user_parameters"); | ||
} | ||
} |
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
Oops, something went wrong.