Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/filebrowser/file_info.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00018 
00028 defined('MOODLE_INTERNAL') || die();
00029 
00038 abstract class file_info {
00039 
00040     protected $context;
00041 
00042     protected $browser;
00043 
00044     public function __construct($browser, $context) {
00045         $this->browser = $browser;
00046         $this->context = $context;
00047     }
00048 
00055     public function get_params() {
00056         return array('contextid' => $this->context->id,
00057                      'component' => null,
00058                      'filearea'  => null,
00059                      'itemid'    => null,
00060                      'filepath'  => null,
00061                      'filename'  => null);
00062     }
00063 
00068     public abstract function get_visible_name();
00069 
00074     public abstract function is_directory();
00075 
00080     public abstract function get_children();
00081 
00086     public abstract function get_parent();
00087 
00092     public function get_params_rawencoded() {
00093         $params = $this->get_params();
00094         $encoded = array();
00095         $encoded[] = 'contextid='.$params['contextid'];
00096         $encoded[] = 'component='.$params['component'];
00097         $encoded[] = 'filearea='.$params['filearea'];
00098         $encoded[] = 'itemid='.(is_null($params['itemid']) ? -1 : $params['itemid']);
00099         $encoded[] = 'filepath='.(is_null($params['filepath']) ? '' : rawurlencode($params['filepath']));
00100         $encoded[] = 'filename='.((is_null($params['filename']) or $params['filename'] === '.') ? '' : rawurlencode($params['filename']));
00101 
00102         return $encoded;
00103     }
00104 
00111     public function get_url($forcedownload=false, $https=false) {
00112         return null;
00113     }
00114 
00119     public function is_readable() {
00120         return true;
00121     }
00122 
00127     public function is_writable() {
00128         return true;
00129     }
00130 
00140     public function is_empty_area() {
00141         return false;
00142     }
00143 
00148     public function get_filesize() {
00149         return null;
00150     }
00151 
00156     public function get_mimetype() {
00157         return null;
00158     }
00159 
00164     public function get_timecreated() {
00165         return null;
00166     }
00167 
00172     public function get_timemodified() {
00173         return null;
00174     }
00175 
00180     public function get_license() {
00181         return null;
00182     }
00183 
00188     public function get_author() {
00189         return null;
00190     }
00191 
00196     public function get_source() {
00197         return null;
00198     }
00199 
00204     public function get_sortorder() {
00205         return 0;
00206     }
00207 
00215     public function create_directory($newdirname, $userid = NULL) {
00216         return null;
00217     }
00218 
00227     public function create_file_from_string($newfilename, $content, $userid = NULL) {
00228         return null;
00229     }
00230 
00239     public function create_file_from_pathname($newfilename, $pathname, $userid = NULL) {
00240         return null;
00241     }
00242 
00251     public function create_file_from_storedfile($newfilename, $fid, $userid = NULL) {
00252         return null;
00253     }
00254 
00259     public function delete() {
00260         return false;
00261     }
00262 
00273     public function copy_to_storage($contextid, $component, $filearea, $itemid, $filepath, $filename) {
00274         return false;
00275     }
00276 
00282     public function copy_to_pathname($pathname) {
00283         return false;
00284     }
00285 
00286 
00287 //TODO: following methods are not implemented yet ;-)
00288     //public abstract function move(location params);
00289     //public abstract function rename(new name);
00290     //public abstract function unzip(location params);
00291     //public abstract function zip(zip file, file info);
00292 }
 All Data Structures Namespaces Files Functions Variables Enumerations