System Announcement: Fix pagination and saving announcements - refs BT#21102

pull/4919/head
christian 2 years ago
parent 046553d14b
commit 1bb10318ce
  1. 2
      public/main/admin/system_announcements.php
  2. 11
      public/main/inc/lib/agenda.lib.php
  3. 2
      public/main/inc/lib/notification.lib.php
  4. 44
      src/CoreBundle/Migrations/Schema/V200/Version20231004220000.php

@ -453,6 +453,8 @@ if ($show_announcement_list) {
$announcement_data[] = $row;
}
$table = new SortableTableFromArray($announcement_data);
$table->per_page= 20;
$table->total_number_of_items = count($announcement_data);
$table->set_header(0, '', false, 'width="20px"');
$table->set_header(1, get_lang('active'));
$table->set_header(2, get_lang('Title'));

@ -124,8 +124,7 @@ class Agenda
$this->setIsAllowedToEdit($isAllowToEdit);
$this->events = [];
$agendaColors = array_merge(
[
$agendaColors = [
'platform' => 'red', //red
'course' => '#458B00', //green
'group' => '#A0522D', //siena
@ -133,9 +132,11 @@ class Agenda
'other_session' => '#999', // kind of green
'personal' => 'steel blue', //steel blue
'student_publication' => '#FF8C00', //DarkOrange
],
api_get_setting('agenda.agenda_colors', true) ?: []
);
];
$settingAgendaColors = api_get_setting('agenda.agenda_colors', true);
if (is_array($settingAgendaColors)) {
$agendaColors = array_merge($agendaColors, $settingAgendaColors);
}
// Event colors
$this->event_platform_color = $agendaColors['platform'];

@ -318,7 +318,7 @@ class Notification extends Model
}
// Saving the notification to be sent some day.
$content = cut($content, $this->max_content_length);
//$content = cut($content, $this->max_content_length);
$params = [
'sent_at' => $sendDate,
'dest_user_id' => $user_id,

@ -0,0 +1,44 @@
<?php
/* For licensing terms, see /license.txt */
declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Chamilo\CourseBundle\Entity\CCalendarEvent;
use DateTime;
use DateTimeZone;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\Exception\ORMException;
use Exception;
class Version20231004220000 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Drop fields not used in this version in table sys_announcement';
}
/**
* @inheritDoc
*
* @throws ORMException
* @throws Exception
*/
public function up(Schema $schema): void
{
$table = $schema->getTable('sys_announcement');
if ($table->hasColumn('visible_teacher')) {
$this->addSql('ALTER TABLE sys_announcement DROP visible_teacher');
}
if ($table->hasColumn('visible_student')) {
$this->addSql('ALTER TABLE sys_announcement DROP visible_student');
}
if ($table->hasColumn('visible_guest')) {
$this->addSql('ALTER TABLE sys_announcement DROP visible_guest');
}
}
}
Loading…
Cancel
Save