ILIAS  release_8 Revision v8.24
ilAssOrderingElement Class Reference
+ Collaboration diagram for ilAssOrderingElement:

Public Member Functions

 __construct (int $id=-1)
 ilAssOrderingElement constructor. More...
 
 __clone ()
 Cloning. More...
 
 getClone ()
 
 getId ()
 
 setId (int $id)
 
 getRandomIdentifier ()
 
 setRandomIdentifier (int $random_identifier)
 
 getSolutionIdentifier ()
 
 setSolutionIdentifier (int $solution_identifier)
 
 setIndentation (int $indentation)
 
 getIndentation ()
 
 getPosition ()
 
 setPosition (int $position)
 
 getContent ()
 
 setContent ($content)
 
 getUploadImageFile ()
 
 setUploadImageFile ($uploadImageFile)
 
 getUploadImageName ()
 
 setUploadImageName ($uploadImageName)
 
 isImageUploadAvailable ()
 
 isImageRemovalRequest ()
 
 setImageRemovalRequest ($imageRemovalRequest)
 
 getImagePathWeb ()
 
 setImagePathWeb ($imagePathWeb)
 
 getImagePathFs ()
 
 setImagePathFs ($imagePathFs)
 
 getImageThumbnailPrefix ()
 
 setImageThumbnailPrefix ($imageThumbnailPrefix)
 
 isSameElement (ilAssOrderingElement $element)
 
 getStorageValue1 ($orderingType)
 
 getStorageValue2 ($orderingType)
 
 __toString ()
 
 getPresentationImageUrl ()
 
 getExportIdent ()
 
 isExportIdent (string $ident)
 
 setExportIdent ($ident)
 
 withRandomIdentifier (int $id)
 
 withSolutionIdentifier (int $id)
 
 withPosition (int $position)
 
 withIndentation (int $indentation)
 
 withContent (string $content)
 

Data Fields

const EXPORT_IDENT_PROPERTY_SEPARATOR = '_'
 
 $objectInstanceId
 
int $id
 

Static Public Attributes

static $objectInstanceCounter = 0
 

Protected Member Functions

 thumbnailFileExists ()
 
 getThumbnailFilePath ()
 
 getThumbnailFileUrl ()
 
 imageFileExists ()
 
 getImageFilePath ()
 
 getImageFileUrl ()
 

Protected Attributes

int $random_identifier = null
 this identifier is generated randomly it is recycled for known elements More...
 
int $solution_identifier = null
 this identifier is used to identify elements and is stored together with the set position and indentation More...
 
int $indentation = 0
 the correct width of indentation for the element More...
 
int $position = null
 the correct position in the ordering sequence More...
 
string $content = null
 
string $uploadImageName = null
 
string $uploadImageFile = null
 
bool $imageRemovalRequest = false
 
string $imagePathWeb = null
 
string $imagePathFs = null
 
 $imageThumbnailPrefix = null
 

Detailed Description

Definition at line 28 of file class.ilAssOrderingElement.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssOrderingElement::__construct ( int  $id = -1)

ilAssOrderingElement constructor.

Definition at line 82 of file class.ilAssOrderingElement.php.

83 {
84 $this->id = $id;
85 $this->objectInstanceId = ++self::$objectInstanceCounter;
86 }

References $id, and $objectInstanceCounter.

Member Function Documentation

◆ __clone()

ilAssOrderingElement::__clone ( )

Cloning.

Definition at line 91 of file class.ilAssOrderingElement.php.

92 {
93 $this->objectInstanceId = ++self::$objectInstanceCounter;
94 }

References $objectInstanceCounter.

◆ __toString()

ilAssOrderingElement::__toString ( )

Definition at line 321 of file class.ilAssOrderingElement.php.

321 : string
322 {
323 return $this->getContent() ?? '';
324 }

References getContent().

+ Here is the call graph for this function:

◆ getClone()

ilAssOrderingElement::getClone ( )

