ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $id.

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

Member Function Documentation

◆ __clone()

ilAssOrderingElement::__clone ( )

Cloning.

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

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

◆ __toString()

ilAssOrderingElement::__toString ( )

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

References getContent().

372  {
373  return $this->getContent();
374  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getId()

ilAssOrderingElement::getId ( )

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

References $id.

Referenced by ilAssOrderingFormValuesObjectsConverter\getStructValueFromObject().

131  : int
132  {
133  return $this->id;
134  }
$id
this identifier equals the database's row id
+ Here is the caller graph for this function:

◆ getImageFilePath()

ilAssOrderingElement::getImageFilePath ( )
protected

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

References getContent(), and getImagePathFs().

Referenced by imageFileExists().

405  {
406  return $this->getImagePathFs() . $this->getContent();
407  }
+ 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.

References getContent(), and getImagePathWeb().

Referenced by getPresentationImageUrl().

410  {
411  return $this->getImagePathWeb() . $this->getContent();
412  }
+ 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 ( )
Returns
int

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

References $indentation.

Referenced by getExportIdent(), getStorageValue2(), ilAssOrderingFormValuesObjectsConverter\getStructValueFromObject(), ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository\insertOrderingElement(), and isSameElement().

179  {
180  return $this->indentation;
181  }
$indentation
the correct width of indentation for the element
+ Here is the caller graph for this function:

◆ getPosition()

ilAssOrderingElement::getPosition ( )

◆ getPresentationImageUrl()

ilAssOrderingElement::getPresentationImageUrl ( )

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

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

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

415  {
416  if ($this->thumbnailFileExists()) {
417  return $this->getThumbnailFileUrl();
418  }
419 
420  if ($this->imageFileExists()) {
421  return $this->getImageFileUrl();
422  }
423 
424  return '';
425  }
+ 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.

References $solution_identifier.

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

155  {
157  }
$solution_identifier
this identifier is used to identify elements and is stored together with the set position and indenta...
+ Here is the caller graph for this function:

◆ getStorageValue1()

ilAssOrderingElement::getStorageValue1 (   $orderingType)

◆ getStorageValue2()

◆ getThumbnailFilePath()

ilAssOrderingElement::getThumbnailFilePath ( )
protected

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

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.

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.

References $uploadImageFile.

Referenced by isImageUploadAvailable().

215  : ?string
216  {
217  return $this->uploadImageFile;
218  }
+ 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.

References getContent(), and getImageFilePath().

Referenced by getPresentationImageUrl().

396  {
397  if (!$this->getContent()) {
398  return false;
399  }
400 
401  return file_exists($this->getImageFilePath());
402  }
+ 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.

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

Referenced by setExportIdent().

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  }
+ 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.

References getUploadImageFile().

254  {
255  return (bool) strlen($this->getUploadImageFile());
256  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ setContent()

ilAssOrderingElement::setContent (   $content)

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

References $content.

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

◆ setExportIdent()

ilAssOrderingElement::setExportIdent (   $ident)

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

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

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  }
setRandomIdentifier(int $random_identifier)
setSolutionIdentifier($solution_identifier)
+ Here is the call graph for this function:

◆ setId()

ilAssOrderingElement::setId ( int  $id)

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

References $id.

136  : void
137  {
138  $this->id = $id;
139  }
$id
this identifier equals the database's row id

◆ setImagePathFs()

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

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

References $imagePathFs.

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

302  {
303  $this->imagePathFs = $imagePathFs;
304  }
+ Here is the caller graph for this function:

◆ setImagePathWeb()

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

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

References $imagePathWeb.

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

286  {
287  $this->imagePathWeb = $imagePathWeb;
288  }
+ Here is the caller graph for this function:

◆ setImageRemovalRequest()

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

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

References $imageRemovalRequest.

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

◆ setImageThumbnailPrefix()

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

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

References $imageThumbnailPrefix.

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

318  {
319  $this->imageThumbnailPrefix = $imageThumbnailPrefix;
320  }
+ Here is the caller graph for this function:

◆ setIndentation()

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

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

References $indentation.

Referenced by setExportIdent().

171  {
172  $this->indentation = $indentation;
173  }
$indentation
the correct width of indentation for the element
+ Here is the caller graph for this function:

◆ setPosition()

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

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

References $position.

Referenced by setExportIdent().

195  {
196  $this->position = $position;
197  }
$position
the correct position in the ordering sequence
+ Here is the caller graph for this function:

◆ setRandomIdentifier()

ilAssOrderingElement::setRandomIdentifier ( int  $random_identifier)

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

References $random_identifier.

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

146  : void
147  {
148  $this->random_identifier = $random_identifier;
149  }
$random_identifier
this identifier is generated randomly it is recycled for known elements
+ 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.

References $solution_identifier.

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

163  {
164  $this->solution_identifier = $solution_identifier;
165  }
$solution_identifier
this identifier is used to identify elements and is stored together with the set position and indenta...
+ Here is the caller graph for this function:

◆ setUploadImageFile()

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

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

References $uploadImageFile.

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

◆ setUploadImageName()

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

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

References $uploadImageName.

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

◆ thumbnailFileExists()

ilAssOrderingElement::thumbnailFileExists ( )
protected

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

References getContent(), and getThumbnailFilePath().

Referenced by getPresentationImageUrl().

377  {
378  if (!$this->getContent()) {
379  return false;
380  }
381 
382  return file_exists($this->getThumbnailFilePath());
383  }
+ 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.

References $content.

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

◆ withIndentation()

ilAssOrderingElement::withIndentation ( int  $indentation)

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

References $indentation.

487  : self
488  {
489  $clone = clone $this;
490  $clone->indentation = $indentation;
491  return $clone;
492  }
$indentation
the correct width of indentation for the element

◆ withPosition()

ilAssOrderingElement::withPosition ( int  $position)

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

References $position.

481  : self
482  {
483  $clone = clone $this;
484  $clone->position = $position;
485  return $clone;
486  }
$position
the correct position in the ordering sequence

◆ withRandomIdentifier()

ilAssOrderingElement::withRandomIdentifier ( int  $id)

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

References $id.

Referenced by ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository\buildOrderingElement(), and assOrderingQuestionTest\testOrderingElementMutation().

469  : self
470  {
471  $clone = clone $this;
472  $clone->random_identifier = $id;
473  return $clone;
474  }
$id
this identifier equals the database's row id
+ Here is the caller graph for this function:

◆ withSolutionIdentifier()

ilAssOrderingElement::withSolutionIdentifier ( int  $id)

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

References $id.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

475  : self
476  {
477  $clone = clone $this;
478  $clone->solution_identifier = $id;
479  return $clone;
480  }
$id
this identifier equals the database's row id
+ 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.

◆ $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: