"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "public_html/lists/admin/plugins/SegmentPlugin/SubscriberConditionActivity.php" between
phplist-3.4.9.tgz and phplist-3.5.0.tgz

About: phpList is a one-way email announcement delivery system for newsletters, publicity lists, notifications, and many other uses (requires PHP and MySQL).

SubscriberConditionActivity.php  (phplist-3.4.9.tgz):SubscriberConditionActivity.php  (phplist-3.5.0.tgz)
skipping to change at line 28 skipping to change at line 28
* @author Duncan Cameron * @author Duncan Cameron
* @copyright 2014-2016 Duncan Cameron * @copyright 2014-2016 Duncan Cameron
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, V ersion 3 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, V ersion 3
*/ */
/** /**
* @category phplist * @category phplist
*/ */
class SegmentPlugin_SubscriberConditionActivity extends SegmentPlugin_Condition class SegmentPlugin_SubscriberConditionActivity extends SegmentPlugin_Condition
{ {
private $aggregatedCaptions;
private $aggregatedIntervals;
public function __construct($field)
{
parent::__construct($field);
$this->aggregatedCaptions = [
'last7day' => s('Any campaigns within the last 7 days'),
'last1month' => s('Any campaigns within the last 1 month'),
'last3month' => s('Any campaigns within the last 3 months'),
];
$this->aggregatedIntervals = [
'last7day' => '7 DAY',
'last1month' => '1 MONTH',
'last3month' => '3 MONTH',
];
}
public function operators() public function operators()
{ {
return array( return array(
SegmentPlugin_Operator::SENT => s('was sent'), SegmentPlugin_Operator::SENT => s('was sent'),
SegmentPlugin_Operator::NOTSENT => s('was not sent'), SegmentPlugin_Operator::NOTSENT => s('was not sent'),
SegmentPlugin_Operator::OPENED => s('opened'), SegmentPlugin_Operator::OPENED => s('opened'),
SegmentPlugin_Operator::NOTOPENED => s('did not open'), SegmentPlugin_Operator::NOTOPENED => s('did not open'),
SegmentPlugin_Operator::CLICKED => s('clicked'), SegmentPlugin_Operator::CLICKED => s('clicked'),
SegmentPlugin_Operator::NOTCLICKED => s('did not click'), SegmentPlugin_Operator::NOTCLICKED => s('did not click'),
); );
skipping to change at line 50 skipping to change at line 69
public function display($op, $value, $namePrefix) public function display($op, $value, $namePrefix)
{ {
if (!(is_array($this->messageData['targetlist']) && count($this->message Data['targetlist']) > 0)) { if (!(is_array($this->messageData['targetlist']) && count($this->message Data['targetlist']) > 0)) {
return ''; return '';
} }
$campaigns = $this->dao->campaigns(null, getConfig('segment_campaign_max '), array_keys($this->messageData['targetlist'])); $campaigns = $this->dao->campaigns(null, getConfig('segment_campaign_max '), array_keys($this->messageData['targetlist']));
if (count($campaigns) == 0) { if (count($campaigns) == 0) {
return s('No campaigns have been sent to the selected lists'); return s('No campaigns have been sent to the selected lists');
} }
$listData = [];
if ($op == SegmentPlugin_Operator::OPENED || $op == SegmentPlugin_Operat
or::NOTOPENED) {
$listData['Aggregated Campaigns'] = $this->aggregatedCaptions;
}
$listData['Sent Campaigns'] = CHtml::listData($campaigns, 'id', 'subject
');
return CHtml::dropDownList( return CHtml::dropDownList(
$namePrefix . '[value]', $namePrefix . '[value]',
$value, $value,
CHtml::listData($campaigns, 'id', 'subject'), $listData,
['class' => 'campaigns'] ['class' => 'campaigns']
); );
} }
public function joinQuery($operator, $value) public function joinQuery($operator, $value)
{ {
if (!ctype_digit($value)) { if (ctype_digit($value)) {
return $this->joinQuerySingleCampaign($operator, $value);
}
if (!isset($this->aggregatedIntervals[$value])) {
throw new SegmentPlugin_ValueException(); throw new SegmentPlugin_ValueException();
} }
return $this->joinQueryAggregate($operator, $this->aggregatedIntervals[$
value]);
}
private function joinQueryAggregate($operator, $interval)
{
$r = new stdClass();
if ($operator == SegmentPlugin_Operator::OPENED || $operator == SegmentP
lugin_Operator::NOTOPENED) {
$negate = $operator == SegmentPlugin_Operator::OPENED ? '' : 'NOT';
$umv = $this->createUniqueAlias('umv');
$r->join = '';
$r->where = <<<END
$negate EXISTS (
SELECT * FROM {$this->tables['user_message_view']} $umv
WHERE u.id = $umv.userid AND DATE_SUB(CURDATE(), INTERVAL $i
nterval) < $umv.viewed
)
END;
}
return $r;
}
private function joinQuerySingleCampaign($operator, $value)
{
$um = $this->createUniqueAlias('um'); $um = $this->createUniqueAlias('um');
$uml = $this->createUniqueAlias('uml'); $uml = $this->createUniqueAlias('uml');
$r = new stdClass(); $r = new stdClass();
if ($operator == SegmentPlugin_Operator::CLICKED || $operator == Segment Plugin_Operator::NOTCLICKED) { if ($operator == SegmentPlugin_Operator::CLICKED || $operator == Segment Plugin_Operator::NOTCLICKED) {
$op = $operator == SegmentPlugin_Operator::CLICKED ? 'IS NOT NULL' : 'IS NULL'; $op = $operator == SegmentPlugin_Operator::CLICKED ? 'IS NOT NULL' : 'IS NULL';
$r->join = <<<END $r->join = <<<END
JOIN {$this->tables['usermessage']} $um ON u.id = $um.userid AND $um.status = 'sent' AND $um.messageid = $value JOIN {$this->tables['usermessage']} $um ON u.id = $um.userid AND $um.status = 'sent' AND $um.messageid = $value
LEFT JOIN {$this->tables['linktrack_uml_click']} $uml ON u.id = $uml.userid AND $uml.messageid = $um.messageid LEFT JOIN {$this->tables['linktrack_uml_click']} $uml ON u.id = $uml.userid AND $uml.messageid = $um.messageid
END; END;
 End of changes. 5 change blocks. 
2 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)