Class Feats_model - echiong/testRepo GitHub Wiki

##Class Feats_model

Feats_model handles feats related data operations.

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

##Methods summary


public integer create ( object $data )

Create a feats record for the user and updates the Users.StatsFeats

Parameters

$data object
$data This contains the data to create a feats record usedby Feats::create_submit()

Returns integer
id record created


public delete ( mixed $id )


public edit ( mixed $id, mixed $data )


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


public array user ( integer $userID, string $scope = 'authors' )

Retrieves all the feats of a specific user.

Parameters

$userID integer
$userID The user ID

$scope string
$scope The scope

Returns array

Used by Feats::mine() Showcases::mine() Users::details()


public array get_components ( integer $featId, string $scope = 'normal', array & $contributors = null )

Returns the components used in a feat.

Result format:

$result->video = [Video object] $result->lyrics = array ( [Lyrics object 1], ..., [Lyrics object n]) $result->beats = array ( [Beat object 1], ..., [Beat object n]) $result->voices = array ( [Voice object 1], ..., [Voice object n])

When specified, the $contributor variable will be structured like this:

$contributors->video = [User object] $contributors->beats = array([User object 1], ..., [User object n]) $contributors->lyrics = array([User object 1], ..., [User object n]) $contributors->voices = array([User object 1], ..., [User object n])

Parameters

$featId integer
$featId - ID of the Feat

$scope string
$scope - Extra data to query for.

$contributors array
$contributors - (Optional) An array where to store the IDS of contributing artists. Original array will be modified.

Returns array


public get ( mixed $id, mixed $scope = 'feat' , mixed $forceQuery = false )

Returns details of a Feat To be edited


public object details ( integer $limit = 100, integer $offset = 0, boolean $top = false, integer|array $ids = null )

Returns a number of feats details with their corresponding user reference.

Parameters

$limit integer
$limit Number of feat results to return

$offset integer
$offset Numeric offset value

$top boolean
$top Flag for return top feats.

$ids integer|array
$ids Feat ids

Returns object
Feat object results

Used by m/Feats::top() m/Feats::details() Main::index()


public like ( mixed $id )


public play ( mixed $id )


public null add_scope ( string $scopeType, object & $featData )

Magic method for attaching additional scopes to feats. Looks up a method named _add_[scope]_scope in feats_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

$featData object
$featData

Returns null

Methods inherited from CI_Model

__construct()

__get()

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