123456789101112131415161718192021222324252627 |
- <?php
- class Album extends DBObject implements JsonSerializable {
- public $Images=array();
- public function __construct($id=0,$forceUrl=false) {
- $repo=new ImageRepository();
- $field="album_id";
- if ($forceUrl || !is_numeric($id))
- $field="album_url";
- parent::__construct("albums", $field, $id);
- $this->Images=$repo->GetImagesByAlbum($this->AlbumId);
- }
- public function Save() {
- if (!isset($this->AlbumUrl) || $this->AlbumUrl==null || $this->AlbumUrl=="")
- $this->AlbumUrl=Utils::MakeUniqueURL("albums", "album_url", $this->AlbumTitle);
- parent::Save();
- }
- public function jsonSerialize() {
- $obj= parent::jsonSerialize();
- $obj->Images=$this->Images;
- return $obj;
- }
- }
|