Commit 4bc75ecc authored by Petr Skoda's avatar Petr Skoda
Browse files

convert imscp export to new booktool plugin

fixed #4

AMOS BEGIN
 MOV [book:exportimscp,mod_book],[exportimscp:export,booktool_exportimscp]
 MOV [generateimscp,mod_book],[generateimscp,booktool_exportimscp]
AMOS END
parent 7927cab1
......@@ -68,9 +68,4 @@ $capabilities = array(
)
),
'mod/book:exportimscp' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE
),
);
......@@ -87,7 +87,6 @@ $string['addafter'] = 'Add new chapter';
$string['confchapterdelete'] = 'Do you really want to delete this chapter?';
$string['confchapterdeleteall'] = 'Do you really want to delete this chapter and all its subchapters?';
$string['generateimscp'] = 'Generate IMS content package';
$string['top'] = 'top';
$string['navprev'] = 'Previous';
......@@ -109,6 +108,5 @@ $string['book:read'] = 'Read book';
$string['book:edit'] = 'Edit book chapters';
$string['book:viewhiddenchapters'] = 'View hidden book chapters';
$string['book:import'] = 'Import chapters';
$string['book:exportimscp'] = 'Export book as IMS content package';
$string['errorchapter'] = 'Error reading book chapter.';
\ No newline at end of file
......@@ -264,12 +264,6 @@ function book_extend_settings_navigation(settings_navigation $settingsnav, navig
//$doimport = ($allowimport and $edit) ? '<div>(<a href="import.php?id='.$cm->id.'">'.get_string('doimport', 'book').'</a>)</div>' : '';
}
if (has_capability('mod/book:exportimscp', $PAGE->cm->context)) {
//TODO
/// Enable the IMS CP button
//$generateimscp = ($allowexport) ? '<a title="'.get_string('generateimscp', 'book').'" href="generateimscp.php?id='.$cm->id.'"><img class="bigicon" src="'.$OUTPUT->pix_url('generateimscp', 'mod_book').'" alt="'.get_string('generateimscp', 'book').'"></img></a>' : '';
}
if (has_capability('mod/book:edit', $PAGE->cm->context)) {
if (!empty($USER->editing)) {
$string = get_string("turneditingoff");
......
<?php
// This file is part of Book module for Moodle - http://moodle.org/
//
// Moodle 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.
//
// 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/>.
/**
* Book module capability definition
*
* @package booktool
* @subpackage exportimscp
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$capabilities = array(
'booktool/exportimscp:export' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE
),
);
......@@ -23,6 +23,8 @@
// //
///////////////////////////////////////////////////////////////////////////
die('Not converted to 2.0 yet, sorry');
require('../../config.php');
require_once($CFG->dirroot.'/mod/book/locallib.php');
require_once($CFG->dirroot.'/backup/lib.php');
......@@ -30,7 +32,6 @@ require_once($CFG->libdir.'/filelib.php');
$id = required_param('id', PARAM_INT); // Course Module ID
die('Not converted to 2.0 yet, sorry');
if (!$cm = get_coursemodule_from_id('book', $id)) {
error('Course Module ID was incorrect');
......
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
//
// Moodle 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.
//
// 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/>.
/**
* Book module language strings
*
* @package booktool
* @subpackage exportimscp
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$string['exportimscp:export'] = 'Export book as IMS content package';
$string['generateimscp'] = 'Generate IMS content package';
$string['pluginname'] = 'Book IMSCP export';
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
//
// Moodle 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.
//
// 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/>.
/**
* IMSCP export lib
*
* @package booktool
* @subpackage print
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
function booktool_exportimscp_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE, $CFG, $DB, $OUTPUT;
if ($PAGE->cm->modname !== 'book') {
return;
}
if (empty($PAGE->cm->context)) {
$PAGE->cm->context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->instance);
}
$params = $PAGE->url->params();
if (empty($params['id']) or empty($params['chapterid'])) {
return;
}
if (has_capability('booktool/exportimscp:export', $PAGE->cm->context)) {
//TODO
/// Enable the IMS CP button
//$generateimscp = ($allowexport) ? '<a title="'.get_string('generateimscp', 'booktool_exportimscp').'" href="generateimscp.php?id='.$cm->id.'"><img class="bigicon" src="'.$OUTPUT->pix_url('generateimscp', 'mod_book').'" alt="'.get_string('generateimscp', 'book').'"></img></a>' : '';
}
}
\ No newline at end of file
<?php
// This file is part of Book plugin for Moodle - http://moodle.org/
//
// Moodle 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.
//
// 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/>.
/**
* Book print plugin version info
*
* @package booktool
* @subpackage exportimscp
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2011090800; // The current plugin version (Date: YYYYMMDDXX)
$plugin->component = 'booktool_exportimscp'; // Full name of the plugin (used for diagnostics)
......@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die;
$module->version = 2011032001; // The current module version (Date: YYYYMMDDXX)
$module->version = 2011032002; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2011070101; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
$module->component = 'mod_book'; // Full name of the plugin (used for diagnostics)
......
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