[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/admin/tool/installaddon/ -> index.php (source)

   1  <?php
   2  
   3  // This file is part of Moodle - http://moodle.org/
   4  //
   5  // Moodle is free software: you can redistribute it and/or modify
   6  // it under the terms of the GNU General Public License as published by
   7  // the Free Software Foundation, either version 3 of the License, or
   8  // (at your option) any later version.
   9  //
  10  // Moodle is distributed in the hope that it will be useful,
  11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13  // GNU General Public License for more details.
  14  //
  15  // You should have received a copy of the GNU General Public License
  16  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  17  
  18  /**
  19   * The main screen of the tool.
  20   *
  21   * @package     tool_installaddon
  22   * @copyright   2013 David Mudrak <[email protected]>
  23   * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  require(dirname(__FILE__) . '/../../../config.php');
  27  require_once($CFG->libdir.'/adminlib.php');
  28  
  29  admin_externalpage_setup('tool_installaddon_index');
  30  
  31  if (!empty($CFG->disableonclickaddoninstall)) {
  32      notice(get_string('featuredisabled', 'tool_installaddon'));
  33  }
  34  
  35  $installer = tool_installaddon_installer::instance();
  36  
  37  $output = $PAGE->get_renderer('tool_installaddon');
  38  $output->set_installer_instance($installer);
  39  
  40  // Handle the eventual request for installing from remote repository.
  41  $remoterequest = optional_param('installaddonrequest', null, PARAM_RAW);
  42  $confirmed = optional_param('confirm', false, PARAM_BOOL);
  43  $installer->handle_remote_request($output, $remoterequest, $confirmed);
  44  
  45  $form = $installer->get_installfromzip_form();
  46  
  47  if ($form->is_cancelled()) {
  48      redirect($PAGE->url);
  49  
  50  } else if ($data = $form->get_data()) {
  51      // Save the ZIP file into a temporary location.
  52      $jobid = md5(rand().uniqid('', true));
  53      $sourcedir = make_temp_directory('tool_installaddon/'.$jobid.'/source');
  54      $zipfilename = $installer->save_installfromzip_file($form, $sourcedir);
  55      // Redirect to the validation page.
  56      $nexturl = new moodle_url('/admin/tool/installaddon/validate.php', array(
  57          'sesskey' => sesskey(),
  58          'jobid' => $jobid,
  59          'zip' => $zipfilename,
  60          'type' => $data->plugintype,
  61          'rootdir' => $data->rootdir));
  62      redirect($nexturl);
  63  }
  64  
  65  // Output starts here.
  66  echo $output->index_page();


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1