Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @author jfalvarez
- */
- class Api_SocialController extends Zend_Rest_Controller {
- /**
- *
- * @var array
- */
- public $contexts = array(
- "get" => array( "json", "xml" ),
- "index" => array( "json", "xml" ),
- );
- public function init() {
- $format = $this->_getParam( "format" );
- if ( true === empty( $format ) ) {
- $this->_setParam( "format", "json" );
- }
- $this->_helper->contextSwitch->initContext();
- }
- public function indexAction() {
- $friend = new Application_Model_Friend();
- $notification = new Application_Model_Notification();
- $this->view->countNotifications = $notification->count();
- }
- public function getAction() {
- $type = strtolower( $this->_getParam( "type" ) );
- switch ( $type ) {
- case "notification":
- return $this->notificationAction();
- break;
- }
- }
- public function deleteAction() {
- }
- public function postAction() {
- $type = $this->_getParam( "type" );
- switch ( strtolower( $type ) ) {
- case "notification":
- break;
- default:
- throw new Exception( "operation type not implemented yet" );
- break;
- }
- }
- public function putAction() {
- }
- public function notificationAction() {
- $notification = new App_View_Helper_Notifications();
- return $this->getResponse()->setBody( $notification->notifications() )
- ->sendResponse();
- }
- }
Add Comment
Please, Sign In to add comment