// Removing failed platforms. foreach ($platforms as $host => $platform) { if (!($rpcommand->getResult($host, 'status') == RPC_SUCCESS && $rpcommand->getResult($host, 'value'))) { unset($platforms[$host]); } } // Saving selected platforms in session. $SESSION->vmoodle_sa['platforms'] = $platforms; // Moving to current step. redirect($sadminreturnurl); break; // Sending command on virtual platforms. // Sending command on virtual platforms. case 'sendcommand': // Invoking form. $target_form = new Target_Form(); // Checking if form is cancelled. if ($target_form->is_cancelled()) { unset($SESSION->vmoodle_sa); header('Location: view.php?view=sadmin'); return -1; } // Checking data. if (!($data = $target_form->get_data())) { return 0; } // Getting platforms // BUGFIX not found why splatforms dont' come into get_data(). $form_platforms = optional_param_array('splatforms', array(), PARAM_URL); if (empty($form_platforms) || count($form_platforms) == 1 && $form_platforms[0] == '0') { echo $OUTPUT->header(); throw new Command_Exception('noplatformchosen');
return -1; } // Checking if platforms are already selected. if (isset($SESSION->vmoodle_sa['platforms'])) { $aplatforms = get_available_platforms(); $splatforms = $SESSION->vmoodle_sa['platforms']; // Removing seletected platforms from available platforms. foreach ($splatforms as $key => $splatform) { unset($aplatforms[$key]); } } else { // Leaving form filling selects. $aplatforms = null; $splatforms = null; } // Instantiating forms. $command_form = new Command_Form($command, Command_Form::MODE_DISPLAY_COMMAND); $target_filter_form = new Target_Filter_Form(); if (!isset($target_form)) { $target_form = new Target_Form(array('aplatforms' => $aplatforms, 'splatforms' => $splatforms)); } if (!(is_null($rpcommand) || isset($rpcommand_form))) { $rpcommand_form = new Command_Form($rpcommand, Command_Form::MODE_RETRIEVE_PLATFORM); } // Display forms. $command_form->display(); $target_filter_form->display(); $target_form->display(); if (isset($rpcommand_form)) { $rpcommand_form->display(); }