ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
CriteriaCatalogueTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
30{
32
33 public function __construct(
34 protected InternalDomainService $domain,
35 protected InternalGUIService $gui,
36 int $exc_id,
37 object $parent_gui,
38 string $parent_cmd
39 ) {
40 $this->retrieval = $domain->peerReview()->criteriaCatalogueRetrieval($exc_id);
41 parent::__construct($parent_gui, $parent_cmd);
42 }
43
44 public function hasProtectedAssignments(): bool
45 {
46 return $this->retrieval->hasProtectedAssignments();
47 }
48
49 protected function getId(): string
50 {
51 return 'exc_criteria_catalogues';
52 }
53
54 protected function getTitle(): string
55 {
56 return $this->domain->lng()->txt('exc_criteria_catalogues');
57 }
58
59 protected function getRetrieval(): RetrievalInterface
60 {
61 return $this->retrieval;
62 }
63
64 protected function getOrderingCommand(): string
65 {
66 return 'saveOrder';
67 }
68
69 protected function activeAction(string $action, array $data_row): bool
70 {
71 if ($action === 'editCriteria') {
72 return !$data_row['protected'];
73 }
74
75 return true;
76 }
77
78 protected function transformRow(array $data_row): array
79 {
80 $ctrl = $this->gui->ctrl();
81 $ctrl->setParameter($this->parent_gui, 'cat_id', $data_row['id']);
82 $title = $this->gui->ui()->factory()->link()->standard(
83 $data_row['title'],
84 $ctrl->getLinkTarget($this->parent_gui, 'edit')
85 );
86 $ctrl->setParameter($this->parent_gui, 'cat_id', '');
87
88 return [
89 'id' => $data_row['id'],
90 'title' => $title,
91 'criterias' => $data_row['criterias'],
92 'assignments' => $data_row['assignments']
93 ];
94 }
95
97 {
98 $lng = $this->domain->lng();
99
100 return $table
101 ->linkColumn('title', $lng->txt('title'))
102 ->textColumn('criterias', $lng->txt('exc_criterias'))
103 ->textColumn('assignments', $lng->txt('exc_assignments'))
104 ->singleRedirectAction(
105 'edit',
106 $lng->txt('edit'),
107 [\ilExcCriteriaCatalogueGUI::class],
108 'edit',
109 'cat_id'
110 )
111 ->singleRedirectAction(
112 'editCriteria',
113 $lng->txt('exc_edit_criterias'),
114 [\ilExcCriteriaCatalogueGUI::class, \ilExcCriteriaGUI::class],
115 '',
116 'cat_id'
117 )
118 ->multiAction('confirmDeletion', $lng->txt('delete'));
119 }
120}
Exercise UI frontend presentation service class.
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, int $exc_id, object $parent_gui, string $parent_cmd)
transformRow(array $data_row)
transform raw data array to table row data array
linkColumn(string $key, string $title, bool $sortable=false)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26