Class Socialveo\Frontend\controllers\MediaController

InheritanceSocialveo\Frontend\controllers\MediaController » Socialveo\Frontend\controllers\FrontendController » Phalcon\Mvc\Controller
Uses TraitsSocialveo\Core\Translatable

Class MediaController

Public Methods

Hide inherited methods

MethodDescriptionDefined By
_t() Gets translations Socialveo\Core\Translatable
afterExecuteRoute() Socialveo\Frontend\controllers\FrontendController
beforeExecuteRoute() Before execute route Socialveo\Frontend\controllers\FrontendController
createAction() Create media Socialveo\Frontend\controllers\MediaController
deleteAction() Removes a media (soft-delete) Socialveo\Frontend\controllers\MediaController
fire() Fire custom event Socialveo\Frontend\controllers\FrontendController
getAction() Returns a media Socialveo\Frontend\controllers\MediaController
getEmbed() Embed getter method, if embed property is not set, fetches embed from request URL Socialveo\Frontend\controllers\FrontendController
getIsRequestPjax() Checks whether is requested via jquery.pjax Socialveo\Frontend\controllers\FrontendController
getLanguage() Gets language code Socialveo\Frontend\controllers\FrontendController
getParams() Gets $_REQUEST superglobal Socialveo\Frontend\controllers\FrontendController
getRequired() Get required param / params Socialveo\Frontend\controllers\FrontendController
getRequiredQuery() Get required param / params from $_GET Socialveo\Frontend\controllers\FrontendController
imageAction() Socialveo\Frontend\controllers\MediaController
initialize() Initialize controller Socialveo\Frontend\controllers\FrontendController
listAction() Returns a list of media resources Socialveo\Frontend\controllers\MediaController
notFound() Not found action Socialveo\Frontend\controllers\FrontendController
partialRender() Renders partial view without layout Socialveo\Frontend\controllers\FrontendController
pick() Pick view Socialveo\Frontend\controllers\FrontendController
posts() Find posts and attach to page Socialveo\Frontend\controllers\FrontendController
setDebugHeaders() Sets headers for debug XHR Socialveo\Frontend\controllers\FrontendController
setHttpCode() Set response Http code Socialveo\Frontend\controllers\FrontendController
t() Gets translations Socialveo\Core\Translatable
updateAction() Updates a media Socialveo\Frontend\controllers\MediaController

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
checkAccess() Checks during the init of controller whether user is a guest. Socialveo\Frontend\controllers\FrontendController
checkIsAjax() Checks whether request is AJAX, redirect if false Usage in action: if (!$this->checkIsAjax()) { return false; } Socialveo\Frontend\controllers\FrontendController
getSocketData() Returns socket events Socialveo\Frontend\controllers\FrontendController
getTranslation() Gets translations Socialveo\Frontend\controllers\FrontendController
initAssets() Initialize assets Socialveo\Frontend\controllers\FrontendController
initViewVars() Sets view vars. Socialveo\Frontend\controllers\FrontendController
redirect() Redirect to url Socialveo\Frontend\controllers\FrontendController
reload() Reload the page Socialveo\Frontend\controllers\FrontendController
renderDefault() Render default page Socialveo\Frontend\controllers\FrontendController
respondWithArray() Returns an error response with an array Socialveo\Frontend\controllers\FrontendController
respondWithItem() Returns a response with a single item Socialveo\Frontend\controllers\FrontendController
respondWithStatus() Returns a response with status and message Socialveo\Frontend\controllers\FrontendController
responseError() Respond with error Socialveo\Frontend\controllers\FrontendController
responseJson() Response json Socialveo\Frontend\controllers\FrontendController
responseSuccess() Respond with success Socialveo\Frontend\controllers\FrontendController

Method Details

createAction() public method

Create media

/api/v1/media/{uuid}

CAUTION: Request content-type has to be multipart/form-data

Method: POST

Parameters: --|:--:|--- file | required | media file to be uploaded name | required | name of the media object media_type | required | type of media: image, video, embed


