diff --git a/Pub/Controller/Entry.php b/Pub/Controller/Entry.php index 5a5139e..9838ee6 100644 --- a/Pub/Controller/Entry.php +++ b/Pub/Controller/Entry.php @@ -2,6 +2,7 @@ namespace RomhackPlaza\Master\Pub\Controller; +use RomhackPlaza\Master\Helper\Laravel; use XF\Mvc\ParameterBag; use XF\Mvc\Reply\AbstractReply; use XF\Pub\Controller\AbstractController; @@ -47,4 +48,36 @@ class Entry extends AbstractController { ); } + + public static function getActivityDetails(array $activities) + { + return self::getActivityDetailsForContent( + $activities, + \XF::phrase('viewing_romhackplaza_entry'), + 'entry_id', + function (array $ids) + { + $db = Laravel::db(); + if( !$db || empty($ids) ) + return []; + + $entries = $db->fetchAll(" + SELECT id, complete_title as title, slug, type + FROM entries + WHERE id IN (" . $db->quote($ids) . ") + "); + + $data = []; + foreach( $entries as $entry ){ + $data[$entry['id']] = [ + 'title' => $entry['title'], + 'url' => \XF::options()->homePageUrl . '/' . $entry['type'] . '/' . $entry['slug'], + ]; + } + + return $data; + }, + \XF::phrase('viewing_romhackplaza_database') + ); + } } \ No newline at end of file diff --git a/Pub/Controller/News.php b/Pub/Controller/News.php index 6be0277..81ac7bd 100644 --- a/Pub/Controller/News.php +++ b/Pub/Controller/News.php @@ -2,6 +2,7 @@ namespace RomhackPlaza\Master\Pub\Controller; +use RomhackPlaza\Master\Helper\Laravel; use XF\Mvc\ParameterBag; use XF\Mvc\Reply\AbstractReply; use XF\Pub\Controller\AbstractController; @@ -15,7 +16,7 @@ class News extends AbstractController { if( !$laravelDb ) return $this->notFound(); - $entry = $laravelDb->fetchRow("SELECT id, slugFROM news WHERE id = ?", $entryId); + $entry = $laravelDb->fetchRow("SELECT id, slug FROM news WHERE id = ?", $entryId); if( !$entry ) return $this->notFound(); @@ -47,4 +48,35 @@ class News extends AbstractController { ); } + + public static function getActivityDetails(array $activities) + { + return self::getActivityDetailsForContent( + $activities, + \XF::phrase('viewing_romhackplaza_news'), + 'news_id', + function (array $ids) + { + $db = Laravel::db(); + if( !$db || empty($ids) ) + return []; + + $entries = $db->fetchAll(" + SELECT id, slug, title FROM news + WHERE id IN (" . $db->quote($ids) . ") + "); + + $data = []; + foreach( $entries as $entry ){ + $data[$entry['id']] = [ + 'title' => $entry['title'], + 'url' => \XF::options()->homePageUrl . '/news/' . $entry['slug'], + ]; + } + + return $data; + }, + \XF::phrase('viewing_romhackplaza_database') + ); + } } \ No newline at end of file diff --git a/Pub/Controller/RomhackPlaza.php b/Pub/Controller/RomhackPlaza.php new file mode 100644 index 0000000..30b35d4 --- /dev/null +++ b/Pub/Controller/RomhackPlaza.php @@ -0,0 +1,42 @@ +controller_action ){ + case 'Drafts': + return \XF::phrase('viewing_romhackplaza_drafts'); + break; + case 'Reviews': + return \XF::phrase('viewing_romhackplaza_reviews'); + break; + case 'Mod': + return \XF::phrase('performing_moderation_duties'); + break; + case 'Submit': + return \XF::phrase('viewing_romhackplaza_submit'); + break; + case 'Edit': + return \XF::phrase('viewing_romhackplaza_edit'); + break; + case 'Tools': + return \XF::phrase('viewing_romhackplaza_tools'); + break; + case 'Play': + return \XF::phrase('viewing_romhackplaza_play'); + break; + } + } + + return \XF::phrase('viewing_romhackplaza'); + } +} \ No newline at end of file diff --git a/_data/phrases.xml b/_data/phrases.xml index 9d3c5f9..28e5dcf 100644 --- a/_data/phrases.xml +++ b/_data/phrases.xml @@ -58,4 +58,5 @@ + diff --git a/_data/template_modifications.xml b/_data/template_modifications.xml index 9caa38b..fa0a13e 100644 --- a/_data/template_modifications.xml +++ b/_data/template_modifications.xml @@ -88,6 +88,13 @@ $0]]> $0]]> + + ]]> + ]]> + ]]> diff --git a/_output/phrases/_metadata.json b/_output/phrases/_metadata.json index aa80d76..f38c9e3 100644 --- a/_output/phrases/_metadata.json +++ b/_output/phrases/_metadata.json @@ -352,5 +352,65 @@ "version_id": 1010170, "version_string": "1.1.1", "hash": "4aacc0a0b65d374943a84f9a0c8ad173" + }, + "viewing_romhackplaza.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "7227f6290a7ed21eb99f9bf648271e1d" + }, + "viewing_romhackplaza_database.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "f5fed0a3a280a492e174885c4139b292" + }, + "viewing_romhackplaza_drafts.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "5fa6af4f4d92357c0702cb20a4723408" + }, + "viewing_romhackplaza_edit.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "3e9d8bab76d8ed750e1ebad609625ec3" + }, + "viewing_romhackplaza_entry.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "ddbf5cfda5b2f0fc93f9f6341cf9bba3" + }, + "viewing_romhackplaza_news.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "c978170b03d4f82db58b3e94649d1855" + }, + "viewing_romhackplaza_play.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "8b3437b63b894e8b6be5acf3949a0c6a" + }, + "viewing_romhackplaza_reviews.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "d45735f9e3a9b21520461e75df1eddf4" + }, + "viewing_romhackplaza_submit.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "0495b6c845b61f6d068d94895cf52fb2" + }, + "viewing_romhackplaza_tools.txt": { + "global_cache": false, + "version_id": 1010270, + "version_string": "1.1.2", + "hash": "c9ad17b928695681b4752643360f4102" } } \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza.txt b/_output/phrases/viewing_romhackplaza.txt new file mode 100644 index 0000000..7463b9d --- /dev/null +++ b/_output/phrases/viewing_romhackplaza.txt @@ -0,0 +1 @@ +Viewing the website \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_database.txt b/_output/phrases/viewing_romhackplaza_database.txt new file mode 100644 index 0000000..a9b4894 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_database.txt @@ -0,0 +1 @@ +Viewing database \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_drafts.txt b/_output/phrases/viewing_romhackplaza_drafts.txt new file mode 100644 index 0000000..e2c90e7 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_drafts.txt @@ -0,0 +1 @@ +Viewing drafts \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_edit.txt b/_output/phrases/viewing_romhackplaza_edit.txt new file mode 100644 index 0000000..c65900d --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_edit.txt @@ -0,0 +1 @@ +Edit an entry \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_entry.txt b/_output/phrases/viewing_romhackplaza_entry.txt new file mode 100644 index 0000000..a4d5000 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_entry.txt @@ -0,0 +1 @@ +Viewing entry \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_news.txt b/_output/phrases/viewing_romhackplaza_news.txt new file mode 100644 index 0000000..7b5eaaa --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_news.txt @@ -0,0 +1 @@ +Viewing news \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_play.txt b/_output/phrases/viewing_romhackplaza_play.txt new file mode 100644 index 0000000..baa0678 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_play.txt @@ -0,0 +1 @@ +Play online \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_reviews.txt b/_output/phrases/viewing_romhackplaza_reviews.txt new file mode 100644 index 0000000..7cfa513 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_reviews.txt @@ -0,0 +1 @@ +Viewing reviews \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_submit.txt b/_output/phrases/viewing_romhackplaza_submit.txt new file mode 100644 index 0000000..ec63f00 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_submit.txt @@ -0,0 +1 @@ +Create an entry \ No newline at end of file diff --git a/_output/phrases/viewing_romhackplaza_tools.txt b/_output/phrases/viewing_romhackplaza_tools.txt new file mode 100644 index 0000000..fdaf350 --- /dev/null +++ b/_output/phrases/viewing_romhackplaza_tools.txt @@ -0,0 +1 @@ +Use tools \ No newline at end of file diff --git a/addon.json b/addon.json index 5747f81..8e350fa 100644 --- a/addon.json +++ b/addon.json @@ -2,8 +2,8 @@ "legacy_addon_id": "", "title": "RomhackPlaza Master Addon", "description": "", - "version_id": 1010170, - "version_string": "1.1.1", + "version_id": 1010270, + "version_string": "1.1.2", "dev": "", "dev_url": "", "faq_url": "",