Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bertrandom
Created August 3, 2009 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bertrandom/160861 to your computer and use it in GitHub Desktop.
Save bertrandom/160861 to your computer and use it in GitHub Desktop.
<?php
/**
* iphone actions.
*
* @package twonodes
* @subpackage iphone
* @author Bertrand Fan <b*******@fan.net>
* @version SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
*/
class iphoneActions extends sfActions {
public function executeRoom() {
$room = RoomPeer::retrieveByPk($this->getRequestParameter('id'));
$data = array(
'status' => 'success',
'id' => $room->getRoomid(),
'name' => $room->getName(),
'picture' => $room->getPicturePath(424, 318),
'exits' => array()
);
$factor = 424/640;
foreach ($room->getExits() as $exit) {
$data['exits'][] = array(
'id' => $exit->getToroomid(),
'x' => round($exit->getX() * $factor),
'y' => round($exit->getY() * $factor),
'width' => round($exit->getWidth() * $factor),
'height' => round($exit->getHeight() * $factor)
);
}
echo json_encode($data);
return sfView::NONE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment