Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | List of all members
repository_type Class Reference

This class is used to manage repository plugins. More...

Inheritance diagram for repository_type:
cacheable_object

Public Member Functions

 __construct ($typename='', $typeoptions=array(), $visible=true, $sortorder=0)
 repository_type constructor More...
 
 create ($silent=false)
 Create a repository type (the type name must not already exist) More...
 
 delete ($downloadcontents=false)
 Delete a repository_type (general options are removed from config_plugin table, and all instances are deleted) More...
 
 get_contextvisibility ($context)
 Return if the instance is visible in a context. More...
 
 get_options ()
 Return general options. More...
 
 get_readablename ()
 Return a human readable and user-friendly type name. More...
 
 get_sortorder ()
 Return order / position of display in the file picker. More...
 
 get_typename ()
 Get the type name (no whitespace) For a human readable name, use get_readablename() More...
 
 get_visible ()
 Return visibility. More...
 
 move_order ($move)
 Change order of the type with its adjacent upper or downer type (database fields are updated) Algorithm details: More...
 
 prepare_to_cache ()
 Prepares the repository type to be cached. More...
 
 update_options ($options=null)
 Update plugin options into the config_plugin table. More...
 
 update_visibility ($visible=null)
 

Static Public Member Functions

static wake_from_cache ($data)
 Restores repository type from cache. More...
 

Detailed Description

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:

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __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)

Member Function Documentation

◆ create()

repository_type::create (   $silent = false)

Create a repository type (the type name must not already exist)

Parameters
bool$silentthrow exception?
Return values
mixedreturn 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$downloadcontentsdownload external contents if exist
Return values
bool

◆ 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
stdClass$contextcontext
Return values
bool

◆ get_options()

repository_type::get_options ( )

Return general options.

Return values
arraythe general options

◆ get_readablename()

repository_type::get_readablename ( )

Return a human readable and user-friendly type name.

Return values
stringuser-friendly type name

◆ get_sortorder()

repository_type::get_sortorder ( )

Return order / position of display in the file picker.

Return values
int

◆ get_typename()

repository_type::get_typename ( )

Get the type name (no whitespace) For a human readable name, use get_readablename()

Return values
stringthe type name

◆ get_visible()

repository_type::get_visible ( )

Return visibility.

Return values
bool

◆ 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:

  1. retrieve all types in an array. This array is sorted by sortorder, and the array keys start from 0 to X (incremented by 1)
  2. 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
array

Implements cacheable_object.

◆ update_options()

repository_type::update_options (   $options = null)

Update plugin options into the config_plugin table.

Parameters
array$options
Return values
bool

◆ update_visibility()

repository_type::update_visibility (   $visible = null)
  1. Change visibility to the value chosen
  2. Update the type
Parameters
bool$visible
Return values
bool

◆ wake_from_cache()

static repository_type::wake_from_cache (   $data)
static

Restores repository type from cache.

Implements method from cacheable_object interface.

Return values
array

Implements cacheable_object.


The documentation for this class was generated from the following file: