Imporved the field display on admin fields conditions to only show fields linked to the admin view. Added access back to all JCB admin views. Fixed the export of JCB packages to include the new admin_fields and admin_flieds_conditions tables. Adapted the JCB package import method to be able to import old JCB packages
This commit is contained in:
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 15th October, 2017
|
||||
@version @update number 23 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
@subpackage admin_fields.php
|
||||
|
@ -10,7 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 15 of this MVC
|
||||
@version @update number 16 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
|
@ -10,7 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 191 of this MVC
|
||||
@version @update number 192 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
|
@ -10,7 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 191 of this MVC
|
||||
@version @update number 192 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@ -165,6 +165,21 @@ class ComponentbuilderModelAdmin_views extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -216,6 +231,12 @@ class ComponentbuilderModelAdmin_views extends JModelList
|
||||
// From the componentbuilder_admin_view table
|
||||
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 15th October, 2017
|
||||
@version @update number 23 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
@subpackage admins_fields.php
|
||||
@ -156,6 +156,21 @@ class ComponentbuilderModelAdmins_fields extends JModelList
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
|
@ -10,7 +10,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 15 of this MVC
|
||||
@version @update number 16 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
@ -156,6 +156,21 @@ class ComponentbuilderModelAdmins_fields_conditions extends JModelList
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ajax.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage componentbuilder.php
|
||||
|
@ -169,6 +169,21 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -220,6 +235,12 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
|
||||
// From the componentbuilder_custom_admin_view table
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_admin_view', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -254,6 +254,21 @@ class ComponentbuilderModelCustom_codes extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -325,6 +340,12 @@ class ComponentbuilderModelCustom_codes extends JModelList
|
||||
// From the componentbuilder_custom_code table
|
||||
$query->from($db->quoteName('#__componentbuilder_custom_code', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -214,6 +214,21 @@ class ComponentbuilderModelDynamic_gets extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -275,6 +290,12 @@ class ComponentbuilderModelDynamic_gets extends JModelList
|
||||
// From the componentbuilder_dynamic_get table
|
||||
$query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 39 of this MVC
|
||||
@build 14th October, 2017
|
||||
@version @update number 40 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage field.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 39 of this MVC
|
||||
@build 14th October, 2017
|
||||
@version @update number 40 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields.php
|
||||
@ -286,6 +286,21 @@ class ComponentbuilderModelFields extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -384,6 +399,12 @@ class ComponentbuilderModelFields extends JModelList
|
||||
// From the componentbuilder_field table
|
||||
$query->from($db->quoteName('#__componentbuilder_field', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviewfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage adminviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage articles.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage component.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage components.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customadminviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfilelist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage customgets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dbtables.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamicget.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage dynamicgets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fields.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage fieldtypes.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage ftps.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage lang.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage maingets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage matchfield.php
|
||||
@ -160,22 +160,28 @@ class JFormFieldMatchfield extends JFormFieldList
|
||||
if (is_numeric($ID) && $ID >= 1)
|
||||
{
|
||||
// get the admin view ID
|
||||
if ($adminView = ComponentbuilderHelper::getVar('admin_fields_conditions', (int) $ID, 'id', 'admin_view'))
|
||||
$adminView = ComponentbuilderHelper::getVar('admin_fields_conditions', (int) $ID, 'id', 'admin_view');
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the admin view ID
|
||||
$adminView = $jinput->getInt('refid', 0);
|
||||
}
|
||||
if (is_numeric($adminView) && $adminView >= 1)
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
if (ComponentbuilderHelper::checkJson($addFields))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($addFields))
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (ComponentbuilderHelper::checkArray($addFields))
|
||||
{
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (ComponentbuilderHelper::checkArray($addFields))
|
||||
foreach($addFields as $addField)
|
||||
{
|
||||
foreach($addFields as $addField)
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
$fieldIds[] = (int) $addField['field'];
|
||||
}
|
||||
$fieldIds[] = (int) $addField['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviewfolderlist.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage siteviews.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage snippets.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage targetfields.php
|
||||
@ -160,22 +160,28 @@ class JFormFieldTargetfields extends JFormFieldList
|
||||
if (is_numeric($ID) && $ID >= 1)
|
||||
{
|
||||
// get the admin view ID
|
||||
if ($adminView = ComponentbuilderHelper::getVar('admin_fields_conditions', (int) $ID, 'id', 'admin_view'))
|
||||
$adminView = ComponentbuilderHelper::getVar('admin_fields_conditions', (int) $ID, 'id', 'admin_view');
|
||||
}
|
||||
else
|
||||
{
|
||||
// get the admin view ID
|
||||
$adminView = $jinput->getInt('refid', 0);
|
||||
}
|
||||
if (is_numeric($adminView) && $adminView >= 1)
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
{
|
||||
// get all the fields linked to the admin view
|
||||
if ($addFields = ComponentbuilderHelper::getVar('admin_fields', (int) $adminView, 'admin_view', 'addfields'))
|
||||
if (ComponentbuilderHelper::checkJson($addFields))
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($addFields))
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (ComponentbuilderHelper::checkArray($addFields))
|
||||
{
|
||||
$addFields = json_decode($addFields, true);
|
||||
if (ComponentbuilderHelper::checkArray($addFields))
|
||||
foreach($addFields as $addField)
|
||||
{
|
||||
foreach($addFields as $addField)
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
if (isset($addField['field']))
|
||||
{
|
||||
$fieldIds[] = (int) $addField['field'];
|
||||
}
|
||||
$fieldIds[] = (int) $addField['field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage viewtabs.php
|
||||
|
@ -174,6 +174,21 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
$query->where('a.fieldtype = -5');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.published ASC');
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -171,6 +171,21 @@ class ComponentbuilderModelFieldtypes extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -244,6 +259,12 @@ class ComponentbuilderModelFieldtypes extends JModelList
|
||||
// From the componentbuilder_fieldtype table
|
||||
$query->from($db->quoteName('#__componentbuilder_fieldtype', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 22 of this MVC
|
||||
@build 15th October, 2017
|
||||
@version @update number 23 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
@subpackage admin_fields.js
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -9,7 +9,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 15 of this MVC
|
||||
@version @update number 16 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 12th October, 2017
|
||||
@package Component Builder
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -9,7 +9,7 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 191 of this MVC
|
||||
@version @update number 192 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 39 of this MVC
|
||||
@build 14th October, 2017
|
||||
@version @update number 40 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage field.js
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 10 of this MVC
|
||||
@build 24th August, 2017
|
||||
@version @update number 11 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 23rd August, 2017
|
||||
@package Component Builder
|
||||
@subpackage ftp.js
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 412 of this MVC
|
||||
@build 16th October, 2017
|
||||
@version @update number 439 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_component.js
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -57,6 +57,15 @@
|
||||
readonly="true"
|
||||
filter="unset"
|
||||
/>
|
||||
<!-- Access Field. Type: Accesslevel (joomla) -->
|
||||
<field name="access"
|
||||
type="accesslevel"
|
||||
label="JFIELD_ACCESS_LABEL"
|
||||
description="JFIELD_ACCESS_DESC"
|
||||
default="1"
|
||||
|
||||
required="false"
|
||||
/>
|
||||
<!-- Ordering Field. Type: Numbers (joomla) -->
|
||||
<field
|
||||
name="ordering"
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 10 of this MVC
|
||||
@build 24th August, 2017
|
||||
@version @update number 11 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 23rd August, 2017
|
||||
@package Component Builder
|
||||
@subpackage ftp.php
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 10 of this MVC
|
||||
@build 24th August, 2017
|
||||
@version @update number 11 of this MVC
|
||||
@build 16th October, 2017
|
||||
@created 23rd August, 2017
|
||||
@package Component Builder
|
||||
@subpackage ftps.php
|
||||
@ -153,6 +153,21 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -209,6 +224,12 @@ class ComponentbuilderModelFtps extends JModelList
|
||||
// From the componentbuilder_ftp table
|
||||
$query->from($db->quoteName('#__componentbuilder_ftp', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -240,6 +240,21 @@ class ComponentbuilderModelHelp_documents extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -311,6 +326,12 @@ class ComponentbuilderModelHelp_documents extends JModelList
|
||||
// From the componentbuilder_help_document table
|
||||
$query->from($db->quoteName('#__componentbuilder_help_document', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import.php
|
||||
|
@ -11,7 +11,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.5.8
|
||||
@build 16th October, 2017
|
||||
@build 18th October, 2017
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage import_joomla_components.php
|
||||
@ -81,15 +81,16 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
|
||||
protected $app;
|
||||
protected $target = false;
|
||||
protected $newID = array();
|
||||
protected $forceUpdate = 0;
|
||||
protected $hasKey = 0;
|
||||
protected $sleutle = null;
|
||||
protected $updateAfter = array('field' => array(), 'adminview' => array());
|
||||
protected $fieldTypes = array();
|
||||
protected $isMultiple = array();
|
||||
protected $specialValue = false;
|
||||
protected $target = false;
|
||||
protected $newID = array();
|
||||
protected $forceUpdate = 0;
|
||||
protected $hasKey = 0;
|
||||
protected $sleutle = null;
|
||||
protected $updateAfter = array('field' => array(), 'adminview' => array());
|
||||
protected $divergedDataMover = array();
|
||||
protected $fieldTypes = array();
|
||||
protected $isMultiple = array();
|
||||
protected $specialValue = false;
|
||||
|
||||
/**
|
||||
* Import an spreadsheet from either folder, url or upload.
|
||||
@ -716,6 +717,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
// do a after all run on all items that need it
|
||||
$this->updateAfter();
|
||||
// finally move the old datasets
|
||||
$this->moveDivergedData();
|
||||
// lets move all the files to its correct location
|
||||
if (!$this->moveSmartStuff($dir))
|
||||
{
|
||||
@ -991,31 +994,53 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
// get the field from db
|
||||
if ($addlinked_views = ComponentbuilderHelper::getVar('admin_view', $adminview, 'id', 'addlinked_views'))
|
||||
{
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($addlinked_views))
|
||||
{
|
||||
$addlinked_views = json_decode($addlinked_views, true);
|
||||
if (ComponentbuilderHelper::checkArray($addlinked_views['adminview']))
|
||||
// convert Repetable Fields
|
||||
if (ComponentbuilderHelper::checkArray($addlinked_views) && isset($addlinked_views['adminview']))
|
||||
{
|
||||
foreach ($addlinked_views['adminview'] as $nr => $admin)
|
||||
{
|
||||
if (isset($this->newID['admin_view'][$admin]))
|
||||
{
|
||||
$addlinked_views['adminview'][$nr] = $this->newID['admin_view'][$admin];
|
||||
}
|
||||
else
|
||||
{
|
||||
$addlinked_views['adminview'][$nr] = '';
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BLINKED_VIEWB_IDS_MISMATCH_IN_BADMIN_VIEWSB_AND_WAS_EMREMOVEDEM_FROM_THE_LINKED_VIEWS', $admin, $adminview), 'warning');
|
||||
}
|
||||
}
|
||||
// update the fields
|
||||
$object = new stdClass;
|
||||
$object->id = $adminview;
|
||||
$object->addlinked_views = json_encode($addlinked_views);
|
||||
// update the admin view
|
||||
$this->_db->updateObject('#__componentbuilder_admin_view', $object, 'id');
|
||||
$addlinked_views = $this->convertRepeatable($addlinked_views, 'addlinked_views');
|
||||
}
|
||||
// update the view IDs
|
||||
if (ComponentbuilderHelper::checkArray($addlinked_views))
|
||||
{
|
||||
// only update the view IDs
|
||||
$addlinked_views = $this->updateSubformIDs($addlinked_views, 'admin_view', array('adminview' => 'admin_view'));
|
||||
}
|
||||
// update the fields
|
||||
$object = new stdClass;
|
||||
$object->id = $adminview;
|
||||
$object->addlinked_views = json_encode($addlinked_views);
|
||||
// update the admin view
|
||||
$this->_db->updateObject('#__componentbuilder_admin_view', $object, 'id');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moving of diverged data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
**/
|
||||
protected function moveDivergedData()
|
||||
{
|
||||
// check if there is data to move
|
||||
if (ComponentbuilderHelper::checkArray($this->divergedDataMover))
|
||||
{
|
||||
foreach($this->divergedDataMover as $table => $values)
|
||||
{
|
||||
foreach($values as $value)
|
||||
{
|
||||
// first check if exist (only add if it does not)
|
||||
if (!$this->getLocalItem($value, $table, 1))
|
||||
{
|
||||
// add the diverged data
|
||||
$this->addLocalItem($value, $table);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1025,8 +1050,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
/*
|
||||
* Convert repeatable field to subform
|
||||
*
|
||||
* @param array $array The array
|
||||
* @param string $name The main field name
|
||||
* @param array $array The array to convert
|
||||
* @param string $name The main field name
|
||||
* @param array $updater The updater (dynamic) option
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -1047,6 +1073,138 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert repeatable field to subform
|
||||
*
|
||||
* @param object $item The item to update
|
||||
* @param json $updater The fields to check and update
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function convertRepeatableFields(&$item, $updater)
|
||||
{
|
||||
// update the repeatable fields
|
||||
foreach ($updater as $up => $sleutel)
|
||||
{
|
||||
if (isset($item->{$up}) && ComponentbuilderHelper::checkJson($item->{$up}))
|
||||
{
|
||||
$updateArray = json_decode($item->{$up}, true);
|
||||
// check if this is old values for repeatable fields
|
||||
if (ComponentbuilderHelper::checkArray($updateArray) && isset($updateArray[$sleutel]))
|
||||
{
|
||||
// load it back
|
||||
$item->{$up} = json_encode($this->convertRepeatable($updateArray, $up));
|
||||
}
|
||||
}
|
||||
elseif (isset($item->{$up}))
|
||||
{
|
||||
unset($item->{$up});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Many Subform IDs
|
||||
*
|
||||
* @param array $values The values to update the IDs in
|
||||
* @param string $table The table these values belong to
|
||||
* @param array $targets The target to update and its type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function updateSubformsIDs(&$item, $table, $targets)
|
||||
{
|
||||
// update the repeatable fields
|
||||
foreach ($targets as $field => $targetArray)
|
||||
{
|
||||
if (isset($item->{$field}) && ComponentbuilderHelper::checkJson($item->{$field}))
|
||||
{
|
||||
$updateArray = json_decode($item->{$field}, true);
|
||||
if (ComponentbuilderHelper::checkArray($updateArray))
|
||||
{
|
||||
// load it back
|
||||
$item->{$field} = json_encode($this->updateSubformIDs($updateArray, $table, $targetArray));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update One Subform IDs
|
||||
*
|
||||
* @param array $values The values to update the IDs in
|
||||
* @param string $table The table these values belong to
|
||||
* @param array $targets The target to update and its type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function updateSubformIDs($values, $table, $targets)
|
||||
{
|
||||
$isJson = false;
|
||||
if (ComponentbuilderHelper::checkJson($values))
|
||||
{
|
||||
$values = json_decode($values, true);
|
||||
$isJson = true;
|
||||
}
|
||||
// now update the fields
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
foreach ($values as $nr => &$value)
|
||||
{
|
||||
foreach ($targets as $target => $target_type)
|
||||
{
|
||||
if (isset($value[$target]))
|
||||
{
|
||||
// update the target
|
||||
if (!ComponentbuilderHelper::checkArray($value[$target]))
|
||||
{
|
||||
if (isset($this->newID[$target_type][$value[$target]]))
|
||||
{
|
||||
$value[$target] = $this->newID[$target_type][$value[$target]];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_SO_THE_IDS_WAS_REMOVED', ComponentbuilderHelper::safeString($target_type, 'Ww') . '->' . ComponentbuilderHelper::safeString($target, 'Ww') .' in ('.ComponentbuilderHelper::safeString($table, 'w').':'.$item->id.')', $value[$target]), 'warning');
|
||||
$value[$target] = '';
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($value[$target]))
|
||||
{
|
||||
// the bucket to load the items back
|
||||
$bucket = array();
|
||||
foreach ($value[$target] as $id)
|
||||
{
|
||||
if (!is_numeric($id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (isset($this->newID[$target_type][$id]))
|
||||
{
|
||||
$bucket[] = $this->newID[$target_type][$id];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_SO_THE_IDS_WAS_REMOVED', ComponentbuilderHelper::safeString($target_type, 'Ww') . '->' . ComponentbuilderHelper::safeString($target, 'Ww') .' in ('.ComponentbuilderHelper::safeString($table, 'w').':'.$item->id.')', $id), 'warning');
|
||||
$bucket[] = '';
|
||||
}
|
||||
}
|
||||
// set ids back
|
||||
if (ComponentbuilderHelper::checkArray($bucket))
|
||||
{
|
||||
$value[$target] = $bucket;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($isJson)
|
||||
{
|
||||
return json_encode($values);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prep the item
|
||||
*
|
||||
@ -1076,6 +1234,15 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// do the id fix for the new ids
|
||||
switch($type)
|
||||
{
|
||||
case 'fieldtype':
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'properties' => 'name'
|
||||
);
|
||||
// update the repeatable fields
|
||||
$this->convertRepeatableFields($item, $updaterR);
|
||||
break;
|
||||
case 'field':
|
||||
// update the fieldtype
|
||||
if (isset($item->fieldtype) && is_numeric($item->fieldtype) && $item->fieldtype > 0 && isset($this->newID['fieldtype'][$item->fieldtype]))
|
||||
@ -1112,42 +1279,10 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// update the join_view_table
|
||||
if (isset($item->join_view_table) && ComponentbuilderHelper::checkJson($item->join_view_table))
|
||||
{
|
||||
$join_view_table = json_decode($item->join_view_table, true);
|
||||
// check if this is old values for repeatable fields
|
||||
if (isset($join_view_table['view_table']))
|
||||
{
|
||||
$join_view_table = $this->convertRepeatable($join_view_table, 'join_view_table');
|
||||
}
|
||||
foreach ($join_view_table as $nr => $join_values)
|
||||
{
|
||||
$id = $join_values['view_table'];
|
||||
if (!is_numeric($id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// update the id's with local id's
|
||||
if (isset($this->newID['admin_view'][$id]))
|
||||
{
|
||||
$join_view_table[$nr]['view_table'] = $this->newID['admin_view'][$id];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BJOIN_VIEW_TABLE_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BJOIN_VIEW_TABLEB_SO_THE_IDS_WAS_REMOVED', '('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $id), 'warning');
|
||||
$join_values['view_table'] = '';
|
||||
}
|
||||
}
|
||||
// load it back
|
||||
$item->join_view_table = json_encode($join_view_table);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($item->join_view_table);
|
||||
}
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'join_view_table' => 'view_table',
|
||||
'join_db_table' => 'db_table',
|
||||
'order' => 'table_key',
|
||||
'where' => 'table_key',
|
||||
@ -1155,24 +1290,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
'filter' => 'filter_type'
|
||||
);
|
||||
// update the repeatable fields
|
||||
foreach ($updaterR as $up => $sleutel)
|
||||
{
|
||||
if (isset($item->{$up}) && ComponentbuilderHelper::checkJson($item->{$up}))
|
||||
{
|
||||
$updateArray = json_decode($item->{$up}, true);
|
||||
// check if this is old values for repeatable fields
|
||||
if (isset($updateArray[$sleutel]))
|
||||
{
|
||||
$updateArray = $this->convertRepeatable($updateArray, $up);
|
||||
// load it back
|
||||
$item->{$up} = json_encode($updateArray);
|
||||
}
|
||||
}
|
||||
elseif (isset($item->{$up}))
|
||||
{
|
||||
unset($item->{$up});
|
||||
}
|
||||
}
|
||||
$this->convertRepeatableFields($item, $updaterR);
|
||||
// subform fields to target
|
||||
$updaterT = array(
|
||||
// subformfield => field => type_value
|
||||
'join_view_table' => array('view_table' => 'admin_view')
|
||||
);
|
||||
// update the subform ids
|
||||
$this->updateSubformsIDs($item, 'dynamic_get', $updaterT);
|
||||
break;
|
||||
case 'layout':
|
||||
case 'template':
|
||||
@ -1287,28 +1412,12 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'ajax_input' => 'value_name',
|
||||
'custom_button' => 'name'
|
||||
);
|
||||
// update the repeatable fields
|
||||
foreach ($updaterR as $up => $sleutel)
|
||||
{
|
||||
if (isset($item->{$up}) && ComponentbuilderHelper::checkJson($item->{$up}))
|
||||
{
|
||||
$updateArray = json_decode($item->{$up}, true);
|
||||
// check if this is old values for repeatable fields
|
||||
if (isset($updateArray[$sleutel]))
|
||||
{
|
||||
$updateArray = $this->convertRepeatable($updateArray, $up);
|
||||
// load it back
|
||||
$item->{$up} = json_encode($updateArray);
|
||||
}
|
||||
}
|
||||
elseif (isset($item->{$up}))
|
||||
{
|
||||
unset($item->{$up});
|
||||
}
|
||||
}
|
||||
// update the repeatable fields
|
||||
$this->convertRepeatableFields($item, $updaterR);
|
||||
break;
|
||||
case 'admin_view':
|
||||
// we must clear the demo content (since it was not moved as far as we know) TODO
|
||||
@ -1322,16 +1431,14 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// update the addfields (old dataset)
|
||||
if (isset($item->addfields) && ComponentbuilderHelper::checkJson($item->addfields))
|
||||
{
|
||||
// set the targets
|
||||
$targets = array('field' => 'field');
|
||||
// set the anchors
|
||||
$anchor = array('admin_view' => $item->id);
|
||||
// set the anchors getters
|
||||
$getter = array('admin_view' => $item->id);
|
||||
// move the old data
|
||||
$this->moveData($item->addfields, 'admin_fields', 'addfields', 'target_field', $targets, $anchor);
|
||||
$this->setDivergedDataMover($item->addfields, 'admin_fields', 'addfields', $getter);
|
||||
// remove from this dataset
|
||||
unset($item->addfields);
|
||||
}
|
||||
else
|
||||
elseif (isset($item->addfields))
|
||||
{
|
||||
unset($item->addfields);
|
||||
}
|
||||
@ -1340,28 +1447,27 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
{
|
||||
$this->updateAfter['adminview'][$item->id] = $item->id; // addlinked_views
|
||||
}
|
||||
else
|
||||
elseif (isset($item->addlinked_views))
|
||||
{
|
||||
unset($item->addlinked_views);
|
||||
}
|
||||
// update the addconditions (old dataset)
|
||||
if (isset($item->addconditions))
|
||||
if (isset($item->addconditions) && ComponentbuilderHelper::checkJson($item->addconditions))
|
||||
{
|
||||
// set the targets
|
||||
$targets = array('target_field' => 'field', 'match_field' => 'field');
|
||||
// set the anchors
|
||||
$anchor = array('admin_view' => $item->id);
|
||||
// set the getters anchors
|
||||
$getter = array('admin_view' => $item->id);
|
||||
// move the old data
|
||||
$this->moveData($item->addconditions, 'admin_fields_conditions', 'addconditions', 'target_field', $targets, $anchor);
|
||||
$this->setDivergedDataMover($item->addconditions, 'admin_fields_conditions', 'addconditions', $getter);
|
||||
// remove from this dataset
|
||||
unset($item->addconditions);
|
||||
}
|
||||
else
|
||||
elseif (isset($item->addconditions))
|
||||
{
|
||||
unset($item->addconditions);
|
||||
}
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'ajax_input' => 'value_name',
|
||||
'custom_button' => 'name',
|
||||
'addtables' => 'table',
|
||||
@ -1370,24 +1476,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
'addpermissions' => 'action'
|
||||
);
|
||||
// update the repeatable fields
|
||||
foreach ($updaterR as $up => $sleutel)
|
||||
{
|
||||
if (isset($item->{$up}) && ComponentbuilderHelper::checkJson($item->{$up}))
|
||||
{
|
||||
$updateArray = json_decode($item->{$up}, true);
|
||||
// check if this is old values for repeatable fields
|
||||
if (isset($updateArray[$sleutel]))
|
||||
{
|
||||
$updateArray = $this->convertRepeatable($updateArray, $up);
|
||||
// load it back
|
||||
$item->{$up} = json_encode($updateArray);
|
||||
}
|
||||
}
|
||||
elseif (isset($item->{$up}))
|
||||
{
|
||||
unset($item->{$up});
|
||||
}
|
||||
}
|
||||
$this->convertRepeatableFields($item, $updaterR);
|
||||
break;
|
||||
case 'joomla_component':
|
||||
// update the addconfig
|
||||
@ -1633,6 +1722,58 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
unset($item->localTranslation);
|
||||
}
|
||||
break;
|
||||
case 'admin_fields':
|
||||
case 'admin_fields_conditions':
|
||||
// update the admin_view ID where needed
|
||||
if (isset($item->admin_view) && $item->admin_view > 0)
|
||||
{
|
||||
if (isset($this->newID['admin_view'][$item->admin_view]))
|
||||
{
|
||||
$item->admin_view = $this->newID['admin_view'][$item->admin_view];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BFIELD_IN_SB_HAS_ID_MISMATCH_OF_SELECTED_BADMIN_VIEWB_SO_THE_IDS_WAS_REMOVED', '('.ComponentbuilderHelper::safeString($type, 'w').':'.$item->id.')', $item->admin_view), 'warning');
|
||||
unset($item->admin_view);
|
||||
}
|
||||
}
|
||||
if ('admin_fields' === $type)
|
||||
{
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'addfields' => 'field'
|
||||
);
|
||||
// subform fields to target
|
||||
$updaterT = array(
|
||||
// subformfield => field => type_value
|
||||
'addfields' => array('field' => 'field')
|
||||
);
|
||||
// little tweak... oops
|
||||
if (isset($item->addconditions))
|
||||
{
|
||||
unset($item->addconditions);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// repeatable fields to update
|
||||
$updaterR = array(
|
||||
// repeatablefield => checker
|
||||
'addconditions' => 'target_field'
|
||||
);
|
||||
// subform fields to target
|
||||
$updaterT = array(
|
||||
// subformfield => field => type_value
|
||||
'addconditions' => array('target_field' => 'field', 'match_field' => 'field')
|
||||
);
|
||||
}
|
||||
|
||||
// update the repeatable fields
|
||||
$this->convertRepeatableFields($item, $updaterR);
|
||||
|
||||
// update the subform ids
|
||||
$this->updateSubformsIDs($item, $type, $updaterT);
|
||||
}
|
||||
// final action prep
|
||||
switch($action)
|
||||
@ -1662,6 +1803,45 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data that should be moved
|
||||
*
|
||||
* @param array/json $values The values/data to move
|
||||
* @param string $table The table to move the values to
|
||||
* @param string $type The type of values
|
||||
* @param array $getters The get values used to anchor the values to the new table
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function setDivergedDataMover($values, $table, $type, $getters)
|
||||
{
|
||||
// we need to move this to the new $table based on anchors
|
||||
if (ComponentbuilderHelper::checkArray($getters))
|
||||
{
|
||||
if (!isset($this->divergedDataMover[$table]))
|
||||
{
|
||||
$this->divergedDataMover[$table] = array();
|
||||
}
|
||||
// set unique key
|
||||
$uniqueKey = md5(serialize($getters));
|
||||
if (!isset($this->divergedDataMover[$table][$uniqueKey]))
|
||||
{
|
||||
$this->divergedDataMover[$table][$uniqueKey] = new stdClass;
|
||||
foreach ($getters as $name => $value)
|
||||
{
|
||||
$this->divergedDataMover[$table][$uniqueKey]->{$name} = $value;
|
||||
}
|
||||
}
|
||||
// add the data to the mover
|
||||
$this->divergedDataMover[$table][$uniqueKey]->{$type} = $values;
|
||||
// success
|
||||
return true;
|
||||
}
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB', ComponentbuilderHelper::safeString($type, 'Ww') . ' to ('.ComponentbuilderHelper::safeString($table, 'w').')'), 'warning');
|
||||
// failure
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a field has multiple fields
|
||||
*
|
||||
@ -1691,116 +1871,6 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move old repeatable field to new subform field, and new table
|
||||
*
|
||||
* @param array/json $values The values to move
|
||||
* @param string $table The table to move the values to
|
||||
* @param string $type The type of values
|
||||
* @param string $checker The key to check if this is a repeatable field
|
||||
* @param array $targets The target to update and its type
|
||||
* @param array $anchor The fields to use in anchoring to the new table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function moveData($values, $table, $type, $checker, $targets, $anchor)
|
||||
{
|
||||
if (ComponentbuilderHelper::checkJson($values))
|
||||
{
|
||||
$values = json_decode($values, true);
|
||||
}
|
||||
// check if this is old values for repeatable fields
|
||||
if (ComponentbuilderHelper::checkArray($values) && isset($values[$checker]))
|
||||
{
|
||||
$values = $this->convertRepeatable($values, $type);
|
||||
}
|
||||
// now update the fields
|
||||
if (ComponentbuilderHelper::checkArray($values))
|
||||
{
|
||||
foreach ($values as $nr => &$value)
|
||||
{
|
||||
foreach ($targets as $target => $target_type)
|
||||
{
|
||||
if (isset($value[$target]))
|
||||
{
|
||||
// update the target
|
||||
if (!ComponentbuilderHelper::checkArray($value[$target]))
|
||||
{
|
||||
if (isset($this->newID[$target_type][$value[$target]]))
|
||||
{
|
||||
$value[$target] = $this->newID[$target_type][$value[$target]];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_SO_THE_IDS_WAS_REMOVED', ComponentbuilderHelper::safeString($target_type, 'Ww') . '->' . ComponentbuilderHelper::safeString($target, 'Ww') .' in ('.ComponentbuilderHelper::safeString($table, 'w').':'.$item->id.')', $value[$target]), 'warning');
|
||||
$value[$target] = '';
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($value[$target]))
|
||||
{
|
||||
// the bucket to load the items back
|
||||
$bucket = array();
|
||||
foreach ($value[$target] as $id)
|
||||
{
|
||||
if (!is_numeric($id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (isset($this->newID[$target_type][$id]))
|
||||
{
|
||||
$bucket[] = $this->newID[$target_type][$id];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_BSB_HAS_ID_MISMATCH_SO_THE_IDS_WAS_REMOVED', ComponentbuilderHelper::safeString($target_type, 'Ww') . '->' . ComponentbuilderHelper::safeString($target, 'Ww') .' in ('.ComponentbuilderHelper::safeString($table, 'w').':'.$item->id.')', $id), 'warning');
|
||||
$bucket[] = '';
|
||||
}
|
||||
}
|
||||
// set ids back
|
||||
if (ComponentbuilderHelper::checkArray($bucket))
|
||||
{
|
||||
$value[$target] = $bucket;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// we need to move this to the new $table based on anchors
|
||||
if (ComponentbuilderHelper::checkArray($anchor))
|
||||
{
|
||||
$anchorArray = array();
|
||||
foreach ($anchor as $name => $id)
|
||||
{
|
||||
$updated = false;
|
||||
if (isset($this->newID[$name]) && isset($this->newID[$name][$id]))
|
||||
{
|
||||
$id = $this->newID[$name][$id];
|
||||
$updated = true;
|
||||
}
|
||||
// set the values
|
||||
$anchorArray[$name] = array('value' => $id, 'updated' => $updated);
|
||||
}
|
||||
if (!isset($this->dataMover[$table]))
|
||||
{
|
||||
$this->dataMover[$table] = array();
|
||||
}
|
||||
// set unique key
|
||||
$uniqueKey = md5(serialize($anchorArray));
|
||||
if (!isset($this->dataMover[$table][$uniqueKey]))
|
||||
{
|
||||
$this->dataMover[$table][$uniqueKey] = array();
|
||||
$this->dataMover[$table][$uniqueKey]['<(--AnCh0r'] = $anchorArray;
|
||||
}
|
||||
// add the data to the mover
|
||||
$this->dataMover[$table][$uniqueKey][$type] = json_encode($values);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_WE_FAILED_TO_MOVE_BSB', ComponentbuilderHelper::safeString($type, 'Ww') . ' to ('.ComponentbuilderHelper::safeString($table, 'w').')'), 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field type
|
||||
*
|
||||
@ -1925,19 +1995,22 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$query = $this->_db->getQuery(true);
|
||||
$query->select('a.*');
|
||||
$query->from($this->_db->quoteName('#__componentbuilder_' . $type, 'a'));
|
||||
if ($get == 1)
|
||||
// only run query if where is set
|
||||
$runQuery = false;
|
||||
if ($get == 1 && isset($item->created) && isset($item->id))
|
||||
{
|
||||
$query->where($this->_db->quoteName('a.created') . ' = '. $this->_db->quote($item->created));
|
||||
$query->where($this->_db->quoteName('a.id') .' = '. (int) $item->id);
|
||||
$runQuery = true;
|
||||
}
|
||||
elseif (componentbuilderHelper::checkArray($get))
|
||||
{
|
||||
foreach ($get as $field)
|
||||
{
|
||||
if (isset($item->$field))
|
||||
if (isset($item->{$field}))
|
||||
{
|
||||
// set the value
|
||||
$value = $item->$field;
|
||||
$value = $item->{$field};
|
||||
// check if we have special value
|
||||
if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$field]))
|
||||
{
|
||||
@ -1960,6 +2033,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$runQuery = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1967,21 +2041,22 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($item->$get) && componentbuilderHelper::checkString($item->$get)) // do not allow empty strings (since it could be major mis match)
|
||||
elseif (isset($item->{$get}) && componentbuilderHelper::checkString($item->{$get})) // do not allow empty strings (since it could be major mis match)
|
||||
{
|
||||
// set the value
|
||||
$value = $item->$get;
|
||||
$value = $item->{$get};
|
||||
// check if we have special value
|
||||
if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$get]))
|
||||
{
|
||||
$value = $this->specialValue[$get];
|
||||
}
|
||||
$query->where($this->_db->quoteName('a.' . $get) . ' = '. $this->_db->quote($value));
|
||||
$runQuery = true;
|
||||
}
|
||||
elseif (isset($item->$get) && is_numeric($item->$get))
|
||||
elseif (isset($item->{$get}) && is_numeric($item->{$get}))
|
||||
{
|
||||
// set the value
|
||||
$value = $item->$get;
|
||||
$value = $item->{$get};
|
||||
// check if we have special value
|
||||
if ($this->specialValue && ComponentbuilderHelper::checkArray($this->specialValue) && isset($this->specialValue[$get]))
|
||||
{
|
||||
@ -2000,19 +2075,21 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
{
|
||||
return false; // really not needed but who knows for sure...
|
||||
}
|
||||
$runQuery = true;
|
||||
}
|
||||
else
|
||||
// since where has been set run the query
|
||||
if ($runQuery)
|
||||
{
|
||||
return false;
|
||||
// see if we get an item
|
||||
$this->_db->setQuery($query);
|
||||
$this->_db->execute();
|
||||
if ($this->_db->getNumRows())
|
||||
{
|
||||
return $this->_db->loadObject();
|
||||
}
|
||||
}
|
||||
// see if we get an item
|
||||
$this->_db->setQuery($query);
|
||||
$this->_db->execute();
|
||||
if ($this->_db->getNumRows())
|
||||
{
|
||||
return $this->_db->loadObject();
|
||||
}
|
||||
elseif ($retry)
|
||||
// retry to get the item
|
||||
if ($retry)
|
||||
{
|
||||
$retryAgain = false;
|
||||
$this->specialValue = false;
|
||||
@ -2022,12 +2099,9 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
case 'admin_fields':
|
||||
case 'admin_fields_conditions':
|
||||
// get by admin_view (since there should only be one of each name)
|
||||
$getter = 'admin_view';
|
||||
// update the admin_view with the local ID
|
||||
if (isset($this->newID[$getter]) && isset($this->newID[$getter][$item->admin_view]))
|
||||
{
|
||||
$item->{$getter} = (int) $this->newID[$getter][$item->{$getter}];
|
||||
}
|
||||
$getter = array('admin_view');
|
||||
$this->specialValue = array();
|
||||
$this->specialValue['admin_view'] = $this->newID['admin_view'][$item->admin_view];
|
||||
break;
|
||||
case 'fieldtype':
|
||||
// get by name (since there should only be one of each name)
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 412 of this MVC
|
||||
@build 16th October, 2017
|
||||
@version @update number 439 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_component.php
|
||||
@ -241,6 +241,21 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
// From the componentbuilder_admin_view table
|
||||
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.published ASC');
|
||||
$query->order('a.ordering ASC');
|
||||
@ -322,6 +337,21 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
$query->select($db->quoteName('g.name','snippet_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.published ASC');
|
||||
$query->order('a.ordering ASC');
|
||||
@ -403,6 +433,21 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
$query->select($db->quoteName('g.name','snippet_name'));
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet', 'g') . ' ON (' . $db->quoteName('a.snippet') . ' = ' . $db->quoteName('g.id') . ')');
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.published ASC');
|
||||
$query->order('a.ordering ASC');
|
||||
@ -480,6 +525,21 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
// From the componentbuilder_language_translation table
|
||||
$query->from($db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.published ASC');
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -10,8 +10,8 @@
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version @update number 412 of this MVC
|
||||
@build 16th October, 2017
|
||||
@version @update number 439 of this MVC
|
||||
@build 18th October, 2017
|
||||
@created 6th May, 2015
|
||||
@package Component Builder
|
||||
@subpackage joomla_components.php
|
||||
|
@ -195,6 +195,21 @@ class ComponentbuilderModelLanguage_translations extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -246,6 +261,12 @@ class ComponentbuilderModelLanguage_translations extends JModelList
|
||||
// From the componentbuilder_language_translation table
|
||||
$query->from($db->quoteName('#__componentbuilder_language_translation', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -157,6 +157,21 @@ class ComponentbuilderModelLanguages extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -208,6 +223,12 @@ class ComponentbuilderModelLanguages extends JModelList
|
||||
// From the componentbuilder_language table
|
||||
$query->from($db->quoteName('#__componentbuilder_language', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -169,6 +169,21 @@ class ComponentbuilderModelLayouts extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -225,6 +240,12 @@ class ComponentbuilderModelLayouts extends JModelList
|
||||
// From the componentbuilder_layout table
|
||||
$query->from($db->quoteName('#__componentbuilder_layout', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -169,6 +169,21 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -220,6 +235,12 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
// From the componentbuilder_site_view table
|
||||
$query->from($db->quoteName('#__componentbuilder_site_view', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -203,6 +203,21 @@ class ComponentbuilderModelSnippets extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -259,6 +274,12 @@ class ComponentbuilderModelSnippets extends JModelList
|
||||
// From the componentbuilder_snippet table
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
@ -165,6 +165,21 @@ class ComponentbuilderModelTemplates extends JModelList
|
||||
{
|
||||
$query->where('(a.published = 0 OR a.published = 1)');
|
||||
}
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level');
|
||||
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
}
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
// Filter by search.
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
@ -216,6 +231,12 @@ class ComponentbuilderModelTemplates extends JModelList
|
||||
// From the componentbuilder_template table
|
||||
$query->from($db->quoteName('#__componentbuilder_template', 'a'));
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
Reference in New Issue
Block a user