first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
HTMLHelper::_('bootstrap.modal');
JHtml::_('bootstrap.popover');
?>
<div class="row-fluid">
<?php if (!defined('nrJ4')) { ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php } ?>
<div id="j-main-container">
<div class="cf-addons-container">
<h2>
<?php echo JText::_("COM_CONVERTFORMS") ?>
<?php echo JText::_("COM_CONVERTFORMS_ADDONS") ?>
</h2>
<p><?php echo JText::_("COM_CONVERTFORMS_ADDONS_DESC") ?></p>
<div class="cf-addons">
<?php foreach ($this->availableAddons as $key => $item) { ?>
<div class="cf-addon">
<div class="cf-addon-wrap">
<div class="cf-addon-img">
<img alt="<?php echo $item["label"]; ?>" src="<?php echo $item["image"]; ?>"/>
</div>
<div class="cf-addon-text">
<h3><?php echo $item["label"]; ?></h3>
<?php echo $item["description"]; ?>
</div>
<div class="cf-addon-action text-center">
<?php
if (!$item['comingsoon'] && $item['proonly'] === true)
{
NRFramework\HTML::renderProButton(JText::_($item['label']));
}
?>
<?php if ($item['comingsoon']) { ?>
<?php echo JText::_('NR_ROADMAP'); ?>
<?php } ?>
<?php if (!$item['comingsoon'] && $item['extensionid']) { ?>
<?php
$optionsURL = JURI::base(true) . '/index.php?option=com_plugins&view=plugin&tmpl=component&layout=modal&extension_id=' . $item['extensionid'];
$modalName = 'cfPluginModal-' . $item['extensionid'];
?>
<a class="btn btn-sm btn-secondary"
data-toggle="modal"
data-bs-toggle="modal"
href="#<?php echo $modalName ?>"
role="button"
title="<?php echo JText::_("JOPTIONS") ?>">
<span class="icon-options"></span>
</a>
<?php
$options = [
'title' => JText::_('GSD_INTEGRATION_EDIT'),
'url' => $optionsURL,
'height' => '400px',
'backdrop' => 'static',
'bodyHeight' => '70',
'modalWidth' => '70',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" data-dismiss="modal" aria-hidden="true">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>
<button type="button" class="btn btn-primary" aria-hidden="true"
onclick="jQuery(\'#' . $modalName . ' iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_('JSAVE') . '</button>
<button type="button" class="btn btn-success" aria-hidden="true"
onclick="jQuery(\'#' . $modalName . ' iframe\').contents().find(\'#applyBtn\').click();">'
. JText::_('JAPPLY') . '</button>',
];
echo JHtml::_('bootstrap.renderModal', $modalName, $options);
?>
<?php } ?>
<?php
$docsURL = 'https://www.tassos.gr/joomla-extensions/convert-forms//docs/' . $item['docalias'];
?>
<a class="btn btn-sm btn-secondary" href="<?php echo $docsURL; ?>" target="_blank" title="<?php echo JText::_("NR_DOCUMENTATION") ?>">
<span class="icon-info"></span>
</a>
</div>
</div>
</div>
<?php } ?>
<div class="cf-addon">
<div class="cf-addon-wrap">
<div class="cf-addon-img">
<a target="_blank" target="_blank" href="https://www.tassos.gr/contact">
<img alt="<?php echo $item["description"]; ?>" src="https://static.tassos.gr/images/integrations/addon.png"/>
</a>
</div>
<div class="cf-addon-text">
<h3><?php echo JText::_("COM_CONVERTFORMS_ADDONS_MISSING_ADDON") ?></h3>
<?php echo JText::_("COM_CONVERTFORMS_ADDONS_MISSING_ADDON_DESC") ?>
</div>
<div class="cf-addon-action text-center">
<a class="btn btn-sm btn-primary" target="_blank" href="https://www.tassos.gr/contact"><?php echo JText::_("NR_CONTACT_US")?></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR."/layouts/footer.php"); ?>

View File

