// Including requirements. include_once $CFG->dirroot . '/local/vmoodle/classes/Command_Form.php'; include_once $CFG->dirroot . '/local/vmoodle/rpclib.php'; // Checking command. if (!isset($SESSION->vmoodle_sa['command'])) { $SESSION['vmoodle_sa']['wizardnow'] = 'commandchoice'; return 0; } // Getting retrieve platforms command $command = unserialize($SESSION->vmoodle_sa['command']); $rpcommand = $command->getRPCommand(); if (is_null($rpcommand)) { return 0; } // Invoking form. $rpcommand_form = new Command_Form($rpcommand, Command_Form::MODE_RETRIEVE_PLATFORM); // Checking if form is submitted. if (!($data = $rpcommand_form->get_data())) { return 0; } // Setting parameters' values. $rpcommand->populate($data); // Sending command on available platforms $platforms = get_available_platforms(); $rpcommand->setReturned(true); $rpcommand->run($platforms); // Removing failed platforms. foreach ($platforms as $host => $platform) { if (!($rpcommand->getResult($host, 'status') == RPC_SUCCESS && $rpcommand->getResult($host, 'value'))) { unset($platforms[$host]); }
foreach ($assistedcommands_conffiles as $conffile) { $path = explode('/', $conffile); $assistedcommands_category = $path[count($path) - 2]; if ($assistedcommands_category[0] != '_') { $assistedcommands_categories[] = $assistedcommands_category; } } // Displaying commands categories. foreach ($assistedcommands_categories as $key => $category) { // Reading commands. try { $vmoodle_category = load_vmplugin($category); // Displaying a command's form. print_collapsable_bloc_start($vmoodle_category->getPluginName(), $vmoodle_category->getName(), null, false); foreach ($vmoodle_category->getCommands() as $command) { $command_form = new Command_Form($command, Command_Form::MODE_COMMAND_CHOICE); $command_form->display(); } print_collapsable_block_end(); } catch (Exception $vce) { print_collapsable_block_end(); echo $OUTPUT->notification($vce->getMessage()); } } // Display link to the advanced mode. echo '<br/><center>'; $btitle = get_string('advancedmode', 'local_vmoodle'); echo $OUTPUT->single_button(new moodle_url('/local/vmoodle/view.php', array('view' => 'sadmin', 'what' => 'switchtoadvancedcommand')), $btitle, 'get'); echo '<br/>'; $btitle = get_string('administration', 'local_vmoodle'); echo $OUTPUT->single_button(new moodle_url('/local/vmoodle/admin.php'), $btitle, 'get');