Commit 20ca5995 authored by Nigel McNie's avatar Nigel McNie
Browse files

Disable the export and import tabs if no export or import plugins are enabled.

parent 9249b8db
......@@ -34,7 +34,13 @@ $SESSION->set('exportdata', '');
$SESSION->set('exportfile', '');
$exportoptions = array();
foreach (plugins_installed('export') as $plugin) {
$exportplugins = plugins_installed('export');
if (!$exportplugins) {
die_info(get_string('noexportpluginsenabled', 'export'));
}
foreach ($exportplugins as $plugin) {
safe_require('export', $plugin->name);
$exportoptions[$plugin->name] = array(
'text' => call_static_method(generate_class_name('export', $plugin->name), 'get_title'),
......
......@@ -29,6 +29,12 @@ define('MENUITEM', 'myportfolio/import');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('import', 'import'));
$importplugins = plugins_installed('import');
if (!$importplugins) {
die_info(get_string('noimportpluginsenabled', 'import'));
}
$form = pieform(array(
'name' => 'import',
'elements' => array(
......
......@@ -34,6 +34,7 @@ $string['exportgeneratedsuccessfully'] = 'Export generated successfully. %sClick
$string['exportgeneratedsuccessfullyjs'] = 'Export generated successfully. %sContinue%s';
$string['exportyourportfolio'] = 'Export Your Portfolio';
$string['generateexport'] = 'Generate export';
$string['noexportpluginsenabled'] = 'No export plugins have been enabled by the administrator, so you are unable to use this feature';
$string['justsomeviews'] = 'Just some of my Views';
$string['pleasewaitwhileyourexportisbeinggenerated'] = 'Please wait while your export is being generated...';
$string['Starting'] = 'Starting';
......
......@@ -27,3 +27,6 @@
defined('INTERNAL') || die();
$string['import'] = 'Import';
$string['noimportpluginsenabled'] = 'No import plugins have been enabled by the administrator, so you are unable to use this feature';
?>
......@@ -1685,6 +1685,8 @@ function institutional_admin_nav() {
* @return $standardnav a data structure containing the standard navigation
*/
function mahara_standard_nav() {
$exportenabled = plugins_installed('export');
$importenabled = plugins_installed('import');
$menu = array(
array(
'path' => '',
......@@ -1709,12 +1711,14 @@ function mahara_standard_nav() {
'url' => 'export/',
'title' => get_string('Export', 'export'),
'weight' => 30,
'ignore' => !$exportenabled,
),
array(
'path' => 'myportfolio/import',
'url' => 'import/',
'title' => get_string('import', 'import'),
'weight' => 30,
'ignore' => !$importenabled,
),
array(
'path' => 'profile/view',
......@@ -1789,6 +1793,8 @@ function mahara_standard_nav() {
'weight' => 40,
),
);
$menu = array_filter($menu, create_function('$a', 'return empty($a["ignore"]);'));
if ($plugins = get_records_array('artefact_installed', 'active', 1)) {
foreach ($plugins as &$plugin) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment