Skip to content

Commit

Permalink
#101 - setting to be able to config if content is added to log (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
schulportalhessen authored Oct 3, 2024
1 parent 6eb00ae commit 1387a5d
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
27 changes: 27 additions & 0 deletions classes/board.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ public static function board_add_column(int $boardid, string $name): array {
* @return void
*/
public static function board_add_column_log($boardid, $name, $columnid) {
if (!get_config('mod_board', 'addcolumnnametolog')) {
$name = '';
}
$event = \mod_board\event\add_column::create(array(
'objectid' => $columnid,
'context' => \context_module::instance(static::coursemodule_for_board(static::get_board($boardid))->id),
Expand Down Expand Up @@ -515,6 +518,9 @@ public static function board_update_column(int $id, string $name): array {
* @return void
*/
public static function board_update_column_log($boardid, $name, $columnid) {
if (!get_config('mod_board', 'addcolumnnametolog')) {
$name = '';
}
$event = \mod_board\event\update_column::create(array(
'objectid' => $columnid,
'context' => \context_module::instance(static::coursemodule_for_board(static::get_board($boardid))->id),
Expand Down Expand Up @@ -835,6 +841,15 @@ public static function board_add_note(int $columnid, int $ownerid, string $headi
* @return void
*/
public static function board_add_note_log($boardid, $groupid, $heading, $content, $attachment, $columnid, $noteid) {
if (!get_config('mod_board', 'addnotetolog')) {
$content = '';
}
if (!get_config('mod_board', 'addheadingtolog')) {
$heading = '';
}
if (!get_config('mod_board', 'addattachmenttolog')) {
$attachment = '';
}
$event = \mod_board\event\add_note::create(array(
'objectid' => $noteid,
'context' => \context_module::instance(static::coursemodule_for_board(static::get_board($boardid))->id),
Expand Down Expand Up @@ -920,6 +935,15 @@ public static function board_update_note(int $id, int $ownerid, string $heading,
* @return void
*/
public static function board_update_note_log($boardid, $heading, $content, $attachment, $columnid, $noteid) {
if (!get_config('mod_board', 'addnotetolog')) {
$content = '';
}
if (!get_config('mod_board', 'addheadingtolog')) {
$heading = '';
}
if (!get_config('mod_board', 'addattachmenttolog')) {
$attachment = '';
}
$event = \mod_board\event\update_note::create(array(
'objectid' => $noteid,
'context' => \context_module::instance(static::coursemodule_for_board(static::get_board($boardid))->id),
Expand Down Expand Up @@ -1288,6 +1312,9 @@ public static function board_rate_note(int $noteid): array {
* @return void
*/
public static function board_rate_note_log($boardid, $noteid, $rating) {
if (!get_config('mod_board', 'addratingtolog')) {
$rating = '';
}
$event = \mod_board\event\rate_note::create(array(
'objectid' => $noteid,
'context' => \context_module::instance(static::coursemodule_for_board(static::get_board($boardid))->id),
Expand Down
3 changes: 3 additions & 0 deletions classes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ public function delete() {
* @return void
*/
public static function board_add_comment_log($commentid, $context, $noteid, $content) {
if (!get_config('mod_board', 'addcommenttolog')) {
$content = '';
}
$event = \mod_board\event\add_comment::create(array(
'objectid' => $commentid,
'context' => $context,
Expand Down
9 changes: 9 additions & 0 deletions lang/en/board.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,12 @@
$string['singleusermodenotembed'] = 'Board does not allow a single user board to be embedded. Please change your settings.';
$string['allowed_singleuser_modes'] = 'Enabled single user modes';
$string['allowed_singleuser_modes_desc'] = 'Allow/Disallow usage of certain single user modes. Does not affect already created boards';

$string['settings_heading_logging'] = 'Logging';
$string['settings_heading_logging_info'] = 'By default, logging will contain content, such as the text of a note, comments, column names, and so on.<br>For data privacy purposes, logging may be configured to exclude some information that has been submitted by users.';
$string['settings:addcommenttolog'] = 'Add comment to log';
$string['settings:addcolumnnametolog'] = 'Add column name to log';
$string['settings:addnotetolog'] = 'Add note to log';
$string['settings:addheadingtolog'] = 'Add heading to log';
$string['settings:addattachmenttolog'] = 'Add attachment to log';
$string['settings:addratingtolog'] = 'Add rating to log';
43 changes: 43 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,47 @@
board::SINGLEUSER_PUBLIC => get_string('singleusermodepublic', 'mod_board')
]
));

// Heading.
$setting = new admin_setting_heading('mod_board/settings_heading_logging',
get_string('settings_heading_logging', 'mod_board'),
get_string('settings_heading_logging_info', 'mod_board'));
$settings->add($setting);

$settings->add(new admin_setting_configcheckbox(
'mod_board/addcolumnnametolog',
get_string('settings:addcolumnnametolog', 'mod_board'),
'',
'1'
));
$settings->add(new admin_setting_configcheckbox(
'mod_board/addnotetolog',
get_string('settings:addnotetolog', 'mod_board'),
'',
'1'
));
$settings->add(new admin_setting_configcheckbox(
'mod_board/addcommenttolog',
get_string('settings:addcommenttolog', 'mod_board'),
'',
'1'
));
$settings->add(new admin_setting_configcheckbox(
'mod_board/addheadingtolog',
get_string('settings:addheadingtolog', 'mod_board'),
'',
'1'
));
$settings->add(new admin_setting_configcheckbox(
'mod_board/addattachmenttolog',
get_string('settings:addattachmenttolog', 'mod_board'),
'',
'1'
));
$settings->add(new admin_setting_configcheckbox(
'mod_board/addratingtolog',
get_string('settings:addratingtolog', 'mod_board'),
'',
'1'
));
}

0 comments on commit 1387a5d

Please sign in to comment.