417 : string {
418 $ilUser = $this->domain->user();
419 $lng = $this->domain->lng();
420
421 $objective = new \ilCourseObjective($this->container, $a_objective_id);
422
424
425
426
427
428 $objectives_lm_obj = new \ilCourseObjectiveMaterials($a_objective_id);
429
430
431 $sort_map = array();
432 foreach ($objectives_lm_obj->getMaterials() as $item) {
433 $sort_map[$item["lm_ass_id"]] = $item["position"];
434 }
435
436 $is_manage = $this->container_gui->isActiveAdministrationPanel();
437 $is_order = $this->container_gui->isActiveOrdering();
438
439 $sort_content = array();
440
441 $access = $this->domain->access();
442 foreach ($items as $item) {
443
444 if (!$access->checkAccess('visible', '', $item["ref_id"])) {
445 continue;
446 }
447
448
449
450
451
452 $item_list_gui2 = $this->
renderer->getItemRenderer()->getItemGUI($item);
453 $item_list_gui2->enableIcon(true);
454
455 if ($is_order || $a_accordion) {
456 $item_list_gui2->enableCommands(true, true);
457 $item_list_gui2->enableProperties(false);
458 }
459
460 $chapters = $objectives_lm_obj->getChapters();
461 if (count($chapters)) {
462 $has_sections = false;
463 foreach ($chapters as $chapter) {
464 if ($chapter['ref_id'] != $item['child']) {
465 continue;
466 }
467 $has_sections = true;
468
469 $title = $item['title'] .
471 " (" .
$lng->
txt(
'obj_' . $chapter[
'type']) .
")";
472
473 $item_list_gui2->setDefaultCommandParameters(array(
474 "obj_id" => $chapter['obj_id'],
475 "focus_id" => $chapter['obj_id'],
476 "focus_return" => $this->container->getRefId()));
477
478 if ($is_order) {
479 $item_list_gui2->setPositionInputField(
480 "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
481 sprintf('%d', $chapter['position'] * 10)
482 );
483 }
484
485 $sub_item_html = $item_list_gui2->getListItemHTML(
486 (int) $item['ref_id'],
487 (int) $item['obj_id'],
488 $title,
489 $item['description']
490 );
491
492
493 $sort_key = str_pad(
494 (string) $chapter['position'],
495 5,
496 "0",
497 STR_PAD_LEFT
498 ) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
499 $sort_content[$sort_key] = $sub_item_html;
500 }
501 }
502
503 $this->rendered_items[$item['child']] = true;
504
505 if ($lm_ass_id = $objectives_lm_obj->isAssigned((int) $item['ref_id'], true)) {
506 if ($is_order) {
507 $item_list_gui2->setPositionInputField(
508 "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
509 sprintf('%d', $sort_map[$lm_ass_id] * 10)
510 );
511 }
512
513 $sub_item_html = $item_list_gui2->getListItemHTML(
514 $item['ref_id'],
515 $item['obj_id'],
516 $item['title'],
517 $item['description']
518 );
519
520
521 $sort_key = str_pad((string) $sort_map[$lm_ass_id], 5, "0", STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
522 $sort_content[$sort_key] = $sub_item_html;
523 }
524 }
525
526
527 $this->objective_list_gui->enableCommands(false);
528
529
530
531
532 if ($is_order) {
533 $this->objective_list_gui->setPositionInputField(
534 "[lobj][" . $a_objective_id . "][0]",
535 (string) ($objective->__getPosition() * 10)
536 );
537 }
538
539 ksort($sort_content);
540 if (!$a_accordion) {
541 foreach ($sort_content as $sub_item_html) {
542 $this->objective_list_gui->addSubItemHTML($sub_item_html);
543 }
544
545 return $this->objective_list_gui->getObjectiveListItemHTML(
546 0,
547 $a_objective_id,
548 $objective->getTitle(),
549 $objective->getDescription(),
550 ($is_manage || $is_order)
551 );
552 } else {
553 $acc_content = $sort_content;
554
555 $initial_shown = false;
558
559 if (
560 $initial_test_obj_id &&
561 $this->loc_settings->hasSeparateInitialTests() &&
563 ) {
566 $a_objective_id,
567 true
568 );
569 $initial_shown = true;
570 } elseif ($this->loc_settings->hasSeparateQualifiedTests()) {
573 $a_objective_id,
574 false
575 );
576 }
577
578 $co_page = null;
580 $a_has_lo_page = true;
581
582 $page_gui = new \ilLOPageGUI($objective->getObjectiveId());
583
584 $page_gui->setStyleId(
585 $this->content_style_domain->getEffectiveStyleId()
586 );
587 $page_gui->setPresentationTitle("");
588 $page_gui->setTemplateOutput(false);
589 $page_gui->setHeader("");
590
591 $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
592 }
593
594 $a_accordion->addItem(
596 $co_page .
598 ($this->request->getObjectiveId() == $objective->getObjectiveId())
599 );
600 }
601 return "";
602 }
buildAccordionTitle(\ilCourseObjective $a_objective, ?array $a_lo_result=null)
renderTest(int $a_test_ref_id, ?int $a_objective_id, bool $a_is_initial=false)
buildAccordionContent(array $a_items)
const string OPERATOR_FINISHED
static _lookupTitle(int $a_obj_id)
static getItemsByObjective(int $objective_id)
Get objective items.
static _lookupObjId(int $ref_id)
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object