3 declare(strict_types=1);
43 public function __construct(
object $a_parent_obj,
string $a_parent_cmd)
47 $this->
ctrl = $DIC->ctrl();
48 $this->
lng = $DIC->language();
49 $this->tree = $DIC->repositoryTree();
50 $this->objDefinition = $DIC[
'objDefinition'];
51 $this->
ui = $DIC->ui()->factory();
52 $this->renderer = $DIC->ui()->renderer();
54 $this->
setId(
"sess_materials_" . $a_parent_obj->getCurrentObject()->getId());
58 $this->parent_ref_id = $this->tree->getParentId($a_parent_obj->getCurrentObject()->getRefId());
59 $this->parent_object_id = $a_parent_obj->getCurrentObject()->getId();
61 $this->
setRowTemplate(
"tpl.session_materials_row.html",
"Modules/Session");
66 $this->
addColumn($this->
lng->txt(
"crs_materials"),
"title",
"90%");
67 $this->
addColumn($this->
lng->txt(
"sess_is_assigned"),
"active",
"5");
79 $this->
lng->loadLanguageModule(
'sess');
84 $this->material_items = $a_set;
94 $this->container_ref_id = $a_set;
109 $already_assigned_ref_ids = [];
111 $already_assigned_ref_ids[] =
$ref_id;
118 if (in_array($node[
'ref_id'], $already_assigned_ref_ids)) {
123 if ($node[
'child'] == $this->parent_ref_id ||
125 in_array($node[
'type'], array(
'sess',
'itgr',
'rolf'))) {
130 $materials[] = $node;
136 if (!empty($this->
filter)) {
144 $data_filtered = $a_data;
147 if (isset($this->
filter[
"title"]) && $this->
filter[
'title'] !==
'') {
148 foreach ($data_filtered as
$key => $material) {
149 $title = $material[
"title"];
150 if (stripos(
$title, $this->
filter[
"title"]) ===
false) {
151 unset($data_filtered[
$key]);
157 if (isset($this->
filter[
'type']) && $this->
filter[
'type'] !==
'') {
158 foreach ($data_filtered as
$key => $material) {
159 $type = $material[
"type"];
161 if ($type != $this->
filter[
"type"]) {
162 unset($data_filtered[
$key]);
168 if (isset($this->
filter[
"status"]) && $this->
filter[
'status'] !==
'') {
170 $assigned_items =
new ilEventItems($this->parent_object_id);
171 $assigned_items = $assigned_items->getItems();
173 if ($this->
filter[
"status"] ==
"assigned") {
174 foreach ($data_filtered as
$key => $material) {
175 if (!in_array($material[
"ref_id"], $assigned_items)) {
176 unset($data_filtered[
$key]);
179 } elseif ($this->
filter[
"status"] ==
"notassigned") {
180 foreach ($data_filtered as
$key => $material) {
181 if (in_array($material[
"ref_id"], $assigned_items)) {
182 unset($data_filtered[
$key]);
188 return $data_filtered;
196 protected function fillRow(array $a_set): void
199 $this->tpl->setVariable(
'IMG_ALT', $this->
lng->txt(
'obj_' . $a_set[
'type']));
201 $this->tpl->setVariable(
"VAL_POSTNAME",
"items");
202 $this->tpl->setVariable(
"VAL_ID", $a_set[
'ref_id']);
204 $this->tpl->setVariable(
"COLL_TITLE", $a_set[
'title']);
206 if (strlen((
string) $a_set[
'description'])) {
207 $this->tpl->setVariable(
"COLL_DESC", (
string) $a_set[
'description']);
210 $ass_glyph = $this->
ui->symbol()->icon()->custom(
212 $this->
lng->txt(
"assigned")
214 $this->tpl->setVariable(
"ASSIGNED_IMG_OK", $this->renderer->render($ass_glyph));
218 $path->enableDisplayCut(
false);
219 $path->enableTextOnly(
false);
220 $path->enableHideLeaf(
false);
221 $this->tpl->setVariable(
"COLL_PATH",
$path->getPath($this->getContainerRefId(), (
int) $a_set[
'ref_id']));
232 foreach ($items as $item) {
233 $all_types[] = $item[
"type"];
235 return array_values(array_unique($all_types));
242 $ti->setMaxLength(64);
245 $ti->readFromSession();
246 $this->
filter[
"title"] = $ti->getValue();
252 $types[0] = $this->
lng->txt(
'sess_filter_all_types');
253 foreach ($filter_types as $type) {
254 $types[
"$type"] = $this->
lng->txt(
"obj_" . $type);
260 $select->readFromSession();
261 $this->
filter[
"type"] = $select->getValue();
266 $status[
"notassigned"] = $this->
lng->txt(
"sess_filter_not_assigned");
267 $status[
"assigned"] = $this->
lng->txt(
"assigned");
272 $select_status->readFromSession();
273 $this->
filter[
'status'] = $select_status->getValue();
__construct(object $a_parent_obj, string $a_parent_cmd)
Creates a path for a start and endnode.
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
ILIAS UI Renderer $renderer
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setFormName(string $a_name="")
parses the objects.xml it handles the xml-description of all ilias objects
setExternalSorting(bool $a_val)
setContainerRefId(int $a_set)
setDefaultOrderField(string $a_defaultorderfield)
filterData(array $a_data)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setMaterialItems(array $a_set)
setDefaultOrderDirection(string $a_defaultorderdirection)
isSideBlock(string $obj_name)
Check, whether object type is a side block.
static stableSortArray(array $array, string $a_array_sortby, string $a_array_sortorder="asc", bool $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
ilObjectDefinition $objDefinition
setMaterials(array $a_materials)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
typesAvailable()
Get object types available in this specific session.
determineOffsetAndOrder(bool $a_omit_offset=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setExternalSegmentation(bool $a_val)