Definition at line 96 of file class.ilAssOrderingElement.php.

97 {
98 return clone $this;
99 }

Referenced by assOrderingQuestion\getSolutionValuePairBrandedOrderingElementBySolutionIdentifier().

+ Here is the caller graph for this function:

◆ getContent()

◆ getExportIdent()

ilAssOrderingElement::getExportIdent ( )

Definition at line 377 of file class.ilAssOrderingElement.php.

377 : string
378 {
379 $ident = array(
380 $this->getRandomIdentifier(),
381 $this->getSolutionIdentifier(),
382 $this->getPosition(),
383 $this->getIndentation()
384 );
385
386 return implode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
387 }

References getIndentation(), getPosition(), getRandomIdentifier(), and getSolutionIdentifier().

+ Here is the call graph for this function:

◆ getId()

ilAssOrderingElement::getId ( )

Definition at line 101 of file class.ilAssOrderingElement.php.

101 : int
102 {
103 return $this->id;
104 }

References $id.

Referenced by ilAssOrderingFormValuesObjectsConverter\getStructValueFromObject().

+ Here is the caller graph for this function:

◆ getImageFilePath()

ilAssOrderingElement::getImageFilePath ( )
protected

Definition at line 354 of file class.ilAssOrderingElement.php.

354 : string
355 {
356 return $this->getImagePathFs() . $this->getContent();
357 }

References getContent(), and getImagePathFs().

Referenced by imageFileExists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageFileUrl()

ilAssOrderingElement::getImageFileUrl ( )
protected

Definition at line 359 of file class.ilAssOrderingElement.php.

359 : string
360 {
361 return $this->getImagePathWeb() . $this->getContent();
362 }

References getContent(), and getImagePathWeb().

Referenced by getPresentationImageUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImagePathFs()

ilAssOrderingElement::getImagePathFs ( )
Returns
string

Definition at line 249 of file class.ilAssOrderingElement.php.

249 : ?string
250 {
251 return $this->imagePathFs;
252 }

References $imagePathFs.

Referenced by getImageFilePath(), and getThumbnailFilePath().

+ Here is the caller graph for this function:

◆ getImagePathWeb()

ilAssOrderingElement::getImagePathWeb ( )
Returns
string

Definition at line 233 of file class.ilAssOrderingElement.php.

233 : ?string
234 {
235 return $this->imagePathWeb;
236 }

References $imagePathWeb.

Referenced by getImageFileUrl(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getImageThumbnailPrefix()

ilAssOrderingElement::getImageThumbnailPrefix ( )

Definition at line 262 of file class.ilAssOrderingElement.php.

References $imageThumbnailPrefix.

Referenced by getThumbnailFilePath(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getIndentation()

ilAssOrderingElement::getIndentation ( )

◆ getPosition()

ilAssOrderingElement::getPosition ( )

◆ getPresentationImageUrl()

ilAssOrderingElement::getPresentationImageUrl ( )

Definition at line 364 of file class.ilAssOrderingElement.php.

364 : string
365 {
366 if ($this->thumbnailFileExists()) {
367 return $this->getThumbnailFileUrl();
368 }
369
370 if ($this->imageFileExists()) {
371 return $this->getImageFileUrl();
372 }
373
374 return '';
375 }

References getImageFileUrl(), getThumbnailFileUrl(), imageFileExists(), and thumbnailFileExists().

Referenced by assOrderingQuestionGUI\getAnswerStatisticOrderingElementHtml(), and ilAssOrderingFormValuesObjectsConverter\getImageContentValueFromObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRandomIdentifier()

ilAssOrderingElement::getRandomIdentifier ( )

◆ getSolutionIdentifier()

ilAssOrderingElement::getSolutionIdentifier ( )
Returns
int

Definition at line 124 of file class.ilAssOrderingElement.php.

124 : ?int
125 {
127 }
int $solution_identifier
this identifier is used to identify elements and is stored together with the set position and indenta...

References $solution_identifier.

Referenced by ilAssOrderingElementList\fetchIdentifier(), getExportIdent(), getStorageValue1(), ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository\insertOrderingElement(), isSameElement(), and assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ getStorageValue1()

ilAssOrderingElement::getStorageValue1 (   $orderingType)

◆ getStorageValue2()

ilAssOrderingElement::getStorageValue2 (   $orderingType)

Definition at line 306 of file class.ilAssOrderingElement.php.

307 {
308 switch ($orderingType) {
311
312 return $this->getRandomIdentifier() . ':' . $this->getIndentation();
313
316 default:
317 return $this->getPosition() + 1;
318 }
319 }

References getIndentation(), getPosition(), getRandomIdentifier(), assOrderingQuestion\OQ_NESTED_PICTURES, assOrderingQuestion\OQ_NESTED_TERMS, assOrderingQuestion\OQ_PICTURES, and assOrderingQuestion\OQ_TERMS.

+ Here is the call graph for this function:

◆ getThumbnailFilePath()

ilAssOrderingElement::getThumbnailFilePath ( )
protected

Definition at line 335 of file class.ilAssOrderingElement.php.

335 : string
336 {
337 return $this->getImagePathFs() . $this->getImageThumbnailPrefix() . $this->getContent();
338 }

References getContent(), getImagePathFs(), and getImageThumbnailPrefix().

Referenced by thumbnailFileExists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailFileUrl()

ilAssOrderingElement::getThumbnailFileUrl ( )
protected

Definition at line 340 of file class.ilAssOrderingElement.php.

340 : string
341 {
342 return $this->getImagePathWeb() . $this->getImageThumbnailPrefix() . $this->getContent();
343 }

References getContent(), getImagePathWeb(), and getImageThumbnailPrefix().

Referenced by getPresentationImageUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUploadImageFile()

ilAssOrderingElement::getUploadImageFile ( )

Definition at line 171 of file class.ilAssOrderingElement.php.

171 : ?string
172 {
174 }

References $uploadImageFile.

Referenced by isImageUploadAvailable().

+ Here is the caller graph for this function:

◆ getUploadImageName()

ilAssOrderingElement::getUploadImageName ( )
Returns
string

Definition at line 190 of file class.ilAssOrderingElement.php.

190 : ?string
191 {
193 }

References $uploadImageName.

◆ imageFileExists()

ilAssOrderingElement::imageFileExists ( )
protected

Definition at line 345 of file class.ilAssOrderingElement.php.

345 : bool
346 {
347 if (!$this->getContent()) {
348 return false;
349 }
350
351 return file_exists($this->getImageFilePath());
352 }

References getContent(), and getImageFilePath().

Referenced by getPresentationImageUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isExportIdent()

ilAssOrderingElement::isExportIdent ( string  $ident)

Definition at line 389 of file class.ilAssOrderingElement.php.

389 : bool
390 {
391 if (!strlen($ident)) {
392 return false;
393 }
394
395 $parts = explode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
396 return
397 count($parts) == 4
402 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64

References $parts, ilAssOrderingElementList\isValidIndentation(), ilAssOrderingElementList\isValidPosition(), ilAssOrderingElementList\isValidRandomIdentifier(), and ilAssOrderingElementList\isValidSolutionIdentifier().

Referenced by setExportIdent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isImageRemovalRequest()

ilAssOrderingElement::isImageRemovalRequest ( )
Returns
bool

Definition at line 217 of file class.ilAssOrderingElement.php.

217 : ?bool
218 {
220 }

References $imageRemovalRequest.

◆ isImageUploadAvailable()

ilAssOrderingElement::isImageUploadAvailable ( )
Returns
bool

Definition at line 209 of file class.ilAssOrderingElement.php.

209 : bool
210 {
211 return (bool) strlen($this->getUploadImageFile());
212 }

References getUploadImageFile().

+ Here is the call graph for this function:

◆ isSameElement()

ilAssOrderingElement::isSameElement ( ilAssOrderingElement  $element)
Parameters
ilAssOrderingElement$element
Returns
bool

Definition at line 276 of file class.ilAssOrderingElement.php.

276 : bool
277 {
278 return [
279 $this->getRandomIdentifier(),
280 $this->getSolutionIdentifier(),
281 $this->getPosition(),
282 $this->getIndentation(),
283 ] == [
284 $element->getRandomIdentifier(),
285 $element->getSolutionIdentifier(),
286 $element->getPosition(),
287 $element->getIndentation()
288 ];
289 }

References getIndentation(), getPosition(), getRandomIdentifier(), and getSolutionIdentifier().

+ Here is the call graph for this function:

◆ setContent()

ilAssOrderingElement::setContent (   $content)

Definition at line 163 of file class.ilAssOrderingElement.php.

163 : void
164 {
165 if (is_array($content)) {
166 $content = array_shift($content);
167 }
168 $this->content = $content;
169 }

References $content.

◆ setExportIdent()

ilAssOrderingElement::setExportIdent (   $ident)

Definition at line 404 of file class.ilAssOrderingElement.php.

404 : void
405 {
406 if ($this->isExportIdent($ident)) {
407 list($randomId, $solutionId, $pos, $indent) = explode(
408 self::EXPORT_IDENT_PROPERTY_SEPARATOR,
409 $ident
410 );
411 $this->setRandomIdentifier((int) $randomId);
412 $this->setSolutionIdentifier((int) $solutionId);
413 $this->setPosition((int) $pos);
414 $this->setIndentation((int) $indent);
415 }
416 }
setRandomIdentifier(int $random_identifier)
setSolutionIdentifier(int $solution_identifier)

References isExportIdent(), setIndentation(), setPosition(), setRandomIdentifier(), and setSolutionIdentifier().

+ Here is the call graph for this function:

◆ setId()

ilAssOrderingElement::setId ( int  $id)

Definition at line 106 of file class.ilAssOrderingElement.php.

106 : void
107 {
108 $this->id = $id;
109 }

References $id.

◆ setImagePathFs()

ilAssOrderingElement::setImagePathFs (   $imagePathFs)
Parameters
string$imagePathFs

Definition at line 257 of file class.ilAssOrderingElement.php.

257 : void
258 {
259 $this->imagePathFs = $imagePathFs;
260 }

References $imagePathFs.

Referenced by assOrderingQuestionGUI\getAnswerStatisticOrderingElementHtml(), and ilAssOrderingFormValuesObjectsConverter\getImageContentValueFromObject().

+ Here is the caller graph for this function:

◆ setImagePathWeb()

ilAssOrderingElement::setImagePathWeb (   $imagePathWeb)
Parameters
string$imagePathWeb

Definition at line 241 of file class.ilAssOrderingElement.php.

241 : void
242 {
243 $this->imagePathWeb = $imagePathWeb;
244 }

References $imagePathWeb.

Referenced by assOrderingQuestionGUI\getAnswerStatisticOrderingElementHtml(), and ilAssOrderingFormValuesObjectsConverter\getImageContentValueFromObject().

+ Here is the caller graph for this function:

◆ setImageRemovalRequest()

ilAssOrderingElement::setImageRemovalRequest (   $imageRemovalRequest)
Parameters
bool$imageRemovalRequest

Definition at line 225 of file class.ilAssOrderingElement.php.

225 : void
226 {
227 $this->imageRemovalRequest = $imageRemovalRequest;
228 }

References $imageRemovalRequest.

◆ setImageThumbnailPrefix()

ilAssOrderingElement::setImageThumbnailPrefix (   $imageThumbnailPrefix)

Definition at line 267 of file class.ilAssOrderingElement.php.

267 : void
268 {
269 $this->imageThumbnailPrefix = $imageThumbnailPrefix;
270 }

References $imageThumbnailPrefix.

Referenced by assOrderingQuestionGUI\getAnswerStatisticOrderingElementHtml(), and ilAssOrderingFormValuesObjectsConverter\getImageContentValueFromObject().

+ Here is the caller graph for this function:

◆ setIndentation()

ilAssOrderingElement::setIndentation ( int  $indentation)

Definition at line 134 of file class.ilAssOrderingElement.php.

134 : void
135 {
136 $this->indentation = $indentation;
137 }

References $indentation.

Referenced by setExportIdent().

+ Here is the caller graph for this function:

◆ setPosition()

ilAssOrderingElement::setPosition ( int  $position)

Definition at line 149 of file class.ilAssOrderingElement.php.

149 : void
150 {
151 $this->position = $position;
152 }

References $position.

Referenced by setExportIdent().

+ Here is the caller graph for this function:

◆ setRandomIdentifier()

ilAssOrderingElement::setRandomIdentifier ( int  $random_identifier)

Definition at line 116 of file class.ilAssOrderingElement.php.

116 : void
117 {
118 $this->random_identifier = $random_identifier;
119 }

References $random_identifier.

Referenced by ilAssOrderingElementList\populateIdentifier(), and setExportIdent().

+ Here is the caller graph for this function:

◆ setSolutionIdentifier()

ilAssOrderingElement::setSolutionIdentifier ( int  $solution_identifier)

Definition at line 129 of file class.ilAssOrderingElement.php.

129 : void
130 {
131 $this->solution_identifier = $solution_identifier;
132 }

References $solution_identifier.

Referenced by ilAssOrderingElementList\populateIdentifier(), and setExportIdent().

+ Here is the caller graph for this function:

◆ setUploadImageFile()

ilAssOrderingElement::setUploadImageFile (   $uploadImageFile)
Parameters
string$uploadImageFile

Definition at line 179 of file class.ilAssOrderingElement.php.

179 : void
180 {
181 if (is_array($uploadImageFile)) {
182 $uploadImageFile = array_shift($uploadImageFile);
183 }
184 $this->uploadImageFile = $uploadImageFile;
185 }

References $uploadImageFile.

◆ setUploadImageName()

ilAssOrderingElement::setUploadImageName (   $uploadImageName)
Parameters
string$uploadImageName

Definition at line 198 of file class.ilAssOrderingElement.php.

198 : void
199 {
200 if (is_array($uploadImageName)) {
201 $uploadImageName = array_shift($uploadImageName);
202 }
203 $this->uploadImageName = $uploadImageName;
204 }

References $uploadImageName.

◆ thumbnailFileExists()

ilAssOrderingElement::thumbnailFileExists ( )
protected

Definition at line 326 of file class.ilAssOrderingElement.php.

326 : bool
327 {
328 if (!$this->getContent()) {
329 return false;
330 }
331
332 return file_exists($this->getThumbnailFilePath());
333 }

References getContent(), and getThumbnailFilePath().

Referenced by getPresentationImageUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withContent()

ilAssOrderingElement::withContent ( string  $content)

Definition at line 443 of file class.ilAssOrderingElement.php.

443 : self
444 {
445 $clone = clone $this;
446 $clone->content = $content;
447 return $clone;
448 }

References $content.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withIndentation()

ilAssOrderingElement::withIndentation ( int  $indentation)

Definition at line 437 of file class.ilAssOrderingElement.php.

437 : self
438 {
439 $clone = clone $this;
440 $clone->indentation = $indentation;
441 return $clone;
442 }

References $indentation.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withPosition()

ilAssOrderingElement::withPosition ( int  $position)

Definition at line 431 of file class.ilAssOrderingElement.php.

431 : self
432 {
433 $clone = clone $this;
434 $clone->position = $position;
435 return $clone;
436 }

References $position.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withRandomIdentifier()

ilAssOrderingElement::withRandomIdentifier ( int  $id)

Definition at line 419 of file class.ilAssOrderingElement.php.

419 : self
420 {
421 $clone = clone $this;
422 $clone->random_identifier = $id;
423 return $clone;
424 }

References $id.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withSolutionIdentifier()

ilAssOrderingElement::withSolutionIdentifier ( int  $id)

Definition at line 425 of file class.ilAssOrderingElement.php.

425 : self
426 {
427 $clone = clone $this;
428 $clone->solution_identifier = $id;
429 return $clone;
430 }

References $id.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

Field Documentation

◆ $content

string ilAssOrderingElement::$content = null
protected

Definition at line 71 of file class.ilAssOrderingElement.php.

Referenced by getContent(), setContent(), and withContent().

◆ $id

int ilAssOrderingElement::$id

◆ $imagePathFs

string ilAssOrderingElement::$imagePathFs = null
protected

Definition at line 76 of file class.ilAssOrderingElement.php.

Referenced by getImagePathFs(), and setImagePathFs().

◆ $imagePathWeb

string ilAssOrderingElement::$imagePathWeb = null
protected

Definition at line 75 of file class.ilAssOrderingElement.php.

Referenced by getImagePathWeb(), and setImagePathWeb().

◆ $imageRemovalRequest

bool ilAssOrderingElement::$imageRemovalRequest = false
protected

Definition at line 74 of file class.ilAssOrderingElement.php.

Referenced by isImageRemovalRequest(), and setImageRemovalRequest().

◆ $imageThumbnailPrefix

ilAssOrderingElement::$imageThumbnailPrefix = null
protected

◆ $indentation

int ilAssOrderingElement::$indentation = 0
protected

the correct width of indentation for the element

Definition at line 65 of file class.ilAssOrderingElement.php.

Referenced by getIndentation(), setIndentation(), and withIndentation().

◆ $objectInstanceCounter

ilAssOrderingElement::$objectInstanceCounter = 0
static

Definition at line 32 of file class.ilAssOrderingElement.php.

Referenced by __clone(), and __construct().

◆ $objectInstanceId

ilAssOrderingElement::$objectInstanceId

Definition at line 33 of file class.ilAssOrderingElement.php.

◆ $position

int ilAssOrderingElement::$position = null
protected

the correct position in the ordering sequence

Definition at line 70 of file class.ilAssOrderingElement.php.

Referenced by getPosition(), setPosition(), and withPosition().

◆ $random_identifier

int ilAssOrderingElement::$random_identifier = null
protected

this identifier is generated randomly it is recycled for known elements

the main purpose is to have a key that does not make the solution derivable and is therefore useable in the examines working form

Definition at line 48 of file class.ilAssOrderingElement.php.

Referenced by getRandomIdentifier(), and setRandomIdentifier().

◆ $solution_identifier

int ilAssOrderingElement::$solution_identifier = null
protected

this identifier is used to identify elements and is stored together with the set position and indentation

this happens for the examine's submit data as well, an order index is build and the elements are assigned using this identifier

it is an integer sequence starting at 0 that increments with every added element while obsolete numbers are not recycled

Definition at line 60 of file class.ilAssOrderingElement.php.

Referenced by getSolutionIdentifier(), and setSolutionIdentifier().

◆ $uploadImageFile

string ilAssOrderingElement::$uploadImageFile = null
protected

Definition at line 73 of file class.ilAssOrderingElement.php.

Referenced by getUploadImageFile(), and setUploadImageFile().

◆ $uploadImageName

string ilAssOrderingElement::$uploadImageName = null
protected

Definition at line 72 of file class.ilAssOrderingElement.php.

Referenced by getUploadImageName(), and setUploadImageName().

◆ EXPORT_IDENT_PROPERTY_SEPARATOR

const ilAssOrderingElement::EXPORT_IDENT_PROPERTY_SEPARATOR = '_'

Definition at line 30 of file class.ilAssOrderingElement.php.


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