forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored the generator script into proper Object Oriented code. It can now be used as a CLI tool, as a web form or as an included library with a function call. Stub implementation is demonstrated in portfolio unit tests.
- Loading branch information
nicolasconnault
committed
Aug 29, 2008
1 parent
d3919c2
commit 7e95408
Showing
7 changed files
with
721 additions
and
538 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
portfolio/type/download/simpletest/testportfolioplugindownload.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php // $Id$ | ||
require_once($CFG->libdir.'/simpletest/testportfoliolib.php'); | ||
require_once($CFG->dirroot.'/portfolio/type/download/lib.php'); | ||
|
||
Mock::generate('boxclient', 'mock_boxclient'); | ||
Mock::generatePartial('portfolio_plugin_download', 'mock_downloadplugin', array('ensure_ticket', 'ensure_account_tree')); | ||
|
||
|
||
class testPortfolioPluginDownload extends portfoliolib_test { | ||
public function setUp() { | ||
parent::setUp(); | ||
$this->plugin = &new mock_boxnetplugin($this); | ||
$this->plugin->boxclient = new mock_boxclient(); | ||
} | ||
|
||
public function tearDown() { | ||
parent::tearDown(); | ||
} | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
require_once($CFG->libdir.'/filelib.php'); | ||
require_once($CFG->dirroot.'/repository/flickr/phpFlickr.php'); | ||
|
||
class portfolio_plugin_flickr extends portfolio_plugin_push_base { | ||
|
||
private $flickr; | ||
|
||
public function prepare_package() { | ||
$this->flickr = new phpFlickr($this->get_config('apikey'), $this->get_config('sharedsecret')); | ||
return true; // don't do anything else for this plugin, we want to send all files as they are. | ||
} | ||
|
||
public function send_package() { | ||
|
||
} | ||
|
||
public function get_continue_url() { | ||
return 'http://www.flickr.com/files#0:f:' . $this->get_export_config('folder'); | ||
} | ||
|
||
public function expected_time($callertime) { | ||
return $callertime; | ||
} | ||
|
||
public static function get_allowed_config() { | ||
return array('apikey', 'sharedsecret'); | ||
} | ||
|
||
public static function has_admin_config() { | ||
return true; | ||
} | ||
|
||
public function admin_config_form(&$mform) { | ||
$strrequired = get_string('required'); | ||
$mform->addElement('text', 'apikey', get_string('apikey', 'portfolio_flickr')); | ||
$mform->addRule('apikey', $strrequired, 'required', null, 'client'); | ||
$mform->addElement('text', 'sharedsecret', get_string('sharedsecret', 'portfolio_flickr')); | ||
$mform->addRule('sharedsecret', $strrequired, 'required', null, 'client'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
$plugin->version = 2008072500; | ||
$plugin->requires = 2008072500; | ||
$plugin->cron = 0; | ||
|
||
?> |