Class Components_model - echiong/testRepo GitHub Wiki

##Class Components_model

Package: [[application<a href="Package application.models.md">models]]
Located at application/models/components_model.php

##Methods summary


public integer create ( array $data, string $component, mixed $user = false )

Create a components record for the user and updates the Users.Stats<component>

Parameters

$data array
$data Component record data.

$component string
$component Component type.

$user

Returns integer
$user Component record id created.

Used by Beats::create_submit() flow_deejaybauff/Main::video_upload_submit() Lyrics::create_submit() Videos::youtube_store() Videos::youtube_import() Videos::vimeo_store() Videos::vimeo_import() Voices::create_submit() Beats::create_submit() Videos::youtube_store() Videos::youtube_import() Videos::vimeo_store() Videos::vimeo_import() Voices::create_submit()


public object|boolean get ( integer $id, string $component, string $scope = 'normal' )

Returns a component record based on component ID.

Parameters

$id integer
$id Component record id.

$component string
$component Component type.

$scope string
$scope Component scope flag, you can provide a comma separated list of related data you'd like to get in return. e.g. 'users' or 'users,comments'

Returns object|boolean
Returns a results object on success or boolean false on failure.

Uses Comments_model::get_by_component() Used by Beats::get_list() Beats::get() Beats::details() Components::record_play() Components::get_list() Feats::create_submit() Feats::load_components() Lyrics::details() Lyrics::get_list() Lyrics::get() Users::add_favorite() Videos::get_list() Videos::get() Videos::details() Voices::get_list() Voices::get() Voices::details() Beats::get_list() Beats::get() Beats::details() Components::record_play() Components::get_list() Users::add_favorite() Videos::get_list() Videos::get() Videos::details() Voices::get_list() Voices::get() Voices::details()


public array get_in ( array $ids, string $componentType, string $scope = 'normal' )

Parameters

$ids array
$ids - IDs of components

$componentType string
$componentType - Type of component

$scope string
$scope - Extra data to query for. Comma-separated. (i.e., "user, comments")

Returns array
ALWAYS an array of object.


public null add_scope ( string $scopeType, string $componentType, object & $componentData )

Magic method for attaching additional scopes to components. Looks up a method named _add_[scope]_scope in the components_model. If found, component data is passed and duly modified to add the extra data. Original object is passed by reference and will be modified.

Parameters

$scopeType string
$scopeType

$componentType string
$componentType

$componentData object
$componentData

Returns null


public object|boolean get_list ( string $component, integer $offset = 0, integer $limit = 100, string $query = false, string $tag = false, float $bpm = false, boolean $order_by = false, boolean $price = false, boolean $free = false, boolean $premium = false )

Returns a list of components.

Parameters

$component string
$component Component type.

$offset integer
$offset Numeric offset value.

$limit integer
$limit Numeric limit value.

$query string
$query Query condition filter.

$tag string
$tag Tag-based condition filter.

$bpm float
$bpm BPM-based condition filter.

$order_by boolean
order_by Order by-based condition filter

$price boolean
$price price-based condition filter

$free boolean
$free free-based condition filter

$premium boolean
$premium premium-based condition filter

Returns object|boolean
A resulting object on success or boolean false on failure.

Used by Beats::get_list() Components::get_list() Lyrics::get_list() Videos::get_list() Voices::get_list() Beats::get_list() Components::get_list() Videos::get_list() Voices::get_list()


public object[] user ( string $component, integer $id = null )

Returns a specific user's list of components

Parameters

$component string
$component Component type

$id integer
$id Component record ID

Returns object[]

Used by Users::details() Users::details()


public boolean delete ( string $component, integer $id )

Deletes a component record.

Parameters

$component string
Component type.

$id integer
Component record ID.

Returns boolean
Boolean true on success or false on failure.

Used by Components::delete() Components::delete()


public edit ( integer $id, string $component, array $data )

Edits a component record.

Parameters

$id integer
$id Component record ID

$component string
$component Component type

$data array
$data Component data

Used by Beats::edit_submit() Feats::edit_submit() Lyrics::edit_submit() Videos::edit_submit() Voices::edit_submit() Beats::edit_submit() Videos::edit_submit() Voices::edit_submit()


public browse ( mixed $category, mixed $license = null, mixed $order = null, mixed $limit = 25 )


public increment_stat ( string $component, integer $id, string $field )

Increments <Component>.<stat_field>

Parameters

$component string
Component type.

$id integer
Component record id.

$field string
Component field name.

Used by Components::record_play() Download::_record_audio_download() Feats::create_submit() User::add_favorite() Components::record_play() Download::_record_audio_download() Users::add_favorite()


public decrement_stat ( string $component, integer $id, string $field )

Decrements <Component>.<stat_field>

Parameters

$component string
Component type.

$id integer
Component record id.

$field string
Component field name.

Used by Components::delete() Components::delete()


public object|boolean getComponent ( string $component )

Returns all of the users Component records. Note: this might be deprecated. Need to confirm.

Parameters

$component string
Component type.

Returns object|boolean
Resulting data on success or false on failure.

Used by Feats::load_components()

Methods inherited from CI_Model

__construct()

__get()

⚠️ **GitHub.com Fallback** ⚠️