controllers / media.php
Media
Controller
The media controller manages all media on the server. It also manages acceptable formats, searching, versioning, and archiving for media items.
public
archive
(
)
public
archive
(
)
Archive media items. Requires the 'manage_media' permission.
id |
An array of media IDs. Can be a single ID. |
public
delete
(
)
public
delete
(
)
Delete archived or unapproved media items. Requires 'manage_media' permission. Will return an error if any of the media items aren't archived or unapproved.
id |
An array of media IDs. Can be a single ID. |
public
formats_get
(
)
public
formats_get
(
)
Return all acceptable media formats.
formats
public
formats_save
(
)
public
formats_save
(
)
Update the acceptable media formats table. Video, image, and audio formats are set separately. Requires the 'manage_media_settings' permission.
video_formats |
|
image_formats |
|
audio_formats |
public
get
(
)
public
get
(
)
Get a single media item.
id |
media
public
media_my_searches
(
)
public
media_my_searches
(
)
Return media search history and saved searches for currently logged in user.
[saved, history]
public
media_my_searches_default
(
)
public
media_my_searches_default
(
)
Set a search item to be part of the default search for the current user. This means that simple searches will by default include the filters specified here.
id |
public
media_my_searches_delete
(
)
public
media_my_searches_delete
(
)
Delete a search query from the user's saved searches.
id |
public
media_my_searches_edit
(
)
public
media_my_searches_edit
(
)
Edit a search query in the user's saved searches.
id |
|
filters |
|
description |
public
media_my_searches_save
(
)
public
media_my_searches_save
(
)
Saves an item by moving it from 'history' to 'saved' in the media searches table.
id |
public
media_my_searches_unset_default
(
)
public
media_my_searches_unset_default
(
)
Unset a default search filter for the current user.
id |
public
save
(
)
public
save
(
)
Edit media items. Can update more than a single item at once. User requires 'create_own_media' or 'manage_media' permissions to update media items. Also, 'media_advanced_permissions' is required to update any of the advanced permissions fields. Media gets validated, and will only be updated if validation succeeds for all provided items. This method gets information from the Uploads model and makes sure to add that to the media items.
media |
The media items to update. |
public
search
(
)
public
search
(
)
Search the media tables for one or more items.
q |
Query |
l |
Limit |
o |
Offset |
sort_by |
|
sort_dir |
|
s |
Status |
my |
Ownership. Set to filter for media items owned by user. |
save_history |
Save to search history if set and we're in advanced search mode. |
[num_results, media]
public
unarchive
(
)
public
unarchive
(
)
Unarchive media items. Requires 'manage_media' permission.
id |
An array of media IDs. Can be a single ID. |
private
user_can_edit
(
media
)
private
user_can_edit
(
media
)
Returns a boolean value determining whether the current user can edit the provided media item. Private method used by a number of other methods in this controller. The rules go as follows:
If the user has the 'manage_media' permission, return TRUE. If the media item is owned by the user AND the user has the 'create_own_media' permission, return TRUE. If the user is in the permissions column for the specified media item, return TRUE. If one of the user's groups is in the groups permissions column for the specified media item, return TRUE. Otherwise, return FALSE.
media |
The media item to check. An associative array containing information about the item, including the ID. |
can_edit
public
version_add
(
)
public
version_add
(
)
Add new media version file.
media_id |
|
file_id |
|
file_key |
public
version_delete
(
)
public
version_delete
(
)
Delete media version.
media_id |
|
created |
Version timestamp |
public
version_edit
(
)
public
version_edit
(
)
Edit media version.
media_id |
|
created |
Version timestamp |
notes |
public
version_set
(
)
public
version_set
(
)
Set media active version.
media_id |
|
created |
Version timestamp |
public
versions
(
)
public
versions
(
)
Get media versions.
media_id |
[versions, media]
private
versions_require_permission
(
media_id
)
private
versions_require_permission
(
media_id
)
Checks that user can manage versions for media item. Does not return true or false, but can throw a permissions error using 'require_permissions'. Private method used by other version methods in this controller.
media_id |