* @param integer $contextid
* @param array $options
*/
- public function __construct($repositoryid, $contextid = SITEID, $options = array(), $readonly = 0) {
+ public function __construct($repositoryid, $contextid = SYSCONTEXTID, $options = array(), $readonly = 0) {
$this->id = $repositoryid;
$this->context = get_context_instance_by_id($contextid);
$this->readonly = $readonly;
* Return a type for a given type name.
* @global object $DB
* @param string $typename the type name
- * @return integer
+ * @return object
*/
public static function get_type_by_typename($typename) {
global $DB;
/**
* Return a type for a given type id.
* @global object $DB
- * @param string $typename the type name
- * @return integer
+ * @param int $id the type id
+ * @return object
*/
public static function get_type_by_id($id) {
global $DB;
* onlyvisible
* type
* accepted_types
- * returntypes
+ * return_types
* userid
*
* @return array repository instances
* @global object $CFG
* @global object $USER
* @global object $OUTPUT
- * @param string $filepath file path in download folder
+ * @param string $thefile file path in download folder
* @param string $name file name
* @param integer $itemid item id to identify a file in filepool
* @param string $filearea file area
* @param string $search
* @return array
*/
- public static function get_user_file_tree($search = ""){
+ public static function get_user_file_tree($search = ''){
global $CFG;
$ret = array();
$ret['nologin'] = true;
}
/**
- *
+ * Serialize file path
* @param string $filearea
* @param string $path
* @param string $visiblename
* Display a repository instance list (with edit/delete/create links)
* @global object $CFG
* @global object $USER
+ * @global object $OUTPUT
* @param object $context the context for which we display the instance
* @param string $typename if set, we display only one type of instance
*/
* convert file id to original url.
*
* @param string $url the url of file
+ * @return string
*/
public function get_link($url) {
return $url;
*
* See details on http://docs.moodle.org/en/Development:Repository_plugins
*
- * @param string $parent The parent path, this parameter can
+ * @param string $path, this parameter can
* a folder name, or a identification of folder
+ * @param string $page, the page number of file list
* @return array the list of files, including meta infomation, containing the following keys
* manage, url to manage url
* client_id
}
}
-function repository_setup_default_plugins() {
- global $OUTPUT;
- //if the plugin type has no multiple instance (e.g. has no instance option name)
- //repository_type::create will create an instance automatically
- $local_plugin = new repository_type('local', array(), true);
- $local_plugin_id = $local_plugin->create(true);
- $upload_plugin = new repository_type('upload', array(), true);
- $upload_plugin_id = $upload_plugin->create(true);
- if (is_int($local_plugin_id) or is_int($upload_plugin_id)) {
- echo $OUTPUT->box(get_string('setupdefaultplugins', 'repository'));
- }
- return true;
-}
-
+/**
+ * Generate all options needed by filepicker
+ *
+ * @param array $args, including following keys
+ * context
+ * accepted_types
+ * return_types
+ *
+ * @return array the list of repository instances, including meta infomation, containing the following keys
+ * externallink
+ * repositories
+ * accepted_types
+ */
function initialise_filepicker($args) {
global $CFG, $USER, $PAGE, $OUTPUT;
$ft = new filetype_parser();
}
return $return;
}
+
+/**
+ * The plugins should be enabled by defaulted once moodle installed
+ *
+ * @global object $OUTPUT
+ *
+ * @return boolean
+ */
+function repository_setup_default_plugins() {
+ global $OUTPUT;
+ //if the plugin type has no multiple instance (e.g. has no instance option name)
+ //repository_type::create will create an instance automatically
+ $local_plugin = new repository_type('local', array(), true);
+ $local_plugin_id = $local_plugin->create(true);
+ $upload_plugin = new repository_type('upload', array(), true);
+ $upload_plugin_id = $upload_plugin->create(true);
+ if (is_int($local_plugin_id) or is_int($upload_plugin_id)) {
+ echo $OUTPUT->box(get_string('setupdefaultplugins', 'repository'));
+ }
+ return true;
+}