示例#1
0
 /**
  * @param Newscoop\Package\Package $package
  */
 public function __construct(\Newscoop\Package\Package $package)
 {
     $this->slideshow = $package;
     $this->headline = $this->slideshow->getHeadline();
     $this->slug = $this->slideshow->getSlug();
     $this->items = new MetaSlideshowItemList($this->slideshow);
 }
 /**
  * @return void
  */
 public function rewind()
 {
     if ($this->items === null) {
         $this->items = new ArrayIterator($this->slideshow->getItems()->toArray());
     }
     return $this->items->rewind();
 }
示例#3
0
 public function testGetImageSpecs()
 {
     $rendition = new Rendition(200, 200, 'crop', 'test');
     $this->package->setRendition($rendition);
     $item = new Item($this->package, new LocalImage('test'));
     $item->setCoords('0_0_200_200');
     $this->assertEquals('crop_0_0_200_200', $item->getImageSpecs());
 }
示例#4
0
 /**
  * Has client
  *
  * @param \Newscoop\GimmeBundle\Entity\Client $client
  *
  * @return boolean
  */
 public function hasClient(\Newscoop\GimmeBundle\Entity\Client $client)
 {
     if ($this->clients->contains($client)) {
         return true;
     }
     return false;
 }
示例#5
0
 public function testReloadRenditions()
 {
     $this->service->getRenditions();
     $rendition = new Rendition(300, 200, 'crop', 'old');
     $rendition2 = new Rendition(300, 200, 'crop', 'packaged');
     $image = new LocalImage(self::PICTURE_PORTRAIT);
     $this->orm->persist($rendition);
     $this->orm->persist($rendition2);
     $this->orm->persist($image);
     $this->orm->flush();
     $package = new \Newscoop\Package\Package();
     $package->setHeadline('test');
     $package->setRendition($rendition2);
     $this->orm->persist($package);
     $this->orm->flush();
     $this->service->setArticleRendition(self::ARTICLE_NUMBER, $rendition, $image);
     $this->service->reloadRenditions();
     $this->assertEquals(6, count($this->service->getRenditions()));
     $this->assertFalse(array_key_exists('old', $this->service->getRenditions()));
     $this->assertTrue(array_key_exists('packaged', $this->service->getRenditions()));
     $articleRenditions = $this->service->getArticleRenditions(self::ARTICLE_NUMBER);
     $this->assertFalse($articleRenditions->offsetExists($rendition));
 }
示例#6
0
文件: Item.php 项目: nidzix/Newscoop
 /**
  * Get package id
  *
  * @return int
  */
 public function getPackageId()
 {
     return $this->package->getId();
 }