This class is used to manage repository plugins.
More...
This class is used to manage repository plugins.
A repository_type is a repository plug-in. It can be Box.net, Flick-r, ... A repository type can be edited, sorted and hidden. It is mandatory for an administrator to create a repository type in order to be able to create some instances of this type. Coding note:
- a repository_type object is mapped to the "repository" database table
- "typename" attibut maps the "type" database field. It is unique.
- general "options" for a repository type are saved in the config_plugin table
- when you delete a repository, all instances are deleted, and general options are also deleted from database
- When you create a type for a plugin that can't have multiple instances, a instance is automatically created.
- Copyright
- 2009 Jerome Mouneyrac
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
repository_type::__construct |
( |
| $typename = '', |
|
|
| $typeoptions = array(), |
|
|
| $visible = true, |
|
|
| $sortorder = 0 ) |
repository_type constructor
- Parameters
-
int | $typename | |
array | $typeoptions | |
bool | $visible | |
int | $sortorder | (don't really need set, it will be during create() call) |
◆ create()
repository_type::create |
( |
| $silent = false | ) |
|
Create a repository type (the type name must not already exist)
- Parameters
-
bool | $silent | throw exception? |
- Return values
-
mixed | return int if create successfully, return false if |
◆ delete()
repository_type::delete |
( |
| $downloadcontents = false | ) |
|
Delete a repository_type (general options are removed from config_plugin table, and all instances are deleted)
- Parameters
-
bool | $downloadcontents | download external contents if exist |
- Return values
-
◆ get_contextvisibility()
repository_type::get_contextvisibility |
( |
| $context | ) |
|
Return if the instance is visible in a context.
- Todo
- check if the context visibility has been overwritten by the plugin creator (need to create special functions to be overvwritten in repository class)
- Parameters
-
- Return values
-
◆ get_options()
repository_type::get_options |
( |
| ) |
|
Return general options.
- Return values
-
◆ get_readablename()
repository_type::get_readablename |
( |
| ) |
|
Return a human readable and user-friendly type name.
- Return values
-
string | user-friendly type name |
◆ get_sortorder()
repository_type::get_sortorder |
( |
| ) |
|
Return order / position of display in the file picker.
- Return values
-
◆ get_typename()
repository_type::get_typename |
( |
| ) |
|
Get the type name (no whitespace) For a human readable name, use get_readablename()
- Return values
-
◆ get_visible()
repository_type::get_visible |
( |
| ) |
|
Return visibility.
- Return values
-
◆ move_order()
repository_type::move_order |
( |
| $move | ) |
|
Change order of the type with its adjacent upper or downer type (database fields are updated) Algorithm details:
- retrieve all types in an array. This array is sorted by sortorder, and the array keys start from 0 to X (incremented by 1)
- switch sortorder values of this type and its adjacent type
- Parameters
-
string | $move | "up" or "down" |
◆ prepare_to_cache()
repository_type::prepare_to_cache |
( |
| ) |
|
Prepares the repository type to be cached.
Implements method from cacheable_object interface.
- Return values
-
◆ update_options()
repository_type::update_options |
( |
| $options = null | ) |
|
Update plugin options into the config_plugin table.
- Parameters
-
- Return values
-
◆ update_visibility()
repository_type::update_visibility |
( |
| $visible = null | ) |
|
- Change visibility to the value chosen
- Update the type
- Parameters
-
- Return values
-
◆ wake_from_cache()
static repository_type::wake_from_cache |
( |
| $data | ) |
|
|
static |
Restores repository type from cache.
Implements method from cacheable_object interface.
- Return values
-
The documentation for this class was generated from the following file: