Skip to content

Commit

Permalink
Merge pull request #1 from TheDMSGroup/ENG-616
Browse files Browse the repository at this point in the history
[ENG-616] php-cs-fixes
  • Loading branch information
heathdutton authored Oct 29, 2018
2 parents 5d4adda + f7db0d0 commit 0b9bd8b
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
env:
global:
# The exact plugin folder/bundle name.
- "MAUTIC_PLUGIN=MauticApiServicesBundle"
- "MAUTIC_PLUGIN=MauticSegmentExtrasBundle"

dist: precise

Expand Down
File renamed without changes
12 changes: 6 additions & 6 deletions Controller/SegmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
namespace MauticPlugin\MauticSegmentExtrasBundle\Controller;

use Mautic\CoreBundle\Controller\CommonController;
use Symfony\Component\HttpFoundation\StreamedResponse;

class SegmentController extends CommonController
{

public function batchExportAction($segmentId = null)
{

if(!$segmentId){
if (!$segmentId) {
return $this->notFound('mautic.segmentextras.export.notfound');
}
$contactIds = $this->getSegmentLeadIdsForExport($segmentId);
Expand Down Expand Up @@ -71,6 +70,7 @@ function ($f) {
}
fputcsv($handle, $values);
}
$contactRepo->clear();
}
fclose($handle);
},
Expand All @@ -88,8 +88,8 @@ public function getSegmentLeadIdsForExport($segmentId)
{
/** @var QueryBuilder $q */
$q = $this->get('doctrine.orm.entity_manager')->getConnection()->createQueryBuilder();
$q->select('ll.lead_id')
->from('lead_list_leads', 'lll')
$q->select('lll.lead_id')
->from('lead_lists_leads', 'lll')
->where(
$q->expr()->eq('lll.manually_removed', ':false'),
$q->expr()->eq('lll.leadlist_id', ':segmentId')
Expand All @@ -104,4 +104,4 @@ public function getSegmentLeadIdsForExport($segmentId)

return $contactIds;
}
}
}
54 changes: 54 additions & 0 deletions Integration/SegmentExtrasIntegration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/*
* @copyright 2018 Mautic Contributors. All rights reserved
* @author Digital Media Solutions, LLC
*
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

namespace MauticPlugin\MauticSegmentExtrasBundle\Integration;

use Mautic\PluginBundle\Integration\AbstractIntegration;

/**
* Class SegmentExtrasIntegration.
*
* This plugin does not add integrations. This is here purely for name/logo/etc.
*/
class SegmentExtrasIntegration extends AbstractIntegration
{
/**
* @return string
*/
public function getAuthenticationType()
{
return 'none';
}

/**
* @return array
*/
public function getSupportedFeatures()
{
return [];
}

/**
* @return string
*/
public function getName()
{
return 'SegmentExtras';
}

/**
* @return string
*/
public function getDisplayName()
{
return 'Segment Extras';
}
}
1 change: 0 additions & 1 deletion MauticSegmentExtrasBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ public function getParent()
{
return 'MauticLeadBundle';
}

}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Mautic Segment Extras [![Latest Stable Version](https://poser.pugx.org/thedmsgroup/mautic-api-services-bundle/v/stable)](https://packagist.org/packages/thedmsgroup/mautic-api-services-bundle) [![License](https://poser.pugx.org/thedmsgroup/mautic-api-services-bundle/license)](https://packagist.org/packages/thedmsgroup/mautic-api-services-bundle) [![Build Status](https://travis-ci.com/TheDMSGroup/mautic-enhancer.svg?branch=master)](https://travis-ci.com/TheDMSGroup/mautic-enhancer)
![](Assets/img/segment_extras.png)
# Mautic Segment Extras [![Latest Stable Version](https://poser.pugx.org/thedmsgroup/mautic-segment_extras-bundle/v/stable)](https://packagist.org/packages/thedmsgroup/mautic-api-services-bundle) [![License](https://poser.pugx.org/thedmsgroup/mautic-api-services-bundle/license)](https://packagist.org/packages/thedmsgroup/mautic-api-services-bundle) [![Build Status](https://travis-ci.com/TheDMSGroup/mautic-enhancer.svg?branch=master)](https://travis-ci.com/TheDMSGroup/mautic-enhancer)
![](Assets/img/SegmentExtras.png)

A bundle that extends Mautic Lead Bundle's Lead List (Segment) functionality.

Expand Down
27 changes: 0 additions & 27 deletions Views/LeadLists/index.html.php

This file was deleted.

167 changes: 167 additions & 0 deletions Views/List/list.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<?php

/*
* @copyright 2014 Mautic Contributors. All rights reserved
* @author Mautic
*
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
//Check to see if the entire page should be displayed or just main content
if ('index' == $tmpl):
$view->extend('MauticLeadBundle:List:index.html.php');
endif;
$listCommand = $view['translator']->trans('mautic.lead.lead.searchcommand.list');
?>

<?php if (count($items)): ?>
<div class="table-responsive">
<table class="table table-hover table-striped table-bordered" id="leadListTable">
<thead>
<tr>
<?php
echo $view->render(
'MauticCoreBundle:Helper:tableheader.html.php',
[
'checkall' => 'true',
'target' => '#leadListTable',
'langVar' => 'lead.list',
'routeBase' => 'segment',
'templateButtons' => [
'delete' => $permissions['lead:lists:deleteother'],
],
]
);

echo $view->render(
'MauticCoreBundle:Helper:tableheader.html.php',
[
'sessionVar' => 'segment',
'orderBy' => 'l.name',
'text' => 'mautic.core.name',
'class' => 'col-leadlist-name',
]
);

echo $view->render(
'MauticCoreBundle:Helper:tableheader.html.php',
[
'sessionVar' => 'segment',
'text' => 'mautic.lead.list.thead.leadcount',
'class' => 'visible-md visible-lg col-leadlist-leadcount',
]
);

echo $view->render(
'MauticCoreBundle:Helper:tableheader.html.php',
[
'sessionVar' => 'segment',
'orderBy' => 'l.id',
'text' => 'mautic.core.id',
'class' => 'visible-md visible-lg col-leadlist-id',
]
);
?>
</tr>
</thead>
<tbody>
<?php foreach ($items as $item): ?>
<?php $mauticTemplateVars['item'] = $item; ?>
<tr>
<td>
<?php
echo $view->render(
'MauticCoreBundle:Helper:list_actions.html.php',
[
'item' => $item,
'templateButtons' => [
'edit' => $view['security']->hasEntityAccess(true, $permissions['lead:lists:editother'], $item->getCreatedBy()),
'clone' => $view['security']->hasEntityAccess(true, $permissions['lead:lists:editother'], $item->getCreatedBy()),
'delete' => $view['security']->hasEntityAccess(true, $permissions['lead:lists:deleteother'], $item->getCreatedBy()),
],
'routeBase' => 'segment',
'langVar' => 'lead.list',
'custom' => [
[
'attr' => [
'data-toggle' => 'ajax',
'href' => $view['router']->path(
'mautic_contact_index',
[
'search' => "$listCommand:{$item->getAlias()}",
]
),
],
'icon' => 'fa-users',
'label' => 'mautic.lead.list.view_contacts',
],
],
]
);
?>
</td>
<td>
<div>
<?php echo $view->render(
'MauticCoreBundle:Helper:publishstatus_icon.html.php',
['item' => $item, 'model' => 'lead.list']
); ?>
<?php if ($view['security']->hasEntityAccess(true, $permissions['lead:lists:editother'], $item->getCreatedBy())) : ?>
<a href="<?php echo $view['router']->path(
'mautic_segment_action',
['objectAction' => 'view', 'objectId' => $item->getId()]
); ?>" data-toggle="ajax">
<?php echo $item->getName(); ?> (<?php echo $item->getAlias(); ?>)
</a>
<?php else : ?>
<?php echo $item->getName(); ?> (<?php echo $item->getAlias(); ?>)
<?php endif; ?>
<?php if (!$item->isGlobal() && $currentUser->getId() != $item->getCreatedBy()): ?>
<br/>
<span class="small">(<?php echo $item->getCreatedByUser(); ?>)</span>
<?php endif; ?>
<?php if ($item->isGlobal()): ?>
<i class="fa fa-fw fa-globe"></i>
<?php endif; ?>
<?php echo $view['content']->getCustomContent('segment.name', $mauticTemplateVars); ?>
</div>
<?php if ($description = $item->getDescription()): ?>
<div class="text-muted mt-4">
<small><?php echo $description; ?></small>
</div>
<?php endif; ?>
</td>
<td class="visible-md visible-lg">
<a class="label label-primary" href="<?php echo $view['router']->path(
'mautic_segment_extras_batch_export',
['segmentId'=> $item->getId()]
); ?>" <?php echo (0 == $leadCounts[$item->getId()]) ? 'disabled=disabled' : ''; ?>>
<?php echo $view['translator']->transChoice(
'mautic.lead.list.viewleads_count',
$leadCounts[$item->getId()],
['%count%' => $leadCounts[$item->getId()]]
); ?>
</a>
</td>
<td class="visible-md visible-lg"><?php echo $item->getId(); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="panel-footer">
<?php echo $view->render(
'MauticCoreBundle:Helper:pagination.html.php',
[
'totalItems' => count($items),
'page' => $page,
'limit' => $limit,
'baseUrl' => $view['router']->path('mautic_segment_index'),
'sessionVar' => 'segment',
]
); ?>
</div>
</div>
<?php else: ?>
<?php echo $view->render('MauticCoreBundle:Helper:noresults.html.php'); ?>
<?php endif; ?>

0 comments on commit 0b9bd8b

Please sign in to comment.