Commit | Line | Data |
---|---|---|
59ab4d0f | 1 | <?php |
a9229942 | 2 | |
59ab4d0f | 3 | namespace wcf\data\media; |
a9229942 | 4 | |
59ab4d0f MS |
5 | use wcf\system\WCF; |
6 | ||
7 | /** | |
a5a4f02d | 8 | * Represents a list of viewable media files. |
e82bf444 | 9 | * |
a9229942 TD |
10 | * @author Matthias Schmidt |
11 | * @copyright 2001-2019 WoltLab GmbH | |
12 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
13 | * @package WoltLabSuite\Core\Data\Media | |
14 | * @since 3.0 | |
15 | * | |
16 | * @method ViewableMedia current() | |
17 | * @method ViewableMedia[] getObjects() | |
18 | * @method ViewableMedia|null search($objectID) | |
19 | * @property ViewableMedia[] $objects | |
59ab4d0f | 20 | */ |
a9229942 TD |
21 | class ViewableMediaList extends MediaList |
22 | { | |
23 | /** | |
24 | * @inheritDoc | |
25 | */ | |
26 | public $decoratorClassName = ViewableMedia::class; | |
27 | ||
28 | /** | |
29 | * Creates a new ViewableMediaList object. | |
30 | * | |
31 | * @param int|null $languageID | |
32 | */ | |
33 | public function __construct($languageID = null) | |
34 | { | |
35 | parent::__construct(); | |
36 | ||
37 | if ($languageID === null) { | |
38 | $languageID = WCF::getLanguage()->languageID; | |
39 | } | |
40 | ||
41 | // fetch content data | |
42 | $this->sqlSelects .= "media_content.*, COALESCE(media.languageID, " . $languageID . ") AS localizedLanguageID"; | |
d3bd0a85 MS |
43 | $this->sqlJoins .= " |
44 | LEFT JOIN wcf" . WCF_N . "_media_content media_content | |
45 | ON media_content.mediaID = media.mediaID | |
46 | AND media_content.languageID = COALESCE(media.languageID, " . $languageID . ")"; | |
a9229942 | 47 | } |
59ab4d0f | 48 | } |