2007-07-19 12:40:05 +02:00
|
|
|
<?php
|
2007-09-16 04:17:51 +02:00
|
|
|
class BouncedList extends FormField {
|
2007-07-19 12:40:05 +02:00
|
|
|
|
|
|
|
protected $nlType;
|
|
|
|
|
|
|
|
function __construct( $name, $newsletterType ) {
|
2007-09-16 04:17:51 +02:00
|
|
|
parent::__construct( $name, '', null );
|
2007-07-19 12:40:05 +02:00
|
|
|
|
|
|
|
if( is_object( $newsletterType ) )
|
|
|
|
$this->nlType = $newsletterType;
|
|
|
|
else
|
|
|
|
$this->nlType = DataObject::get_by_id( 'NewsletterType', $newsletterType );
|
|
|
|
}
|
|
|
|
|
|
|
|
function setController($controller) {
|
|
|
|
$this->controller = $controller;
|
|
|
|
}
|
2007-09-16 04:17:51 +02:00
|
|
|
|
|
|
|
function FieldHolder() {
|
|
|
|
return $this->renderWith( 'NewsletterAdmin_BouncedList' );
|
|
|
|
}
|
|
|
|
|
2007-07-19 12:40:05 +02:00
|
|
|
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,
|
2007-09-16 04:17:51 +02:00
|
|
|
'GroupID' => $id,
|
2007-07-19 12:40:05 +02:00
|
|
|
'Member' => DataObject::get_by_id( 'Member', $bounceRecord->MemberID )
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return new DataObjectSet( $bouncedUsers );
|
|
|
|
}
|
2007-09-16 04:17:51 +02:00
|
|
|
}
|
|
|
|
?>
|