ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (string $image_path_fs)
 
 getImageThumbnailPrefix ()
 
 setImageThumbnailPrefix ($imageThumbnailPrefix)
 
 isSameElement (ilAssOrderingElement $element)
 
 getStorageValue1 (int $ordering_type)
 
 getStorageValue2 (int $ordering_type)
 
 __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 $image_path_fs = 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 315 of file class.ilAssOrderingElement.php.

315 : string
316 {
317 return $this->getContent() ?? '';
318 }

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 }

◆ getContent()

◆ getExportIdent()

ilAssOrderingElement::getExportIdent ( )

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

371 : string
372 {
373 $ident = [
374 $this->getRandomIdentifier(),
375 $this->getSolutionIdentifier(),
376 $this->getPosition(),
377 $this->getIndentation()
378 ];
379
380 return implode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
381 }

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

348 : string
349 {
350 return $this->getImagePathFs() . $this->getContent();
351 }

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

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

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

250 : ?string
251 {
253 }

References $image_path_fs.

Referenced by getImageFilePath(), and getThumbnailFilePath().

+ Here is the caller graph for this function:

◆ getImagePathWeb()

ilAssOrderingElement::getImagePathWeb ( )
Returns
string

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

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

References $imagePathWeb.

Referenced by getImageFileUrl(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getImageThumbnailPrefix()

ilAssOrderingElement::getImageThumbnailPrefix ( )

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

References $imageThumbnailPrefix.

Referenced by getThumbnailFilePath(), and getThumbnailFileUrl().

+ Here is the caller graph for this function:

◆ getIndentation()

◆ getPosition()

◆ getPresentationImageUrl()

ilAssOrderingElement::getPresentationImageUrl ( )

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

358 : string
359 {
360 if ($this->thumbnailFileExists()) {
361 return $this->getThumbnailFileUrl();
362 }
363
364 if ($this->imageFileExists()) {
365 return $this->getImageFileUrl();
366 }
367
368 return '';
369 }

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\TestQuestionPool\Questions\Ordering\OrderingQuestionDatabaseRepository\insertOrderingElement(), isSameElement(), and assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ getStorageValue1()

ilAssOrderingElement::getStorageValue1 ( int  $ordering_type)

◆ getStorageValue2()

ilAssOrderingElement::getStorageValue2 ( int  $ordering_type)

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

300 : int|string
301 {
302 switch ($ordering_type) {
305
306 return $this->getRandomIdentifier() . ':' . $this->getIndentation();
307
310 default:
311 return $this->getPosition() + 1;
312 }
313 }

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

329 : string
330 {
331 return $this->getImagePathFs() . $this->getImageThumbnailPrefix() . $this->getContent();
332 }

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

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

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

339 : bool
340 {
341 if (!$this->getContent()) {
342 return false;
343 }
344
345 return file_exists($this->getImageFilePath());
346 }

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

383 : bool
384 {
385 if (!strlen($ident)) {
386 return false;
387 }
388
389 $parts = explode(self::EXPORT_IDENT_PROPERTY_SEPARATOR, $ident);
390 return
391 count($parts) == 4
396 }
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61

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

218 : ?bool
219 {
221 }

References $imageRemovalRequest.

◆ isImageUploadAvailable()

ilAssOrderingElement::isImageUploadAvailable ( )
Returns
bool

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

209 : bool
210 {
211 return $this->getUploadImageFile() !== null
212 && $this->getUploadImageFile() !== '';
213 }

References getUploadImageFile().

+ Here is the call graph for this function:

◆ isSameElement()

ilAssOrderingElement::isSameElement ( ilAssOrderingElement  $element)

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

270 : bool
271 {
272 return [
273 $this->getRandomIdentifier(),
274 $this->getSolutionIdentifier(),
275 $this->getPosition(),
276 $this->getIndentation(),
277 ] == [
278 $element->getRandomIdentifier(),
279 $element->getSolutionIdentifier(),
280 $element->getPosition(),
281 $element->getIndentation()
282 ];
283 }

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

398 : void
399 {
400 if ($this->isExportIdent($ident)) {
401 list($randomId, $solutionId, $pos, $indent) = explode(
402 self::EXPORT_IDENT_PROPERTY_SEPARATOR,
403 $ident
404 );
405 $this->setRandomIdentifier((int) $randomId);
406 $this->setSolutionIdentifier((int) $solutionId);
407 $this->setPosition((int) $pos);
408 $this->setIndentation((int) $indent);
409 }
410 }
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 ( string  $image_path_fs)

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

255 : void
256 {
257 $this->image_path_fs = $image_path_fs;
258 }

References $image_path_fs.

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

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

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

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

References $imageRemovalRequest.

◆ setImageThumbnailPrefix()

ilAssOrderingElement::setImageThumbnailPrefix (   $imageThumbnailPrefix)

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

265 : void
266 {
267 $this->imageThumbnailPrefix = $imageThumbnailPrefix;
268 }

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

320 : bool
321 {
322 if (!$this->getContent()) {
323 return false;
324 }
325
326 return file_exists($this->getThumbnailFilePath());
327 }

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

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

References $content.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withIndentation()

ilAssOrderingElement::withIndentation ( int  $indentation)

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

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

References $indentation.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withPosition()

ilAssOrderingElement::withPosition ( int  $position)

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

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

References $position.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withRandomIdentifier()

ilAssOrderingElement::withRandomIdentifier ( int  $id)

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

413 : self
414 {
415 $clone = clone $this;
416 $clone->random_identifier = $id;
417 return $clone;
418 }

References $id.

Referenced by assOrderingQuestionTest\testOrderingElementMutation().

+ Here is the caller graph for this function:

◆ withSolutionIdentifier()

ilAssOrderingElement::withSolutionIdentifier ( int  $id)

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

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

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

◆ $image_path_fs

string ilAssOrderingElement::$image_path_fs = 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: