silverstripe-reports/code/Newsletter/BouncedList.php
Ingo Schommer 706580c443 elofgren: NEW FEATURE: Make it possible to blacklist and remove bounced Newsletter recipients from the Bounced tab of the Mailing List. @TODO: Make this features work corectly in IE.
Make class BouncedList? just extend FormField? like it used to, extending TableListField? added unneeded complexity. 
Remove the unused Save button from the 'Mailing List' section. Fixes gsoc track ticket: #26 Remove uneeded "Save" button in "Mailing List" section of Newsletters 
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42039 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-09-16 02:17:51 +00:00

47 lines
1.3 KiB
PHP
Executable File

<?php
class BouncedList extends FormField {
protected $nlType;
function __construct( $name, $newsletterType ) {
parent::__construct( $name, '', null );
if( is_object( $newsletterType ) )
$this->nlType = $newsletterType;
else
$this->nlType = DataObject::get_by_id( 'NewsletterType', $newsletterType );
}
function setController($controller) {
$this->controller = $controller;
}
function FieldHolder() {
return $this->renderWith( 'NewsletterAdmin_BouncedList' );
}
function Entries() {
$id = $this->nlType->GroupID;
$bounceRecords = DataObject::get( 'Email_BounceRecord', "`GroupID`='$id'", null, "INNER JOIN `Group_Members` USING(`MemberID`)" );
//user_error($id, E_USER_ERROR );
if( !$bounceRecords )
return null;
foreach( $bounceRecords as $bounceRecord ) {
if( $bounceRecord ) {
$bouncedUsers[] = new ArrayData( array(
'Record' => $bounceRecord,
'GroupID' => $id,
'Member' => DataObject::get_by_id( 'Member', $bounceRecord->MemberID )
));
}
}
return new DataObjectSet( $bouncedUsers );
}
}
?>