/** * Set the initial order for the feedback comments plugin (top) * @return bool */ function xmldb_assignfeedback_comments_install() { global $CFG; require_once $CFG->dirroot . '/mod/assign/adminlib.php'; // Set the correct initial order for the plugins. $pluginmanager = new assign_plugin_manager('assignfeedback'); $pluginmanager->move_plugin('comments', 'up'); return true; }
/** * Code run after the assignsubmission_onlinetext module database tables have been created. * Moves the plugin to the top of the list (of 3) * @return bool */ function xmldb_assignsubmission_onlinetext_install() { global $CFG; // Set the correct initial order for the plugins. require_once $CFG->dirroot . '/mod/assign/adminlib.php'; $pluginmanager = new assign_plugin_manager('assignsubmission'); $pluginmanager->move_plugin('onlinetext', 'up'); $pluginmanager->move_plugin('onlinetext', 'up'); return true; }
/** * Code run after the assignfeedback_poodll module database tables have been created. * Moves the feedback file plugin down * * @return bool */ function xmldb_assignfeedback_poodll_install() { global $CFG; // do the install require_once $CFG->dirroot . '/mod/assign/adminlib.php'; // set the correct initial order for the plugins $pluginmanager = new assign_plugin_manager('assignfeedback'); $pluginmanager->move_plugin('poodll', 'down'); // do the upgrades return true; }
/** * Code run after the module database tables have been created. * Moves the comments plugin to the bottom * @return bool */ function xmldb_assignsubmission_comments_install() { global $CFG; // do the install require_once($CFG->dirroot . '/mod/assign/adminlib.php'); // set the correct initial order for the plugins $pluginmanager = new assign_plugin_manager('assignsubmission'); $pluginmanager->move_plugin('comments', 'down'); $pluginmanager->move_plugin('comments', 'down'); // do the upgrades return true; }
defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot . '/mod/assign/adminlib.php'); $ADMIN->add('modules', new admin_category('assignmentplugins', new lang_string('assignmentplugins', 'assign'), !$module->visible)); $ADMIN->add('assignmentplugins', new admin_category('assignsubmissionplugins', new lang_string('submissionplugins', 'assign'), !$module->visible)); $ADMIN->add('assignsubmissionplugins', new assign_admin_page_manage_assign_plugins('assignsubmission')); $ADMIN->add('assignmentplugins', new admin_category('assignfeedbackplugins', new lang_string('feedbackplugins', 'assign'), !$module->visible)); $ADMIN->add('assignfeedbackplugins', new assign_admin_page_manage_assign_plugins('assignfeedback')); assign_plugin_manager::add_admin_assign_plugin_settings('assignsubmission', $ADMIN, $settings, $module); assign_plugin_manager::add_admin_assign_plugin_settings('assignfeedback', $ADMIN, $settings, $module); if ($ADMIN->fulltree) { $menu = array(); foreach (get_plugin_list('assignfeedback') as $type => $notused) { $visible = !get_config('assignfeedback_' . $type, 'disabled'); if ($visible) { $menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type); } } // The default here is feedback_comments (if it exists) $settings->add(new admin_setting_configselect('assign/feedback_plugin_for_gradebook', new lang_string('feedbackplugin', 'mod_assign'), new lang_string('feedbackpluginforgradebook', 'mod_assign'), 'assignfeedback_comments', $menu)); $settings->add(new admin_setting_configcheckbox('assign/showrecentsubmissions',
// the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Allows the admin to manage assignment plugins * * @package mod_assign * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../config.php'); require_once($CFG->dirroot.'/mod/assign/adminlib.php'); // Create the class for this controller. $pluginmanager = new assign_plugin_manager(required_param('subtype', PARAM_PLUGIN)); $PAGE->set_context(get_system_context()); // Execute the controller. $pluginmanager->execute(optional_param('action', null, PARAM_PLUGIN), optional_param('plugin', null, PARAM_PLUGIN));
/** * Test subplugins availability */ public function test_subplugins_availability() { global $CFG; require_once $CFG->dirroot . '/mod/assign/adminlib.php'; $this->resetAfterTest(true); // Hide assignment file submissiong plugin. $pluginmanager = new assign_plugin_manager('assignsubmission'); $pluginmanager->hide_plugin('file'); $parameters = mod_assign_external::save_submission_parameters(); $this->assertTrue(!isset($parameters->keys['plugindata']->keys['files_filemanager'])); // Show it again and check that the value is returned as optional. $pluginmanager->show_plugin('file'); $parameters = mod_assign_external::save_submission_parameters(); $this->assertTrue(isset($parameters->keys['plugindata']->keys['files_filemanager'])); $this->assertEquals(VALUE_OPTIONAL, $parameters->keys['plugindata']->keys['files_filemanager']->required); // Hide feedback file submissiong plugin. $pluginmanager = new assign_plugin_manager('assignfeedback'); $pluginmanager->hide_plugin('file'); $parameters = mod_assign_external::save_grade_parameters(); $this->assertTrue(!isset($parameters->keys['plugindata']->keys['files_filemanager'])); // Show it again and check that the value is returned as optional. $pluginmanager->show_plugin('file'); $parameters = mod_assign_external::save_grade_parameters(); $this->assertTrue(isset($parameters->keys['plugindata']->keys['files_filemanager'])); $this->assertEquals(VALUE_OPTIONAL, $parameters->keys['plugindata']->keys['files_filemanager']->required); // Check a different one. $pluginmanager->show_plugin('comments'); $this->assertTrue(isset($parameters->keys['plugindata']->keys['assignfeedbackcomments_editor'])); $this->assertEquals(VALUE_OPTIONAL, $parameters->keys['plugindata']->keys['assignfeedbackcomments_editor']->required); }
// it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Allows the admin to manage assignment plugins * * @package mod_assign * @copyright 2012 NetSpot {@link http://www.netspot.com.au} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once __DIR__ . '/../../config.php'; require_once $CFG->dirroot . '/mod/assign/adminlib.php'; $subtype = required_param('subtype', PARAM_PLUGIN); $action = optional_param('action', null, PARAM_PLUGIN); $plugin = optional_param('plugin', null, PARAM_PLUGIN); if (!empty($plugin)) { require_sesskey(); } // Create the class for this controller. $pluginmanager = new assign_plugin_manager($subtype); $PAGE->set_context(context_system::instance()); // Execute the controller. $pluginmanager->execute($action, $plugin);
function action($action) { $pluginmanager = new assign_plugin_manager('assignfeedback'); switch ($action) { case 'enable': $pluginmanager->show_plugin($this->plugin); break; case 'disable': $pluginmanager->hide_plugin($this->plugin); break; } return 0; }