@@ -0,0 +1,135 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Addons View
*/
class ConvertFormsViewAddons extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.addons.manage', true);
$this->config = JComponentHelper::getParams('com_convertforms');
ConvertForms\Helper::addSubmenu('addons');
$this->sidebar = JHtmlSidebar::render();
$this->availableAddons = $this->getAddons();
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Get list of all available addons
*
* @return array
*/
function getAddons()
{
// Load XML file
$xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/ConvertForms/xml/addons.xml';
if (!JFile::exists($xmlfile))
{
return;
}
if (!$xmlItems = simplexml_load_file($xmlfile))
{
return;
}
$addons = [];
foreach ($xmlItems as $key => $item)
{
$item = (array) $item;
$item = new JRegistry($item["@attributes"]);
$extensionType = $item->get("extension_type", "plugin");
$extensionFolder = $item->get("extension_folder", "convertforms");
$extensionName = $item->get("name");
$extensionID = NRFramework\Extension::getID($extensionName, $extensionType, $extensionFolder);
$backEndURL = "";
if ($extensionID)
{
if ($extensionType == "plugin")
{
$backEndURL = "index.php?option=com_plugins&task=plugin.edit&extension_id=" . $extensionID;
}
}
$url = $item->get("customurl") ?: NRFramework\Functions::getUTMURL($item->get("url", "https://www.tassos.gr/joomla-extensions/convert-forms/"));
$obj = array(
"name" => $extensionName,
"label" => $item->get("label"),
"description" => $item->get("description"),
"image" => $item->get("image"),
"url" => $url,
"customlabel" => $item->get("customlabel"),
"docalias" => $item->get("docalias"),
"extensionid" => $extensionID,
"backendurl" => JURI::base() . $backEndURL,
"proonly" => $item->get("proonly", true),
"comingsoon" => $item->get("comingsoon", false)
);
$addons[] = $obj;
}
asort($addons);
return $addons;
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
$canDo = ConvertForms\Helper::getActions();
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_ADDONS'), "puzzle");
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_convertforms');
}
JToolbarHelper::help("Help", false, "http://www.tassos.gr/joomla-extensions/convert-forms/docs");
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
HTMLHelper::_('bootstrap.modal');
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
if (!defined('nrJ4'))
{
JHtml::_('formbehavior.chosen', 'select');
JFactory::getDocument()->addScriptDeclaration('
document.addEventListener("DOMContentLoaded", function() {
Joomla.submitbutton = function(task)
{
if (task == "campaign.cancel" || document.formvalidator.isValid(document.getElementById("adminForm")))
{
Joomla.submitform(task, document.getElementById("adminForm"));
}
}
});
');
}
JFactory::getDocument()->addScriptDeclaration('
jQuery(function($) {
$("#jform_service").on("change", function() {
$("#confirm-delete").modal("show");
})
$("#confirm-delete .btn-success").click(function() {
Joomla.submitform("campaign.apply", document.getElementById("adminForm"));
})
})
');
?>
<div class="modal fade modal-nr modal-sm" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3><?php echo JText::_("COM_CONVERTFORMS_CAMPAIGN_CHANGED"); ?></h3>
</div>
<div class="modal-body">
<p><?php echo JText::_("COM_CONVERTFORMS_CAMPAIGN_CONFIRM_DESC"); ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-bs-dismiss="modal" data-dismiss="modal"><?php echo JText::_("JCANCEL") ?></button>
<a class="btn btn-success"><?php echo JText::_("JAPPLY") ?></a>
</div>
</div>
</div>
</div>
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=campaign&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate">
<div class="form-horizontal">
<div class="row-fluid">
<div class="span12">
<div class="card p-3 mb-3 well nr-well">
<h4>Campaign Settings</h4>
<?php echo $this->form->renderField("name"); ?>
<?php echo $this->form->renderField("state"); ?>
</div>
<div class="card p-3 well nr-well">
<h4><?php echo JText::_("COM_CONVERTFORMS_CAMPAIGN_SYNC") ?></h4>
<div class="well-desc" style="margin-bottom:20px">
<?php echo JText::_("COM_CONVERTFORMS_CAMPAIGN_SYNC_DESC"); ?>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel("service"); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput("service"); ?>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=addons" class="btn btn-info btn-small">
<span class="icon-cogs" style="margin-right:5px;"></span>
<?php echo JText::_("COM_CONVERTFORMS_INSTALL_ADDONS"); ?>
</a>
</div>
</div>
<?php echo $this->form->renderField("service_pro"); ?>
</div>
<?php if ($this->item->service) { ?>
<div class="card p-3 mt-3 well nr-well cf-service-fields">
<h4><?php echo JText::_("PLG_CONVERTFORMS_" . $this->item->service . "_ALIAS"); ?></h4>
<div class="well-desc" style="margin-bottom:20px;"><?php echo JText::_("PLG_CONVERTFORMS_" . $this->item->service . "_DESC"); ?></div>
<?php echo $this->form->renderFieldset("service"); ?>
</div>
<?php } ?>
<?php echo JHtml::_('form.token'); ?>
<input type="hidden" name="task" value="" />
</div>
</div>
</div>
</form>

View File

@@ -0,0 +1,91 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Toolbar\Toolbar;
/**
* Campaign View Class
*/
class ConvertFormsViewCampaign extends JViewLegacy
{
/**
* display method of Item view
* @return void
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.campaigns.manage', true);
// get the Data
$form = $this->get('Form');
$item = $this->get('Item');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Assign the Data
$this->form = $form;
$this->item = $item;
$this->isnew = (!isset($_REQUEST["id"])) ? true : false;
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$isNew = ($this->item->id == 0);
JToolBarHelper::title($isNew ? JText::_('COM_CONVERTFORMS_NEW_CAMPAIGN') : JText::_('COM_CONVERTFORMS_EDIT_CAMPAIGN') . ": " . $this->item->name . " - ". $this->item->id);
if (defined('nrJ4'))
{
$toolbar = Toolbar::getInstance();
$saveGroup = $toolbar->dropdownButton('save-group');
$saveGroup->configure(
function (Toolbar $childBar)
{
$childBar->apply('campaign.apply');
$childBar->save('campaign.save');
$childBar->save2new('campaign.save2new');
$childBar->save2copy('campaign.save2copy');
}
);
$toolbar->cancel('campaign.cancel', 'JTOOLBAR_CLOSE');
return;
}
JToolbarHelper::apply('campaign.apply');
JToolBarHelper::save('campaign.save');
JToolbarHelper::save2new('campaign.save2new');
JToolBarHelper::cancel('campaign.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
}
}

View File

@@ -0,0 +1,131 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Button\PublishedButton;
JHtml::_('bootstrap.popover');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$user = JFactory::getUser();
?>
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=campaigns'); ?>" class="clearfix" method="post" name="adminForm" id="adminForm">
<?php if (!defined('nrJ4')) { ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php } ?>
<div id="j-main-container">
<?php
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<table class="adminlist nrTable table">
<thead>
<tr>
<th class="center" width="2%"><?php echo JHtml::_('grid.checkall'); ?></th>
<th width="3%" class="nowrap hidden-phone" align="center">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
<th>
<?php echo JHtml::_('searchtools.sort', 'NR_NAME', 'a.name', $listDirn, $listOrder); ?>
</th>
<th width="15%" class="text-center">
<?php echo JHtml::_('searchtools.sort', 'COM_CONVERTFORMS_CAMPAIGN_SYNC', 'a.service', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="text-center nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php if (count($this->items)) { ?>
<?php foreach($this->items as $i => $item): ?>
<?php
$canChange = $user->authorise('core.edit.state', 'com_convertforms.campaign.' . $item->id);
$leadsURL = JURI::base() . 'index.php?option=com_convertforms&view=conversions&filter.campaign_id='. $item->id .'&filter.form_id';
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center"><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td class="text-center">
<?php if (defined('nrJ4')) { ?>
<?php
$options = [
'task_prefix' => 'forms.',
'disabled' => !$canChange,
'id' => 'state-' . $item->id
];
echo (new PublishedButton)->render((int) $item->state, $i, $options);
?>
<?php } else { ?>
<div class="btn-group">
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'campaigns.', $canChange); ?>
<?php
if ($canChange && !defined('nrJ4'))
{
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'campaigns');
JHtml::_('actionsdropdown.' . 'duplicate', 'cb' . $i, 'campaigns');
echo JHtml::_('actionsdropdown.render', $this->escape($item->name));
}
?>
</div>
<?php } ?>
</td>
<td>
<a href="<?php echo JRoute::_('index.php?option=com_convertforms&task=campaign.edit&id='.$item->id); ?>" title="<?php echo JText::_('JACTION_EDIT'); ?>">
<?php echo $this->escape($item->name); ?>
</a>
</td>
<td class="text-center">
<?php
if (!empty($item->service))
{
echo JText::_("PLG_CONVERTFORMS_" . strtoupper($item->service) . "_ALIAS");
}
?>
</td>
<td class="text-center"><?php echo $item->id ?></td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td align="center" colspan="9">
<div align="center">
<?php echo ConvertForms\Helper::noItemsFound("campaigns"); ?>
-
<a href="javascript://" onclick="Joomla.submitbutton('campaign.add')"><?php echo JText::_("COM_CONVERTFORMS_CREATE_NEW") ?></a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR . '/layouts/footer.php'); ?>

View File

@@ -0,0 +1,166 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Campaigns View
*/
class ConvertFormsViewCampaigns extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.campaigns.manage', true);
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->config = JComponentHelper::getParams('com_convertforms');
ConvertForms\Helper::addSubmenu('campaigns');
$this->sidebar = JHtmlSidebar::render();
// Trigger all ConvertForms plugins
JPluginHelper::importPlugin('convertforms');
JFactory::getApplication()->triggerEvent('onConvertFormsServiceName');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
$canDo = ConvertForms\Helper::getActions();
$state = $this->get('State');
$viewLayout = JFactory::getApplication()->input->get('layout', 'default');
$title = JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_CAMPAIGNS');
JFactory::getDocument()->setTitle($title);
JToolbarHelper::title($title);
// Joomla J4
if (defined('nrJ4'))
{
$toolbar = Toolbar::getInstance('toolbar');
if ($canDo->get('core.create'))
{
$toolbar->addNew('campaign.add');
}
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fas fa-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();
if ($canDo->get('core.edit.state'))
{
$childBar->publish('campaigns.publish')->listCheck(true);
$childBar->unpublish('campaigns.unpublish')->listCheck(true);
$childBar->standardButton('copy')->text('JTOOLBAR_DUPLICATE')->task('campaigns.duplicate')->listCheck(true);
$childBar->standardButton('export')->text('COM_CONVERTFORMS_LEADS_EXPORT')->task('campaigns.export')->icon('icon-download')->listCheck(true);
$childBar->trash('campaigns.trash')->listCheck(true);
}
if ($this->state->get('filter.state') == -2)
{
$toolbar->delete('campaigns.delete')
->text('JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if ($canDo->get('core.admin'))
{
$toolbar->preferences('com_convertforms');
}
$toolbar->help('JHELP', false, 'http://www.tassos.gr/joomla-extensions/convert-forms/docs');
return;
}
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('campaign.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('campaign.edit');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('campaigns.duplicate', 'copy', 'copy', 'JTOOLBAR_DUPLICATE', true);
}
if ($canDo->get('core.edit.state') && $state->get('filter.state') != 2)
{
JToolbarHelper::publish('campaigns.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('campaigns.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($canDo->get('core.delete') && $state->get('filter.state') == -2)
{
JToolbarHelper::deleteList('', 'campaigns.delete', 'JTOOLBAR_EMPTY_TRASH');
}
else if ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('campaigns.trash');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('campaigns.export', 'box-add', 'box-add', 'COM_CONVERTFORMS_LEADS_EXPORT');
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_convertforms');
}
JToolbarHelper::help("Help", false, "http://www.tassos.gr/joomla-extensions/convert-forms/docs");
}
}

View File

@@ -0,0 +1,54 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
if (!defined('nrJ4'))
{
JHtml::_('formbehavior.chosen', 'select');
}
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'conversion.cancel' || document.formvalidator.isValid(document.getElementById('adminForm')))
{
Joomla.submitform(task, document.getElementById('adminForm'));
}
}
</script>
<div class="form-horizontal">
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=conversion&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm">
<div class="<?php echo defined('nrJ4') ? 'row' : 'row-fluid' ?>">
<span class="span6 col-md-7">
<h3><?php echo JText::_('COM_CONVERTFORMS_LEAD_USER_SUBMITTED_DATA') ?></h3>
<?php echo $this->form->renderFieldset('params') ?>
</span>
<span class="span6 col-md-5">
<h3><?php echo JText::_('COM_CONVERTFORMS_LEAD_INFO') ?></h3>
<?php echo $this->form->renderFieldset('main') ?>
</span>
</div>
<?php echo JHtml::_('form.token'); ?>
<input type="hidden" name="task" value="conversion.edit" />
</form>
</div>

View File

@@ -0,0 +1,69 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Conversion View Class
*/
class ConvertFormsViewConversion extends JViewLegacy
{
/**
* display method of Item view
* @return void
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.submissions.manage', true);
// get the Data
$form = $this->get('Form');
$item = $this->get('Item');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Assign the Data
$this->form = $form;
$this->item = $item;
$this->isnew = (!isset($_REQUEST["id"])) ? true : false;
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
$input = JFactory::getApplication()->input;
$input->set('hidemainmenu', true);
$isNew = ($this->item->id == 0);
JToolBarHelper::title($isNew ? JText::_('COM_CONVERTFORMS_NEW_CONVERSION') : JText::_('COM_CONVERTFORMS_EDIT_CONVERSION'));
JToolbarHelper::apply('conversion.apply');
JToolBarHelper::save('conversion.save');
JToolBarHelper::cancel('conversion.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
}
}

View File

@@ -0,0 +1,226 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Button\PublishedButton;
use ConvertForms\Helper;
if (!defined('nrJ4'))
{
JHtml::_('formbehavior.chosen', 'select');
}
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$user = JFactory::getUser();
$columns = $this->state->get('filter.columns');
$doc = JFactory::getDocument();
$doc->addStyleDeclaration('
.js-stools .js-stools-container-filters .chzn-container.active:not(.chzn-with-drop) .chzn-single {
border: 1px solid rgba(0,0,0,0.2);
}
.js-stools .js-stools-container-filters .chzn-container.active .chzn-single {
border: 1px solid #2384D3;
}
');
$doc->addScriptDeclaration('
Joomla.submitbutton = function(task) {
let form = document.getElementById("adminForm");
Joomla.submitform(task, form);
// Since the export runs in the background and without reloading the page we need to manually reset the task input.
if (task == "conversions.export") {
form.task.value = "";
}
}
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=conversions'); ?>" class="clearfix" method="post" name="adminForm" id="adminForm">
<?php if (!defined('nrJ4')) { ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php } ?>
<div id="j-main-container">
<?php
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<table class="adminlist nrTable scroll table">
<thead>
<tr>
<th width="2%" class="center"><?php echo JHtml::_('grid.checkall'); ?></th>
<th width="3%" class="nowrap hidden-phone" align="center">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
<?php foreach ($columns as $key => $column) { ?>
<th class="nowrap col_<?php echo $column; ?>">
<?php
$isParam = (strpos($column, 'param_') !== false);
$columnLabel = $isParam ? ucfirst(str_replace('param_', '', $column)) : 'COM_CONVERTFORMS_' . strtoupper($column);
echo JHtml::_('searchtools.sort', $columnLabel, 'a.' . $column, $listDirn, $listOrder);
?>
</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php if (count($this->items)) { ?>
<?php foreach($this->items as $i => $item): ?>
<?php
$canChange = $user->authorise('core.edit.state', 'com_convertforms.conversion.' . $item->id);
$canEdit = $user->authorise('core.edit', 'com_convertforms.conversion.' . $item->id);
?>
<tr class="row<?php echo $i % 2; ?> <?php echo isset($item->params->sync_error) ? 'error' : '' ?>">
<td class="center"><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td class="text-center">
<?php if (defined('nrJ4')) { ?>
<?php
$options = [
'task_prefix' => 'conversions.',
'disabled' => !$canChange,
'id' => 'state-' . $item->id
];
echo (new PublishedButton)->render((int) $item->state, $i, $options);
?>
<?php } else { ?>
<div class="btn-group">
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'conversions.', $canChange); ?>
<?php
if ($canChange && !defined('nrJ4'))
{
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'conversions');
echo JHtml::_('actionsdropdown.render', $this->escape($item->id));
}
?>
</div>
<?php } ?>
</td>
<?php $i = 0; foreach ($columns as $key => $column) {
// Convert to lower case to always match the field in case it has been renamed.
$column = strtolower($column);
$params = [];
if (!is_null($item->params))
{
foreach ($item->params as $key => $value)
{
$params[strtolower($key)] = $value;
}
}
$isParam = (strpos($column, 'param_') !== false);
$columnName = $isParam ? str_replace('param_', '' , $column) : $column;
$value = false;
$col_class = !$isParam ? 'nowrap col_' . $column : $column;
$submission_user = JFactory::getUser($item->user_id);
$submission_user_edit_url = $submission_user->id > 0 ? JURI::base() . '/index.php?option=com_users&task=user.edit&id=' . $submission_user->id : '';
?>
<td class="<?php echo $col_class; ?>">
<?php
switch ($columnName)
{
case 'id':
if ($canEdit)
{
$url = JRoute::_('index.php?option=com_convertforms&task=conversion.edit&id=' . $item->id);
$value = '<a href="' . $url . '">' . $item->$columnName . '</a>';
} else
{
$value = $item->$columnName;
}
break;
case 'user_username':
if ($submission_user->id > 0)
{
$value = '<a href="' . $submission_user_edit_url . '">' . $submission_user->username . '</a>';
}
break;
case 'user_id':
$value = '';
if ($submission_user->id > 0)
{
$value = '<a href="' . $submission_user_edit_url . '">' . $submission_user->id . '</a>';
}
break;
default:
if ($isParam)
{
if (isset($item->prepared_fields[$columnName]))
{
$value = $item->prepared_fields[$columnName]->value_html;
}
} else
{
if (isset($item->$columnName))
{
$value = $item->$columnName;
}
}
break;
}
?>
<?php echo $value; ?>
<?php if ($i == 0 && isset($item->params->sync_service) && isset($item->params->sync_error) && $key == 0) { ?>
<span class="hasPopover icon icon-info"
data-placement="top"
data-title="<?php echo JText::_("PLG_CONVERTFORMS_" . $item->params->sync_service . "_ALIAS"); ?>"
data-content="<?php echo $item->params->sync_error ?>"
style="color:red;">
</span>
<?php } ?>
<?php $i++; ?>
</td>
<?php } ?>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td align="center" colspan="<?php echo count($columns) + 2 ?>">
<div align="center">
<?php echo ConvertForms\Helper::noItemsFound(); ?>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="pagination"><?php echo $this->pagination->getListFooter(); ?></div>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR . '/layouts/footer.php'); ?>

View File

@@ -0,0 +1,147 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
/**
* Conversions View
*/
class ConvertFormsViewConversions extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.submissions.manage', true);
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->config = JComponentHelper::getParams('com_convertforms');
ConvertForms\Helper::addSubmenu('conversions');
$this->sidebar = JHtmlSidebar::render();
// Trigger all ConvertForms plugins
JPluginHelper::importPlugin('convertforms');
JFactory::getApplication()->triggerEvent('onConvertFormsServiceName');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
$canDo = ConvertForms\Helper::getActions();
$state = $this->get('State');
$viewLayout = JFactory::getApplication()->input->get('layout', 'default');
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_SUBMISSIONS'), "users");
// Joomla J4
if (defined('nrJ4'))
{
$toolbar = Toolbar::getInstance('toolbar');
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fas fa-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();
if ($canDo->get('core.edit.state'))
{
$childBar->publish('conversions.publish')->listCheck(true);
$childBar->unpublish('conversions.unpublish')->listCheck(true);
$childBar->standardButton('export')->text('COM_CONVERTFORMS_LEADS_EXPORT')->task('conversions.export')->icon('icon-download')->listCheck(true);
$childBar->trash('conversions.trash')->listCheck(true);
}
if ($this->state->get('filter.state') == -2)
{
$toolbar->delete('conversions.delete')
->text('JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if ($canDo->get('core.admin'))
{
$toolbar->preferences('com_convertforms');
}
$toolbar->help('JHELP', false, 'http://www.tassos.gr/joomla-extensions/convert-forms/docs');
return;
}
if ($canDo->get('core.edit.state') && $state->get('filter.state') != 2)
{
JToolbarHelper::publish('conversions.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('conversions.unpublish', 'JTOOLBAR_UNPUBLISH', true);
JToolbarHelper::archiveList('conversions.archive');
}
if ($canDo->get('core.delete') && $state->get('filter.state') == -2)
{
JToolbarHelper::deleteList('', 'conversions.delete', 'JTOOLBAR_EMPTY_TRASH');
}
else if ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('conversions.trash');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('conversion.edit');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('', 'box-add toolbarexportmodal', '', 'COM_CONVERTFORMS_LEADS_EXPORT');
ConvertForms\Export::renderModal();
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_convertforms');
}
JToolbarHelper::help("Help", false, "http://www.tassos.gr/joomla-extensions/convert-forms/docs");
}
}

View File

@@ -0,0 +1,151 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use ConvertForms\Helper;
jimport('joomla.filesystem.file');
$downloadKey = NRFramework\Functions::getDownloadKey();
// Display extension notices
\NRFramework\Notices\Notices::getInstance([
'ext_element' => 'com_convertforms',
'ext_xml' => 'com_convertforms'
])->show();
$canAccessOptions = Helper::authorise('core.admin');
$canAccessForms = Helper::authorise('convertforms.forms.manage');
$canAccessSubmissions = Helper::authorise('convertforms.submissions.manage');
$canAccessCampaigns = Helper::authorise('convertforms.campaigns.manage');
$canAccessAddons = Helper::authorise('convertforms.addons.manage');
?>
<div class="<?php echo defined('nrJ4') ? 'row' : 'row-fluid' ?> dashboard">
<span class="span8 col-md-8">
<div class="<?php echo defined('nrJ4') ? 'row' : 'row-fluid' ?>">
<div class="col">
<ul class="nr-icons">
<?php if ($canAccessForms) { ?>
<li>
<a href="javascript: newForm()">
<span class="icon-pencil-2"></span>
<span><?php echo JText::_("COM_CONVERTFORMS_NEW_FORM") ?></span>
</a>
</li>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=forms">
<span class="icon-list-2"></span>
<span><?php echo JText::_("COM_CONVERTFORMS_FORMS") ?></span>
</a>
</li>
<?php } ?>
<?php if ($canAccessCampaigns) { ?>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=campaigns">
<span class="cf-icon-megaphone"></span>
<span><?php echo JText::_("COM_CONVERTFORMS_CAMPAIGNS") ?></span>
</a>
</li>
<?php } ?>
<?php if ($canAccessSubmissions) { ?>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=conversions">
<span class="icon-users"></span>
<span><?php echo JText::_("COM_CONVERTFORMS_SUBMISSIONS") ?></span>
</a>
</li>
<?php } ?>
<?php if ($canAccessAddons) { ?>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=addons">
<span class="icon-puzzle"></span>
<span><?php echo JText::_("COM_CONVERTFORMS_ADDONS") ?></span>
</a>
</li>
<?php } ?>
<?php if ($canAccessForms) { ?>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=forms&layout=import">
<span class="icon-box-remove"></span>
<span><?php echo JText::_("NR_IMPORT") ?></span>
</a>
</li>
<?php } ?>
<?php if ($canAccessOptions) { ?>
<li>
<a href="<?php echo JURI::base() ?>index.php?option=com_config&view=component&component=com_convertforms&path=&return=<?php echo MD5(JURI::base()."index.php?option=com_convertforms") ?>">
<span class="icon-options"></span>
<span><?php echo JText::_("JOPTIONS") ?></span>
</a>
</li>
<?php } ?>
<li>
<a href="https://www.tassos.gr/joomla-extensions/convert-forms/docs" target="_blank">
<span class="icon-info"></span>
<span><?php echo JText::_("NR_KNOWLEDGEBASE")?></span>
</a>
</li>
</ul>
</div>
</div>
<?php if ($canAccessSubmissions) { ?>
<div class="<?php echo defined('nrJ4') ? 'row mt-3' : 'row-fluid' ?>" style="margin-top:10px;">
<div class="span6 col">
<div class="nr-well-white">
<h3><?php echo JText::_("COM_CONVERTFORMS_SUBMISSIONS") ?></h3>
<?php include "panel.stats.php"; ?>
</div>
</div>
<div class="span6 col">
<div class="nr-well-white">
<h3><?php echo JText::_('COM_CONVERTFORMS_LATEST_SUBMISSIONS') ?></h3>
<?php include "latest.leads.php"; ?>
</div>
</div>
</div>
<?php } ?>
</span>
<span class="span4 col-md-4">
<?php echo JHtml::_('bootstrap.startAccordion', "info", array('active' => 'slide0')); ?>
<!-- Information Slide -->
<?php
echo JHtml::_('bootstrap.addSlide', "info", JText::_("NR_INFORMATION"), 'slide0');
include "panel.info.php";
echo JHtml::_('bootstrap.endSlide');
?>
<!-- Documentation Slide -->
<?php
echo JHtml::_('bootstrap.addSlide', "info", JText::_("NR_KNOWLEDGEBASE"), 'slide1');
include "panel.docs.php";
echo JHtml::_('bootstrap.endSlide');
?>
<!-- Translations Slide -->
<?php
echo JHtml::_('bootstrap.addSlide', "info", JText::_("NR_HELP_WITH_TRANSLATIONS"), 'slide2');
include "panel.translations.php";
echo JHtml::_('bootstrap.endSlide');
?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
</span>
</div>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR . '/layouts/footer.php'); ?>
<script>
function newForm() {
jQuery("#cfSelectTemplate").modal("show");
}
</script>

View File

@@ -0,0 +1,68 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<?php if (count($this->latestleads)) { ?>
<table class="table nrTable">
<thead>
<tr>
<th><?php echo JText::_("COM_CONVERTFORMS_EMAIL") ?></th>
<th><?php echo JText::_("COM_CONVERTFORMS_FORM") ?></th>
<th width="30%"><?php echo JText::_("JDATE") ?></th>
</tr>
<tbody>
<?php foreach ($this->latestleads as $key => $lead) { ?>
<tr class="<?php echo isset($lead->params->sync_error) ? "error" : "" ?>">
<td>
<?php
$email = '';
if (!$lead->params)
{
continue;
}
foreach ($lead->params as $param_key => $param_value)
{
if (strtolower($param_key) == 'email')
{
$email = $param_value;
break;
}
}
echo $email;
?>
<?php if (isset($lead->params->sync_error)) { ?>
<span class="hasPopover icon icon-info"
data-placement="top"
data-content="<?php echo $lead->params->sync_error ?>"
style="color:red;">
</span>
<?php } ?>
</td>
<td><?php echo $lead->form_name ?></td>
<td><?php echo $lead->created; ?></td>
</tr>
<?php } ?>
</tbody>
</thead>
</table>
<?php } else { ?>
<div class="text-center">
<?php echo ConvertForms\Helper::noItemsFound(); ?>
</div>
<?php } ?>

View File

@@ -0,0 +1,33 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
$docs = array(
"Getting Started with Convert Forms" => "getting-started-with-convert-forms",
"How to use the Form Designer" => "how-to-use-the-form-designer",
"How to display a form on the frontend" => "how-to-display-a-form-on-the-frontend",
"Sync Submissions with ActiveCampaign" => "sync-leads-with-activecampaign",
"Sync Submissions with GetResponse" => "sync-leads-with-getresponse",
"Sync Submissions with MailChimp" => "sync-leads-with-mailchimp",
"How to use Convert Forms as a popup" => "how-to-use-convert-forms-as-a-popup",
);
$docHome = "http://www.tassos.gr/joomla-extensions/convert-forms/docs/";
?>
<ul>
<?php foreach ($docs as $title => $url) { ?>
<li><a target="_blank" href="<?php echo $docHome; ?><?php echo $url?>"><?php echo $title ?></a></li>
<?php } ?>
</ul>

View File

@@ -0,0 +1,56 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<table class="table nrTable noBorder">
<tbody>
<tr>
<td><?php echo JText::_("NR_EXTENSION"); ?></td>
<td><?php echo JText::_("COM_CONVERTFORMS"); ?></td>
</tr>
<tr>
<td><?php echo JText::_("NR_VERSION"); ?></td>
<td><?php echo NRFramework\Functions::getExtensionVersion("com_convertforms", true); ?>
<a href="https://www.tassos.gr/joomla-extensions/convert-forms//changelog"><?php echo JText::_("NR_CHANGELOG"); ?></a>
</td>
</tr>
<tr>
<td><?php echo JText::_("NR_DOWNLOAD_KEY"); ?></td>
<td>
<?php if ($downloadKey) { ?>
<span class="badge bg-success label-success"><?php echo JText::_("NR_OK"); ?></span>
<?php } else { ?>
<span class="badge bg-danger label-important"><?php echo JText::_("NR_MISSING"); ?></span>
<?php } ?>
</td>
</tr>
<tr>
<td><?php echo JText::_("NR_LICENSE"); ?></td>
<td><a href="http://www.tassos.gr/license" target="_blank">GNU GPLv3 Commercial</td>
</tr>
<tr>
<td><?php echo JText::_("NR_AUTHOR"); ?></td>
<td>Tassos Marinos - <a href="http://www.tassos.gr" target="_blank">www.tassos.gr</td>
</tr>
<tr>
<td><?php echo JText::_("NR_FOLLOWME"); ?></td>
<td>
<a href="#" onclick="window.open('https://twitter.com/intent/follow?screen_name=tassosm','tassos.gr','width=500,height=500');">
<?php echo JText::sprintf("NR_FOLLOW", "@mtassos") ?>
</a>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,61 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use ConvertForms\Analytics;
?>
<table width="100%" class="table nrTable">
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_LAST_YEAR") ?></td>
<td class="text-right"><?php echo Analytics::getRows('last_year') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_THIS_YEAR") ?></td>
<td class="text-right"><?php echo Analytics::getRows('this_year') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_LAST_MONTH") ?></td>
<td class="text-right"><?php echo Analytics::getRows('last_month') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_THIS_MONTH") ?></td>
<td class="text-right"><?php echo Analytics::getRows('this_month') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_LAST_7_DAYS") ?></td>
<td class="text-right"><?php echo Analytics::getRows('range', ['created_from' => '-7 day', 'created_to' => 'now']) ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_YESTERDAY") ?></td>
<td class="text-right"><?php echo Analytics::getRows('yesterday') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_TODAY") ?></td>
<td class="text-right"><?php echo Analytics::getRows('today') ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_AVG_DAY") ?></td>
<td class="text-right"><?php echo Analytics::getLeadsAverageThisMonth() ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_PROJECTION") ?></td>
<td class="text-right"><?php echo Analytics::getMonthProjection(); ?></td>
</tr>
<tr>
<td><?php echo JText::_("COM_CONVERTFORMS_TOTAL") ?></td>
<td class="text-right"><?php echo Analytics::getRows(); ?></td>
</tr>
</table>

View File

@@ -0,0 +1,20 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<p>
<?php echo JText::sprintf("NR_TRANSLATE_INTEREST", JText::_("COM_CONVERTFORMS")); ?>
<a href="https://www.transifex.com/tassosgr/convert-forms/" target="_blank"><?php echo JText::_("NR_TRANSIFEX_REQUEST") ?></a>.
</p>

View File

@@ -0,0 +1,50 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
class ConvertFormsViewConvertForms extends JViewLegacy
{
/**
* Items view display method
*
* @return void
*/
function display($tpl = null)
{
$this->config = JComponentHelper::getParams('com_convertforms');
$model = \JModelLegacy::getInstance('Conversions', 'ConvertFormsModel', ['ignore_request' => true]);
$model->setState('list.limit', 10);
$model->setState('filter.state', 1);
$this->latestleads = $model->getItems();
ConvertForms\Helper::renderSelectTemplateModal();
if (!defined('nrJ4'))
{
JHTML::_('behavior.modal');
JHtml::_('bootstrap.popover');
}
JHtml::stylesheet('jui/icomoon.css', array(), true);
JToolBarHelper::title(JText::_('COM_CONVERTFORMS'));
// Display the template
parent::display($tpl);
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2021 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die;
JHtml::script('com_convertforms/editorbutton.js', ['relative' => true, 'version' => 'auto']);
JFactory::getDocument()->addStyleDeclaration( '
.cfEditorButton form, .eboxEditorButton .controls > * {
margin:0;
}
.cfHeader {
border-bottom: 1px dotted #ccc;
margin-bottom: 15px;
padding-bottom: 5px;
}
.cfHeader p {
color:#666;
font-size: 11px;
}
.cfHeader h3 {
font-size: 16px;
margin-bottom: 5px;
margin-top: 0;
}
.cfEditorButton .control-group {
margin-bottom: 15px;
}
.cfEditorButton {
padding: 5px;
}
');
?>
<div class="cfEditorButton">
<form>
<?php echo $this->form->renderFieldset("main") ?>
<button onclick="insertConvertFormShortcode('<?php echo $this->eName; ?>', <?php echo defined('nrJ4') ? 'true' : 'false' ?>);" class="btn btn-success span12">
<?php echo JText::_('PLG_EDITORS-XTD_CONVERTFORMS_INSERTBUTTON'); ?>
</button>
</form>
</div>

View File

@@ -0,0 +1,47 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
class ConvertFormsViewEditorbutton extends JViewLegacy
{
/**
* Items view display method
* @return void
*/
public function display($tpl = null)
{
// Load plugin language file
NRFramework\Functions::loadLanguage("plg_editors-xtd_convertforms");
// Get editor name
$eName = JFactory::getApplication()->input->getCmd('e_name');
// Get form fields
$xml = JPATH_PLUGINS . "/editors-xtd/convertforms/form.xml";
$form = new JForm("com_convertforms.button", array('control' => 'jform'));
$form->loadFile($xml, false);
// Template properties
$this->eName = preg_replace('#[^A-Z0-9\-\_\[\]]#i', '', $eName);
$this->form = $form;
parent::display($tpl);
return;
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
if ($this->download_link)
{
JFactory::getDocument()->addScriptDeclaration('
document.addEventListener("DOMContentLoaded", function() {
window.location.href = "' . $this->download_link . '";
});
');
}
?>
<div class="export_tool completed text-center tmpl-<?php echo $this->tmpl ?>">
<div class="container">
<span class="icon-checkmark-2"></span>
<h2>
<?php echo JText::sprintf('COM_CONVERTFORMS_EXPORT_COMPLETED', number_format($this->total_submissions_exported)) ?>
</h2>
<p>
<?php echo JText::_('COM_CONVERTFORMS_DOWNLOAD_WILL_START') ?>
</p>
<a class="btn" href="<?php echo $this->start_over_link ?>">
<?php echo JText::_('NR_START_OVER') ?>
</a>
</div>
</div>

View File

@@ -0,0 +1,53 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
JFactory::getDocument()->addScriptDeclaration('
document.addEventListener("DOMContentLoaded", function() {
var form = document.querySelector(".export_tool form");
form.addEventListener("submit", function(e) {
var btn = form.querySelector("button[type=\'submit\']");
btn.innerText = "' . JText::_('NR_PLEASE_WAIT') . '...";
document.querySelector(".export_tool").classList.add("working");
});
// Joomla\'s showOn attribute doesn\'t support showing/hiding a field when another field is empty.
let formIDInput = document.getElementById("filter_search");
formIDInput.addEventListener("input", showHideFields);
showHideFields();
function showHideFields() {
let state = formIDInput.value.startsWith("id:") == "" ? "block" : "none";
document.getElementById("filter_state").closest(".control-group").style.display = state;
document.getElementById("filter_period").closest(".control-group").style.display = state;
}
});
');
?>
<div class="export_tool form tmpl-<?php echo $this->tmpl ?>">
<div class="container">
<h1><?php echo JText::_('COM_CONVERTFORMS_LEADS_EXPORT') ?></h1>
<form method="post" action="<?php echo JRoute::_('index.php') ?>" name="adminForm" id="adminForm" >
<?php echo $this->form->renderFieldset('submission'); ?>
<button class="btn btn-primary" type="submit">
<?php echo JText::_('COM_CONVERTFORMS_LEADS_EXPORT') ?>
</button>
<input type="hidden" name="option" value="com_convertforms"/>
<input type="hidden" name="task" value="export.export"/>
<input type="hidden" name="tmpl" value="<?php echo $this->tmpl ?>"/>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
</div>

View File

@@ -0,0 +1,26 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<div class="export_tool error text-center tmpl-<?php echo $this->tmpl ?>">
<div class="container">
<span class="icon-smiley-sad-2"></span>
<h2><?php echo JText::_('NR_ERROR') ?></h2>
<p class="error_message"><?php echo $this->error; ?></p>
<a class="btn" href="<?php echo $this->start_over_link ?>">
<?php echo JText::_('NR_TRY_AGAIN') ?>
</a>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<div class="export_tool inprogress text-center tmpl-<?php echo $this->tmpl ?>">
<div class="container">
<span class="icon-health"></span>
<h2>
<?php echo JText::_('COM_CONVERTFORMS_EXPORT_WORKING') ?>
</h2>
<p>
<?php echo \JText::sprintf('COM_CONVERTFORMS_EXPORT_PROCESSING', number_format($this->processed), number_format($this->total)); ?>
</p>
<a href="<?php echo $this->start_over_link ?>" onclick="return confirm('<?php echo JText::_('NR_ARE_YOU_SURE') ?>')">
<?php echo JText::_('NR_CANCEL'); ?>
</a>
</div>
</div>

View File

@@ -0,0 +1,142 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use ConvertForms\Export;
/**
* Templates View
*/
class ConvertFormsViewExport extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$input = $app->input;
$viewLayout = $input->get('layout', 'default');
$this->tmpl = $input->get('tmpl');
$this->baseURL = 'index.php?option=com_convertforms&view=export';
$this->start_over_link = $this->baseURL . ($this->tmpl == 'component' ? '&tmpl=component' : '');
switch ($viewLayout)
{
case 'completed':
$file = $input->get('filename');
if (!Export::exportFileExists($file))
{
Export::error(JText::_('COM_CONVERTFORMS_EXPORT_ERROR_CANT_FIND_FILE'));
}
$this->download_link = 'index.php?option=com_convertforms&task=export.download&filename=' . $file;
$this->total_submissions_exported = $input->get('total');
$this->export_type = $input->get('export_type');
break;
case 'progress':
JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN'));
try
{
$data = Export::export($input->getArray());
$pagination = $data['pagination'];
$options = $data['options'];
$totalProcessedSoFar = $pagination->pagesCurrent * $pagination->limit;
$totalProcessedSoFar = $pagination->total > $totalProcessedSoFar ? $totalProcessedSoFar : $pagination->total;
$this->processed = $totalProcessedSoFar;
$this->total = $pagination->total;
if ($pagination->pagesCurrent < $pagination->pagesTotal)
{
$new_url = \JURI::getInstance();
$new_url->setVar('offset', $options['offset'] + $options['limit']);
$new_url->setVar('processed', $this->processed);
$new_url->setVar('total', $this->total);
header('Refresh:0; url=' . $new_url->toString());
} else
{
// Export completed
$optionsQuery = http_build_query(array_filter([
'total' => $this->total,
'filename' => $options['filename'],
'export_type' => $options['export_type'],
'tmpl' => $this->tmpl
]));
$app->redirect($this->baseURL . '&layout=completed&' . $optionsQuery);
}
} catch (\Throwable $th)
{
Export::error($th->getMessage());
}
break;
case 'error':
$this->error = $input->get('error', '', 'RAW');
break;
default:
$form = new JForm('export');
$form->loadFile(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms/export_submissions.xml');
$form->bind($app->input->getArray());
$this->form = $form;
break;
}
if ($this->tmpl == 'component')
{
JFactory::getDocument()->addStyleDeclaration('
body {
background:none !important;
}
');
} else
{
$this->addToolBar();
}
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
$app->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Display the template
parent::display($tpl);
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_LEADS_EXPORT'));
}
}

View File

@@ -0,0 +1,248 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\HTML\HTMLHelper;
use NRFramework\HTML;
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('bootstrap.dropdown');
JHtml::script('com_convertforms/admin.js', ['relative' => true, 'version' => 'auto']);
JHtml::stylesheet('com_convertforms/editor.css', ['relative' => true, 'version' => 'auto']);
if (defined('nrJ4'))
{
JFactory::getDocument()->addScript(JURI::root(true) . '/media/vendor/tinymce/tinymce.js');
HTML::fixFieldTooltips();
} else
{
JFactory::getDocument()->addScript(JURI::root(true) . '/media/editors/tinymce/tinymce.min.js');
JHtml::script('com_convertforms/cookie.js', ['relative' => true, 'version' => 'auto']);
}
$fonts = new NRFonts();
JFactory::getDocument()->addScriptDeclaration('var ConvertFormsGoogleFonts = '. json_encode($fonts->getFontGroup('google')));
$tabState = JFactory::getApplication()->input->cookie->get("ConvertFormsState" . $this->item->id, 'fields');
$tabStateParts = explode("-", $tabState);
$tabActive = $tabStateParts[0];
// Smart Tags Box
echo NRFramework\HTML::smartTagsBox();
NRFramework\HTML::renderProOnlyModal();
if (!$this->isnew) {
// Render Embed popup
echo \JHtml::_('bootstrap.renderModal', 'embedForm', [
'title' => 'Embed Form',
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" data-dismiss="modal" aria-hidden="true">'. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
], '
<p>You are almost done! To embed this form on your site, please paste the following shortcode inside an article or a module.</p>
<input class="shortcode" readonly value="{convertforms ' . $this->item->id . '}"/>
<p>or you can follow the instructions from this <a target="_blank" href="https://www.tassos.gr/joomla-extensions/convert-forms/docs/how-to-display-a-form-on-the-frontend">page</a>.</p>
');
}
function tabSetStart($active)
{
echo defined('nrJ4') ? HTMLHelper::_('uitab.startTabSet', 'sections', ['active' => $active, 'orientation' => 'vertical']) : JHtml::_('bootstrap.startTabSet', 'sections', ['active' => $active]);;
}
function tabSetEnd()
{
echo defined('nrJ4') ? HTMLHelper::_('uitab.endTabSet') : JHtml::_('bootstrap.endTabSet');;
}
function tabStart($name, $title)
{
echo defined('nrJ4') ? HTMLHelper::_('uitab.addTab', 'sections', $name, JText::_($title)) : JHtml::_('bootstrap.addTab', 'sections', $name, JText::_($title));
}
function tabEnd()
{
echo defined('nrJ4') ? HTMLHelper::_('uitab.endTab') : JHtml::_('bootstrap.endTab');
}
if (defined('nrJ4'))
{
NRFramework\HTML::fixFieldTooltips();
}
?>
<div class="cfEditor">
<?php
JPluginHelper::importPlugin('convertformstools');
JFactory::getApplication()->triggerEvent('onConvertFormsEditorView');
?>
<div class="nrEditor" data-root="<?php echo JURI::root(); ?>">
<?php if (defined('nrJ4')) { ?>
<div class="cfe-top">
<div>
<img height="18px" src="<?php echo JURI::root() ?>media/templates/administrator/atum/images/logos/brand-small.svg"/>
</div>
<div>
<span><?php echo JVERSION ?></span>
<span class="pl-3"><?php echo JFactory::getApplication()->get('sitename') ?></span>
</div>
</div>
<?php } ?>
<div class="cfe-header">
<div class="cfe-logo">
<img width="150px" src="<?php echo JURI::root() ?>/media/com_convertforms/img/logo.svg"/>
</div>
<div class="cfe-title">
<label for="formname"><?php echo $this->isnew ? JText::_('COM_CONVERTFORMS_NEW_FORM') : JText::_('COM_CONVERTFORMS_EDIT_FORM') ?>:</label>
<input type="text" data-fallback="<?php echo JText::_("COM_CONVERTFORMS_UNTITLED_BOX") ?>" id="formname" value="<?php echo $this->name ?>"/>
</div>
<div class="cfe-toolbar">
<ul class="cf-menu">
<li>
<a href="#" class="btn btn-success save cf-menu-item saveForm" title="Save form" data-cfaction="save">
<i class="cf-icon-ok up-state"><?php echo JText::_('JAPPLY') ?></i>
<i class="cf-icon-spin hover-state">Saving..</i>
</a>
</li>
<li class="cf-menu-parent">
<a href="#" class="cf-icon-dots cf-menu-item " role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" data-toggle="dropdown" title="View more"></a>
<ul class="dropdown <?php echo defined('nrJ4') ? 'dropdown-menu' : '' ?>">
<li>
<a class="<?php echo $this->isnew ? 'disabled' : '' ?>" data-bs-toggle="modal" data-bs-target="#embedForm" data-toggle="modal" data-target="#embedForm" href="#">
<span class="cf-icon-link"></span>
<?php echo JText::_('NR_EMBED') ?>
</a>
</li>
<li>
<a class="<?php echo $this->isnew ? 'disabled' : '' ?>" target="_blank" href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=conversions&filter.form_id=<?php echo $this->item->id ?>">
<span class="cf-icon-users"></span>
<?php echo JText::_('COM_CONVERTFORMS_SUBMISSIONS')?>
</a>
</li>
<li class="separator"></li>
<li>
<a href="#" data-pro-only>
<span class="cf-icon-heart"></span>
<?php echo JText::_('NR_UPGRADE_TO_PRO') ?>
</a>
</li>
<li class="separator"></li>
<li>
<a href="https://extensions.joomla.org/extension/convert-forms/" target="_blank">
<span class="cf-icon-thumbs-up"></span>
<?php echo JText::sprintf('NR_RATE', JText::_('CONVERTFORMS')) ?>
</a>
</li>
<li>
<a href="http://www.tassos.gr/contact?topic=Bug Report&extension=Convert Forms" target="_blank">
<span class="cf-icon-attention"></span>
<?php echo JText::_('NR_REPORT_ISSUE') ?>
</a>
</li>
<li>
<a href="http://www.tassos.gr/joomla-extensions/convert-forms/docs" target="_blank">
<span class="cf-icon-help"></span>
<?php echo JText::_('JHELP') ?>
</a>
</li>
</ul>
</li>
<li>
<a href="<?php echo JRoute::_('index.php?option=com_convertforms&view=forms') ?>" class="cf-icon-cancel cf-menu-item" title="Close and return to forms list"></a>
</li>
</ul>
</div>
</div>
<div class="cfe-main">
<div class="nrEditorOptions inputSettings">
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-vertical" pk="<?php echo (int) $this->item->id ?>">
<div class="tabs-left">
<?php
tabSetStart($tabActive);
foreach ($this->tabs as $key => $tab)
{
$tabName = $key;
$tabLabel = JText::_($tab["label"]);
tabStart($tabName, '<span data-label="' . $tabLabel . '" class="' . $tab["icon"] . '"></span>');
$panelActive = $tabActive == $key ? $tabState : "";
echo JHtml::_('bootstrap.startAccordion', $tabName, array('active' => $panelActive));
echo "<h2>" . $tabLabel . "</h2>";
$single = count($tab["fields"]) == 1 ? true : false;
foreach ($tab["fields"] as $key => $field)
{
if ($single)
{
echo '<div class="accordion-inner"> ' . $this->form->renderFieldset($field["name"]) . '</div>';
continue;
}
echo JHtml::_('bootstrap.addSlide', $tabName, JText::_($field["label"]), $tabName.'-' . $field["name"], $field["name"]);
$fieldset = $this->form->renderFieldset($field["name"]);
JFactory::getApplication()->triggerEvent('onConvertFormsBackendFormPrepareFieldset', [$field["name"], &$fieldset]);
echo $fieldset;
echo JHtml::_('bootstrap.endSlide');
}
echo JHtml::_('bootstrap.endAccordion');
tabEnd();
}
tabSetEnd();
?>
<input type="hidden" name="task" value="form.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
<div class="nrEditorPreview hidden-phone">
<div class="nrEditorTools inputSettings">
<div class="l nrEditorTabs">
<ul class="nrNav">
<li class="nrCheckbox">
<input value="1" type="checkbox" id="preview-successmsg">
<label for="preview-successmsg"><?php echo JText::_("COM_CONVERTFORMS_PREVIEW_SUCCESS") ?></label>
</li>
</ul>
</div>
<div class="r">
</div>
</div>
<div class="nrEditorPreviewContainer"></div>
<div class="loader"></div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
?>
<?php echo $this->field; ?>

View File

@@ -0,0 +1,57 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Item View
*/
class ConvertFormsViewForm extends JViewLegacy
{
/**
* display method of Item view
* @return void
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.forms.manage', true);
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Assign the Data
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->isnew = (!isset($_REQUEST["id"])) ? true : false;
$this->tabs = $this->get('Tabs');
$this->name = $this->item->name ?: JText::_('COM_CONVERTFORMS_UNTITLED_BOX');
\JPluginHelper::importPlugin('convertformstools');
\JFactory::getApplication()->triggerEvent('onConvertFormsBackendEditorDisplay');
$title = JText::_('COM_CONVERTFORMS') . ' - ' . ($this->isnew ? JText::_("COM_CONVERTFORMS_UNTITLED_BOX") : $this->name);
JFactory::getDocument()->setTitle($title);
JToolbarHelper::title($title);
// Display the template
parent::display($tpl);
}
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.view');
/**
* Item View
*/
class ConvertFormsViewForm extends JViewLegacy
{
/**
* display method of Item view
* @return void
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
$app->enqueueMessage(implode('\n', $errors), 'error');
return false;
}
$layout = $app->input->get('layout', 'default');
if ($layout == 'preview')
{
//$data = json_decode($app->input->get('jform', null, 'RAW'));
$input = json_decode(file_get_contents('php://input'));
$data = json_decode($input);
$xx = new JRegistry();
foreach ($data as $value)
{
$key = str_replace(['jform[', ']', '['], ['', '', '.'], $value->name);
$xx->set($key, $value->value);
}
$xx = $xx->toArray();
$this->data = $this->getModel('Form')->validate('jform', $xx);
$this->data['params'] = json_decode($this->data['params'], true);
$this->data['fields'] = $this->data['params']['fields'];
unset($this->data['params']['fields']);
$this->form = ConvertForms\Helper::renderForm($this->data);
}
if ($layout == 'field')
{
$formControl = urldecode($app->input->get('formcontrol', null, 'RAW'));
$loadData = $app->input->get('field', array(), 'ARRAY');
$this->field = ConvertForms\FieldsHelper::getFieldClass($loadData['type'])->getOptionsForm($formControl, $loadData);
}
// Display the template
parent::display($tpl);
}
}

View File

@@ -0,0 +1,240 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Button\PublishedButton;
JHtml::_('bootstrap.popover');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
if (!defined('nrJ4'))
{
JFactory::getDocument()->addScriptDeclaration('
jQuery(function($) {
Joomla.submitbutton = function(task) {
if (task == "form.add") {
jQuery("#cfSelectTemplate").modal("show");
} else {
Joomla.submitform(task, document.getElementById("adminForm"));
}
}
});
');
}
$user = JFactory::getUser();
?>
<form action="<?php echo JRoute::_('index.php?option=com_convertforms&view=forms'); ?>" class="clearfix" method="post" name="adminForm" id="adminForm">
<?php if (!defined('nrJ4')) { ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<?php } ?>
<div id="j-main-container">
<?php
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<table class="adminlist nrTable table">
<thead>
<tr>
<th class="text-center" width="2%"><?php echo JHtml::_('grid.checkall'); ?></th>
<th width="3%" class="nowrap hidden-phone" align="center">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
<th>
<?php echo JHtml::_('searchtools.sort', 'NR_NAME', 'a.name', $listDirn, $listOrder); ?>
</th>
<th width="13%" class="text-center">
<?php echo JText::_('COM_CONVERTFORMS_CAMPAIGN') ?>
</th>
<th width="13%" class="text-center">
<?php echo JText::_('COM_CONVERTFORMS_SAVE_DATA') ?>
</th>
<th width="13%" class="text-center">
<?php echo JHtml::_('searchtools.sort', 'COM_CONVERTFORMS_SUBMISSIONS', 'leads', $listDirn, $listOrder); ?>
</th>
<th width="20%" class="text-center"><?php echo JText::_("COM_CONVERTFORMS_ACTIONS"); ?></th>
<th width="5%" class="nowrap text-center hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php if (count($this->items)) { ?>
<?php foreach($this->items as $i => $item): ?>
<?php
$leads = \ConvertForms\Form::getSubmissionsTotal($item->id);
$canChange = $user->authorise('core.edit.state', 'com_convertforms.form.' . $item->id);
$leadsURL = JURI::base() . 'index.php?option=com_convertforms&view=conversions&filter.period&filter.form_id='. $item->id;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="text-center"><?php echo JHtml::_('grid.id', $i, $item->id); ?></td>
<td class="text-center">
<?php if (defined('nrJ4')) { ?>
<?php
$options = [
'task_prefix' => 'forms.',
'disabled' => !$canChange,
'id' => 'state-' . $item->id
];
echo (new PublishedButton)->render((int) $item->state, $i, $options);
?>
<?php } else { ?>
<div class="btn-group">
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'forms.', $canChange); ?>
<?php
if ($canChange && !defined('nrJ4'))
{
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'forms');
JHtml::_('actionsdropdown.' . 'duplicate', 'cb' . $i, 'forms');
echo JHtml::_('actionsdropdown.render', $this->escape($item->name));
}
?>
</div>
<?php } ?>
</td>
<td>
<a href="<?php echo JRoute::_('index.php?option=com_convertforms&task=form.edit&id='.$item->id); ?>" title="<?php echo JText::_('JACTION_EDIT'); ?>"><?php echo $this->escape($item->name); ?>
</a>
</td>
<td class="text-center">
<?php
if (isset($item->campaign))
{
echo ConvertForms\Helper::getCampaign($item->campaign)->name;
}
?>
</td>
<td class="text-center">
<?php
$saveToDb = isset($item->save_data_to_db) ? $item->save_data_to_db : true;
?>
<span title="<?php echo JText::_('COM_CONVERTFORMS_SAVE_DATA_' . (int) $saveToDb) ?> ">
<?php echo JText::_($saveToDb ? 'JYES' : 'JNO'); ?>
</span>
</td>
<td class="text-center">
<?php
$total = number_format($leads);
?>
<a href="<?php echo $leadsURL ?>">
<span class="badge badge-info bg-info hasPopover" data-placement="top" data-content="<?php echo JText::sprintf("COM_CONVERTFORMS_FORM_LEADS", $total) ?>">
<?php echo $total; ?>
</span>
</a>
</td>
<td class="text-center">
<ul class="item-icons">
<li>
<a class="hasPopover <?php echo ($leads == 0) ? "disabled" : "" ?>"
data-placement="top"
data-content="<?php echo JText::_("COM_CONVERTFORMS_VIEW_LEADS") ?>"
href="<?php echo JURI::base() ?>index.php?option=com_convertforms&view=conversions&filter.form_id=<?php echo $item->id ?>&filter.state"><span class="icon icon-users"></span>
</a>
</li>
<li>
<a class="hasPopover"
data-placement="top"
data-content="<?php echo JText::_("COM_CONVERTFORMS_FORM_CREATE_MODULE") ?>"
href="<?php echo JURI::base() ?>index.php?option=com_modules&task=module.add&eid=<?php echo $this->moduleID ?>">
<span class="icon icon-cube"></span>
</a>
</li>
<li>
<a class="hasPopover copyToClipboard"
data-clipboard="{convertforms <?php echo $item->id ?>}"
data-placement="top"
data-content="<?php echo JText::sprintf("COM_CONVERTFORMS_FORM_CLIPBOARD_SHORTCODE", "{convertforms ".$item->id."}") ?>"
href='#'>
<span class="icon icon-link disable-click"></span>
</a>
</li>
</ul>
</td>
<td class="text-center"><?php echo $item->id ?></td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td align="center" colspan="9">
<div align="center">
<?php echo ConvertForms\Helper::noItemsFound("forms"); ?>
-
<a href="javascript://" onclick="Joomla.submitbutton('form.add')"><?php echo JText::_("COM_CONVERTFORMS_CREATE_NEW") ?></a>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
<?php include_once(JPATH_COMPONENT_ADMINISTRATOR . '/layouts/footer.php'); ?>
<script>
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("click", function(e) {
if (!e.target.classList.contains("copyToClipboard")) {
return;
}
e.preventDefault();
var data = e.target.dataset.clipboard;
copyTextToClipboard(data, function(success) {
if (success) {
Joomla.renderMessages({"success": ["Shortcode " + data + " copied to clipboard"]});
}
});
});
function copyTextToClipboard(text, callback) {
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var success = document.execCommand('copy');
callback(success);
} catch (err) {
callback(false);
}
document.body.removeChild(textArea);
}
})
</script>

View File

@@ -0,0 +1,67 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die;
?>
<form onsubmit="return submitform();" action="<?php echo JRoute::_('index.php?option=com_convertforms&view=forms'); ?>" method="post" enctype="multipart/form-data" name="import-form" id="import-form">
<fieldset class="form-horizontal">
<legend><?php echo JText::_('NR_IMPORT_ITEMS'); ?></legend>
<div class="control-group">
<label for="file" class="control-label"><?php echo JText::_('COM_CONVERTFORMS_CHOOSE_FILE'); ?></label>
<div class="controls">
<input class="input_box" id="file" name="file" type="file" size="57" />
</div>
</div>
<div class="control-group">
<label for="publish_all" class="control-label"><?php echo JText::_('NR_PUBLISH_ITEMS'); ?></label>
<div class="controls">
<fieldset id="publish_all" class="radio btn-group">
<input type="radio" name="publish_all" id="publish_all0" value="0" />
<label for="publish_all0" class="btn"><?php echo JText::_('JNO'); ?></label>
<input type="radio" name="publish_all" id="publish_all1" value="1" />
<label for="publish_all1" class="btn"><?php echo JText::_('JYES'); ?></label>
<input type="radio" name="publish_all" id="publish_all2" value="2" checked="checked" />
<label for="publish_all2" class="btn"><?php echo JText::_('NR_AS_EXPORTED'); ?></label>
</fieldset>
</div>
</div>
<div class="form-actions">
<input class="btn btn-primary" type="submit" value="<?php echo JText::_('NR_IMPORT'); ?>" />
</div>
</fieldset>
<input type="hidden" name="task" value="forms.import" />
<?php echo JHtml::_('form.token'); ?>
</form>
<script language="javascript" type="text/javascript">
/**
* Submit the admin form
*
* small hack: let task decides where it comes
*/
function submitform() {
var file = jQuery('#file').val();
if (file) {
var dot = file.lastIndexOf(".");
if (dot != -1) {
var ext = file.substr(dot, file.length);
if (ext == '.cnvf') {
return true;
}
}
}
alert('<?php echo JText::_('NR_PLEASE_CHOOSE_A_VALID_FILE'); ?>');
return false;
}
</script>

View File

@@ -0,0 +1,194 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Forms View Class
*/
class ConvertFormsViewForms extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
public function display($tpl = null)
{
// Access check.
ConvertForms\Helper::authorise('convertforms.forms.manage', true);
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->config = JComponentHelper::getParams('com_convertforms');
ConvertForms\Helper::addSubmenu('forms');
$this->sidebar = JHtmlSidebar::render();
$this->moduleID = NRFramework\Extension::getID('mod_convertforms', 'module');
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
ConvertForms\Helper::renderSelectTemplateModal();
// Display the template
parent::display($tpl);
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
$canDo = ConvertForms\Helper::getActions();
$state = $this->get('State');
$viewLayout = JFactory::getApplication()->input->get('layout', 'default');
// Joomla J4
if (defined('nrJ4'))
{
$toolbar = Toolbar::getInstance('toolbar');
if ($viewLayout == 'import')
{
$title = JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS');
JFactory::getDocument()->setTitle($title);
JToolbarHelper::title($title);
JToolbarHelper::back();
}
else
{
ToolbarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_FORMS'));
if ($canDo->get('core.create'))
{
$newGroup = $toolbar->dropdownButton('new-group');
$newGroup->configure(
function (Toolbar $childBar)
{
$childBar->popupButton('new')->text('New')->selector('cfSelectTemplate')->icon('icon-new')->buttonClass('btn btn-success');
$childBar->addNew('form.add')->text('COM_CONVERTFORMS_TEMPLATES_BLANK');
$childBar->standardButton('import')->text('NR_IMPORT')->task('forms.import')->icon('icon-upload');
}
);
}
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fas fa-ellipsis-h')
->buttonClass('btn btn-action')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();
if ($canDo->get('core.edit.state'))
{
$childBar->publish('forms.publish')->listCheck(true);
$childBar->unpublish('forms.unpublish')->listCheck(true);
$childBar->standardButton('copy')->text('JTOOLBAR_DUPLICATE')->task('forms.duplicate')->listCheck(true);
$childBar->standardButton('export')->text('NR_EXPORT')->task('forms.export')->icon('icon-download')->listCheck(true);
$childBar->trash('forms.trash')->listCheck(true);
}
if ($this->state->get('filter.state') == -2)
{
$toolbar->delete('forms.delete')
->text('JTOOLBAR_EMPTY_TRASH')
->message('JGLOBAL_CONFIRM_DELETE')
->listCheck(true);
}
if ($canDo->get('core.admin'))
{
$toolbar->preferences('com_convertforms');
}
$toolbar->help('JHELP', false, "http://www.tassos.gr/joomla-extensions/responsive-scroll-triggered-box-for-joomla/docs");
}
return;
}
if ($viewLayout == 'import')
{
JFactory::getDocument()->setTitle(JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS'));
JToolbarHelper::title(JText::_('COM_CONVERTFORMS') . ': ' . JText::_('NR_IMPORT_ITEMS'));
JToolbarHelper::back();
}
else
{
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_FORMS'));
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('form.add');
}
if ($canDo->get('core.edit'))
{
JToolbarHelper::editList('form.edit');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('forms.duplicate', 'copy', 'copy', 'JTOOLBAR_DUPLICATE', true);
}
if ($canDo->get('core.edit.state') && $state->get('filter.state') != 2)
{
JToolbarHelper::publish('forms.publish', 'JTOOLBAR_PUBLISH', true);
JToolbarHelper::unpublish('forms.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
if ($canDo->get('core.delete') && $state->get('filter.state') == -2)
{
JToolbarHelper::deleteList('', 'forms.delete', 'JTOOLBAR_EMPTY_TRASH');
}
else if ($canDo->get('core.edit.state'))
{
JToolbarHelper::trash('forms.trash');
}
if ($canDo->get('core.create'))
{
JToolbarHelper::custom('forms.export', 'box-add', 'box-add', 'NR_EXPORT');
JToolbarHelper::custom('forms.import', 'box-remove', 'box-remove', 'NR_IMPORT', false);
}
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_convertforms');
}
}
JToolbarHelper::help("Help", false, "http://www.tassos.gr/joomla-extensions/convert-forms/docs");
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
JHtml::_('bootstrap.popover');
?>
<div class="cf-templates">
<div class="cf-templates-items">
<?php foreach ($this->templates as $key => $templateGroup) { ?>
<div class="cf-template-group">
<div class="cf-template-group-name">
<?php echo JText::_("COM_CONVERTFORMS_TEMPLATE_GROUP_" . $key); ?>
</div>
<div class="cf-template-group-items cf-template-group-<?php echo $key ?>">
<?php foreach ($templateGroup as $template) { ?>
<div class="cf-template">
<div>
<a href="<?php echo $template["link"]; ?>"
class="hasPopover"
data-placement="top"
data-content="<?php echo $template["label"] ?>">
<img width="100%" height="auto" src="<?php echo $template["thumb"]; ?>"/>
</a>
</div>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>
<script>
jQuery(function($) {
$(".cf-templates a").click(function(event) {
event.preventDefault();
window.parent.location = $(this).attr("href");
window.parent.jModalClose();
});
})
</script>

View File

@@ -0,0 +1,111 @@
<?php
/**
* @package Convert Forms
* @version 3.2.12 Free
*
* @author Tassos Marinos <info@tassos.gr>
* @link http://www.tassos.gr
* @copyright Copyright © 2020 Tassos Marinos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/**
* Templates View
*/
class ConvertFormsViewTemplates extends JViewLegacy
{
/**
* Items view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*/
function display($tpl = null)
{
$this->config = JComponentHelper::getParams('com_convertforms');
$this->templates = $this->getTemplates();
// Check for errors.
if (!is_null($this->get('Errors')) && count($errors = $this->get('Errors')))
{
JFactory::getApplication()->enqueueMessage(implode("\n", $errors), 'error');
return false;
}
// Set the toolbar
$this->addToolBar();
// Display the template
parent::display($tpl);
}
/**
* Get list of all available templates
*
* @return array
*/
function getTemplates()
{
$templatesPath = JPATH_ROOT . "/media/com_convertforms/templates/";
$xmlFile = $templatesPath . "templates.xml";
if (!JFile::exists($xmlFile))
{
return;
}
if (!$templateGroups = simplexml_load_file($xmlFile))
{
return;
}
$templates = array();
foreach ($templateGroups as $templateGroup)
{
$templateGroupName = (string) $templateGroup["name"];
foreach ($templateGroup as $template)
{
$templateName = (string) $template["name"];
// Check if template thumb file exists
if (!JFile::exists($templatesPath . $templateName . ".jpg"))
{
continue;
}
$templateInfo = array(
"name" => $templateName,
"label" => (string) $template["label"],
"thumb" => JURI::root() . 'media/com_convertforms/templates/' . $templateName . '.jpg',
"link" => JURI::base() . "index.php?option=com_convertforms&view=form&layout=edit&template=" . $templateName
);
// Check if template thumb file exists
if (!JFile::exists($templatesPath . $templateName . ".cnvf"))
{
unset($templateInfo["link"]);
}
$templates[$templateGroupName][] = $templateInfo;
}
}
return $templates;
}
/**
* Add Toolbar to layout
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_CONVERTFORMS') . ": " . JText::_('COM_CONVERTFORMS_TEMPLATES'));
}
}