Skip to content

Commit 18822ab

Browse files
Merge pull request #8468 from christianbeeznest/fixes-plugin-studentfollowup01
Plugin: Integrate StudentFollowUp plugin
2 parents a1164f9 + a16e5be commit 18822ab

12 files changed

Lines changed: 864 additions & 495 deletions

File tree

public/main/admin/settings.lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ function getStablePluginAllowList(): array
326326
'CourseLegal',
327327
'Static',
328328
'ShowUserInfo',
329+
'StudentFollowUp',
329330
];
330331
}
331332

public/main/my_space/index.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,28 @@
166166
api_get_path(WEB_PLUGIN_PATH).'LearningCalendar/start.php'
167167
);
168168
}
169+
170+
// Optional StudentFollowUp plugin entry for users allowed to access reporting.
171+
$studentFollowUpPluginPath = api_get_path(SYS_PLUGIN_PATH).'StudentFollowUp/StudentFollowUpPlugin.php';
172+
if (file_exists($studentFollowUpPluginPath)) {
173+
require_once $studentFollowUpPluginPath;
174+
}
175+
176+
if (class_exists('StudentFollowUpPlugin')) {
177+
$studentFollowUpPlugin = StudentFollowUpPlugin::create();
178+
if ($studentFollowUpPlugin->isEnabled()) {
179+
$actionsLeft .= Display::url(
180+
Display::getMdiIcon(
181+
'account-search',
182+
'ch-tool-icon',
183+
null,
184+
32,
185+
$studentFollowUpPlugin->get_lang('plugin_title')
186+
),
187+
api_get_path(WEB_PLUGIN_PATH).'StudentFollowUp/my_students.php'
188+
);
189+
}
190+
}
169191
}
170192

171193
// ---------------------------------------------------------------------

public/plugin/StudentFollowUp/Entity/CarePost.php

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
declare(strict_types=1);
66

7-
87
namespace Chamilo\PluginBundle\StudentFollowUp\Entity;
98

10-
use Chamilo\PluginBundle\XApi\ToolExperience\Actor\User;
9+
use Chamilo\CoreBundle\Entity\User;
1110
use DateTime;
11+
use Doctrine\Common\Collections\ArrayCollection;
1212
use Doctrine\Common\Collections\Collection;
1313
use Doctrine\ORM\Mapping as ORM;
1414
use Gedmo\Mapping\Annotation as Gedmo;
@@ -21,75 +21,72 @@ class CarePost
2121
#[ORM\Column(name: 'id', type: 'integer')]
2222
#[ORM\Id]
2323
#[ORM\GeneratedValue]
24-
protected ?int $id;
24+
protected ?int $id = null;
2525

2626
#[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)]
27-
protected string $title;
27+
protected string $title = '';
2828

2929
#[ORM\Column(name: 'content', type: 'text', nullable: true)]
30-
protected string $content;
30+
protected ?string $content = null;
3131

3232
#[ORM\Column(name: 'external_care_id', type: 'string', nullable: true)]
33-
protected ?string $externalCareId;
33+
protected ?string $externalCareId = null;
3434

3535
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)]
36-
protected ?DateTime $createdAt;
36+
protected ?DateTime $createdAt = null;
3737

3838
#[ORM\Column(name: 'updated_at', type: 'datetime', nullable: true)]
39-
protected ?DateTime $updatedAt;
39+
protected ?DateTime $updatedAt = null;
4040

4141
#[ORM\Column(name: 'private', type: 'boolean')]
42-
protected bool $private;
42+
protected bool $private = false;
4343

4444
#[ORM\Column(name: 'external_source', type: 'boolean')]
45-
protected bool $externalSource;
45+
protected bool $externalSource = false;
4646

4747
#[ORM\Column(name: 'tags', type: 'array')]
48-
protected array $tags;
48+
protected array $tags = [];
4949

5050
#[ORM\Column(name: 'attachment', type: 'string', length: 255)]
51-
protected string $attachment;
51+
protected string $attachment = '';
5252

