-
Notifications
You must be signed in to change notification settings - Fork 194
Model User Marks To Tags
Jeff Johns edited this page Feb 4, 2014
·
2 revisions
| Model | Extends | Table | Path |
|---|---|---|---|
| User_Marks_To_Tags_Model | Plain_Model | user_marks_to_tags | /application/models/user_marks_to_tags_model.php |
$this->load->model('user_marks_to_tags_model', 'umtt');| Property | Visibility | Default Value | Description |
|---|---|---|---|
| $sort | Public | user_marks_to_tag_id DESC | The default sort direction for reads. |
Called automatically which in turn calls the parent constructor and sets the model $data_types properties.
Used to create new records in the user marks to tags table.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $options | array | array() | Yes | An associative array that contains the column names and the values for the record to be created. Array keys are the column names for each value. |
| $options['tag_id'] | integer | N/A/td> | Yes | The tag id. |
| $options['user_id'] | integer | N/A/td> | Yes | The user id. |
| $options['users_to_mark_id'] | integer | N/A/td> | Yes | The user mark id. |
$this->load->model('user_marks_to_tags_model', 'umtt');
$umtt = $this->umtt->create(array('tag_id' => 7, 'user_id' => $this->user_id, 'user_to_mark_id' => 144));
// If tag was created
if (isset($umtt->user_id)) {
// Good to go
}
// Some sort of validation error
elseif (isset($umtt['errors']) {
// Validation errors were found
}
// Some sort of database write error, check logs
else {
// will return false
}One of the rare occurences of an actual delete.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $where | string | N/A | Yes | The where clause for the delete query. |
$this->load->model('user_marks_to_tags_model', 'umtt');
if ($this->umtt->delete("user_id = '" . $this->user_id . "'") === true) {
// Shiz got deleted for that user
}Returns the most recently used tags for a user.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $user_id | integer | N/A | Yes | The user_id to get the list for. |
| $limit | integer | 10 | No | The total number of tags to retrieve. |
$this->load->model('user_marks_to_tags_model', 'umtt');
$recent = $this->umtt->getMostRecent($this->user_id);Returns the most popular tags for a user.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $user_id | integer | N/A | Yes | The user_id to get the list for. |
| $limit | integer | 10 | No | The total number of tags to retrieve. |
$this->load->model('user_marks_to_tags_model', 'umtt');
$popular = $this->umtt->getPopular($this->user_id);Used by getMostRecent and getPopular to retrieve the correct records.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
| $user_id | integer | N/A | Yes | The user_id to get the list for. |
| $limit | integer | 10 | No | The total number of tags to retrieve. |
| $type | string | N/A | Yes | Either popular or recent. |
return self::getTagList($user_id, $limit, 'popular');g