Plugin: PENS: fix plugin installation and re-enable in learning path upload

pull/3932/head
Yannick Warnier 4 years ago
parent 18098fb5de
commit a875fc5976
  1. 17
      main/upload/form.scorm.php
  2. 18
      plugin/pens/chamilo_pens.php
  3. 13
      plugin/pens/install.php
  4. 6
      plugin/pens/lib/PENSPlugin.php
  5. 15
      plugin/pens/uninstall.php

@ -109,6 +109,23 @@ if (api_get_configuration_value('scorm_upload_from_cache')) {
} }
} }
if (api_get_setting('status', 'pens') == 'installed') {
require_once api_get_path(SYS_PLUGIN_PATH)."/pens/chamilo_pens.php";
$list = ChamiloPens::findAll();
$select_pens = $form->addElement(
'select',
'pens_package',
'Or select an existing PENS package'
);
if (count($list) > 0) {
foreach ($list as $package) {
$select_pens->addOption($package->getPackageName(), $package->getPackageName());
}
} else {
$select_pens->addOption(get_lang('ImportNoFile'), get_lang('ImportNoFile'));
}
}
// the default values for the form // the default values for the form
$defaults = ['index_document' => 'checked="checked"', 'use_max_score' => 1]; $defaults = ['index_document' => 'checked="checked"', 'use_max_score' => 1];
$form->setDefaults($defaults); $form->setDefaults($defaults);

@ -1,20 +1,6 @@
<?php <?php
/**
* This file is part of chamilo-pens. /* For licensing terms, see /license.txt */
*
* chamilo-pens is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* chamilo-pens 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 chamilo-pens. If not, see <http://www.gnu.org/licenses/>.
*/
/** /**
* ChamiloPens. * ChamiloPens.

@ -0,0 +1,13 @@
<?php
/**
* This script is included by main/admin/settings.lib.php and generally
* includes things to execute in the main database (settings_current table).
*
* @package chamilo.plugin.bigbluebutton
*/
/**
* Initialization.
*/
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once __DIR__.'/lib/pens.php';
PENSPlugin::create()->install();

@ -55,8 +55,8 @@ class PENSPlugin extends Plugin implements HookPluginInterface
*/ */
public function uninstall() public function uninstall()
{ {
$setting = api_get_setting('plugin_pens'); $setting = api_get_setting('status', 'pens');
if (!empty($setting)) { if ($setting === 'installed') {
$this->uninstallHook(); $this->uninstallHook();
// Note: Keeping area field data is intended so it will not be removed // Note: Keeping area field data is intended so it will not be removed
$this->uninstallDatabase(); $this->uninstallDatabase();
@ -85,7 +85,7 @@ class PENSPlugin extends Plugin implements HookPluginInterface
updated_at datetime NULL, updated_at datetime NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY package_id (package_id) UNIQUE KEY package_id (package_id)
"; )";
Database::query($sql); Database::query($sql);
} }

@ -0,0 +1,15 @@
<?php
/**
* This script is included by main/admin/settings.lib.php when unselecting a plugin
* and is meant to remove things installed by the install.php script in both
* the global database and the courses tables.
*
* @package chamilo.plugin.pens
*/
/**
* Queries.
*/
require_once __DIR__.'/../../main/inc/global.inc.php';
require_once __DIR__.'/lib/pens.php';
PENSPlugin::create()->uninstall();
Loading…
Cancel
Save