first commit
This commit is contained in:
@@ -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'); ?>
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user