コード例 #1
0
     if (!($data = $advancedcommand_form->get_data(false))) {
         return 0;
     }
     // Creating a Command_MultiSql.
     $command = new Command_MultiSql(get_string('manualcommand', 'local_vmoodle'), get_string('manualcommand', 'local_vmoodle'), $data->sqlcommand);
     // Record the wizard status.
     $SESSION->vmoodle_sa['command'] = serialize($command);
     $SESSION->vmoodle_sa['wizardnow'] = 'targetchoice';
     // Move to the next step.
     redirect($sadminreturnurl);
     break;
     // Uploading a SQL script to fill Command_Sql
 // Uploading a SQL script to fill Command_Sql
 case 'uploadsqlscript':
     // Checking uploaded file.
     $advancedcommand_form = new AdvancedCommand_Form();
     $advancedcommand_upload_form = new AdvancedCommand_Upload_Form();
     if ($file_content = $advancedcommand_upload_form->get_file_content('script')) {
         $advancedcommand_form->set_data(array('sqlcommand' => $file_content));
     }
     break;
     // Getting available platforms by their original value.
 // Getting available platforms by their original value.
 case 'gettargetbyvalue':
     // 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;
コード例 #2
0
// 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/>.
/**
 * The alternative first step of wizard.
 * Input a SQL command.
 * 
 * @package local_vmoodle
 * @category local
 * @author Bruce Bujon (bruce.bujon@gmail.com)
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
 */
// Loading the libraries.
require_once $CFG->dirroot . '/local/vmoodle/classes/commands/AdvancedCommand_Form.php';
require_once $CFG->dirroot . '/local/vmoodle/classes/commands/AdvancedCommand_Upload_Form.php';
// Display forms.
if (!isset($advancedcommand_form)) {
    $advancedcommand_form = new AdvancedCommand_Form();
}
$advancedcommand_form->display();
if (!isset($advancedcommand_upload_form)) {
    $advancedcommand_upload_form = new AdvancedCommand_Upload_Form();
}
$advancedcommand_upload_form->display();