if ($euserid) { $referer = $CFG->wwwroot . '/local/rcommon/users.php?action=manage&username='******'/local/rcommon/users.php'; } } else { $referer = $CFG->wwwroot . '/local/rcommon/books.php?id=' . $book->id; } $form = new local_rcommon_edit_credentials_form(); if ($form->is_cancelled()) { redirect($referer); } else { if ($fromform = $form->get_data() and confirm_sesskey()) { if (empty($fromform->id)) { $userid = $fromform->euserid ? $fromform->euserid : 0; $id = credentials::add($fromform->isbn, $fromform->credentials, $userid); if (!$id) { redirect($referer, get_string('saveko', 'local_rcommon'), 5); } } else { $success = credentials::update($fromform->id, $fromform->isbn, $fromform->credentials); if (!$success) { redirect($referer, get_string('saveko', 'local_rcommon'), 5); } } redirect($referer, get_string('saveok', 'local_rcommon'), 2); } else { $credential->backto = $backto; $form->set_data($credential); $form->display(); }
require_login(); $pagetitle = get_string('keymanager', 'local_rcommon'); $url = new moodle_url('/local/rcommon/formInsert.php', $_REQUEST); // Base URL $context = context_system::instance(); $PAGE->set_context($context); $PAGE->set_heading($pagetitle); $PAGE->set_url($url); $PAGE->set_title($pagetitle); $PAGE->navbar->add($pagetitle, null, null, navigation_node::TYPE_CUSTOM, null); echo $OUTPUT->header(); $isbn = required_param('isbn', PARAM_TEXT); $url = base64_decode(optional_param('url', '', PARAM_TEXT)); $key = optional_param('key', false, PARAM_TEXT); if (!empty($key)) { credentials::add($isbn, $key, $USER->id); echo '<script>document.location.href="' . $url . '";</script>'; } else { echo $OUTPUT->heading(get_string('insertkeymsg', 'local_rcommon')); ?> <form id="keyform" method="POST"> <input type="text" name="key"> <input type="hidden" name="isbn" value="<?php echo $isbn; ?> "> <input type="hidden" name="url" value="<?php echo base64_encode($url); ?> "> <input type="submit" value="<?php
$upt->track('status', get_string('keymanager_import_error_21', 'local_rcommon'), 'warning'); $warning = true; } else { $processed_credential[$credential->isbn][$credential->credential] = true; } if ($error) { $errors++; continue; } else { if ($warning) { $warnings++; } } // Ok Do it if ($continue) { if (credentials::add($credential->isbn, $credential->credential, $credential->euserid)) { $upt->track('status', get_string('success'), 'info'); $do_ok++; } else { $upt->track('status', get_string('error'), 'error'); $do_errors++; } } } $upt->close(); // close table $cir->close(); // Show the summary if ($linenum <= 1) { // Empty file echo $OUTPUT->notification(get_string('keymanager_import_error_17', 'local_rcommon'));