diff --git a/README.md b/README.md
index 0767b53..4302fe3 100644
--- a/README.md
+++ b/README.md
@@ -10,20 +10,20 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Demo](https://www.vdm.io/)
+ *First Build*: 18th October, 2016
-+ *Last Build*: 5th May, 2018
++ *Last Build*: 13th September, 2018
+ *Version*: 2.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
-**41 Hours** or **5 Eight Hour Days** (actual time the author saved -
+**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
> (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*: **14621**
++ *Line count*: **14920**
+ *File count*: **147**
+ *Folder count*: **54**
@@ -35,7 +35,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> **mapping @4hours** = codingtime / 10;
> **office @7hours** = codingtime / 6;)
-**68 Hours** or **9 Eight Hour Days**
+**69 Hours** or **9 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
diff --git a/admin/README.txt b/admin/README.txt
index 0767b53..4302fe3 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -10,20 +10,20 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Demo](https://www.vdm.io/)
+ *First Build*: 18th October, 2016
-+ *Last Build*: 5th May, 2018
++ *Last Build*: 13th September, 2018
+ *Version*: 2.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
-**41 Hours** or **5 Eight Hour Days** (actual time the author saved -
+**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
> (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*: **14621**
++ *Line count*: **14920**
+ *File count*: **147**
+ *Folder count*: **54**
@@ -35,7 +35,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
> **mapping @4hours** = codingtime / 10;
> **office @7hours** = codingtime / 6;)
-**68 Hours** or **9 Eight Hour Days**
+**69 Hours** or **9 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
diff --git a/admin/access.xml b/admin/access.xml
index 5f01326..fb38d1d 100644
--- a/admin/access.xml
+++ b/admin/access.xml
@@ -13,6 +13,7 @@
+
@@ -43,5 +44,19 @@
+
+
+
\ No newline at end of file
diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css
index 1e6abf7..67a1654 100644
--- a/admin/assets/css/admin.css
+++ b/admin/assets/css/admin.css
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage admin.css
diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css
index 91d716d..7f8d052 100644
--- a/admin/assets/css/dashboard.css
+++ b/admin/assets/css/dashboard.css
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage dashboard.css
diff --git a/admin/assets/css/look.css b/admin/assets/css/look.css
index 9f9f15b..2f65d91 100644
--- a/admin/assets/css/look.css
+++ b/admin/assets/css/look.css
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage look.css
diff --git a/admin/assets/css/looks.css b/admin/assets/css/looks.css
index 1223ead..fa8b092 100644
--- a/admin/assets/css/looks.css
+++ b/admin/assets/css/looks.css
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage looks.css
diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js
index 87ab16a..d082e91 100644
--- a/admin/assets/js/admin.js
+++ b/admin/assets/js/admin.js
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage admin.js
diff --git a/admin/controller.php b/admin/controller.php
index efa3d05..e58031a 100644
--- a/admin/controller.php
+++ b/admin/controller.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage controller.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla controller library
-jimport('joomla.application.component.controller');
-
/**
* General Controller of Demo component
*/
diff --git a/admin/controllers/demo.php b/admin/controllers/demo.php
index 0ab5f57..0d67c57 100644
--- a/admin/controllers/demo.php
+++ b/admin/controllers/demo.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage demo.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla controlleradmin library
-jimport('joomla.application.component.controlleradmin');
-
/**
* Demo Controller
*/
diff --git a/admin/controllers/import.php b/admin/controllers/import.php
index 7d02fb1..a008ab5 100644
--- a/admin/controllers/import.php
+++ b/admin/controllers/import.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage import.php
diff --git a/admin/controllers/look.php b/admin/controllers/look.php
index ba4be92..985d875 100644
--- a/admin/controllers/look.php
+++ b/admin/controllers/look.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage look.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla controllerform library
-jimport('joomla.application.component.controllerform');
-
/**
* Look Controller
*/
@@ -38,6 +35,13 @@ class DemoControllerLook extends JControllerForm
*/
protected $task;
+ /**
+ * Class constructor.
+ *
+ * @param array $config A named array of configuration variables.
+ *
+ * @since 1.6
+ */
public function __construct($config = array())
{
$this->view_list = 'Looks'; // safeguard for setting the return view listing to the main view.
@@ -55,14 +59,17 @@ class DemoControllerLook extends JControllerForm
*/
protected function allowAdd($data = array())
{
+ // Get user object.
+ $user = JFactory::getUser();
// Access check.
- $access = JFactory::getUser()->authorise('look.access', 'com_demo');
+ $access = $user->authorise('look.access', 'com_demo');
if (!$access)
{
return false;
}
+
// In the absense of better information, revert to the component permissions.
- return JFactory::getUser()->authorise('look.create', $this->option);
+ return $user->authorise('look.create', $this->option);
}
/**
@@ -78,9 +85,9 @@ class DemoControllerLook extends JControllerForm
protected function allowEdit($data = array(), $key = 'id')
{
// get user object.
- $user = JFactory::getUser();
+ $user = JFactory::getUser();
// get record id.
- $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
+ $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
@@ -136,42 +143,25 @@ class DemoControllerLook extends JControllerForm
*
* @return string The arguments to append to the redirect URL.
*
- * @since 12.2
+ * @since 1.6
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
- $tmpl = $this->input->get('tmpl');
- $layout = $this->input->get('layout', 'edit', 'string');
+ // get the referral options (old method use return instead see parent)
+ $ref = $this->input->get('ref', 0, 'string');
+ $refid = $this->input->get('refid', 0, 'int');
- $ref = $this->input->get('ref', 0, 'string');
- $refid = $this->input->get('refid', 0, 'int');
+ // get redirect info.
+ $append = parent::getRedirectToItemAppend($recordId, $urlVar);
- // Setup redirect info.
-
- $append = '';
-
- if ($refid)
+ // set the referral options
+ if ($refid && $ref)
{
- $append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
+ $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
}
elseif ($ref)
{
- $append .= '&ref='.(string)$ref;
- }
-
- if ($tmpl)
- {
- $append .= '&tmpl=' . $tmpl;
- }
-
- if ($layout)
- {
- $append .= '&layout=' . $layout;
- }
-
- if ($recordId)
- {
- $append .= '&' . $urlVar . '=' . $recordId;
+ $append = '&ref='. (string)$ref . $append;
}
return $append;
@@ -210,43 +200,45 @@ class DemoControllerLook extends JControllerForm
*/
public function cancel($key = null)
{
- // get the referal details
- $this->ref = $this->input->get('ref', 0, 'word');
- $this->refid = $this->input->get('refid', 0, 'int');
+ // get the referral options
+ $this->ref = $this->input->get('ref', 0, 'word');
+ $this->refid = $this->input->get('refid', 0, 'int');
+
+ // Check if there is a return value
+ $return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key);
- if ($cancel)
+ if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{
- if ($this->refid)
- {
- $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
+ $redirect = base64_decode($return);
- // Redirect to the item screen.
- $this->setRedirect(
- JRoute::_(
- 'index.php?option=' . $this->option . $redirect, false
- )
- );
- }
- elseif ($this->ref)
- {
- $redirect = '&view='.(string)$this->ref;
-
- // Redirect to the list screen.
- $this->setRedirect(
- JRoute::_(
- 'index.php?option=' . $this->option . $redirect, false
- )
- );
- }
- }
- else
- {
- // Redirect to the items screen.
+ // Redirect to the return value.
$this->setRedirect(
JRoute::_(
- 'index.php?option=' . $this->option . '&view=' . $this->view_list, false
+ $redirect, false
+ )
+ );
+ }
+ elseif ($this->refid && $this->ref)
+ {
+ $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
+
+ // Redirect to the item screen.
+ $this->setRedirect(
+ JRoute::_(
+ 'index.php?option=' . $this->option . $redirect, false
+ )
+ );
+ }
+ elseif ($this->ref)
+ {
+ $redirect = '&view='.(string)$this->ref;
+
+ // Redirect to the list screen.
+ $this->setRedirect(
+ JRoute::_(
+ 'index.php?option=' . $this->option . $redirect, false
)
);
}
@@ -265,11 +257,15 @@ class DemoControllerLook extends JControllerForm
*/
public function save($key = null, $urlVar = null)
{
- // get the referal details
- $this->ref = $this->input->get('ref', 0, 'word');
- $this->refid = $this->input->get('refid', 0, 'int');
+ // get the referral options
+ $this->ref = $this->input->get('ref', 0, 'word');
+ $this->refid = $this->input->get('refid', 0, 'int');
- if ($this->ref || $this->refid)
+ // Check if there is a return value
+ $return = $this->input->get('return', null, 'base64');
+ $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
+
+ if ($this->ref || $this->refid || $canReturn)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
@@ -277,9 +273,22 @@ class DemoControllerLook extends JControllerForm
$saved = parent::save($key, $urlVar);
- if ($this->refid && $saved)
+ // This is not needed since parent save already does this
+ // Due to the ref and refid implementation we need to add this
+ if ($canReturn)
{
- $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
+ $redirect = base64_decode($return);
+
+ // Redirect to the return value.
+ $this->setRedirect(
+ JRoute::_(
+ $redirect, false
+ )
+ );
+ }
+ elseif ($this->refid && $this->ref)
+ {
+ $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
@@ -288,9 +297,9 @@ class DemoControllerLook extends JControllerForm
)
);
}
- elseif ($this->ref && $saved)
+ elseif ($this->ref)
{
- $redirect = '&view='.(string)$this->ref;
+ $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
diff --git a/admin/controllers/looks.php b/admin/controllers/looks.php
index 0cad4dc..b05e619 100644
--- a/admin/controllers/looks.php
+++ b/admin/controllers/looks.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage looks.php
@@ -21,24 +21,33 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla controlleradmin library
-jimport('joomla.application.component.controlleradmin');
-
/**
* Looks Controller
*/
class DemoControllerLooks extends JControllerAdmin
{
- protected $text_prefix = 'COM_DEMO_LOOKS';
/**
- * Proxy for getModel.
- * @since 2.5
+ * The prefix to use with controller messages.
+ *
+ * @var string
+ * @since 1.6
*/
- public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array())
+ protected $text_prefix = 'COM_DEMO_LOOKS';
+
+ /**
+ * Method to get a model object, loading it if required.
+ *
+ * @param string $name The model name. Optional.
+ * @param string $prefix The class prefix. Optional.
+ * @param array $config Configuration array for model. Optional.
+ *
+ * @return JModelLegacy The model.
+ *
+ * @since 1.6
+ */
+ public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array('ignore_request' => true))
{
- $model = parent::getModel($name, $prefix, array('ignore_request' => true));
-
- return $model;
+ return parent::getModel($name, $prefix, $config);
}
public function exportData()
@@ -102,5 +111,5 @@ class DemoControllerLooks extends JControllerAdmin
$message = JText::_('COM_DEMO_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks', false), $message, 'error');
return;
- }
+ }
}
diff --git a/admin/demo.php b/admin/demo.php
index c144c5a..9b3733c 100644
--- a/admin/demo.php
+++ b/admin/demo.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage demo.php
@@ -20,29 +20,22 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
+JHtml::_('behavior.tabstate');
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_demo'))
{
- return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR'));
+ throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
};
-// Load cms libraries
-JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
-// Load joomla libraries without overwrite
-JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
-
// Add CSS file for all pages
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_demo/assets/css/admin.css');
$document->addScript('components/com_demo/assets/js/admin.js');
// require helper files
-JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
-JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
-
-// import joomla controller library
-jimport('joomla.application.component.controller');
+JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php');
+JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Get an instance of the controller prefixed by Demo
$controller = JControllerLegacy::getInstance('Demo');
diff --git a/admin/helpers/demo.php b/admin/helpers/demo.php
index 89a9d31..5fa11b7 100644
--- a/admin/helpers/demo.php
+++ b/admin/helpers/demo.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage demo.php
@@ -25,7 +25,7 @@ defined('_JEXEC') or die('Restricted access');
* Demo component helper.
*/
abstract class DemoHelper
-{
+{
/**
* Load the Component xml manifest.
**/
@@ -92,8 +92,8 @@ abstract class DemoHelper
}
/**
- * Can be used to build help urls.
- **/
+ * Can be used to build help urls.
+ **/
public static function getHelpUrl($view)
{
return false;
@@ -111,12 +111,17 @@ abstract class DemoHelper
if ($user->authorise('look.access', 'com_demo') && $user->authorise('look.submenu', 'com_demo'))
{
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu === 'looks');
+ }
+ if (JComponentHelper::isEnabled('com_fields'))
+ {
+ JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS'), 'index.php?option=com_fields&context=com_demo.look', $submenu === 'fields.fields');
+ JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_demo.look', $submenu === 'fields.groups');
}
- }
+ }
/**
- * UIKIT Component Classes
- **/
+ * UIKIT Component Classes
+ **/
public static $uk_components = array(
'data-uk-grid' => array(
'grid' ),
@@ -170,15 +175,15 @@ abstract class DemoHelper
'upload-drop' => array(
'upload', 'form-file' )
);
-
+
/**
- * Add UIKIT Components
- **/
+ * Add UIKIT Components
+ **/
public static $uikit = false;
/**
- * Get UIKIT Components
- **/
+ * Get UIKIT Components
+ **/
public static function getUikitComp($content,$classes = array())
{
if (strpos($content,'class="uk-') !== false)
@@ -208,13 +213,13 @@ abstract class DemoHelper
}
return $temp;
}
- }
+ }
if (self::checkArray($classes))
{
return $classes;
}
return false;
- }
+ }
/**
* Prepares the xml document
@@ -244,19 +249,19 @@ abstract class DemoHelper
{
$subjectTab = 'Sheet1';
}
-
- // make sure the file is loaded
+
+ // make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
-
+
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
-
+
// Set document properties
$objPHPExcel->getProperties()->setCreator($creator)
- ->setCompany('Vast Development Method')
- ->setLastModifiedBy($modified)
- ->setTitle($title)
- ->setSubject($subjectTab);
+ ->setCompany('Vast Development Method')
+ ->setLastModifiedBy($modified)
+ ->setTitle($title)
+ ->setSubject($subjectTab);
if (!$description)
{
$objPHPExcel->getProperties()->setDescription($description);
@@ -269,7 +274,7 @@ abstract class DemoHelper
{
$objPHPExcel->getProperties()->setCategory($category);
}
-
+
// Some styles
$headerStyles = array(
'font' => array(
@@ -291,7 +296,7 @@ abstract class DemoHelper
'size' => 11,
'name' => 'Verdana'
));
-
+
// Add some data
if (self::checkArray($rows))
{
@@ -318,43 +323,43 @@ abstract class DemoHelper
{
return false;
}
-
+
// Rename worksheet
$objPHPExcel->getActiveSheet()->setTitle($subjectTab);
-
+
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
-
+
// Redirect output to a client's web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$fileName.'.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
-
+
// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0
-
+
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
jexit();
}
-
+
/**
- * Get CSV Headers
- */
+ * Get CSV Headers
+ */
public static function getFileHeaders($dataType)
- {
- // make sure these files are loaded
+ {
+ // make sure these files are loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
JLoader::import('ChunkReadFilter', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/PHPExcel/Reader');
// get session object
- $session = JFactory::getSession();
- $package = $session->get('package', null);
- $package = json_decode($package, true);
+ $session = JFactory::getSession();
+ $package = $session->get('package', null);
+ $package = json_decode($package, true);
// set the headers
if(isset($package['dir']))
{
@@ -532,16 +537,16 @@ abstract class DemoHelper
{
if ($external)
{
- if ($name = self::getVar(null, $val, $id, $name, '=', $table))
+ if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{
- $names[] = $name;
+ $names[] = $_name;
}
}
else
{
- if ($name = self::getVar($table, $val, $id, $name))
+ if ($_name = self::getVar($table, $val, $id, $name))
{
- $names[] = $name;
+ $names[] = $_name;
}
}
}
@@ -931,7 +936,7 @@ abstract class DemoHelper
}
}
// check if there are any view values remaining
- if (count($_result))
+ if (count((array)$_result))
{
$_result = json_encode($_result);
$_result = array($_result);
@@ -1037,6 +1042,46 @@ abstract class DemoHelper
}
}
+ /**
+ * get the field object
+ *
+ * @param array $attributes The array of attributes
+ * @param string $default The default of the field
+ * @param array $options The options to apply to the XML element
+ *
+ * @return object
+ *
+ */
+ public static function getFieldObject(&$attributes, $default = '', $options = null)
+ {
+ // make sure we have attributes and a type value
+ if (self::checkArray($attributes) && isset($attributes['type']))
+ {
+ // make sure the form helper class is loaded
+ if (!method_exists('JFormHelper', 'loadFieldType'))
+ {
+ jimport('joomla.form.form');
+ }
+ // get field type
+ $field = JFormHelper::loadFieldType($attributes['type'],true);
+ // start field xml
+ $XML = new SimpleXMLElement('');
+ // load the attributes
+ self::xmlAddAttributes($XML, $attributes);
+ // check if we have options
+ if (self::checkArray($options))
+ {
+ // load the options
+ self::xmlAddOptions($XML, $options);
+ }
+ // setup the field
+ $field->setup($XML, $default);
+ // return the field object
+ return $field;
+ }
+ return false;
+ }
+
/**
* Render Bool Button
*
@@ -1055,8 +1100,6 @@ abstract class DemoHelper
$args = func_get_args();
// check if there is additional button class
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
- // start the xml
- $buttonXML = new SimpleXMLElement('');
// button attributes
$buttonAttributes = array(
'type' => 'radio',
@@ -1065,22 +1108,12 @@ abstract class DemoHelper
'class' => 'btn-group',
'filter' => 'INT',
'default' => isset($args[2]) ? (int) $args[2] : 0);
- // load the haskey attributes
- self::xmlAddAttributes($buttonXML, $buttonAttributes);
// set the button options
$buttonOptions = array(
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
- // load the button options
- self::xmlAddOptions($buttonXML, $buttonOptions);
-
- // get the radio element
- $button = JFormHelper::loadFieldType('radio');
-
- // run
- $button->setup($buttonXML, $buttonAttributes['default']);
-
- return $button->input;
+ // return the input
+ return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
}
/**
@@ -1125,7 +1158,7 @@ abstract class DemoHelper
**/
public static function checkArray($array, $removeEmptyString = false)
{
- if (isset($array) && is_array($array) && count($array) > 0)
+ if (isset($array) && is_array($array) && count((array)$array) > 0)
{
// also make sure the empty strings are removed
if ($removeEmptyString)
@@ -1228,7 +1261,7 @@ abstract class DemoHelper
{
$initial = strlen($string);
$words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE);
- $words_count = count($words);
+ $words_count = count((array)$words);
$word_length = 0;
$last_word = 0;
@@ -1263,7 +1296,7 @@ abstract class DemoHelper
*
* @returns string on success
**/
- public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
+ public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
if ($replaceNumbers === true)
{
@@ -1292,7 +1325,16 @@ abstract class DemoHelper
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
- $string = preg_replace("/[^A-Za-z ]/", '', $string);
+ // remove all and keep only characters
+ if ($keepOnlyCharacters)
+ {
+ $string = preg_replace("/[^A-Za-z ]/", '', $string);
+ }
+ // keep both numbers and characters
+ else
+ {
+ $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
+ }
// select final adaptations
if ($type === 'L' || $type === 'strtolower')
{
diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php
index 9654af4..ea4b931 100644
--- a/admin/helpers/headercheck.php
+++ b/admin/helpers/headercheck.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage headercheck.php
diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php
index fa2c726..5533776 100644
--- a/admin/helpers/html/batch_.php
+++ b/admin/helpers/html/batch_.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage batch_.php
diff --git a/admin/language/en-GB/en-GB.com_demo.ini b/admin/language/en-GB/en-GB.com_demo.ini
index e3b3745..35fcbf5 100644
--- a/admin/language/en-GB/en-GB.com_demo.ini
+++ b/admin/language/en-GB/en-GB.com_demo.ini
@@ -111,9 +111,9 @@ COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/upda
COM_DEMO_LOOKS_CREATE="Looks Create"
COM_DEMO_LOOKS_CREATE_DESC="Allows the users in this group to create create looks"
COM_DEMO_LOOKS_DASHBOARD_ADD="Looks Dashboard Add"
-COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the look"
+COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of look"
COM_DEMO_LOOKS_DASHBOARD_LIST="Looks Dashboard List"
-COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the look"
+COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of look"
COM_DEMO_LOOKS_DELETE="Looks Delete"
COM_DEMO_LOOKS_DELETE_DESC="Allows the users in this group to delete delete looks"
COM_DEMO_LOOKS_EDIT="Looks Edit"
@@ -150,7 +150,7 @@ COM_DEMO_LOOKS_N_ITEMS_UNFEATURED_1="%s Look unfeatured."
COM_DEMO_LOOKS_N_ITEMS_UNPUBLISHED="%s Looks unpublished."
COM_DEMO_LOOKS_N_ITEMS_UNPUBLISHED_1="%s Look unpublished."
COM_DEMO_LOOKS_SUBMENU="Looks Submenu"
-COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to update the submenu of the look"
+COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to submenu of look"
COM_DEMO_LOOK_ADD="Add"
COM_DEMO_LOOK_ADD_LABEL="Add More"
COM_DEMO_LOOK_ALIAS="Alias"
@@ -217,6 +217,8 @@ COM_DEMO_SAVE_SUCCESS="Great! Item successfully saved."
COM_DEMO_SAVE_WARNING="The value already existed so please select another."
COM_DEMO_SUBMENU_DASHBOARD="Dashboard"
COM_DEMO_SUBMENU_LOOKS="Looks"
+COM_DEMO_SUBMENU_LOOKS_FIELDS="Looks Fields"
+COM_DEMO_SUBMENU_LOOKS_FIELDS_GROUPS="Looks Field Groups"
COM_DEMO_TRASHED="Trashed"
COM_DEMO_USE_BATCH="Use Batch"
COM_DEMO_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
diff --git a/admin/language/en-GB/en-GB.com_demo.sys.ini b/admin/language/en-GB/en-GB.com_demo.sys.ini
index 272f96c..a487bf9 100644
--- a/admin/language/en-GB/en-GB.com_demo.sys.ini
+++ b/admin/language/en-GB/en-GB.com_demo.sys.ini
@@ -21,9 +21,9 @@ COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/upda
COM_DEMO_LOOKS_CREATE="Looks Create"
COM_DEMO_LOOKS_CREATE_DESC="Allows the users in this group to create create looks"
COM_DEMO_LOOKS_DASHBOARD_ADD="Looks Dashboard Add"
-COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the look"
+COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of look"
COM_DEMO_LOOKS_DASHBOARD_LIST="Looks Dashboard List"
-COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the look"
+COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of look"
COM_DEMO_LOOKS_DELETE="Looks Delete"
COM_DEMO_LOOKS_DELETE_DESC="Allows the users in this group to delete delete looks"
COM_DEMO_LOOKS_EDIT="Looks Edit"
@@ -43,7 +43,7 @@ COM_DEMO_LOOKS_EXPORT_DESC="Allows the users in this group to export export look
COM_DEMO_LOOKS_IMPORT="Looks Import"
COM_DEMO_LOOKS_IMPORT_DESC="Allows the users in this group to import import looks"
COM_DEMO_LOOKS_SUBMENU="Looks Submenu"
-COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to update the submenu of the look"
+COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to submenu of look"
COM_DEMO_MENU="» Demo"
COM_DEMO_MENU_LOOKS="Looks"
COM_DEMO_MENU_LOOKS_DESC="The List of all published looks"
diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php
index 1ec94aa..56e6e5b 100644
--- a/admin/layouts/batchselection.php
+++ b/admin/layouts/batchselection.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage batchselection.php
@@ -22,8 +22,8 @@
defined('JPATH_BASE') or die;
JHtmlBehavior::core();
-$divWrapper = range(1,120,2);
-$counter = 0;
+$divWrapper = range(1,120,2);
+$counter = 0;
?>
ListSelection) : ?>
diff --git a/admin/layouts/look/details_above.php b/admin/layouts/look/details_above.php
index e3af998..50cd9e2 100644
--- a/admin/layouts/look/details_above.php
+++ b/admin/layouts/look/details_above.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage details_above.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/details_fullwidth.php b/admin/layouts/look/details_fullwidth.php
index 09f2cfc..70f20f9 100644
--- a/admin/layouts/look/details_fullwidth.php
+++ b/admin/layouts/look/details_fullwidth.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage details_fullwidth.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/details_under.php b/admin/layouts/look/details_under.php
index 386fdd1..90565f7 100644
--- a/admin/layouts/look/details_under.php
+++ b/admin/layouts/look/details_under.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage details_under.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/metadata.php b/admin/layouts/look/metadata.php
index 67428c8..53726f0 100644
--- a/admin/layouts/look/metadata.php
+++ b/admin/layouts/look/metadata.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage metadata.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/more_left.php b/admin/layouts/look/more_left.php
index 56fc0e4..0b3bcd7 100644
--- a/admin/layouts/look/more_left.php
+++ b/admin/layouts/look/more_left.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage more_left.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/more_right.php b/admin/layouts/look/more_right.php
index b94764f..86cde4e 100644
--- a/admin/layouts/look/more_right.php
+++ b/admin/layouts/look/more_right.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage more_right.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm();
diff --git a/admin/layouts/look/publishing.php b/admin/layouts/look/publishing.php
index 8770def..117a936 100644
--- a/admin/layouts/look/publishing.php
+++ b/admin/layouts/look/publishing.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage publishing.php
@@ -19,7 +19,6 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
-
defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication();
diff --git a/admin/models/demo.php b/admin/models/demo.php
index 5235f1d..09b9e24 100644
--- a/admin/models/demo.php
+++ b/admin/models/demo.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage demo.php
@@ -21,10 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import the Joomla modellist library
-jimport('joomla.application.component.modellist');
-jimport('joomla.application.component.helper');
-
/**
* Demo Model
*/
diff --git a/admin/models/forms/look.js b/admin/models/forms/look.js
index a56a48a..14e706b 100644
--- a/admin/models/forms/look.js
+++ b/admin/models/forms/look.js
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage look.js
@@ -20,6 +20,7 @@
// Some Global Values
jform_vvvvvvvvvv_required = false;
jform_vvvvvvvvvw_required = false;
+jform_vvvvvvvvvx_required = false;
// Initial Script
jQuery(document).ready(function()
@@ -35,50 +36,70 @@ function vvvvvvv(add_vvvvvvv)
if (add_vvvvvvv == 1)
{
jQuery('#jform_dateofbirth').closest('.control-group').show();
- jQuery('#jform_email').closest('.control-group').show();
+ // add required attribute to dateofbirth field
if (jform_vvvvvvvvvv_required)
+ {
+ updateFieldRequired('dateofbirth',0);
+ jQuery('#jform_dateofbirth').prop('required','required');
+ jQuery('#jform_dateofbirth').attr('aria-required',true);
+ jQuery('#jform_dateofbirth').addClass('required');
+ jform_vvvvvvvvvv_required = false;
+ }
+ jQuery('#jform_email').closest('.control-group').show();
+ // add required attribute to email field
+ if (jform_vvvvvvvvvw_required)
{
updateFieldRequired('email',0);
jQuery('#jform_email').prop('required','required');
jQuery('#jform_email').attr('aria-required',true);
jQuery('#jform_email').addClass('required');
- jform_vvvvvvvvvv_required = false;
+ jform_vvvvvvvvvw_required = false;
}
-
jQuery('#jform_image').closest('.control-group').show();
jQuery('#jform_mobile_phone').closest('.control-group').show();
- if (jform_vvvvvvvvvw_required)
+ // add required attribute to mobile_phone field
+ if (jform_vvvvvvvvvx_required)
{
updateFieldRequired('mobile_phone',0);
jQuery('#jform_mobile_phone').prop('required','required');
jQuery('#jform_mobile_phone').attr('aria-required',true);
jQuery('#jform_mobile_phone').addClass('required');
- jform_vvvvvvvvvw_required = false;
+ jform_vvvvvvvvvx_required = false;
}
-
jQuery('#jform_website').closest('.control-group').show();
}
else
{
jQuery('#jform_dateofbirth').closest('.control-group').hide();
- jQuery('#jform_email').closest('.control-group').hide();
+ // remove required attribute from dateofbirth field
if (!jform_vvvvvvvvvv_required)
+ {
+ updateFieldRequired('dateofbirth',1);
+ jQuery('#jform_dateofbirth').removeAttr('required');
+ jQuery('#jform_dateofbirth').removeAttr('aria-required');
+ jQuery('#jform_dateofbirth').removeClass('required');
+ jform_vvvvvvvvvv_required = true;
+ }
+ jQuery('#jform_email').closest('.control-group').hide();
+ // remove required attribute from email field
+ if (!jform_vvvvvvvvvw_required)
{
updateFieldRequired('email',1);
jQuery('#jform_email').removeAttr('required');
jQuery('#jform_email').removeAttr('aria-required');
jQuery('#jform_email').removeClass('required');
- jform_vvvvvvvvvv_required = true;
+ jform_vvvvvvvvvw_required = true;
}
jQuery('#jform_image').closest('.control-group').hide();
jQuery('#jform_mobile_phone').closest('.control-group').hide();
- if (!jform_vvvvvvvvvw_required)
+ // remove required attribute from mobile_phone field
+ if (!jform_vvvvvvvvvx_required)
{
updateFieldRequired('mobile_phone',1);
jQuery('#jform_mobile_phone').removeAttr('required');
jQuery('#jform_mobile_phone').removeAttr('aria-required');
jQuery('#jform_mobile_phone').removeClass('required');
- jform_vvvvvvvvvw_required = true;
+ jform_vvvvvvvvvx_required = true;
}
jQuery('#jform_website').closest('.control-group').hide();
}
diff --git a/admin/models/forms/look.xml b/admin/models/forms/look.xml
index 00a6472..8a85098 100644
--- a/admin/models/forms/look.xml
+++ b/admin/models/forms/look.xml
@@ -142,6 +142,7 @@
class="text_area"
filter="url"
validated="url"
+ scheme="http,https"
message="COM_DEMO_LOOK_WEBSITE_MESSAGE"
hint="COM_DEMO_LOOK_WEBSITE_HINT"
/>
@@ -160,6 +161,11 @@
default="1970-01-01"
description="COM_DEMO_LOOK_DATEOFBIRTH_DESCRIPTION"
format="%Y-%m-%d"
+ filter="STRING"
+ required="true"
+ todaybutton="false"
+ minyear="-120"
+ maxyear="-1"
/>
addTablePath(JPATH_ADMINISTRATOR . '/components/com_demo/tables');
+ // get instance of the table
return JTable::getInstance($type, $prefix, $config);
}
@@ -98,22 +98,25 @@ class DemoModelLook extends JModelAdmin
}
return $item;
- }
+ }
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
+ * @param array $options Optional array of options for the form creation.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
- public function getForm($data = array(), $loadData = true)
- {
+ public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
+ {
+ // set load data option
+ $options['load_data'] = $loadData;
// Get the form.
- $form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
+ $form = $this->loadForm('com_demo.look', 'look', $options);
if (empty($form))
{
@@ -176,17 +179,20 @@ class DemoModelLook extends JModelAdmin
// Only load these values if no id is found
if (0 == $id)
{
- // Set redirected field name
- $redirectedField = $jinput->get('ref', null, 'STRING');
- // Set redirected field value
- $redirectedValue = $jinput->get('refid', 0, 'INT');
+ // Set redirected view name
+ $redirectedView = $jinput->get('ref', null, 'STRING');
+ // Set field name (or fall back to view name)
+ $redirectedField = $jinput->get('field', $redirectedView, 'STRING');
+ // Set redirected view id
+ $redirectedId = $jinput->get('refid', 0, 'INT');
+ // Set field id (or fall back to redirected view id)
+ $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
-
return $form;
}
@@ -237,7 +243,7 @@ class DemoModelLook extends JModelAdmin
protected function canEditState($record)
{
$user = JFactory::getUser();
- $recordId = (!empty($record->id)) ? $record->id : 0;
+ $recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
@@ -348,18 +354,18 @@ class DemoModelLook extends JModelAdmin
}
/**
- * Method to validate the form data.
- *
- * @param JForm $form The form to validate against.
- * @param array $data The data to validate.
- * @param string $group The name of the field group to validate.
- *
- * @return mixed Array of filtered data if valid, false otherwise.
- *
- * @see JFormRule
- * @see JFilterInput
- * @since 12.2
- */
+ * Method to validate the form data.
+ *
+ * @param JForm $form The form to validate against.
+ * @param array $data The data to validate.
+ * @param string $group The name of the field group to validate.
+ *
+ * @return mixed Array of filtered data if valid, false otherwise.
+ *
+ * @see JFormRule
+ * @see JFilterInput
+ * @since 12.2
+ */
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
@@ -381,7 +387,7 @@ class DemoModelLook extends JModelAdmin
}
}
return parent::validate($form, $data, $group);
- }
+ }
/**
* Method to get the unique fields of this table.
@@ -539,7 +545,7 @@ class DemoModelLook extends JModelAdmin
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
- * @since 12.2
+ * @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
@@ -632,7 +638,7 @@ class DemoModelLook extends JModelAdmin
$this->table->id = 0;
// TODO: Deal with ordering?
- // $this->table->ordering = 1;
+ // $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
@@ -666,7 +672,7 @@ class DemoModelLook extends JModelAdmin
$this->cleanCache();
return $newIds;
- }
+ }
/**
* Batch move items to a new category
@@ -677,7 +683,7 @@ class DemoModelLook extends JModelAdmin
*
* @return boolean True if successful, false otherwise and internal error is set.
*
- * @since 12.2
+ * @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
@@ -798,7 +804,7 @@ class DemoModelLook extends JModelAdmin
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
- }
+ }
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
@@ -907,14 +913,14 @@ class DemoModelLook extends JModelAdmin
}
/**
- * Method to change the title/s & alias.
- *
- * @param string $alias The alias.
- * @param string/array $title The title.
- *
- * @return array/string Contains the modified title/s and/or alias.
- *
- */
+ * Method to change the title/s & alias.
+ *
+ * @param string $alias The alias.
+ * @param string/array $title The title.
+ *
+ * @return array/string Contains the modified title/s and/or alias.
+ *
+ */
protected function _generateNewTitle($alias, $title = null)
{
diff --git a/admin/models/looks.php b/admin/models/looks.php
index 31bc3b1..4ec2aa6 100644
--- a/admin/models/looks.php
+++ b/admin/models/looks.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage looks.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import the Joomla modellist library
-jimport('joomla.application.component.modellist');
-
/**
* Looks Model
*/
@@ -95,7 +92,7 @@ class DemoModelLooks extends JModelList
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
- {
+ {
// check in items
$this->checkInNow();
@@ -105,11 +102,9 @@ class DemoModelLooks extends JModelList
// set values to display correctly.
if (DemoHelper::checkArray($items))
{
- // get user object.
- $user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
- $access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
+ $access = (JFactory::getUser()->authorise('look.access', 'com_demo.look.' . (int) $item->id) && JFactory::getUser()->authorise('look.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
@@ -117,7 +112,7 @@ class DemoModelLooks extends JModelList
}
}
- }
+ }
// return items
return $items;
@@ -195,10 +190,10 @@ class DemoModelLooks extends JModelList
}
/**
- * Method to get list export data.
- *
- * @return mixed An array of data items on success, false on failure.
- */
+ * Method to get list export data.
+ *
+ * @return mixed An array of data items on success, false on failure.
+ */
public function getExportData($pks)
{
// setup the query
@@ -238,11 +233,9 @@ class DemoModelLooks extends JModelList
// set values to display correctly.
if (DemoHelper::checkArray($items))
{
- // get user object.
- $user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
- $access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
+ $access = (JFactory::getUser()->authorise('look.access', 'com_demo.look.' . (int) $item->id) && JFactory::getUser()->authorise('look.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
@@ -292,7 +285,7 @@ class DemoModelLooks extends JModelList
return $headers;
}
return false;
- }
+ }
/**
* Method to get a store id based on model configuration state.
@@ -316,16 +309,16 @@ class DemoModelLooks extends JModelList
}
/**
- * Build an SQL query to checkin all items left checked out longer then a set time.
- *
- * @return a bool
- *
- */
+ * Build an SQL query to checkin all items left checked out longer then a set time.
+ *
+ * @return a bool
+ *
+ */
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_demo')->get('check_in');
-
+
if ($time)
{
diff --git a/admin/tables/look.php b/admin/tables/look.php
index 8c55ab2..23898ae 100644
--- a/admin/tables/look.php
+++ b/admin/tables/look.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage look.php
@@ -23,9 +23,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
-// import Joomla table library
-jimport('joomla.database.table');
-
/**
* Looks Table class
*/
@@ -49,7 +46,7 @@ class DemoTableLook extends JTable
parent::__construct('#__demo_look', 'id', $db);
// Adding History Options
- JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
+ JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
}
public function bind($array, $ignore = '')
@@ -321,11 +318,11 @@ class DemoTableLook extends JTable
}
/**
- * Generate a valid alias from title / date.
- * Remains public to be able to check for duplicated alias before saving
- *
- * @return string
- */
+ * Generate a valid alias from title / date.
+ * Remains public to be able to check for duplicated alias before saving
+ *
+ * @return string
+ */
public function generateAlias()
{
if (empty($this->alias))
diff --git a/admin/views/demo/tmpl/default.php b/admin/views/demo/tmpl/default.php
index eae048b..557d4e0 100644
--- a/admin/views/demo/tmpl/default.php
+++ b/admin/views/demo/tmpl/default.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage default.php
diff --git a/admin/views/demo/tmpl/default_main.php b/admin/views/demo/tmpl/default_main.php
index bac65ce..c034793 100644
--- a/admin/views/demo/tmpl/default_main.php
+++ b/admin/views/demo/tmpl/default_main.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage default_main.php
diff --git a/admin/views/demo/tmpl/default_vdm.php b/admin/views/demo/tmpl/default_vdm.php
index 5f2de88..8caa2ab 100644
--- a/admin/views/demo/tmpl/default_vdm.php
+++ b/admin/views/demo/tmpl/default_vdm.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage default_vdm.php
diff --git a/admin/views/demo/view.html.php b/admin/views/demo/view.html.php
index 6cc278a..abde8cd 100644
--- a/admin/views/demo/view.html.php
+++ b/admin/views/demo/view.html.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage view.html.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla view library
-jimport('joomla.application.component.view');
-
/**
* Demo View class
*/
diff --git a/admin/views/import/tmpl/default.php b/admin/views/import/tmpl/default.php
index 9e40e87..5ef9e6c 100644
--- a/admin/views/import/tmpl/default.php
+++ b/admin/views/import/tmpl/default.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage default.php
diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php
index dc452fe..de383f3 100644
--- a/admin/views/import/view.html.php
+++ b/admin/views/import/view.html.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage view.html.php
@@ -21,9 +21,6 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
-// import Joomla view library
-jimport('joomla.application.component.view');
-
/**
* Demo Import View
*/
diff --git a/admin/views/look/submitbutton.js b/admin/views/look/submitbutton.js
index f3ed727..5013c59 100644
--- a/admin/views/look/submitbutton.js
+++ b/admin/views/look/submitbutton.js
@@ -3,7 +3,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage submitbutton.js
diff --git a/admin/views/look/tmpl/edit.php b/admin/views/look/tmpl/edit.php
index 3af40db..56b28fd 100644
--- a/admin/views/look/tmpl/edit.php
+++ b/admin/views/look/tmpl/edit.php
@@ -4,7 +4,7 @@
/-------------------------------------------------------------------------------------------------------/
@version 2.0.0
- @build 5th May, 2018
+ @build 13th September, 2018
@created 18th October, 2016
@package Demo
@subpackage edit.php
@@ -51,7 +51,7 @@ $componentParams = JComponentHelper::getParams('com_demo');
});