| Línea 123... |
Línea 123... |
| 123 |
* @param \context $context Details about which context to delete comments for.
|
123 |
* @param \context $context Details about which context to delete comments for.
|
| 124 |
* @param string $component Component to delete.
|
124 |
* @param string $component Component to delete.
|
| 125 |
* @param string $commentarea Comment area to delete.
|
125 |
* @param string $commentarea Comment area to delete.
|
| 126 |
* @param int $itemid The item ID for use with deletion.
|
126 |
* @param int $itemid The item ID for use with deletion.
|
| 127 |
*/
|
127 |
*/
|
| 128 |
public static function delete_comments_for_all_users(\context $context, string $component, string $commentarea = null,
|
128 |
public static function delete_comments_for_all_users(\context $context, string $component, ?string $commentarea = null,
|
| 129 |
int $itemid = null) {
|
129 |
?int $itemid = null) {
|
| 130 |
global $DB;
|
130 |
global $DB;
|
| 131 |
$params = [
|
131 |
$params = [
|
| 132 |
'contextid' => $context->id,
|
132 |
'contextid' => $context->id,
|
| 133 |
'component' => $component
|
133 |
'component' => $component
|
| 134 |
];
|
134 |
];
|
| Línea 169... |
Línea 169... |
| 169 |
* @param string $component Component to delete from.
|
169 |
* @param string $component Component to delete from.
|
| 170 |
* @param string $commentarea Area to delete from.
|
170 |
* @param string $commentarea Area to delete from.
|
| 171 |
* @param int $itemid The item id to delete from.
|
171 |
* @param int $itemid The item id to delete from.
|
| 172 |
*/
|
172 |
*/
|
| 173 |
public static function delete_comments_for_user(\core_privacy\local\request\approved_contextlist $contextlist,
|
173 |
public static function delete_comments_for_user(\core_privacy\local\request\approved_contextlist $contextlist,
|
| 174 |
string $component, string $commentarea = null, int $itemid = null) {
|
174 |
string $component, ?string $commentarea = null, ?int $itemid = null) {
|
| 175 |
global $DB;
|
175 |
global $DB;
|
| Línea 176... |
Línea 176... |
| 176 |
|
176 |
|
| 177 |
$userid = $contextlist->get_user()->id;
|
177 |
$userid = $contextlist->get_user()->id;
|
| 178 |
$contextids = implode(',', $contextlist->get_contextids());
|
178 |
$contextids = implode(',', $contextlist->get_contextids());
|
| Línea 205... |
Línea 205... |
| 205 |
* @param string $component Component to delete from.
|
205 |
* @param string $component Component to delete from.
|
| 206 |
* @param string $commentarea Area to delete from.
|
206 |
* @param string $commentarea Area to delete from.
|
| 207 |
* @param int $itemid The item id to delete from.
|
207 |
* @param int $itemid The item id to delete from.
|
| 208 |
*/
|
208 |
*/
|
| 209 |
public static function delete_comments_for_users(\core_privacy\local\request\approved_userlist $userlist,
|
209 |
public static function delete_comments_for_users(\core_privacy\local\request\approved_userlist $userlist,
|
| 210 |
string $component, string $commentarea = null, int $itemid = null) {
|
210 |
string $component, ?string $commentarea = null, ?int $itemid = null) {
|
| 211 |
global $DB;
|
211 |
global $DB;
|
| Línea 212... |
Línea 212... |
| 212 |
|
212 |
|
| 213 |
$context = $userlist->get_context();
|
213 |
$context = $userlist->get_context();
|
| 214 |
$params = [
|
214 |
$params = [
|
| Línea 242... |
Línea 242... |
| 242 |
* @param int $contextid The context id.
|
242 |
* @param int $contextid The context id.
|
| 243 |
* @param string $insql The SQL to use in a sub-select for the itemid query.
|
243 |
* @param string $insql The SQL to use in a sub-select for the itemid query.
|
| 244 |
* @param array $params The params required for the insql.
|
244 |
* @param array $params The params required for the insql.
|
| 245 |
*/
|
245 |
*/
|
| 246 |
public static function get_users_in_context_from_sql(
|
246 |
public static function get_users_in_context_from_sql(
|
| 247 |
userlist $userlist, string $alias, string $component, string $area, int $contextid = null, string $insql = '',
|
247 |
userlist $userlist, string $alias, string $component, string $area, ?int $contextid = null, string $insql = '',
|
| 248 |
array $params = []) {
|
248 |
array $params = []) {
|
| Línea 249... |
Línea 249... |
| 249 |
|
249 |
|
| 250 |
if ($insql != '') {
|
250 |
if ($insql != '') {
|
| 251 |
$insql = "AND {$alias}.itemid {$insql}";
|
251 |
$insql = "AND {$alias}.itemid {$insql}";
|