ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ($solution_identifier)
 
 setIndentation ($indentation)
 
 getIndentation ()
 
 getPosition ()
 
 setPosition ($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
 
 $id
 this identifier equals the database's row id More...
 

Static Public Attributes

static $objectInstanceCounter = 0
 

Protected Member Functions

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

Protected Attributes

 $random_identifier = null
 this identifier is generated randomly it is recycled for known elements More...
 
 $solution_identifier = null
 this identifier is used to identify elements and is stored together with the set position and indentation More...
 
 $indentation = 0
 the correct width of indentation for the element More...
 
 $position = null
 the correct position in the ordering sequence More...
 
 $content = null
 
 $uploadImageName = null
 
 $uploadImageFile = null
 
 $imageRemovalRequest = false
 
 $imagePathWeb = null
 
 $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 112 of file class.ilAssOrderingElement.php.

113 {
114 $this->id = $id;
115 $this->objectInstanceId = ++self::$objectInstanceCounter;
116 }
$id
this identifier equals the database's row id

References $id, and $objectInstanceCounter.

Member Function Documentation

◆ __clone()

ilAssOrderingElement::__clone ( )

Cloning.

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

122 {
123 $this->objectInstanceId = ++self::$objectInstanceCounter;
124 }

References $objectInstanceCounter.

◆ __toString()

ilAssOrderingElement::__toString ( )

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

372 {
373 return $this->getContent();
374 }

References getContent().

+ Here is the call graph for this function:

◆ getClone()

ilAssOrderingElement::getClone ( )

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

127 {
128 return clone $this;
129 }

◆ getContent()

◆ getExportIdent()

ilAssOrderingElement::getExportIdent ( )

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

428 {
429 $ident = array(
430 $this->getRandomIdentifier(),
431 $this->getSolutionIdentifier(),
432 $this->getPosition(),
433 $this->getIndentation()
434 );
435
436 return implode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
437 }

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

+ Here is the call graph for this function:

◆ getId()

ilAssOrderingElement::getId ( )

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

131 : int
132 {
133 return $this->id;
134 }

References $id.

Referenced by ilAssOrderingFormValuesObjectsConverter\getStructValueFromObject().

+ Here is the caller graph for this function:

◆ getImageFilePath()

ilAssOrderingElement::getImageFilePath ( )
protected

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

405 {
406 return $this->getImagePathFs() . $this->getContent();
407 }

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 409 of file class.ilAssOrderingElement.php.

410 {
411 return $this->getImagePathWeb() . $this->getContent();
412 }

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 293 of file class.ilAssOrderingElement.php.

References $imagePathFs.

Referenced by getImageFilePath(), and getThumbnailFilePath().

+ Here is the caller graph for this function:

◆ getImagePathWeb()

ilAssOrderingElement::getImagePathWeb ( )
Returns
string

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

References $imagePathWeb.

Referenced by getImageFileUrl(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getImageThumbnailPrefix()

ilAssOrderingElement::getImageThumbnailPrefix ( )
Returns
null

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

References $imageThumbnailPrefix.

Referenced by getThumbnailFilePath(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getIndentation()

ilAssOrderingElement::getIndentation ( )

◆ getPosition()

◆ getPresentationImageUrl()

ilAssOrderingElement::getPresentationImageUrl ( )

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

415 {
416 if ($this->thumbnailFileExists()) {
417 return $this->getThumbnailFileUrl();
418 }
419
420 if ($this->imageFileExists()) {
421 return $this->getImageFileUrl();
422 }
423
424 return '';
425 }

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 154 of file class.ilAssOrderingElement.php.

155 {
157 }
$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 356 of file class.ilAssOrderingElement.php.

357 {
358 switch ($orderingType) {
361
362 return $this->getRandomIdentifier() . ':' . $this->getIndentation();
363
366
367 return $this->getPosition() + 1;
368 }
369 }

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 385 of file class.ilAssOrderingElement.php.

386 {
387 return $this->getImagePathFs() . $this->getImageThumbnailPrefix() . $this->getContent();
388 }

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 390 of file class.ilAssOrderingElement.php.

391 {
392 return $this->getImagePathWeb() . $this->getImageThumbnailPrefix() . $this->getContent();
393 }

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 215 of file class.ilAssOrderingElement.php.

215 : ?string
216 {
218 }

References $uploadImageFile.

Referenced by isImageUploadAvailable().

+ Here is the caller graph for this function:

◆ getUploadImageName()

ilAssOrderingElement::getUploadImageName ( )
Returns
string

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

References $uploadImageName.

◆ imageFileExists()

ilAssOrderingElement::imageFileExists ( )
protected

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

396 {
397 if (!$this->getContent()) {
398 return false;
399 }
400
401 return file_exists($this->getImageFilePath());
402 }

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 439 of file class.ilAssOrderingElement.php.

439 : bool
440 {
441 if (!strlen($ident)) {
442 return false;
443 }
444
445 $parts = explode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
446 return
447 count($parts) == 4
452 }

References 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 261 of file class.ilAssOrderingElement.php.

References $imageRemovalRequest.

◆ isImageUploadAvailable()

ilAssOrderingElement::isImageUploadAvailable ( )
Returns
bool

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

254 {
255 return (bool) strlen($this->getUploadImageFile());
256 }

References getUploadImageFile().

+ Here is the call graph for this function:

◆ isSameElement()

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

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

326 : bool
327 {
328 return [
329 $this->getRandomIdentifier(),
330 $this->getSolutionIdentifier(),
331 $this->getPosition(),
332 $this->getIndentation(),
333 ] == [
334 $element->getRandomIdentifier(),
335 $element->getSolutionIdentifier(),
336 $element->getPosition(),
337 $element->getIndentation()
338 ];
339 }

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

+ Here is the call graph for this function:

◆ setContent()

ilAssOrderingElement::setContent (   $content)

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

208 {
209 if (is_array($content)) {
210 $content = array_shift($content);
211 }
212 $this->content = $content;
213 }

References $content.

◆ setExportIdent()

ilAssOrderingElement::setExportIdent (   $ident)

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

455 {
456 if ($this->isExportIdent($ident)) {
457 list($randomId, $solutionId, $pos, $indent) = explode(
458 self::EXPORT_IDENT_PROPERTY_SEPARATOR,
459 $ident
460 );
461 $this->setRandomIdentifier((int) $randomId);
462 $this->setSolutionIdentifier($solutionId);
463 $this->setPosition($pos);
464 $this->setIndentation($indent);
465 }
466 }
setSolutionIdentifier($solution_identifier)
setRandomIdentifier(int $random_identifier)

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

+ Here is the call graph for this function:

◆ setId()

ilAssOrderingElement::setId ( int  $id)

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

136 : void
137 {
138 $this->id = $id;
139 }

References $id.

◆ setImagePathFs()

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

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

302 {
303 $this->imagePathFs = $imagePathFs;
304 }

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 285 of file class.ilAssOrderingElement.php.

286 {
287 $this->imagePathWeb = $imagePathWeb;
288 }

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 269 of file class.ilAssOrderingElement.php.

270 {
271 $this->imageRemovalRequest = $imageRemovalRequest;
272 }

References $imageRemovalRequest.

◆ setImageThumbnailPrefix()

ilAssOrderingElement::setImageThumbnailPrefix (   $imageThumbnailPrefix)
Parameters
null$imageThumbnailPrefix

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

318 {
319 $this->imageThumbnailPrefix = $imageThumbnailPrefix;
320 }

References $imageThumbnailPrefix.

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

+ Here is the caller graph for this function:

◆ setIndentation()

ilAssOrderingElement::setIndentation (   $indentation)
Parameters
int$indentation

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

171 {
172 $this->indentation = $indentation;
173 }

References $indentation.

Referenced by setExportIdent().

+ Here is the caller graph for this function:

◆ setPosition()

ilAssOrderingElement::setPosition (   $position)
Parameters
int$position

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

195 {
196 $this->position = $position;
197 }

References $position.

Referenced by setExportIdent().

+ Here is the caller graph for this function:

◆ setRandomIdentifier()

ilAssOrderingElement::setRandomIdentifier ( int  $random_identifier)

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

146 : void
147 {
148 $this->random_identifier = $random_identifier;
149 }

References $random_identifier.

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

+ Here is the caller graph for this function:

◆ setSolutionIdentifier()

ilAssOrderingElement::setSolutionIdentifier (   $solution_identifier)
Parameters
int$solution_identifier

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

163 {
164 $this->solution_identifier = $solution_identifier;
165 }

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 223 of file class.ilAssOrderingElement.php.

224 {
225 if (is_array($uploadImageFile)) {
226 $uploadImageFile = array_shift($uploadImageFile);
227 }
228 $this->uploadImageFile = $uploadImageFile;
229 }

References $uploadImageFile.

◆ setUploadImageName()

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

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

243 {
244 if (is_array($uploadImageName)) {
245 $uploadImageName = array_shift($uploadImageName);
246 }
247 $this->uploadImageName = $uploadImageName;
248 }

References $uploadImageName.

◆ thumbnailFileExists()

ilAssOrderingElement::thumbnailFileExists ( )
protected

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

377 {
378 if (!$this->getContent()) {
379 return false;
380 }
381
382 return file_exists($this->getThumbnailFilePath());
383 }

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 493 of file class.ilAssOrderingElement.php.

493 : self
494 {
495 $clone = clone $this;
496 $clone->content = $content;
497 return $clone;
498 }

References $content.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withIndentation()

ilAssOrderingElement::withIndentation ( int  $indentation)

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

487 : self
488 {
489 $clone = clone $this;
490 $clone->indentation = $indentation;
491 return $clone;
492 }

References $indentation.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withPosition()

ilAssOrderingElement::withPosition ( int  $position)

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

481 : self
482 {
483 $clone = clone $this;
484 $clone->position = $position;
485 return $clone;
486 }

References $position.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withRandomIdentifier()

ilAssOrderingElement::withRandomIdentifier ( int  $id)

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

469 : self
470 {
471 $clone = clone $this;
472 $clone->random_identifier = $id;
473 return $clone;
474 }

References $id.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withSolutionIdentifier()

ilAssOrderingElement::withSolutionIdentifier ( int  $id)

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

475 : self
476 {
477 $clone = clone $this;
478 $clone->solution_identifier = $id;
479 return $clone;
480 }

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 81 of file class.ilAssOrderingElement.php.

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

◆ $id

integer ilAssOrderingElement::$id

this identifier equals the database's row id

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

Referenced by __construct(), getId(), setId(), withRandomIdentifier(), and withSolutionIdentifier().

◆ $imagePathFs

string ilAssOrderingElement::$imagePathFs = null
protected

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

Referenced by getImagePathFs(), and setImagePathFs().

◆ $imagePathWeb

string ilAssOrderingElement::$imagePathWeb = null
protected

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

Referenced by getImagePathWeb(), and setImagePathWeb().

◆ $imageRemovalRequest

bool ilAssOrderingElement::$imageRemovalRequest = false
protected

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

Referenced by isImageRemovalRequest(), and setImageRemovalRequest().

◆ $imageThumbnailPrefix

ilAssOrderingElement::$imageThumbnailPrefix = null
protected

◆ $indentation

integer ilAssOrderingElement::$indentation = 0
protected

the correct width of indentation for the element

Definition at line 70 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

integer ilAssOrderingElement::$position = null
protected

the correct position in the ordering sequence

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

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

◆ $random_identifier

integer 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 50 of file class.ilAssOrderingElement.php.

Referenced by getRandomIdentifier(), and setRandomIdentifier().

◆ $solution_identifier

integer 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 64 of file class.ilAssOrderingElement.php.

Referenced by getSolutionIdentifier(), and setSolutionIdentifier().

◆ $uploadImageFile

ilAssOrderingElement::$uploadImageFile = null
protected

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

Referenced by getUploadImageFile(), and setUploadImageFile().

◆ $uploadImageName

string ilAssOrderingElement::$uploadImageName = null
protected

Definition at line 86 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: