Skip to content

Moodle 4.2 fixes #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions classes/event/assessable_uploaded.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,6 @@ public function get_description() {
"'$this->contextinstanceid'.";
}

/**
* Legacy event data if get_legacy_eventname() is not empty.
*
* @return \stdClass
*/
protected function get_legacy_eventdata() {
$eventdata = new \stdClass();
$eventdata->modulename = 'hsuforum';
$eventdata->name = $this->other['triggeredfrom'];
$eventdata->cmid = $this->contextinstanceid;
$eventdata->itemid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
$eventdata->content = $this->other['content'];
if ($this->other['pathnamehashes']) {
$eventdata->pathnamehashes = $this->other['pathnamehashes'];
}
return $eventdata;
}

/**
* Return the legacy event name.
*
* @return string
*/
public static function get_legacy_eventname() {
return 'assessable_content_uploaded';
}

/**
* Return localised event name.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/course_module_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/view.php', array('f' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'view forum', 'view.php?f=' . $this->objectid,
$this->objectid, $this->contextinstanceid);
}

public static function get_objectid_mapping() {
return array('db' => 'hsuforum', 'restore' => 'hsuforum');
}
Expand Down
12 changes: 0 additions & 12 deletions classes/event/course_searched.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ public function get_url() {
array('id' => $this->courseid, 'search' => $this->other['searchterm']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'search', $logurl, $this->other['searchterm']);
}

/**
* Custom validation.
*
Expand Down
13 changes: 0 additions & 13 deletions classes/event/discussion_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {

// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'add discussion', $logurl, $this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/discussion_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/view.php', array('id' => $this->contextinstanceid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'delete discussion', 'view.php?id=' . $this->contextinstanceid,
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/discussion_moved.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'move discussion', 'discuss.php?d=' . $this->objectid,
$this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
11 changes: 0 additions & 11 deletions classes/event/discussion_pinned.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));
return array($this->courseid, 'hsuforum', 'pin discussion', $logurl, $this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
11 changes: 0 additions & 11 deletions classes/event/discussion_unpinned.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));
return array($this->courseid, 'hsuforum', 'unpin discussion', $logurl, $this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/discussion_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/discuss.php', array('d' => $this->objectid));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'view discussion', 'discuss.php?d=' . $this->objectid,
$this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
12 changes: 0 additions & 12 deletions classes/event/post_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ public function get_url() {
return $url;
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'add post', $logurl, $this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
12 changes: 0 additions & 12 deletions classes/event/post_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,6 @@ public function get_url() {
return $url;
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'delete post', $logurl, $this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
12 changes: 0 additions & 12 deletions classes/event/post_updated.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ public function get_url() {
return $url;
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'update post', $logurl, $this->objectid, $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/readtracking_disabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/view.php', array('f' => $this->other['forumid']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'stop tracking', 'view.php?f=' . $this->other['forumid'],
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/readtracking_enabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/view.php', array('f' => $this->other['forumid']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'start tracking', 'view.php?f=' . $this->other['forumid'],
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/subscribers_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/subscribers.php', array('id' => $this->other['forumid']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'view subscribers', 'subscribers.php?id=' . $this->other['forumid'],
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/subscription_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/subscribers.php', array('id' => $this->other['forumid']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'subscribe', 'view.php?f=' . $this->other['forumid'],
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
10 changes: 0 additions & 10 deletions classes/event/subscription_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ public function get_url() {
return new \moodle_url('/mod/hsuforum/subscribers.php', array('id' => $this->other['forumid']));
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
return array($this->courseid, 'hsuforum', 'unsubscribe', 'view.php?f=' . $this->other['forumid'],
$this->other['forumid'], $this->contextinstanceid);
}

/**
* Custom validation.
*
Expand Down
12 changes: 0 additions & 12 deletions classes/event/user_report_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,6 @@ public function get_url() {
return $url;
}

/**
* Return the legacy event log data.
*
* @return array|null
*/
protected function get_legacy_logdata() {
// The legacy log table expects a relative path to /mod/hsuforum/.
$logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/hsuforum/'));

return array($this->courseid, 'hsuforum', 'user report', $logurl, $this->relateduserid);
}

/**
* Custom validation.
*
Expand Down
4 changes: 4 additions & 0 deletions hide_duplicated.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#page-mod-hsuforum-post .activity-description,
#page-mod-hsuforum-post [role="main"] h2 {
display: none;
}
22 changes: 13 additions & 9 deletions post.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,19 @@
} else {
$formheading = get_string('yournewtopic', 'hsuforum');
// Hide duplicated hsuforum description when creating a new discussion topic, see INT-18928.
$hidehtml = '';
$hidehtml .= html_writer::start_tag('style', array('type' => 'text/css')) . "\n";
$hidehtml .= '
#page-mod-hsuforum-post .activity-description,
#page-mod-hsuforum-post [role="main"] h2 {
display: none;
};';
$hidehtml .= html_writer::end_tag('style') . "\n";
echo $hidehtml;

// This breaks the page as it renders before the DOCTYPE.
// Switched to an external stylesheet.
// $hidehtml = '';
// $hidehtml .= html_writer::start_tag('style', array('type' => 'text/css')) . "\n";
// $hidehtml .= '
// #page-mod-hsuforum-post .activity-description,
// #page-mod-hsuforum-post [role="main"] h2 {
// display: none;
// };';
// $hidehtml .= html_writer::end_tag('style') . "\n";
// echo $hidehtml;
$PAGE->requires->css(new moodle_url('/mod/hsuforum/hide_duplicated.css'));
}
}

Expand Down