Adds the option to select between old and new gif animation in the compiler GUI area.

This commit is contained in:
2021-02-20 01:53:14 +02:00
parent e579cd421a
commit 8abe3bced8
15 changed files with 354 additions and 112 deletions

View File

@ -37,8 +37,37 @@ class ComponentbuilderViewCompiler extends JViewLegacy
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=compiler');
$this->sidebar = JHtmlSidebar::render();
}
$this->Components = $this->get('Components');
$this->form = $this->setForm();
$this->Components = $this->get('Components');
$this->form = $this->setForm();
// set the compiler artwork from global settings
$this->builder_gif_size = $this->params->get('builder_gif_size', '480-272');
// only run these checks if he has access
if ($this->canDo->get('compiler.compiler_animations'))
{
// if the new artwork is not being targeted hide download option of artwork
if ('480-540' !== $this->builder_gif_size)
{
$this->canDo->set('compiler.compiler_animations', false);
}
// we count of all the files are already there
else
{
// get all the gif files in the gif folder
$all_gifs = scandir(JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/builder-gif");
// check if we have any values
if (ComponentbuilderHelper::checkArray($all_gifs))
{
// count number of files but remove the 2 dot values
$num_gifs = count($all_gifs) - 2;
// if we have more or the same number of files that are in the array, the we hide the download option
if ($num_gifs >= ComponentbuilderHelper::getDynamicContentSize('builder-gif', '480-540'))
{
$this->canDo->set('compiler.compiler_animations', false);
}
}
}
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
@ -346,6 +375,11 @@ class ComponentbuilderViewCompiler extends JViewLegacy
// add Translate button.
JToolBarHelper::custom('compiler.runTranslator', 'comments-2 custom-button-runtranslator', '', 'COM_COMPONENTBUILDER_TRANSLATE', false);
}
if ($this->canDo->get('compiler.compiler_animations'))
{
// add Compiler Animations button.
JToolBarHelper::custom('compiler.getCompilerAnimations', 'download custom-button-getcompileranimations', '', 'COM_COMPONENTBUILDER_COMPILER_ANIMATIONS', false);
}
if ($this->canDo->get('compiler.clear_tmp'))
{
// add Clear tmp button.