|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
|
6
|
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource; |
|
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
12
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* CCourseDescription. |
|
16
|
|
|
* |
|
17
|
|
|
* @ORM\Table(name="c_course_description") |
|
18
|
|
|
* @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CCourseDescriptionRepository") |
|
19
|
|
|
*/ |
|
20
|
|
|
class CCourseDescription extends AbstractResource implements ResourceInterface |
|
21
|
|
|
{ |
|
22
|
|
|
public const TYPE_DESCRIPTION = 1; |
|
23
|
|
|
public const TYPE_OBJECTIVES = 2; |
|
24
|
|
|
public const TYPE_TOPICS = 3; |
|
25
|
|
|
public const TYPE_METHODOLOGY = 4; |
|
26
|
|
|
public const TYPE_COURSE_MATERIAL = 5; |
|
27
|
|
|
public const TYPE_RESOURCES = 6; |
|
28
|
|
|
public const TYPE_ASSESSMENT = 7; |
|
29
|
|
|
public const TYPE_CUSTOM = 8; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @ORM\Column(name="iid", type="integer") |
|
33
|
|
|
* @ORM\Id |
|
34
|
|
|
* @ORM\GeneratedValue |
|
35
|
|
|
*/ |
|
36
|
|
|
protected int $iid; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @ORM\Column(name="title", type="text", nullable=true) |
|
40
|
|
|
*/ |
|
41
|
|
|
#[Assert\NotBlank] |
|
42
|
|
|
protected ?string $title = null; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @ORM\Column(name="content", type="text", nullable=true) |
|
46
|
|
|
*/ |
|
47
|
|
|
protected ?string $content; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @ORM\Column(name="description_type", type="integer", nullable=false) |
|
51
|
|
|
*/ |
|
52
|
|
|
#[Assert\Choice(callback: 'getTypes')] |
|
53
|
|
|
protected int $descriptionType; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @ORM\Column(name="progress", type="integer", nullable=false) |
|
57
|
|
|
*/ |
|
58
|
|
|
protected int $progress; |
|
59
|
|
|
|
|
60
|
|
|
public function __construct() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->content = ''; |
|
63
|
|
|
$this->progress = 0; |
|
64
|
|
|
$this->descriptionType = 1; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function __toString(): string |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->getTitle(); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public static function getTypes(): array |
|
73
|
|
|
{ |
|
74
|
|
|
return [ |
|
75
|
|
|
self::TYPE_DESCRIPTION, |
|
76
|
|
|
self::TYPE_OBJECTIVES, |
|
77
|
|
|
self::TYPE_TOPICS, |
|
78
|
|
|
self::TYPE_METHODOLOGY, |
|
79
|
|
|
self::TYPE_COURSE_MATERIAL, |
|
80
|
|
|
self::TYPE_RESOURCES, |
|
81
|
|
|
self::TYPE_ASSESSMENT, |
|
82
|
|
|
self::TYPE_CUSTOM, |
|
83
|
|
|
]; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function setTitle(string $title): self |
|
87
|
|
|
{ |
|
88
|
|
|
$this->title = $title; |
|
89
|
|
|
|
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Get title. |
|
95
|
|
|
* |
|
96
|
|
|
* @return string |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getTitle() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->title; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function setContent(string $content): self |
|
104
|
|
|
{ |
|
105
|
|
|
$this->content = $content; |
|
106
|
|
|
|
|
107
|
|
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Get content. |
|
112
|
|
|
* |
|
113
|
|
|
* @return string |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getContent() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->content; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function setDescriptionType(int $descriptionType): self |
|
121
|
|
|
{ |
|
122
|
|
|
$this->descriptionType = $descriptionType; |
|
123
|
|
|
|
|
124
|
|
|
return $this; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Get descriptionType. |
|
129
|
|
|
* |
|
130
|
|
|
* @return int |
|
131
|
|
|
*/ |
|
132
|
|
|
public function getDescriptionType() |
|
133
|
|
|
{ |
|
134
|
|
|
return $this->descriptionType; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function setProgress(int $progress): self |
|
138
|
|
|
{ |
|
139
|
|
|
$this->progress = $progress; |
|
140
|
|
|
|
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* Get progress. |
|
146
|
|
|
* |
|
147
|
|
|
* @return int |
|
148
|
|
|
*/ |
|
149
|
|
|
public function getProgress() |
|
150
|
|
|
{ |
|
151
|
|
|
return $this->progress; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @return int |
|
156
|
|
|
*/ |
|
157
|
|
|
public function getIid() |
|
158
|
|
|
{ |
|
159
|
|
|
return $this->iid; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function getResourceIdentifier(): int |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->getIid(); |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function getResourceName(): string |
|
168
|
|
|
{ |
|
169
|
|
|
return $this->getTitle(); |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
public function setResourceName(string $name): self |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->setTitle($name); |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
|