diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index 9cc1d585fd..e19bf9d6df 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -62,7 +62,7 @@ class Publications implements ControllerProviderInterface $feed->setIconUrl(false); if ($request->request->get('public') == '1') { - $feed->setPublic(true); + $feed->setIsPublic(true); } elseif ($request->request->get('base_id')) { $feed->setCollection(\collection::get_from_base_id($app, $request->request->get('base_id'))); } @@ -102,7 +102,7 @@ class Publications implements ControllerProviderInterface $feed->setSubtitle($subtitle); } $feed->setCollection($collection); - $feed->setPublic($request->request->get('public') === '1' ? true : false); + $feed->setIsPublic($request->request->get('public') === '1' ? true : false); $app['EM']->persist($feed); $app['EM']->flush(); diff --git a/lib/Alchemy/Phrasea/Controller/Lightbox.php b/lib/Alchemy/Phrasea/Controller/Lightbox.php index 56c966e2c0..440be22108 100644 --- a/lib/Alchemy/Phrasea/Controller/Lightbox.php +++ b/lib/Alchemy/Phrasea/Controller/Lightbox.php @@ -161,12 +161,12 @@ class Lightbox implements ControllerProviderInterface $controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(SilexApplication $app, $entry_id, $item_id) { $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($entry_id); - $item = $entry->getItems()->getItem($item_id); + $item = $entry->getItem($item_id); if ($app['browser']->isMobile()) { $output = $app['twig']->render('lightbox/feed_element.html.twig', array( 'feed_element' => $item, - 'module_name' => $item->getRecord()->get_title() + 'module_name' => $item->getRecord($app)->get_title() ) ); @@ -181,12 +181,12 @@ class Lightbox implements ControllerProviderInterface } $ret = array(); - $ret['number'] = $item->get_record()->get_number(); - $ret['title'] = $item->get_record()->get_title(); + $ret['number'] = $item->getRecord($app)->get_number(); + $ret['title'] = $item->getRecord($app)->get_title(); - $ret['preview'] = $app['twig']->render($template_preview, array('record' => $item->get_record(), 'not_wrapped' => true)); + $ret['preview'] = $app['twig']->render($template_preview, array('record' => $item->getRecord($app), 'not_wrapped' => true)); $ret['options_html'] = $app['twig']->render($template_options, array('feed_element' => $item)); - $ret['caption'] = $app['twig']->render($template_caption, array('view' => 'preview', 'record' => $item->get_record())); + $ret['caption'] = $app['twig']->render($template_caption, array('view' => 'preview', 'record' => $item->getRecord($app))); $ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = ''; @@ -313,7 +313,7 @@ class Lightbox implements ControllerProviderInterface return $app->redirectPath('logout'); } - $feed_entry = $app['EM']->getEntity('Entities\FeedEntry')->find($entry_id); + $feed_entry = $app['EM']->getRepository('Entities\FeedEntry')->find($entry_id); $template = 'lightbox/feed.html.twig'; @@ -322,10 +322,11 @@ class Lightbox implements ControllerProviderInterface } $content = $feed_entry->getItems(); + $first = $content->first(); $output = $app['twig']->render($template, array( 'feed_entry' => $feed_entry, - 'first_item' => array_shift($content), + 'first_item' => $first, 'local_title' => $feed_entry->getTitle(), 'module' => 'lightbox', 'module_name' => _('admin::monitor: module validation') diff --git a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php index 68e41056ab..705cd18e36 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php +++ b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php @@ -36,7 +36,7 @@ class RSSFeeds implements ControllerProviderInterface $app->abort(404, 'Feed not found'); } - if (!$feed->getPublic()) { + if (!$feed->isPublic()) { $app->abort(403, 'Forbidden'); } @@ -110,7 +110,7 @@ class RSSFeeds implements ControllerProviderInterface $page = (int) $request->query->get('page'); $page = $page < 1 ? 1 : $page; - return $app[$this->getFormater('cooliris')]->createResponse($feed, $page); + return $app[$this->getFormater('cooliris')]->createResponse($feed, $page, null, 'Phraseanet', $app); }) ->bind('feed_public_cooliris'); diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php index c207d47eab..c81a6d70a7 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php @@ -11,6 +11,7 @@ namespace Alchemy\Phrasea\Feed\Formatter; +use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Feed\FeedInterface; use Alchemy\Phrasea\Feed\Link\FeedLink; use Alchemy\Phrasea\Feed\Link\LinkGeneratorCollection; @@ -34,7 +35,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf return $response; } - public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet') + public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', $app = null) { $title = $feed->getTitle(); $subtitle = $feed->getSubtitle(); diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php index 74fbc4c734..c7db287a10 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php @@ -11,6 +11,7 @@ namespace Alchemy\Phrasea\Feed\Formatter; +use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Feed\FeedInterface; use Alchemy\Phrasea\Feed\Link\LinkGeneratorCollection; use Symfony\Component\HttpFoundation\Response; @@ -26,15 +27,15 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn $this->linkGenerator = $generator; } - public function createResponse(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet') + public function createResponse(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', $app = null) { - $content = $this->format($feed, $page, $user, $generator); + $content = $this->format($feed, $page, $user, $generator, $app); $response = new Response($content, 200, array('Content-Type' => 'application/rss+xml')); $response->setCharset('UTF-8'); return $response; } - public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet') + public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', $app = null) { $title = $feed->getTitle(); $subtitle = $feed->getSubtitle(); @@ -158,28 +159,28 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn } foreach ($feed->getEntries() as $item) { - $this->addItem($doc, $channel, $item); + $this->addItem($app, $doc, $channel, $item); } return $doc->saveXML(); } - protected function addItem(\DOMDocument $document, \DOMNode $feed, FeedEntry $entry) + protected function addItem(Application $app, \DOMDocument $document, \DOMNode $feed, FeedEntry $entry) { foreach ($entry->get_content() as $content) { - $this->addContent($document, $feed, $entry, $content); + $this->addContent($app, $document, $feed, $entry, $content); } } - protected function addContent(\DOMDocument $document, \DOMNode $node, FeedItem $content) + protected function addContent(Application $app, \DOMDocument $document, \DOMNode $node, FeedItem $content) { - $preview_sd = $content->getRecord()->get_subdef('preview'); + $preview_sd = $content->getRecord($app)->get_subdef('preview'); $preview_permalink = $preview_sd->get_permalink(); - $thumbnail_sd = $content->getRecord()->get_thumbnail(); + $thumbnail_sd = $content->getRecord($app)->get_thumbnail(); $thumbnail_permalink = $thumbnail_sd->get_permalink(); - $medium = strtolower($content->getRecord()->get_type()); + $medium = strtolower($content->getRecord($app)->get_type()); if ( ! in_array($medium, array('image', 'audio', 'video'))) { return $this; @@ -192,13 +193,13 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn //add item node to channel node $item = $this->addTag($document, $node, 'item'); - $caption = $content->getRecord()->get_caption(); + $caption = $content->getRecord($app)->get_caption(); $title_field = $caption->get_dc_field(databox_Field_DCESAbstract::Title); if ($title_field) { $str_title = $title_field->get_serialized_values(' '); } else { - $str_title = $content->getRecord()->get_title(); + $str_title = $content->getRecord($app)->get_title(); } //attach tile node to item node @@ -214,7 +215,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn //attach desc node to item node $desc = $this->addTag($document, $item, 'description', $str_desc); - $duration = $content->getRecord()->get_duration(); + $duration = $content->getRecord($app)->get_duration(); if ($preview_permalink) { $preview = $this->addTag($document, $item, 'media:content'); diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php index 97974f2729..3f87da30cb 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php @@ -11,6 +11,8 @@ namespace Alchemy\Phrasea\Feed\Formatter; +use Alchemy\Phrasea\Application; + abstract class FeedFormatterAbstract { const PAGE_SIZE = 20; @@ -41,14 +43,14 @@ abstract class FeedFormatterAbstract * @param FeedItem $content * @return FeedFormaterInterface */ - protected function addContent(\DOMDocument $document, \DOMNode $item, FeedItem $content) + protected function addContent(Application $app, \DOMDocument $document, \DOMNode $item, FeedItem $content) { - $preview_sd = $content->getRecord()->get_subdef('preview'); + $preview_sd = $content->getRecord($app)->get_subdef('preview'); $preview_permalink = $preview_sd->get_permalink(); - $thumbnail_sd = $content->getRecord()->get_thumbnail(); + $thumbnail_sd = $content->getRecord($app)->get_thumbnail(); $thumbnail_permalink = $thumbnail_sd->get_permalink(); - $medium = strtolower($content->getRecord()->get_type()); + $medium = strtolower($content->getRecord($app)->get_type()); if ( ! in_array($medium, array('image', 'audio', 'video'))) { return $this; @@ -60,7 +62,7 @@ abstract class FeedFormatterAbstract $group = $this->addTag($document, $item, 'media:group'); - $caption = $content->getRecord()->get_caption(); + $caption = $content->getRecord($app)->get_caption(); $title_field = $caption->get_dc_field(databox_Field_DCESAbstract::Title); if ($title_field) { diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterInterface.php b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterInterface.php index 7d6a8ecaeb..a028f73333 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterInterface.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterInterface.php @@ -16,5 +16,5 @@ interface FeedFormatterInterface * * @return string */ - public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet'); + public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', $app = null); } diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php index 34f504427b..859fadfbdf 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php @@ -11,6 +11,7 @@ namespace Alchemy\Phrasea\Feed\Formatter; +use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Feed\FeedInterface; use Alchemy\Phrasea\Feed\Link\FeedLink; use Alchemy\Phrasea\Feed\Link\LinkGeneratorCollection; @@ -35,7 +36,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa return $response; } - public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet') + public function format(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', $app = null) { $title = $feed->getTitle(); $subtitle = $feed->getSubtitle(); diff --git a/lib/Doctrine/Entities/Feed.php b/lib/Doctrine/Entities/Feed.php index 7b4bd64d5e..8c778d02f6 100644 --- a/lib/Doctrine/Entities/Feed.php +++ b/lib/Doctrine/Entities/Feed.php @@ -91,7 +91,7 @@ class Feed implements FeedInterface * @param boolean $public * @return Feed */ - public function setPublic($public) + public function setIsPublic($public) { $this->public = $public; @@ -103,7 +103,7 @@ class Feed implements FeedInterface * * @return boolean */ - public function getPublic() + public function isPublic() { return $this->public; } diff --git a/lib/Doctrine/Entities/FeedItem.php b/lib/Doctrine/Entities/FeedItem.php index b277e5cd2a..552660728f 100644 --- a/lib/Doctrine/Entities/FeedItem.php +++ b/lib/Doctrine/Entities/FeedItem.php @@ -2,7 +2,7 @@ namespace Entities; -use Doctrine\ORM\Mapping as ORM; +use Alchemy\Phrasea\Application; /** * FeedItem @@ -196,4 +196,9 @@ class FeedItem { $this->setOrd($this->getEntry()->getItems()->count() + 1); } + + public function getRecord(Application $app) + { + return new \record_adapter($app, $this->getSbasId(), $this->getRecordId(), $this->getOrd()); + } } diff --git a/lib/Doctrine/Repositories/SessionRepository.php b/lib/Doctrine/Repositories/SessionRepository.php index a3ca1b71e0..93487f3287 100644 --- a/lib/Doctrine/Repositories/SessionRepository.php +++ b/lib/Doctrine/Repositories/SessionRepository.php @@ -57,7 +57,7 @@ class SessionRepository extends EntityRepository $feed = $this->find($id); if ($feed) { $coll = $feed->getCollection($app); - if ($feed->getPublic() + if ($feed->isPublic() || $coll === null || in_array($coll->get_base_id(), array_keys($user->ACL()->get_granted_base()))) { return $feed; diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php index 773c5d6eb5..92e4bbbf2b 100644 --- a/lib/classes/API/V1/adapter.php +++ b/lib/classes/API/V1/adapter.php @@ -9,11 +9,16 @@ * file that was distributed with this source code. */ +use Alchemy\Phrasea\Feed\Aggregate; +use Alchemy\Phrasea\Feed\FeedInterface; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\Attribute\Status; use Alchemy\Phrasea\Border\Manager as BorderManager; +use Entities\Feed; +use Entities\FeedEntry; +use Entities\FeedItem; use Entities\UserQuery; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -1479,10 +1484,10 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($this->app, $request, $this); - $coll = Feed_Collection::load_all($this->app, $user); + $coll = $this->app['EM']->getRepository('Entities\Feed')->getAllForUser($user); $datas = array(); - foreach ($coll->get_feeds() as $feed) { + foreach ($coll as $feed) { $datas[] = $this->list_publication($feed, $user); } @@ -1512,7 +1517,7 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($this->app, $request, $this); - $feed = Feed_Adapter::load_with_user($this->app, $user, $publication_id); + $feed = $this->app['EM']->getRepository('Entities\Feed')->loadWithUser($this->app, $user, $publication_id); $offset_start = (int) ($request->get('offset_start') ? : 0); $per_page = (int) ($request->get('per_page') ? : 5); @@ -1535,7 +1540,7 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($this->app, $request, $this); - $feed = Feed_Aggregate::load_with_user($this->app, $user); + $feed = Aggregate::createFromUser($this->app['EM'], $user); $offset_start = (int) ($request->get('offset_start') ? : 0); $per_page = (int) ($request->get('per_page') ? : 5); @@ -1543,7 +1548,7 @@ class API_V1_adapter extends API_V1_Abstract $per_page = (($per_page >= 1) && ($per_page <= 20)) ? $per_page : 5; $datas = array( - 'total_entries' => $feed->get_count_total_entries(), + 'total_entries' => $feed->getCountTotalEntries(), 'offset_start' => $offset_start, 'per_page' => $per_page, 'entries' => $this->list_publications_entries($feed, $offset_start, $per_page), @@ -1558,9 +1563,9 @@ class API_V1_adapter extends API_V1_Abstract { $result = new API_V1_result($this->app, $request, $this); - $entry = Feed_Entry_Adapter::load_from_id($this->app, $entry_id); + $entry = $this->app['EM']->getRepository('Entities\FeedEntry')->find($entry_id); - $collection = $entry->get_feed()->get_collection(); + $collection = $entry->getFeed()->getCollection($this->app); if (null !== $collection && !$user->ACL()->has_access_to_base($collection->get_base_id())) { throw new \API_V1_exception_forbidden('You have not access to the parent feed'); @@ -1578,38 +1583,38 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve detailled informations about one feed * - * @param Feed_Adapter $feed + * @param Feed $feed * @param type $user * @return array */ - protected function list_publication(Feed_Adapter $feed, $user) + protected function list_publication(Feed $feed, $user) { return array( - 'id' => $feed->get_id(), - 'title' => $feed->get_title(), - 'subtitle' => $feed->get_subtitle(), - 'total_entries' => $feed->get_count_total_entries(), - 'icon' => $feed->get_icon_url(), - 'public' => $feed->is_public(), - 'readonly' => !$feed->is_publisher($user), - 'deletable' => $feed->is_owner($user), - 'created_on' => $feed->get_created_on()->format(DATE_ATOM), - 'updated_on' => $feed->get_updated_on()->format(DATE_ATOM), + 'id' => $feed->getId(), + 'title' => $feed->getTitle(), + 'subtitle' => $feed->getSubtitle(), + 'total_entries' => $feed->getCountTotalEntries(), + 'icon' => $feed->getIconUrl(), + 'public' => $feed->isPublic(), + 'readonly' => !$feed->isPublisher($user), + 'deletable' => $feed->isOwner($user), + 'created_on' => $feed->getCreatedOn()->format(DATE_ATOM), + 'updated_on' => $feed->getUpdatedOn()->format(DATE_ATOM), ); } /** * Retrieve all entries of one feed * - * @param Feed_Adapter $feed + * @param FeedInterface $feed * @param int $offset_start * @param int $how_many * @return array */ - protected function list_publications_entries(Feed_Abstract $feed, $offset_start = 0, $how_many = 5) + protected function list_publications_entries(FeedInterface $feed, $offset_start = 0, $how_many = 5) { - $entries = $feed->get_entries($offset_start, $how_many)->get_entries(); + $entries = $feed->getEntries($offset_start, $how_many); $out = array(); foreach ($entries as $entry) { @@ -1622,42 +1627,42 @@ class API_V1_adapter extends API_V1_Abstract /** * Retrieve detailled information about one feed entry * - * @param Feed_Entry_Adapter $entry + * @param FeedEntry $entry * @return array */ - protected function list_publication_entry(Feed_Entry_Adapter $entry) + protected function list_publication_entry(FeedEntry $entry) { $items = array(); - foreach ($entry->get_content() as $item) { + foreach ($entry->getItems() as $item) { $items[] = $this->list_publication_entry_item($item); } return array( - 'id' => $entry->get_id(), - 'author_email' => $entry->get_author_email(), - 'author_name' => $entry->get_author_name(), - 'created_on' => $entry->get_created_on()->format(DATE_ATOM), - 'updated_on' => $entry->get_updated_on()->format(DATE_ATOM), - 'title' => $entry->get_title(), - 'subtitle' => $entry->get_subtitle(), + 'id' => $entry->getId(), + 'author_email' => $entry->getAuthorEmail(), + 'author_name' => $entry->getAuthorName(), + 'created_on' => $entry->getCreatedOn()->format(DATE_ATOM), + 'updated_on' => $entry->getUpdatedOn()->format(DATE_ATOM), + 'title' => $entry->getTitle(), + 'subtitle' => $entry->getSubtitle(), 'items' => $items, - 'feed_id' => $entry->get_feed()->get_id(), - 'feed_url' => '/feeds/' . $entry->get_feed()->get_id() . '/content/', - 'url' => '/feeds/entry/' . $entry->get_id() . '/', + 'feed_id' => $entry->getFeed()->getId(), + 'feed_url' => '/feeds/' . $entry->getFeed()->getId() . '/content/', + 'url' => '/feeds/entry/' . $entry->getId() . '/', ); } /** * Retrieve detailled informations about one feed entry item * - * @param Feed_Entry_Item $item + * @param FeedItem $item * @return array */ - protected function list_publication_entry_item(Feed_Entry_Item $item) + protected function list_publication_entry_item(FeedItem $item) { $datas = array( - 'item_id' => $item->get_id() - , 'record' => $this->list_record($item->get_record()) + 'item_id' => $item->getId() + , 'record' => $this->list_record($item->getRecord($this->app)) ); return $datas; diff --git a/lib/classes/eventsmanager/notify/feed.php b/lib/classes/eventsmanager/notify/feed.php index 55783d5bb8..ec521f6e0f 100644 --- a/lib/classes/eventsmanager/notify/feed.php +++ b/lib/classes/eventsmanager/notify/feed.php @@ -140,7 +140,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract $sx = simplexml_load_string($datas); try { - $entry = $this->app['EM']->getRepository("Entities\FeedEntry")->find((int) $sx->entry_id); + $entry = $this->app['EM']->getRepository('Entities\FeedEntry')->find((int) $sx->entry_id); } catch (\Exception $e) { return array(); } diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php index 49a60c2461..2d94004888 100644 --- a/lib/classes/record/preview.php +++ b/lib/classes/record/preview.php @@ -175,30 +175,30 @@ class record_preview extends record_adapter } break; case "FEED": - $entry = Feed_Entry_Adapter::load_from_id($app, $contId); + $entry = $app['EM']->getRepository('Entities\FeedEntry')->find($contId); $this->container = $entry; - $this->total = count($entry->get_content()); + $this->total = count($entry->getItems()); $i = 0; $first = true; - foreach ($entry->get_content() as $element) { + foreach ($entry->getItems() as $element) { $i ++; if ($first) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); $this->original_item = $element; - $this->name = $entry->get_title(); - $number = $element->get_ord(); + $this->name = $entry->getTitle(); + $number = $element->getOrd(); } $first = false; - if ($element->get_ord() == $pos) { - $sbas_id = $element->get_record()->get_sbas_id(); - $record_id = $element->get_record()->get_record_id(); + if ($element->getOrd() == $pos) { + $sbas_id = $element->getRecord()->get_sbas_id(); + $record_id = $element->getRecord()->get_record_id(); $this->original_item = $element; - $this->name = $entry->get_title(); - $number = $element->get_ord(); + $this->name = $entry->getTitle(); + $number = $element->getOrd(); } } break; diff --git a/lib/conf.d/PhraseaFixture/Feed/LoadOneFeed.php b/lib/conf.d/PhraseaFixture/Feed/LoadOneFeed.php new file mode 100644 index 0000000000..dcdd8a97fc --- /dev/null +++ b/lib/conf.d/PhraseaFixture/Feed/LoadOneFeed.php @@ -0,0 +1,95 @@ +user) { + throw new \LogicException('Fill a user to store a new feed'); + } + + $feed = new Feed(); + + $publisher = new \Entities\FeedPublisher(); + $publisher->setUsrId($this->user->get_id()); + $publisher->setIsOwner(true); + $publisher->setFeed($feed); + + $feed->addPublisher($publisher); + if (isset($this->title) && $this->title !== null) { + $feed->setTitle($this->title); + } + else { + $feed->setTitle("test"); + } + + if (isset($this->public) && $this->public !== null) { + $feed->setIsPublic($this->public); + } + + $feed->setSubtitle("description"); + + $manager->persist($feed); + $manager->persist($publisher); + $manager->flush(); + + $this->feed = $feed; + + $this->addReference('one-feed', $feed); + } + + public function setUser(\User_Adapter $user) + { + $this->user = $user; + } + + public function getUser() + { + return $this->user; + } + + public function setTitle($title) + { + $this->title = $title; + } + + public function getTitle() + { + return $this->title; + } + + public function setPublic($public) + { + $this->public = $public; + } + + public function getPublic() + { + return $this->public; + } +} diff --git a/templates/mobile/lightbox/feed.html.twig b/templates/mobile/lightbox/feed.html.twig index c3eeeb2006..526d323729 100644 --- a/templates/mobile/lightbox/feed.html.twig +++ b/templates/mobile/lightbox/feed.html.twig @@ -12,26 +12,26 @@ {% block content %}
-

{{feed_entry.get_title()}}

+

{{feed_entry.getTitle()}}

{% trans 'Home' %}

- {{feed_entry.get_subtitle()|nl2br|raw}} + {{feed_entry.getSubtitle()|nl2br|raw}}

- {% set author = feed_entry.get_author_name() %} + {% set author = feed_entry.getAuthorName() %} {% trans %}Par {{ author }}{% endtrans %} - {% set entry_length = feed_entry.get_content()|length %} + {% set entry_length = feed_entry.getItems()|length %} {% trans %}{{entry_length}} documents{% endtrans %}

diff --git a/templates/mobile/lightbox/feed_element.html.twig b/templates/mobile/lightbox/feed_element.html.twig index 66006c3a6f..870e3c4697 100644 --- a/templates/mobile/lightbox/feed_element.html.twig +++ b/templates/mobile/lightbox/feed_element.html.twig @@ -11,11 +11,11 @@ {% endblock %} {% block content %} - {% set record = feed_element.get_record() %} + {% set record = feed_element.getRecord(app) %}
- Back -

{{feed_element.get_ord()}} - {{record.get_title()}}

+ Back +

{{feed_element.getOrd()}} - {{record.getTitle()}}

Home
diff --git a/templates/web/admin/publications/fiche.html.twig b/templates/web/admin/publications/fiche.html.twig index 75ea22fc7c..57e0c65dcd 100644 --- a/templates/web/admin/publications/fiche.html.twig +++ b/templates/web/admin/publications/fiche.html.twig @@ -99,7 +99,7 @@
- {% for databox in app['authentication'].getUser().ACL().get_granted_sbas('bas_chupub') %} @@ -114,7 +114,7 @@
diff --git a/templates/web/admin/publications/list.html.twig b/templates/web/admin/publications/list.html.twig index 522b44bc71..b9414b0f73 100644 --- a/templates/web/admin/publications/list.html.twig +++ b/templates/web/admin/publications/list.html.twig @@ -85,7 +85,7 @@ {% endif %} - {% if feed.getPublic() %} + {% if feed.isPublic() %} {% endif %} diff --git a/templates/web/lightbox/IE6/feed.html.twig b/templates/web/lightbox/IE6/feed.html.twig index 654cdd89f3..c961530e19 100644 --- a/templates/web/lightbox/IE6/feed.html.twig +++ b/templates/web/lightbox/IE6/feed.html.twig @@ -18,11 +18,11 @@ -
{% if first_item %}{{first_item.get_ord()}}{% endif %}
+
{% if first_item %}{{first_item.getOrd()}}{% endif %}
-
- {% if first_item %}{{first_item.get_record().get_title}}{% endif %} +
+ {% if first_item %}{{first_item.getRecord(app).get_title}}{% endif %}
@@ -34,10 +34,10 @@