From 7b89d65cf8c25872f33a677d20dddb9228b6b34a Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 14 Aug 2019 14:18:34 +0200 Subject: [PATCH] Updated with JCB v2.10.0 --- README.md | 10 +-- admin/README.txt | 10 +-- admin/assets/css/admin.css | 2 +- admin/assets/css/dashboard.css | 2 +- admin/assets/css/greeting.css | 2 +- admin/assets/css/greetings.css | 2 +- admin/assets/js/admin.js | 2 +- admin/controller.php | 2 +- admin/controllers/greeting.php | 2 +- admin/controllers/greetings.php | 2 +- admin/controllers/hello_world.php | 2 +- admin/controllers/import.php | 2 +- admin/hello_world.php | 2 +- admin/helpers/headercheck.php | 2 +- admin/helpers/hello_world.php | 30 ++++---- admin/helpers/html/batch_.php | 2 +- .../language/en-GB/en-GB.com_hello_world.ini | 18 ++--- .../en-GB/en-GB.com_hello_world.sys.ini | 16 ++-- admin/layouts/batchselection.php | 2 +- admin/layouts/greeting/details_left.php | 17 ++++- admin/layouts/greeting/metadata.php | 2 +- admin/layouts/greeting/publishing.php | 17 ++++- admin/models/forms/greeting.js | 2 +- admin/models/greeting.php | 19 ++++- admin/models/greetings.php | 2 +- admin/models/hello_world.php | 2 +- admin/models/import.php | 2 +- admin/tables/greeting.php | 2 +- admin/views/greeting/submitbutton.js | 2 +- admin/views/greeting/tmpl/edit.php | 2 +- admin/views/greeting/view.html.php | 2 +- admin/views/greetings/tmpl/default.php | 2 +- .../greetings/tmpl/default_batch_body.php | 2 +- .../greetings/tmpl/default_batch_footer.php | 2 +- admin/views/greetings/tmpl/default_body.php | 2 +- admin/views/greetings/tmpl/default_foot.php | 2 +- admin/views/greetings/tmpl/default_head.php | 2 +- .../views/greetings/tmpl/default_toolbar.php | 2 +- admin/views/greetings/view.html.php | 2 +- admin/views/hello_world/tmpl/default.php | 2 +- admin/views/hello_world/tmpl/default_main.php | 2 +- admin/views/hello_world/tmpl/default_vdm.php | 2 +- admin/views/hello_world/view.html.php | 2 +- admin/views/import/tmpl/default.php | 2 +- admin/views/import/view.html.php | 2 +- hello_world.xml | 9 +-- script.php | 73 +++++++++++-------- site/assets/css/greet.css | 2 +- site/assets/css/greeting.css | 2 +- site/assets/css/greetings.css | 2 +- site/assets/css/site.css | 2 +- site/assets/js/site.js | 2 +- site/controller.php | 2 +- site/controllers/greeting.php | 2 +- site/hello_world.php | 2 +- site/helpers/category.php | 2 +- site/helpers/headercheck.php | 2 +- site/helpers/hello_world.php | 30 ++++---- site/helpers/route.php | 2 +- site/layouts/greeting/details_left.php | 17 ++++- site/layouts/greeting/metadata.php | 2 +- site/layouts/greeting/publishing.php | 17 ++++- site/models/forms/greeting.js | 2 +- site/models/greet.php | 2 +- site/models/greeting.php | 19 ++++- site/models/greetings.php | 2 +- site/router.php | 4 +- site/views/greet/tmpl/default.php | 7 +- site/views/greet/view.html.php | 2 +- site/views/greeting/submitbutton.js | 2 +- site/views/greeting/tmpl/edit.php | 2 +- site/views/greeting/view.html.php | 2 +- site/views/greetings/tmpl/default.php | 12 ++- site/views/greetings/view.html.php | 2 +- 74 files changed, 272 insertions(+), 167 deletions(-) diff --git a/README.md b/README.md index 969a9f6..779d3a0 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,28 @@ + *Author*: [Llewellyn](mailto:joomla@vdm.io) + *Name*: [Hello World](https://www.vdm.io) + *First Build*: 20th September, 2017 -+ *Last Build*: 12th June, 2019 ++ *Last Build*: 14th August, 2019 + *Version*: 1.0.0 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**38 Hours** or **5 Eight Hour Days** (actual time the author saved - +**39 Hours** or **5 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **13706** ++ *Line count*: **13811** + *File count*: **137** + *Folder count*: **55** -**26 Hours** or **3 Eight Hour Days** (the actual time the author spent) +**25 Hours** or **3 Eight Hour Days** (the actual time the author spent) > (with the following break down: > **debugging @10hours** = codingtime / 4; -> **planning @5hours** = codingtime / 7; +> **planning @6hours** = codingtime / 7; > **mapping @4hours** = codingtime / 10; > **office @6hours** = codingtime / 6;) diff --git a/admin/README.txt b/admin/README.txt index 969a9f6..779d3a0 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -8,28 +8,28 @@ + *Author*: [Llewellyn](mailto:joomla@vdm.io) + *Name*: [Hello World](https://www.vdm.io) + *First Build*: 20th September, 2017 -+ *Last Build*: 12th June, 2019 ++ *Last Build*: 14th August, 2019 + *Version*: 1.0.0 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**38 Hours** or **5 Eight Hour Days** (actual time the author saved - +**39 Hours** or **5 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **13706** ++ *Line count*: **13811** + *File count*: **137** + *Folder count*: **55** -**26 Hours** or **3 Eight Hour Days** (the actual time the author spent) +**25 Hours** or **3 Eight Hour Days** (the actual time the author spent) > (with the following break down: > **debugging @10hours** = codingtime / 4; -> **planning @5hours** = codingtime / 7; +> **planning @6hours** = codingtime / 7; > **mapping @4hours** = codingtime / 10; > **office @6hours** = codingtime / 6;) diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 47272e6..a605073 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage admin.css diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index d21b8b7..30dfeaa 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage dashboard.css diff --git a/admin/assets/css/greeting.css b/admin/assets/css/greeting.css index 4208610..512fc9f 100644 --- a/admin/assets/css/greeting.css +++ b/admin/assets/css/greeting.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.css diff --git a/admin/assets/css/greetings.css b/admin/assets/css/greetings.css index b2c874d..2fe882a 100644 --- a/admin/assets/css/greetings.css +++ b/admin/assets/css/greetings.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greetings.css diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 94b3533..bde1fa4 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage admin.js diff --git a/admin/controller.php b/admin/controller.php index 1de1364..00c9717 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage controller.php diff --git a/admin/controllers/greeting.php b/admin/controllers/greeting.php index 46559fe..82d7ca7 100644 --- a/admin/controllers/greeting.php +++ b/admin/controllers/greeting.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.php diff --git a/admin/controllers/greetings.php b/admin/controllers/greetings.php index 4468512..6ab209d 100644 --- a/admin/controllers/greetings.php +++ b/admin/controllers/greetings.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greetings.php diff --git a/admin/controllers/hello_world.php b/admin/controllers/hello_world.php index e119e97..114b1b5 100644 --- a/admin/controllers/hello_world.php +++ b/admin/controllers/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php diff --git a/admin/controllers/import.php b/admin/controllers/import.php index fddf9ca..7b567eb 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage import.php diff --git a/admin/hello_world.php b/admin/hello_world.php index 70f2b24..5065eaa 100644 --- a/admin/hello_world.php +++ b/admin/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index cd2bbcd..7a71435 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage headercheck.php diff --git a/admin/helpers/hello_world.php b/admin/helpers/hello_world.php index 9358fdb..7e306bf 100644 --- a/admin/helpers/hello_world.php +++ b/admin/helpers/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php @@ -958,38 +958,42 @@ abstract class Hello_worldHelper /** * Get any component's model **/ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $component = 'Hello_world', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Hello_world', $config = array()) { // fix the name $name = self::safeString($name); - // full path - $fullPath = $path . '/models'; - // set prefix - $prefix = $component.'Model'; + // full path to models + $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPath, $prefix); + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } // get instance - $model = JModelLegacy::getInstance($name, $prefix, $config); + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { jimport('joomla.filesystem.file'); // get file path - $filePath = $path.'/'.$name.'.php'; - $fullPath = $fullPath.'/'.$name.'.php'; + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; // check if it exists if (JFile::exists($filePath)) { // get the file require_once $filePath; } - elseif (JFile::exists($fullPath)) + elseif (JFile::exists($fullPathModel)) { // get the file - require_once $fullPath; + require_once $fullPathModel; } // build class names - $modelClass = $prefix.$name; + $modelClass = $Component . 'Model' . $name; if (class_exists($modelClass)) { // initialize the model diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index d04fddd..aca02b5 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage batch_.php diff --git a/admin/language/en-GB/en-GB.com_hello_world.ini b/admin/language/en-GB/en-GB.com_hello_world.ini index cf73fe0..e8d6ff6 100644 --- a/admin/language/en-GB/en-GB.com_hello_world.ini +++ b/admin/language/en-GB/en-GB.com_hello_world.ini @@ -45,21 +45,21 @@ COM_HELLO_WORLD_DASHBOARD_GREETINGS="Greetings

" COM_HELLO_WORLD_DASHBOARD_GREETING_ADD="Add Greeting

" COM_HELLO_WORLD_DATE="Date" COM_HELLO_WORLD_EDIT_CREATED_BY="Edit Created By" -COM_HELLO_WORLD_EDIT_CREATED_BY_DESC=" Allows users in this group to edit created by." +COM_HELLO_WORLD_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." COM_HELLO_WORLD_EDIT_CREATED_DATE="Edit Created Date" -COM_HELLO_WORLD_EDIT_CREATED_DATE_DESC=" Allows users in this group to edit created date." +COM_HELLO_WORLD_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." COM_HELLO_WORLD_EDIT_S="Edit %s" COM_HELLO_WORLD_EDIT_VERSIONS="Edit Version" -COM_HELLO_WORLD_EDIT_VERSIONS_DESC=" Allows users in this group to edit versions." +COM_HELLO_WORLD_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." COM_HELLO_WORLD_EXPORT_DATA="Export Data" -COM_HELLO_WORLD_EXPORT_DATA_DESC=" Allows users in this group to export data." +COM_HELLO_WORLD_EXPORT_DATA_DESC="Allows users in this group to export data." COM_HELLO_WORLD_EXPORT_FAILED="Export Failed" COM_HELLO_WORLD_GREETING="Greeting" COM_HELLO_WORLD_GREETINGS="Greetings" COM_HELLO_WORLD_GREETINGS_ACCESS="Greetings Access" COM_HELLO_WORLD_GREETINGS_ACCESS_DESC="Allows the users in this group to access access greetings" COM_HELLO_WORLD_GREETINGS_ACCESS_SITE="Greetings (Site) Access" -COM_HELLO_WORLD_GREETINGS_ACCESS_SITE_DESC=" Allows the users in this group to access site greetings." +COM_HELLO_WORLD_GREETINGS_ACCESS_SITE_DESC="Allows the users in this group to access site greetings." COM_HELLO_WORLD_GREETINGS_BATCH_OPTIONS="Batch process the selected Greetings" COM_HELLO_WORLD_GREETINGS_BATCH_TIP="All changes will be applied to all selected Greetings" COM_HELLO_WORLD_GREETINGS_BATCH_USE="Greetings Batch Use" @@ -96,7 +96,7 @@ COM_HELLO_WORLD_GREETINGS_N_ITEMS_UNPUBLISHED_1="%s Greeting unpublished." COM_HELLO_WORLD_GREETINGS_SUBMENU="Greetings Submenu" COM_HELLO_WORLD_GREETINGS_SUBMENU_DESC="Allows the users in this group to submenu of greeting" COM_HELLO_WORLD_GREETING_ACCESS_SITE="Greeting (Site) Access" -COM_HELLO_WORLD_GREETING_ACCESS_SITE_DESC=" Allows the users in this group to access site greeting." +COM_HELLO_WORLD_GREETING_ACCESS_SITE_DESC="Allows the users in this group to access site greeting." COM_HELLO_WORLD_GREETING_CREATED_BY_DESC="The user that created this Greeting." COM_HELLO_WORLD_GREETING_CREATED_BY_LABEL="Created By" COM_HELLO_WORLD_GREETING_CREATED_DATE_DESC="The date this Greeting was created." @@ -126,7 +126,7 @@ COM_HELLO_WORLD_HELP_MANAGER="Help" COM_HELLO_WORLD_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BHELLO_WORLDB_WILL_NOT_FUNCTION_CORRECTLYP="

Curl Not Found!

Please setup curl on your system, or hello_world will not function correctly!

" COM_HELLO_WORLD_IMPORT_CONTINUE="Continue" COM_HELLO_WORLD_IMPORT_DATA="Import Data" -COM_HELLO_WORLD_IMPORT_DATA_DESC=" Allows users in this group to import data." +COM_HELLO_WORLD_IMPORT_DATA_DESC="Allows users in this group to import data." COM_HELLO_WORLD_IMPORT_ERROR="Import error." COM_HELLO_WORLD_IMPORT_FAILED="Import Failed" COM_HELLO_WORLD_IMPORT_FILE_COLUMNS="File Columns" @@ -166,7 +166,7 @@ COM_HELLO_WORLD_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -" COM_HELLO_WORLD_KEEP_ORIGINAL_STATE="- Keep Original State -" COM_HELLO_WORLD_LICENSE="License" COM_HELLO_WORLD_NEW="New" -COM_HELLO_WORLD_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!" +COM_HELLO_WORLD_NOT_FOUND_OR_ACCESS_DENIED="Not found, or access denied." COM_HELLO_WORLD_NO_ACCESS_GRANTED="No Access Granted!" COM_HELLO_WORLD_PUBLISHED="Published" COM_HELLO_WORLD_SAVE_SUCCESS="Great! Item successfully saved." @@ -177,6 +177,6 @@ COM_HELLO_WORLD_SUBMENU_GREETINGS_FIELDS="Greetings Fields" COM_HELLO_WORLD_SUBMENU_GREETINGS_FIELDS_GROUPS="Greetings Field Groups" COM_HELLO_WORLD_TRASHED="Trashed" COM_HELLO_WORLD_USE_BATCH="Use Batch" -COM_HELLO_WORLD_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." +COM_HELLO_WORLD_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." COM_HELLO_WORLD_VERSION="Version" COM_HELLO_WORLD_WEBSITE="Website" \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_hello_world.sys.ini b/admin/language/en-GB/en-GB.com_hello_world.sys.ini index dbee1d5..db514ba 100644 --- a/admin/language/en-GB/en-GB.com_hello_world.sys.ini +++ b/admin/language/en-GB/en-GB.com_hello_world.sys.ini @@ -1,17 +1,17 @@ COM_HELLO_WORLD="Hello World" COM_HELLO_WORLD_CONFIGURATION="Hello World Configuration" COM_HELLO_WORLD_EDIT_CREATED_BY="Edit Created By" -COM_HELLO_WORLD_EDIT_CREATED_BY_DESC=" Allows users in this group to edit created by." +COM_HELLO_WORLD_EDIT_CREATED_BY_DESC="Allows users in this group to edit created by." COM_HELLO_WORLD_EDIT_CREATED_DATE="Edit Created Date" -COM_HELLO_WORLD_EDIT_CREATED_DATE_DESC=" Allows users in this group to edit created date." +COM_HELLO_WORLD_EDIT_CREATED_DATE_DESC="Allows users in this group to edit created date." COM_HELLO_WORLD_EDIT_VERSIONS="Edit Version" -COM_HELLO_WORLD_EDIT_VERSIONS_DESC=" Allows users in this group to edit versions." +COM_HELLO_WORLD_EDIT_VERSIONS_DESC="Allows users in this group to edit versions." COM_HELLO_WORLD_EXPORT_DATA="Export Data" -COM_HELLO_WORLD_EXPORT_DATA_DESC=" Allows users in this group to export data." +COM_HELLO_WORLD_EXPORT_DATA_DESC="Allows users in this group to export data." COM_HELLO_WORLD_GREETINGS_ACCESS="Greetings Access" COM_HELLO_WORLD_GREETINGS_ACCESS_DESC="Allows the users in this group to access access greetings" COM_HELLO_WORLD_GREETINGS_ACCESS_SITE="Greetings (Site) Access" -COM_HELLO_WORLD_GREETINGS_ACCESS_SITE_DESC=" Allows the users in this group to access site greetings." +COM_HELLO_WORLD_GREETINGS_ACCESS_SITE_DESC="Allows the users in this group to access site greetings." COM_HELLO_WORLD_GREETINGS_BATCH_USE="Greetings Batch Use" COM_HELLO_WORLD_GREETINGS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch greetings" COM_HELLO_WORLD_GREETINGS_DASHBOARD_ADD="Greetings Dashboard Add" @@ -29,13 +29,13 @@ COM_HELLO_WORLD_GREETINGS_IMPORT_DESC="Allows the users in this group to import COM_HELLO_WORLD_GREETINGS_SUBMENU="Greetings Submenu" COM_HELLO_WORLD_GREETINGS_SUBMENU_DESC="Allows the users in this group to submenu of greeting" COM_HELLO_WORLD_GREETING_ACCESS_SITE="Greeting (Site) Access" -COM_HELLO_WORLD_GREETING_ACCESS_SITE_DESC=" Allows the users in this group to access site greeting." +COM_HELLO_WORLD_GREETING_ACCESS_SITE_DESC="Allows the users in this group to access site greeting." COM_HELLO_WORLD_IMPORT_DATA="Import Data" -COM_HELLO_WORLD_IMPORT_DATA_DESC=" Allows users in this group to import data." +COM_HELLO_WORLD_IMPORT_DATA_DESC="Allows users in this group to import data." COM_HELLO_WORLD_MENU="» Hello World" COM_HELLO_WORLD_MENU_GREETINGS="Greetings" COM_HELLO_WORLD_MENU_GREETINGS_DESC="Greetings" COM_HELLO_WORLD_MENU_GREETINGS_OPTION="Greetings" COM_HELLO_WORLD_MENU_GREETINGS_TITLE="Greetings" COM_HELLO_WORLD_USE_BATCH="Use Batch" -COM_HELLO_WORLD_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." \ No newline at end of file +COM_HELLO_WORLD_USE_BATCH_DESC="Allows users in this group to use batch copy/update method." \ No newline at end of file diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 875d548..bca81c7 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage batchselection.php diff --git a/admin/layouts/greeting/details_left.php b/admin/layouts/greeting/details_left.php index f60e5e9..875b5d6 100644 --- a/admin/layouts/greeting/details_left.php +++ b/admin/layouts/greeting/details_left.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage details_left.php @@ -21,18 +21,31 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// get the form $form = $displayData->getForm(); -$fields = $displayData->get('fields') ?: array( +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'greeting' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); ?> + setFieldAttribute($field, 'type', 'hidden'); ?> renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + diff --git a/admin/layouts/greeting/metadata.php b/admin/layouts/greeting/metadata.php index c23d497..990ffd5 100644 --- a/admin/layouts/greeting/metadata.php +++ b/admin/layouts/greeting/metadata.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage metadata.php diff --git a/admin/layouts/greeting/publishing.php b/admin/layouts/greeting/publishing.php index 426f0de..d1f0cff 100644 --- a/admin/layouts/greeting/publishing.php +++ b/admin/layouts/greeting/publishing.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage publishing.php @@ -21,9 +21,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// get the form $form = $displayData->getForm(); -$fields = $displayData->get('fields') ?: array( +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'created', 'created_by', 'modified', @@ -39,9 +50,11 @@ $fields = $displayData->get('fields') ?: array( $hiddenFields = $displayData->get('hidden_fields') ?: array(); ?> + setFieldAttribute($field, 'type', 'hidden'); ?> renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + diff --git a/admin/models/forms/greeting.js b/admin/models/forms/greeting.js index 6eb0135..dca6112 100644 --- a/admin/models/forms/greeting.js +++ b/admin/models/forms/greeting.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.js diff --git a/admin/models/greeting.php b/admin/models/greeting.php index a83b33c..f013624 100644 --- a/admin/models/greeting.php +++ b/admin/models/greeting.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.php @@ -27,13 +27,26 @@ use Joomla\Registry\Registry; * Hello_world Greeting Model */ class Hello_worldModelGreeting extends JModelAdmin -{ +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'greeting' + ) + ) + ); + /** * @var string The prefix to use with controller messages. * @since 1.6 */ protected $text_prefix = 'COM_HELLO_WORLD'; - + /** * The type alias for this content type. * diff --git a/admin/models/greetings.php b/admin/models/greetings.php index caf0505..e8de9db 100644 --- a/admin/models/greetings.php +++ b/admin/models/greetings.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greetings.php diff --git a/admin/models/hello_world.php b/admin/models/hello_world.php index 9e8e50b..49b3379 100644 --- a/admin/models/hello_world.php +++ b/admin/models/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php diff --git a/admin/models/import.php b/admin/models/import.php index 7a033e4..e0a0e8d 100644 --- a/admin/models/import.php +++ b/admin/models/import.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage import.php diff --git a/admin/tables/greeting.php b/admin/tables/greeting.php index 2e3868d..f8ffe9d 100644 --- a/admin/tables/greeting.php +++ b/admin/tables/greeting.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.php diff --git a/admin/views/greeting/submitbutton.js b/admin/views/greeting/submitbutton.js index 90535f4..70a22e4 100644 --- a/admin/views/greeting/submitbutton.js +++ b/admin/views/greeting/submitbutton.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage submitbutton.js diff --git a/admin/views/greeting/tmpl/edit.php b/admin/views/greeting/tmpl/edit.php index 2ed1c76..d0b67f5 100644 --- a/admin/views/greeting/tmpl/edit.php +++ b/admin/views/greeting/tmpl/edit.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage edit.php diff --git a/admin/views/greeting/view.html.php b/admin/views/greeting/view.html.php index e25f908..ea74718 100644 --- a/admin/views/greeting/view.html.php +++ b/admin/views/greeting/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/admin/views/greetings/tmpl/default.php b/admin/views/greetings/tmpl/default.php index c1993bc..09b1f82 100644 --- a/admin/views/greetings/tmpl/default.php +++ b/admin/views/greetings/tmpl/default.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default.php diff --git a/admin/views/greetings/tmpl/default_batch_body.php b/admin/views/greetings/tmpl/default_batch_body.php index bd006ce..148b403 100644 --- a/admin/views/greetings/tmpl/default_batch_body.php +++ b/admin/views/greetings/tmpl/default_batch_body.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_batch_body.php diff --git a/admin/views/greetings/tmpl/default_batch_footer.php b/admin/views/greetings/tmpl/default_batch_footer.php index 8865fbb..faf2729 100644 --- a/admin/views/greetings/tmpl/default_batch_footer.php +++ b/admin/views/greetings/tmpl/default_batch_footer.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_batch_footer.php diff --git a/admin/views/greetings/tmpl/default_body.php b/admin/views/greetings/tmpl/default_body.php index ac6abd8..2137082 100644 --- a/admin/views/greetings/tmpl/default_body.php +++ b/admin/views/greetings/tmpl/default_body.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_body.php diff --git a/admin/views/greetings/tmpl/default_foot.php b/admin/views/greetings/tmpl/default_foot.php index 42f1d1a..9a31702 100644 --- a/admin/views/greetings/tmpl/default_foot.php +++ b/admin/views/greetings/tmpl/default_foot.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_foot.php diff --git a/admin/views/greetings/tmpl/default_head.php b/admin/views/greetings/tmpl/default_head.php index cf9ee13..cac9e30 100644 --- a/admin/views/greetings/tmpl/default_head.php +++ b/admin/views/greetings/tmpl/default_head.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_head.php diff --git a/admin/views/greetings/tmpl/default_toolbar.php b/admin/views/greetings/tmpl/default_toolbar.php index f95b41b..1cb2778 100644 --- a/admin/views/greetings/tmpl/default_toolbar.php +++ b/admin/views/greetings/tmpl/default_toolbar.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_toolbar.php diff --git a/admin/views/greetings/view.html.php b/admin/views/greetings/view.html.php index a576968..5f23f4d 100644 --- a/admin/views/greetings/view.html.php +++ b/admin/views/greetings/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/admin/views/hello_world/tmpl/default.php b/admin/views/hello_world/tmpl/default.php index 2180672..e898beb 100644 --- a/admin/views/hello_world/tmpl/default.php +++ b/admin/views/hello_world/tmpl/default.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default.php diff --git a/admin/views/hello_world/tmpl/default_main.php b/admin/views/hello_world/tmpl/default_main.php index 913fc9d..9913310 100644 --- a/admin/views/hello_world/tmpl/default_main.php +++ b/admin/views/hello_world/tmpl/default_main.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_main.php diff --git a/admin/views/hello_world/tmpl/default_vdm.php b/admin/views/hello_world/tmpl/default_vdm.php index 2b4edda..a0af6d6 100644 --- a/admin/views/hello_world/tmpl/default_vdm.php +++ b/admin/views/hello_world/tmpl/default_vdm.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default_vdm.php diff --git a/admin/views/hello_world/view.html.php b/admin/views/hello_world/view.html.php index ffcbf92..fcf27e6 100644 --- a/admin/views/hello_world/view.html.php +++ b/admin/views/hello_world/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php index cc3905a..7180b92 100644 --- a/admin/views/import/tmpl/default.php +++ b/admin/views/import/tmpl/default.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default.php diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index 38d65c0..5c5dc2d 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/hello_world.xml b/hello_world.xml index 5e6c525..0aeda02 100644 --- a/hello_world.xml +++ b/hello_world.xml @@ -1,7 +1,7 @@ COM_HELLO_WORLD - 12th June, 2019 + 14th August, 2019 Llewellyn joomla@vdm.io https://www.vdm.io @@ -54,8 +54,7 @@ router.php hello_world.php hello_world.php - router.php - controller.php + router.php assets helpers controllers @@ -81,11 +80,7 @@ controller.php index.html hello_world.php - access.xml - config.xml - controller.php hello_world.php - README.txt README.txt assets controllers diff --git a/script.php b/script.php index 2814788..5dedf52 100644 --- a/script.php +++ b/script.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage script.php @@ -29,21 +29,27 @@ JHTML::_('behavior.modal'); class com_hello_worldInstallerScript { /** - * method to install the component + * Constructor * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script */ - function install($parent) - { - - } + public function __construct(JAdapterInstance $parent) {} /** - * method to uninstall the component + * Called on installation * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function uninstall($parent) + public function install(JAdapterInstance $parent) {} + + /** + * Called on uninstallation + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function uninstall(JAdapterInstance $parent) { // Get Application object $app = JFactory::getApplication(); @@ -327,57 +333,63 @@ class com_hello_worldInstallerScript } /** - * method to update the component + * Called on update * - * @return void + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function update($parent) - { - - } + public function update(JAdapterInstance $parent){} /** - * method to run before an install/update/uninstall method + * Called before any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function preflight($type, $parent) + public function preflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication(); - // is redundant ...hmmm - if ($type == 'uninstall') + // is redundant or so it seems ...hmmm let me know if it works again + if ($type === 'uninstall') { return true; } // the default for both install and update $jversion = new JVersion(); - if (!$jversion->isCompatible('3.6.0')) + if (!$jversion->isCompatible('3.8.0')) { - $app->enqueueMessage('Please upgrade to at least Joomla! 3.6.0 before continuing!', 'error'); + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); return false; } // do any updates needed - if ($type == 'update') + if ($type === 'update') { } // do any install needed - if ($type == 'install') + if ($type === 'install') { } + return true; } /** - * method to run after an install/update/uninstall method + * Called after any type of action * - * @return void + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success */ - function postflight($type, $parent) + public function postflight($type, JAdapterInstance $parent) { // get application $app = JFactory::getApplication(); // set the default component settings - if ($type == 'install') + if ($type === 'install') { // Get The Database object @@ -429,7 +441,7 @@ class com_hello_worldInstallerScript '; } // do any updates needed - if ($type == 'update') + if ($type === 'update') { // Get The Database object @@ -470,5 +482,6 @@ class com_hello_worldInstallerScript

Upgrade to Version 1.0.0 Was Successful! Let us know if anything is not working as expected.

'; } + return true; } } diff --git a/site/assets/css/greet.css b/site/assets/css/greet.css index a4bb2a7..cb174f5 100644 --- a/site/assets/css/greet.css +++ b/site/assets/css/greet.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greet.css diff --git a/site/assets/css/greeting.css b/site/assets/css/greeting.css index 4208610..512fc9f 100644 --- a/site/assets/css/greeting.css +++ b/site/assets/css/greeting.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.css diff --git a/site/assets/css/greetings.css b/site/assets/css/greetings.css index b2c874d..2fe882a 100644 --- a/site/assets/css/greetings.css +++ b/site/assets/css/greetings.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greetings.css diff --git a/site/assets/css/site.css b/site/assets/css/site.css index 9f388e0..60bf7f6 100644 --- a/site/assets/css/site.css +++ b/site/assets/css/site.css @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage site.css diff --git a/site/assets/js/site.js b/site/assets/js/site.js index 8c9bf2b..aef7f3b 100644 --- a/site/assets/js/site.js +++ b/site/assets/js/site.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage site.js diff --git a/site/controller.php b/site/controller.php index e81c253..0c06e4f 100644 --- a/site/controller.php +++ b/site/controller.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage controller.php diff --git a/site/controllers/greeting.php b/site/controllers/greeting.php index 336e559..acc3260 100644 --- a/site/controllers/greeting.php +++ b/site/controllers/greeting.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.php diff --git a/site/hello_world.php b/site/hello_world.php index 3a2bffe..dba50e0 100644 --- a/site/hello_world.php +++ b/site/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php diff --git a/site/helpers/category.php b/site/helpers/category.php index 0d711c2..81f665e 100644 --- a/site/helpers/category.php +++ b/site/helpers/category.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage category.php diff --git a/site/helpers/headercheck.php b/site/helpers/headercheck.php index cd2bbcd..7a71435 100644 --- a/site/helpers/headercheck.php +++ b/site/helpers/headercheck.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage headercheck.php diff --git a/site/helpers/hello_world.php b/site/helpers/hello_world.php index d364d1d..3e2a48e 100644 --- a/site/helpers/hello_world.php +++ b/site/helpers/hello_world.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage hello_world.php @@ -312,38 +312,42 @@ abstract class Hello_worldHelper /** * Get any component's model **/ - public static function getModel($name, $path = JPATH_COMPONENT_SITE, $component = 'Hello_world', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_SITE, $Component = 'Hello_world', $config = array()) { // fix the name $name = self::safeString($name); - // full path - $fullPath = $path . '/models'; - // set prefix - $prefix = $component.'Model'; + // full path to models + $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPath, $prefix); + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } // get instance - $model = JModelLegacy::getInstance($name, $prefix, $config); + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { jimport('joomla.filesystem.file'); // get file path - $filePath = $path.'/'.$name.'.php'; - $fullPath = $fullPath.'/'.$name.'.php'; + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; // check if it exists if (JFile::exists($filePath)) { // get the file require_once $filePath; } - elseif (JFile::exists($fullPath)) + elseif (JFile::exists($fullPathModel)) { // get the file - require_once $fullPath; + require_once $fullPathModel; } // build class names - $modelClass = $prefix.$name; + $modelClass = $Component . 'Model' . $name; if (class_exists($modelClass)) { // initialize the model diff --git a/site/helpers/route.php b/site/helpers/route.php index 27ade47..155cf94 100644 --- a/site/helpers/route.php +++ b/site/helpers/route.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage route.php diff --git a/site/layouts/greeting/details_left.php b/site/layouts/greeting/details_left.php index f60e5e9..875b5d6 100644 --- a/site/layouts/greeting/details_left.php +++ b/site/layouts/greeting/details_left.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage details_left.php @@ -21,18 +21,31 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// get the form $form = $displayData->getForm(); -$fields = $displayData->get('fields') ?: array( +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'greeting' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); ?> + setFieldAttribute($field, 'type', 'hidden'); ?> renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + diff --git a/site/layouts/greeting/metadata.php b/site/layouts/greeting/metadata.php index c23d497..990ffd5 100644 --- a/site/layouts/greeting/metadata.php +++ b/site/layouts/greeting/metadata.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage metadata.php diff --git a/site/layouts/greeting/publishing.php b/site/layouts/greeting/publishing.php index 426f0de..d1f0cff 100644 --- a/site/layouts/greeting/publishing.php +++ b/site/layouts/greeting/publishing.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage publishing.php @@ -21,9 +21,20 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +// get the form $form = $displayData->getForm(); -$fields = $displayData->get('fields') ?: array( +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'created', 'created_by', 'modified', @@ -39,9 +50,11 @@ $fields = $displayData->get('fields') ?: array( $hiddenFields = $displayData->get('hidden_fields') ?: array(); ?> + setFieldAttribute($field, 'type', 'hidden'); ?> renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + diff --git a/site/models/forms/greeting.js b/site/models/forms/greeting.js index 6eb0135..dca6112 100644 --- a/site/models/forms/greeting.js +++ b/site/models/forms/greeting.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.js diff --git a/site/models/greet.php b/site/models/greet.php index 4fd346b..426bb61 100644 --- a/site/models/greet.php +++ b/site/models/greet.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greet.php diff --git a/site/models/greeting.php b/site/models/greeting.php index a83b33c..f013624 100644 --- a/site/models/greeting.php +++ b/site/models/greeting.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greeting.php @@ -27,13 +27,26 @@ use Joomla\Registry\Registry; * Hello_world Greeting Model */ class Hello_worldModelGreeting extends JModelAdmin -{ +{ + /** + * The tab layout fields array. + * + * @var array + */ + protected $tabLayoutFields = array( + 'details' => array( + 'left' => array( + 'greeting' + ) + ) + ); + /** * @var string The prefix to use with controller messages. * @since 1.6 */ protected $text_prefix = 'COM_HELLO_WORLD'; - + /** * The type alias for this content type. * diff --git a/site/models/greetings.php b/site/models/greetings.php index 31f1067..f5cf288 100644 --- a/site/models/greetings.php +++ b/site/models/greetings.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage greetings.php diff --git a/site/router.php b/site/router.php index a42e540..9fcc745 100644 --- a/site/router.php +++ b/site/router.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage router.php @@ -184,6 +184,8 @@ class Hello_worldRouter extends JComponentRouterBase { $getTable = '#__categories'; $query->from($db->quoteName($getTable)); + // we need this to target the components categories (TODO will keep an eye on this) + $query->where($db->quoteName('extension') . ' LIKE '. $db->quote((string)'com_' . $main . '%')); } else { diff --git a/site/views/greet/tmpl/default.php b/site/views/greet/tmpl/default.php index f669c2e..78ee4d7 100644 --- a/site/views/greet/tmpl/default.php +++ b/site/views/greet/tmpl/default.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default.php @@ -23,4 +23,7 @@ defined('_JEXEC') or die('Restricted access'); ?> toolbar->render(); ?> -

item->greeting; ?>

+ + +

item->greeting; ?>

+ diff --git a/site/views/greet/view.html.php b/site/views/greet/view.html.php index 26c2618..474529e 100644 --- a/site/views/greet/view.html.php +++ b/site/views/greet/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/site/views/greeting/submitbutton.js b/site/views/greeting/submitbutton.js index 90535f4..70a22e4 100644 --- a/site/views/greeting/submitbutton.js +++ b/site/views/greeting/submitbutton.js @@ -3,7 +3,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage submitbutton.js diff --git a/site/views/greeting/tmpl/edit.php b/site/views/greeting/tmpl/edit.php index f98e582..1285836 100644 --- a/site/views/greeting/tmpl/edit.php +++ b/site/views/greeting/tmpl/edit.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage edit.php diff --git a/site/views/greeting/view.html.php b/site/views/greeting/view.html.php index 7881608..452c72f 100644 --- a/site/views/greeting/view.html.php +++ b/site/views/greeting/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php diff --git a/site/views/greetings/tmpl/default.php b/site/views/greetings/tmpl/default.php index 9b9e9c3..9a02fb1 100644 --- a/site/views/greetings/tmpl/default.php +++ b/site/views/greetings/tmpl/default.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage default.php @@ -21,12 +21,18 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -$edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit"; + +/***[JCBGUI.site_view.php_view.50.$$$$]***/ +$edit = "index.php?option=com_hello_world&view=greetings&task=greeting.edit";/***[/JCBGUI$$$$]***/ + ?> toolbar->render(); ?> + + + + diff --git a/site/views/greetings/view.html.php b/site/views/greetings/view.html.php index fd97e02..77fc9dd 100644 --- a/site/views/greetings/view.html.php +++ b/site/views/greetings/view.html.php @@ -4,7 +4,7 @@ /-------------------------------------------------------------------------------------------------------/ @version 1.0.0 - @build 12th June, 2019 + @build 14th August, 2019 @created 20th September, 2017 @package Hello World @subpackage view.html.php