public function addAlbum($request, $title, $number = null, $mini = null)
 {
     $daoAlbum = $this->dao->getDAO("Album");
     $albumTitle = $title == null ? 'Album glowny' : $title;
     if ($number == 0) {
         $number = $daoAlbum->countByUserId($_SESSION['oUser']->getId());
         ++$number;
     }
     if ($mini != null) {
         $icon = $mini;
     }
     $album = new Album();
     $album->setAccess(NewPhotoEnum::ALBUM_PUBLIC);
     $album->setAdded($album->getAdded());
     $album->setDescription($request->getDescription());
     $album->setNumber($number);
     $album->setTitle($albumTitle);
     $album->setIcon($icon);
     $album->setUserId($_SESSION['oUser']->getId());
     $albumAdded = $daoAlbum->save($album);
     return $albumAdded;
 }
Example #2
0
 private function setAlbumDescription()
 {
     Module::dependencies(isset($_POST['albumID'], $_POST['description']));
     $album = new Album($this->database, $this->plugins, $this->settings, $_POST['albumID']);
     echo $album->setDescription($_POST['description']);
 }
 /**
  * Converts the album fetched from the database to the Album object.
  */
 private function convertAlbum($row)
 {
     $album = new Album($row['id'], $row['owner_id']);
     $album->setTitle($row['title']);
     $album->setDescription($row['description']);
     $album->setMediaMimeType($row['media_mime_type']);
     $album->setThumbnailUrl($row['thumbnail_url']);
     $album->setMediaType($row['media_type']);
     $album->setMediaItemCount($row['media_item_count']);
     if (isset($row['address_id'])) {
         $album->setLocation($this->getAddress($row['address_id']));
     }
     $album->setMediaItemCount($this->getCount("select count(*) from media_items where album_id = " . $row['id']));
     return $album;
 }