Skip to content

Commit 193d447

Browse files
Gradebook: Add certificate validity (in days) to gradebook (add certificate_validity_period column to gradebook_category) - refs #6371
Author: @christianbeeznest
1 parent df6127a commit 193d447

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/CoreBundle/Entity/GradebookCategory.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ class GradebookCategory
128128
#[ORM\Column(name: 'generate_certificates', type: 'boolean', nullable: false)]
129129
protected bool $generateCertificates;
130130

131+
#[Groups(['gradebookCategory:read', 'gradebookCategory:write'])]
132+
#[ORM\Column(name: 'certificate_validity_period', type: 'integer', nullable: true)]
133+
protected ?int $certificateValidityPeriod = null;
134+
131135
#[ORM\Column(name: 'is_requirement', type: 'boolean', nullable: false, options: ['default' => 0])]
132136
protected bool $isRequirement;
133137

@@ -305,6 +309,24 @@ public function getGenerateCertificates()
305309
return $this->generateCertificates;
306310
}
307311

312+
/**
313+
* Get number of days the linked certificate is valid after attribution
314+
*/
315+
public function getCertificateValidityPeriod(): ?int
316+
{
317+
return $this->certificateValidityPeriod;
318+
}
319+
320+
/**
321+
* Set number of days the linked certificate is valid after attribution
322+
*/
323+
public function setCertificateValidityPeriod(?int $certificateValidityPeriod): self
324+
{
325+
$this->certificateValidityPeriod = $certificateValidityPeriod;
326+
327+
return $this;
328+
}
329+
308330
public function setIsRequirement(bool $isRequirement): self
309331
{
310332
$this->isRequirement = $isRequirement;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/* For licensing terms, see /license.txt */
4+
5+
declare(strict_types=1);
6+
7+
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8+
9+
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
10+
use Doctrine\DBAL\Schema\Schema;
11+
12+
class Version20250619114200 extends AbstractMigrationChamilo
13+
{
14+
public function getDescription(): string
15+
{
16+
return 'Add certificate_validity_period column to gradebook_category';
17+
}
18+
19+
public function up(Schema $schema): void
20+
{
21+
$this->addSql('ALTER TABLE gradebook_category ADD certificate_validity_period INT DEFAULT NULL;');
22+
}
23+
24+
public function down(Schema $schema): void
25+
{
26+
$this->addSql('ALTER TABLE gradebook_category DROP COLUMN certificate_validity_period;');
27+
}
28+
}

0 commit comments

Comments
 (0)