1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

MDL-59495 block_community: search courses on moodle.net only

Remove support for alternative hubs and hub selector
This commit is contained in:
Marina Glancy 2017-09-12 15:19:11 +08:00
parent 8df792ee8a
commit 5189f57f38
5 changed files with 116 additions and 341 deletions

@ -31,7 +31,6 @@
require('../../config.php');
require_once($CFG->dirroot . '/blocks/community/locallib.php');
require_once($CFG->dirroot . '/blocks/community/forms.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
require_login();
$courseid = required_param('courseid', PARAM_INT); //if no courseid is given
@ -48,21 +47,8 @@ $PAGE->navbar->add(get_string('searchcourse', 'block_community'));
$search = optional_param('search', null, PARAM_TEXT);
//if no capability to search course, display an error message
$usercansearch = has_capability('moodle/community:add', $context);
require_capability('moodle/community:add', $context);
$usercandownload = has_capability('moodle/community:download', $context);
if (empty($usercansearch)) {
$notificationerror = get_string('cannotsearchcommunity', 'hub');
} else if (!extension_loaded('xmlrpc')) {
$notificationerror = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$notificationerror .= get_string('xmlrpcdisabledcommunity', 'hub');
}
if (!empty($notificationerror)) {
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('searchcommunitycourse', 'block_community'), 3, 'main');
echo $OUTPUT->notification($notificationerror);
echo $OUTPUT->footer();
die();
}
$communitymanager = new block_community_manager();
$renderer = $PAGE->get_renderer('block_community');
@ -93,17 +79,11 @@ if ($usercandownload and $cancelrestore and confirm_sesskey()) {
}
/// Download
$huburl = optional_param('huburl', false, PARAM_URL);
$download = optional_param('download', -1, PARAM_INT);
$downloadcourseid = optional_param('downloadcourseid', '', PARAM_INT);
$coursefullname = optional_param('coursefullname', '', PARAM_ALPHANUMEXT);
$backupsize = optional_param('backupsize', 0, PARAM_INT);
if ($usercandownload and $download != -1 and !empty($downloadcourseid) and confirm_sesskey()) {
$course = new stdClass();
$course->fullname = $coursefullname;
$course->id = $downloadcourseid;
$course->huburl = $huburl;
//OUTPUT: display restore choice page
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('downloadingcourse', 'block_community'), 3, 'main');
@ -115,12 +95,12 @@ if ($usercandownload and $download != -1 and !empty($downloadcourseid) and confi
ob_flush();
}
flush();
$filenames = $communitymanager->block_community_download_course_backup($course);
list($privatefilename, $tmpfilename) = \core\hub\publication::download_course_backup($downloadcourseid, $coursefullname);
echo html_writer::tag('div', get_string('downloaded', 'block_community'),
array('class' => 'textinfo'));
echo $OUTPUT->notification(get_string('downloadconfirmed', 'block_community',
'/downloaded_backup/' . $filenames['privatefile']), 'notifysuccess');
echo $renderer->restore_confirmation_box($filenames['tmpfile'], $context);
$privatefilename), 'notifysuccess');
echo $renderer->restore_confirmation_box($tmpfilename, $context);
echo $OUTPUT->footer();
die();
}
@ -145,7 +125,6 @@ $fromformdata['language'] = optional_param('language', current_language(), PARAM
$fromformdata['educationallevel'] = optional_param('educationallevel', 'all', PARAM_ALPHANUMEXT);
$fromformdata['downloadable'] = optional_param('downloadable', $usercandownload, PARAM_ALPHANUM);
$fromformdata['orderby'] = optional_param('orderby', 'newest', PARAM_ALPHA);
$fromformdata['huburl'] = optional_param('huburl', HUB_MOODLEORGHUBURL, PARAM_URL);
$fromformdata['search'] = $search;
$fromformdata['courseid'] = $courseid;
$hubselectorform = new community_hub_search_form('', $fromformdata);
@ -181,35 +160,14 @@ if (optional_param('executesearch', 0, PARAM_INT) and confirm_sesskey()) {
//the range of course requested
$options->givememore = optional_param('givememore', 0, PARAM_INT);
//check if the selected hub is from the registered list (in this case we use the private token)
$token = 'publichub';
$registrationmanager = new registration_manager();
$registeredhubs = $registrationmanager->get_registered_on_hubs();
foreach ($registeredhubs as $registeredhub) {
if ($huburl == $registeredhub->huburl) {
$token = $registeredhub->token;
}
}
$function = 'hub_get_courses';
$params = array('search' => $search, 'downloadable' => $downloadable,
'enrollable' => intval(!$downloadable), 'options' => $options);
$serverurl = $huburl . "/local/hub/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, $token);
try {
$result = $xmlrpcclient->call($function, array_values($params));
$courses = $result['courses'];
$coursetotal = $result['coursetotal'];
} catch (Exception $e) {
$errormessage = $OUTPUT->notification(
get_string('errorcourselisting', 'block_community', $e->getMessage()));
}
list($courses, $coursetotal) = \core\hub\publication::search($search, $downloadable, $options);
}
// OUTPUT
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('searchcommunitycourse', 'block_community'), 3, 'main');
echo $renderer->moodlenet_info();
$hubselectorform->display();
if (!empty($errormessage)) {
echo $errormessage;
@ -232,9 +190,9 @@ $PAGE->requires->yui_module('moodle-block_community-comments', 'M.blocks_communi
array(array('commentids' => $commentedcourseids, 'closeButtonTitle' => get_string('close', 'editor'))));
$PAGE->requires->yui_module('moodle-block_community-imagegallery', 'M.blocks_community.init_imagegallery',
array(array('imageids' => $courseids, 'imagenumbers' => $courseimagenumbers,
'huburl' => $huburl, 'closeButtonTitle' => get_string('close', 'editor'))));
'huburl' => HUB_MOODLEORGHUBURL, 'closeButtonTitle' => get_string('close', 'editor'))));
echo highlight($search, $renderer->course_list($courses, $huburl, $courseid));
echo highlight($search, $renderer->course_list($courses, null, $courseid));
//display givememore/Next link if more course can be displayed
if (!empty($courses)) {

@ -29,14 +29,11 @@
*/
require_once($CFG->libdir . '/formslib.php');
require_once($CFG->dirroot . '/course/publish/lib.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
class community_hub_search_form extends moodleform {
public function definition() {
global $CFG, $USER, $OUTPUT;
$strrequired = get_string('required');
global $CFG;
$mform = & $this->_form;
//set default value
@ -81,11 +78,6 @@ class community_hub_search_form extends moodleform {
} else {
$orderby = 'newest';
}
if (isset($this->_customdata['huburl'])) {
$huburl = $this->_customdata['huburl'];
} else {
$huburl = HUB_MOODLEORGHUBURL;
}
$mform->addElement('header', 'site', get_string('search', 'block_community'));
@ -95,222 +87,87 @@ class community_hub_search_form extends moodleform {
$mform->addElement('hidden', 'executesearch', 1);
$mform->setType('executesearch', PARAM_INT);
//retrieve the hub list on the hub directory by web service
$function = 'hubdirectory_get_hubs';
$params = array();
$serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
$xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
try {
$hubs = $xmlrpcclient->call($function, $params);
} catch (Exception $e) {
$hubs = array();
$error = $OUTPUT->notification(get_string('errorhublisting', 'block_community', $e->getMessage()));
$mform->addElement('static', 'errorhub', '', $error);
// Display enrol/download select box if the USER has the download capability on the course.
if (has_capability('moodle/community:download',
context_course::instance($this->_customdata['courseid']))) {
$options = array(0 => get_string('enrollable', 'block_community'),
1 => get_string('downloadable', 'block_community'));
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
$options);
$mform->addHelpButton('downloadable', 'enroldownload', 'block_community');
$mform->setDefault('downloadable', $downloadable);
} else {
$mform->addElement('hidden', 'downloadable', 0);
}
$mform->setType('downloadable', PARAM_INT);
// Hubdirectory returns old URL for the moodle.net hub, substitute it.
foreach ($hubs as $key => $hub) {
if ($hub['url'] === HUB_OLDMOODLEORGHUBURL) {
$hubs[$key]['url'] = HUB_MOODLEORGHUBURL;
}
$options = \core\hub\publication::audience_options(true);
$mform->addElement('select', 'audience', get_string('audience', 'block_community'), $options);
$mform->setDefault('audience', $audience);
unset($options);
$mform->addHelpButton('audience', 'audience', 'block_community');
$options = \core\hub\publication::educational_level_options(true);
$mform->addElement('select', 'educationallevel',
get_string('educationallevel', 'block_community'), $options);
$mform->setDefault('educationallevel', $educationallevel);
unset($options);
$mform->addHelpButton('educationallevel', 'educationallevel', 'block_community');
$options = \core\hub\publication::get_sorted_subjects();
$mform->addElement('searchableselector', 'subject', get_string('subject', 'block_community'),
$options, array('id' => 'communitysubject'));
$mform->setDefault('subject', $subject);
unset($options);
$mform->addHelpButton('subject', 'subject', 'block_community');
require_once($CFG->libdir . "/licenselib.php");
$licensemanager = new license_manager();
$licences = $licensemanager->get_licenses();
$options = array();
$options['all'] = get_string('any');
foreach ($licences as $license) {
$options[$license->shortname] = get_string($license->shortname, 'license');
}
$mform->addElement('select', 'licence', get_string('licence', 'block_community'), $options);
unset($options);
$mform->addHelpButton('licence', 'licence', 'block_community');
$mform->setDefault('licence', $licence);
//display list of registered on hub
$registrationmanager = new registration_manager();
$registeredhubs = $registrationmanager->get_registered_on_hubs();
//retrieve some additional hubs that we will add to
//the hub list got from the hub directory
$additionalhubs = array();
foreach ($registeredhubs as $registeredhub) {
$inthepubliclist = false;
foreach ($hubs as $hub) {
if ($hub['url'] == $registeredhub->huburl) {
$inthepubliclist = true;
$hub['registeredon'] = true;
}
}
if (!$inthepubliclist) {
$additionalhub = array();
$additionalhub['name'] = $registeredhub->hubname;
$additionalhub['url'] = $registeredhub->huburl;
$additionalhubs[] = $additionalhub;
}
}
if (!empty($additionalhubs)) {
$hubs = array_merge($hubs, $additionalhubs);
}
$languages = get_string_manager()->get_list_of_languages();
core_collator::asort($languages);
$languages = array_merge(array('all' => get_string('any')), $languages);
$mform->addElement('select', 'language', get_string('language'), $languages);
if (!empty($hubs)) {
$htmlhubs = array();
foreach ($hubs as $hub) {
// Name can come from hub directory - need some cleaning.
$hubname = clean_text($hub['name'], PARAM_TEXT);
$smalllogohtml = '';
if (array_key_exists('id', $hub)) {
$mform->setDefault('language', $language);
$mform->addHelpButton('language', 'language', 'block_community');
// Retrieve hub logo + generate small logo.
$params = array('hubid' => $hub['id'], 'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
$imgurl = new moodle_url(HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/download.php", $params);
$imgsize = getimagesize($imgurl->out(false));
if ($imgsize[0] > 1) {
$ascreenshothtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hubname));
$smalllogohtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hubname
, 'height' => 30, 'width' => 40));
} else {
$ascreenshothtml = '';
}
$hubimage = html_writer::tag('div', $ascreenshothtml, array('class' => 'hubimage'));
$mform->addElement('select', 'orderby', get_string('orderby', 'block_community'),
array('newest' => get_string('orderbynewest', 'block_community'),
'eldest' => get_string('orderbyeldest', 'block_community'),
'fullname' => get_string('orderbyname', 'block_community'),
'publisher' => get_string('orderbypublisher', 'block_community'),
'ratingaverage' => get_string('orderbyratingaverage', 'block_community')));
// Statistics + trusted info.
$hubstats = '';
if (isset($hub['enrollablecourses'])) { //check needed to avoid warnings for Moodle version < 2011081700
$additionaldesc = get_string('enrollablecourses', 'block_community') . ': ' . $hub['enrollablecourses'] . ' - ' .
get_string('downloadablecourses', 'block_community') . ': ' . $hub['downloadablecourses'];
$hubstats .= html_writer::tag('div', $additionaldesc);
}
if ($hub['trusted']) {
$hubtrusted = get_string('hubtrusted', 'block_community');
$hubstats .= $OUTPUT->doc_link('trusted_hubs') . html_writer::tag('div', $hubtrusted);
}
$hubstats = html_writer::tag('div', $hubstats, array('class' => 'hubstats'));
$mform->setDefault('orderby', $orderby);
$mform->addHelpButton('orderby', 'orderby', 'block_community');
$mform->setType('orderby', PARAM_ALPHA);
// hub name link + hub description.
$hubnamelink = html_writer::link($hub['url'], html_writer::tag('h2',$hubname),
array('class' => 'hubtitlelink'));
// The description can come from the hub directory - need to clean.
$hubdescription = clean_param($hub['description'], PARAM_TEXT);
$hubdescriptiontext = html_writer::tag('div', format_text($hubdescription, FORMAT_PLAIN),
array('class' => 'hubdescription'));
$mform->setAdvanced('audience');
$mform->setAdvanced('educationallevel');
$mform->setAdvanced('subject');
$mform->setAdvanced('licence');
$mform->setAdvanced('language');
$mform->setAdvanced('orderby');
$hubtext = html_writer::tag('div', $hubdescriptiontext . $hubstats, array('class' => 'hubtext'));
$mform->addElement('text', 'search', get_string('keywords', 'block_community'),
array('size' => 30));
$mform->addHelpButton('search', 'keywords', 'block_community');
$mform->setType('search', PARAM_NOTAGS);
$hubimgandtext = html_writer::tag('div', $hubimage . $hubtext, array('class' => 'hubimgandtext'));
$mform->addElement('submit', 'submitbutton', get_string('search', 'block_community'));
$hubfulldesc = html_writer::tag('div', $hubnamelink . $hubimgandtext, array('class' => 'hubmainhmtl'));
} else {
$hubfulldesc = html_writer::link($hub['url'], $hubname);
}
// Add hub to the hub items.
$hubinfo = new stdClass();
$hubinfo->mainhtml = $hubfulldesc;
$hubinfo->rowhtml = html_writer::tag('div', $smalllogohtml , array('class' => 'hubsmalllogo')) . $hubname;
$hubitems[$hub['url']] = $hubinfo;
}
// Hub listing form element.
$mform->addElement('listing','huburl', '', '', array('items' => $hubitems,
'showall' => get_string('showall', 'block_community'),
'hideall' => get_string('hideall', 'block_community')));
$mform->setDefault('huburl', $huburl);
//display enrol/download select box if the USER has the download capability on the course
if (has_capability('moodle/community:download',
context_course::instance($this->_customdata['courseid']))) {
$options = array(0 => get_string('enrollable', 'block_community'),
1 => get_string('downloadable', 'block_community'));
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
$options);
$mform->addHelpButton('downloadable', 'enroldownload', 'block_community');
$mform->setDefault('downloadable', $downloadable);
} else {
$mform->addElement('hidden', 'downloadable', 0);
}
$mform->setType('downloadable', PARAM_INT);
$options = array();
$options['all'] = get_string('any');
$options[HUB_AUDIENCE_EDUCATORS] = get_string('audienceeducators', 'hub');
$options[HUB_AUDIENCE_STUDENTS] = get_string('audiencestudents', 'hub');
$options[HUB_AUDIENCE_ADMINS] = get_string('audienceadmins', 'hub');
$mform->addElement('select', 'audience', get_string('audience', 'block_community'), $options);
$mform->setDefault('audience', $audience);
unset($options);
$mform->addHelpButton('audience', 'audience', 'block_community');
$options = array();
$options['all'] = get_string('any');
$options[HUB_EDULEVEL_PRIMARY] = get_string('edulevelprimary', 'hub');
$options[HUB_EDULEVEL_SECONDARY] = get_string('edulevelsecondary', 'hub');
$options[HUB_EDULEVEL_TERTIARY] = get_string('eduleveltertiary', 'hub');
$options[HUB_EDULEVEL_GOVERNMENT] = get_string('edulevelgovernment', 'hub');
$options[HUB_EDULEVEL_ASSOCIATION] = get_string('edulevelassociation', 'hub');
$options[HUB_EDULEVEL_CORPORATE] = get_string('edulevelcorporate', 'hub');
$options[HUB_EDULEVEL_OTHER] = get_string('edulevelother', 'hub');
$mform->addElement('select', 'educationallevel',
get_string('educationallevel', 'block_community'), $options);
$mform->setDefault('educationallevel', $educationallevel);
unset($options);
$mform->addHelpButton('educationallevel', 'educationallevel', 'block_community');
$publicationmanager = new course_publish_manager();
$options = $publicationmanager->get_sorted_subjects();
$mform->addElement('searchableselector', 'subject', get_string('subject', 'block_community'),
$options, array('id' => 'communitysubject'));
$mform->setDefault('subject', $subject);
unset($options);
$mform->addHelpButton('subject', 'subject', 'block_community');
require_once($CFG->libdir . "/licenselib.php");
$licensemanager = new license_manager();
$licences = $licensemanager->get_licenses();
$options = array();
$options['all'] = get_string('any');
foreach ($licences as $license) {
$options[$license->shortname] = get_string($license->shortname, 'license');
}
$mform->addElement('select', 'licence', get_string('licence', 'block_community'), $options);
unset($options);
$mform->addHelpButton('licence', 'licence', 'block_community');
$mform->setDefault('licence', $licence);
$languages = get_string_manager()->get_list_of_languages();
core_collator::asort($languages);
$languages = array_merge(array('all' => get_string('any')), $languages);
$mform->addElement('select', 'language', get_string('language'), $languages);
$mform->setDefault('language', $language);
$mform->addHelpButton('language', 'language', 'block_community');
$mform->addElement('select', 'orderby', get_string('orderby', 'block_community'),
array('newest' => get_string('orderbynewest', 'block_community'),
'eldest' => get_string('orderbyeldest', 'block_community'),
'fullname' => get_string('orderbyname', 'block_community'),
'publisher' => get_string('orderbypublisher', 'block_community'),
'ratingaverage' => get_string('orderbyratingaverage', 'block_community')));
$mform->setDefault('orderby', $orderby);
$mform->addHelpButton('orderby', 'orderby', 'block_community');
$mform->setType('orderby', PARAM_ALPHA);
$mform->setAdvanced('audience');
$mform->setAdvanced('educationallevel');
$mform->setAdvanced('subject');
$mform->setAdvanced('licence');
$mform->setAdvanced('language');
$mform->setAdvanced('orderby');
$mform->addElement('text', 'search', get_string('keywords', 'block_community'),
array('size' => 30));
$mform->addHelpButton('search', 'keywords', 'block_community');
$mform->setType('search', PARAM_NOTAGS);
$mform->addElement('submit', 'submitbutton', get_string('search', 'block_community'));
}
}
function validation($data, $files) {
global $CFG;
$errors = array();
if (empty($this->_form->_submitValues['huburl'])) {
$errors['huburl'] = get_string('nohubselected', 'hub');
}
return $errors;
}
}

@ -73,66 +73,6 @@ class block_community_manager {
array('courseurl' => $courseurl, 'userid' => $userid));
}
/**
* Download the community course backup and save it in file API
* @param integer $courseid
* @param string $huburl
* @return array 'privatefile' the file name saved in private area
* 'tmpfile' the file name saved in the moodledata temp dir (for restore)
*/
public function block_community_download_course_backup($course) {
global $CFG, $USER;
require_once($CFG->libdir . "/filelib.php");
require_once($CFG->dirroot. "/course/publish/lib.php");
$params['courseid'] = $course->id;
$params['filetype'] = HUB_BACKUP_FILE_TYPE;
make_temp_directory('backup');
$filename = md5(time() . '-' . $course->id . '-'. $USER->id . '-'. random_string(20));
$url = new moodle_url($course->huburl.'/local/hub/webservice/download.php', $params);
$path = $CFG->tempdir.'/backup/'.$filename.".mbz";
$fp = fopen($path, 'w');
$curlurl = $course->huburl.'/local/hub/webservice/download.php?filetype='
.HUB_BACKUP_FILE_TYPE.'&courseid='.$course->id;
//send an identification token if the site is registered on the hub
require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_registeredhub($course->huburl);
if (!empty($registeredhub)) {
$token = $registeredhub->token;
$curlurl .= '&token='.$token;
}
$ch = curl_init($curlurl);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);
$fs = get_file_storage();
$record = new stdClass();
$record->contextid = context_user::instance($USER->id)->id;
$record->component = 'user';
$record->filearea = 'private';
$record->itemid = 0;
$record->filename = urlencode($course->fullname)."_".time().".mbz";
$record->filepath = '/downloaded_backup/';
if (!$fs->file_exists($record->contextid, $record->component,
$record->filearea, 0, $record->filepath, $record->filename)) {
$fs->create_file_from_pathname($record,
$CFG->tempdir.'/backup/'.$filename.".mbz");
}
$filenames = array();
$filenames['privatefile'] = $record->filename;
$filenames['tmpfile'] = $filename;
return $filenames;
}
/**
* Delete a community course
* @param integer $communityid

@ -85,14 +85,43 @@ class block_community_renderer extends plugin_renderer_base {
return html_writer::tag('div', $nextlink, array( 'class' => 'nextlink'));
}
/**
* Displays information about moodle.net above course search form
*
* @return string
*/
public function moodlenet_info() {
if (!$info = \core\hub\registration::get_moodlenet_info()) {
return '';
}
$image = html_writer::div(html_writer::img($info['imgurl'], $info['name']), 'hubimage');
$namelink = html_writer::link($info['url'], html_writer::tag('h2', $info['name']), array('class' => 'hubtitlelink'));
$description = clean_param($info['description'], PARAM_TEXT);
$descriptiontext = html_writer::div(format_text($description, FORMAT_PLAIN), 'hubdescription');
$additionaldesc = get_string('enrollablecourses', 'block_community') . ': ' . $info['enrollablecourses'] . ' - ' .
get_string('downloadablecourses', 'block_community') . ': ' . $info['downloadablecourses'];
$stats = html_writer::div(html_writer::tag('div', $additionaldesc), 'hubstats');
$text = html_writer::div($descriptiontext . $stats, 'hubtext');
$imgandtext = html_writer::div($image . $text, 'hubimgandtext');
$fulldesc = html_writer::div($namelink . $imgandtext, 'hubmainhmtl clearfix');
return html_writer::div($fulldesc, 'formlisting');
}
/**
* Display a list of courses
* @param array $courses
* @param boolean $withwriteaccess
* @param mixed $unused parameter is not used
* @param int $contextcourseid context course id
* @return string
*/
public function course_list($courses, $huburl, $contextcourseid) {
public function course_list($courses, $unused, $contextcourseid) {
global $CFG;
$renderedhtml = '';
@ -128,12 +157,9 @@ class block_community_renderer extends plugin_renderer_base {
// create screenshots html
$screenshothtml = '';
if (!empty($course->screenshots)) {
$baseurl = new moodle_url($huburl . '/local/hub/webservice/download.php',
array('courseid' => $course->id,
'filetype' => HUB_SCREENSHOT_FILE_TYPE));
if (!empty($course->screenshotbaseurl)) {
$screenshothtml = html_writer::empty_tag('img',
array('src' => $baseurl, 'alt' => $course->fullname));
array('src' => $course->screenshotbaseurl, 'alt' => $course->fullname));
}
$coursescreenshot = html_writer::tag('div', $screenshothtml,
array('class' => 'coursescreenshot',
@ -269,7 +295,7 @@ class block_community_renderer extends plugin_renderer_base {
if (!$course->enrollable) {
$params = array('sesskey' => sesskey(), 'download' => 1, 'confirmed' => 1,
'remotemoodleurl' => $CFG->wwwroot, 'courseid' => $contextcourseid,
'downloadcourseid' => $course->id, 'huburl' => $huburl,
'downloadcourseid' => $course->id,
'coursefullname' => $course->fullname, 'backupsize' => $course->backupsize);
$downloadurl = new moodle_url("/blocks/community/communitycourse.php", $params);
$downloadbuttonhtml = html_writer::tag('a', get_string('install', 'block_community'),
@ -339,10 +365,8 @@ class block_community_renderer extends plugin_renderer_base {
//link rate and comment
$rateandcomment = html_writer::tag('div',
html_writer::tag('a', get_string('rateandcomment', 'block_community'),
array('href' => new moodle_url($huburl,
array('courseid' => $course->id, 'mustbelogged' => true)),
'onclick' => 'this.target="_blank"')),
html_writer::link($course->commenturl, get_string('rateandcomment', 'block_community'),
['onclick' => 'this.target="_blank"']),
array('class' => 'hubrateandcomment'));
//the main DIV tags

@ -21,10 +21,6 @@
padding-left: 165px;
}
#page-blocks-community-communitycourse .hubimgandtext {
display: table;
}
#page-blocks-community-communitycourse .hubimage {
float: left;
display: block;