예제 #1
0
 /**
  * @param ContentInterface|PosterInterface $item
  *
  * @return bool
  */
 public function isPoster($item)
 {
     if (!$this->logged()) {
         return false;
     }
     return (bool) array_intersect([$this->getId(), $this->getUserId()], [$item->getId(), $item->getPosterId(), $item->getUserId()]);
 }
예제 #2
0
 /**
  * Get Singleton album.
  * Each profile have some singleton album, etc: "wall", "mobile", "comments"
  *
  * @param  PosterInterface $parent
  *
  * @return \Platform\Photo\Model\PhotoAlbum
  */
 public function getSingletonAlbum(PosterInterface $parent)
 {
     $album = app()->table('platform_photo_album')->select()->where('parent_id=?', $parent->getId())->where('parent_type=?', $parent->getType())->one();
     if (empty($album)) {
         $album = new PhotoAlbum(['user_id' => $parent->getUserId(), 'poster_id' => $parent->getPosterId(), 'poster_type' => $parent->getPosterType(), 'parent_id' => $parent->getId(), 'parent_type' => $parent->getType(), 'parent_user_id' => $parent->getUserId(), 'title' => '', 'content' => '', 'description' => '', 'created_at' => KENDO_DATE_TIME, 'modified_at' => KENDO_DATE_TIME]);
         $album->save();
     }
     return $album;
 }