mirror of
https://github.com/moodle/moodle.git
synced 2025-03-10 10:58:38 +01:00
AMOS BEGIN MOV [checkin,report_customlang],[checkin,tool_customlang] MOV [checkout,report_customlang],[checkout,tool_customlang] MOV [checkoutdone,report_customlang],[checkoutdone,tool_customlang] MOV [checkoutinprogress,report_customlang],[checkoutinprogress,tool_customlang] MOV [confirmcheckin,report_customlang],[confirmcheckin,tool_customlang] MOV [customlang:edit,report_customlang],[customlang:edit,tool_customlang] MOV [customlang:view,report_customlang],[customlang:view,tool_customlang] MOV [filter,report_customlang],[filter,tool_customlang] MOV [filtercomponent,report_customlang],[filtercomponent,tool_customlang] MOV [filtercustomized,report_customlang],[filtercustomized,tool_customlang] MOV [filtermodified,report_customlang],[filtermodified,tool_customlang] MOV [filteronlyhelps,report_customlang],[filteronlyhelps,tool_customlang] MOV [filtershowstrings,report_customlang],[filtershowstrings,tool_customlang] MOV [filterstringid,report_customlang],[filterstringid,tool_customlang] MOV [filtersubstring,report_customlang],[filtersubstring,tool_customlang] MOV [headingcomponent,report_customlang],[headingcomponent,tool_customlang] MOV [headinglocal,report_customlang],[headinglocal,tool_customlang] MOV [headingstandard,report_customlang],[headingstandard,tool_customlang] MOV [headingstringid,report_customlang],[headingstringid,tool_customlang] MOV [markinguptodate,report_customlang],[markinguptodate,tool_customlang] MOV [markinguptodate_help,report_customlang],[markinguptodate_help,tool_customlang] MOV [markuptodate,report_customlang],[markuptodate,tool_customlang] MOV [modifiedno,report_customlang],[modifiedno,tool_customlang] MOV [modifiednum,report_customlang],[modifiednum,tool_customlang] MOV [nostringsfound,report_customlang],[nostringsfound,tool_customlang] MOV [placeholder,report_customlang],[placeholder,tool_customlang] MOV [placeholder_help,report_customlang],[placeholder_help,tool_customlang] MOV [placeholderwarning,report_customlang],[placeholderwarning,tool_customlang] MOV [pluginname,report_customlang],[pluginname,tool_customlang] MOV [savecheckin,report_customlang],[savecheckin,tool_customlang] MOV [savecontinue,report_customlang],[savecontinue,tool_customlang] AMOS END
139 lines
5.0 KiB
PHP
139 lines
5.0 KiB
PHP
<?php
|
|
// This file is part of 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/>.
|
|
|
|
/**
|
|
* Performs checkout of the strings into the translation table
|
|
*
|
|
* @package tool
|
|
* @subpackage customlang
|
|
* @copyright 2010 David Mudrak <david@moodle.com>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
define('NO_OUTPUT_BUFFERING', true); // progress bar is used here
|
|
|
|
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
|
|
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
|
|
require_once($CFG->libdir.'/adminlib.php');
|
|
|
|
require_login(SITEID, false);
|
|
require_capability('tool/customlang:view', get_system_context());
|
|
|
|
$action = optional_param('action', '', PARAM_ALPHA);
|
|
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
|
$lng = optional_param('lng', '', PARAM_LANG);
|
|
|
|
admin_externalpage_setup('toolcustomlang');
|
|
$langs = get_string_manager()->get_list_of_translations();
|
|
|
|
// pre-output actions
|
|
if ($action === 'checkout') {
|
|
require_sesskey();
|
|
require_capability('tool/customlang:edit', get_system_context());
|
|
if (empty($lng)) {
|
|
print_error('missingparameter');
|
|
}
|
|
|
|
$PAGE->set_cacheable(false); // progress bar is used here
|
|
$output = $PAGE->get_renderer('tool_customlang');
|
|
echo $output->header();
|
|
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
|
$progressbar = new progress_bar();
|
|
$progressbar->create(); // prints the HTML code of the progress bar
|
|
|
|
// we may need a bit of extra execution time and memory here
|
|
@set_time_limit(HOURSECS);
|
|
raise_memory_limit(MEMORY_EXTRA);
|
|
tool_customlang_utils::checkout($lng, $progressbar);
|
|
|
|
echo $output->continue_button(new moodle_url('/admin/tool/customlang/edit.php', array('lng' => $lng)), 'get');
|
|
echo $output->footer();
|
|
exit;
|
|
}
|
|
|
|
if ($action === 'checkin') {
|
|
require_sesskey();
|
|
require_capability('tool/customlang:edit', get_system_context());
|
|
if (empty($lng)) {
|
|
print_error('missingparameter');
|
|
}
|
|
|
|
if (!$confirm) {
|
|
$output = $PAGE->get_renderer('tool_customlang');
|
|
echo $output->header();
|
|
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
|
echo $output->heading($langs[$lng], 3);
|
|
$numofmodified = tool_customlang_utils::get_count_of_modified($lng);
|
|
if ($numofmodified != 0) {
|
|
echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
|
|
echo $output->confirm(get_string('confirmcheckin', 'tool_customlang'),
|
|
new moodle_url($PAGE->url, array('action'=>'checkin', 'lng'=>$lng, 'confirm'=>1)),
|
|
new moodle_url($PAGE->url, array('lng'=>$lng)));
|
|
} else {
|
|
echo $output->heading(get_string('modifiedno', 'tool_customlang', $numofmodified), 3);
|
|
echo $output->continue_button(new moodle_url($PAGE->url, array('lng' => $lng)));
|
|
}
|
|
echo $output->footer();
|
|
die();
|
|
|
|
} else {
|
|
tool_customlang_utils::checkin($lng);
|
|
redirect($PAGE->url);
|
|
}
|
|
}
|
|
|
|
$output = $PAGE->get_renderer('tool_customlang');
|
|
|
|
// output starts here
|
|
echo $output->header();
|
|
echo $output->heading(get_string('pluginname', 'tool_customlang'));
|
|
|
|
if (empty($lng)) {
|
|
$s = new single_select($PAGE->url, 'lng', $langs);
|
|
$s->label = get_accesshide(get_string('language'));
|
|
$s->class = 'langselector';
|
|
echo $output->box($OUTPUT->render($s), 'langselectorbox');
|
|
echo $OUTPUT->footer();
|
|
exit;
|
|
}
|
|
|
|
echo $output->heading($langs[$lng], 3);
|
|
|
|
$numofmodified = tool_customlang_utils::get_count_of_modified($lng);
|
|
|
|
if ($numofmodified != 0) {
|
|
echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
|
|
}
|
|
|
|
$menu = array();
|
|
if (has_capability('tool/customlang:edit', get_system_context())) {
|
|
$menu['checkout'] = array(
|
|
'title' => get_string('checkout', 'tool_customlang'),
|
|
'url' => new moodle_url($PAGE->url, array('action' => 'checkout', 'lng' => $lng)),
|
|
'method' => 'post',
|
|
);
|
|
if ($numofmodified != 0) {
|
|
$menu['checkin'] = array(
|
|
'title' => get_string('checkin', 'tool_customlang'),
|
|
'url' => new moodle_url($PAGE->url, array('action' => 'checkin', 'lng' => $lng)),
|
|
'method' => 'post',
|
|
);
|
|
}
|
|
}
|
|
echo $output->render(new tool_customlang_menu($menu));
|
|
|
|
echo $output->footer();
|