MDL-15666 - change all the portfolio plugins and callers to use exceptions
[moodle.git] / portfolio / type / flickr / lib.php
CommitLineData
7e95408b 1<?php
2require_once($CFG->libdir.'/filelib.php');
539b3d13 3require_once($CFG->libdir.'/flickrlib.php');
7e95408b 4
5class portfolio_plugin_flickr extends portfolio_plugin_push_base {
6
7 private $flickr;
8
ea0de12f 9 public static function supported_formats() {
10 return array(PORTFOLIO_FORMAT_IMAGE);
11 }
12
0f71f48b 13 public static function get_name() {
14 return get_string('pluginname', 'portfolio_flickr');
15 }
16
7e95408b 17 public function prepare_package() {
18 $this->flickr = new phpFlickr($this->get_config('apikey'), $this->get_config('sharedsecret'));
7e95408b 19 }
20
21 public function send_package() {
37f03ea0 22 throw new portfolio_plugin_exception('notimplemented', 'portfolio', null, 'flickr');
7e95408b 23 }
24
237d80e0 25 public static function allows_multiple() {
26 return false;
27 }
28
7e95408b 29 public function get_continue_url() {
30 return 'http://www.flickr.com/files#0:f:' . $this->get_export_config('folder');
31 }
32
33 public function expected_time($callertime) {
34 return $callertime;
35 }
36
37 public static function get_allowed_config() {
38 return array('apikey', 'sharedsecret');
39 }
40
41 public static function has_admin_config() {
42 return true;
43 }
44
45 public function admin_config_form(&$mform) {
46 $strrequired = get_string('required');
47 $mform->addElement('text', 'apikey', get_string('apikey', 'portfolio_flickr'));
48 $mform->addRule('apikey', $strrequired, 'required', null, 'client');
49 $mform->addElement('text', 'sharedsecret', get_string('sharedsecret', 'portfolio_flickr'));
50 $mform->addRule('sharedsecret', $strrequired, 'required', null, 'client');
51 }
52
53}