| @@ 528-546 (lines=19) @@ | ||
| 525 | $batchSize = 20; |
|
| 526 | $em = Database::getManager(); |
|
| 527 | // Storing the selected groups |
|
| 528 | if (is_array($send_to['groups']) && !empty($send_to['groups'])) { |
|
| 529 | $counter = 1; |
|
| 530 | foreach ($send_to['groups'] as $group) { |
|
| 531 | api_item_property_update( |
|
| 532 | $courseInfo, |
|
| 533 | TOOL_ANNOUNCEMENT, |
|
| 534 | $last_id, |
|
| 535 | 'AnnouncementAdded', |
|
| 536 | $authorId, |
|
| 537 | $group |
|
| 538 | ); |
|
| 539 | ||
| 540 | if (($counter % $batchSize) === 0) { |
|
| 541 | $em->flush(); |
|
| 542 | $em->clear(); |
|
| 543 | } |
|
| 544 | $counter++; |
|
| 545 | } |
|
| 546 | } |
|
| 547 | ||
| 548 | // Storing the selected users |
|
| 549 | if (is_array($send_to['users'])) { |
|
| @@ 549-568 (lines=20) @@ | ||
| 546 | } |
|
| 547 | ||
| 548 | // Storing the selected users |
|
| 549 | if (is_array($send_to['users'])) { |
|
| 550 | $counter = 1; |
|
| 551 | foreach ($send_to['users'] as $user) { |
|
| 552 | api_item_property_update( |
|
| 553 | $courseInfo, |
|
| 554 | TOOL_ANNOUNCEMENT, |
|
| 555 | $last_id, |
|
| 556 | 'AnnouncementAdded', |
|
| 557 | $authorId, |
|
| 558 | '', |
|
| 559 | $user |
|
| 560 | ); |
|
| 561 | ||
| 562 | if (($counter % $batchSize) === 0) { |
|
| 563 | $em->flush(); |
|
| 564 | $em->clear(); |
|
| 565 | } |
|
| 566 | $counter++; |
|
| 567 | } |
|
| 568 | } |
|
| 569 | } |
|
| 570 | ||
| 571 | if ($sendToUsersInSession) { |
|