-
Notifications
You must be signed in to change notification settings - Fork 193
Controller Labels
Controller | Extends | Path |
---|---|---|
Labels | Plain_Controller | /application/controllers/labels.php |
Type | Accessible |
---|---|
XMLHttpRequest | Yes |
API | Yes |
Web View | No |
This controller handles all requests to get, update, add and read indivdual labels. This is not accessible for a web view. Only accessible for API and XMLHttpRequest requests.
Called automatically which in turn calls the parent constructor. Also does the following:
- Redirects if logged out
- Redirects if web view
- Loads the labels model
Sets a label to active. You must own the label. If activating a system-level you must be an admin.
URL: /label/activate/LABEL_ID
Adds a new label to the system. There a different variables per type of label. They are listed below.
Param | Type | Default | Required | Description |
---|---|---|---|---|
name | string | N/A | Yes | The name of the label. |
active | integer | 1 | No | Set to 1 for active and 0 for inactive. |
URL: /label/add
Query: name=testing&active=0
Param | Type | Default | Required | Description |
---|---|---|---|---|
admin | integer | 0 | No | 1 to create the system level label, 0 for personal. Must be an admin to even use this flag. |
label_id | integer | N/A | Yes | The label's id to apply when this rule is met. |
url | string | N/A | Yes | The URL to extract the domain from for the smart label. |
active | integer | 1 | No | Set to 1 for active and 0 for inactive. |
URL: /label/add
Query: url=http://www.testing.com&admin=1&label_id=7
Sets a label to inactive. You must own the label. If activating a system-level you must be an admin.
URL: /label/deactivate/LABEL_ID
Edits an existing label.
Param | Type | Default | Required | Description |
---|---|---|---|---|
name | string | N/A | No | The name of the label. |
active | integer | 1 | No | Set to 1 for active and 0 for inactive. |
URL: /label/edit/LABEL_ID
Query: active=0
Param | Type | Default | Required | Description |
---|---|---|---|---|
admin | integer | 0 | No | 1 to create the system level label, 0 for personal. Must be an admin to even use this flag. |
label_id | integer | N/A | Yes | The label's id to apply when this rule is met. |
url | string | N/A | Yes | The URL to extract the domain from for the smart label. |
active | integer | 1 | No | Set to 1 for active and 0 for inactive. |
URL: /label/edit/LABEL_ID
Query: label_id=5
Returns a list of labels 30 at a time. You can get labels in a few different ways:
All Labels: /labels(/PAGE)?
Normal Labels: /labels/normal(/PAGE)? (admin accounts only)
Smart Labels: /labels/smart(/PAGE)? (admin accounts will get the system ones and their personal smart labels)
Get all the information for a particular label. You must own the label to have access to the information. Only users with the admin flag set will be able to read the system level labels.
URL: /label/info/LABEL_ID
Used internally to toggle the active state of a label.
Argument | Type | Default | Required | Description |
---|---|---|---|---|
label_id | integer | N/A | Yes | The label id. |
active | integer | 0 | No | Set to 1 for active, 0 for inactive. |
// inactive
self::toggle($label_id);
// active
self::toggle($label_id, 1);