Created
August 3, 2009 22:09
-
-
Save bertrandom/160861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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