6a391ebf |
1 | <?php |
2 | /** |
3 | * repository_local class |
4 | * This is a subclass of repository class |
5 | * |
6 | * @version $Id$ |
7 | * @license http://www.gnu.org/copyleft/gpl.html GNU Public License |
8 | */ |
9 | |
10 | class repository_local extends repository{ |
11 | public $type = 'local'; |
12 | |
13 | public function __construct($repositoryid, $context = SITEID, $options = array()){ |
14 | global $SESSION, $action, $CFG; |
15 | parent::__construct($repositoryid, $context, $options); |
16 | // get the parameter from client side |
17 | // $this->context can be used here. |
18 | } |
19 | public function print_login($ajax = true){ |
20 | global $SESSION; |
21 | // TODO |
22 | // Return file list in moodle |
23 | // Also, this plugin should have ability to |
24 | // upload files in user's computer, a iframe |
25 | // need to be created. |
26 | return $this->get_listing(); |
27 | } |
28 | public function get_listing($path = '/', $search = ''){ |
29 | global $SESSION; |
30 | $ret = new stdclass; |
31 | $ret->upload = array('name'=>'attachment', 'id'=>'', 'url'=>''); |
32 | $ret->list = array(); |
33 | // call file api get the list of the file |
34 | $ret->list[] = array('title'=>'title','source'=>'download url', 'thumbnail'=>'url of thumbnail', 'date'=>'', 'size'=>'unknown'); |
35 | if(empty($ret)) { |
36 | throw new repository_exception('emptyfilelist', 'repository_local'); |
37 | } else { |
38 | return $ret; |
39 | } |
40 | } |
41 | public function print_listing(){ |
42 | // will be used in non-javascript file picker |
43 | } |
44 | public function print_search(){ |
45 | return true; |
46 | } |
47 | } |
48 | ?> |