MDL-15666 MDL-16177
[moodle.git] / portfolio / type / flickr / lib.php
CommitLineData
7e95408b 1<?php
2require_once($CFG->libdir.'/filelib.php');
3require_once($CFG->dirroot.'/repository/flickr/phpFlickr.php');
4
5class portfolio_plugin_flickr extends portfolio_plugin_push_base {
6
7 private $flickr;
8
9 public function prepare_package() {
10 $this->flickr = new phpFlickr($this->get_config('apikey'), $this->get_config('sharedsecret'));
11 return true; // don't do anything else for this plugin, we want to send all files as they are.
12 }
13
14 public function send_package() {
15
16 }
17
18 public function get_continue_url() {
19 return 'http://www.flickr.com/files#0:f:' . $this->get_export_config('folder');
20 }
21
22 public function expected_time($callertime) {
23 return $callertime;
24 }
25
26 public static function get_allowed_config() {
27 return array('apikey', 'sharedsecret');
28 }
29
30 public static function has_admin_config() {
31 return true;
32 }
33
34 public function admin_config_form(&$mform) {
35 $strrequired = get_string('required');
36 $mform->addElement('text', 'apikey', get_string('apikey', 'portfolio_flickr'));
37 $mform->addRule('apikey', $strrequired, 'required', null, 'client');
38 $mform->addElement('text', 'sharedsecret', get_string('sharedsecret', 'portfolio_flickr'));
39 $mform->addRule('sharedsecret', $strrequired, 'required', null, 'client');
40 }
41
42}