2017-04-03 10:58:41 +00:00
|
|
|
<?php
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2024-03-09 19:52:51 +00:00
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
|
|
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
2023-10-18 07:26:30 +00:00
|
|
|
use VDM\Joomla\Utilities\JsonHelper;
|
|
|
|
use VDM\Joomla\Utilities\ArrayHelper;
|
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
2021-03-05 03:08:47 +00:00
|
|
|
|
2024-03-09 19:52:51 +00:00
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
$edit = "index.php?option=com_componentbuilder&view=language_translations&task=language_translation.edit";
|
|
|
|
|
|
|
|
?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php foreach ($this->items as $i => $item): ?>
|
|
|
|
<?php
|
|
|
|
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
|
2024-03-09 19:52:51 +00:00
|
|
|
$userChkOut = Factory::getContainer()->
|
|
|
|
get(\Joomla\CMS\User\UserFactoryInterface::class)->
|
|
|
|
loadUserById($item->checked_out);
|
2017-04-05 13:21:10 +00:00
|
|
|
$canDo = ComponentbuilderHelper::getActions('language_translation',$item,'language_translations');
|
2017-04-03 10:58:41 +00:00
|
|
|
?>
|
|
|
|
<tr class="row<?php echo $i % 2; ?>">
|
|
|
|
<td class="order nowrap center hidden-phone">
|
2017-04-05 13:21:10 +00:00
|
|
|
<?php if ($canDo->get('language_translation.edit.state')): ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php
|
2020-11-26 17:33:39 +00:00
|
|
|
$iconClass = '';
|
|
|
|
if (!$this->saveOrder)
|
2017-04-03 10:58:41 +00:00
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$iconClass = ' inactive tip-top" hasTooltip" title="' . Html::tooltipText('JORDERINGDISABLED');
|
2017-04-03 10:58:41 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<span class="sortable-handler<?php echo $iconClass; ?>">
|
|
|
|
<i class="icon-menu"></i>
|
|
|
|
</span>
|
|
|
|
<?php if ($this->saveOrder) : ?>
|
|
|
|
<input type="text" style="display:none" name="order[]" size="5"
|
|
|
|
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
|
|
|
⋮
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
<td class="nowrap center">
|
2017-04-05 13:21:10 +00:00
|
|
|
<?php if ($canDo->get('language_translation.edit')): ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php if ($item->checked_out) : ?>
|
|
|
|
<?php if ($canCheckin) : ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php else: ?>
|
|
|
|
□
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('grid.id', $i, $item->id); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
|
|
|
□
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
<td class="nowrap">
|
2020-03-24 01:11:43 +00:00
|
|
|
<div>
|
|
|
|
<?php if ($canDo->get('language_translation.edit')): ?>
|
|
|
|
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $item->source; ?></a>
|
|
|
|
<?php if ($item->checked_out): ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'language_translations.', $canCheckin); ?>
|
2018-05-24 13:56:56 +00:00
|
|
|
<?php endif; ?>
|
2020-03-24 01:11:43 +00:00
|
|
|
<?php else: ?>
|
|
|
|
<?php echo $item->source; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
|
|
$langBucket = array();
|
2023-10-18 07:26:30 +00:00
|
|
|
if (JsonHelper::check($item->translation))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
$translations = json_decode($item->translation, true);
|
2023-10-18 07:26:30 +00:00
|
|
|
if (ArrayHelper::check($translations))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
foreach ($translations as $language)
|
|
|
|
{
|
2023-10-18 07:26:30 +00:00
|
|
|
if (isset($language['translation']) && StringHelper::check($language['translation'])
|
|
|
|
&& isset($language['language']) && StringHelper::check($language['language']))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
$langBucket[$language['language']] = $language['language'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// start how many usedin's
|
|
|
|
$counterUsedin = array();
|
|
|
|
// set how many components use this string
|
2023-10-18 07:26:30 +00:00
|
|
|
if (JsonHelper::check($item->components))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
$item->components = json_decode($item->components, true);
|
|
|
|
}
|
2023-10-18 07:26:30 +00:00
|
|
|
if (($number = ArrayHelper::check($item->components)) !== false)
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
if ($number == 1)
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_COMPONENT');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_COMPONENTS');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// set how many modules use this string
|
2023-10-18 07:26:30 +00:00
|
|
|
if (JsonHelper::check($item->modules))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
$item->modules = json_decode($item->modules, true);
|
|
|
|
}
|
2023-10-18 07:26:30 +00:00
|
|
|
if (($number = ArrayHelper::check($item->modules)) !== false)
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
if ($number == 1)
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_MODULE');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_MODULES');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// set how many plugins use this string
|
2023-10-18 07:26:30 +00:00
|
|
|
if (JsonHelper::check($item->plugins))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
$item->plugins = json_decode($item->plugins, true);
|
|
|
|
}
|
2023-10-18 07:26:30 +00:00
|
|
|
if (($number = ArrayHelper::check($item->plugins)) !== false)
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
|
|
|
if ($number == 1)
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_PLUGIN');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$counterUsedin[] = $number . ' ' . Text::_('COM_COMPONENTBUILDER_PLUGINS');
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// build the numbers
|
|
|
|
$numbersUsedin = '';
|
2023-10-18 07:26:30 +00:00
|
|
|
if (ArrayHelper::check($counterUsedin))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
$numbersUsedin = '<br />' . Text::_('COM_COMPONENTBUILDER_USED_IN') . ' ' . implode('<br />', $counterUsedin);
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
// load the languages to the string
|
2023-10-18 07:26:30 +00:00
|
|
|
if (ArrayHelper::check($langBucket))
|
2020-03-24 01:11:43 +00:00
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
echo '<br /><small>' . Text::_('COM_COMPONENTBUILDER_ALREADY_TRANSLATED_INTO') . ' <em>(' . implode(', ', $langBucket) . ')</em>' . $numbersUsedin . '</small>';
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-09 19:52:51 +00:00
|
|
|
echo '<br /><small><em>(' . Text::_('COM_COMPONENTBUILDER_NOTRANSLATION') . ')</em>' . $numbersUsedin . '</small>';
|
2020-03-24 01:11:43 +00:00
|
|
|
}
|
|
|
|
?>
|
2018-05-24 13:56:56 +00:00
|
|
|
</div>
|
2017-04-03 10:58:41 +00:00
|
|
|
</td>
|
|
|
|
<td class="center">
|
2017-04-05 13:21:10 +00:00
|
|
|
<?php if ($canDo->get('language_translation.edit.state')) : ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php if ($item->checked_out) : ?>
|
|
|
|
<?php if ($canCheckin) : ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'language_translations.', true, 'cb'); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php else: ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'language_translations.', false, 'cb'); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'language_translations.', true, 'cb'); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php else: ?>
|
2024-03-09 19:52:51 +00:00
|
|
|
<?php echo Html::_('jgrid.published', $item->published, $i, 'language_translations.', false, 'cb'); ?>
|
2017-04-03 10:58:41 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
|
|
<td class="nowrap center hidden-phone">
|
|
|
|
<?php echo $item->id; ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|