19 declare(strict_types=1);
68 protected static array
$tags = [];
196 public function __construct(
int $context = self::CONTEXT_REPOSITORY)
201 $this->
access = $DIC[
'ilAccess'];
202 $this->
user = $DIC[
'ilUser'];
203 $this->object_dic = LocalDIC::dic();
204 $this->obj_definition = $DIC[
'objDefinition'];
205 $this->tree = $DIC[
'tree'];
206 $this->
settings = $DIC[
'ilSetting'];
207 $this->
http = $DIC->http();
208 $this->
ui = $DIC->ui();
209 $this->main_tpl = $DIC[
'tpl'];
210 $this->rbacsystem = $DIC[
'rbacsystem'];
211 $this->
ctrl = $DIC[
'ilCtrl'];
212 $this->
lng = $DIC[
'lng'];
213 $this->mode = self::IL_LIST_FULL;
214 $this->path_enabled =
false;
216 $this->request_wrapper = $DIC->http()->wrapper()->query();
231 $this->
lng->loadLanguageModule(
'obj');
232 $this->
lng->loadLanguageModule(
'rep');
233 $params = $DIC->http()->request()->getQueryParams();
235 $this->requested_cmd = (string) (
$params[
'cmd'] ?? null);
236 $this->requested_base_class = (string) (
$params[
'baseClass'] ?? null);
237 $this->clipboard = $DIC
242 $this->notes_service = $DIC->notes();
264 $this->static_link_enabled =
true;
265 $this->delete_enabled =
true;
266 $this->cut_enabled =
true;
267 $this->subscribe_enabled =
true;
268 $this->link_enabled =
false;
269 $this->copy_enabled =
false;
270 $this->progress_enabled =
false;
271 $this->notice_properties_enabled =
true;
272 $this->info_screen_enabled =
false;
274 $this->gui_class_name =
'';
282 $this->properties_enabled = $status;
292 $this->preconditions_enabled = $status;
302 $this->notice_properties_enabled = $status;
312 $this->description_enabled = $status;
322 $this->search_fragment_enabled = $status;
332 $this->path_linked = $status;
337 $this->relevance = $rel;
347 $this->icons_enabled = $status;
357 $this->checkboxes_enabled = $status;
367 $this->expand_enabled = $status;
377 $this->is_expanded = $status;
390 $this->position_enabled =
true;
391 $this->position_field_index = $field_index;
397 $this->delete_enabled = $status;
407 $this->cut_enabled = $status;
417 $this->copy_enabled = $status;
427 $this->subscribe_enabled = $status;
437 $this->link_enabled = $status;
447 $this->path_enabled =
$path;
448 $this->path_start_node = $start_node;
459 $this->commands_enabled = $status;
460 $this->std_cmd_only = $std_only;
470 $this->info_screen_enabled = $info_screen;
480 $this->lp_cmd_enabled = $enabled;
485 $this->lp_settings_cmd_enabled = $enabled;
495 $this->sub_item_html[] = $html;
500 $this->progress_enabled = $status;
510 $this->substitutions_enabled = $status;
524 $this->item_detail_links_enabled = $status;
542 $this->item_detail_links = $detail_links;
543 $this->item_detail_links_intro = $intro_txt;
548 if (!count($this->item_detail_links)) {
551 if (strlen($this->item_detail_links_intro)) {
552 $this->tpl->setCurrentBlock(
'item_detail_intro');
553 $this->tpl->setVariable(
'ITEM_DETAIL_INTRO_TXT', $this->item_detail_links_intro);
554 $this->tpl->parseCurrentBlock();
557 foreach ($this->item_detail_links as
$info) {
558 $this->tpl->setCurrentBlock(
'item_detail_link');
559 $this->tpl->setVariable(
'ITEM_DETAIL_LINK_TARGET', $info[
'target']);
560 $this->tpl->setVariable(
'ITEM_DETAIL_LINK_DESC', $info[
'desc']);
561 $this->tpl->setVariable(
'ITEM_DETAIL_LINK_HREF', $info[
'link']);
562 $this->tpl->setVariable(
'ITEM_DETAIL_LINK_NAME', $info[
'name']);
563 $this->tpl->parseCurrentBlock();
565 $this->tpl->setCurrentBlock(
'item_detail_links');
566 $this->tpl->parseCurrentBlock();
570 $this->title = $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
585 $this->description = $this->
refinery->encode()->htmlSpecialCharsAsEntities()->transform(
603 $this->search_fragment = $text;
613 $this->separate_commands = $val;
633 $this->additional_information = $val;
648 $this->details_level = $level;
661 $this->repository_transfer_enabled = $value;
669 $this->restrict_to_goto = $value;
689 $cache_prefix =
null;
690 if ($this->context == self::CONTEXT_WORKSPACE || $this->context == self::CONTEXT_WORKSPACE_SHARING) {
691 $cache_prefix =
'wsp';
692 if (!isset($this->ws_access)) {
697 if (isset($this->access_cache[$permission][
'-' . $cmd][$cache_prefix . $ref_id])) {
698 return $this->access_cache[$permission][
'-' . $cmd][$cache_prefix .
$ref_id];
701 if ($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SEARCH) {
702 $access = $this->
access->checkAccess($permission, $cmd, $ref_id, $type, (
int) $obj_id);
703 if ($this->
access->getPreventCachingLastResult()) {
704 $this->prevent_access_caching =
true;
707 $access = $this->ws_access->
checkAccess($permission, $cmd, $ref_id, $type);
710 $this->access_cache[$permission][
'-' . $cmd][$cache_prefix .
$ref_id] =
$access;
722 string $description =
'' 724 $this->access_cache = [];
727 $this->object_properties = $this->object_dic[
'properties.aggregator']->getFor($obj_id);
732 $this->adm_commands_included =
false;
733 $this->prevent_access_caching =
false;
736 if ($this->context == self::CONTEXT_REPOSITORY) {
746 $this->condition_target = [
749 'target_type' => $target_type
755 $this->condition_target = [];
760 $this->title_link_disabled = $status;
765 $this->default_command_params =
$params;
775 if ($this->static_link_enabled and !$this->default_command_params) {
777 $command[
'link'] = $link;
778 $command[
'frame'] =
'_top';
781 if ($this->default_command_params) {
783 foreach ($this->default_command_params as $name => $value) {
784 $params[] = $name .
'=' . $value;
788 if (!stristr($command[
'link'],
'?')) {
789 $command[
'link'] .=
'?' .
$params;
791 $command[
'link'] .=
'&' .
$params;
807 if ($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SEARCH) {
815 $this->
ctrl->setParameterByClass(
'ilrepositorygui',
'ref_id', $this->
getCommandId());
816 $cmd_link = $this->
ctrl->getLinkTargetByClass(
'ilrepositorygui', $cmd);
817 $this->
ctrl->setParameterByClass(
'ilrepositorygui',
'ref_id', $this->requested_ref_id);
821 $this->
ctrl->setParameterByClass($this->gui_class_name,
'ref_id',
'');
822 $this->
ctrl->setParameterByClass($this->gui_class_name,
'wsp_id', $this->ref_id);
823 return $this->
ctrl->getLinkTargetByClass($this->gui_class_name, $cmd);
868 if ($this->context == self::CONTEXT_REPOSITORY) {
874 'property' => $this->
lng->txt(
'status'),
875 'value' => $this->
lng->txt(
'offline')
884 $webdav_lock_backend =
$webdav_dic->locksbackend();
886 if ($lock = $webdav_lock_backend->getLocksOnObjectId($this->obj_id)) {
887 $lock_user =
new ilObjUser($lock->getIliasOwner());
891 'property' => $this->
lng->txt(
'in_use_by'),
892 'value' => $lock_user->getLogin(),
894 './ilias.php?user=' .
895 $lock_user->getId() .
896 '&cmd=showUserProfile&cmdClass=ildashboardgui&baseClass=ilDashboardGUI' 908 string $property =
'',
911 bool $newline =
false 913 $this->cust_prop[] = [
914 'property' => $property,
917 'newline' => $newline
923 if (is_array($this->cust_prop)) {
924 foreach ($this->cust_prop as $property) {
935 if (isset($prop[
'alert']) && $prop[
'alert'] ==
true) {
944 $this->notice_prop = [];
945 if ($infos = $this->ldap_mapping->getInfoStrings($this->obj_id,
true)) {
946 foreach ($infos as
$info) {
947 $this->notice_prop[] = [
'value' =>
$info];
953 public function addCustomCommand(
string $link,
string $lang_var,
string $frame =
'',
string $onclick =
''): void
955 $this->cust_commands[] = [
957 'lang_var' => $lang_var,
959 'onclick' => $onclick
967 $this->cust_commands[] = $button;
968 if ($triggeredModal !==
null) {
969 $this->cust_modals[] = $triggeredModal;
975 $this->force_visible_only = $stat;
1009 foreach ($this->commands as $command) {
1010 $permission = $command[
'permission'];
1011 $cmd = $command[
'cmd'];
1012 $lang_var = $command[
'lang_var'] ??
'';
1014 $info_object =
null;
1018 $access_granted =
false;
1020 if (isset($command[
'txt'])) {
1021 $txt = $command[
'txt'];
1027 (isset($command[
'enable_anonymous']) && $command[
'enable_anonymous'] ==
'false')
1038 $access_granted =
true;
1043 $info_object = $this->
access->getInfo();
1046 if (!isset($command[
'default'])) {
1047 $command[
'default'] =
'';
1050 'permission' => $permission,
1052 'link' => $cmd_link,
1053 'frame' => $cmd_frame,
1054 'lang_var' => $lang_var,
1056 'granted' => $access_granted,
1057 'access_info' => $info_object,
1058 'img' => $cmd_image,
1059 'default' => $command[
'default']
1063 return $ref_commands;
1080 if ($this->restrict_to_goto) {
1081 $this->default_command = [
1088 !$this->default_command ||
1090 $this->title_link_disabled
1093 $this->tpl->setCurrentBlock(
'item_title');
1094 $this->tpl->setVariable(
'TXT_TITLE', $this->
getTitle());
1096 $this->default_command[
'link'] = $this->
modifyTitleLink($this->default_command[
'link']);
1098 list($this->default_command[
'link'], $this->default_command[
'frame']) =
1099 $this->
modifySAHSlaunch($this->default_command[
'link'], $this->default_command[
'frame']);
1101 if ($this->default_command[
'frame'] !=
'') {
1102 $this->tpl->setCurrentBlock(
'title_linked_frame');
1103 $this->tpl->setVariable(
'TARGET_TITLE_LINKED', $this->default_command[
'frame']);
1104 $this->tpl->parseCurrentBlock();
1111 $this->tpl->setCurrentBlock(
'item_title_linked');
1112 $this->tpl->setVariable(
'TXT_TITLE_LINKED', $this->
getTitle());
1113 $this->tpl->setVariable(
'HREF_TITLE_LINKED', $this->default_command[
'link']);
1116 if ($this->type ===
'file') {
1118 if ($preview->has()) {
1119 $this->tpl->setVariable(
'PREVIEW_GLYPH', $preview->getRenderedTriggerComponents());
1120 $this->tpl->parseCurrentBlock();
1124 $this->tpl->parseCurrentBlock();
1126 if ($this->bold_title ==
true) {
1127 $this->tpl->touchBlock(
'bold_title_start');
1128 $this->tpl->touchBlock(
'bold_title_end');
1134 switch ($this->context) {
1135 case self::CONTEXT_WORKSPACE_SHARING:
1147 $fields_shown =
false;
1148 foreach ($this->substitutions->getParsedSubstitutions($this->ref_id, $this->obj_id) as
$data) {
1149 if (
$data[
'bold']) {
1150 $data[
'name'] =
'<strong>' .
$data[
'name'] .
'</strong>';
1151 $data[
'value'] =
'<strong>' .
$data[
'value'] .
'</strong>';
1153 $this->tpl->touchBlock(
'std_prop');
1154 $this->tpl->setCurrentBlock(
'item_property');
1155 if (
$data[
'show_field']) {
1156 $this->tpl->setVariable(
'TXT_PROP',
$data[
'name']);
1158 $this->tpl->setVariable(
'VAL_PROP',
$data[
'value']);
1159 $this->tpl->parseCurrentBlock();
1161 if (
$data[
'newline']) {
1162 $this->tpl->touchBlock(
'newline_prop');
1164 $fields_shown =
false;
1172 if (!$this->substitutions->isDescriptionEnabled()) {
1177 $this->tpl->setCurrentBlock(
'item_description');
1179 $this->tpl->parseCurrentBlock();
1188 $this->tpl->setCurrentBlock(
'search_fragment');
1189 $this->tpl->setVariable(
'TXT_SEARCH_FRAGMENT', $this->
getSearchFragment() .
' ...');
1190 $this->tpl->parseCurrentBlock();
1201 $this->mode =
$mode;
1219 $this->condition_depth = $depth;
1239 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
1245 'property' => $this->
lng->txt(
'learning_progress'),
1254 if (!$this->
access->checkAccess(
'read',
'', $this->ref_id, $this->type, $this->obj_id)) {
1257 'value' => $this->
lng->txt(
'no_access_item_public'),
1267 if ($this->reference_ref_id) {
1271 $redraw_js =
'il.Object.redrawListItem(' . $note_ref_id .
');';
1277 isset(self::$cnt_notes[$note_obj_id][Note::PRIVATE]) &&
1278 self::$cnt_notes[$note_obj_id][Note::PRIVATE] > 0
1280 isset(self::$cnt_notes[$note_obj_id][Note::PUBLIC]) &&
1281 self::$cnt_notes[$note_obj_id][Note::PUBLIC] > 0
1283 isset(self::$cnt_tags[$note_obj_id]) && self::$cnt_tags[$note_obj_id] > 0
1285 isset(self::$tags[$note_obj_id]) && is_array(self::$tags[$note_obj_id])
1290 $cnt_comments = self::$cnt_notes[$note_obj_id][Note::PUBLIC] ?? 0;
1292 && $cnt_comments > 0) {
1295 'property' => $this->
lng->txt(
'notes_comments'),
1297 '<a href="#" onclick="return ' .
1299 self::$cnt_notes[$note_obj_id][Note::PUBLIC] .
'</a>',
1305 $cnt_notes = self::$cnt_notes[$note_obj_id][Note::PRIVATE] ?? 0;
1306 if ($this->notes_enabled && $cnt_notes > 0) {
1309 'property' => $this->
lng->txt(
'notes'),
1311 '<a href="#" onclick="return ' .
1313 self::$cnt_notes[$note_obj_id][Note::PRIVATE] .
'</a>',
1318 $cnt_tags = self::$cnt_tags[$note_obj_id] ?? 0;
1319 if ($this->tags_enabled && ($cnt_tags > 0 || isset(self::$tags[$note_obj_id]))) {
1321 if ($tags_set->get(
'enable')) {
1325 if (isset(self::$tags[$note_obj_id])) {
1327 foreach (self::$tags[$note_obj_id] as $tag => $is_tag_owner) {
1328 if ($is_tag_owner) {
1329 $tags_tmp[] =
'<a class="ilTag ilTagRelHigh" href="#" onclick="return ' .
1330 $tags_url .
'">' . $tag .
'</a>';
1332 $tags_tmp[] =
'<span class="ilTag ilTagRelMiddle">' . $tag .
'</span>';
1335 $tags_value = implode(
' ', $tags_tmp);
1340 $tags_value =
'<a href="#" onclick="return ' . $tags_url .
'">' .
1341 self::$cnt_tags[$note_obj_id] .
'</a>';
1342 $prop_text = $this->
lng->txt(
'tagging_tags');
1346 'property' => $prop_text,
1347 'value' => $tags_value,
1354 if (!isset($props)) {
1365 if (is_array($props) && count($props) > 0) {
1366 foreach ($props as $prop) {
1368 $this->tpl->touchBlock(
'separator_prop');
1371 if (isset($prop[
'alert']) && $prop[
'alert'] ==
true) {
1372 $this->tpl->touchBlock(
'alert_prop');
1374 $this->tpl->touchBlock(
'std_prop');
1377 if (isset($prop[
'newline']) && $prop[
'newline'] ==
true && $cnt > 1) {
1378 $this->tpl->touchBlock(
'newline_prop');
1383 isset($prop[
'property']) &&
1384 (($prop[
'propertyNameVisible'] ??
null) !==
false) &&
1385 $prop[
'property'] !=
'' 1388 $this->tpl->setCurrentBlock(
'prop_name');
1389 $this->tpl->setVariable(
'TXT_PROP', $prop[
'property']);
1390 $this->tpl->parseCurrentBlock();
1393 $this->tpl->setCurrentBlock(
'item_property');
1395 if (isset($prop[
'link']) && $prop[
'link']) {
1396 $this->tpl->setVariable(
'LINK_PROP', $prop[
'link']);
1397 $this->tpl->setVariable(
'LINK_VAL_PROP', $prop[
'value']);
1399 $this->tpl->setVariable(
'VAL_PROP', $prop[
'value']);
1402 $this->tpl->parseCurrentBlock();
1406 $this->tpl->setCurrentBlock(
'item_properties');
1407 $this->tpl->parseCurrentBlock();
1414 foreach ($this->notice_prop as $property) {
1415 $this->tpl->setCurrentBlock(
'notice_item');
1416 $this->tpl->setVariable(
'NOTICE_ITEM_VALUE', $property[
'value']);
1417 $this->tpl->parseCurrentBlock();
1419 $this->tpl->setCurrentBlock(
'notice_property');
1420 $this->tpl->parseCurrentBlock();
1423 protected function parseConditions(
int $toggle_id, array $conditions,
bool $obligatory =
true): bool
1426 $num_optional_required =
1428 count($conditions) +
1433 $visible_conditions = [];
1434 $passed_optional = 0;
1435 foreach ($conditions as $condition) {
1436 if ($obligatory && !$condition[
'obligatory']) {
1439 if (!$obligatory && $condition[
'obligatory']) {
1443 if ($this->tree->isDeleted($condition[
'trigger_ref_id'])) {
1450 $visible_conditions[] = $condition[
'id'];
1453 if (!$obligatory && $ok) {
1456 if ($passed_optional >= $num_optional_required) {
1462 $missing_cond_exist =
false;
1463 foreach ($conditions as $condition) {
1464 if (!in_array($condition[
'id'], $visible_conditions)) {
1469 $cond_txt = $operator .
' ' . $condition[
'value'];
1472 $class = $this->obj_definition->getClassName($condition[
'trigger_type']);
1473 $location = $this->obj_definition->getLocation($condition[
'trigger_type']);
1477 $missing_cond_exist =
true;
1479 $full_class =
'ilObj' . $class .
'ListGUI';
1480 $item_list_gui =
new $full_class($this->context);
1481 $item_list_gui->setMode(self::IL_LIST_AS_TRIGGER);
1482 $item_list_gui->enablePath(
false);
1483 $item_list_gui->enableIcon(
true);
1484 $item_list_gui->setConditionDepth($this->condition_depth + 1);
1485 $item_list_gui->setParentRefId($this->ref_id);
1486 $item_list_gui->addCustomProperty($this->
lng->txt(
'precondition_required_itemlist'), $cond_txt,
false,
true);
1487 $item_list_gui->enableCommands($this->commands_enabled, $this->std_cmd_only);
1488 $item_list_gui->enableProperties($this->properties_enabled);
1490 $trigger_html = $item_list_gui->getListItemHTML(
1491 $condition[
'trigger_ref_id'],
1492 $condition[
'trigger_obj_id'],
1496 $this->tpl->setCurrentBlock(
'precondition');
1497 if ($trigger_html ==
'') {
1498 $trigger_html = $this->
lng->txt(
'precondition_not_accessible');
1500 $this->tpl->setVariable(
'TXT_CONDITION', trim($cond_txt));
1501 $this->tpl->setVariable(
'TRIGGER_ITEM', $trigger_html);
1502 $this->tpl->parseCurrentBlock();
1505 if ($missing_cond_exist && $obligatory) {
1506 $this->tpl->setCurrentBlock(
'preconditions');
1507 $this->tpl->setVariable(
'CONDITION_TOGGLE_ID',
'_obl_' . $toggle_id);
1508 $this->tpl->setVariable(
'TXT_PRECONDITIONS', $this->
lng->txt(
'preconditions_obligatory_hint'));
1509 $this->tpl->parseCurrentBlock();
1510 } elseif ($missing_cond_exist && !$obligatory) {
1511 $this->tpl->setCurrentBlock(
'preconditions');
1512 $this->tpl->setVariable(
'CONDITION_TOGGLE_ID',
'_opt_' . $toggle_id);
1513 $this->tpl->setVariable(
1514 'TXT_PRECONDITIONS',
1516 $this->
lng->txt(
'preconditions_optional_hint'),
1517 $num_optional_required - $passed_optional
1520 $this->tpl->parseCurrentBlock();
1523 return !$missing_cond_exist;
1532 if ($this->condition_depth > 0) {
1536 if ($this->context == self::CONTEXT_WORKSPACE) {
1540 if (isset($this->condition_target) && is_array($this->condition_target)
1541 && count($this->condition_target) > 0) {
1542 $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget(
1543 (
int) $this->condition_target[
'ref_id'],
1544 (
int) $this->condition_target[
'obj_id'],
1545 $this->condition_target[
'target_type'] ??
'' 1548 $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget($this->ref_id, $this->obj_id);
1551 if (
sizeof($conditions)) {
1552 for ($i = 0; $i < count($conditions); $i++) {
1557 ++self::$js_unique_id;
1559 $all_done_obl = $this->
parseConditions(self::$js_unique_id, $conditions);
1560 $all_done_opt = $this->
parseConditions(self::$js_unique_id, $conditions,
false);
1562 if (!$all_done_obl || !$all_done_opt) {
1563 $this->tpl->setCurrentBlock(
'preconditions_toggle');
1564 $this->tpl->setVariable(
'PRECONDITION_TOGGLE_INTRO', $this->
lng->txt(
'precondition_toggle'));
1565 $this->tpl->setVariable(
'PRECONDITION_TOGGLE_TRIGGER', $this->
lng->txt(
'show'));
1566 $this->tpl->setVariable(
'PRECONDITION_TOGGLE_ID', self::$js_unique_id);
1567 $this->tpl->setVariable(
'TXT_PRECONDITION_SHOW', $this->
lng->txt(
'show'));
1568 $this->tpl->setVariable(
'TXT_PRECONDITION_HIDE', $this->
lng->txt(
'hide'));
1569 $this->tpl->parseCurrentBlock();
1583 string $onclick =
'' 1586 $checksum = md5($href . $text);
1587 if ($href !==
'#' && in_array($checksum, $this->prevent_duplicate_commands)) {
1591 if ($href !==
'#') {
1592 $this->prevent_duplicate_commands[] = $checksum;
1595 if ($cmd ===
'mount_webfolder') {
1596 $onclick =
"triggerWebDAVModal('$href')";
1601 $action = $this->
ui->factory()
1603 ->shy($text, $href);
1605 if ($frame !==
'') {
1606 $action = $this->
ui->factory()->link()->standard($text, $href)->withOpenInNewViewport(
true);
1609 if ($onclick !==
'') {
1610 $action = $action->withAdditionalOnLoadCode(
function (
$id) use ($onclick):
string {
1611 return "$('#$id').click(function(){" . $onclick .
';});';
1617 $this->current_actions[] = $action;
1622 if ($this->std_cmd_only) {
1632 $this->adm_commands_included =
true;
1638 $this->
ctrl->setParameter(
1639 $this->container_obj,
1641 $this->container_obj->getObject()->getRefId()
1643 $this->
ctrl->setParameter($this->container_obj,
'item_ref_id', $this->
getCommandId());
1644 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'delete');
1646 $this->adm_commands_included =
true;
1654 if ($this->std_cmd_only) {
1661 !$objDefinition->allowLink($this->type)
1671 $this->adm_commands_included =
true;
1678 $this->
ctrl->setParameter(
1679 $this->container_obj,
1681 $this->container_obj->getObject()->getRefId()
1683 $this->
ctrl->setParameter($this->container_obj,
'item_ref_id', $this->
getCommandId());
1684 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'link');
1686 $this->adm_commands_included =
true;
1691 if ($this->std_cmd_only) {
1702 $this->adm_commands_included =
true;
1710 if ($this->
checkCommandAccess(
'delete',
'', $this->ref_id, $this->type) && $this->container_obj->getObject()) {
1711 $this->
ctrl->setParameter(
1712 $this->container_obj,
1714 $this->container_obj->getObject()->getRefId()
1716 $this->
ctrl->setParameter($this->container_obj,
'item_ref_id', $this->
getCommandId());
1718 if (!$to_repository) {
1719 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'cut');
1722 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'cut_for_repository');
1723 $this->
insertCommand($cmd_link, $this->
lng->txt(
'wsp_move_to_repository'));
1726 $this->adm_commands_included =
true;
1732 if ($this->std_cmd_only) {
1737 $this->obj_definition->allowCopy($this->type)) {
1738 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
1739 $this->
ctrl->setParameterByClass(
'ilobjectcopygui',
'source_id', $this->
getCommandId());
1740 $cmd_copy = $this->
ctrl->getLinkTargetByClass([get_class($this->container_obj),
'ilobjectcopygui'],
'initTargetSelection');
1743 $this->
ctrl->setParameter(
1744 $this->container_obj,
1746 $this->container_obj->getObject()->getRefId()
1748 $this->
ctrl->setParameter($this->container_obj,
'item_ref_id', $this->
getCommandId());
1750 if (!$to_repository) {
1751 $cmd_copy = $this->
ctrl->getLinkTarget($this->container_obj,
'copy');
1754 $cmd_copy = $this->
ctrl->getLinkTarget($this->container_obj,
'copy_to_repository');
1755 $this->
insertCommand($cmd_copy, $this->
lng->txt(
'wsp_copy_to_repository'));
1759 $this->adm_commands_included =
true;
1765 if ($this->std_cmd_only) {
1775 $this->clipboard->hasEntries()
1780 $this->adm_commands_included =
true;
1786 if ($this->std_cmd_only
1789 || $this->
settings->get(
'rep_favourites',
'0') !==
'1') {
1797 is_object($this->container_obj) &&
1799 method_exists($this->container_obj,
'getObject') &&
1800 is_object($this->container_obj->getObject())
1802 $this->
ctrl->setParameter(
1803 $this->container_obj,
1805 $this->container_obj->getObject()->getRefId()
1809 $this->
ctrl->setParameter($this->container_obj,
'type', $type);
1810 $this->
ctrl->setParameter($this->container_obj,
'item_ref_id', $this->
getCommandId());
1812 if (!$this->fav_manager->ifIsFavourite($this->user->getId(), $this->
getCommandId())) {
1814 if ($this->
checkCommandAccess(
'read',
'', $this->ref_id, $this->type, $this->obj_id)) {
1815 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'addToDesk');
1819 $cmd_link = $this->
ctrl->getLinkTarget($this->container_obj,
'removeFromDesk');
1820 $this->
insertCommand($cmd_link, $this->
lng->txt(
'rep_remove_from_favourites'));
1823 $this->
ctrl->clearParameters($this->container_obj);
1829 if ($this->std_cmd_only) {
1834 $this->
lng->txt(
'info_short'),
1845 if ($this->std_cmd_only || $this->
user->isAnonymous()) {
1849 $this->
lng->loadLanguageModule(
'notes');
1850 $this->
lng->loadLanguageModule(
'tagging');
1855 if ($this->reference_ref_id) {
1859 $js_updater = $header_actions
1860 ?
'il.Object.redrawActionHeader();' 1861 :
'il.Object.redrawListItem(' . $note_ref_id .
')';
1863 $comments_enabled = $this->
isCommentsActivated($this->type, $this->ref_id, $this->obj_id, $header_actions);
1864 if ($comments_enabled) {
1867 $this->
lng->txt(
'notes_comments'),
1875 if ($this->notes_enabled) {
1878 $this->
lng->txt(
'notes'),
1886 if ($this->tags_enabled) {
1889 $this->
lng->txt(
'tagging_set_tag'),
1907 $this->std_cmd_only || is_null($this->container_obj) ||
1908 !method_exists($this->container_obj,
'getObject') ||
1909 !is_object($this->container_obj->getObject())
1914 $parent_ref_id = $this->container_obj->getObject()->getRefId();
1915 $parent_type = $this->container_obj->getObject()->getType();
1918 if ($this->reference_ref_id) {
1919 $this->
ctrl->setParameterByClass(
'ilconditionhandlergui',
'ref_id', $this->reference_ref_id);
1926 $this->
ctrl->setParameterByClass(
1927 get_class($this->container_obj),
1931 $time_limit_link = $this->
ctrl->getLinkTargetByClass(
1932 get_class($this->container_obj),
1933 'editAvailabilityPeriod' 1935 $this->
insertCommand($time_limit_link, $this->
lng->txt(
'edit_availability_period'));
1936 $this->
ctrl->clearParameterByClass(
1937 get_class($this->container_obj),
1941 $this->
ctrl->setParameterByClass(
1942 'ilconditionhandlergui',
1946 $this->
ctrl->setParameterByClass(
1947 'ilconditionhandlergui',
1952 $availbility_link = $this->
ctrl->getLinkTargetByClass(
1953 [$this->gui_class_name,
'ilcommonactiondispatchergui',
'ilobjectactivationgui',
'ilconditionhandlergui'],
1960 if ($this->reference_ref_id) {
1961 $this->
ctrl->setParameterByClass(
'ilconditionhandlergui',
'ref_id', $this->ref_id);
1973 foreach ($commands as $command) {
1974 if ($command[
'default'] ===
true) {
1975 $this->default_command = $command[
'granted'] ===
true ? $this->
createDefaultCommand($command) : [];
1982 $this->
ctrl->setParameterByClass($this->gui_class_name,
'ref_id', $this->ref_id);
1984 $this->current_actions = [];
1985 $this->default_command = [];
1986 $this->prevent_duplicate_commands = [];
1989 $valid_header_commands = [
'mount_webfolder'];
1991 foreach ($commands as $command) {
1992 if ($for_header && !in_array($command[
'cmd'], $valid_header_commands)
1993 || $command[
'granted'] ===
false) {
1997 if ($command[
'default'] !==
true) {
1998 if (!$this->std_cmd_only) {
2003 $cmd_link = $command[
'link'];
2004 $txt = ($command[
'lang_var'] ==
'')
2006 : $this->
lng->txt($command[
'lang_var']);
2021 if (is_array($this->cust_commands)) {
2022 foreach ($this->cust_commands as $command) {
2023 if ($command instanceof
Button) {
2024 $this->current_actions[] = $command;
2030 $this->
lng->txt($command[
'lang_var']),
2033 $command[
'cmd'] ??
'',
2047 if (!$this->
isMode(self::IL_LIST_AS_TRIGGER)) {
2049 if ($this->timings_enabled) {
2054 if ($this->delete_enabled) {
2059 if ($this->link_enabled) {
2064 if ($this->cut_enabled) {
2069 if ($this->copy_enabled) {
2074 if ($this->repository_transfer_enabled) {
2080 if ($this->subscribe_enabled) {
2085 if ($this->multi_download_enabled && $for_header) {
2090 if ($this->cut_enabled or $this->link_enabled) {
2097 if (!$this->
isMode(self::IL_LIST_AS_TRIGGER)) {
2113 && $this->object_properties->getPropertyInfoTabVisibility()) {
2119 public function enableComments(
bool $value,
bool $enable_comments_settings =
true): void
2121 if ($this->
settings->get(
'disable_comments')) {
2125 $this->comments_enabled = $value;
2126 $this->comments_settings_enabled = $enable_comments_settings;
2131 if ($this->
settings->get(
'disable_notes')) {
2135 $this->notes_enabled = $value;
2141 if (!$tags_set->get(
'enable')) {
2144 $this->tags_enabled = $value;
2149 ?
string $text =
null,
2150 bool $categories =
false,
2151 ?array $ctrl_path =
null,
2152 bool $force_rate_parent =
false 2154 $this->rating_enabled = $value;
2156 if ($this->rating_enabled) {
2157 $this->rating_categories_enabled = $categories;
2158 $this->rating_text = $text;
2159 $this->rating_ctrl_path = $ctrl_path;
2172 if (!$folder_set->get(
'enable_multi_download')) {
2175 $this->multi_download_enabled = $value;
2180 if ($this->std_cmd_only) {
2201 if ($hasAdminAccess) {
2202 $cmd = ($this->requested_cmd ==
'enableAdministrationPanel')
2204 :
'enableAdministrationPanel';
2206 $cmd = ($this->requested_cmd ==
'enableMultiDownload')
2208 :
'enableMultiDownload';
2211 $this->
insertCommand($cmd_link, $this->
lng->txt(
'download_multiple_objects'));
2218 if (!$this->
getContainerObject()->isActiveAdministrationPanel() || $this->clipboard->hasEntries()) {
2220 in_array($this->type, [
'file',
'fold']) &&
2221 $this->
access->checkAccess(
'read',
'', $ref_id, $this->type)
2223 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_ENABLED;
2225 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_DISABLED;
2228 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
2248 if (is_null($tpl)) {
2253 $DIC->notes()->gui()->initJavascript($notes_url);
2261 $tpl->addOnLoadCode(
'il.Object.setRedrawAHUrl("' . $redraw_url .
'");');
2267 $this->sub_obj_type =
$type;
2268 $this->sub_obj_id = (
int) $id;
2274 ?
string $tooltip =
null,
2275 ?
string $onclick =
null,
2276 ?
string $status_text =
null,
2277 ?
string $href =
null 2279 $this->header_icons[
$id] = [
2281 'tooltip' => $tooltip,
2282 'onclick' => $onclick,
2283 'status_text' => $status_text,
2290 $this->header_icons[
$id] = $html;
2295 $this->header_icons[
$id] = [
'glyph' => $glyph,
'onclick' => $onclick];
2300 $this->ajax_hash = $hash;
2305 if ($main_tpl ==
null) {
2309 $htpl =
new ilTemplate(
'tpl.header_action.html',
true,
true,
'components/ILIAS/ILIASObject');
2311 $redraw_js =
'il.Object.redrawActionHeader();';
2314 if ($this->tags_enabled) {
2320 $this->
user->getId()
2322 if (count($tags) > 0) {
2323 $this->
lng->loadLanguageModule(
'tagging');
2325 $f = $this->
ui->factory();
2328 $f->symbol()->glyph()->tag(
'#')
2329 ->withCounter(
$f->counter()->status(count($tags))),
2336 $comments_enabled = $this->
isCommentsActivated($this->type, $this->ref_id, $this->obj_id,
true,
false);
2337 if ($this->notes_enabled || $comments_enabled) {
2338 $type = ($this->sub_obj_type ==
'') ? $this->type : $this->sub_obj_type;
2339 $context = $this->notes_service->data()->context($this->obj_id, $this->sub_obj_id, $type);
2340 $cnt[
$this->obj_id][Note::PUBLIC] = $this->notes_service->domain()->getNrOfCommentsForContext($context);
2341 $cnt[
$this->obj_id][Note::PRIVATE] = $this->notes_service->domain()->getNrOfNotesForContext($context);
2343 $this->notes_enabled &&
2344 isset($cnt[$this->obj_id][Note::PRIVATE]) &&
2345 $cnt[$this->obj_id][Note::PRIVATE] > 0
2347 $f = $this->
ui->factory();
2350 $f->symbol()->glyph()->note(
'#')
2351 ->withCounter(
$f->counter()->status((
int) $cnt[$this->obj_id][Note::PRIVATE])),
2357 $comments_enabled &&
2358 isset($cnt[$this->obj_id][Note::PUBLIC]) &&
2361 $this->
lng->loadLanguageModule(
'notes');
2362 $f = $this->
ui->factory();
2365 $f->symbol()->glyph()->comment(
'#')
2366 ->withCounter(
$f->counter()->status((
int) $cnt[$this->obj_id][Note::PUBLIC])),
2373 if ($this->rating_enabled) {
2375 $rating_gui->enableCategories($this->rating_categories_enabled);
2377 $rating_gui->setObject($this->obj_id, $this->type);
2378 if ($this->rating_text) {
2379 $rating_gui->setYourRatingText($this->rating_text);
2382 $ajax_hash = $this->force_rate_parent
2385 $this->
ctrl->setParameterByClass(
'ilRatingGUI',
'cadh', $ajax_hash);
2386 $this->
ctrl->setParameterByClass(
'ilRatingGUI',
'rnsb',
true);
2387 if ($this->rating_ctrl_path) {
2388 $rating_gui->setCtrlPath($this->rating_ctrl_path);
2389 $ajax_url = $this->
ctrl->getLinkTargetByClass($this->rating_ctrl_path,
'saveRating',
'',
true);
2391 $ajax_url = $this->
ctrl->getLinkTargetByClass(
'ilRatingGUI',
'saveRating',
'',
true);
2393 $main_tpl->
addOnLoadCode(
'il.Object.setRatingUrl("' . $ajax_url .
'");');
2396 $rating_gui->getHTML(
2398 $this->checkCommandAccess(
'read',
'', $this->ref_id, $this->type),
2399 'il.Object.saveRating(%rating%);' 2404 if ($this->header_icons) {
2406 foreach ($this->header_icons as
$id => $attr) {
2409 if (is_array($attr)) {
2410 if (isset($attr[
'glyph']) && $attr[
'glyph']) {
2411 if ($attr[
'onclick']) {
2412 $htpl->setCurrentBlock(
'prop_glyph_oc');
2413 $htpl->setVariable(
'GLYPH_ONCLICK', $attr[
'onclick']);
2414 $htpl->parseCurrentBlock();
2417 $html =
$renderer->render($attr[
'glyph']);
2418 $htpl->setCurrentBlock(
'prop_glyph');
2419 $htpl->setVariable(
'GLYPH', $html);
2420 $htpl->parseCurrentBlock();
2422 if ($attr[
'onclick']) {
2423 $htpl->setCurrentBlock(
'onclick');
2424 $htpl->setVariable(
'PROP_ONCLICK', $attr[
'onclick']);
2425 $htpl->parseCurrentBlock();
2428 if ($attr[
'status_text']) {
2429 $htpl->setCurrentBlock(
'status');
2430 $htpl->setVariable(
'PROP_TXT', $attr[
'status_text']);
2431 $htpl->parseCurrentBlock();
2435 $htpl->setCurrentBlock(
'prop');
2436 if ($attr[
'href'] || $attr[
'onclick']) {
2437 $htpl->setVariable(
'TAG',
'a');
2439 $htpl->setVariable(
'TAG',
'span');
2441 $htpl->setVariable(
'PROP_ID',
$id);
2442 $htpl->setVariable(
'IMG_SRC', $attr[
'img']);
2443 if ($attr[
'href'] !=
'') {
2444 $htpl->setVariable(
'PROP_HREF',
' href="' . $attr[
'href'] .
'" ');
2447 if ($attr[
'tooltip']) {
2448 $htpl->setVariable(
'IMG_ADDITIONAL',
"alt=\"{$attr['tooltip']}\" title=\"{$attr['tooltip']}\"");
2450 $htpl->parseCurrentBlock();
2457 if (
sizeof($chunks)) {
2460 implode(
' ', $chunks) .
' ' 2466 $dropdown_label =
'<span class="hidden-xs">' .
2467 $this->
lng->txt(
'actions') .
2472 $this->
ui->renderer()->render($dropdown)
2475 if ($this->cust_modals !== []) {
2476 $htpl->setVariable(
'TRIGGERED_MODALS', $this->
ui->renderer()->render($this->cust_modals));
2479 return $htpl->get();
2490 $base_class = $this->request_wrapper->retrieve(
'baseClass', $this->
refinery->kindlyTo()->string());
2492 (strtolower($base_class) !=
'ilrepositorygui') &&
2493 is_int(strpos($link,
'baseClass=ilRepositoryGUI'))
2495 if ($this->type !=
'frm') {
2505 if ($this->default_command_params) {
2507 foreach ($this->default_command_params as $name => $value) {
2508 $params[] = $name .
'=' . $value;
2514 if (!stristr($default_link,
'?')) {
2515 $default_link = ($default_link .
'?' .
$params);
2517 $default_link = ($default_link .
'&' .
$params);
2520 return $default_link;
2528 if (strstr($link, ilSAHSPresentationGUI::class) ===
false) {
2529 return [$link, $target];
2533 $om = $sahs_obj->getOpenMode();
2534 $width = $sahs_obj->getWidth();
2535 $height = $sahs_obj->getHeight();
2536 if (($om == 5 || $om == 1) && $width > 0 && $height > 0) {
2539 if ($om !== 0 && !$this->
http->agent()->isMobile()) {
2540 $this->default_command[
'frame'] =
'';
2542 'javascript:void(0); onclick=startSAHS(\'' .
2555 $target = "ilContObj" . $this->ref_id; 2557 return [$link, $target]; 2560 public function insertPath(): void 2562 if ($this->getPathStatus() != false) { 2563 if (!$this->path_gui instanceof \ilPathGUI) { 2564 $path_gui = new \ilPathGUI(); 2566 $path_gui = $this->path_gui; 2569 $path_gui->enableTextOnly(!$this->path_linked); 2570 $path_gui->setUseImages(false); 2572 $start_node = ROOT_FOLDER_ID; 2573 if ($this->path_start_node) { 2574 $start_node = $this->path_start_node; 2577 $this->tpl->setCurrentBlock('path_item
'); 2578 $this->tpl->setVariable('PATH_ITEM
', $path_gui->getPath($start_node, $this->ref_id)); 2579 $this->tpl->parseCurrentBlock(); 2581 $this->tpl->setCurrentBlock('path
'); 2582 $this->tpl->setVariable('TXT_LOCATION
', $this->lng->txt('locator')); 2583 $this->tpl->parseCurrentBlock(); 2587 public function insertProgressInfo(): void 2591 public function insertIconsAndCheckboxes(): void 2594 if ($this->getCheckboxStatus()) { 2595 $this->tpl->setCurrentBlock('check'); 2596 $this->tpl->setVariable('VAL_ID
', $this->getCommandId()); 2597 $this->tpl->setVariable('CHECK_TITLE
', $this->lng->txt('select
') . ' ' . $this->getTitle()); 2598 $this->tpl->parseCurrentBlock(); 2600 } elseif ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE) { 2601 $this->tpl->setCurrentBlock('check_download
'); 2602 $this->tpl->setVariable('CHECK_DOWNLOAD_TITLE
', $this->lng->txt('download
') . ' ' . $this->getTitle()); 2603 if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED) { 2604 $this->tpl->setVariable('VAL_ID
', $this->getCommandId()); 2606 $this->tpl->setVariable('VAL_VISIBILITY
', 'visibility: hidden;
" disabled="disabled'); 2608 $this->tpl->parseCurrentBlock(); 2610 } elseif ($this->getExpandStatus()) { 2611 $this->tpl->setCurrentBlock('expand'); 2613 if ($this->isExpanded()) { 2614 $this->ctrl->setParameter($this->container_obj, 'expand', -1 * $this->obj_id); 2615 // 'view
' added, see #19922 2616 $this->tpl->setVariable('EXP_HREF
', $this->ctrl->getLinkTarget($this->container_obj, 'view
', $this->getUniqueItemId(true))); 2617 $this->ctrl->clearParameters($this->container_obj); 2618 $this->tpl->setVariable('EXP_IMG
', ilUtil::getImagePath('nav/tree_exp.svg
')); 2619 $this->tpl->setVariable('EXP_ALT
', $this->lng->txt('collapse')); 2621 $this->ctrl->setParameter($this->container_obj, 'expand', $this->obj_id); 2622 // 'view
' added, see #19922 2623 $this->tpl->setVariable('EXP_HREF
', $this->ctrl->getLinkTarget($this->container_obj, 'view
', $this->getUniqueItemId(true))); 2624 $this->ctrl->clearParameters($this->container_obj); 2625 $this->tpl->setVariable('EXP_IMG
', ilUtil::getImagePath('nav/tree_col.svg
')); 2626 $this->tpl->setVariable('EXP_ALT
', $this->lng->txt('expand')); 2629 $this->tpl->parseCurrentBlock(); 2633 if ($this->getIconStatus()) { 2635 $this->tpl->touchBlock('i_1
'); 2638 $this->tpl->setCurrentBlock('icon
'); 2639 $this->tpl->setVariable('ALT_ICON
', $this->buildTranslatedType()); 2641 $this->tpl->setVariable( 2643 $this->getTypeIcon() 2645 $this->tpl->parseCurrentBlock(); 2649 $this->tpl->touchBlock('d_
' . $cnt); 2655 public function getTypeIcon(): string 2657 return ilObject::getIconForReference( 2661 $this->getIconImageType() 2665 public function insertSubItems(): void 2667 foreach ($this->sub_item_html as $sub_html) { 2668 $this->tpl->setCurrentBlock('subitem
'); 2669 $this->tpl->setVariable('SUBITEM
', $sub_html); 2670 $this->tpl->parseCurrentBlock(); 2674 public function insertPositionField(): void 2676 if ($this->position_enabled) { 2677 $this->tpl->setCurrentBlock('position
'); 2678 $this->tpl->setVariable('POS_ID
', $this->position_field_index); 2679 $this->tpl->setVariable('POS_VAL
', $this->position_value); 2680 $this->tpl->parseCurrentBlock(); 2688 public function adminCommandsIncluded(): bool 2690 return $this->adm_commands_included; 2696 public function getListItemHTML( 2702 // this variable stores whether any admin commands 2703 // are included in the output 2704 $this->adm_commands_included = false; 2706 // only for performance exploration 2707 $type = ilObject::_lookupType($obj_id); 2709 $this->initItem($ref_id, $obj_id, $type, $title, $description); 2711 if ($this->rating_enabled) { 2712 if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) { 2713 $may_rate = $this->checkCommandAccess('read
', '', $this->ref_id, $this->type); 2714 $rating = new ilRatingGUI(); 2715 $rating->setObject($this->obj_id, $this->type); 2716 $this->addCustomProperty( 2718 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), 2726 if (!$this->checkCommandAccess('visible
', '', $ref_id, '', $obj_id)) { 2727 $this->resetCustomData(); 2732 if ($type == 'file
' and ilObjFileAccess::_isFileHidden($title)) { 2733 $this->resetCustomData(); 2738 $this->tpl = new ilTemplate( 2739 static::$tpl_file_name, 2742 static::$tpl_component, 2748 if ($this->getCommandsStatus()) { 2749 if (!$this->getSeparateCommands()) { 2750 $dropdown = $this->getCommandsDropdown($title); 2751 $this->tpl->setVariable( 2752 'COMMAND_SELECTION_LIST
', 2753 $this->ui->renderer()->render($dropdown) 2758 if ($this->getProgressInfoStatus()) { 2759 $this->insertProgressInfo(); 2762 // insert title and describtion 2763 $this->insertTitle(); 2764 if (!$this->isMode(self::IL_LIST_AS_TRIGGER)) { 2765 if ($this->getDescriptionStatus()) { 2766 $this->insertDescription(); 2770 if ($this->getSearchFragmentStatus()) { 2771 $this->insertSearchFragment(); 2775 if ($this->getPropertiesStatus()) { 2776 $this->insertProperties(); 2779 // notice properties 2780 if ($this->getNoticePropertiesStatus()) { 2781 $this->insertNoticeProperties(); 2785 if ($this->getPreconditionsStatus()) { 2786 $this->insertPreconditions(); 2790 $this->insertPath(); 2792 if ($this->getItemDetailLinkStatus()) { 2793 $this->insertItemDetailLinks(); 2796 // icons and checkboxes 2797 $this->insertIconsAndCheckboxes(); 2799 // input field for position 2800 $this->insertPositionField(); 2803 $this->insertSubItems(); 2805 $this->resetCustomData(); 2807 $this->tpl->setVariable('DIV_CLASS
', 'ilContainerListItemOuter
'); 2808 $this->tpl->setVariable( 2810 'data-list-item-
id=
"' . $this->getUniqueItemId(true) . '" id =
"' . $this->getUniqueItemId(true) . '"' 2812 $this->tpl->setVariable('ADDITIONAL
', $this->getAdditionalInformation()); 2814 if (is_object($this->getContainerObject())) { 2815 // #11554 - make sure that internal ids are reset 2816 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id
', ''); 2819 // if file upload is enabled the content is wrapped by a UI dropzone. 2820 $content = $this->tpl->get(); 2821 $file_upload_dropzone = new ilObjFileUploadDropzone($this->ref_id, $content); 2822 if ($this->context === self::CONTEXT_REPOSITORY 2823 && ($this->requested_cmd === "view" || $this->requested_cmd === "" || $this->requested_cmd === "render") 2824 && $file_upload_dropzone->isUploadAllowed($this->type) 2825 && !(new ModeSessionRepository())->isAdminMode() 2827 return $file_upload_dropzone->getDropzoneHtml(); 2836 protected function resetCustomData(): void 2839 $this->cust_prop = []; 2840 $this->cust_commands = []; 2841 $this->cust_modals = []; 2842 $this->sub_item_html = []; 2843 $this->position_enabled = false; 2849 public function setParentRefId(int $ref_id): void 2851 $this->parent_ref_id = $ref_id; 2860 public function getUniqueItemId(bool $as_div = false): string 2862 // use correct id for references 2863 $id_ref = $this->ref_id; 2864 if ($this->reference_ref_id > 0) { 2865 $id_ref = $this->reference_ref_id; 2868 // add unique identifier for preconditions (objects can appear twice in same container) 2869 if ($this->condition_depth) { 2870 $id_ref .= '_pc
' . $this->condition_depth; 2874 $id_ref .= '_pref_
' . $this->parent_ref_id; 2879 // action menu [yellow] toggle 2880 return 'lg_div_
' . $id_ref; 2887 public function getCommandsHTML(string $title = ''): string 2889 return $this->ui->renderer()->render($this->getCommandsDropdown($title, false)); 2892 private function getCommandsDropdown(string $title, bool $for_header = false): StandardDropdown 2894 $this->populateCommands($for_header); 2895 return $this->ui->factory() 2897 ->standard($this->current_actions) 2898 ->withAriaLabel(sprintf( 2899 $this->lng->txt('actions_for
'), 2900 htmlspecialchars(addslashes($title)) 2907 public function isSideBlock(): bool 2912 public function setBoldTitle(bool $bold_title): void 2914 $this->bold_title = $bold_title; 2917 public function isTitleBold(): bool 2919 return $this->bold_title; 2922 public static function preloadCommonProperties(array $obj_ids, int $context): void 2925 $lng = $DIC->language(); 2926 $ilSetting = $DIC->settings(); 2927 $ilUser = $DIC->user(); 2928 $notes_manager = $DIC->notes()->internal()->domain()->notes(); 2930 if ($context == self::CONTEXT_REPOSITORY) { 2931 $active_notes = !$ilSetting->get('disable_notes
'); 2932 $active_comments = !$ilSetting->get('disable_comments
'); 2934 if ($active_comments) { 2935 // needed for action 2936 self::$comments_activation = $DIC->notes() 2939 ->notes()->commentsActiveMultiple($obj_ids); 2942 // properties are optional 2943 if ($ilSetting->get('comments_tagging_in_lists
')) { 2944 if ($active_notes || $active_comments) { 2945 // @todo: should be refactored, see comment in notes db repo 2946 self::$cnt_notes = $notes_manager->countNotesAndCommentsMultipleObjects( 2951 $lng->loadLanguageModule('notes
'); 2954 $tags_set = new ilSetting('tags
'); 2955 if ($tags_set->get('enable
')) { 2956 $all_users = (bool) $tags_set->get('enable_all_users
'); 2958 if (!$ilSetting->get('comments_tagging_in_lists_tags
')) { 2959 self::$cnt_tags = ilTagging::_countTags($obj_ids, $all_users); 2961 $tag_user_id = null; 2963 $tag_user_id = $ilUser->getId(); 2965 self::$tags = ilTagging::_getListTagsForObjects($obj_ids, $tag_user_id); 2968 $lng->loadLanguageModule('tagging
'); 2972 $lng->loadLanguageModule('rating
'); 2975 self::$preload_done = true; 2981 protected function isCommentsActivated( 2985 bool $header_actions, 2986 bool $check_write_access = true 2988 if ($this->comments_enabled) { 2989 if (!$this->comments_settings_enabled) { 2992 if ($check_write_access && $this->checkCommandAccess('write
', '', $ref_id, $type)) { 2995 // fallback to single object check if no preloaded data 2996 // only the repository does preloadCommonProperties() yet 2997 if (!$header_actions && self::$preload_done) { 2998 if (isset(self::$comments_activation[$obj_id]) && 2999 self::$comments_activation[$obj_id]) { 3002 } elseif ($this->notes_service->domain()->commentsActive($obj_id)) { 3012 public function enableTimings(bool $status): void 3014 $this->timings_enabled = $status; 3020 public function getAsListItem( 3029 // even b tag produced bugs, see #32304 3030 $description = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform( 3042 $this->enableCommands(true); 3045 $this->populateCommands(false); 3047 $dropdown = $this->getCommandsDropdown($title); 3048 $def_command = $this->getDefaultCommand(); 3050 if ($def_command['link'] ?? false) { 3051 list($def_command['link'], $def_command['frame
']) = 3052 $this->modifySAHSlaunch($def_command['link'], $def_command['frame
']); 3053 $new_viewport = !in_array($def_command['frame
'], ['', '_top
', '_self
', '_parent
'], true); 3054 $link = $this->ui->factory() 3056 ->standard($this->getTitle(), $def_command['link']) 3057 ->withOpenInNewViewport($new_viewport); 3058 $list_item = $ui->factory()->item()->standard($link); 3060 $list_item = $ui->factory()->item()->standard($this->getTitle()); 3063 if ($description != '') { 3064 $list_item = $list_item->withDescription($description); 3066 $list_item = $list_item->withActions($dropdown)->withLeadIcon( 3067 $this->ui->factory()->symbol()->icon()->custom( 3068 $this->getTypeIcon(), 3069 $this->buildTranslatedType(), 3076 $this->enableComments(true); 3077 $this->enableNotes(true); 3078 $this->enableTags(true); 3079 $this->enableRating(true); 3081 foreach ($this->determineProperties() as $p) { 3082 //if ($p['property'] !== $this->lng->txt('learning_progress
')) { 3083 $l[(string) $p['property']] = (string) $p['value
']; 3086 if (count($l) > 0) { 3087 $list_item = $list_item->withProperties($l); 3096 public function getAsCard( 3102 ): ?RepositoryObject { 3105 $title = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($title); 3106 // even b tag produced bugs, see #32304 3107 $description = $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform( 3119 $user = $this->user; 3120 $access = $this->access; 3122 $this->enableCommands(true); 3125 if ($description !== '') { 3126 $sections[] = $ui->factory()->legacy()->content('<div
class=
"il-multi-line-cap-3">
' . $description . '</div>
'); 3129 $this->populateCommands(false); 3131 $def_command = $this->getDefaultCommand(); 3133 $dropdown = $this->getCommandsDropdown($title); 3135 // workaround for #26205 3136 // we should get rid of _top links completely and gifure our how 3137 // to manage scorm links better 3138 $def_cmd_frame = ($def_command['frame
'] ?? ''); 3139 if ($def_cmd_frame === '_top
') { 3140 $def_cmd_frame = ''; 3142 $def_cmd_link = ($def_command['link'] ?? ''); 3144 // workaround for scorm 3145 list($modified_link, $def_cmd_frame) = 3146 $this->modifySAHSlaunch($def_cmd_link, $def_cmd_frame); 3148 $image = $this->getTileImage(); 3150 if ($def_cmd_link != '') { // #24256 3151 if ($def_cmd_frame !== '' && ($modified_link === $def_cmd_link)) { 3152 $signal = (new SignalGenerator())->create(); 3153 $this->main_tpl->addOnLoadCode( 3154 "$(document).on('{$signal->getId()}
', function(event, signalData) {" 3155 . ' window.open(
"' . str_replace( 3159 ) . '",
"' . $def_cmd_frame . '");
' 3163 $image = $image->withAction($signal); 3166 $ui->factory()->button()->shy($title, '')->appendOnClick($signal); 3167 $title = $ui->renderer()->render($button); 3169 $image = $image->withAction($modified_link); 3173 if ($type == 'sess
') { 3175 $title = ':
' . $title; 3177 $app_info = ilSessionAppointment::_lookupAppointment($obj_id); 3178 $title = ilSessionAppointment::_appointmentToString( 3181 (bool) $app_info['fullday
'] 3185 $icon = $this->ui->factory()->symbol()->icon()->custom( 3186 $this->getTypeIcon(), 3187 $this->buildTranslatedType(), 3191 // card title action 3192 $card_title_action = ''; 3193 if ($def_cmd_link != '' && ($def_cmd_frame == '' || $modified_link != $def_cmd_link)) { // #24256 3194 $card_title_action = $modified_link; 3195 } elseif ($def_cmd_link == '' && 3196 $this->getInfoScreenStatus() && 3197 $access->checkAccessOfUser( 3203 $card_title_action = ilLink::_getLink($ref_id); 3204 if ($image->getAction() == '') { 3205 $image = $image->withAction($card_title_action); 3209 $card = $ui->factory()->card()->repositoryObject( 3210 $title . '<span data-list-item-
id=
"' . $this->getUniqueItemId(true) . '"></span>
', 3218 if ($card_title_action != '') { 3219 $card = $card->withTitleAction($card_title_action); 3223 foreach ($this->determineProperties() as $p) { 3224 if (isset($p['alert
']) && $p['alert
'] == true 3225 && isset($p['property']) && $p['property'] !== $this->lng->txt('learning_progress
')) { 3226 $l[(string) $p['property']] = (string) $p['value
']; 3229 if (count($l) > 0) { 3230 $prop_list = $ui->factory()->listing()->descriptive($l); 3231 $sections[] = $prop_list; 3233 if (count($sections) > 0) { 3234 $card = $card->withSections($sections); 3237 $lp = ilLPStatus::getListGUIStatus($obj_id, false); 3238 if (is_array($lp) && array_key_exists('status
', $lp)) { 3239 $percentage = (int) ilLPStatus::_lookupPercentage($obj_id, $this->user->getId()); 3240 if ($lp['status
'] == ilLPStatus::LP_STATUS_COMPLETED_NUM) { 3244 $card = $card->withProgress( 3248 ->mini(100, $percentage) 3255 public function checkInfoPageOnAsynchronousRendering(): bool 3260 private function getTileImage(): Image 3262 return $this->object_properties->getPropertyTileImage() 3263 ->getTileImage()->getImage($this->ui->factory()->image()); 3269 public function insertLPCommand(): void 3271 if ($this->std_cmd_only || !$this->lp_cmd_enabled) { 3274 $relevant = ilLPStatus::hasListGUIStatus($this->obj_id); 3276 $cmd_link = $this->getCommandLink('learningProgress
'); 3277 $this->insertCommand( 3279 $this->lng->txt('learning_progress
') 3287 private function insertLPSettingsCommand(): void 3289 if (!$this->lp_settings_cmd_enabled 3290 || !ilObjUserTracking::_enabledLearningProgress() 3291 || ilObjectLP::getTypeClass($this->type) === '' 3292 || ! $this->checkCommandAccess('edit_learning_progress
', '', $this->ref_id, $this->type) 3298 $this->ctrl->setParameterByClass(ilLearningProgressGUI::class, 'ref_id
', $this->ref_id); 3299 switch ($this->type) { 3301 switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) { 3303 $scorm_class = ilObjSCORM2004LearningModuleGUI::class; 3306 $scorm_class = ilObjSCORMLearningModuleGUI::class; 3313 $cmd_link = $this->ctrl->getLinkTargetByClass([ 3314 ilSAHSEditGUI::class, 3316 ilLearningProgressGUI::class, 3317 ilLPListOfSettingsGUI::class 3322 $cmd_link = $this->ctrl->getLinkTargetByClass([ 3323 ilLMEditorGUI::class, 3324 ilObjLearningModuleGUI::class, 3325 ilLearningProgressGUI::class, 3326 ilLPListOfSettingsGUI::class 3331 $cmd_link = $this->ctrl->getLinkTargetByClass([ 3332 ilObjLearningSequenceGUI::class, 3333 ilLearningProgressGUI::class, 3334 ilLPListOfSettingsGUI::class 3347 $gui_class = 'ilObj
' . $this->obj_definition->getClassName($this->type) . 'GUI
'; 3348 $cmd_link = $this->ctrl->getLinkTargetByClass([ 3349 ilRepositoryGUI::class, 3351 ilLearningProgressGUI::class, 3352 ilLPListOfSettingsGUI::class 3364 $this->ctrl->setParameterByClass('ilrepositorygui
', 'ref_id
', $this->requested_ref_id); 3365 if ($cmd_link !== '') { 3366 $this->insertCommand( 3368 $this->lng->txt('listaction_learning_progress_settings
') 3373 private function buildTranslatedType(): string 3375 if ($this->obj_definition->isPlugin($this->getIconImageType())) { 3376 return ilObjectPlugin::lookupTxtById($this->getIconImageType(), 'obj_
' . $this->getIconImageType()); 3379 return $this->lng->txt('obj_
' . $this->getIconImageType()); getCommands()
get all current commands for a specific ref id (in the permission context of the current user) ...
This describes commonalities between the different modals.
static removeSubObjFromAjaxHash(string $hash)
const CONTEXT_WORKSPACE_SHARING
setHeaderSubObject(?string $type, ?int $id)
parseConditions(int $toggle_id, array $conditions, bool $obligatory=true)
insertSearchFragment()
Insert highlighted search fragment.
setConditionTarget(int $ref_id, int $obj_id, string $target_type)
getDescription()
getDescription overwritten in class.ilObjLinkResourceList.php
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static string $tpl_component
insertMultiDownloadCommand()
ilListItemAccessCache $acache
modifySAHSlaunch(string $link, string $target)
workaround: SAHS in new javavasript-created window or iframe
bool $multi_download_enabled
static maybeRenderWebDAVModalInGlobalTpl()
string $requested_base_class
setParentRefId(int $ref_id)
Set current parent ref id to enable unique js-ids (sessions, etc.)
setMode(string $mode)
set output mode
enableCommands(bool $status, bool $std_only=false)
setAdditionalInformation(?string $val)
setContainerObject(object $container_obj)
bool $notice_properties_enabled
setSearchFragment(string $text)
initItem(int $ref_id, int $obj_id, string $type, string $title='', string $description='')
initialize new item (is called by getItemHTML())
bool $static_link_enabled
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
const DOWNLOAD_CHECKBOX_NONE
insertPreconditions()
insert all missing preconditions
Interface Observer Contains several chained tasks and infos about them.
setDescription(string $description)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static translateOperator(int $a_obj_id, string $a_operator, string $value='')
checkCommandAccess(string $permission, string $cmd, int $ref_id, string $type, ?int $obj_id=null)
getCommandFrame(string $cmd)
Get command target frame.
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
appendRepositoryFrameParameter(string $link)
workaround: all links into the repository (from outside) must tell repository to set up the frameset ...
bool $search_fragment_enabled
getAdditionalInformation()
enableExpand(bool $status)
enableDelete(bool $status)
insertCopyCommand(bool $to_repository=false)
const DOWNLOAD_CHECKBOX_ENABLED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $preconditions_enabled
getItemDetailLinkStatus()
get item detail link status
setPositionInputField(string $field_index, string $position_value)
enableMultiDownload(bool $value)
Toggles whether multiple objects can be downloaded at once or not.
small()
description: > This can be used, when space is very scarce and the label cannot be displayed ...
setDetailsLevel(int $level)
Details level Currently used in Search which shows only limited properties of forums Currently used f...
commandsNeedToBeHidden(bool $for_header)
Fix bug #12417: We hide the action menu when we are in the public area.
ILIAS Notes Service $notes_service
ilFavouritesManager $fav_manager
enableSubscribe(bool $status)
bool $search_fragments_enabled
ilWorkspaceAccessHandler $ws_access
getCommandsDropdown(string $title, bool $for_header=false)
addCustomCommandButton(Button $button, ?Modal $triggeredModal=null)
enableLinkedPath(bool $status)
ilGlobalTemplateInterface $main_tpl
bool $lp_settings_cmd_enabled
int $download_checkbox_state
static initJavascript(string $a_ajax_url, ?ilGlobalTemplateInterface $a_main_tpl=null)
array $prevent_duplicate_commands
bool $adm_commands_included
bool $item_detail_links_enabled
enableInfoScreen(bool $info_screen)
static _lookupObjId(int $ref_id)
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
static string $tpl_file_name
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, ?string $sub_type=null, ?int $sub_id=null, int $news_id=0)
Build ajax hash.
enablePath(bool $path, int $start_node=0, ?\ilPathGUI $path_gui=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
enablePreconditions(bool $status)
enableSearchFragments(bool $status)
enableProperties(bool $status)
static _getInstance()
Get singleton instance of this class.
collapse()
description: > Example for rendering a collapse glyph.
enableNoticeProperties(bool $status)
Provides fluid interface to RBAC services.
static http()
Fetches the global http state from ILIAS.
static _getCommands()
get commands
getProperties()
Get item properties.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createDefaultCommand(array $command)
Get default command link Overwritten for e.g categories,courses => they return a goto link If search ...
static _checkCondition(array $condition, int $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
enableComments(bool $value, bool $enable_comments_settings=true)
static _lookupTitle(int $obj_id)
getCommandId()
get command id Normally the ref id.
const CONTEXT_PERSONAL_DESKTOP
restrictToGoto(bool $value)
Restrict all actions/links to goto.
setExpanded(bool $status)
string $item_detail_links_intro
static calculateEffectiveRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, string $a_target_obj_type='')
enableLPSettingsCommand(bool $enabled)
getDownloadCheckboxState()
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
setDefaultCommandParameters(array $params)
getCommandImage(string $cmd)
Get command icon image.
enableProgressInfo(bool $status)
insertInfoScreenCommand()
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getListTagsJSCall(string $a_hash, ?string $a_update_code=null)
array $default_command_params
bool $substitutions_enabled
getHeaderAction(?ilGlobalTemplateInterface $main_tpl=null)
Manages items in repository clipboard.
getSearchFragmentStatus()
isMode(string $mode)
check current output mode
setConditionDepth(int $depth)
set depth for precondition output (stops at level 5)
getIconImageType()
Returns the icon image type.
disableTitleLink(bool $status)
enableRating(bool $value, ?string $text=null, bool $categories=false, ?array $ctrl_path=null, bool $force_rate_parent=false)
addSubItemHTML(string $html)
Add HTML for sub item (used for sessions)
bool $repository_transfer_enabled
isCommentsActivated(string $type, int $ref_id, int $obj_id, bool $header_actions, bool $check_write_access=true)
Check comments status against comments settings and context.
addCustomCommand(string $link, string $lang_var, string $frame='', string $onclick='')
static getListGUIStatus(int $a_obj_id, bool $a_image_only=true)
insertLPSettingsCommand()
enableLearningProgress(bool $enabled)
populateCommands(bool $for_header)
insert all commands into html code
getCustomProperties(array $prop)
insertLPCommand()
insert learning progress command
static getTagsForUserAndObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id, string $a_sub_obj_type, int $a_user_id)
bool $comments_settings_enabled
ILIAS Refinery Factory $refinery
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
checkInfoPageOnAsynchronousRendering()
addHeaderIcon(string $id, string $img, ?string $tooltip=null, ?string $onclick=null, ?string $status_text=null, ?string $href=null)
insertCutCommand(bool $to_repository=false)
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
static bool $preload_done
addHeaderGlyph(string $id, ILIAS\UI\Component\Symbol\Glyph\Glyph $glyph, $onclick=null)
bool $description_enabled
ilAdvancedMDSubstitution $substitutions
expand()
description: > Example for rendering an expand glyph.
enableSubstitutions(bool $status)
getNoticePropertiesStatus()
bool $prevent_access_caching
insertTimingsCommand()
ks, 23 OCT 2023: This function is badly named and it already was before the changes made today...
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
string $position_field_index
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
string $additional_information
__construct(Container $dic, ilPlugin $plugin)
setSeparateCommands(bool $val)
bool $info_screen_enabled
bool $title_link_disabled
link(string $caption, string $href, bool $new_viewport=false)
enableCheckbox(bool $status)
Properties $object_properties
setItemDetailLinks(array $detail_links, string $intro_txt='')
set items detail links
getCommandLink(string $cmd)
Get command link url.
bool $rating_categories_enabled
catch(InvalidArgumentException) if(!ilDAVActivationChecker::_isActive()) $webdav_dic
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
static getEffectiveOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
ClipboardManager $clipboard
ilObjectDefinition $obj_definition
insertCommand(string $href, string $text, string $frame='', string $img='', string $cmd='', string $onclick='')
insert command button
enableItemDetailLinks(bool $status)
enable item detail links E.g Direct links to chapters or pages
getUriToMountInstructionModalByRef(int $a_ref_id)
Interface for GUI classes (PDGUI, LuceneSearchGUI...) that have to handle administration commands (cu...
insertCommonSocialCommands(bool $header_actions=false)
Insert common social commands (comments, notes, tagging)
static _lookupType(int $id, bool $reference=false)
enableDescription(bool $status)
static array $comments_activation
addHeaderIconHTML(string $id, string $html)
forceVisibleOnly(bool $stat)
enableDownloadCheckbox(int $ref_id)
setAjaxHash(string $hash)
enableRepositoryTransfer(bool $value)
Enable copy/move to repository (from personal workspace)
ilLDAPRoleGroupMapping $ldap_mapping
Class ilObjSCORMLearningModule.
const DOWNLOAD_CHECKBOX_DISABLED
modifyTitleLink(string $default_link)
static getListNotesJSCall(string $a_hash, ?string $a_update_code=null)
Get list notes js call.
addCustomProperty(string $property='', string $value='', bool $alert=false, bool $newline=false)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)