Added module area target client switch. Added the custom code placeholder search to modules. Improved the JCB backup feature to only move the zip package to the backup location.

This commit is contained in:
2020-03-13 04:45:08 +02:00
parent aae9ffb6e0
commit 86f671c87c
17 changed files with 403 additions and 181 deletions

View File

@ -101,6 +101,9 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_modules&task=joomla_m
<?php endforeach; ?>
</div>
</td>
<td class="hidden-phone">
<?php echo JText::_($item->target); ?>
</td>
<td class="hidden-phone">
<?php echo $this->escape($item->description); ?>
</td>

View File

@ -14,5 +14,5 @@ defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="6"><?php echo $this->pagination->getListFooter(); ?></td>
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>

View File

@ -32,6 +32,9 @@ defined('_JEXEC') or die('Restricted access');
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_JOOMLA_MODULE_SYSTEM_NAME_LABEL', 'system_name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL'); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_LABEL', 'description', $this->listDirn, $this->listOrder); ?>
</th>

View File

@ -184,6 +184,36 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
// Set Target Selection
$this->targetOptions = $this->getTheTargetSelections();
// We do some sanitation for Target filter
if (ComponentbuilderHelper::checkArray($this->targetOptions) &&
isset($this->targetOptions[0]->value) &&
!ComponentbuilderHelper::checkString($this->targetOptions[0]->value))
{
unset($this->targetOptions[0]);
}
// Only load Target filter if it has values
if (ComponentbuilderHelper::checkArray($this->targetOptions))
{
// Target Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL').' -',
'filter_target',
JHtml::_('select.options', $this->targetOptions, 'value', 'text', $this->state->get('filter.target'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Target Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_TARGET_LABEL').' -',
'batch[target]',
JHtml::_('select.options', $this->targetOptions, 'value', 'text')
);
}
}
}
@ -234,5 +264,41 @@ class ComponentbuilderViewJoomla_modules extends JViewLegacy
'a.description' => JText::_('COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
protected function getTheTargetSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('target'));
$query->from($db->quoteName('#__componentbuilder_joomla_module'));
$query->order($db->quoteName('target') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $target)
{
// Translate the target selection
$text = $model->selectionTranslation($target,'target');
// Now add the target and its text to the options array
$_filter[] = JHtml::_('select.option', $target, JText::_($text));
}
return $_filter;
}
return false;
}
}