*
     * Can only be deleted if all of the following applies to the asset:
     * - has no active media file
     * - has no asset assignment
     * - is not connected to any feed
     * - is not connected to web player
     * 
     * @return boolean true if it should be deleted, otherwise false.
     */
    public function is_deletable()
    {
        return !$this->has_active_media_files() && !$this->has_asset_assignments() && !$this->is_connected_to_feed() && !$this->is_connected_to_web_player();
    }
    /**
     * @override \Podlove\Model\Base::delete();
     */
    public function delete()
    {
        foreach ($this->media_files() as $media_file) {
            $media_file->delete();
        }
        parent::delete();
    }
}
EpisodeAsset::property('id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
EpisodeAsset::property('title', 'VARCHAR(255)');
EpisodeAsset::property('file_type_id', 'INT');
EpisodeAsset::property('suffix', 'VARCHAR(255)');
EpisodeAsset::property('downloadable', 'INT');
EpisodeAsset::property('position', 'FLOAT');
Exemplo n.º 2
0
     *
     * @return \Podlove\Model\FileType|NULL
     */
    public function file_type()
    {
        return FileType::find_by_id($this->file_type_id);
    }
    /**
     * Fine all media file models in this location.
     * 
     * @return array|NULL
     */
    function media_files()
    {
        return MediaFile::find_all_by_episode_asset_id($this->id);
    }
    public function title()
    {
        if ($this->file_type_id) {
            return $this->file_type()->title();
        } else {
            return __('Notice: No file format defined.', 'podlove');
        }
    }
}
EpisodeAsset::property('id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
EpisodeAsset::property('title', 'VARCHAR(255)');
EpisodeAsset::property('file_type_id', 'INT');
EpisodeAsset::property('url_template', 'VARCHAR(255)');
EpisodeAsset::property('downloadable', 'INT');