Skip to content

Commit

Permalink
add anonymous function
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed May 16, 2024
1 parent 152039c commit 84cf7b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion classes/moodleoverflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
defined('MOODLE_INTERNAL') || die;

use local_townsquaresupport\townsquaresupportinterface;
use mod_moodleoverflow\anonymous;

global $CFG;
require_once($CFG->dirroot . '/blocks/townsquare/locallib.php');
Expand Down Expand Up @@ -67,6 +68,15 @@ public static function get_events(): array {
($event->eventtype == 'expectcompletionon' && townsquare_filter_activitycompletions($event))) {
unset($moodleoverflowevents[$key]);
}

// Add an anonymous attribute.
if ($event->anonymoussetting == anonymous::EVERYTHING_ANONYMOUS) {
$event->anonymous = true;
} else if ($event->anonymoussetting == anonymous::QUESTION_ANONYMOUS) {
$event->anonymous = $event->postuserid == $event->discussionuserid;
} else {
$event->anonymous = false;
}
}

return $moodleoverflowevents;
Expand Down Expand Up @@ -118,7 +128,7 @@ private static function get_other_events_from_db($courses, $timestart, $timeend)
list($insqlcourses, $inparamscourses) = $DB->get_in_or_equal($courses, SQL_PARAMS_NAMED);

$params = ['timestart' => $timestart, 'timeduration' => $timestart,
'timeend' => $timeend, 'courses' => $courses] + $inparamscourses;
'timeend' => $timeend, 'courses' => $courses, ] + $inparamscourses;
// Set the sql statement.
$sql = "SELECT e.id, e.name, mo.name AS instancename, e.courseid, cm.id AS coursemoduleid, cm.availability AS availability,
e.groupid, e.userid, e.modulename, e.instance, e.eventtype, e.timestart, e.timemodified, e.visible
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();
$plugin->component = 'townsquareexpansion_moodleoverflow';
$plugin->dependencies = ['local_townsquaresupport' => ANY_VERSION];
$plugin->dependencies = ['local_townsquaresupport' => ANY_VERSION, 'mod_moodleoverflow' => ANY_VERSION];
$plugin->release = '0.1.0';
$plugin->version = 2024050900;
$plugin->requires = 2022041900;
Expand Down

0 comments on commit 84cf7b9

Please sign in to comment.