Guest User

Untitled

a guest
Jan 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. *
  5. * @author jfalvarez
  6. */
  7. class Api_SocialController extends Zend_Rest_Controller {
  8. /**
  9. *
  10. * @var array
  11. */
  12. public $contexts = array(
  13. "get" => array( "json", "xml" ),
  14. "index" => array( "json", "xml" ),
  15. );
  16.  
  17. public function init() {
  18. $format = $this->_getParam( "format" );
  19.  
  20. if ( true === empty( $format ) ) {
  21. $this->_setParam( "format", "json" );
  22. }
  23.  
  24. $this->_helper->contextSwitch->initContext();
  25. }
  26.  
  27. public function indexAction() {
  28. $friend = new Application_Model_Friend();
  29. $notification = new Application_Model_Notification();
  30. $this->view->countNotifications = $notification->count();
  31. }
  32.  
  33. public function getAction() {
  34. $type = strtolower( $this->_getParam( "type" ) );
  35. switch ( $type ) {
  36. case "notification":
  37. return $this->notificationAction();
  38. break;
  39. }
  40. }
  41.  
  42. public function deleteAction() {
  43. }
  44.  
  45. public function postAction() {
  46. $type = $this->_getParam( "type" );
  47.  
  48. switch ( strtolower( $type ) ) {
  49. case "notification":
  50. break;
  51. default:
  52. throw new Exception( "operation type not implemented yet" );
  53. break;
  54. }
  55. }
  56.  
  57. public function putAction() {
  58. }
  59.  
  60. public function notificationAction() {
  61. $notification = new App_View_Helper_Notifications();
  62. return $this->getResponse()->setBody( $notification->notifications() )
  63. ->sendResponse();
  64. }
  65. }
Add Comment
Please, Sign In to add comment