diff --git a/composer.json b/composer.json index 54c0750..88ea64e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "oneplace/oneplace-core", "description": "onePlace Core Application", "type": "project", - "version": "1.0.21", + "version": "1.0.22", "license": "BSD-3-Clause", "keywords": [ "laminas", diff --git a/module/Application/data/data.sql b/module/Application/data/data.sql index 9424597..5c76c5c 100644 --- a/module/Application/data/data.sql +++ b/module/Application/data/data.sql @@ -32,4 +32,9 @@ INSERT INTO `core_widget` (`Widget_ID`, `widget_name`, `label`, `permission`) VA (NULL, 'manage_themes', 'Manage Themes', 'themes-Application\\Controller\\IndexController'), (NULL, 'discover_modules', 'Discover Modules', 'update-Application\\Controller\\IndexController'), (NULL, 'help_support', 'Help & Support', 'index-Application\\Controller\\IndexController'), -(NULL, 'welcome_default', 'Welcome Default', 'index-Application\\Controller\\IndexController'); \ No newline at end of file +(NULL, 'welcome_default', 'Welcome Default', 'index-Application\\Controller\\IndexController'); + +-- +-- default vendor for updating +-- +INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES ('app-vendors', '[\"oneplace\"]'); \ No newline at end of file diff --git a/module/Application/src/Controller/CoreApiController.php b/module/Application/src/Controller/CoreApiController.php index bfb756d..0f69ad1 100644 --- a/module/Application/src/Controller/CoreApiController.php +++ b/module/Application/src/Controller/CoreApiController.php @@ -78,6 +78,8 @@ public function listAction() { return false; } + $iPage = $this->params()->fromRoute('id', 0); + # Set default values $bSelect2 = true; $sListLabel = 'label'; @@ -104,8 +106,8 @@ public function listAction() { $translator = new Translator(); $aLangs = ['en_US','de_DE']; foreach($aLangs as $sLoadLang) { - if(file_exists(__DIR__.'/../../../oneplace-translation/language/'.$sLoadLang.'.mo')) { - $translator->addTranslationFile('gettext', __DIR__.'/../../../oneplace-translation/language/'.$sLang.'.mo', $sEntityType, $sLoadLang); + if(file_exists('vendor/oneplace/oneplace-translation/language/'.$sLoadLang.'.mo')) { + $translator->addTranslationFile('gettext', 'vendor/oneplace/oneplace-translation/language/'.$sLang.'.mo', $sEntityType, $sLoadLang); } } @@ -134,8 +136,17 @@ public function listAction() { return false; } + $bPaginated = false; + if($iPage > 0) { + $bPaginated = true; + } + # Get All Article Entities from Database - $oItemsDB = $this->oTableGateway->fetchAll(false); + $oItemsDB = $this->oTableGateway->fetchAll($bPaginated); + if($bPaginated) { + $oItemsDB->setItemCountPerPage(25); + $oItemsDB->setCurrentPageNumber($iPage); + } if(count($oItemsDB) > 0) { # Loop all items foreach($oItemsDB as $oItem) { @@ -241,6 +252,10 @@ public function listAction() { 'pagination' => (object)['more'=>false], ]; + if($bPaginated) { + $aReturn['pages'] = $oItemsDB->getPages()->pageCount; + } + # Print List with all Entities echo json_encode($aReturn); @@ -287,8 +302,8 @@ public function getAction() { $translator = new Translator(); $aLangs = ['en_US','de_DE']; foreach($aLangs as $sLoadLang) { - if(file_exists(__DIR__.'/../../../oneplace-translation/language/'.$sLoadLang.'.mo')) { - $translator->addTranslationFile('gettext', __DIR__.'/../../../oneplace-translation/language/'.$sLang.'.mo', $sEntityType, $sLoadLang); + if(file_exists('vendor/oneplace/oneplace-translation/language/'.$sLoadLang.'.mo')) { + $translator->addTranslationFile('gettext', 'vendor/oneplace/oneplace-translation/language/'.$sLang.'.mo', $sEntityType, $sLoadLang); } } @@ -373,9 +388,29 @@ public function getfieldsAction() { $this->layout('layout/json'); $aData = $this->getPublicFormFields($this->sSingleForm); + $sEntityType = explode('-',$this->sSingleForm)[0]; + + # get list label from query + $sLang = 'en_US'; + if(isset($_REQUEST['lang'])) { + $sLang = $_REQUEST['lang']; + } + + // translating system + $translator = new Translator(); + $aLangs = ['en_US','de_DE']; + foreach($aLangs as $sLoadLang) { + if(file_exists('vendor/oneplace/oneplace-translation/language/'.$sLoadLang.'.mo')) { + $translator->addTranslationFile('gettext', 'vendor/oneplace/oneplace-translation/language/'.$sLang.'.mo', $sEntityType, $sLoadLang); + } + } + + $translator->setLocale($sLang); return new ViewModel([ - 'aFields'=>$aData, + 'aFields' => $aData, + 'translator' => $translator, + 'sEntityType' => $sEntityType, ]); } } diff --git a/module/Application/src/Module.php b/module/Application/src/Module.php index 623e186..1d4fe7e 100644 --- a/module/Application/src/Module.php +++ b/module/Application/src/Module.php @@ -27,7 +27,7 @@ class Module { * * @since 1.0.0 */ - const VERSION = '1.0.21'; + const VERSION = '1.0.22'; public function getConfig() : array { return include __DIR__ . '/../config/module.config.php'; diff --git a/module/Application/view/application/index/checkforupdates.phtml b/module/Application/view/application/index/checkforupdates.phtml index fbd8e3d..6d5d1c7 100644 --- a/module/Application/view/application/index/checkforupdates.phtml +++ b/module/Application/view/application/index/checkforupdates.phtml @@ -1,3 +1,8 @@ +