unregistration MDL-21936 add site unregistration
This commit is contained in:
@@ -34,6 +34,62 @@
|
||||
require_once($CFG->dirroot . '/lib/formslib.php');
|
||||
require_once($CFG->dirroot . '/admin/registration/lib.php');
|
||||
|
||||
/**
|
||||
* This form display a unregistration form.
|
||||
*/
|
||||
class site_unregistration_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
$mform = & $this->_form;
|
||||
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
|
||||
|
||||
$huburl = $this->_customdata['huburl'];
|
||||
$hubname = $this->_customdata['hubname'];
|
||||
|
||||
$unregisterlabel = get_string('unregister', 'hub');
|
||||
$mform->addElement('checkbox', 'unpublishalladvertisedcourses', '',
|
||||
' ' . get_string('unpublishalladvertisedcourses', 'hub'));
|
||||
$mform->addElement('checkbox', 'unpublishalluploadedcourses', '',
|
||||
' ' . get_string('unpublishalluploadedcourses', 'hub'));
|
||||
|
||||
$mform->addElement('hidden', 'confirm', 1);
|
||||
$mform->addElement('hidden', 'unregistration', 1);
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
$mform->addElement('hidden', 'hubname', $hubname);
|
||||
|
||||
$this->add_action_buttons(true, $unregisterlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This form display a clean registration data form.
|
||||
*/
|
||||
class site_clean_registration_data_form extends moodleform {
|
||||
|
||||
public function definition() {
|
||||
$mform = & $this->_form;
|
||||
$mform->addElement('header', 'site', get_string('unregister', 'hub'));
|
||||
|
||||
$huburl = $this->_customdata['huburl'];
|
||||
$hubname = $this->_customdata['hubname'];
|
||||
|
||||
|
||||
$unregisterlabel = get_string('forceunregister', 'hub');
|
||||
$mform->addElement('static', '', get_string('warning', 'hub'), get_string('forceunregisterconfirmation', 'hub', $hubname));
|
||||
|
||||
|
||||
$mform->addElement('hidden', 'confirm', 1);
|
||||
$mform->addElement('hidden', 'unregistration', 1);
|
||||
$mform->addElement('hidden', 'cleanregdata', 1);
|
||||
$mform->addElement('hidden', 'huburl', $huburl);
|
||||
$mform->addElement('hidden', 'hubname', $hubname);
|
||||
|
||||
$this->add_action_buttons(true, $unregisterlabel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This form display a hub selector.
|
||||
* The hub list is retrieved from Moodle.org hub directory.
|
||||
@@ -374,4 +430,3 @@ class site_registration_form extends moodleform {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@@ -23,17 +24,130 @@
|
||||
*
|
||||
* On this page the administrator select if he wants to register on Moodle.org or
|
||||
* a specific hub
|
||||
*/
|
||||
*/
|
||||
|
||||
require('../../config.php');
|
||||
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->dirroot . '/admin/registration/lib.php');
|
||||
require_once($CFG->dirroot . '/admin/registration/forms.php');
|
||||
require_once($CFG->dirroot . '/course/publish/lib.php');
|
||||
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
admin_externalpage_setup('registrationindex');
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
|
||||
$unregistration = optional_param('unregistration', 0, PARAM_INT);
|
||||
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT);
|
||||
$huburl = optional_param('huburl', '', PARAM_URL);
|
||||
$cancel = optional_param('cancel', null, PARAM_ALPHA);
|
||||
|
||||
$registrationmanager = new registration_manager();
|
||||
$publicationmanager = new course_publish_manager();
|
||||
$errormessage = '';
|
||||
if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
|
||||
|
||||
$hub = $registrationmanager->get_registeredhub($huburl);
|
||||
|
||||
//unpublish course and unregister the site by web service
|
||||
if (!$cleanregdata) {
|
||||
|
||||
//check if we need to unpublish courses
|
||||
//enrollable courses
|
||||
$unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
|
||||
$hubcourseids = array();
|
||||
if ($unpublishalladvertisedcourses) {
|
||||
$enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
|
||||
if (!empty($enrollablecourses)) {
|
||||
foreach ($enrollablecourses as $enrollablecourse) {
|
||||
$hubcourseids[] = $enrollablecourse->hubcourseid;
|
||||
}
|
||||
}
|
||||
}
|
||||
//downloadable courses
|
||||
$unpublishalluploadedcourses = optional_param('unpublishalluploadedcourses', 0, PARAM_INT);
|
||||
if ($unpublishalluploadedcourses) {
|
||||
$downloadablecourses = $publicationmanager->get_publications($huburl, null, 0);
|
||||
if (!empty($downloadablecourses)) {
|
||||
foreach ($downloadablecourses as $downloadablecourse) {
|
||||
$hubcourseids[] = $downloadablecourse->hubcourseid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//unpublish the courses by web service
|
||||
if (!empty($hubcourseids)) {
|
||||
$function = 'hub_unregister_courses';
|
||||
$params = array($hubcourseids);
|
||||
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client();
|
||||
try {
|
||||
$result = $xmlrpcclient->call($serverurl, $hub->token, $function, $params);
|
||||
//delete the published courses
|
||||
if (!empty($enrollablecourses)) {
|
||||
$publicationmanager->delete_hub_publications($huburl, 1);
|
||||
}
|
||||
if (!empty($downloadablecourses)) {
|
||||
$publicationmanager->delete_hub_publications($huburl, 0);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$errormessage = $e->getMessage();
|
||||
$errormessage .= html_writer::empty_tag('br') .
|
||||
get_string('errorunpublishcourses', 'hub');
|
||||
$confirm = false;
|
||||
$cleanregdata = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//course unpublish went ok, unregister the site now
|
||||
if ($confirm) {
|
||||
$function = 'hub_unregister_site';
|
||||
$params = array();
|
||||
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
|
||||
$xmlrpcclient = new webservice_xmlrpc_client();
|
||||
try {
|
||||
$result = $xmlrpcclient->call($serverurl, $hub->token, $function, $params);
|
||||
} catch (Exception $e) {
|
||||
$errormessage = $e->getMessage();
|
||||
$confirm = false;
|
||||
$cleanregdata = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check that we are still processing the unregistration,
|
||||
//it could have been unset if an exception were previsouly catched
|
||||
if ($confirm) {
|
||||
$registrationmanager->delete_registeredhub($huburl);
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
|
||||
echo $renderer->registrationselector();
|
||||
|
||||
//do not check sesskey if confirm = false because this script is linked into email message
|
||||
if (!empty($errormessage)) {
|
||||
echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
|
||||
}
|
||||
if (empty($cancel) and $unregistration and !$confirm) {
|
||||
$hub = $registrationmanager->get_registeredhub($huburl);
|
||||
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
|
||||
if ($cleanregdata) {
|
||||
$siteunregistrationform = new site_clean_registration_data_form('',
|
||||
array('huburl' => $huburl, 'hubname' => $hub->hubname));
|
||||
} else {
|
||||
$siteunregistrationform = new site_unregistration_form('',
|
||||
array('huburl' => $huburl, 'hubname' => $hub->hubname));
|
||||
}
|
||||
$siteunregistrationform->display();
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('registeron', 'hub'), 3, 'main');
|
||||
echo $renderer->registrationselector();
|
||||
$hubs = $registrationmanager->get_registered_on_hubs();
|
||||
if (!empty($hubs)) {
|
||||
echo $OUTPUT->heading(get_string('registeredon', 'hub'), 3, 'main');
|
||||
echo $renderer->registeredonhublisting($hubs);
|
||||
}
|
||||
}
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
@@ -60,6 +60,15 @@ class registration_manager {
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* When a site unregister from a hub, he must call this function
|
||||
* @param string $huburl the huburl to delete
|
||||
*/
|
||||
public function delete_registeredhub($huburl) {
|
||||
global $DB;
|
||||
$DB->delete_records('registration_hubs', array('huburl' => $huburl));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a hub on which the site is registered for a given url or token
|
||||
* Mostly use to check if the site is registered on a specific hub
|
||||
@@ -111,7 +120,7 @@ class registration_manager {
|
||||
*/
|
||||
public function get_registered_on_hubs() {
|
||||
global $DB;
|
||||
$hubs = $DB->get_records('registration_hubs', array());
|
||||
$hubs = $DB->get_records('registration_hubs', array('confirmed' => 1));
|
||||
return $hubs;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// This file is part of Moodle - http://moodle.org/ //
|
||||
@@ -19,7 +20,6 @@
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Registration renderer.
|
||||
* @package moodle
|
||||
@@ -37,8 +37,8 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function registration_confirmation($confirmationmessage) {
|
||||
global $OUTPUT;
|
||||
$linktositelist = html_writer::tag('a', get_string('sitelist','hub'), array('href' => new moodle_url('/local/hub/index.php')));
|
||||
$message = $confirmationmessage.html_writer::empty_tag('br').$linktositelist;
|
||||
$linktositelist = html_writer::tag('a', get_string('sitelist', 'hub'), array('href' => new moodle_url('/local/hub/index.php')));
|
||||
$message = $confirmationmessage . html_writer::empty_tag('br') . $linktositelist;
|
||||
return $OUTPUT->box($message);
|
||||
}
|
||||
|
||||
@@ -49,18 +49,17 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
global $OUTPUT;
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub'));
|
||||
$table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub'));
|
||||
$table->size = array('50%', '50%');
|
||||
//$table->attributes['class'] = 'registerindextable';
|
||||
|
||||
//Moodle.org information cell
|
||||
$moodleorgcell = get_string('moodleorgregistrationdetail', 'hub');
|
||||
$moodleorgcell .= html_writer::empty_tag('br').html_writer::empty_tag('br');
|
||||
$moodleorgcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
|
||||
$moodleorgcell = html_writer::tag('div', $moodleorgcell, array('class' => 'justifytext'));
|
||||
|
||||
//Specific hub information cell
|
||||
$specifichubcell = get_string('specifichubregistrationdetail', 'hub');
|
||||
$specifichubcell .= html_writer::empty_tag('br').html_writer::empty_tag('br');
|
||||
$specifichubcell .= html_writer::empty_tag('br') . html_writer::empty_tag('br');
|
||||
$specifichubcell = html_writer::tag('div', $specifichubcell, array('class' => 'justifytext'));
|
||||
|
||||
//add information cells
|
||||
@@ -70,8 +69,8 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
|
||||
//Moodle.org button cell
|
||||
$registeronmoodleorgurl = new moodle_url("/admin/registration/register.php",
|
||||
array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL
|
||||
, 'hubname' => 'Moodle.org'));
|
||||
array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL
|
||||
, 'hubname' => 'Moodle.org'));
|
||||
$registeronmoodleorgbutton = new single_button($registeronmoodleorgurl, get_string('registeronmoodleorg', 'hub'));
|
||||
$registeronmoodleorgbutton->class = 'centeredbutton';
|
||||
$registeronmoodleorgbuttonhtml = $OUTPUT->render($registeronmoodleorgbutton);
|
||||
@@ -79,7 +78,7 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
|
||||
//Specific hub button cell
|
||||
$registeronspecifichuburl = new moodle_url("/admin/registration/hubselector.php",
|
||||
array('sesskey' => sesskey()));
|
||||
array('sesskey' => sesskey()));
|
||||
$registeronspecifichubbutton = new single_button($registeronspecifichuburl, get_string('registeronspecifichub', 'hub'));
|
||||
$registeronspecifichubbutton->class = 'centeredbutton';
|
||||
$registeronspecifichubbuttonhtml = $OUTPUT->render($registeronspecifichubbutton);
|
||||
@@ -91,7 +90,36 @@ class core_register_renderer extends plugin_renderer_base {
|
||||
$table->data[] = $row;
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of registered on hub
|
||||
*/
|
||||
public function registeredonhublisting($hubs) {
|
||||
global $OUTPUT;
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('80%', '20%');
|
||||
|
||||
foreach ($hubs as $hub) {
|
||||
$hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
|
||||
$hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
|
||||
|
||||
$unregisterhuburl = new moodle_url("/admin/registration/index.php",
|
||||
array('sesskey' => sesskey(), 'huburl' => $hub->huburl, 'unregistration' => 1));
|
||||
$unregisterbutton = new single_button($unregisterhuburl,
|
||||
get_string('unregister', 'hub'));
|
||||
$unregisterbutton->class = 'centeredbutton';
|
||||
$unregisterbuttonhtml = $OUTPUT->render($unregisterbutton);
|
||||
|
||||
//add button cells
|
||||
$cells = array($hublinkcell, $unregisterbuttonhtml);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -112,5 +112,6 @@ $backupfile->delete();
|
||||
|
||||
//redirect to the index publication page
|
||||
redirect(new moodle_url('/course/publish/index.php',
|
||||
array('sesskey' => sesskey(), 'id' => $id, 'published' => true)));
|
||||
array('sesskey' => sesskey(), 'id' => $id,
|
||||
'published' => true, 'huburl' => $huburl, 'hubname' => $hubname)));
|
||||
?>
|
||||
|
||||
@@ -106,7 +106,7 @@ class course_publication_form extends moodleform {
|
||||
$registrationmanager = new registration_manager();
|
||||
$registeredhub = $registrationmanager->get_registeredhub($huburl);
|
||||
$publicationmanager = new course_publish_manager();
|
||||
$publications = $publicationmanager->get_publications($registeredhub->id, $course->id, $advertise);
|
||||
$publications = $publicationmanager->get_publications($registeredhub->huburl, $course->id, $advertise);
|
||||
|
||||
if (!empty($publications)) {
|
||||
//get the last publication of this course
|
||||
|
||||
+50
-20
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@@ -13,8 +14,6 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
/// TIME PERIOD ///
|
||||
|
||||
define('HUB_LASTMODIFIED_WEEK', 7);
|
||||
@@ -100,8 +99,6 @@ define('HUB_HUBSCREENSHOT_FILE_TYPE', 'hubscreenshot');
|
||||
*/
|
||||
define('HUB_BACKUP_FILE_TYPE', 'backup');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Course publication library
|
||||
@@ -112,7 +109,6 @@ define('HUB_BACKUP_FILE_TYPE', 'backup');
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
class course_publish_manager {
|
||||
|
||||
/**
|
||||
@@ -122,10 +118,10 @@ class course_publish_manager {
|
||||
* @param int $enrollable if the course is enrollable = 1, if downloadable = 0
|
||||
* @param int $hubcourseid the course id from the hub point of view
|
||||
*/
|
||||
public function add_course_publication($hubid, $courseid, $enrollable, $hubcourseid) {
|
||||
public function add_course_publication($huburl, $courseid, $enrollable, $hubcourseid) {
|
||||
global $DB;
|
||||
$publication = new stdClass();
|
||||
$publication->hubid = $hubid;
|
||||
$publication->huburl = $huburl;
|
||||
$publication->courseid = $courseid;
|
||||
$publication->hubcourseid = $hubcourseid;
|
||||
$publication->enrollable = $enrollable;
|
||||
@@ -155,16 +151,29 @@ class course_publish_manager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get courses publication for a given hub, a given course and a given type (enrollable or downloadable)
|
||||
* @param int $hubid
|
||||
* @param int $courseid
|
||||
* @param int $enrollable
|
||||
* Get courses publications
|
||||
* @param int $hubid specify a hub
|
||||
* @param int $courseid specify a course
|
||||
* @param int $enrollable specify type of publication (enrollable or downloadable)
|
||||
* @return array of publications
|
||||
*/
|
||||
public function get_publications($hubid, $courseid, $enrollable) {
|
||||
public function get_publications($huburl = null, $courseid = null, $enrollable = -1) {
|
||||
global $DB;
|
||||
return $DB->get_records('course_published',
|
||||
array('hubid' => $hubid, 'courseid' => $courseid, 'enrollable' => $enrollable));
|
||||
$params = array();
|
||||
|
||||
if (!empty($huburl)) {
|
||||
$params['huburl'] = $huburl;
|
||||
}
|
||||
|
||||
if (!empty($courseid)) {
|
||||
$params['courseid'] = $courseid;
|
||||
}
|
||||
|
||||
if ($enrollable != -1) {
|
||||
$params['enrollable'] = $enrollable;
|
||||
}
|
||||
|
||||
return $DB->get_records('course_published', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,9 +196,10 @@ class course_publish_manager {
|
||||
*/
|
||||
public function get_course_publications($courseid) {
|
||||
global $DB;
|
||||
$sql = 'SELECT cp.id, cp.status, cp.timechecked, cp.timepublished, rh.hubname, rh.huburl, cp.courseid, cp.enrollable, cp.hubcourseid
|
||||
$sql = 'SELECT cp.id, cp.status, cp.timechecked, cp.timepublished, rh.hubname,
|
||||
rh.huburl, cp.courseid, cp.enrollable, cp.hubcourseid
|
||||
FROM {course_published} cp, {registration_hubs} rh
|
||||
WHERE cp.hubid = rh.id and cp.courseid = :courseid
|
||||
WHERE cp.huburl = rh.huburl and cp.courseid = :courseid
|
||||
ORDER BY cp.enrollable DESC, rh.hubname, cp.timepublished';
|
||||
$params = array('courseid' => $courseid);
|
||||
return $DB->get_records_sql($sql, $params);
|
||||
@@ -202,9 +212,9 @@ class course_publish_manager {
|
||||
*/
|
||||
public function get_registeredhub_by_publication($publicationid) {
|
||||
global $DB;
|
||||
$sql = 'SELECT cp.hubid, rh.hubname, rh.huburl, rh.token
|
||||
$sql = 'SELECT rh.huburl, rh.hubname, rh.token
|
||||
FROM {course_published} cp, {registration_hubs} rh
|
||||
WHERE cp.hubid = rh.id and cp.id = :publicationid';
|
||||
WHERE cp.huburl = rh.huburl and cp.id = :publicationid';
|
||||
$params = array('publicationid' => $publicationid);
|
||||
return $DB->get_record_sql($sql, $params);
|
||||
}
|
||||
@@ -217,7 +227,27 @@ class course_publish_manager {
|
||||
global $DB;
|
||||
$DB->delete_records('course_published', array('id' => $publicationid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete publications for a hub
|
||||
* @param string $huburl
|
||||
* @param int $enrollable
|
||||
*/
|
||||
public function delete_hub_publications($huburl, $enrollable = -1) {
|
||||
global $DB;
|
||||
|
||||
$params = array();
|
||||
|
||||
if (!empty($huburl)) {
|
||||
$params['huburl'] = $huburl;
|
||||
}
|
||||
|
||||
if ($enrollable != -1) {
|
||||
$params['enrollable'] = $enrollable;
|
||||
}
|
||||
|
||||
$DB->delete_records('course_published', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of all block instances for a given context
|
||||
@@ -228,6 +258,6 @@ class course_publish_manager {
|
||||
global $DB;
|
||||
return $DB->get_records('block_instances', array('parentcontextid' => $contextid), $sort);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -175,7 +175,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE,
|
||||
$publication = $publicationmanager->get_publication($courseids[0]);
|
||||
if (empty($publication)) {
|
||||
//if never been published or if we share, we need to save this new publication record
|
||||
$publicationmanager->add_course_publication($registeredhub->id, $course->id, !$share, $courseids[0]);
|
||||
$publicationmanager->add_course_publication($registeredhub->huburl, $course->id, !$share, $courseids[0]);
|
||||
} else {
|
||||
//if we update the enrollable course publication we update the publication record
|
||||
$publicationmanager->update_enrollable_course_publication($publication->id);
|
||||
|
||||
+13
-2
@@ -63,7 +63,7 @@ $string['coursepublished'] = 'This course has been published on \'{$a}\' success
|
||||
$string['courseshortname'] = 'Shortname';
|
||||
$string['courseshortname_help'] = 'Enter any shortname for your course. It is not an identifier (i.e many courses can have a same shortname in a search result.)';
|
||||
$string['coursesnumber'] = 'Number of courses ({$a})';
|
||||
$string['courseunpublished'] = 'the course {$a->courseshortname} has been unpublished from {$a->hubname} successfully.';
|
||||
$string['courseunpublished'] = 'The course {$a->courseshortname} has been unpublished from {$a->hubname} successfully.';
|
||||
$string['courseurl'] = 'Course URL';
|
||||
$string['courseurl_help'] = 'It is the URL of your course. This url is displayed as a link in a search result.';
|
||||
$string['creatorname'] = 'Creator';
|
||||
@@ -98,8 +98,11 @@ $string['errorcoursewronglypublished'] = 'A publication error has been returned
|
||||
$string['errorhublisting'] = 'An error occured when retrieving the hub listing from Moodle.org, please try again later. ({$a})';
|
||||
$string['errorlangnotrecognized'] = 'Language code is unknown by Moodle. Please contact {$a}';
|
||||
$string['errorregistration'] = 'An error occured during registration, please try again later. ({$a})';
|
||||
$string['errorunpublishcourses']= 'Due to an unexpected error, the courses haven\'t been deleted on the hub. Try again later (recommanded) or clean up your registration data.';
|
||||
$string['existingscreenshotnumber'] = '{$a} existing screenshots. You will be able to see these screenshots on this page, only once the hub administrator enables your course.';
|
||||
$string['existingscreenshots'] = 'Existing screenshots';
|
||||
$string['forceunregister'] = 'Yes, clean registration data';
|
||||
$string['forceunregisterconfirmation'] = 'Your site can not reach {$a}. This hub could be temporary down. We strongly recommand you to Cancel this operation and try again later. However if you have received the instruction to clean you registration data you can continue.';
|
||||
$string['geolocation'] = 'latitude - longitude';
|
||||
$string['geolocation_help'] = 'A geolocation code like you can find on Google Map or Twitter (example: -31.947884,115.871285)';
|
||||
$string['hub'] = 'Hub';
|
||||
@@ -157,6 +160,7 @@ $string['questionsnumber'] = 'Number of questions ({$a})';
|
||||
$string['registeredcourses'] = 'Registered courses';
|
||||
$string['registeredsites'] = 'Registered sites';
|
||||
$string['registrationinfo'] = 'Registration information';
|
||||
$string['registeredon'] = 'Registered on';
|
||||
$string['registersite'] = 'Register on {$a}';
|
||||
$string['registeron'] = 'Register your site';
|
||||
$string['registeronmoodleorg'] = 'Register on Moodle.org now';
|
||||
@@ -227,15 +231,21 @@ $string['statuspublished'] = 'Listed';
|
||||
$string['statusunpublished'] = 'Not Listed';
|
||||
$string['subject'] = 'Subject';
|
||||
$string['tags'] = 'Tags';
|
||||
$string['tags_help'] = 'Your course can be searched against these tag words. Separate your tag words with a comma. Example: math, algebric, geometry';
|
||||
$string['tags_help'] = 'Your course can be searched against these tag words. Separate your tag words with a comma. Example: math, algebra, geometry';
|
||||
$string['trustme'] = 'Trust';
|
||||
$string['type'] = 'Advertised / Shared';
|
||||
$string['unknownstatus'] = 'unknown.';
|
||||
$string['unlistedurl'] = 'Unlisted hub URL';
|
||||
$string['unprioritise'] = 'Unprioritise';
|
||||
$string['unpublish'] = 'Unpublish';
|
||||
$string['unpublishalladvertisedcourses'] = 'Unpublish all advertised course';
|
||||
$string['unpublishalluploadedcourses'] = 'Unpublish all shared course';
|
||||
$string['unpublishconfirmation'] = 'Do you really want to unpublish the course {$a->courseshortname} from the hub {$a->hubname}';
|
||||
$string['unpublishcourse'] = 'Unpublish {$a}';
|
||||
$string['unregister'] = 'Unregister';
|
||||
$string['unregisterfrom'] = 'Unregister from {$a}';
|
||||
$string['unregisterconfirmation'] = 'You are about to unregistered this site from {$a}. Note than none of this site courses will be unpublished. Once the site is unregistered, you will not be able to unpublish your courses anymore. If you want to unpublish your courses, take care to do it before to continue. Are you sure to unregister your site from the hub?';
|
||||
$string['unregistrationerror'] = 'An error occured when the site tried to unregister from the hub: {$a}';
|
||||
$string['untrustme'] = 'Untrust';
|
||||
$string['update'] = 'Update';
|
||||
$string['updatesite'] = 'Update registration on {$a}';
|
||||
@@ -244,6 +254,7 @@ $string['uploaded'] = 'Uploaded';
|
||||
$string['url'] = 'hub URL';
|
||||
$string['urlalreadyregistered'] = 'Your site is already registered on {$a}. It means that your site is not synchronized with {$a} anymore. Alert the hub administrator. Once the hub administrator reset your registration, you will be able to register a new time. Let the hub administrator know if you want to keep your already published courses.';
|
||||
$string['usersnumber'] = 'Number of users ({$a})';
|
||||
$string['warning'] = 'WARNING';
|
||||
$string['wrongtoken'] = 'The registration failed. Press continue and try again.';
|
||||
$string['wrongurlformat'] = 'Bad URL format';
|
||||
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20100615" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20100624" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -2674,9 +2674,9 @@
|
||||
</TABLE>
|
||||
<TABLE NAME="course_published" COMMENT="Information about how and when an local courses were published to hubs" PREVIOUS="backup_logs">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="hubid"/>
|
||||
<FIELD NAME="hubid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="the id of the "registered on" hub" PREVIOUS="id" NEXT="courseid"/>
|
||||
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="the id of the published course" PREVIOUS="hubid" NEXT="timepublished"/>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="huburl"/>
|
||||
<FIELD NAME="huburl" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="the url of the "registered on" hub" PREVIOUS="id" NEXT="courseid"/>
|
||||
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="the id of the published course" PREVIOUS="huburl" NEXT="timepublished"/>
|
||||
<FIELD NAME="timepublished" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="The time when the publication occurred" PREVIOUS="courseid" NEXT="enrollable"/>
|
||||
<FIELD NAME="enrollable" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" COMMENT="1 = enrollable, 0 = downloadable" PREVIOUS="timepublished" NEXT="hubcourseid"/>
|
||||
<FIELD NAME="hubcourseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="the course id on the hub server" PREVIOUS="enrollable" NEXT="status"/>
|
||||
@@ -2688,4 +2688,4 @@
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
+26
-1
@@ -4359,7 +4359,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
|
||||
// unfortunately old enrol plugins were doing sometimes weird role assignments :-(
|
||||
|
||||
// enabled
|
||||
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
|
||||
$enabledplugins = explode(',', $CFG->enrol_plugins_enabled);
|
||||
list($sqlenabled, $params) = $DB->get_in_or_equal($enabledplugins, SQL_PARAMS_NAMED, 'ena00');
|
||||
$params['siteid'] = SITEID;
|
||||
$sql = "INSERT INTO {enrol} (enrol, status, courseid, sortorder, enrolperiod, enrolstartdate, enrolenddate, expirynotify, expirythreshold,
|
||||
@@ -4822,6 +4822,31 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
|
||||
upgrade_main_savepoint($result, 2010061900.32);
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2010062101) {
|
||||
|
||||
/// Define field huburl to be dropped from course_published
|
||||
$table = new xmldb_table('course_published');
|
||||
$field = new xmldb_field('hubid');
|
||||
|
||||
/// Conditionally launch drop field huburl
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
/// Define field huburl to be added to course_published
|
||||
$table = new xmldb_table('course_published');
|
||||
$field = new xmldb_field('huburl', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'id');
|
||||
|
||||
/// Conditionally launch add field huburl
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
/// Main savepoint reached
|
||||
upgrade_main_savepoint($result, 2010062101);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2010062100; // YYYYMMDD = date of the last version bump
|
||||
$version = 2010062101; // YYYYMMDD = date of the last version bump
|
||||
// XX = daily increments
|
||||
|
||||
$release = '2.0 Preview 3 (Build: 20100625)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user