mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Implement admin controllers
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
namespace Alchemy\Phrasea\Controller\Admin;
|
namespace Alchemy\Phrasea\Controller\Admin;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application as PhraseaApplication;
|
use Alchemy\Phrasea\Application as PhraseaApplication;
|
||||||
|
use Repositories;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@@ -46,21 +47,28 @@ class Publications implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/create/', function(PhraseaApplication $app, Request $request) {
|
$controllers->post('/create/', function(PhraseaApplication $app, Request $request) {
|
||||||
|
|
||||||
$feed = \Feed_Adapter::create(
|
$publisher = new \Entities\FeedPublisher($app['authentication']->getUser(), true);
|
||||||
$app, $app['authentication']->getUser(), $request->request->get('title'), $request->request->get('subtitle')
|
|
||||||
);
|
$feed = new \Entities\Feed($publisher, $request->request->get('title'), $request->request->get('subtitle'));
|
||||||
|
|
||||||
if ($request->request->get('public') == '1') {
|
if ($request->request->get('public') == '1') {
|
||||||
$feed->set_public(true);
|
$feed->setPublic(true);
|
||||||
} elseif ($request->request->get('base_id')) {
|
} elseif ($request->request->get('base_id')) {
|
||||||
$feed->set_collection(\collection::get_from_base_id($app, $request->request->get('base_id')));
|
$feed->setCollection(\collection::get_from_base_id($app, $request->request->get('base_id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$publisher->setFeed($feed);
|
||||||
|
|
||||||
|
$app["EM"]->persist($feed);
|
||||||
|
$app["EM"]->persist($publisher);
|
||||||
|
|
||||||
|
$app["EM"]->flush();
|
||||||
|
|
||||||
return $app->redirectPath('admin_feeds_list');
|
return $app->redirectPath('admin_feeds_list');
|
||||||
})->bind('admin_feeds_create');
|
})->bind('admin_feeds_create');
|
||||||
|
|
||||||
$controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) {
|
$controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) {
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
|
|
||||||
return $app['twig']
|
return $app['twig']
|
||||||
->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error')));
|
->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error')));
|
||||||
@@ -70,24 +78,26 @@ class Publications implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) {
|
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) {
|
||||||
|
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
|
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$collection = null;
|
$collection = null;
|
||||||
}
|
}
|
||||||
|
$feed->setTitle($request->request->get('title'));
|
||||||
|
$feed->setDescription($request->request->get('subtitle'));
|
||||||
|
$feed->setCollection($collection);
|
||||||
|
$feed->setPublic($request->request->get('public'));
|
||||||
|
|
||||||
$feed->set_title($request->request->get('title'));
|
$app["EM"]->persist($feed);
|
||||||
$feed->set_subtitle($request->request->get('subtitle'));
|
$app["EM"]->flush();
|
||||||
$feed->set_collection($collection);
|
|
||||||
$feed->set_public($request->request->get('public'));
|
|
||||||
|
|
||||||
return $app->redirectPath('admin_feeds_list');
|
return $app->redirectPath('admin_feeds_list');
|
||||||
})->before(function(Request $request) use ($app) {
|
})->before(function(Request $request) use ($app) {
|
||||||
$feed = new \Feed_Adapter($app, $request->attributes->get('id'));
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($request->attributes->get('id'));
|
||||||
|
|
||||||
if (!$feed->is_owner($app['authentication']->getUser())) {
|
if (!$feed->getOwner($app['authentication']->getUser())) {
|
||||||
return $app->redirectPath('admin_feeds_feed', array('id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')));
|
return $app->redirectPath('admin_feeds_feed', array('id' => $request->attributes->get('id'), 'error' => _('You are not the owner of this feed, you can not edit it')));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -99,12 +109,11 @@ class Publications implements ControllerProviderInterface
|
|||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => '',
|
'message' => '',
|
||||||
);
|
);
|
||||||
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
|
||||||
|
|
||||||
$request = $app["request"];
|
$request = $app["request"];
|
||||||
|
|
||||||
if (!$feed->is_owner($app['authentication']->getUser())) {
|
if (!$feed->getOwner($app['authentication']->getUser())) {
|
||||||
$datas['message'] = 'You are not allowed to do that';
|
$datas['message'] = 'You are not allowed to do that';
|
||||||
|
|
||||||
return $app->json($datas);
|
return $app->json($datas);
|
||||||
@@ -146,7 +155,7 @@ class Publications implements ControllerProviderInterface
|
|||||||
throw new \Exception_InternalServerError('Error while resizing');
|
throw new \Exception_InternalServerError('Error while resizing');
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed->set_icon($tmpname);
|
//$feed->set_icon($tmpname);
|
||||||
|
|
||||||
unset($media);
|
unset($media);
|
||||||
|
|
||||||
@@ -167,8 +176,17 @@ class Publications implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$user = \User_Adapter::getInstance($request->request->get('usr_id'), $app);
|
$user = \User_Adapter::getInstance($request->request->get('usr_id'), $app);
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
$feed->add_publisher($user);
|
|
||||||
|
$publisher = new \Entities\FeedPublisher($user, false);
|
||||||
|
$publisher->setFeed($feed);
|
||||||
|
|
||||||
|
$feed->addPublisher($publisher);
|
||||||
|
|
||||||
|
$app["EM"]->persist($feed);
|
||||||
|
$app["EM"]->persist($publisher);
|
||||||
|
|
||||||
|
$app["EM"]->flush();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -182,11 +200,16 @@ class Publications implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
|
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
$publisher = new \Feed_Publisher_Adapter($app, $request->request->get('publisher_id'));
|
|
||||||
$user = $publisher->get_user();
|
$publisher = $app["EM"]->getRepository("Entities\FeedPublisher")->find($request->request->get('publisher_id'));
|
||||||
if ($feed->is_publisher($user) === true && $feed->is_owner($user) === false)
|
$user = $publisher->getUser($app);
|
||||||
$publisher->delete();
|
if ($feed->isPublisher($user) === true && $feed->isOwner($user) === false) {
|
||||||
|
$feed->removePublisher($publisher);
|
||||||
|
|
||||||
|
$app["EM"]->remove($publisher);
|
||||||
|
$app["EM"]->flush();
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$error = $e->getMessage();
|
$error = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -197,8 +220,13 @@ class Publications implements ControllerProviderInterface
|
|||||||
->assert('id', '\d+');
|
->assert('id', '\d+');
|
||||||
|
|
||||||
$controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) {
|
$controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) {
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = $app["EM"]->getRepository("Entities\Feed")->find($id);
|
||||||
$feed->delete();
|
$publishers = $feed->getPublishers();
|
||||||
|
foreach ($publishers as $publisher) {
|
||||||
|
$app["EM"]->remove($publisher);
|
||||||
|
}
|
||||||
|
$app["EM"]->remove($feed);
|
||||||
|
$app["EM"]->flush();
|
||||||
|
|
||||||
return $app->redirectPath('admin_feeds_list');
|
return $app->redirectPath('admin_feeds_list');
|
||||||
})
|
})
|
||||||
|
@@ -18,12 +18,12 @@ class Feed
|
|||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private $public;
|
private $public = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $icon_url;
|
private $icon_url = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
@@ -38,17 +38,17 @@ class Feed
|
|||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $description;
|
private $subtitle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
private $created;
|
private $created_on;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \DateTime
|
* @var \DateTime
|
||||||
*/
|
*/
|
||||||
private $updated;
|
private $updated_on;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Doctrine\Common\Collections\Collection
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
@@ -122,7 +122,11 @@ class Feed
|
|||||||
*/
|
*/
|
||||||
public function getIconUrl()
|
public function getIconUrl()
|
||||||
{
|
{
|
||||||
return $this->icon_url;
|
if (!$this->icon_url) {
|
||||||
|
return '/skins/icons/rss32.gif';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '/www/custom/feed_' . $this->getId() . '.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,75 +175,6 @@ class Feed
|
|||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set description
|
|
||||||
*
|
|
||||||
* @param string $description
|
|
||||||
* @return Feed
|
|
||||||
*/
|
|
||||||
public function setDescription($description)
|
|
||||||
{
|
|
||||||
$this->description = $description;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get description
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getDescription()
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set created
|
|
||||||
*
|
|
||||||
* @param \DateTime $created
|
|
||||||
* @return Feed
|
|
||||||
*/
|
|
||||||
public function setCreated($created)
|
|
||||||
{
|
|
||||||
$this->created = $created;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get created
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
|
||||||
public function getCreated()
|
|
||||||
{
|
|
||||||
return $this->created;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set updated
|
|
||||||
*
|
|
||||||
* @param \DateTime $updated
|
|
||||||
* @return Feed
|
|
||||||
*/
|
|
||||||
public function setUpdated($updated)
|
|
||||||
{
|
|
||||||
$this->updated = $updated;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get updated
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
|
||||||
public function getUpdated()
|
|
||||||
{
|
|
||||||
return $this->updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add publishers
|
* Add publishers
|
||||||
*
|
*
|
||||||
@@ -279,7 +214,7 @@ class Feed
|
|||||||
* @param \Entities\FeedEntry $entries
|
* @param \Entities\FeedEntry $entries
|
||||||
* @return Feed
|
* @return Feed
|
||||||
*/
|
*/
|
||||||
public function addEntrie(\Entities\FeedEntry $entries)
|
public function addEntry(\Entities\FeedEntry $entries)
|
||||||
{
|
{
|
||||||
$this->entries[] = $entries;
|
$this->entries[] = $entries;
|
||||||
|
|
||||||
@@ -291,7 +226,7 @@ class Feed
|
|||||||
*
|
*
|
||||||
* @param \Entities\FeedEntry $entries
|
* @param \Entities\FeedEntry $entries
|
||||||
*/
|
*/
|
||||||
public function removeEntrie(\Entities\FeedEntry $entries)
|
public function removeEntry(\Entities\FeedEntry $entries)
|
||||||
{
|
{
|
||||||
$this->entries->removeElement($entries);
|
$this->entries->removeElement($entries);
|
||||||
}
|
}
|
||||||
@@ -309,7 +244,7 @@ class Feed
|
|||||||
public function getOwner()
|
public function getOwner()
|
||||||
{
|
{
|
||||||
foreach ($this->getPublishers() as $publisher) {
|
foreach ($this->getPublishers() as $publisher) {
|
||||||
if ($publisher->isOwner()) {
|
if ($publisher->getOwner()) {
|
||||||
return $publisher;
|
return $publisher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,7 +253,7 @@ class Feed
|
|||||||
public function isOwner(\User_Adapter $user)
|
public function isOwner(\User_Adapter $user)
|
||||||
{
|
{
|
||||||
$owner = $this->getOwner();
|
$owner = $this->getOwner();
|
||||||
if ($owner !== null && $user->get_id() === $owner->getId()) {
|
if ($owner !== null && $user->get_id() === $owner->getUsrId()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +262,116 @@ class Feed
|
|||||||
|
|
||||||
public function getCollection(Application $app)
|
public function getCollection(Application $app)
|
||||||
{
|
{
|
||||||
if ($this->getBaseId() !== null)
|
if ($this->getBaseId() !== null) {
|
||||||
return \collection::get_from_base_id($app, $this->getBaseId());
|
return \collection::get_from_base_id($app, $this->getBaseId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function setCollection(\collection $collection = null)
|
||||||
|
{
|
||||||
|
if ($collection === null) {
|
||||||
|
$this->base_id = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->base_id = $collection->get_base_id();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set created_on
|
||||||
|
*
|
||||||
|
* @param \DateTime $createdOn
|
||||||
|
* @return Feed
|
||||||
|
*/
|
||||||
|
public function setCreatedOn($createdOn)
|
||||||
|
{
|
||||||
|
$this->created_on = $createdOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get created_on
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getCreatedOn()
|
||||||
|
{
|
||||||
|
return $this->created_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set updated_on
|
||||||
|
*
|
||||||
|
* @param \DateTime $updatedOn
|
||||||
|
* @return Feed
|
||||||
|
*/
|
||||||
|
public function setUpdatedOn($updatedOn)
|
||||||
|
{
|
||||||
|
$this->updated_on = $updatedOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get updated_on
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getUpdatedOn()
|
||||||
|
{
|
||||||
|
return $this->updated_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPublisher(\User_Adapter $user)
|
||||||
|
{
|
||||||
|
foreach ($this->getPublishers() as $publisher) {
|
||||||
|
if ($publisher->getUsrId() == $user->get_id()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set subtitle
|
||||||
|
*
|
||||||
|
* @param string $subtitle
|
||||||
|
* @return Feed
|
||||||
|
*/
|
||||||
|
public function setSubtitle($subtitle)
|
||||||
|
{
|
||||||
|
$this->subtitle = $subtitle;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get subtitle
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSubtitle()
|
||||||
|
{
|
||||||
|
return $this->subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAggregated()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCountTotalEntries()
|
||||||
|
{
|
||||||
|
return (count($this->entries));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasAccess(User_Adapter $user)
|
||||||
|
{
|
||||||
|
if ($this->get_collection() instanceof collection) {
|
||||||
|
return $user->ACL()->has_access_to_base($this->collection->get_base_id());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
306
lib/Doctrine/Entities/FeedEntry.php
Normal file
306
lib/Doctrine/Entities/FeedEntry.php
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FeedEntry
|
||||||
|
*/
|
||||||
|
class FeedEntry
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $subtitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $author_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $author_email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $created_on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $updated_on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
private $items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Entities\FeedPublisher
|
||||||
|
*/
|
||||||
|
private $publisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Entities\Feed
|
||||||
|
*/
|
||||||
|
private $feed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->items = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set title
|
||||||
|
*
|
||||||
|
* @param string $title
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setTitle($title)
|
||||||
|
{
|
||||||
|
$this->title = $title;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get title
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set subtitle
|
||||||
|
*
|
||||||
|
* @param string $subtitle
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setSubtitle($subtitle)
|
||||||
|
{
|
||||||
|
$this->subtitle = $subtitle;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get subtitle
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSubtitle()
|
||||||
|
{
|
||||||
|
return $this->subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set author_name
|
||||||
|
*
|
||||||
|
* @param string $authorName
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setAuthorName($authorName)
|
||||||
|
{
|
||||||
|
$this->author_name = $authorName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get author_name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAuthorName()
|
||||||
|
{
|
||||||
|
return $this->author_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set author_email
|
||||||
|
*
|
||||||
|
* @param string $authorEmail
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setAuthorEmail($authorEmail)
|
||||||
|
{
|
||||||
|
$this->author_email = $authorEmail;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get author_email
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAuthorEmail()
|
||||||
|
{
|
||||||
|
return $this->author_email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set created
|
||||||
|
*
|
||||||
|
* @param \DateTime $created
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setCreatedOn($createdOn)
|
||||||
|
{
|
||||||
|
$this->created_on = $createdOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get created
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getCreatedOn()
|
||||||
|
{
|
||||||
|
return $this->createdOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set updated
|
||||||
|
*
|
||||||
|
* @param \DateTime $updated
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setUpdatedOn($updatedOn)
|
||||||
|
{
|
||||||
|
$this->updated_on = $updatedOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get updated
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getUpdatedOn()
|
||||||
|
{
|
||||||
|
return $this->updatedOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add items
|
||||||
|
*
|
||||||
|
* @param \Entities\FeedItem $items
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function addItem(\Entities\FeedItem $items)
|
||||||
|
{
|
||||||
|
$this->items[] = $items;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove items
|
||||||
|
*
|
||||||
|
* @param \Entities\FeedItem $items
|
||||||
|
*/
|
||||||
|
public function removeItem(\Entities\FeedItem $items)
|
||||||
|
{
|
||||||
|
$this->items->removeElement($items);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get items
|
||||||
|
*
|
||||||
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
|
*/
|
||||||
|
public function getItems()
|
||||||
|
{
|
||||||
|
return $this->items;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set publisher
|
||||||
|
*
|
||||||
|
* @param \Entities\FeedPublisher $publisher
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setPublisher(\Entities\FeedPublisher $publisher = null)
|
||||||
|
{
|
||||||
|
$this->publisher = $publisher;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get publisher
|
||||||
|
*
|
||||||
|
* @return \Entities\FeedPublisher
|
||||||
|
*/
|
||||||
|
public function getPublisher()
|
||||||
|
{
|
||||||
|
return $this->publisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feed
|
||||||
|
*
|
||||||
|
* @param \Entities\Feed $feed
|
||||||
|
* @return FeedEntry
|
||||||
|
*/
|
||||||
|
public function setFeed(\Entities\Feed $feed = null)
|
||||||
|
{
|
||||||
|
$this->feed = $feed;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get feed
|
||||||
|
*
|
||||||
|
* @return \Entities\Feed
|
||||||
|
*/
|
||||||
|
public function getFeed()
|
||||||
|
{
|
||||||
|
return $this->feed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPublisher(\User_Adapter $user)
|
||||||
|
{
|
||||||
|
if ($this->publisher) {
|
||||||
|
if ($this->publisher->getUsrId() === $user->get_id())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
198
lib/Doctrine/Entities/FeedItem.php
Normal file
198
lib/Doctrine/Entities/FeedItem.php
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FeedItem
|
||||||
|
*/
|
||||||
|
class FeedItem
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $record_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $sbas_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $created_on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $updated_on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Entities\FeedEntry
|
||||||
|
*/
|
||||||
|
private $entry;
|
||||||
|
|
||||||
|
public function __construct(\Entities\FeedEntry $entry, \record_adapter $record)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set record_id
|
||||||
|
*
|
||||||
|
* @param integer $recordId
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setRecordId($recordId)
|
||||||
|
{
|
||||||
|
$this->record_id = $recordId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get record_id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getRecordId()
|
||||||
|
{
|
||||||
|
return $this->record_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sbas_id
|
||||||
|
*
|
||||||
|
* @param integer $sbasId
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setSbasId($sbasId)
|
||||||
|
{
|
||||||
|
$this->sbas_id = $sbasId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sbas_id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getSbasId()
|
||||||
|
{
|
||||||
|
return $this->sbas_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set entry
|
||||||
|
*
|
||||||
|
* @param \Entities\FeedEntry $entry
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setEntry(\Entities\FeedEntry $entry = null)
|
||||||
|
{
|
||||||
|
$this->entry = $entry;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get entry
|
||||||
|
*
|
||||||
|
* @return \Entities\FeedEntry
|
||||||
|
*/
|
||||||
|
public function getEntry()
|
||||||
|
{
|
||||||
|
return $this->entry;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $ord;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set ord
|
||||||
|
*
|
||||||
|
* @param \int $ord
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setOrd(\int $ord)
|
||||||
|
{
|
||||||
|
$this->ord = $ord;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get ord
|
||||||
|
*
|
||||||
|
* @return \int
|
||||||
|
*/
|
||||||
|
public function getOrd()
|
||||||
|
{
|
||||||
|
return $this->ord;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set created_on
|
||||||
|
*
|
||||||
|
* @param \DateTime $createdOn
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setCreatedOn($createdOn)
|
||||||
|
{
|
||||||
|
$this->created_on = $createdOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get created_on
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getCreatedOn()
|
||||||
|
{
|
||||||
|
return $this->created_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set updated_on
|
||||||
|
*
|
||||||
|
* @param \DateTime $updatedOn
|
||||||
|
* @return FeedItem
|
||||||
|
*/
|
||||||
|
public function setUpdatedOn($updatedOn)
|
||||||
|
{
|
||||||
|
$this->updated_on = $updatedOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get updated_on
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getUpdatedOn()
|
||||||
|
{
|
||||||
|
return $this->updated_on;
|
||||||
|
}
|
||||||
|
}
|
147
lib/Doctrine/Entities/FeedPublisher.php
Normal file
147
lib/Doctrine/Entities/FeedPublisher.php
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Entities;
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Application;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FeedPublisher
|
||||||
|
*/
|
||||||
|
class FeedPublisher
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
private $usr_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $owner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $created_on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Entities\Feed
|
||||||
|
*/
|
||||||
|
private $feed;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set usr_id
|
||||||
|
*
|
||||||
|
* @param integer $usrId
|
||||||
|
* @return FeedPublisher
|
||||||
|
*/
|
||||||
|
public function setUsrId($usrId)
|
||||||
|
{
|
||||||
|
$this->usr_id = $usrId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get usr_id
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getUsrId()
|
||||||
|
{
|
||||||
|
return $this->usr_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set owner
|
||||||
|
*
|
||||||
|
* @param boolean $owner
|
||||||
|
* @return FeedPublisher
|
||||||
|
*/
|
||||||
|
public function setOwner($owner)
|
||||||
|
{
|
||||||
|
$this->owner = $owner;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get owner
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getOwner()
|
||||||
|
{
|
||||||
|
return $this->owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feed
|
||||||
|
*
|
||||||
|
* @param \Entities\Feed $feed
|
||||||
|
* @return FeedPublisher
|
||||||
|
*/
|
||||||
|
public function setFeed(\Entities\Feed $feed = null)
|
||||||
|
{
|
||||||
|
$this->feed = $feed;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get feed
|
||||||
|
*
|
||||||
|
* @return \Entities\Feed
|
||||||
|
*/
|
||||||
|
public function getFeed()
|
||||||
|
{
|
||||||
|
return $this->feed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(Application $app)
|
||||||
|
{
|
||||||
|
$user = \User_Adapter::getInstance($this->getUsrId(), $app);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set created_on
|
||||||
|
*
|
||||||
|
* @param \DateTime $createdOn
|
||||||
|
* @return FeedPublisher
|
||||||
|
*/
|
||||||
|
public function setCreatedOn($createdOn)
|
||||||
|
{
|
||||||
|
$this->created_on = $createdOn;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get created_on
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*/
|
||||||
|
public function getCreatedOn()
|
||||||
|
{
|
||||||
|
return $this->created_on;
|
||||||
|
}
|
||||||
|
}
|
@@ -12,4 +12,15 @@ use Doctrine\ORM\EntityRepository;
|
|||||||
*/
|
*/
|
||||||
class OrderElementRepository extends EntityRepository
|
class OrderElementRepository extends EntityRepository
|
||||||
{
|
{
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
$dql = 'SELECT f FROM Entities\FeedPublisher f
|
||||||
|
WHERE f.id = :id ';
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$query->setParameter('id', $id);
|
||||||
|
$feed = $query->getResult();
|
||||||
|
|
||||||
|
return $feed[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Repositories;
|
namespace Repositories;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +15,6 @@ class SessionRepository extends EntityRepository
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param Application $app
|
|
||||||
* @param User_Adapter $user
|
* @param User_Adapter $user
|
||||||
* @return \Doctrine\Common\Collections\Collection
|
* @return \Doctrine\Common\Collections\Collection
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +22,6 @@ class SessionRepository extends EntityRepository
|
|||||||
{
|
{
|
||||||
$base_ids = array_keys($user->ACL()->get_granted_base());
|
$base_ids = array_keys($user->ACL()->get_granted_base());
|
||||||
|
|
||||||
|
|
||||||
$dql = 'SELECT f FROM Entities\Feed f
|
$dql = 'SELECT f FROM Entities\Feed f
|
||||||
WHERE f.base_id IS NULL ';
|
WHERE f.base_id IS NULL ';
|
||||||
|
|
||||||
@@ -34,10 +31,23 @@ class SessionRepository extends EntityRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
$dql .= ' OR f.public = true
|
$dql .= ' OR f.public = true
|
||||||
ORDER BY f.created DESC';
|
ORDER BY f.created_on DESC';
|
||||||
|
|
||||||
$query = $this->_em->createQuery($dql);
|
$query = $this->_em->createQuery($dql);
|
||||||
$feeds = $query->getResult();
|
$feeds = $query->getResult();
|
||||||
|
|
||||||
return $feeds;
|
return $feeds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function find($id)
|
||||||
|
{
|
||||||
|
$dql = 'SELECT f FROM Entities\Feed f
|
||||||
|
WHERE f.id = :id ';
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$query->setParameter('id', $id);
|
||||||
|
$feed = $query->getResult();
|
||||||
|
|
||||||
|
return $feed[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,16 +6,16 @@
|
|||||||
{% if error %}
|
{% if error %}
|
||||||
<div class="error alert alert-error">{{ error }}</div>
|
<div class="error alert alert-error">{{ error }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if feed.is_owner(app['authentication'].getUser()) %}
|
{% if feed.isOwner(app['authentication'].getUser()) %}
|
||||||
<h2>{% trans 'Edition' %}</h2>
|
<h2>{% trans 'Edition' %}</h2>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div id="pub_icon">
|
<div id="pub_icon">
|
||||||
<div class="thumb_wrapper">
|
<div class="thumb_wrapper">
|
||||||
<img id="img_before" src="{{ feed.get_icon_url() }}" />
|
<img id="img_before" src="{{ feed.getIconUrl() }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="pub_fileupload">
|
<div id="pub_fileupload">
|
||||||
<input id="fileupload-feed" type="file" name="files[]" accept="image/*" data-url="/admin/publications/feed/{{ feed.get_id() }}/iconupload/">
|
<input id="fileupload-feed" type="file" name="files[]" accept="image/*" data-url="/admin/publications/feed/{{ feed.getId() }}/iconupload/">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
@@ -79,28 +79,28 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class="no-ajax form_publication form-vertical" name="form_publication" enctype="multipart/form-data" method="post" action="{{ path('admin_feeds_feed_update', { 'id' : feed.get_id() }) }}">
|
<form class="no-ajax form_publication form-vertical" name="form_publication" enctype="multipart/form-data" method="post" action="{{ path('admin_feeds_feed_update', { 'id' : feed.getId() }) }}">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="edit_pub_titre">{% trans 'Titre' %} :</label>
|
<label class="control-label" for="edit_pub_titre">{% trans 'Titre' %} :</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id="edit_pub_titre" class="required_text input-large" maxlength="128" name="title" type="text" value="{{ feed.get_title() }}" />
|
<input id="edit_pub_titre" class="required_text input-large" maxlength="128" name="title" type="text" value="{{ feed.getTitle() }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="edit_pub_subtitre">{% trans 'Sous-titre' %} :</label>
|
<label class="control-label" for="edit_pub_subtitre">{% trans 'Sous-titre' %} :</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input placeholder="{% trans 'Short description' %}" id="edit_pub_subtitre" class="input-large" maxlength="512" name="subtitle" type="text" value="{{ feed.get_subtitle() }}" />
|
<input placeholder="{% trans 'Short description' %}" id="edit_pub_subtitre" class="input-large" maxlength="512" name="subtitle" type="text" value="{{ feed.getDescription() }}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label" for="edit_pub_base_id">{% trans 'Etendue de la publication' %} :</label>
|
<label class="control-label" for="edit_pub_base_id">{% trans 'Etendue de la publication' %} :</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select id="edit_pub_base_id" class="input-large" name="base_id" {% if feed.is_public() %}disabled="disabled"{% endif %}>
|
<select id="edit_pub_base_id" class="input-large" name="base_id" {% if feed.getPublic() %}disabled="disabled"{% endif %}>
|
||||||
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
<option value="">{% trans 'Non-Restreinte (publique)' %}</option>
|
||||||
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
{% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %}
|
||||||
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
|
<optgroup label="{{ databox.get_label(app['locale.I18n']) }}">
|
||||||
{% for collection in databox.get_collections() %}
|
{% for collection in databox.get_collections() %}
|
||||||
<option {% if feed.get_collection() and feed.get_collection().get_base_id() == collection.get_base_id() %}selected="selected"{% endif %} value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
<option {% if feed.getBaseId() and feed.getCollection(app).get_base_id() == collection.get_base_id() %}selected="selected"{% endif %} value="{{ collection.get_base_id() }}">{{ collection.get_name() }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="checkbox" for="edit_pub_public">
|
<label class="checkbox" for="edit_pub_public">
|
||||||
<input type="checkbox" id="edit_pub_public" class="input-large" name="public" value="1" {% if feed.is_public() %}checked="checked"{% endif %} />
|
<input type="checkbox" id="edit_pub_public" class="input-large" name="public" value="1" {% if feed.getPublic() %}checked="checked"{% endif %} />
|
||||||
{% trans 'Publique' %}
|
{% trans 'Publique' %}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -133,23 +133,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for publisher in feed.get_publishers() %}
|
{% for publisher in feed.getPublishers() %}
|
||||||
<tr class="{% if loop.index is odd %}odd{% else %}even{% endif %}">
|
<tr class="{% if loop.index is odd %}odd{% else %}even{% endif %}">
|
||||||
<td valign="center" align="left">
|
<td valign="center" align="left">
|
||||||
{{ publisher.get_user().get_id() }}
|
{{ publisher.getUsrId() }}
|
||||||
</td>
|
</td>
|
||||||
<td valign="center" align="left">
|
<td valign="center" align="left">
|
||||||
{{ publisher.get_user().get_display_name() }}
|
{{ publisher.getUser(app).get_display_name() }}
|
||||||
</td>
|
</td>
|
||||||
<td valign="center" align="left">
|
<td valign="center" align="left">
|
||||||
{{ publisher.get_user().get_email() }}
|
{{ publisher.getUser(app).get_email() }}
|
||||||
</td>
|
</td>
|
||||||
<td valign="center" align="center">
|
<td valign="center" align="center">
|
||||||
{% if publisher.is_owner() == true %}
|
{% if publisher.getOwner() == true %}
|
||||||
X
|
X
|
||||||
{% else %}
|
{% else %}
|
||||||
<form class="no-ajax form_publication" method="post" action="{{ path('admin_feeds_feed_remove_publisher', { 'id' : feed.get_id() }) }}" style="margin:0;">
|
<form class="no-ajax form_publication" method="post" action="{{ path('admin_feeds_feed_remove_publisher', { 'id' : feed.getId() }) }}" style="margin:0;">
|
||||||
<input type="hidden" value="{{ publisher.get_id() }}" name="publisher_id"/>
|
<input type="hidden" value="{{ publisher.getId() }}" name="publisher_id"/>
|
||||||
<button class="btn btn-mini">{% trans 'boutton::supprimer' %}</button>
|
<button class="btn btn-mini">{% trans 'boutton::supprimer' %}</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div>
|
<div>
|
||||||
<form class="no-ajax form_publication" id="publisher_adder" method="post" action="{{ path('admin_feeds_feed_add_publisher', { 'id' : feed.get_id() }) }}">
|
<form class="no-ajax form_publication" id="publisher_adder" method="post" action="{{ path('admin_feeds_feed_add_publisher', { 'id' : feed.getId() }) }}">
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{% trans 'Ajouter un publisher' %} :</label>
|
<label class="control-label">{% trans 'Ajouter un publisher' %} :</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
<a href="{{ path('admin_feeds_feed', { 'id' : feed.getId() }) }}" style="display:block;">{{ feed.getTitle() }}</a>
|
<a href="{{ path('admin_feeds_feed', { 'id' : feed.getId() }) }}" style="display:block;">{{ feed.getTitle() }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
{{ app['date-formatter'].getDate(feed.getCreated()) }}
|
{{ app['date-formatter'].getDate(feed.getCreatedOn()) }}
|
||||||
</td>
|
</td>
|
||||||
<td valign="center" align="center">
|
<td valign="center" align="center">
|
||||||
{% if feed.getCollection() != null %}
|
{% if feed.getCollection() != null %}
|
||||||
|
Reference in New Issue
Block a user