Merge branch 'wip-MDL-62312-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE
This commit is contained in:
@@ -37,7 +37,7 @@ require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
|
||||
|
||||
admin_externalpage_setup('registrationhubs');
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
$renderer = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
$unregistration = optional_param('unregistration', 0, PARAM_INT);
|
||||
$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
|
||||
@@ -181,8 +181,7 @@ if (empty($cancel) and $unregistration and !$confirm) {
|
||||
echo $OUTPUT->header();
|
||||
|
||||
//check if the site is registered on Moodle.org and display a message about registering on MOOCH
|
||||
$adminrenderer = $PAGE->get_renderer('core', 'admin');
|
||||
echo $adminrenderer->warn_if_not_registered();
|
||||
echo $renderer->warn_if_not_registered();
|
||||
|
||||
//do not check sesskey if confirm = false because this script is linked into email message
|
||||
if (!empty($errormessage)) {
|
||||
|
||||
@@ -195,7 +195,7 @@ if ($huburl == HUB_MOODLEORGHUBURL) {
|
||||
echo $OUTPUT->notification($registrationmessage, $notificationtype);
|
||||
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
|
||||
$renderer = $PAGE->get_renderer('core', 'register');
|
||||
$renderer = $PAGE->get_renderer('core', 'admin');
|
||||
echo $renderer->moodleorg_registration_message();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// This file is part of Moodle - http://moodle.org/ //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// //
|
||||
// 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/>. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Registration renderer.
|
||||
* @package moodle
|
||||
* @subpackage registration
|
||||
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
|
||||
* @author Jerome Mouneyrac
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_register_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Display message about the benefits of registering on Moodle.org
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
return $moodleorgregmsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a box message confirming a site registration (add or update)
|
||||
* @param string $confirmationmessage
|
||||
* @return string
|
||||
*/
|
||||
public function registration_confirmation($confirmationmessage) {
|
||||
$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 $this->output->box($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of registered on hub
|
||||
*/
|
||||
public function registeredonhublisting($hubs) {
|
||||
global $CFG;
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('80%', '20%');
|
||||
|
||||
foreach ($hubs as $hub) {
|
||||
if ($hub->huburl == HUB_MOODLEORGHUBURL) {
|
||||
$hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname);
|
||||
}
|
||||
$hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
|
||||
$hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
|
||||
|
||||
$unregisterhuburl = new moodle_url("/" . $CFG->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 = $this->output->render($unregisterbutton);
|
||||
|
||||
//add button cells
|
||||
$cells = array($hublinkcell, $unregisterbuttonhtml);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2033,4 +2033,69 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->warning(get_string('legacylogginginuse'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display message about the benefits of registering on Moodle.org
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
return $moodleorgregmsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a box message confirming a site registration (add or update)
|
||||
* @param string $confirmationmessage
|
||||
* @return string
|
||||
*/
|
||||
public function registration_confirmation($confirmationmessage) {
|
||||
$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 $this->output->box($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of registered on hub
|
||||
*
|
||||
* @param stdClass[] $hubs
|
||||
* @return string
|
||||
*/
|
||||
public function registeredonhublisting($hubs) {
|
||||
global $CFG;
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('80%', '20%');
|
||||
|
||||
foreach ($hubs as $hub) {
|
||||
if ($hub->huburl == HUB_MOODLEORGHUBURL) {
|
||||
$hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname);
|
||||
}
|
||||
$hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
|
||||
$hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
|
||||
|
||||
$unregisterhuburl = new moodle_url("/" . $CFG->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 = $this->output->render($unregisterbutton);
|
||||
|
||||
// Add button cells.
|
||||
$cells = array($hublinkcell, $unregisterbuttonhtml);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ $registeredhub = $registrationmanager->get_registeredhub($huburl);
|
||||
//display the sending file page
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('sendingcourse', 'hub'), 3, 'main');
|
||||
$renderer = $PAGE->get_renderer('core', 'publish');
|
||||
$renderer = $PAGE->get_renderer('core', 'course');
|
||||
echo $renderer->sendingbackupinfo($backupfile);
|
||||
if (ob_get_level()) {
|
||||
ob_flush();
|
||||
|
||||
@@ -109,7 +109,7 @@ if (has_capability('moodle/course:publish', context_course::instance($id))) {
|
||||
die();
|
||||
}
|
||||
|
||||
$renderer = $PAGE->get_renderer('core', 'publish');
|
||||
$renderer = $PAGE->get_renderer('core', 'course');
|
||||
|
||||
/// UNPUBLISH
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
|
||||
@@ -263,7 +263,7 @@ if (has_capability('moodle/course:publish', context_course::instance($id))) {
|
||||
//only print error log in apache (for backward compatibility)
|
||||
error_log(print_r($e->getMessage(), true));
|
||||
}
|
||||
$renderer = $PAGE->get_renderer('core', 'publish');
|
||||
$renderer = $PAGE->get_renderer('core', 'course');
|
||||
if (!empty($hubinfo)) {
|
||||
echo $renderer->hubinfo($hubinfo);
|
||||
}
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
<?php
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// This file is part of Moodle - http://moodle.org/ //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// //
|
||||
// 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/>. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Course publish renderer.
|
||||
* @package course
|
||||
* @subpackage publish
|
||||
* @copyright 2010 Moodle Pty Ltd (http://moodle.com)
|
||||
* @author Jerome Mouneyrac
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class core_publish_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Display the selector to advertise or publish a course
|
||||
*/
|
||||
public function publicationselector($courseid) {
|
||||
$text = '';
|
||||
|
||||
$advertiseurl = new moodle_url("/course/publish/hubselector.php",
|
||||
array('sesskey' => sesskey(), 'id' => $courseid, 'advertise' => true));
|
||||
$advertisebutton = new single_button($advertiseurl, get_string('advertise', 'hub'));
|
||||
$text .= $this->output->render($advertisebutton);
|
||||
$text .= html_writer::tag('div', get_string('advertisepublication_help', 'hub'),
|
||||
array('class' => 'publishhelp'));
|
||||
|
||||
$text .= html_writer::empty_tag('br'); /// TODO Delete
|
||||
|
||||
$uploadurl = new moodle_url("/course/publish/hubselector.php",
|
||||
array('sesskey' => sesskey(), 'id' => $courseid, 'share' => true));
|
||||
$uploadbutton = new single_button($uploadurl, get_string('share', 'hub'));
|
||||
$text .= $this->output->render($uploadbutton);
|
||||
$text .= html_writer::tag('div', get_string('sharepublication_help', 'hub'),
|
||||
array('class' => 'publishhelp'));
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of hub where a course is registered on
|
||||
*/
|
||||
public function registeredonhublisting($courseid, $publications) {
|
||||
global $CFG;
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('type', 'hub'), get_string('hub', 'hub'),
|
||||
get_string('date'), get_string('status', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('10%', '40%', '20%', '%10', '%15');
|
||||
|
||||
$brtag = html_writer::empty_tag('br');
|
||||
|
||||
foreach ($publications as $publication) {
|
||||
|
||||
$updatebuttonhtml = '';
|
||||
|
||||
$params = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'hubcourseid' => $publication->hubcourseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'cancel' => true, 'publicationid' => $publication->id,
|
||||
'timepublished' => $publication->timepublished);
|
||||
$cancelurl = new moodle_url("/course/publish/index.php", $params);
|
||||
$cancelbutton = new single_button($cancelurl, get_string('removefromhub', 'hub'));
|
||||
$cancelbutton->class = 'centeredbutton';
|
||||
$cancelbuttonhtml = $this->output->render($cancelbutton);
|
||||
|
||||
if ($publication->enrollable) {
|
||||
$params = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'share' => !$publication->enrollable, 'advertise' => $publication->enrollable);
|
||||
$updateurl = new moodle_url("/course/publish/metadata.php", $params);
|
||||
$updatebutton = new single_button($updateurl, get_string('update', 'hub'));
|
||||
$updatebutton->class = 'centeredbutton';
|
||||
$updatebuttonhtml = $this->output->render($updatebutton);
|
||||
|
||||
$operations = $updatebuttonhtml . $brtag . $cancelbuttonhtml;
|
||||
} else {
|
||||
$operations = $cancelbuttonhtml;
|
||||
}
|
||||
|
||||
$hubname = html_writer::tag('a',
|
||||
$publication->hubname ? $publication->hubname : $publication->huburl,
|
||||
array('href' => $publication->huburl));
|
||||
//if the publication check time if bigger than May 2010, it has been checked
|
||||
if ($publication->timechecked > 1273127954) {
|
||||
if ($publication->status == 0) {
|
||||
$status = get_string('statusunpublished', 'hub');
|
||||
} else {
|
||||
$status = get_string('statuspublished', 'hub');
|
||||
}
|
||||
|
||||
$status .= $brtag . html_writer::tag('a', get_string('updatestatus', 'hub'),
|
||||
array('href' => $CFG->wwwroot . '/course/publish/index.php?id='
|
||||
. $courseid . "&updatestatusid=" . $publication->id
|
||||
. "&sesskey=" . sesskey())) .
|
||||
$brtag . get_string('lasttimechecked', 'hub') . ": "
|
||||
. format_time(time() - $publication->timechecked);
|
||||
} else {
|
||||
$status = get_string('neverchecked', 'hub') . $brtag
|
||||
. html_writer::tag('a', get_string('updatestatus', 'hub'),
|
||||
array('href' => $CFG->wwwroot . '/course/publish/index.php?id='
|
||||
. $courseid . "&updatestatusid=" . $publication->id
|
||||
. "&sesskey=" . sesskey()));
|
||||
}
|
||||
//add button cells
|
||||
$cells = array($publication->enrollable ?
|
||||
get_string('advertised', 'hub') : get_string('shared', 'hub'),
|
||||
$hubname, userdate($publication->timepublished,
|
||||
get_string('strftimedatetimeshort')), $status, $operations);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
$contenthtml = html_writer::table($table);
|
||||
|
||||
return $contenthtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display unpublishing confirmation page
|
||||
* @param object $publication
|
||||
* $publication->courseshortname
|
||||
$publication->courseid
|
||||
$publication->hubname
|
||||
$publication->huburl
|
||||
$publication->id
|
||||
*/
|
||||
public function confirmunpublishing($publication) {
|
||||
$optionsyes = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'hubcourseid' => $publication->hubcourseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
|
||||
$optionsno = array('sesskey' => sesskey(), 'id' => $publication->courseid);
|
||||
$publication->hubname = html_writer::tag('a', $publication->hubname,
|
||||
array('href' => $publication->huburl));
|
||||
$formcontinue = new single_button(new moodle_url("/course/publish/index.php",
|
||||
$optionsyes), get_string('unpublish', 'hub'), 'post');
|
||||
$formcancel = new single_button(new moodle_url("/course/publish/index.php",
|
||||
$optionsno), get_string('cancel'), 'get');
|
||||
return $this->output->confirm(get_string('unpublishconfirmation', 'hub', $publication),
|
||||
$formcontinue, $formcancel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display waiting information about backup size during uploading backup process
|
||||
* @param object $backupfile the backup stored_file
|
||||
* @return $html string
|
||||
*/
|
||||
public function sendingbackupinfo($backupfile) {
|
||||
$sizeinfo = new stdClass();
|
||||
$sizeinfo->total = number_format($backupfile->get_filesize() / 1000000, 2);
|
||||
$html = html_writer::tag('div', get_string('sendingsize', 'hub', $sizeinfo),
|
||||
array('class' => 'courseuploadtextinfo'));
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display upload successfull message and a button to the publish index page
|
||||
* @param int $id the course id
|
||||
* @param string $huburl the hub url where the course is published
|
||||
* @param string $hubname the hub name where the course is published
|
||||
* @return $html string
|
||||
*/
|
||||
public function sentbackupinfo($id, $huburl, $hubname) {
|
||||
$html = html_writer::tag('div', get_string('sent', 'hub'),
|
||||
array('class' => 'courseuploadtextinfo'));
|
||||
$publishindexurl = new moodle_url('/course/publish/index.php',
|
||||
array('sesskey' => sesskey(), 'id' => $id,
|
||||
'published' => true, 'huburl' => $huburl, 'hubname' => $hubname));
|
||||
$continue = $this->output->render(
|
||||
new single_button($publishindexurl, get_string('continue', 'hub')));
|
||||
$html .= html_writer::tag('div', $continue, array('class' => 'sharecoursecontinue'));
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hub information (logo - name - description - link)
|
||||
* @param object $hubinfo
|
||||
* @return string html code
|
||||
*/
|
||||
public function hubinfo($hubinfo) {
|
||||
$params = array('filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
|
||||
$imgurl = new moodle_url($hubinfo['url'] .
|
||||
"/local/hub/webservice/download.php", $params);
|
||||
$screenshothtml = html_writer::empty_tag('img',
|
||||
array('src' => $imgurl, 'alt' => $hubinfo['name']));
|
||||
$hubdescription = html_writer::tag('div', $screenshothtml,
|
||||
array('class' => 'hubscreenshot'));
|
||||
|
||||
$hubdescription .= html_writer::tag('a', $hubinfo['name'],
|
||||
array('class' => 'hublink', 'href' => $hubinfo['url'],
|
||||
'onclick' => 'this.target="_blank"'));
|
||||
|
||||
$hubdescription .= html_writer::tag('div', format_text($hubinfo['description'], FORMAT_PLAIN),
|
||||
array('class' => 'hubdescription'));
|
||||
$hubdescription = html_writer::tag('div', $hubdescription, array('class' => 'hubinfo'));
|
||||
|
||||
return $hubdescription;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2119,6 +2119,194 @@ class core_course_renderer extends plugin_renderer_base {
|
||||
set_attributes(array('class' => 'frontpage-category-names'));
|
||||
return $this->coursecat_tree($chelper, coursecat::get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the selector to advertise or publish a course
|
||||
* @param int $courseid
|
||||
*/
|
||||
public function publicationselector($courseid) {
|
||||
$text = '';
|
||||
|
||||
$advertiseurl = new moodle_url("/course/publish/hubselector.php",
|
||||
array('sesskey' => sesskey(), 'id' => $courseid, 'advertise' => true));
|
||||
$advertisebutton = new single_button($advertiseurl, get_string('advertise', 'hub'));
|
||||
$text .= $this->output->render($advertisebutton);
|
||||
$text .= html_writer::tag('div', get_string('advertisepublication_help', 'hub'),
|
||||
array('class' => 'publishhelp'));
|
||||
|
||||
$text .= html_writer::empty_tag('br'); // TODO Delete.
|
||||
|
||||
$uploadurl = new moodle_url("/course/publish/hubselector.php",
|
||||
array('sesskey' => sesskey(), 'id' => $courseid, 'share' => true));
|
||||
$uploadbutton = new single_button($uploadurl, get_string('share', 'hub'));
|
||||
$text .= $this->output->render($uploadbutton);
|
||||
$text .= html_writer::tag('div', get_string('sharepublication_help', 'hub'),
|
||||
array('class' => 'publishhelp'));
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the listing of hub where a course is registered on
|
||||
* @param int $courseid
|
||||
* @param array $publications
|
||||
*/
|
||||
public function registeredonhublisting($courseid, $publications) {
|
||||
global $CFG;
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('type', 'hub'), get_string('hub', 'hub'),
|
||||
get_string('date'), get_string('status', 'hub'), get_string('operation', 'hub'));
|
||||
$table->size = array('10%', '40%', '20%', '%10', '%15');
|
||||
|
||||
$brtag = html_writer::empty_tag('br');
|
||||
|
||||
foreach ($publications as $publication) {
|
||||
|
||||
$updatebuttonhtml = '';
|
||||
|
||||
$params = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'hubcourseid' => $publication->hubcourseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'cancel' => true, 'publicationid' => $publication->id,
|
||||
'timepublished' => $publication->timepublished);
|
||||
$cancelurl = new moodle_url("/course/publish/index.php", $params);
|
||||
$cancelbutton = new single_button($cancelurl, get_string('removefromhub', 'hub'));
|
||||
$cancelbutton->class = 'centeredbutton';
|
||||
$cancelbuttonhtml = $this->output->render($cancelbutton);
|
||||
|
||||
if ($publication->enrollable) {
|
||||
$params = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'share' => !$publication->enrollable, 'advertise' => $publication->enrollable);
|
||||
$updateurl = new moodle_url("/course/publish/metadata.php", $params);
|
||||
$updatebutton = new single_button($updateurl, get_string('update', 'hub'));
|
||||
$updatebutton->class = 'centeredbutton';
|
||||
$updatebuttonhtml = $this->output->render($updatebutton);
|
||||
|
||||
$operations = $updatebuttonhtml . $brtag . $cancelbuttonhtml;
|
||||
} else {
|
||||
$operations = $cancelbuttonhtml;
|
||||
}
|
||||
|
||||
$hubname = html_writer::tag('a',
|
||||
$publication->hubname ? $publication->hubname : $publication->huburl,
|
||||
array('href' => $publication->huburl));
|
||||
// If the publication check time if bigger than May 2010, it has been checked.
|
||||
if ($publication->timechecked > 1273127954) {
|
||||
if ($publication->status == 0) {
|
||||
$status = get_string('statusunpublished', 'hub');
|
||||
} else {
|
||||
$status = get_string('statuspublished', 'hub');
|
||||
}
|
||||
|
||||
$status .= $brtag . html_writer::tag('a', get_string('updatestatus', 'hub'),
|
||||
array('href' => $CFG->wwwroot . '/course/publish/index.php?id='
|
||||
. $courseid . "&updatestatusid=" . $publication->id
|
||||
. "&sesskey=" . sesskey())) .
|
||||
$brtag . get_string('lasttimechecked', 'hub') . ": "
|
||||
. format_time(time() - $publication->timechecked);
|
||||
} else {
|
||||
$status = get_string('neverchecked', 'hub') . $brtag
|
||||
. html_writer::tag('a', get_string('updatestatus', 'hub'),
|
||||
array('href' => $CFG->wwwroot . '/course/publish/index.php?id='
|
||||
. $courseid . "&updatestatusid=" . $publication->id
|
||||
. "&sesskey=" . sesskey()));
|
||||
}
|
||||
// Add button cells.
|
||||
$cells = array($publication->enrollable ?
|
||||
get_string('advertised', 'hub') : get_string('shared', 'hub'),
|
||||
$hubname, userdate($publication->timepublished,
|
||||
get_string('strftimedatetimeshort')), $status, $operations);
|
||||
$row = new html_table_row($cells);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
$contenthtml = html_writer::table($table);
|
||||
|
||||
return $contenthtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display unpublishing confirmation page
|
||||
* @param stdClass $publication
|
||||
* $publication->courseshortname
|
||||
* $publication->courseid
|
||||
* $publication->hubname
|
||||
* $publication->huburl
|
||||
* $publication->id
|
||||
*/
|
||||
public function confirmunpublishing($publication) {
|
||||
$optionsyes = array('sesskey' => sesskey(), 'id' => $publication->courseid,
|
||||
'hubcourseid' => $publication->hubcourseid,
|
||||
'huburl' => $publication->huburl, 'hubname' => $publication->hubname,
|
||||
'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
|
||||
$optionsno = array('sesskey' => sesskey(), 'id' => $publication->courseid);
|
||||
$publication->hubname = html_writer::tag('a', $publication->hubname,
|
||||
array('href' => $publication->huburl));
|
||||
$formcontinue = new single_button(new moodle_url("/course/publish/index.php",
|
||||
$optionsyes), get_string('unpublish', 'hub'), 'post');
|
||||
$formcancel = new single_button(new moodle_url("/course/publish/index.php",
|
||||
$optionsno), get_string('cancel'), 'get');
|
||||
return $this->output->confirm(get_string('unpublishconfirmation', 'hub', $publication),
|
||||
$formcontinue, $formcancel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display waiting information about backup size during uploading backup process
|
||||
* @param object $backupfile the backup stored_file
|
||||
* @return $html string
|
||||
*/
|
||||
public function sendingbackupinfo($backupfile) {
|
||||
$sizeinfo = new stdClass();
|
||||
$sizeinfo->total = number_format($backupfile->get_filesize() / 1000000, 2);
|
||||
$html = html_writer::tag('div', get_string('sendingsize', 'hub', $sizeinfo),
|
||||
array('class' => 'courseuploadtextinfo'));
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display upload successfull message and a button to the publish index page
|
||||
* @param int $id the course id
|
||||
* @param string $huburl the hub url where the course is published
|
||||
* @param string $hubname the hub name where the course is published
|
||||
* @return $html string
|
||||
*/
|
||||
public function sentbackupinfo($id, $huburl, $hubname) {
|
||||
$html = html_writer::tag('div', get_string('sent', 'hub'),
|
||||
array('class' => 'courseuploadtextinfo'));
|
||||
$publishindexurl = new moodle_url('/course/publish/index.php',
|
||||
array('sesskey' => sesskey(), 'id' => $id,
|
||||
'published' => true, 'huburl' => $huburl, 'hubname' => $hubname));
|
||||
$continue = $this->output->render(
|
||||
new single_button($publishindexurl, get_string('continue', 'hub')));
|
||||
$html .= html_writer::tag('div', $continue, array('class' => 'sharecoursecontinue'));
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hub information (logo - name - description - link)
|
||||
* @param object $hubinfo
|
||||
* @return string html code
|
||||
*/
|
||||
public function hubinfo($hubinfo) {
|
||||
$params = array('filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
|
||||
$imgurl = new moodle_url($hubinfo['url'] .
|
||||
"/local/hub/webservice/download.php", $params);
|
||||
$screenshothtml = html_writer::empty_tag('img',
|
||||
array('src' => $imgurl, 'alt' => $hubinfo['name']));
|
||||
$hubdescription = html_writer::tag('div', $screenshothtml,
|
||||
array('class' => 'hubscreenshot'));
|
||||
|
||||
$hubdescription .= html_writer::tag('a', $hubinfo['name'],
|
||||
array('class' => 'hublink', 'href' => $hubinfo['url'],
|
||||
'onclick' => 'this.target="_blank"'));
|
||||
|
||||
$hubdescription .= html_writer::tag('div', format_text($hubinfo['description'], FORMAT_PLAIN),
|
||||
array('class' => 'hubdescription'));
|
||||
$hubdescription = html_writer::tag('div', $hubdescription, array('class' => 'hubinfo'));
|
||||
|
||||
return $hubdescription;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.3.6 ===
|
||||
* The following have been removed from the list of core subsystems:
|
||||
- core_register
|
||||
- core_publish
|
||||
Following this change, \core_register_renderer and \core_publish_renderer have been removed and their methods have been
|
||||
moved to \core_admin_renderer and \core_course_renderer respectively.
|
||||
|
||||
=== 3.3.5 ===
|
||||
|
||||
* Plugins can define class 'PLUGINNAME\privacy\local\sitepolicy\handler' if they implement an alternative mechanisms for
|
||||
|
||||
Reference in New Issue
Block a user