echo $OUTPUT->footer(); exit; } // Retrieving commands plugins. $assistedcommands_conffiles = glob($CFG->dirroot . '/local/vmoodle/plugins/*/config.php'); // Creating table. $table = new stdclass(); $table->head = array('<b>' . get_string('commands', 'local_vmoodle') . '</b>', '<b>' . get_string('operation', 'local_vmoodle') . '</b>'); $table->align = array('LEFT', 'CENTER'); $table->size = array('70%', '30%'); $table->width = '80%'; // Adding commands plugins. foreach ($assistedcommands_conffiles as $conffile) { $path = explode('/', $conffile); $category = $path[count($path) - 2]; $vmoodle_category = load_vmplugin($category); $table->data[] = array($vmoodle_category->getName() . '<br/> > ' . $vmoodle_category->count() . ' ' . get_string('elements', 'local_vmoodle'), $category[0] == '_' ? $OUTPUT->single_button(new moodle_url('admin.php', array('action' => 'enablecommands', 'commands' => $category)), get_string('enable'), 'get') : $OUTPUT->single_button(new moodle_url('admin.php', array('action' => 'disablecommands', 'commands' => $category)), get_string('disable'), 'get')); } // Displaying commands plugins. echo $OUTPUT->heading(get_string('commandsadministration', 'local_vmoodle')); echo '<br/>'; echo html_writer::table($table); echo '<br/>'; // Retrieving vmoodle plugins. $plugins = core_plugin_manager::get_plugins_of_type('vmoodleadminset'); foreach ($plugins as $key => $plugin) { if (!$DB->get_record('config', array('name' => 'vmoodle_lib_' . $plugin . '_version'))) { unset($plugins[$key]); } } // Creating table.
die('Direct access to this script is forbidden.'); } $sadminreturnurl = new moodle_url('/local/vmoodle/view.php', array('view' => 'sadmin')); // Checking action to do switch ($action) { // Validating the assisted command. case 'validateassistedcommand': // Checking the neeed values $category = optional_param('category_plugin_name', null, PARAM_TEXT); $index = optional_param('command_index', -1, PARAM_INT); if (is_null($category) || $index < 0) { return 0; } // Loading command's category. if (is_dir(VMOODLE_PLUGINS_DIR . $category) && is_readable(VMOODLE_PLUGINS_DIR . $category . '/config.php')) { $command_category = load_vmplugin($_POST['category_plugin_name']); } else { return 0; } // Invoking a form. try { $command = $command_category->getCommands($index); } catch (Command_Exception $vce) { return 0; } $command_form = new Command_Form($command, Command_Form::MODE_COMMAND_CHOICE); if (!($data = $command_form->get_data())) { return 0; } // Setting parameters' values try {