Skip to content

Commit

Permalink
MDL-30973 Files API, check and update DocBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai committed Feb 15, 2012
1 parent baa5cd8 commit d2b7803
Show file tree
Hide file tree
Showing 47 changed files with 1,497 additions and 785 deletions.
13 changes: 10 additions & 3 deletions blocks/html/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
/**
* Form for editing HTML block instances.
*
* @package block_html
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package block_html
* @category files
* @param stdClass $course course object
* @param stdClass $birecord_or_cm block instance record
* @param stdClass $context context object
* @param string $filearea file area
* @param array $args extra arguments
* @param bool $forcedownload whether or not force download
* @return bool
*/

function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) {
global $SCRIPT;

Expand Down Expand Up @@ -79,4 +86,4 @@ function block_html_global_db_replace($search, $replace) {
}
}
$instances->close();
}
}
107 changes: 55 additions & 52 deletions lib/filebrowser/file_browser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand All @@ -19,10 +18,9 @@
/**
* Utility class for browsing of files.
*
* @package core
* @subpackage filebrowser
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_files
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();
Expand All @@ -41,8 +39,7 @@
require_once("$CFG->libdir/filebrowser/file_info_context_module.php");

/**
* This class provides the main entry point for other code wishing to get
* information about files.
* This class provides the main entry point for other code wishing to get information about files.
*
* The whole file storage for a Moodle site can be seen as a huge virtual tree.
* The spine of the tree is the tree of contexts (system, course-categories,
Expand All @@ -56,22 +53,23 @@
*
* Always use this abstraction when you need to access module files from core code.
*
* @package core
* @subpackage filebrowser
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_files
* @category files
* @copyright 2008 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class file_browser {

/**
* Looks up file_info instance
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info instance or null if not found or access not allowed
*
* @param stdClass $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info|null file_info instance or null if not found or access not allowed
*/
public function get_file_info($context = NULL, $component = NULL, $filearea = NULL, $itemid = NULL, $filepath = NULL, $filename = NULL) {
if (!$context) {
Expand All @@ -95,12 +93,13 @@ public function get_file_info($context = NULL, $component = NULL, $filearea = NU

/**
* Returns info about the files at System context
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
*
* @param object $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_system($context, $component, $filearea, $itemid, $filepath, $filename) {
Expand All @@ -111,13 +110,14 @@ private function get_file_info_context_system($context, $component, $filearea, $

/**
* Returns info about the files at User context
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info instance or null if not found or access not allowed
*
* @param stdClass $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info|null file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_user($context, $component, $filearea, $itemid, $filepath, $filename) {
global $DB, $USER;
Expand All @@ -142,13 +142,14 @@ private function get_file_info_context_user($context, $component, $filearea, $it

/**
* Returns info about the files at Course category context
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info instance or null if not found or access not allowed
*
* @param stdClass $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info|null file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_coursecat($context, $component, $filearea, $itemid, $filepath, $filename) {
global $DB;
Expand All @@ -163,13 +164,14 @@ private function get_file_info_context_coursecat($context, $component, $filearea

/**
* Returns info about the files at Course category context
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info instance or null if not found or access not allowed
*
* @param stdClass $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info|null file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_course($context, $component, $filearea, $itemid, $filepath, $filename) {
global $DB, $COURSE;
Expand All @@ -186,13 +188,14 @@ private function get_file_info_context_course($context, $component, $filearea, $

/**
* Returns info about the files at Course category context
* @param object $context
* @param string $component
* @param string $filearea
* @param int $itemid
* @param string $filepath
* @param string $filename
* @return file_info instance or null if not found or access not allowed
*
* @param stdClass $context context object
* @param string $component component
* @param string $filearea file area
* @param int $itemid item ID
* @param string $filepath file path
* @param string $filename file name
* @return file_info|null file_info instance or null if not found or access not allowed
*/
private function get_file_info_context_module($context, $component, $filearea, $itemid, $filepath, $filename) {
global $COURSE, $DB, $CFG;
Expand Down
Loading

0 comments on commit d2b7803

Please sign in to comment.