Sample response: `json {

'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
'media_type': 'local',
'name': 'Our vacation',
'src': 'img/sample.jpg',
'cdn': null,
'queued': 0,
'mime_type': 'image/jpeg',
'file_size': 192502,
'target_uuid': null,
'target_type': null,
'properties': null,
'created': '2015-02-16 15:22:13',
'updated': '2015-02-16 15:22:13'

} `


*
public Socialveo\Core\models\Media createAction ( )
return Socialveo\Core\models\Media

Object

deleteAction() public method

Removes a media (soft-delete)

/api/v1/media/{uuid}

DELETE

Parameters: This action accepts no properties


Sample response: `json {

'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
'media_type': 'local',
'name': 'Our vacation',
'src': 'img/sample.jpg',
'cdn': null,
'queued': 0,
'mime_type': 'image/jpeg',
'file_size': 192502,
'target_uuid': '32227ec2-b5e7-11e4-81dc-b88d1200a92c',
'target_type': 'post',
'properties': null,
'created': '2015-02-16 15:22:13',
'updated': '2015-02-16 15:22:13'

} `


*
public Socialveo\Core\models\Media deleteAction ( $media_uuid )
$media_uuid string
return Socialveo\Core\models\Media

Object

getAction() public method

Returns a media

/api/v1/media/{uuid}

Method: GET

Parameters: --|:--:|--- embed | optional | allows to include one or more child resource(s) in the response


Sample response: `json {

'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
'media_type': 'local',
'name': 'Our vacation',
'src': 'img/sample.jpg',
'cdn': null,
'queued': 0,
'mime_type': 'image/jpeg',
'file_size': 192502,
'target_uuid': '32227ec2-b5e7-11e4-81dc-b88d1200a92c',
'target_type': 'post',
'properties': null,
'created': '2015-02-16 15:22:13',
'updated': '2015-02-16 15:22:13'

} `


*
public Socialveo\Core\models\Media getAction ( $media_uuid )
$media_uuid
return Socialveo\Core\models\Media

Object

imageAction() public method

public Phalcon\Http\Response imageAction ( $uuid )
$uuid string
listAction() public method

Returns a list of media resources

/api/v1/media

Method: GET

Parameters: --|:--:|--- page|optional|current page indicator (pagination) perpage|optional|items per page (pagination) sortby[property]=order|optional|sort by property value, order either desc or asc filterby[property][operator]=value|optional|filter (limit results) by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), like uuids|optional|list of item UUIDs to fetch, separated by commas. when used, no other properties can be utilized


Sample query: /api/v1/media?page=2&perpage=20&filterby[target_uuid][eq]=847d7974-b5e7-11e4-a4e3-b88d1200a93c


Sample response: `json [{

'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
'media_type': 'local',
'name': 'Our vacation',
'src': 'img/sample.jpg',
'cdn': null,
'queued': 0,
'mime_type': 'image/jpeg',
'file_size': 192502,
'target_uuid': '32227ec2-b5e7-11e4-81dc-b88d1200a92c',
'media_type': 'post',
'properties': null,
'created': '2015-02-16 15:22:13',
'updated': '2015-02-16 15:22:13'

}, {..}, {..}] `


*
public Socialveo\Core\models\Media listAction ( )
return Socialveo\Core\models\Media

Object

updateAction() public method

Updates a media

/api/v1/media/{uuid}

PUT

Parameters: --|:--:|--- name | optional | media object name (caption) target_uuid | optional | the UUID of target item (eg. post) target_type | optional | the type of target item (eg. post, comment, etc.) properties | optional | additional properties attached to media object


Sample response: `json {

'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
'media_type': 'local',
'name': 'Our vacation',
'src': 'img/sample.jpg',
'cdn': null,
'queued': 0,
'mime_type': 'image/jpeg',
'file_size': 192502,
'target_uuid': '32227ec2-b5e7-11e4-81dc-b88d1200a92c',
'target_type': 'post',
'properties': null,
'created': '2015-02-16 15:22:13',
'updated': '2015-02-16 15:22:13'

} `


*
public Socialveo\Core\models\Media updateAction ( $media_uuid )
$media_uuid string
return Socialveo\Core\models\Media

Object

throws Exception

Object not found