53-
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'posts')]
53+
#[ORM\ManyToOne(targetEntity: User::class)]
5454
#[ORM\JoinColumn(name: 'insert_user_id', referencedColumnName: 'id', nullable: false)]
55-
private User $insertUser;
55+
private ?User $insertUser = null;
5656

5757
#[ORM\ManyToOne(targetEntity: User::class, cascade: ['persist'])]
5858
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)]
59-
private User $user;
59+
private ?User $user = null;
6060

6161
#[Gedmo\TreeParent]
6262
#[ORM\ManyToOne(targetEntity: CarePost::class, inversedBy: 'children')]
6363
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
64-
private CarePost $parent;
64+
private ?CarePost $parent = null;
6565

6666
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: CarePost::class)]
6767
#[ORM\OrderBy(['createdAt' => 'DESC'])]
6868
private Collection $children;
6969

7070
#[Gedmo\TreeLeft]
7171
#[ORM\Column(name: 'lft', type: 'integer', unique: false, nullable: true)]
72-
private ?int $lft;
72+
private ?int $lft = null;
7373

7474
#[Gedmo\TreeRight]
7575
#[ORM\Column(name: 'rgt', type: 'integer', unique: false, nullable: true)]
76-
private ?int $rgt;
76+
private ?int $rgt = null;
7777

7878
#[Gedmo\TreeLevel]
7979
#[ORM\Column(name: 'lvl', type: 'integer', unique: false, nullable: true)]
80-
private ?int $lvl;
80+
private ?int $lvl = null;
8181

8282
#[Gedmo\TreeRoot]
8383
#[ORM\Column(name: 'root', type: 'integer', unique: false, nullable: true)]
84-
private ?int $root;
84+
private ?int $root = null;
8585

86-
/**
87-
* Project constructor.
88-
*/
8986
public function __construct()
9087
{
9188
$this->createdAt = new DateTime();
92-
$this->attachment = '';
89+
$this->children = new ArrayCollection();
9390
}
9491

9592
public function getId(): ?int
@@ -109,7 +106,7 @@ public function getTitle(): string
109106
return $this->title;
110107
}
111108

112-
public function setTitle($title): static
109+
public function setTitle(string $title): static
113110
{
114111
$this->title = $title;
115112

@@ -118,10 +115,10 @@ public function setTitle($title): static
118115

119116
public function getContent(): string
120117
{
121-
return $this->content;
118+
return $this->content ?? '';
122119
}
123120

124-
public function setContent(string $content): static
121+
public function setContent(?string $content): static
125122
{
126123
$this->content = $content;
127124

@@ -140,12 +137,12 @@ public function setExternalCareId(?string $externalCareId): static
140137
return $this;
141138
}
142139

143-
public function getUser(): User
140+
public function getUser(): ?User
144141
{
145142
return $this->user;
146143
}
147144

148-
public function setUser($user): static
145+
public function setUser(User $user): static
149146
{
150147
$this->user = $user;
151148

@@ -188,12 +185,12 @@ public function setAttachment(string $attachment): static
188185
return $this;
189186
}
190187

191-
public function getParent(): CarePost
188+
public function getParent(): ?CarePost
192189
{
193190
return $this->parent;
194191
}
195192

196-
public function setParent(CarePost $parent): static
193+
public function setParent(?CarePost $parent): static
197194
{
198195
$this->parent = $parent;
199196

@@ -202,7 +199,7 @@ public function setParent(CarePost $parent): static
202199

203200
public function hasParent(): int
204201
{
205-
return !empty($this->parent) ? 1 : 0;
202+
return null !== $this->parent ? 1 : 0;
206203
}
207204

208205
public function getChildren(): Collection
@@ -253,7 +250,7 @@ public function setTags(array $tags): static
253250
return $this;
254251
}
255252

256-
public function getInsertUser(): User
253+
public function getInsertUser(): ?User
257254
{
258255
return $this->insertUser;
259256
}

0 commit comments

Comments
 (0)