diff --git a/upload/application/modules/gamelist/config/config.php b/upload/application/modules/gamelist/config/config.php index 5b66635..9d30f58 100644 --- a/upload/application/modules/gamelist/config/config.php +++ b/upload/application/modules/gamelist/config/config.php @@ -56,6 +56,7 @@ public function getInstallSql() 'CREATE TABLE IF NOT EXISTS `[prefix]_gamelist` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `title` VARCHAR(100) NOT NULL, + `videourl` VARCHAR(100) NOT NULL, `image` VARCHAR(255) NULL DEFAULT NULL, `show` TINYINT(1) NOT NULL DEFAULT 1, PRIMARY KEY (`id`) diff --git a/upload/application/modules/gamelist/controllers/admin/Index.php b/upload/application/modules/gamelist/controllers/admin/Index.php index 3bdef2e..e3e63e1 100644 --- a/upload/application/modules/gamelist/controllers/admin/Index.php +++ b/upload/application/modules/gamelist/controllers/admin/Index.php @@ -88,9 +88,12 @@ public function treatAction() $post = [ 'title' => $this->getRequest()->getPost('title'), + 'videourl' => $this->getRequest()->getPost('videourl'), 'image' => $image ]; + $newvideoUrl = str_replace("https://www.youtube.com/watch?v=","", $post['videourl']); + $validation = Validation::create($post, [ 'title' => 'required', 'image' => 'required|url' @@ -104,7 +107,8 @@ public function treatAction() $model->setId($this->getRequest()->getParam('id')); } $model->setTitle($post['title']) - ->setImage($post['image']); + ->setVideourl($newvideoUrl) + ->setImage($post['image']); $gamesMapper->save($model); $this->redirect() diff --git a/upload/application/modules/gamelist/mappers/Games.php b/upload/application/modules/gamelist/mappers/Games.php index 1083448..9a834df 100644 --- a/upload/application/modules/gamelist/mappers/Games.php +++ b/upload/application/modules/gamelist/mappers/Games.php @@ -34,6 +34,7 @@ public function getEntries($where = []) $model = new GamesModel(); $model->setId($entry['id']) ->setTitle($entry['title']) + ->setVideourl($entry['videourl']) ->setImage($entry['image']) ->setShow($entry['show']); $entries[] = $model; @@ -63,6 +64,7 @@ public function getEntryById($id) $model = new GamesModel(); $model->setId($row['id']) ->setTitle($row['title']) + ->setVideourl($row['videourl']) ->setImage($row['image']) ->setShow($row['show']); @@ -78,6 +80,7 @@ public function save(GamesModel $entry) { $fields = [ 'title' => $entry->getTitle(), + 'videourl' => $entry->getVideourl(), 'image' => $entry->getImage(), 'show' => $entry->getShow() ]; diff --git a/upload/application/modules/gamelist/models/Games.php b/upload/application/modules/gamelist/models/Games.php index 89a6645..6c34aac 100644 --- a/upload/application/modules/gamelist/models/Games.php +++ b/upload/application/modules/gamelist/models/Games.php @@ -22,6 +22,13 @@ class Games extends \Ilch\Model */ protected $title; + /** + * The Videourl. + * + * @var string + */ + protected $videourl; + /** * The image. * @@ -69,6 +76,29 @@ public function getTitle() return $this->title; } + /** + * Sets the videourl. + * + * @param string $videourl + * @return $this + */ + public function setVideourl($videourl) + { + $this->videourl = (string)$videourl; + + return $this; + } + + /** + * Gets the videourl. + * + * @return string + */ + public function getVideourl() + { + return $this->videourl; + } + /** * Sets the title. * diff --git a/upload/application/modules/gamelist/translations/de.php b/upload/application/modules/gamelist/translations/de.php index c265c62..5261dd6 100644 --- a/upload/application/modules/gamelist/translations/de.php +++ b/upload/application/modules/gamelist/translations/de.php @@ -11,6 +11,7 @@ 'image' => 'Bild', 'members' => 'Mitglieder', 'games' => 'Spiele', + 'videourl' => 'Youtube URL', 'selectGames' => 'Spiele wählen', 'profileFieldHidden' => 'Feld vom Administrator ausgeblendet.', diff --git a/upload/application/modules/gamelist/translations/en.php b/upload/application/modules/gamelist/translations/en.php index 2d6f31a..423b041 100644 --- a/upload/application/modules/gamelist/translations/en.php +++ b/upload/application/modules/gamelist/translations/en.php @@ -11,6 +11,7 @@ 'image' => 'Image', 'members' => 'Members', 'games' => 'Games', + 'videourl' => 'Youtube URL', 'selectGames' => 'Select games', 'profileFieldHidden' => 'Field hidden by the administrator.', diff --git a/upload/application/modules/gamelist/views/admin/index/index.php b/upload/application/modules/gamelist/views/admin/index/index.php index db2204c..87a9749 100644 --- a/upload/application/modules/gamelist/views/admin/index/index.php +++ b/upload/application/modules/gamelist/views/admin/index/index.php @@ -18,6 +18,7 @@ getTrans('title') ?> + getTrans('videourl') ?> @@ -38,6 +39,7 @@ escape($entry->getTitle()) ?> + escape($entry->getVideourl()) ?> diff --git a/upload/application/modules/gamelist/views/admin/index/treat.php b/upload/application/modules/gamelist/views/admin/index/treat.php index 9451462..57ed9d6 100644 --- a/upload/application/modules/gamelist/views/admin/index/treat.php +++ b/upload/application/modules/gamelist/views/admin/index/treat.php @@ -13,6 +13,18 @@ class="form-control" value="get('entry') != '') ? $this->escape($this->get('entry')->getTitle()) : $this->originalInput('title') ?>"> +
+ +
+ +
+