Album.php 576 B

123456789101112131415161718192021
  1. <?php
  2. class Album extends DBObject {
  3. public $Images=array();
  4. public function __construct($id=0,$forceUrl=false) {
  5. $repo=new ImageRepository();
  6. $field="album_id";
  7. if ($forceUrl || !is_numeric($id))
  8. $field="album_url";
  9. parent::__construct("albums", $field, $id);
  10. $this->Images=$repo->GetImagesByAlbum($this->AlbumId);
  11. }
  12. public function Save() {
  13. if (!isset($this->AlbumUrl) || $this->AlbumUrl==null || $this->AlbumUrl=="")
  14. $this->AlbumUrl=Utils::MakeUniqueURL("albums", "album_url", $this->AlbumTitle);
  15. parent::Save();
  16. }
  17. }