<?php

  /* 
   * This file is (c) Copyright 2009 by Olivier BERGER, Institut
   * TELECOM
   *
   * Use, modification, redistribution of this software are subject to
   * the terms of the NEW BSD License, whose text can be found in the
   * 'COPYING' file that is distributed along with the software archive.
   *
   * Thus you may use it at your own risk, of course !
   *
   * This program has been developed in the frame of the HELIOS
   * project with financial support of its funders.
   *
   */

  /* $Id$ */

$entriescount = count($this->collection);

$json = array('oslc_cm:totalCount' => $entriescount);

$resources = array();

foreach ($this->collection as $resource) {
	$newresource = array();
	$newresource['rdf:about'] = $resource['id'];
	foreach ($resource['resource'] as $key => $value) {
		$newresource[$key] = $value;
	}
	$resources[] = $newresource;
}

$json['oslc_cm:results'] = $resources;

//print_r($json);


print str_replace("\/", "/", Zend_Json::prettyPrint(Zend_Json::encode($json)));