Commit 2dbcef7d authored by Son Nguyen's avatar Son Nguyen Committed by Aaron Wells

Refactor mahara plugin classes

... in order to silence all the E_ALL notices

Change-Id: I0fdc9fc68ae7ffd2fa2dffe68dfbd79ee9599c06
parent b5d0274f
......@@ -108,7 +108,7 @@ class PluginBlocktypeBlog extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
......
......@@ -100,7 +100,7 @@ class PluginBlocktypeBlogpost extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
......
......@@ -92,7 +92,7 @@ class PluginBlocktypeRecentposts extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
safe_require('artefact', 'blog');
$configdata = $instance->get('configdata');
$elements = array(self::artefactchooser_element((isset($configdata['artefactids'])) ? $configdata['artefactids'] : null),
......
......@@ -142,7 +142,7 @@ class PluginBlocktypeTaggedposts extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
$configdata = $instance->get('configdata');
......
......@@ -77,7 +77,7 @@ class PluginBlocktypeFiledownload extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......
......@@ -106,7 +106,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
);
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('blocktype', 'folder', 'sortorder', $values['sortorder']);
set_config_plugin('blocktype', 'folder', 'folderdownloadzip', $values['folderdownloadzip']);
}
......@@ -121,7 +121,7 @@ class PluginBlocktypeFolder extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......
......@@ -39,7 +39,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
}
}
public static function get_instance_config_javascript() {
public static function get_instance_config_javascript(BlockInstance $instance) {
return array(
'js/configform.js',
'js/slideshow.js',
......@@ -491,7 +491,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('blocktype', 'gallery', 'useslimbox2', (int)$values['useslimbox2']);
set_config_plugin('blocktype', 'gallery', 'photoframe', (int)$values['photoframe']);
set_config_plugin('blocktype', 'gallery', 'previewwidth', (int)$values['previewwidth']);
......@@ -512,7 +512,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......@@ -587,7 +587,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
);
}
public static function instance_config_validate($form, $values) {
public static function instance_config_validate(Pieform $form, $values) {
global $USER;
if (!empty($values['images'])) {
......
......@@ -59,7 +59,7 @@ class PluginBlocktypeHtml extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......
......@@ -69,7 +69,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......
......@@ -78,14 +78,14 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return true;
}
public static function get_instance_config_javascript() {
public static function get_instance_config_javascript(BlockInstance $instance) {
$result = self::get_js_source(true);
if (!empty($result)) {
return $result;
}
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......@@ -139,7 +139,7 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
return $artefact;
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
$enabledtypes = array();
foreach ($values as $type => $enabled) {
if (!in_array($type, self::get_all_filetypes())) {
......
......@@ -63,7 +63,7 @@ class PluginBlocktypePdf extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
safe_require('artefact', 'file');
$instance->set('artefactplugin', 'file');
......
......@@ -25,7 +25,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
return array('internal');
}
public static function get_instance_config_javascript() {
public static function get_instance_config_javascript(BlockInstance $instance) {
return array('js/configform.js');
}
......@@ -128,7 +128,7 @@ class PluginBlocktypeProfileinfo extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$form = array();
......
......@@ -73,7 +73,7 @@ class PluginBlocktypeSocialprofile extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$form = array();
......
......@@ -119,7 +119,7 @@ class PluginBlocktypeTextbox extends PluginBlocktype {
return $artefact;
}
public static function get_instance_config_javascript($instance) {
public static function get_instance_config_javascript(BlockInstance $instance) {
// When an artefact is selected in the artefactchooser, update the
// contents of the wysiwyg editor and the message about the number
// of blocks containing the new artefact.
......@@ -271,7 +271,7 @@ EOF;
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
require_once('license.php');
safe_require('artefact', 'file');
......
......@@ -98,7 +98,7 @@ class PluginBlocktypePlans extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$instance->set('artefactplugin', 'plans');
$configdata = $instance->get('configdata');
......
......@@ -57,7 +57,7 @@ class PluginBlocktypeEntireresume extends PluginBlocktype {
return true;
}
public static function instance_config_form() {
public static function instance_config_form(BlockInstance $instance) {
return array();
}
......
......@@ -61,7 +61,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$form = array();
......
......@@ -177,7 +177,7 @@ class PluginAuthBrowserid extends PluginAuth {
return false;
}
public static function save_instance_config_options($values, $form) {
public static function save_instance_config_options($values, Pieform $form) {
$authinstance = new stdClass();
......
......@@ -214,7 +214,7 @@ class PluginAuthImap extends PluginAuth {
);
}
public static function save_instance_config_options($values, $form) {
public static function save_instance_config_options($values, Pieform $form) {
$authinstance = new stdClass();
......
......@@ -1972,7 +1972,7 @@ class PluginAuthLdap extends PluginAuth {
}
public static function save_instance_config_options($values, $form) {
public static function save_instance_config_options($values, Pieform $form) {
$authinstance = new stdClass();
......
......@@ -477,7 +477,7 @@ class PluginAuthSaml extends PluginAuth {
}
}
public static function validate_instance_config_options($values, $form) {
public static function validate_instance_config_options($values, Pieform $form) {
// only allow remoteuser to be unset if usersuniquebyusername is NOT set
if (!get_config('usersuniquebyusername') && !$values['remoteuser']) {
......@@ -517,14 +517,14 @@ class PluginAuthSaml extends PluginAuth {
}
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
$configs = array('simplesamlphplib', 'simplesamlphpconfig');
foreach ($configs as $config) {
set_config_plugin('auth', 'saml', $config, $values[$config]);
}
}
public static function save_instance_config_options($values, $form) {
public static function save_instance_config_options($values, Pieform $form) {
$authinstance = new stdClass();
......
......@@ -839,7 +839,7 @@ class PluginAuthXmlrpc extends PluginAuth {
);
}
public static function validate_instance_config_options($values, $form) {
public static function validate_instance_config_options($values, Pieform $form) {
if (false === strpos($values['wwwroot'], '://')) {
$values['wwwroot'] = 'http://' . $values['wwwroot'];
}
......@@ -879,7 +879,7 @@ class PluginAuthXmlrpc extends PluginAuth {
//TODO: test values and set appropriate errors on form
}
public static function save_instance_config_options($values, $form) {
public static function save_instance_config_options($values, Pieform $form) {
if (false === strpos($values['wwwroot'], '://')) {
$values['wwwroot'] = 'http://' . $values['wwwroot'];
}
......
......@@ -77,7 +77,7 @@ class PluginBlocktypeCreativecommons extends SystemBlocktype {
return true;
}
public static function get_instance_config_javascript() {
public static function get_instance_config_javascript(BlockInstance $instance) {
return array('js/creativecommons.js');
}
......@@ -100,7 +100,7 @@ class PluginBlocktypeCreativecommons extends SystemBlocktype {
return $configdata;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $THEME;
$configdata = $instance->get('configdata');
......
......@@ -114,7 +114,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
if (!empty($configdata['feedid'])) {
......@@ -557,7 +557,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
/**
* Overrides default import to trigger retrieving the feed.
*/
public static function import_create_blockinstance(array $config) {
public static function import_create_blockinstance(array $config, array $viewconfig) {
// Trigger retrieving the feed
// Note: may have to re-think this at some point - we'll end up retrieving all the
// RSS feeds for this user at import time, which could easily be quite
......
......@@ -167,7 +167,7 @@ class PluginBlocktypeExternalvideo extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array(
......
......@@ -64,7 +64,7 @@ class PluginBlocktypeGoogleApps extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array(
......
......@@ -93,7 +93,7 @@ class PluginBlocktypeGroupMembers extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$options = range(0,100);
......
......@@ -168,7 +168,7 @@ class PluginBlocktypeGroupViews extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array(
'showgroupviews' => array(
......
......@@ -137,7 +137,7 @@ class PluginBlocktypeInbox extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
$configdata = $instance->get('configdata');
......
......@@ -114,7 +114,7 @@ class PluginBlocktypeMyGroups extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array(
......
......@@ -62,7 +62,7 @@ class PluginBlocktypeNavigation extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
$view = $instance->get_view();
......
......@@ -47,7 +47,7 @@ class PluginBlocktypeNewViews extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array('limit' => array(
'type' => 'text',
......
......@@ -118,7 +118,7 @@ class PluginBlocktypeRecentForumPosts extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
global $USER;
$elements = array();
......
......@@ -41,7 +41,7 @@ class PluginBlocktypeText extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
require_once('license.php');
$configdata = $instance->get('configdata');
if (!$height = get_config('blockeditorheight')) {
......@@ -178,7 +178,7 @@ class PluginBlocktypeText extends SystemBlocktype {
* @param $form the pieform to send the ok-message to
* @param array $values
*/
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
global $SESSION;
if (!array_key_exists('convertcheckbox', $values) || !$values['convertcheckbox']) {
return;
......
......@@ -91,7 +91,7 @@ class PluginBlocktypeWall extends SystemBlocktype {
}
public static function validate_config_options($form, $values) {
public static function validate_config_options(Pieform $form, $values) {
if (!is_numeric($values['defaultpostsizelimit'])) {
$form->set_error('defaultpostsizelimit', get_string('postsizelimitinvalid', 'blocktype.wall'));
}
......@@ -100,7 +100,7 @@ class PluginBlocktypeWall extends SystemBlocktype {
}
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('blocktype', 'wall', 'defaultpostsizelimit', (int)$values['defaultpostsizelimit']);
}
......
......@@ -72,7 +72,7 @@ class PluginBlocktypeWatchlist extends SystemBlocktype {
return true;
}
public static function instance_config_form($instance) {
public static function instance_config_form(BlockInstance $instance) {
$configdata = $instance->get('configdata');
return array(
......
......@@ -567,7 +567,7 @@ EOF;
);
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('interaction', 'forum', 'postdelay', $values['postdelay']);
}
......
......@@ -336,7 +336,7 @@ class PluginSearchElasticsearch extends PluginSearch {
return $config;
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('search', 'elasticsearch', 'cronlimit', $values['cronlimit']);
// Changes in artefact types:
......
......@@ -51,7 +51,7 @@ class PluginSearchInternal extends PluginSearch {
);
}
public static function save_config_options($form, $values) {
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('search', 'internal', 'exactusersearch', (int) $values['exactusersearch']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment