ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ILIAS\LearningModule\Search\SubitemPropertiesReader Class Reference
+ Inheritance diagram for ILIAS\LearningModule\Search\SubitemPropertiesReader:
+ Collaboration diagram for ILIAS\LearningModule\Search\SubitemPropertiesReader:

Public Member Functions

 init (Container $dic)
 
 getSubitemProperties (PropertiesFactory $factory, int $parent_ref_id, ID ... $subitem_ids)
 Order of the output should respect the order of the subitem_ids. More...
 
 init (Container $dic)
 
 getSubitemProperties (PropertiesFactory $factory, int $parent_ref_id, ID ... $subitem_ids)
 Order of the output should respect the order of the subitem_ids. More...
 

Static Public Member Functions

static type ()
 Type of the parent object. More...
 
static type ()
 Type of the parent object. More...
 

Protected Member Functions

 getPropertiesForLMObject (PropertiesFactory $factory, int $parent_ref_id, ID $subitem_id, string $presentable_type)
 
 getPropertiesForFile (PropertiesFactory $factory, int $parent_ref_id, ID $subitem_id)
 

Protected Attributes

ilLanguage $lng
 
DataFactory $data_factory
 
ilCtrlInterface $ctrl
 

Detailed Description

Definition at line 36 of file SubitemPropertiesReader.php.

Member Function Documentation

◆ getPropertiesForFile()

ILIAS\LearningModule\Search\SubitemPropertiesReader::getPropertiesForFile ( PropertiesFactory  $factory,
int  $parent_ref_id,
ID  $subitem_id 
)
protected

Definition at line 110 of file SubitemPropertiesReader.php.

114 : Properties {
115 $this->ctrl->setParameterByClass(ilLMPresentationGUI::class, 'ref_id', $parent_ref_id);
116 $this->ctrl->setParameterByClass(ilLMPresentationGUI::class, 'file_id', 'il__file_' . $subitem_id->id());
117 $link = rtrim(ILIAS_HTTP_PATH, '/') . '/' .
118 $this->ctrl->getLinkTargetByClass(ilLMPresentationGUI::class, 'downloadFile');
119 $this->ctrl->clearParameterByClass(ilLMPresentationGUI::class, 'file_id');
120 $this->ctrl->clearParameterByClass(ilLMPresentationGUI::class, 'ref_id');
121 return $factory->get(
122 $subitem_id,
123 ilObject::_lookupTitle((int) $subitem_id->id()),
124 $this->data_factory->uri($link),
125 false,
126 $this->lng->txt('obj_file')
127 );
128 }
static _lookupTitle(int $obj_id)

Referenced by ILIAS\LearningModule\Search\SubitemPropertiesReader\getSubitemProperties().

+ Here is the caller graph for this function:

◆ getPropertiesForLMObject()

ILIAS\LearningModule\Search\SubitemPropertiesReader::getPropertiesForLMObject ( PropertiesFactory  $factory,
int  $parent_ref_id,
ID  $subitem_id,
string  $presentable_type 
)
protected

Definition at line 89 of file SubitemPropertiesReader.php.

94 : Properties {
95 $this->ctrl->setParameterByClass(ilLMPresentationGUI::class, 'ref_id', $parent_ref_id);
96 $this->ctrl->setParameterByClass(ilLMPresentationGUI::class, 'obj_id', $subitem_id->id());
97 $link = rtrim(ILIAS_HTTP_PATH, '/') . '/' .
98 $this->ctrl->getLinkTargetByClass(ilLMPresentationGUI::class, '');
99 $this->ctrl->clearParameterByClass(ilLMPresentationGUI::class, 'obj_id');
100 $this->ctrl->clearParameterByClass(ilLMPresentationGUI::class, 'ref_id');
101 return $factory->get(
102 $subitem_id,
103 ilLMObject::_lookupTitle((int) $subitem_id->id()),
104 $this->data_factory->uri($link),
105 false,
106 $presentable_type
107 );
108 }
static _lookupTitle(int $a_obj_id)

Referenced by ILIAS\LearningModule\Search\SubitemPropertiesReader\getSubitemProperties().

+ Here is the caller graph for this function:

◆ getSubitemProperties()

ILIAS\LearningModule\Search\SubitemPropertiesReader::getSubitemProperties ( PropertiesFactory  $factory,
int  $parent_ref_id,
ID ...  $subitem_ids 
)

Order of the output should respect the order of the subitem_ids.

Subitems that should not be shown in the search results should not be included in the output (read access on the parent object is already checked).

Returns
Properties[]

Implements ILIAS\Search\Presentation\Result\Subitem\PropertiesReader.

Definition at line 54 of file SubitemPropertiesReader.php.

58 : Generator {
59 $obj_id = ilObject::_lookupObjId($parent_ref_id);
60 foreach ($subitem_ids as $subitem_id) {
61 switch ($subitem_id->type()) {
62 case 'pg':
63 yield $this->getPropertiesForLMObject(
64 $factory,
65 $parent_ref_id,
66 $subitem_id,
67 $this->lng->txt('obj_pg')
68 );
69 break;
70
71 case 'st':
72 yield $this->getPropertiesForLMObject(
73 $factory,
74 $parent_ref_id,
75 $subitem_id,
76 $this->lng->txt('obj_st')
77 );
78 break;
79
80 case 'file':
81 if (!ilObject::_exists((int) $subitem_id->id())) {
82 break;
83 }
84 yield $this->getPropertiesForFile($factory, $parent_ref_id, $subitem_id);
85 }
86 }
87 }
getPropertiesForLMObject(PropertiesFactory $factory, int $parent_ref_id, ID $subitem_id, string $presentable_type)
getPropertiesForFile(PropertiesFactory $factory, int $parent_ref_id, ID $subitem_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)

References ilObject\_exists(), ILIAS\LearningModule\Search\SubitemPropertiesReader\getPropertiesForFile(), ILIAS\LearningModule\Search\SubitemPropertiesReader\getPropertiesForLMObject(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ init()

ILIAS\LearningModule\Search\SubitemPropertiesReader::init ( Container  $dic)

Implements ILIAS\Search\Presentation\Result\Subitem\PropertiesReader.

Definition at line 47 of file SubitemPropertiesReader.php.

47 : void
48 {
49 $this->lng = $dic->language();
50 $this->data_factory = new DataFactory();
51 $this->ctrl = $dic->ctrl();
52 }
$dic
Definition: ltiresult.php:33

References ILIAS\DI\Container\ctrl(), ILIAS\Repository\ctrl(), ILIAS\DI\Container\language(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ type()

static ILIAS\LearningModule\Search\SubitemPropertiesReader::type ( )
static

Type of the parent object.

Should do nothing but return a string, is called during setup.

Implements ILIAS\Search\Presentation\Result\Subitem\PropertiesReader.

Definition at line 42 of file SubitemPropertiesReader.php.

42 : string
43 {
44 return 'lm';
45 }

Field Documentation

◆ $ctrl

ilCtrlInterface ILIAS\LearningModule\Search\SubitemPropertiesReader::$ctrl
protected

Definition at line 40 of file SubitemPropertiesReader.php.

◆ $data_factory

DataFactory ILIAS\LearningModule\Search\SubitemPropertiesReader::$data_factory
protected

Definition at line 39 of file SubitemPropertiesReader.php.

◆ $lng

ilLanguage ILIAS\LearningModule\Search\SubitemPropertiesReader::$lng
protected

Definition at line 38 of file SubitemPropertiesReader.php.


The documentation for this class was generated from the following file: