Skip to content

Commit

Permalink
[NF] Euro-IX export of members list
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Jun 10, 2014
1 parent c48c843 commit 0a90b19
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions application/modules/apiv1/controllers/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,39 @@ class Apiv1_CustomerController extends IXP_Controller_API_V1Action
public function detailsAction()
{
Zend_Controller_Action_HelperBroker::removeHelper( 'viewRenderer' );

$user = $this->assertUserPriv( \Entities\User::AUTH_SUPERUSER );

$customers = $this->getD2EM()->getRepository( '\\Entities\\Customer' )->getCurrentActive(
true,
$this->getParam( 'trafficing', false ) ? true : false,
$this->getParam( 'externalonly', false ) ? true : false,
is_int( $this->getParam( 'ixp', false ) ) ? $this->getParam( 'ixp', false ) : false
);

$this->getResponse()->setHeader( 'Content-Type', 'application/json' );
echo json_encode( $customers );
}

public function euroixExportAction()
{
Zend_Controller_Action_HelperBroker::removeHelper( 'viewRenderer' );

$customers = $this->getD2EM()->getRepository( '\\Entities\\Customer' )->getCurrentActive(
false,
$this->getParam( 'trafficing', true ) ? true : false,
$this->getParam( 'externalonly', true ) ? true : false,
is_int( $this->getParam( 'ixp', false ) ) ? $this->getParam( 'ixp', false ) : false
);

$this->getResponse()->setHeader( 'Content-Type', 'text/plain' );

foreach( $customers as $c )
{
echo sprintf( "%s;%s;%s;%s\n", str_replace( ';', '-', $c->getName() ),
$c->getAutsys(), $c->getCorpwww(),
$c->isRouteServerClient() ? 'Yes' : 'No'
);
}
}
}

0 comments on commit 0a90b19

Please sign in to comment.