|
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\Course; |
|
10
|
|
|
use Chamilo\CoreBundle\Entity\Session; |
|
11
|
|
|
use Chamilo\CoreBundle\Entity\User; |
|
12
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* CLpView. |
|
16
|
|
|
*/ |
|
17
|
|
|
#[ORM\Table(name: 'c_lp_view')] |
|
18
|
|
|
#[ORM\Index(name: 'course', columns: ['c_id'])] |
|
19
|
|
|
#[ORM\Index(name: 'lp_id', columns: ['lp_id'])] |
|
20
|
|
|
#[ORM\Index(name: 'session_id', columns: ['session_id'])] |
|
21
|
|
|
#[ORM\Entity] |
|
22
|
|
|
class CLpView |
|
23
|
|
|
{ |
|
24
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
|
25
|
|
|
#[ORM\Id] |
|
26
|
|
|
#[ORM\GeneratedValue] |
|
27
|
|
|
protected ?int $iid = null; |
|
28
|
|
|
|
|
29
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
|
30
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
31
|
|
|
protected User $user; |
|
32
|
|
|
|
|
33
|
|
|
#[ORM\ManyToOne(targetEntity: CLp::class)] |
|
34
|
|
|
#[ORM\JoinColumn(name: 'lp_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
|
35
|
|
|
protected CLp $lp; |
|
36
|
|
|
|
|
37
|
|
|
#[ORM\ManyToOne(targetEntity: Course::class)] |
|
38
|
|
|
#[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
39
|
|
|
protected Course $course; |
|
40
|
|
|
|
|
41
|
|
|
#[ORM\ManyToOne(targetEntity: Session::class)] |
|
42
|
|
|
#[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
43
|
|
|
protected ?Session $session = null; |
|
44
|
|
|
|
|
45
|
|
|
#[ORM\Column(name: 'view_count', type: 'integer', nullable: false)] |
|
46
|
|
|
protected int $viewCount; |
|
47
|
|
|
|
|
48
|
|
|
#[ORM\Column(name: 'last_item', type: 'integer', nullable: false)] |
|
49
|
|
|
protected int $lastItem; |
|
50
|
|
|
|
|
51
|
|
|
#[ORM\Column(name: 'progress', type: 'integer', nullable: true)] |
|
52
|
|
|
protected ?int $progress = null; |
|
53
|
|
|
|
|
54
|
|
|
public function getIid(): ?int |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->iid; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function setViewCount(int $viewCount): self |
|
60
|
|
|
{ |
|
61
|
|
|
$this->viewCount = $viewCount; |
|
62
|
|
|
|
|
63
|
|
|
return $this; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Get viewCount. |
|
68
|
|
|
* |
|
69
|
|
|
* @return int |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getViewCount() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->viewCount; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function setLastItem(int $lastItem): self |
|
77
|
|
|
{ |
|
78
|
|
|
$this->lastItem = $lastItem; |
|
79
|
|
|
|
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Get lastItem. |
|
85
|
|
|
* |
|
86
|
|
|
* @return int |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getLastItem() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->lastItem; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function setProgress(int $progress): self |
|
94
|
|
|
{ |
|
95
|
|
|
$this->progress = $progress; |
|
96
|
|
|
|
|
97
|
|
|
return $this; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Get progress. |
|
102
|
|
|
* |
|
103
|
|
|
* @return int |
|
104
|
|
|
*/ |
|
105
|
|
|
public function getProgress() |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->progress; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function getLp(): CLp |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->lp; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function setLp(CLp $lp): self |
|
116
|
|
|
{ |
|
117
|
|
|
$this->lp = $lp; |
|
118
|
|
|
|
|
119
|
|
|
return $this; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function getCourse(): Course |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->course; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
public function setCourse(Course $course): self |
|
128
|
|
|
{ |
|
129
|
|
|
$this->course = $course; |
|
130
|
|
|
|
|
131
|
|
|
return $this; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function getSession(): ?Session |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->session; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function setSession(?Session $session): self |
|
140
|
|
|
{ |
|
141
|
|
|
$this->session = $session; |
|
142
|
|
|
|
|
143
|
|
|
return $this; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
public function getUser(): User |
|
147
|
|
|
{ |
|
148
|
|
|
return $this->user; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
public function setUser(User $user): self |
|
152
|
|
|
{ |
|
153
|
|
|
$this->user = $user; |
|
154
|
|
|
|
|
155
|
|
|
return $this; |
|
156
|
|
|
} |
|
157
|
|
|
} |
|
158
|
|
|
|