Get Demo Component to work on both J3! and J4! via legacy approach #1
@ -1,48 +1,48 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// 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'))
|
||||
{
|
||||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
};
|
||||
|
||||
// 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', __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');
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// 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'))
|
||||
{
|
||||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
};
|
||||
|
||||
// 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', __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');
|
||||
|
||||
// Perform the Request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
|
@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `#__demo_look` (
|
||||
`mobile_phone` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`name` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`website` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`params` text NOT NULL,
|
||||
`params` text NULL,
|
||||
`published` TINYINT(3) NOT NULL DEFAULT 1,
|
||||
`created_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,
|
||||
|
@ -1,322 +1,322 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Looks Table class
|
||||
*/
|
||||
class DemoTableLook extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\String\StringHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Looks Table class
|
||||
*/
|
||||
class DemoTableLook extends JTable
|
||||
{
|
||||
/**
|
||||
* Ensure the params and metadata in json encoded in the bind method
|
||||
*
|
||||
* @var array
|
||||
* @since 3.3
|
||||
*/
|
||||
protected $_jsonEncode = array('params', 'metadata');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Database connector object
|
||||
*/
|
||||
function __construct(&$db)
|
||||
{
|
||||
parent::__construct('#__demo_look', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Look table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New look. A look created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('look', 'DemoTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('look', 'demoTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_demo.look.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_demo');
|
||||
|
||||
return $asset->id;
|
||||
// JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
{
|
||||
|
||||
if (isset($array['params']) && is_array($array['params']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['params']);
|
||||
$array['params'] = (string) $registry;
|
||||
}
|
||||
|
||||
if (isset($array['metadata']) && is_array($array['metadata']))
|
||||
{
|
||||
$registry = new JRegistry;
|
||||
$registry->loadArray($array['metadata']);
|
||||
$array['metadata'] = (string) $registry;
|
||||
}
|
||||
|
||||
// Bind the rules.
|
||||
if (isset($array['rules']) && is_array($array['rules']))
|
||||
{
|
||||
$rules = new JAccessRules($array['rules']);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
return parent::bind($array, $ignore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload the store method for the Look table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @return boolean True on success, false on failure.
|
||||
* @since 1.6
|
||||
*/
|
||||
public function store($updateNulls = false)
|
||||
{
|
||||
$date = JFactory::getDate();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
// Existing item
|
||||
$this->modified = $date->toSql();
|
||||
$this->modified_by = $user->get('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
// New look. A look created and created_by field can be set by the user,
|
||||
// so we don't touch either of these if they are set.
|
||||
if (!(int) $this->created)
|
||||
{
|
||||
$this->created = $date->toSql();
|
||||
}
|
||||
if (empty($this->created_by))
|
||||
{
|
||||
$this->created_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Verify that the alias is unique
|
||||
$table = JTable::getInstance('look', 'DemoTable');
|
||||
|
||||
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->url))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->url = JStringPunycode::urlToPunycode($this->url);
|
||||
}
|
||||
if (isset($this->website))
|
||||
{
|
||||
// Convert IDN urls to punycode
|
||||
$this->website = JStringPunycode::urlToPunycode($this->website);
|
||||
}
|
||||
|
||||
return parent::store($updateNulls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloaded check method to ensure data integrity.
|
||||
*
|
||||
* @return boolean True on success.
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
if (isset($this->alias))
|
||||
{
|
||||
// Generate a valid alias
|
||||
$this->generateAlias();
|
||||
|
||||
$table = JTable::getInstance('look', 'demoTable');
|
||||
|
||||
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||
{
|
||||
$this->alias = StringHelper::increment($this->alias, 'dash');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up keywords -- eliminate extra spaces between phrases
|
||||
* and cr (\r) and lf (\n) characters from string.
|
||||
* Only process if not empty.
|
||||
*/
|
||||
if (!empty($this->metakey))
|
||||
{
|
||||
// Array of characters to remove.
|
||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||
|
||||
// Remove bad characters.
|
||||
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||
|
||||
// Create array using commas as delimiter.
|
||||
$keys = explode(',', $after_clean);
|
||||
$clean_keys = array();
|
||||
|
||||
foreach ($keys as $key)
|
||||
{
|
||||
// Ignore blank keywords.
|
||||
if (trim($key))
|
||||
{
|
||||
$clean_keys[] = trim($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Put array back together delimited by ", "
|
||||
$this->metakey = implode(", ", $clean_keys);
|
||||
}
|
||||
|
||||
// Clean up description -- eliminate quotes and <> brackets
|
||||
if (!empty($this->metadesc))
|
||||
{
|
||||
// Only process if not empty
|
||||
$bad_characters = array("\"", "<", ">");
|
||||
$this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc);
|
||||
}
|
||||
|
||||
// If we don't have any access rules set at this point just use an empty JAccessRules class
|
||||
if (!$this->getRules())
|
||||
{
|
||||
$rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id);
|
||||
$this->setRules($rules);
|
||||
}
|
||||
|
||||
// Set ordering
|
||||
if ($this->published < 0)
|
||||
{
|
||||
// Set ordering to 0 if state is archived or trashed
|
||||
$this->ordering = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default asset values for a component.
|
||||
*
|
||||
* @param $string $component The component asset name to search for
|
||||
*
|
||||
* @return JAccessRules The JAccessRules object for the asset
|
||||
*/
|
||||
protected function getDefaultAssetValues($component, $try = true)
|
||||
{
|
||||
// Need to find the asset id by the name of the component.
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__assets'))
|
||||
->where($db->quoteName('name') . ' = ' . $db->quote($component));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->loadRowList())
|
||||
{
|
||||
// asset already set so use saved rules
|
||||
$assetId = (int) $db->loadResult();
|
||||
return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
|
||||
}
|
||||
// try again
|
||||
elseif ($try)
|
||||
{
|
||||
$try = explode('.',$component);
|
||||
$result = $this->getDefaultAssetValues($try[0], false);
|
||||
if ($result instanceof JAccessRules)
|
||||
{
|
||||
if (isset($try[1]))
|
||||
{
|
||||
$_result = (string) $result;
|
||||
$_result = json_decode($_result);
|
||||
foreach ($_result as $name => &$rule)
|
||||
{
|
||||
$v = explode('.', $name);
|
||||
if ($try[1] !== $v[0])
|
||||
{
|
||||
// remove since it is not part of this view
|
||||
unset($_result->$name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear the value since we inherit
|
||||
$rule = array();
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count( (array) $_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
// Instantiate and return the JAccessRules object for the asset rules.
|
||||
$rules = new JAccessRules;
|
||||
$rules->mergeCollection($_result);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
return JAccess::getAssetRules(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to compute the default name of the asset.
|
||||
* The default name is in the form 'table_name.id'
|
||||
* where id is the value of the primary key of the table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetName()
|
||||
{
|
||||
$k = $this->_tbl_key;
|
||||
return 'com_demo.look.'.(int) $this->$k;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return the title to use for the asset table.
|
||||
*
|
||||
* @return string
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetTitle()
|
||||
{
|
||||
if (isset($this->title))
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent asset id for the record
|
||||
*
|
||||
* @return int
|
||||
* @since 2.5
|
||||
*/
|
||||
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
|
||||
{
|
||||
$asset = JTable::getInstance('Asset');
|
||||
$asset->loadByName('com_demo');
|
||||
|
||||
return $asset->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -332,7 +332,7 @@ class DemoTableLook extends JTable
|
||||
$this->alias = $this->name;
|
||||
}
|
||||
|
||||
$this->alias = JApplication::stringURLSafe($this->alias);
|
||||
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
|
||||
|
||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||
{
|
||||
@ -340,6 +340,6 @@ class DemoTableLook extends JTable
|
||||
}
|
||||
|
||||
return $this->alias;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,28 +1,28 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.tooltip');
|
||||
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
//JHtml::_('behavior.tooltip');
|
||||
|
||||
?>
|
||||
<div id="j-main-container">
|
||||
<div class="span9">
|
||||
|
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
//JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
JHtml::_('behavior.keepalive');
|
||||
$componentParams = $this->params; // will be removed just use $this->params instead
|
||||
?>
|
||||
<!--<script type="text/javascript">
|
||||
// waiting spinner
|
||||
var outerDiv = jQuery('body');
|
||||
jQuery('<div id="loading"></div>')
|
||||
@ -50,8 +50,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
||||
jQuery('#loading').hide();
|
||||
});
|
||||
</script>
|
||||
<div id="demo_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<div id="demo_loader" style="display: none;">-->
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('look.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
@ -124,8 +124,8 @@ $componentParams = $this->params; // will be removed just use $this->params inst
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<?php echo JLayoutHelper::render('look.details_under', $this); ?>
|
||||
</form>
|
||||
<?php echo JLayoutHelper::render('look.details_under', $this); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -145,4 +145,4 @@ jQuery('#adminForm').on('change', '#jform_add',function (e)
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
@ -1,37 +1,37 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.tooltip');
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
//JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
JHtml::_('dropdown.init');
|
||||
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_DEMO_FILTER_SELECT_ACCESS') . ' -'));
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_demo&task=looks.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'lookList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
if ($this->saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_demo&task=looks.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'lookList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&view=looks'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if(!empty( $this->sidebar)): ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
@ -74,4 +74,4 @@ if ($this->saveOrder)
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
</form>
|
||||
|
@ -1,47 +1,47 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Demo View class for the Looks
|
||||
*/
|
||||
class DemoViewLooks extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Looks view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// Include helper submenu
|
||||
DemoHelper::addSubmenu('looks');
|
||||
}
|
||||
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Demo View class for the Looks
|
||||
*/
|
||||
class DemoViewLooks extends JViewLegacy
|
||||
{
|
||||
/**
|
||||
* Looks view display method
|
||||
* @return void
|
||||
*/
|
||||
function display($tpl = null)
|
||||
{
|
||||
// if ($this->getLayout() !== 'modal')
|
||||
// {
|
||||
// // Include helper submenu
|
||||
// DemoHelper::addSubmenu('looks');
|
||||
// }
|
||||
|
||||
// Assign data to the view
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->user = JFactory::getUser();
|
||||
// Load the filter form from xml.
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
@ -49,122 +49,122 @@ class DemoViewLooks extends JViewLegacy
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
// Add the list ordering clause.
|
||||
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
|
||||
$this->saveOrder = $this->listOrder == 'a.ordering';
|
||||
// set the return here value
|
||||
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
|
||||
// get global action permissions
|
||||
$this->canDo = DemoHelper::getActions('look');
|
||||
$this->canEdit = $this->canDo->get('look.edit');
|
||||
$this->canState = $this->canDo->get('look.edit.state');
|
||||
$this->canCreate = $this->canDo->get('look.create');
|
||||
$this->canDelete = $this->canDo->get('look.delete');
|
||||
$this->canBatch = $this->canDo->get('core.batch');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'eye-open');
|
||||
JHtmlSidebar::setAction('index.php?option=com_demo&view=looks');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
JToolBarHelper::addNew('look.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (DemoHelper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('look.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('looks.publish');
|
||||
JToolBarHelper::unpublishList('looks.unpublish');
|
||||
JToolBarHelper::archiveList('looks.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('looks.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('looks.trash');
|
||||
$this->canBatch = $this->canDo->get('core.batch');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
// Display the template
|
||||
parent::display($tpl);
|
||||
|
||||
// Set the document
|
||||
$this->setDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'eye-open');
|
||||
JHtmlSidebar::setAction('index.php?option=com_demo&view=looks');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
JToolBarHelper::addNew('look.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (DemoHelper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('look.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('looks.publish');
|
||||
JToolBarHelper::unpublishList('looks.unpublish');
|
||||
JToolBarHelper::archiveList('looks.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('looks.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('looks.trash');
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.export') && $this->canDo->get('look.export'))
|
||||
{
|
||||
JToolBarHelper::custom('looks.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.import') && $this->canDo->get('look.import'))
|
||||
{
|
||||
JToolBarHelper::custom('looks.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = DemoHelper::getHelpUrl('looks');
|
||||
if (DemoHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_demo');
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = DemoHelper::getHelpUrl('looks');
|
||||
if (DemoHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_demo');
|
||||
}
|
||||
|
||||
// Only load published batch if state and batch is allowed
|
||||
@ -185,55 +185,55 @@ class DemoViewLooks extends JViewLegacy
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_DEMO_LOOKS'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/looks.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return DemoHelper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return DemoHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to set up the document properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
if (!isset($this->document))
|
||||
{
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_('COM_DEMO_LOOKS'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/looks.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return DemoHelper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
return DemoHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of fields the table can be sorted by
|
||||
*
|
||||
* @return array Array containing the field name to sort by as the key and display text as value
|
||||
*/
|
||||
protected function getSortFields()
|
||||
{
|
||||
return array(
|
||||
'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.name' => JText::_('COM_DEMO_LOOK_NAME_LABEL'),
|
||||
'a.description' => JText::_('COM_DEMO_LOOK_DESCRIPTION_LABEL'),
|
||||
'a.id' => JText::_('JGRID_HEADING_ID')
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
20
demo.xml
20
demo.xml
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<extension type="component" version="4.0" method="upgrade">
|
||||
<name>COM_DEMO</name>
|
||||
<creationDate>8th February, 2021</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
@ -36,7 +36,7 @@
|
||||
<filename>index.html</filename>
|
||||
<folder>js</folder>
|
||||
<folder>css</folder>
|
||||
<folder>images</folder>
|
||||
<folder>images</folder>
|
||||
<folder>uikit-v2</folder>
|
||||
</media>
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>router.php</filename>
|
||||
<filename>demo.php</filename>
|
||||
<filename>demo.php</filename>
|
||||
<filename>router.php</filename>
|
||||
<folder>assets</folder>
|
||||
<folder>helpers</folder>
|
||||
@ -62,14 +62,14 @@
|
||||
</files>
|
||||
|
||||
<languages folder="site">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<administration>
|
||||
<menu>COM_DEMO_MENU</menu>
|
||||
<submenu>
|
||||
<!-- Instead of link you can specify individual link attributes -->
|
||||
<!-- Instead of link you can specify individual link attributes -->
|
||||
<menu option="com_demo" view="looks">COM_DEMO_MENU_LOOKS</menu>
|
||||
</submenu>
|
||||
<files folder="admin">
|
||||
@ -77,7 +77,7 @@
|
||||
<filename>config.xml</filename>
|
||||
<filename>controller.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<filename>demo.php</filename>
|
||||
<filename>demo.php</filename>
|
||||
<filename>README.txt</filename>
|
||||
<folder>assets</folder>
|
||||
<folder>controllers</folder>
|
||||
@ -90,12 +90,12 @@
|
||||
</files>
|
||||
|
||||
<languages folder="admin">
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.ini</language>
|
||||
<language tag="en-GB">language/en-GB/en-GB.com_demo.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
</administration>
|
||||
<updateservers>
|
||||
<server type="extension" enabled="1" element="com_demo" name="Demo">https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml</server>
|
||||
</administration>
|
||||
<updateservers>
|
||||
<server type="extension" enabled="1" element="com_demo" name="Demo">https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml</server>
|
||||
</updateservers>
|
||||
</extension>
|
@ -32,6 +32,23 @@
|
||||
<maintainer>Llewellyn van der Merwe</maintainer>
|
||||
<maintainerurl>https://www.vdm.io/</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*"/>
|
||||
</update>
|
||||
<update>
|
||||
<name>Demo</name>
|
||||
<description>Demo Component</description>
|
||||
<element>com_demo</element>
|
||||
<type>component</type>
|
||||
<version>2.0.3</version>
|
||||
<infourl title="Demo!">https://www.vdm.io/</infourl>
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">http://domain.com/demo.zip</downloadurl>
|
||||
</downloads>
|
||||
<tags>
|
||||
<tag>stable</tag>
|
||||
</tags>
|
||||
<maintainer>Llewellyn van der Merwe</maintainer>
|
||||
<maintainerurl>https://www.vdm.io/</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*" />
|
||||
</update>
|
||||
<update>
|
||||
<name>Demo</name>
|
||||
@ -48,6 +65,6 @@
|
||||
</tags>
|
||||
<maintainer>Llewellyn van der Merwe</maintainer>
|
||||
<maintainerurl>https://www.vdm.io/</maintainerurl>
|
||||
<targetplatform name="joomla" version="3.*"/>
|
||||
<targetplatform name="joomla" version="4.*" />
|
||||
</update>
|
||||
</updates>
|
828
script.php
828
script.php
@ -1,61 +1,71 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage script.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHTML::_('behavior.modal');
|
||||
|
||||
/**
|
||||
* Script File of Demo Component
|
||||
*/
|
||||
class com_demoInstallerScript
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function __construct(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on installation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function install(JAdapterInstance $parent) {}
|
||||
|
||||
/**
|
||||
* Called on uninstallation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function uninstall(JAdapterInstance $parent)
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage script.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
|
||||
//use Joomla\CMS\Installer\InstallerScript;
|
||||
//use Joomla\CMS\Filesystem\File;
|
||||
//use Joomla\CMS\Filesystem\Folder;
|
||||
//use Joomla\CMS\Installer\InstallerAdapter;
|
||||
//use Joomla\CMS\Language\Text;
|
||||
//use Joomla\CMS\Table\Table;
|
||||
|
||||
HTMLHelper::_('bootstrap.renderModal');
|
||||
|
||||
/**
|
||||
* Script File of Demo Component
|
||||
*/
|
||||
class com_demoInstallerScript
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function __construct(ComponentAdapter $parent) {}
|
||||
|
||||
/**
|
||||
* Called on installation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function install(ComponentAdapter $parent) {}
|
||||
|
||||
/**
|
||||
* Called on uninstallation
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*/
|
||||
public function uninstall(ComponentAdapter $parent)
|
||||
{
|
||||
// Get Application object
|
||||
$app = JFactory::getApplication();
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// Get The Database object
|
||||
$db = JFactory::getDbo();
|
||||
$db = Factory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
@ -325,36 +335,36 @@ class com_demoInstallerScript
|
||||
}
|
||||
|
||||
// Get the biggest rule column in the assets table at this point.
|
||||
$get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1";
|
||||
$db->setQuery($get_rule_length);
|
||||
if ($db->execute())
|
||||
{
|
||||
$rule_length = $db->loadResult();
|
||||
// Check the size of the rules column
|
||||
if ($rule_length < 5120)
|
||||
{
|
||||
// Revert the assets table rules column back to the default
|
||||
$revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';";
|
||||
$db->setQuery($revert_rule);
|
||||
$db->execute();
|
||||
$app->enqueueMessage(JText::_('Reverted the <b>#__assets</b> table rules column back to its default size of varchar(5120)'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$app->enqueueMessage(JText::_('Could not revert the <b>#__assets</b> table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.'));
|
||||
}
|
||||
}
|
||||
// $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1";
|
||||
// $db->setQuery($get_rule_length);
|
||||
// if ($db->execute())
|
||||
// {
|
||||
// $rule_length = $db->loadResult();
|
||||
// // Check the size of the rules column
|
||||
// if ($rule_length < 5120)
|
||||
// {
|
||||
// // Revert the assets table rules column back to the default
|
||||
// $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';";
|
||||
// $db->setQuery($revert_rule);
|
||||
// $db->execute();
|
||||
// $app->enqueueMessage(JText::_('Reverted the <b>#__assets</b> table rules column back to its default size of varchar(5120)'));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
//
|
||||
// $app->enqueueMessage(JText::_('Could not revert the <b>#__assets</b> table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.'));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$db = Factory::getDbo();
|
||||
}
|
||||
// Set app if not set already.
|
||||
if (!isset($app))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app = Factory::getApplication();
|
||||
}
|
||||
// Remove Demo from the action_logs_extensions table
|
||||
$demo_action_logs_extensions = array( $db->quoteName('extension') . ' = ' . $db->quote('com_demo') );
|
||||
@ -374,12 +384,12 @@ class com_demoInstallerScript
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$db = Factory::getDbo();
|
||||
}
|
||||
// Set app if not set already.
|
||||
if (!isset($app))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app = Factory::getApplication();
|
||||
}
|
||||
// Remove Demo Look from the action_log_config table
|
||||
$look_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_demo.look') );
|
||||
@ -394,114 +404,114 @@ class com_demoInstallerScript
|
||||
{
|
||||
// If successfully removed Demo Look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The com_demo.look type alias was removed from the <b>#__action_log_config</b> table'));
|
||||
}
|
||||
// little notice as after service, in case of bad experience with component.
|
||||
echo '<h2>Did something go wrong? Are you disappointed?</h2>
|
||||
<p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>.
|
||||
<br />We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really!
|
||||
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
|
||||
<br />Visit us at <a href="https://www.vdm.io/" target="_blank">https://www.vdm.io/</a> today!</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on update
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function update(JAdapterInstance $parent){}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function preflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
// 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.8.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
{
|
||||
}
|
||||
// do any install needed
|
||||
if ($type === 'install')
|
||||
{
|
||||
}
|
||||
// check if the PHPExcel stuff is still around
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php'))
|
||||
{
|
||||
// We need to remove this old PHPExcel folder
|
||||
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel');
|
||||
// We need to remove this old PHPExcel file
|
||||
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function postflight($type, JAdapterInstance $parent)
|
||||
{
|
||||
// get application
|
||||
$app = JFactory::getApplication();
|
||||
}
|
||||
// little notice as after service, in case of bad experience with component.
|
||||
echo '<h2>Did something go wrong? Are you disappointed?</h2>
|
||||
<p>Please let me know at <a href="mailto:joomla@vdm.io">joomla@vdm.io</a>.
|
||||
<br />We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really!
|
||||
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
|
||||
<br />Visit us at <a href="https://www.vdm.io/" target="_blank">https://www.vdm.io/</a> today!</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on update
|
||||
*
|
||||
* @param JAdapterInstance $parent The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function update(ComponentAdapter $parent){}
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function preflight($type, ComponentAdapter $parent)
|
||||
{
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
// 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.8.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
{
|
||||
}
|
||||
// do any install needed
|
||||
if ($type === 'install')
|
||||
{
|
||||
}
|
||||
// check if the PHPExcel stuff is still around
|
||||
if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php'))
|
||||
{
|
||||
// We need to remove this old PHPExcel folder
|
||||
$this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel');
|
||||
// We need to remove this old PHPExcel file
|
||||
JFile::delete(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function postflight($type, ComponentAdapter $parent)
|
||||
{
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
// We check if we have dynamic folders to copy
|
||||
$this->setDynamicF0ld3rs($app, $parent);
|
||||
// set the default component settings
|
||||
if ($type === 'install')
|
||||
$this->setDynamicF0ld3rs($app, $parent);
|
||||
// set the default component settings
|
||||
if ($type === 'install')
|
||||
{
|
||||
|
||||
// Get The Database object
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create the look content type object.
|
||||
$look = new stdClass();
|
||||
$look->type_title = 'Demo Look';
|
||||
$look->type_alias = 'com_demo.look';
|
||||
$look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
$look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}';
|
||||
$look->router = 'DemoHelperRoute::getLookRoute';
|
||||
$look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';
|
||||
|
||||
// Set the object into the content types table.
|
||||
$look_Inserted = $db->insertObject('#__content_types', $look);
|
||||
$db = Factory::getDbo();
|
||||
//
|
||||
// // Create the look content type object.
|
||||
// $look = new stdClass();
|
||||
// $look->type_title = 'Demo Look';
|
||||
// $look->type_alias = 'com_demo.look';
|
||||
// $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
// $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}';
|
||||
// $look->router = 'DemoHelperRoute::getLookRoute';
|
||||
// $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';
|
||||
//
|
||||
// // Set the object into the content types table.
|
||||
// $look_Inserted = $db->insertObject('#__content_types', $look);
|
||||
|
||||
|
||||
// Install the global extenstion assets permission.
|
||||
$query = $db->getQuery(true);
|
||||
// $query = $db->getQuery(true);
|
||||
// Field to update.
|
||||
$fields = array(
|
||||
$db->quoteName('rules') . ' = ' . $db->quote('{"site.looks.access":{"1":1}}'),
|
||||
);
|
||||
// $fields = array(
|
||||
// $db->quoteName('rules') . ' = ' . $db->quote('{"site.looks.access":{"1":1}}'),
|
||||
// );
|
||||
// Condition.
|
||||
$conditions = array(
|
||||
$db->quoteName('name') . ' = ' . $db->quote('com_demo')
|
||||
);
|
||||
$query->update($db->quoteName('#__assets'))->set($fields)->where($conditions);
|
||||
$db->setQuery($query);
|
||||
$allDone = $db->execute();
|
||||
// $conditions = array(
|
||||
// $db->quoteName('name') . ' = ' . $db->quote('com_demo')
|
||||
// );
|
||||
// $query->update($db->quoteName('#__assets'))->set($fields)->where($conditions);
|
||||
// $db->setQuery($query);
|
||||
// $allDone = $db->execute();
|
||||
|
||||
// Install the global extenstion params.
|
||||
$query = $db->getQuery(true);
|
||||
@ -518,93 +528,93 @@ class com_demoInstallerScript
|
||||
$allDone = $db->execute();
|
||||
|
||||
|
||||
// Get Application object
|
||||
$app = JFactory::getApplication();
|
||||
// Get Application object
|
||||
$app = Factory::getApplication();
|
||||
$app->enqueueMessage('This is a demo component developed in <a href="http://vdm.bz/component-builder" taget="_balnk" title="Joomla Component Builder">JCB</a>! You can build more components like this with JCB, checkout our page on <a href="https://github.com/vdm-io/Joomla-Component-Builder" taget="_balnk" title="Joomla Component Builder">github</a> for more info. The future of <a href="http://vdm.bz/component-builder" taget="_balnk" title="Joomla Component Builder">Joomla Component Development</a> is Here!', 'Info');
|
||||
// Get the biggest rule column in the assets table at this point.
|
||||
$get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1";
|
||||
$db->setQuery($get_rule_length);
|
||||
if ($db->execute())
|
||||
{
|
||||
$rule_length = $db->loadResult();
|
||||
// Check the size of the rules column
|
||||
if ($rule_length <= 5600)
|
||||
{
|
||||
// Fix the assets table rules column size
|
||||
$fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';";
|
||||
$db->setQuery($fix_rules_size);
|
||||
$db->execute();
|
||||
$app->enqueueMessage(JText::_('The <b>#__assets</b> table rules column was resized to the TEXT datatype for the components possible large permission rules.'));
|
||||
}
|
||||
}
|
||||
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
|
||||
<img src="components/com_demo/assets/images/vdm-component.jpg"/>
|
||||
</a>';
|
||||
// // Get the biggest rule column in the assets table at this point.
|
||||
// $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1";
|
||||
// $db->setQuery($get_rule_length);
|
||||
// if ($db->execute())
|
||||
// {
|
||||
// $rule_length = $db->loadResult();
|
||||
// // Check the size of the rules column
|
||||
// if ($rule_length <= 5600)
|
||||
// {
|
||||
// // Fix the assets table rules column size
|
||||
// $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';";
|
||||
// $db->setQuery($fix_rules_size);
|
||||
// $db->execute();
|
||||
// $app->enqueueMessage(JText::_('The <b>#__assets</b> table rules column was resized to the TEXT datatype for the components possible large permission rules.'));
|
||||
// }
|
||||
// }
|
||||
// echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
|
||||
// <img src="components/com_demo/assets/images/vdm-component.jpg"/>
|
||||
// </a>';
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
}
|
||||
// Create the demo action logs extensions object.
|
||||
$demo_action_logs_extensions = new stdClass();
|
||||
$demo_action_logs_extensions->extension = 'com_demo';
|
||||
|
||||
// Set the object into the action logs extensions table.
|
||||
$demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions);
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
}
|
||||
// Create the look action log config object.
|
||||
$look_action_log_config = new stdClass();
|
||||
$look_action_log_config->type_title = 'LOOK';
|
||||
$look_action_log_config->type_alias = 'com_demo.look';
|
||||
$look_action_log_config->id_holder = 'id';
|
||||
$look_action_log_config->title_holder = 'name';
|
||||
$look_action_log_config->table_name = '#__demo_look';
|
||||
$look_action_log_config->text_prefix = 'COM_DEMO';
|
||||
|
||||
// Set the object into the action log config table.
|
||||
$look_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config);
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
// if (!isset($db))
|
||||
// {
|
||||
// $db = Factory::getDbo();
|
||||
// }
|
||||
// // Create the demo action logs extensions object.
|
||||
// $demo_action_logs_extensions = new stdClass();
|
||||
// $demo_action_logs_extensions->extension = 'com_demo';
|
||||
//
|
||||
// // Set the object into the action logs extensions table.
|
||||
// $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions);
|
||||
//
|
||||
// // Set db if not set already.
|
||||
// if (!isset($db))
|
||||
// {
|
||||
// $db = Factory::getDbo();
|
||||
// }
|
||||
// // Create the look action log config object.
|
||||
// $look_action_log_config = new stdClass();
|
||||
// $look_action_log_config->type_title = 'LOOK';
|
||||
// $look_action_log_config->type_alias = 'com_demo.look';
|
||||
// $look_action_log_config->id_holder = 'id';
|
||||
// $look_action_log_config->title_holder = 'name';
|
||||
// $look_action_log_config->table_name = '#__demo_look';
|
||||
// $look_action_log_config->text_prefix = 'COM_DEMO';
|
||||
//
|
||||
// // Set the object into the action log config table.
|
||||
// $look_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config);
|
||||
}
|
||||
// do any updates needed
|
||||
if ($type === 'update')
|
||||
{
|
||||
|
||||
// Get The Database object
|
||||
$db = JFactory::getDbo();
|
||||
// $db = Factory::getDbo();
|
||||
|
||||
// Create the look content type object.
|
||||
$look = new stdClass();
|
||||
$look->type_title = 'Demo Look';
|
||||
$look->type_alias = 'com_demo.look';
|
||||
$look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
$look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}';
|
||||
$look->router = 'DemoHelperRoute::getLookRoute';
|
||||
$look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';
|
||||
// $look = new stdClass();
|
||||
// $look->type_title = 'Demo Look';
|
||||
// $look->type_alias = 'com_demo.look';
|
||||
// $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
|
||||
// $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}';
|
||||
// $look->router = 'DemoHelperRoute::getLookRoute';
|
||||
// $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';
|
||||
|
||||
// Check if look type is already in content_type DB.
|
||||
$look_id = null;
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('type_id')));
|
||||
$query->from($db->quoteName('#__content_types'));
|
||||
$query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look->type_alias));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
// Set the object into the content types table.
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$look->type_id = $db->loadResult();
|
||||
$look_Updated = $db->updateObject('#__content_types', $look, 'type_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$look_Inserted = $db->insertObject('#__content_types', $look);
|
||||
}
|
||||
// $look_id = null;
|
||||
// $query = $db->getQuery(true);
|
||||
// $query->select($db->quoteName(array('type_id')));
|
||||
// $query->from($db->quoteName('#__content_types'));
|
||||
// $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look->type_alias));
|
||||
// $db->setQuery($query);
|
||||
// $db->execute();
|
||||
//
|
||||
// // Set the object into the content types table.
|
||||
// if ($db->getNumRows())
|
||||
// {
|
||||
// $look->type_id = $db->loadResult();
|
||||
// $look_Updated = $db->updateObject('#__content_types', $look, 'type_id');
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $look_Inserted = $db->insertObject('#__content_types', $look);
|
||||
// }
|
||||
|
||||
|
||||
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
|
||||
@ -613,164 +623,164 @@ class com_demoInstallerScript
|
||||
<h3>Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.</h3>';
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
}
|
||||
// Create the demo action logs extensions object.
|
||||
$demo_action_logs_extensions = new stdClass();
|
||||
$demo_action_logs_extensions->extension = 'com_demo';
|
||||
|
||||
// Check if demo action log extension is already in action logs extensions DB.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('id')));
|
||||
$query->from($db->quoteName('#__action_logs_extensions'));
|
||||
$query->where($db->quoteName('extension') . ' LIKE '. $db->quote($demo_action_logs_extensions->extension));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
// Set the object into the action logs extensions table if not found.
|
||||
if (!$db->getNumRows())
|
||||
{
|
||||
$demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions);
|
||||
}
|
||||
|
||||
// Set db if not set already.
|
||||
if (!isset($db))
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
}
|
||||
// Create the look action log config object.
|
||||
$look_action_log_config = new stdClass();
|
||||
$look_action_log_config->id = null;
|
||||
$look_action_log_config->type_title = 'LOOK';
|
||||
$look_action_log_config->type_alias = 'com_demo.look';
|
||||
$look_action_log_config->id_holder = 'id';
|
||||
$look_action_log_config->title_holder = 'name';
|
||||
$look_action_log_config->table_name = '#__demo_look';
|
||||
$look_action_log_config->text_prefix = 'COM_DEMO';
|
||||
|
||||
// Check if look action log config is already in action_log_config DB.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('id')));
|
||||
$query->from($db->quoteName('#__action_log_config'));
|
||||
$query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look_action_log_config->type_alias));
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
// if (!isset($db))
|
||||
// {
|
||||
// $db = Factory::getDbo();
|
||||
// }
|
||||
// // Create the demo action logs extensions object.
|
||||
// $demo_action_logs_extensions = new stdClass();
|
||||
// $demo_action_logs_extensions->extension = 'com_demo';
|
||||
//
|
||||
// // Check if demo action log extension is already in action logs extensions DB.
|
||||
// $query = $db->getQuery(true);
|
||||
// $query->select($db->quoteName(array('id')));
|
||||
// $query->from($db->quoteName('#__action_logs_extensions'));
|
||||
// $query->where($db->quoteName('extension') . ' LIKE '. $db->quote($demo_action_logs_extensions->extension));
|
||||
// $db->setQuery($query);
|
||||
// $db->execute();
|
||||
//
|
||||
// // Set the object into the action logs extensions table if not found.
|
||||
// if (!$db->getNumRows())
|
||||
// {
|
||||
// $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions);
|
||||
// }
|
||||
//
|
||||
// // Set db if not set already.
|
||||
// if (!isset($db))
|
||||
// {
|
||||
// $db = Factory::getDbo();
|
||||
// }
|
||||
// // Create the look action log config object.
|
||||
// $look_action_log_config = new stdClass();
|
||||
// $look_action_log_config->id = null;
|
||||
// $look_action_log_config->type_title = 'LOOK';
|
||||
// $look_action_log_config->type_alias = 'com_demo.look';
|
||||
// $look_action_log_config->id_holder = 'id';
|
||||
// $look_action_log_config->title_holder = 'name';
|
||||
// $look_action_log_config->table_name = '#__demo_look';
|
||||
// $look_action_log_config->text_prefix = 'COM_DEMO';
|
||||
//
|
||||
// // Check if look action log config is already in action_log_config DB.
|
||||
// $query = $db->getQuery(true);
|
||||
// $query->select($db->quoteName(array('id')));
|
||||
// $query->from($db->quoteName('#__action_log_config'));
|
||||
// $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look_action_log_config->type_alias));
|
||||
// $db->setQuery($query);
|
||||
// $db->execute();
|
||||
//
|
||||
// Set the object into the content types table.
|
||||
if ($db->getNumRows())
|
||||
// if ($db->getNumRows())
|
||||
// {
|
||||
// $look_action_log_config->id = $db->loadResult();
|
||||
// $look_action_log_config_Updated = $db->updateObject('#__action_log_config', $look_action_log_config, 'id');
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $look_action_log_config_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config);
|
||||
// }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $ignore The folders and files to ignore and not remove
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
*
|
||||
*/
|
||||
protected function removeFolder($dir, $ignore = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
// remove ending /
|
||||
$dir = rtrim($dir, '/');
|
||||
// now loop the files & folders
|
||||
foreach ($it as $file)
|
||||
{
|
||||
$look_action_log_config->id = $db->loadResult();
|
||||
$look_action_log_config_Updated = $db->updateObject('#__action_log_config', $look_action_log_config, 'id');
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
// set file dir
|
||||
$file_dir = $file->getPathname();
|
||||
// check if this is a dir or a file
|
||||
if ($file->isDir())
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFolder::delete($file_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFile::delete($file_dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
// delete the root folder if not ignore found
|
||||
if (!$this->checkArray($ignore))
|
||||
{
|
||||
$look_action_log_config_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove folders with files
|
||||
*
|
||||
* @param string $dir The path to folder to remove
|
||||
* @param boolean $ignore The folders and files to ignore and not remove
|
||||
*
|
||||
* @return boolean True in all is removed
|
||||
*
|
||||
*/
|
||||
protected function removeFolder($dir, $ignore = false)
|
||||
{
|
||||
if (JFolder::exists($dir))
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator($dir);
|
||||
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
// remove ending /
|
||||
$dir = rtrim($dir, '/');
|
||||
// now loop the files & folders
|
||||
foreach ($it as $file)
|
||||
{
|
||||
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
|
||||
// set file dir
|
||||
$file_dir = $file->getPathname();
|
||||
// check if this is a dir or a file
|
||||
if ($file->isDir())
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFolder::delete($file_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$keeper = false;
|
||||
if ($this->checkArray($ignore))
|
||||
{
|
||||
foreach ($ignore as $keep)
|
||||
{
|
||||
if (strpos($file_dir, $dir.'/'.$keep) !== false)
|
||||
{
|
||||
$keeper = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($keeper)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
JFile::delete($file_dir);
|
||||
}
|
||||
}
|
||||
// delete the root folder if not ignore found
|
||||
if (!$this->checkArray($ignore))
|
||||
{
|
||||
return JFolder::delete($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
*/
|
||||
protected function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
{
|
||||
foreach ($array as $key => $string)
|
||||
{
|
||||
if (empty($string))
|
||||
{
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return $this->checkArray($array, false);
|
||||
}
|
||||
return $nr;
|
||||
}
|
||||
return false;
|
||||
return JFolder::delete($dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if have an array with a length
|
||||
*
|
||||
* @input array The array to check
|
||||
*
|
||||
* @returns bool/int number of items in array on success
|
||||
*/
|
||||
protected function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
{
|
||||
foreach ($array as $key => $string)
|
||||
{
|
||||
if (empty($string))
|
||||
{
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return $this->checkArray($array, false);
|
||||
}
|
||||
return $nr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -806,5 +816,5 @@ class com_demoInstallerScript
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,42 +1,42 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::_('behavior.tabstate');
|
||||
|
||||
// Set the component css/js
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('components/com_demo/assets/css/site.css');
|
||||
$document->addScript('components/com_demo/assets/js/site.js');
|
||||
|
||||
// Require helper files
|
||||
JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php');
|
||||
JLoader::register('DemoHelperRoute', __DIR__ . '/helpers/route.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Demo
|
||||
$controller = JControllerLegacy::getInstance('Demo');
|
||||
|
||||
// Perform the request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
//JHtml::_('behavior.tabstate');
|
||||
|
||||
// Set the component css/js
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('components/com_demo/assets/css/site.css');
|
||||
$document->addScript('components/com_demo/assets/js/site.js');
|
||||
|
||||
// Require helper files
|
||||
JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php');
|
||||
JLoader::register('DemoHelperRoute', __DIR__ . '/helpers/route.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Demo
|
||||
$controller = JControllerLegacy::getInstance('Demo');
|
||||
|
||||
// Perform the request task
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
|
@ -1,91 +1,91 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looking.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Demo Looking Model
|
||||
*/
|
||||
class DemoModelLooking extends JModelItem
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_demo.looking';
|
||||
|
||||
/**
|
||||
* Model user data.
|
||||
*
|
||||
* @var strings
|
||||
*/
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $app;
|
||||
protected $input;
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
// Get the itme main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('looking.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
$params = $this->app->getParams();
|
||||
$this->setState('params', $params);
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer $pk The id of the article.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looking.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Demo Looking Model
|
||||
*/
|
||||
class DemoModelLooking extends JModelItem
|
||||
{
|
||||
/**
|
||||
* Model context string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_context = 'com_demo.looking';
|
||||
|
||||
/**
|
||||
* Model user data.
|
||||
*
|
||||
* @var strings
|
||||
*/
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $app;
|
||||
protected $input;
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* @var object item
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @since 1.6
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
// Get the itme main id
|
||||
$id = $this->input->getInt('id', null);
|
||||
$this->setState('looking.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
$params = $this->app->getParams();
|
||||
$this->setState('params', $params);
|
||||
parent::populateState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get article data.
|
||||
*
|
||||
* @param integer $pk The id of the article.
|
||||
*
|
||||
* @return mixed Menu item data object on success, false on failure.
|
||||
*/
|
||||
public function getItem($pk = null)
|
||||
{
|
||||
$this->user = JFactory::getUser();
|
||||
// check if this user has permission to access item
|
||||
if (!$this->user->authorise('site.looking.access', 'com_demo'))
|
||||
@ -95,24 +95,24 @@ class DemoModelLooking extends JModelItem
|
||||
// redirect away to the default view if no access allowed.
|
||||
$app->redirect(JRoute::_('index.php?option=com_demo&view=looks'));
|
||||
return false;
|
||||
}
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->initSet = true;
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id');
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = array();
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
}
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->initSet = true;
|
||||
|
||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id');
|
||||
|
||||
if ($this->_item === null)
|
||||
{
|
||||
$this->_item = array();
|
||||
}
|
||||
|
||||
if (!isset($this->_item[$pk]))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
@ -141,37 +141,37 @@ class DemoModelLooking extends JModelItem
|
||||
return false;
|
||||
}
|
||||
// Load the JEvent Dispatcher
|
||||
JPluginHelper::importPlugin('content');
|
||||
$this->_dispatcher = JEventDispatcher::getInstance();
|
||||
// JPluginHelper::importPlugin('content');
|
||||
// $this->_dispatcher = JEventDispatcher::getInstance();
|
||||
// Check if item has params, or pass whole item.
|
||||
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
||||
// Make sure the content prepare plugins fire on description
|
||||
$_description = new stdClass();
|
||||
$_description->text =& $data->description; // value must be in text
|
||||
// Since all values are now in text (Joomla Limitation), we also add the field name (description) to context
|
||||
$this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0));
|
||||
// $this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0));
|
||||
// Checking if description has uikit components that must be loaded.
|
||||
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
||||
|
||||
// set data object to item.
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
JError::raiseWarning(404, $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
$this->_item[$pk] = $data;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
if ($e->getCode() == 404)
|
||||
{
|
||||
// Need to go thru the error handler to allow Redirect to work.
|
||||
JError::raiseWarning(404, $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setError($e);
|
||||
$this->_item[$pk] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,5 +187,5 @@ class DemoModelLooking extends JModelItem
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
457
site/router.php
457
site/router.php
@ -1,259 +1,204 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage router.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/**
|
||||
* Routing class from com_demo
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
class DemoRouter extends JComponentRouterBase
|
||||
{
|
||||
/**
|
||||
* Build the route for the com_demo component
|
||||
*
|
||||
* @param array &$query An array of URL arguments
|
||||
*
|
||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
public function build(&$query)
|
||||
{
|
||||
$segments = array();
|
||||
|
||||
// Get a menu item based on Itemid or currently active
|
||||
$params = JComponentHelper::getParams('com_demo');
|
||||
|
||||
if (empty($query['Itemid']))
|
||||
{
|
||||
$menuItem = $this->menu->getActive();
|
||||
}
|
||||
else
|
||||
{
|
||||
$menuItem = $this->menu->getItem($query['Itemid']);
|
||||
}
|
||||
|
||||
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
|
||||
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
|
||||
|
||||
if (isset($query['view']))
|
||||
{
|
||||
$view = $query['view'];
|
||||
|
||||
if (empty($query['Itemid']))
|
||||
{
|
||||
$segments[] = $query['view'];
|
||||
}
|
||||
|
||||
unset($query['view']);
|
||||
}
|
||||
|
||||
// Are we dealing with a item that is attached to a menu item?
|
||||
if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id']))
|
||||
{
|
||||
unset($query['view']);
|
||||
unset($query['catid']);
|
||||
unset($query['id']);
|
||||
return $segments;
|
||||
}
|
||||
|
||||
if (isset($view) && isset($query['id']) && ($view === 'look' || $view === 'looks' || $view === 'looking'))
|
||||
{
|
||||
if ($mId != (int) $query['id'] || $mView != $view)
|
||||
{
|
||||
if (($view === 'look' || $view === 'looks' || $view === 'looking'))
|
||||
{
|
||||
$segments[] = $view;
|
||||
$id = explode(':', $query['id']);
|
||||
if (count($id) == 2)
|
||||
{
|
||||
$segments[] = $id[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$segments[] = $id[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($query['id']);
|
||||
}
|
||||
|
||||
$total = count($segments);
|
||||
|
||||
for ($i = 0; $i < $total; $i++)
|
||||
{
|
||||
$segments[$i] = str_replace(':', '-', $segments[$i]);
|
||||
}
|
||||
|
||||
return $segments;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the segments of a URL.
|
||||
*
|
||||
* @param array &$segments The segments of the URL to parse.
|
||||
*
|
||||
* @return array The URL attributes to be used by the application.
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
public function parse(&$segments)
|
||||
{
|
||||
$count = count($segments);
|
||||
$vars = array();
|
||||
|
||||
//Handle View and Identifier
|
||||
switch($segments[0])
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage router.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Component\Router\RouterView;
|
||||
use Joomla\CMS\Component\Router\RouterViewConfiguration;
|
||||
use Joomla\CMS\Component\Router\Rules\MenuRules;
|
||||
use Joomla\CMS\Component\Router\Rules\StandardRules;
|
||||
use Joomla\CMS\Component\Router\Rules\NomenuRules;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Menu\SiteMenu;
|
||||
|
||||
/**
|
||||
* Routing class from com_demo
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
class DemoRouter extends RouterView
|
||||
{
|
||||
/**
|
||||
* The database driver
|
||||
*
|
||||
* @var \JDatabaseDriver
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Search Component router constructor
|
||||
*
|
||||
* @param CMSApplication $app The application object
|
||||
* @param SiteMenu $menu The menu object to work with
|
||||
*/
|
||||
public function __construct($app = null, $menu = null)
|
||||
{
|
||||
$this->db = Factory::getDbo();
|
||||
|
||||
$looks = new RouterViewConfiguration('looks');
|
||||
$this->registerView($looks);
|
||||
|
||||
$look = (new RouterViewConfiguration('look'))
|
||||
->setParent($looks)
|
||||
->setKey('id');
|
||||
$this->registerView($look);
|
||||
|
||||
$looking = (new RouterViewConfiguration('looking'))
|
||||
->setParent($look, 'id')
|
||||
->setKey('id');
|
||||
|
||||
$this->registerView($looking);
|
||||
|
||||
$export = (new RouterViewConfiguration('export'))
|
||||
->setKey('cms_version');
|
||||
$this->registerView($export);
|
||||
|
||||
parent::__construct($app, $menu);
|
||||
|
||||
$this->attachRule(new MenuRules($this));
|
||||
$this->attachRule(new StandardRules($this));
|
||||
$this->attachRule(new NomenuRules($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for looks
|
||||
*
|
||||
* @param string $id ID of the looks to retrieve the segments for
|
||||
* @param array $query The request that is built right now
|
||||
*
|
||||
* @return array|string The segments of this item
|
||||
*/
|
||||
public function getLooksSegment($id, $query)
|
||||
{
|
||||
return $this->getLookSegment($id, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for looks
|
||||
*
|
||||
* @param string $segment Segment of the contact to retrieve the ID for
|
||||
* @param array $query The request that is parsed right now
|
||||
*
|
||||
* @return mixed The id of this item or false
|
||||
*/
|
||||
public function getLooksId($segment, $query)
|
||||
{
|
||||
return $this->getLookId($segment, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for a look
|
||||
*
|
||||
* @param string $id ID of the application to retrieve the segments for
|
||||
* @param array $query The request that is built right now
|
||||
*
|
||||
* @return array|string The segments of this item
|
||||
*/
|
||||
public function getLookSegment($id, $query)
|
||||
{
|
||||
if (!strpos($id, ':'))
|
||||
{
|
||||
case 'look':
|
||||
$vars['view'] = 'look';
|
||||
if (is_numeric($segments[$count-1]))
|
||||
{
|
||||
$vars['id'] = (int) $segments[$count-1];
|
||||
}
|
||||
break;
|
||||
case 'looks':
|
||||
$vars['view'] = 'looks';
|
||||
if (is_numeric($segments[$count-1]))
|
||||
{
|
||||
$vars['id'] = (int) $segments[$count-1];
|
||||
}
|
||||
elseif ($segments[$count-1])
|
||||
{
|
||||
$id = $this->getVar('look', $segments[$count-1], 'alias', 'id');
|
||||
if($id)
|
||||
{
|
||||
$vars['id'] = $id;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'looking':
|
||||
$vars['view'] = 'looking';
|
||||
if (is_numeric($segments[$count-1]))
|
||||
{
|
||||
$vars['id'] = (int) $segments[$count-1];
|
||||
}
|
||||
elseif ($segments[$count-1])
|
||||
{
|
||||
$id = $this->getVar('look', $segments[$count-1], 'alias', 'id');
|
||||
if($id)
|
||||
{
|
||||
$vars['id'] = $id;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
protected function getVar($table, $where = null, $whereString = null, $what = null, $category = false, $operator = '=', $main = 'demo')
|
||||
{
|
||||
if(!$where || !$what || !$whereString)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select($db->quoteName(array($what)));
|
||||
if ('categories' == $table || 'category' == $table || $category)
|
||||
{
|
||||
$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
|
||||
{
|
||||
// we must check if the table exist (TODO not ideal)
|
||||
$tables = $db->getTableList();
|
||||
$app = JFactory::getApplication();
|
||||
$prefix = $app->get('dbprefix');
|
||||
$check = $prefix.$main.'_'.$table;
|
||||
if (in_array($check, $tables))
|
||||
{
|
||||
$getTable = '#__'.$main.'_'.$table;
|
||||
$query->from($db->quoteName($getTable));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (is_numeric($where))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif ($this->checkString($where))
|
||||
{
|
||||
// we must first check if this table has the column
|
||||
$columns = $db->getTableColumns($getTable);
|
||||
if (isset($columns[$whereString]))
|
||||
{
|
||||
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function checkString($string)
|
||||
{
|
||||
if (isset($string) && is_string($string) && strlen($string) > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function DemoBuildRoute(&$query)
|
||||
{
|
||||
$router = new DemoRouter;
|
||||
|
||||
return $router->build($query);
|
||||
}
|
||||
|
||||
function DemoParseRoute($segments)
|
||||
{
|
||||
$router = new DemoRouter;
|
||||
|
||||
return $router->parse($segments);
|
||||
$dbquery = $this->db->getQuery(true);
|
||||
$dbquery->select($this->db->quoteName('alias'))
|
||||
->from($this->db->quoteName('#__demo_look'))
|
||||
->where('id = ' . $dbquery->q((int) $id));
|
||||
$this->db->setQuery($dbquery);
|
||||
|
||||
$id .= ':' . $this->db->loadResult();
|
||||
}
|
||||
|
||||
list($void, $segment) = explode(':', $id, 2);
|
||||
|
||||
return array($void => $segment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for an application
|
||||
*
|
||||
* @param string $segment Segment of the application to retrieve the ID for
|
||||
* @param array $query The request that is parsed right now
|
||||
*
|
||||
* @return mixed The id of this item or false
|
||||
*/
|
||||
public function getLookId($segment, $query)
|
||||
{
|
||||
$query = $this->db->getQuery(true);
|
||||
$query->select($this->db->quoteName('id'))
|
||||
->from($this->db->quoteName('#__demo_look'))
|
||||
->where('alias = ' . $this->db->quote($segment));
|
||||
$this->db->setQuery($query);
|
||||
|
||||
return (int) $this->db->loadResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for a looking
|
||||
*
|
||||
* @param string $id ID of the looking to retrieve the segments for
|
||||
* @param array $query The request that is built right now
|
||||
*
|
||||
* @return array|string The segments of this item
|
||||
*/
|
||||
public function getLookingSegment($id, $query)
|
||||
{
|
||||
if (!strpos($id, ':'))
|
||||
{
|
||||
$dbquery = $this->db->getQuery(true);
|
||||
$dbquery->select($this->db->quoteName('alias'))
|
||||
->from($this->db->quoteName('#__demo_look'))
|
||||
->where('id = ' . $dbquery->q((int) $id));
|
||||
$this->db->setQuery($dbquery);
|
||||
|
||||
$id .= ':' . $this->db->loadResult();
|
||||
}
|
||||
|
||||
list($void, $segment) = explode(':', $id, 2);
|
||||
|
||||
return array($void => $segment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the segment(s) for a looking
|
||||
*
|
||||
* @param string $segment Segment of the looking to retrieve the ID for
|
||||
* @param array $query The request that is parsed right now
|
||||
*
|
||||
* @return mixed The id of this item or false
|
||||
*/
|
||||
public function getLookingId($segment, $query)
|
||||
{
|
||||
$dbQuery = $this->db->getQuery(true);
|
||||
$dbQuery->select($this->db->quoteName('id'))
|
||||
->from($this->db->quoteName('#__demo_look'))
|
||||
->where(
|
||||
[
|
||||
$this->db->quoteName('alias') . ' = ' . $this->db->quote($segment),
|
||||
$this->db->quoteName('id') . ' = ' . (int) $query['id'],
|
||||
]
|
||||
);;
|
||||
$this->db->setQuery($dbQuery);
|
||||
|
||||
return (int) $this->db->loadResult();
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +1,37 @@
|
||||
<?php
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.3
|
||||
@build 8th February, 2021
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
//JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidator');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
JHtml::_('behavior.tabstate');
|
||||
JHtml::_('behavior.calendar');
|
||||
?>
|
||||
<div class="demo-look">
|
||||
<?php echo $this->toolbar->render(); ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
//JHtml::_('behavior.tabstate');
|
||||
//JHtml::_('behavior.calendar');
|
||||
?>
|
||||
<div class="demo-look">
|
||||
<?php echo $this->toolbar->render(); ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('look.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
@ -104,8 +104,8 @@ JHtml::_('behavior.calendar');
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<?php echo JLayoutHelper::render('look.details_under', $this); ?>
|
||||
</form>
|
||||
<?php echo JLayoutHelper::render('look.details_under', $this); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -125,4 +125,4 @@ jQuery('#adminForm').on('change', '#jform_add',function (e)
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user