ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCourseObjectiveListGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=0);
26 {
30  public function init(): void
31  {
32  $this->static_link_enabled = true;
33  $this->delete_enabled = false;
34  $this->cut_enabled = false;
35  $this->subscribe_enabled = false;
36  $this->link_enabled = false;
37  $this->info_screen_enabled = false;
38  $this->progress_enabled = true;
39  $this->type = "lobj";
40  //$this->gui_class_name = "ilobjcoursegui";
41 
42  // general commands array
43  $this->commands = array();
44  }
45 
46  public function getObjectiveListItemHTML(
47  int $a_ref_id,
48  int $a_obj_id,
49  string $a_title,
50  string $a_description,
51  bool $a_manage = false
52  ): string {
53  $this->tpl = new ilTemplate(
54  "tpl.container_list_item.html",
55  true,
56  true,
57  "Services/Container"
58  );
59  $this->initItem($a_ref_id, $a_obj_id, ilObject::_lookupType($a_obj_id), $a_title, $a_description);
60 
61  $this->insertIconsAndCheckboxes();
62  $this->insertTitle();
63  $this->insertDescription();
64 
65  if (!$a_manage) {
66  $this->insertProgressInfo();
67  }
68  $this->insertPositionField();
69 
70  // subitems
71  $this->insertSubItems();
72 
73  // reset properties and commands
74  $this->cust_prop = array();
75  $this->cust_commands = array();
76  $this->sub_item_html = array();
77  $this->position_enabled = false;
78 
79  return $this->tpl->get();
80  }
81 
85  public function insertTitle(): void
86  {
87  if (
89  $this->user->getId(),
90  $this->getContainerObject()->getObject()->getId()
92  $this->user->getId(),
93  $this->getContainerObject()->getObject()->getId(),
95  )
96  ) {
97  $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuterHighlight');
98  } else {
99  $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuter');
100  }
101 
102  if (!$this->getCommandsStatus()) {
103  $this->tpl->setCurrentBlock("item_title");
104  $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
105  $this->tpl->parseCurrentBlock();
106  return;
107  }
108  $this->tpl->setCurrentBlock("item_title_linked");
109  $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
110 
111  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->getObject()->getRefId());
112  $this->ctrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
113  $link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", "");
114  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
115 
116  $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
117  $this->tpl->parseCurrentBlock();
118  }
119 
123  public function insertProgressInfo(): void
124  {
125  $this->lng->loadLanguageModule('trac');
126  $this->tpl->setCurrentBlock('item_progress');
127 
129 
131  $this->user->getId(),
132  $this->getContainerObject()->getObject()->getId()
133  )) {
135  $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_status'));
136  $this->tpl->setVariable(
137  'PROGRESS_ICON',
138  $icons->renderIconForStatus(ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM)
139  );
140  break;
141 
144  $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_pretest'));
146  $this->user->getId(),
147  $this->getContainerObject()->getObject()->getId(),
149  )) {
150  $this->tpl->setVariable(
151  'PROGRESS_ICON',
152  $icons->renderIconForStatus(ilLPStatus::LP_STATUS_FAILED_NUM)
153  );
154  } else {
155  $this->tpl->setVariable(
156  'PROGRESS_ICON',
157  $icons->renderIconForStatus(ilLPStatus::LP_STATUS_COMPLETED_NUM)
158  );
159  }
160  break;
161 
164  $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_result'));
166  $this->user->getId(),
167  $this->getContainerObject()->getObject()->getId(),
169  )) {
170  $this->tpl->setVariable(
171  'PROGRESS_ICON',
172  $icons->renderIconForStatus(ilLPStatus::LP_STATUS_FAILED_NUM)
173  );
174  } else {
175  $this->tpl->setVariable(
176  'PROGRESS_ICON',
177  $icons->renderIconForStatus(ilLPStatus::LP_STATUS_COMPLETED_NUM)
178  );
179  }
180  break;
181 
182  }
183  $this->tpl->parseCurrentBlock();
184  }
185 }
const LP_STATUS_COMPLETED_NUM
static isSuggested(int $a_usr_id, int $a_crs_id, int $a_objective_id)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
getObjectiveListItemHTML(int $a_ref_id, int $a_obj_id, string $a_title, string $a_description, bool $a_manage=false)
static getStatus(int $a_usr_id, int $a_crs_id)
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
const LP_STATUS_NOT_ATTEMPTED_NUM
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
initItem(int $ref_id, int $obj_id, string $type, string $title="", string $description="")
initialize new item (is called by getItemHTML())
const LP_STATUS_FAILED_NUM