Updated with JCB v2.10.0

This commit is contained in:
Llewellyn van der Merwe 2019-08-14 14:18:34 +02:00
parent e5d578dfbe
commit 7b89d65cf8
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
74 changed files with 272 additions and 167 deletions

View File

@ -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;)

View File

@ -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;)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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';
$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

View File

@ -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

View File

@ -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."

View File

@ -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

View File

@ -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();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -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

View File

@ -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();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -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

View File

@ -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
@ -28,6 +28,19 @@ use Joomla\Registry\Registry;
*/
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_HELLO_WORLD</name>
<creationDate>12th June, 2019</creationDate>
<creationDate>14th August, 2019</creationDate>
<author>Llewellyn</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io</authorUrl>
@ -55,7 +55,6 @@
<filename>hello_world.php</filename>
<filename>hello_world.php</filename>
<filename>router.php</filename>
<filename>controller.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>controllers</folder>
@ -81,12 +80,8 @@
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>hello_world.php</filename>
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>hello_world.php</filename>
<filename>README.txt</filename>
<filename>README.txt</filename>
<folder>assets</folder>
<folder>controllers</folder>
<folder>helpers</folder>

View File

@ -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
</a>';
}
// do any updates needed
if ($type == 'update')
if ($type === 'update')
{
// Get The Database object
@ -470,5 +482,6 @@ class com_hello_worldInstallerScript
</a>
<h3>Upgrade to Version 1.0.0 Was Successful! Let us know if anything is not working as expected.</h3>';
}
return true;
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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';
$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

View File

@ -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

View File

@ -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();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -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

View File

@ -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();
?>
<?php if ($fields && count((array) $fields)) :?>
<?php foreach($fields as $field): ?>
<?php if (in_array($field, $hiddenFields)) : ?>
<?php $form->setFieldAttribute($field, 'type', 'hidden'); ?>
<?php endif; ?>
<?php echo $form->renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?>
<?php endforeach; ?>
<?php endif; ?>

View File

@ -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

View File

@ -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

View File

@ -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
@ -28,6 +28,19 @@ use Joomla\Registry\Registry;
*/
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

View File

@ -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

View File

@ -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
{

View File

@ -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');
?>
<?php echo $this->toolbar->render(); ?>
<h2><?php echo $this->item->greeting; ?></h2>
<!--[JCBGUI.site_view.default.51.$$$$]-->
<h2><?php echo $this->item->greeting; ?></h2><!--[/JCBGUI$$$$]-->

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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$$$$]***/
?>
<?php echo $this->toolbar->render(); ?>
<!--[JCBGUI.site_view.default.50.$$$$]-->
<ul class="uk-list uk-list-striped">
<?php foreach ($this->items as $item): ?>
<li><?php echo JText::_('COM_HELLO_WORLD_GREETING'); ?>: <a href="<?php echo JRoute::_(Hello_worldHelperRoute::getGreetRoute($item->slug)); ?>"><?php echo $item->greeting; ?></a> <a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo JText::_('COM_HELLO_WORLD_EDIT'); ?></a></li>
<?php endforeach; ?>
</ul>
</ul><!--[/JCBGUI$$$$]-->

View File

@ -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