Skip to content

Commit

Permalink
MDL-66072 core: Remove ancillary sharing functions and code
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter authored and peterRd committed Sep 3, 2019
1 parent 020bad7 commit 14db737
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 1,007 deletions.
139 changes: 0 additions & 139 deletions course/renderer.php
Expand Up @@ -2106,128 +2106,6 @@ public function render_activity_navigation(\core_course\output\activity_navigati
return $this->output->render_from_template('core_course/activity_navigation', $data);
}

/**
* Display the selector to advertise or publish a course
* @param int $courseid
*/
public function publicationselector($courseid) {
$text = '';

$advertiseurl = new moodle_url("/course/publish/metadata.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/metadata.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('date'), get_string('status', 'hub'), get_string('operation', 'hub'));
$table->size = array('20%', '30%', '%20', '%25');

$brtag = html_writer::empty_tag('br');

foreach ($publications as $publication) {

$params = array('id' => $publication->courseid, 'publicationid' => $publication->id);
$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, 'publicationid' => $publication->id);
$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;
}

// 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');
if (!empty($publication->link)) {
$status = html_writer::link($publication->link, $status);
}
}

$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'),
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,
'cancel' => true, 'publicationid' => $publication->id, 'confirm' => true);
$optionsno = array('sesskey' => sesskey(), 'id' => $publication->courseid);
$publication->hubname = html_writer::tag('a', 'Moodle.net',
array('href' => HUB_MOODLEORGHUBURL));
$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
Expand All @@ -2241,23 +2119,6 @@ public function sendingbackupinfo($backupfile) {
return $html;
}

/**
* Display upload successfull message and a button to the publish index page
* @param int $id the course id
* @return $html string
*/
public function sentbackupinfo($id) {
$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));
$continue = $this->output->render(
new single_button($publishindexurl, get_string('continue')));
$html .= html_writer::tag('div', $continue, array('class' => 'sharecoursecontinue'));
return $html;
}

/**
* Hub information (logo - name - description - link)
* @param object $hubinfo
Expand Down
58 changes: 58 additions & 0 deletions lang/en/deprecated.txt
Expand Up @@ -48,3 +48,61 @@ purgedefinitionsuccess,core_cache
purgestoresuccess,core_cache
eventrolecapabilitiesupdated,core_role
configuserquota,core_admin
addscreenshots,core_hub
advertise,core_hub
advertised,core_hub
advertiseon,core_hub
readvertiseon,core_hub
advertisepublication_help,core_hub
courseunpublished,core_hub
courseurl,core_hub
courseurl_help,core_hub
creatorname,core_hub
creatorname_help,core_hub
creatornotes,core_hub
creatornotes_help,core_hub
contributornames,core_hub
contributornames_help,core_hub
deletescreenshots,core_hub
deletescreenshots_help,core_hub
description,core_hub
description_help,core_hub
detectednotexistingpublication,core_hub
errorcoursepublish,core_hub
errorcourseinfo,core_hub
errorcoursewronglypublished,core_hub
errorbadimageheightwidth,core_hub
errorregistration,core_hub
errorunpublishcourses,core_hub
existingscreenshotnumber,core_hub
existingscreenshots,core_hub
nosearch,core_hub
notregisteredonhub,core_hub
publicationinfo,core_hub
publish,core_hub
publishcourse,core_hub
publishcourseon,core_hub
publishedon,core_hub
publisheremail,core_hub
publisheremail_help,core_hub
publishername,core_hub
publishername_help,core_hub
removefromhub,core_hub
screenshots,core_hub
screenshots_help,core_hub
sendingcourse,core_hub
share,core_hub
shared,core_hub
shareon,core_hub
sharepublication_help,core_hub
status,core_hub
statuspublished,core_hub
statusunpublished,core_hub
tags,core_hub
tags_help,core_hub
unpublish,core_hub
unpublishalladvertisedcourses,core_hub
unpublishalluploadedcourses,core_hub
unpublishconfirmation,core_hub
unpublishcourse,core_hub
updatestatus,core_hub

0 comments on commit 14db737

Please sign in to comment.