| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * Klasse für den Datenzugriff
- */
- class Model {
- public static function getSourceBySourceID($sourceID) {
- return $GLOBALS['db']->getAllAssocCustom("sources", "ORDER BY `name` ASC", "id", $sourceID);
- }
- public static function getSeries() {
- return $GLOBALS['db']->getAllAssocCustom("series", "ORDER BY `name` ASC");
- }
- public static function getSeriesBySeriesID($seriesID) {
- return $GLOBALS['db']->getAllAssocCustom("series", "ORDER BY `name` ASC", "id", $seriesID);
- }
- public static function getMovies() {
- return $GLOBALS['db']->getAllAssocCustom("movies", "ORDER BY `name` ASC");
- }
- public static function getSeasonBySeasonID($seasonID) {
- return $GLOBALS['db']->getAllAssocCustom("series-seasons", "ORDER BY `number` ASC", "id", $seasonID);
- }
- public static function getSeasonsBySeriesID($seriesID) {
- return $GLOBALS['db']->getAllAssocCustom("series-seasons", "ORDER BY `number` ASC", "series-id", $seriesID);
- }
- public static function getEpisodesBySeasonID($seasonID) {
- return $GLOBALS['db']->getAllAssocCustom("series-episodes", "ORDER BY `number` ASC", "season-id", $seasonID);
- }
- public static function getEpisodeByID($episodeID) {
- return $GLOBALS['db']->getAllAssoc("series-episodes", "id", $episodeID);
- }
- public static function getAbsouluteVideoPathByEpisodeID($episodeID) {
- $episode = self::getEpisodeByID($episodeID);
- $season = self::getSeasonBySeasonID($episode[0]['season-id']);
- $series = self::getSeriesBySeriesID($season[0]['series-id']);
- $source = self::getSourceBySourceID($series[0]['source']);
- if($season[0]['number'] < 10) {
- return $source[0]['path'] . "/" . $series[0]['path'] . "/S0" . $season[0]['number'] . "/" . $episode[0]['path'];
- } else {
- return $source[0]['path'] . "/" . $series[0]['path'] . "/S" . $season[0]['number'] . "/" . $episode[0]['path'];
- }
- }
- public static function getUserIDByMail($userMail) {
- return $GLOBALS['db']->getAllAssoc("users", "mail", $userMail);
- }
- public static function getMovieByID($movieID) {
- return $GLOBALS['db']->getAllAssoc("movies", "id", $movieID);
- }
- public static function getAbsouluteVideoPathByMovieID($movieID) {
- $movie = self::getMovieByID($movieID);
- $source = self::getSourceBySourceID($movie[0]['source']);
- return $source[0]['path'] . "/" . $movie[0]['path'];
- }
- }
- ?>
|