ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBadge Class Reference
+ Collaboration diagram for ilBadge:

Public Member Functions

 __construct (?int $a_id=null, ?Container $container=null)
 
 clone (int $target_parent_obj_id)
 
 getTypeInstance ()
 
 copy (int $a_new_parent_id, string $copy_suffix)
 
 setId (int $a_id)
 
 getId ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setTypeId (string $a_id)
 
 getTypeId ()
 
 setActive (bool $a_value)
 
 isActive ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 setDescription (string $a_value)
 
 getDescription ()
 
 setCriteria (string $a_value)
 
 getCriteria ()
 
 setValid (string $a_value)
 
 getValid ()
 
 setConfiguration (?array $a_value=null)
 
 getConfiguration ()
 
 setImage (?string $a_value)
 
 getImage ()
 
 uploadImage (array $a_upload_meta)
 
 importImage (string $a_name, string $a_file)
 
 getImagePath (bool $a_full_path=true)
 
 create ()
 
 update ()
 
 delete ()
 
 getParentMeta ()
 
 deleteStaticFiles ()
 
 getImageRid ()
 
 setImageRid (?string $image_rid)
 

Static Public Member Functions

static getInstancesByParentId (int $a_parent_id, ?array $a_filter=null)
 
static getInstancesByType (string $a_type_id)
 
static getObjectInstances (?array $filter=null)
 
static getExtendedTypeCaption (ilBadgeType $a_type)
 

Protected Member Functions

 getFilePath (int $a_id, ?string $a_subdir=null)
 
 read (int $a_id)
 
 importDBRow (array $a_row)
 
 getPropertiesForStorage ()
 
 prepareJson (string $a_base_url, string $a_img_suffix)
 

Protected Attributes

ilDBInterface $db
 
int $id = 0
 
int $parent_id = 0
 
string $type_id = ""
 
bool $active = false
 
string $title = ""
 
string $desc = ""
 
string $image = ""
 
string $image_rid = null
 
string $valid = ""
 
array $config = null
 
string $criteria = ""
 

Private Attributes

ilLogger $log
 
Services $resource_storage
 

Detailed Description

Definition at line 24 of file class.ilBadge.php.

Constructor & Destructor Documentation

◆ __construct()

ilBadge::__construct ( ?int  $a_id = null,
?Container  $container = null 
)

Definition at line 42 of file class.ilBadge.php.

45 {
46
47 if ($container === null) {
48 global $DIC;
50 }
51
52 $this->db = $container->database();
53 $this->resource_storage = $container->resourceStorage();
54 $this->log = $container->logger()->root();
55 if ($a_id) {
56 $this->read($a_id);
57 }
58 }
read(int $a_id)
global $DIC
Definition: shib_login.php:26
$container
@noRector
Definition: wac.php:37

References $container, $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ clone()

ilBadge::clone ( int  $target_parent_obj_id)

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

121 : void
122 {
123 $this->setParentId($target_parent_obj_id);
124 $this->setActive(false);
125
126 if ($this->getId()) {
127 if ($this->getImageRid()) {
128 $current_collection_id = new ResourceIdentification($this->getImageRid());
129 $new_collection_id = $this->resource_storage->manage()->clone($current_collection_id);
130 $this->setId(0);
131 $this->setImageRid($new_collection_id);
132 $this->create();
133 } else {
134 $this->log->warning('Please run the "Migration of files of badges to the resource storage service" job, before working with badges.');
135 }
136 }
137 }
setId(int $a_id)
setActive(bool $a_value)
setParentId(int $a_id)
setImageRid(?string $image_rid)

References ILIAS\Survey\Mode\getId().

Referenced by ILIAS\UI\Implementation\Component\Table\Presentation\getCollapseAllSignal(), ILIAS\UI\Implementation\Component\Table\Presentation\getExpandAllSignal(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withAction(), ILIAS\UI\Implementation\Component\Table\AbstractTable\withActions(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withContent(), ILIAS\UI\Implementation\Component\Table\Presentation\withData(), ILIAS\UI\Implementation\Component\Table\DataRow\withDisabledAction(), ILIAS\UI\Implementation\Component\Table\Presentation\withEnvironment(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withFurtherFields(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withFurtherFieldsHeadline(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withHeadline(), ILIAS\UI\Implementation\Component\Table\AbstractTable\withId(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withImportantFields(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withLeadingSymbol(), ILIAS\UI\Implementation\Component\Table\Ordering\withOrderingDisabled(), ILIAS\UI\Implementation\Component\Table\OrderingRow\withOrderingDisabled(), ILIAS\UI\Implementation\Component\Table\OrderingRow\withPosition(), ILIAS\UI\Implementation\Component\Table\AbstractTable\withRequest(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withResetSignals(), ILIAS\UI\Implementation\Component\Table\Presentation\withRowMapping(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withSubheadline(), and ILIAS\UI\Implementation\Component\Table\Table\withTitle().

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

◆ copy()

ilBadge::copy ( int  $a_new_parent_id,
string  $copy_suffix 
)

Definition at line 148 of file class.ilBadge.php.

151 : void {
152 $this->setTitle($this->getTitle() . " " . $copy_suffix);
153 $this->setParentId($a_new_parent_id);
154 $this->setActive(false);
155
156 if ($this->getId()) {
157 $this->setId(0);
158 $old_rid = $this->getImageRid();
159 $this->create();
160 if ($old_rid !== null) {
161 $new_rid = $this->resource_storage->manage()->clone(new ResourceIdentification($old_rid));
162 $this->setImageRid($new_rid);
163 $this->update();
164 }
165 }
166 }
setTitle(string $a_value)

◆ create()

ilBadge::create ( )

Definition at line 450 of file class.ilBadge.php.

450 : void
451 {
453
454 if ($this->getId()) {
455 $this->update();
456 return;
457 }
458
459 $id = $ilDB->nextId("badge_badge");
460 $this->setId($id);
461
462 $fields = $this->getPropertiesForStorage();
463
464 $fields["id"] = ["integer", $id];
465 $fields["parent_id"] = ["integer", $this->getParentId()];
466 $fields["type_id"] = ["text", $this->getTypeId()];
467
468 $ilDB->insert("badge_badge", $fields);
469 }
ilDBInterface $db
getPropertiesForStorage()

References $id, $ilDB, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ delete()

ilBadge::delete ( )

Definition at line 489 of file class.ilBadge.php.

489 : void
490 {
492
493 if (!$this->getId()) {
494 return;
495 }
496
497 if ($this->getImageRid()) {
498 try {
499 $this->resource_storage->manage()->remove(new ResourceIdentification($this->getImageRid()), new ilBadgeFileStakeholder());
500 } catch (Exception $e) {
501 $this->log->warning(sprintf('There was an exception, while deleting the badge with id %s. Exception: %s', $this->getId(), $e->getMessage()));
502 }
503 }
504
505 $this->deleteStaticFiles();
506
508
509 $ilDB->manipulate("DELETE FROM badge_badge" .
510 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
511 }
static deleteByBadgeId(int $a_badge_id)
deleteStaticFiles()

References Vendor\Package\$e, $ilDB, ilBadgeAssignment\deleteByBadgeId(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteStaticFiles()

ilBadge::deleteStaticFiles ( )

Definition at line 588 of file class.ilBadge.php.

588 : void
589 {
590 // remove instance files
591 $path = ilBadgeHandler::getInstance()->getBadgePath($this);
592 if (is_dir($path)) {
594 }
595 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$path
Definition: ltiservices.php:30

References $path, ilFileUtils\delDir(), and ilBadgeHandler\getInstance().

+ Here is the call graph for this function:

◆ getConfiguration()

ilBadge::getConfiguration ( )

Definition at line 323 of file class.ilBadge.php.

323 : ?array
324 {
325 return $this->config;
326 }
array $config

◆ getCriteria()

ilBadge::getCriteria ( )

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

300 : string
301 {
302 return $this->criteria;
303 }
string $criteria

Referenced by ILIAS\Badge\Tile\modalContent().

+ Here is the caller graph for this function:

◆ getDescription()

ilBadge::getDescription ( )

Definition at line 290 of file class.ilBadge.php.

290 : string
291 {
292 return $this->desc;
293 }
string $desc

◆ getExtendedTypeCaption()

static ilBadge::getExtendedTypeCaption ( ilBadgeType  $a_type)
static

Definition at line 597 of file class.ilBadge.php.

599 : string {
600 global $DIC;
601
602 $lng = $DIC->language();
603
604 return $a_type->getCaption() . " (" .
605 ($a_type instanceof ilBadgeAuto
606 ? $lng->txt("badge_subtype_auto")
607 : $lng->txt("badge_subtype_manual")) . ")";
608 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $lng
Definition: privfeed.php:31

Referenced by ILIAS\Badge\ilBadgeTableGUI\getRecords(), ILIAS\Badge\ilObjectBadgeTableGUI\getRecords(), and ilBadgeManagementGUI\listBadges().

+ Here is the caller graph for this function:

◆ getFilePath()

ilBadge::getFilePath ( int  $a_id,
?string  $a_subdir = null 
)
protected

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

398 : string {
399 $storage = new ilFSStorageBadge($a_id);
400 $storage->create();
401
402 $path = $storage->getAbsolutePath() . "/";
403
404 if ($a_subdir) {
405 $path .= $a_subdir . "/";
406
407 if (!is_dir($path)) {
408 mkdir($path);
409 }
410 }
411
412 return $path;
413 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $path.

◆ getId()

ilBadge::getId ( )

Definition at line 240 of file class.ilBadge.php.

240 : int
241 {
242 return $this->id;
243 }

References $id.

Referenced by ilBadgeHandler\countStaticBadgeInstances(), ilBadgeHandler\getBadgePath(), and ILIAS\Badge\Tile\profileButton().

+ Here is the caller graph for this function:

◆ getImage()

ilBadge::getImage ( )

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

335 : string
336 {
337 return $this->image;
338 }
string $image

◆ getImagePath()

ilBadge::getImagePath ( bool  $a_full_path = true)

Definition at line 379 of file class.ilBadge.php.

381 : string {
382 if ($this->getId()) {
383 $exp = explode(".", $this->getImage());
384 $suffix = strtolower(array_pop($exp));
385 if ($a_full_path) {
386 return $this->getFilePath($this->getId()) . "img" . $this->getId() . "." . $suffix;
387 }
388
389 return "img" . $this->getId() . "." . $suffix;
390 }
391
392 return "";
393 }
getFilePath(int $a_id, ?string $a_subdir=null)

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getImageRid()

ilBadge::getImageRid ( )

Definition at line 610 of file class.ilBadge.php.

610 : ?string
611 {
612 return $this->image_rid;
613 }
string $image_rid

Referenced by ILIAS\Badge\ilBadgeImage\getImageFromResourceId(), and ilBadgeManagementGUI\removeResourceStorageImage().

+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilBadge::getInstancesByParentId ( int  $a_parent_id,
?array  $a_filter = null 
)
static
Parameters
array | null$a_filter
Returns
self[]

Definition at line 64 of file class.ilBadge.php.

67 : array {
68 global $DIC;
69
70 $ilDB = $DIC->database();
71
72 $res = [];
73
74 $sql = "SELECT * FROM badge_badge" .
75 " WHERE parent_id = " . $ilDB->quote($a_parent_id);
76
77 if ($a_filter) {
78 if ($a_filter["title"] ?? false) {
79 $sql .= " AND " . $ilDB->like("title", "text", "%" . trim($a_filter["title"]) . "%");
80 }
81 if ($a_filter["type"] ?? false) {
82 $sql .= " AND type_id = " . $ilDB->quote($a_filter["type"], "integer");
83 }
84 }
85
86 $set = $ilDB->query($sql .
87 " ORDER BY title");
88 while ($row = $ilDB->fetchAssoc($set)) {
89 $obj = new self();
90 $obj->importDBRow($row);
91 $res[] = $obj;
92 }
93
94 return $res;
95 }
$res
Definition: ltiservices.php:69

References $ilDB.

Referenced by ilObjCourse\cloneObject(), ilBadgeManagementGUI\confirmDeleteBadges(), ILIAS\Badge\ilBadgeTableGUI\getRecords(), and ilBadgeManagementGUI\toggleBadges().

+ Here is the caller graph for this function:

◆ getInstancesByType()

static ilBadge::getInstancesByType ( string  $a_type_id)
static
Returns
self[]

Definition at line 100 of file class.ilBadge.php.

102 : array {
103 global $DIC;
104
105 $ilDB = $DIC->database();
106
107 $res = [];
108
109 $set = $ilDB->query("SELECT * FROM badge_badge" .
110 " WHERE type_id = " . $ilDB->quote($a_type_id, "text") .
111 " ORDER BY title");
112 while ($row = $ilDB->fetchAssoc($set)) {
113 $obj = new self();
114 $obj->importDBRow($row);
115 $res[] = $obj;
116 }
117
118 return $res;
119 }

References $res.

◆ getObjectInstances()

static ilBadge::getObjectInstances ( ?array  $filter = null)
static
Parameters
array{typestring, title: string, object: string}|null $filter
Returns
list<array{ id: int, parent_id: int, type_id: string, active: int, title: ?string, descr: ?string, conf: ?string, image: ?string, valid: ?string, crit: ?string, image_rid: ?string, parent_title: ?string, parent_type: ?string, deleted: bool }>

Definition at line 187 of file class.ilBadge.php.

189 : array {
190 global $DIC;
191
192 $ilDB = $DIC->database();
193
194 $rows = [];
195
196 $where = '';
197
198 if ($filter['type']) {
199 $where .= ' AND bb.type_id = ' . $ilDB->quote($filter['type'], ilDBConstants::T_TEXT);
200 }
201 if ($filter['title']) {
202 $where .= ' AND ' . $ilDB->like('bb.title', ilDBConstants::T_TEXT, '%' . $filter['title'] . '%');
203 }
204 if ($filter['object']) {
205 $where .= ' AND ' . $ilDB->like('od.title', ilDBConstants::T_TEXT, '%' . $filter['object'] . '%');
206 }
207
208 $set = $ilDB->query('SELECT bb.*, od.title parent_title, od.type parent_type' .
209 ' FROM badge_badge bb' .
210 ' INNER JOIN object_data od ON bb.parent_id = od.obj_id' .
211 ' WHERE od.type != ' . $ilDB->quote('bdga', ilDBConstants::T_TEXT) .
212 $where);
213 while ($row = $ilDB->fetchAssoc($set)) {
214 $row['deleted'] = false;
215 $rows[] = $row;
216 }
217
218 $set = $ilDB->query('SELECT bb.*, od.title parent_title, od.type parent_type' .
219 ' FROM badge_badge bb' .
220 ' INNER JOIN object_data_del od ON bb.parent_id = od.obj_id' .
221 ' WHERE od.type != ' . $ilDB->quote('bdga', ilDBConstants::T_TEXT) .
222 $where);
223 while ($row = $ilDB->fetchAssoc($set)) {
224 $row['deleted'] = true;
225 $rows[] = $row;
226 }
227
228 return $rows;
229 }

References $ilDB, and ilDBConstants\T_TEXT.

Referenced by ilObjBadgeAdministrationGUI\confirmDeleteObjectBadges(), ILIAS\Badge\ilObjectBadgeTableGUI\getRecords(), ILIAS\Badge\ilObjectBadgeTableGUI\renderTable(), and ilObjBadgeAdministrationGUI\toggleObjectBadges().

+ Here is the caller graph for this function:

◆ getParentId()

ilBadge::getParentId ( )

Definition at line 250 of file class.ilBadge.php.

250 : int
251 {
252 return $this->parent_id;
253 }
int $parent_id

Referenced by ILIAS\Badge\BadgeParent\metaData().

+ Here is the caller graph for this function:

◆ getParentMeta()

ilBadge::getParentMeta ( )
Returns
array{id: int, type: string, title: string, deleted: bool}

Definition at line 540 of file class.ilBadge.php.

540 : array
541 {
542 $parent_type = ilObject::_lookupType($this->getParentId());
543 $parent_title = "";
544 if ($parent_type) {
545 $parent_title = ilObject::_lookupTitle($this->getParentId());
546 $deleted = false;
547 } else {
548 // already deleted?
549 $parent = ilObjectDataDeletionLog::get($this->getParentId());
550 if ($parent["type"]) {
551 $parent_type = $parent["type"];
552 $parent_title = $parent["title"];
553 }
554 $deleted = true;
555 }
556
557 return [
558 "id" => $this->getParentId(),
559 "type" => $parent_type,
560 "title" => $parent_title,
561 "deleted" => $deleted
562 ];
563 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle(), ilObject\_lookupType(), and ilObjectDataDeletionLog\get().

Referenced by ILIAS\Badge\BadgeParent\metaData().

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

◆ getPropertiesForStorage()

ilBadge::getPropertiesForStorage ( )
protected
Returns
array<string, array>

Definition at line 516 of file class.ilBadge.php.

516 : array
517 {
518 return [
519 "active" => ["integer", $this->isActive()],
520 "title" => ["text", $this->getTitle()],
521 "descr" => ["text", $this->getDescription()],
522 "crit" => ["text", $this->getCriteria()],
523 "image" => ["text", $this->getImage()],
524 "image_rid" => ["text", $this->getImageRid()],
525 "valid" => ["text", $this->getValid()],
526 "conf" => [
527 "text", $this->getConfiguration() ? serialize($this->getConfiguration()) : null
528 ]
529 ];
530 }
getConfiguration()

References ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ getTitle()

ilBadge::getTitle ( )

Definition at line 280 of file class.ilBadge.php.

280 : string
281 {
282 return $this->title;
283 }
string $title

Referenced by ILIAS\Badge\Tile\image(), and ILIAS\Badge\Tile\title().

+ Here is the caller graph for this function:

◆ getTypeId()

ilBadge::getTypeId ( )

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

260 : string
261 {
262 return $this->type_id;
263 }
string $type_id

◆ getTypeInstance()

ilBadge::getTypeInstance ( )

Definition at line 139 of file class.ilBadge.php.

139 : ?ilBadgeType
140 {
141 if ($this->getTypeId()) {
143 return $handler->getTypeInstanceByUniqueId($this->getTypeId());
144 }
145 return null;
146 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$handler
Definition: oai.php:29

References $handler, and ilBadgeHandler\getInstance().

+ Here is the call graph for this function:

◆ getValid()

ilBadge::getValid ( )

Definition at line 310 of file class.ilBadge.php.

310 : string
311 {
312 return $this->valid;
313 }
string $valid

References $valid.

Referenced by ILIAS\Badge\Tile\modalContent().

+ Here is the caller graph for this function:

◆ importDBRow()

ilBadge::importDBRow ( array  $a_row)
protected

Definition at line 432 of file class.ilBadge.php.

434 : void {
435 $this->setId($a_row["id"]);
436 $this->setParentId($a_row["parent_id"]);
437 $this->setTypeId($a_row["type_id"]);
438 $this->setActive($a_row["active"]);
439 $this->setTitle($a_row["title"]);
440 $this->setDescription($a_row["descr"]);
441 $this->setCriteria($a_row["crit"]);
442 $this->setImage($a_row["image"]);
443 $this->setImageRid($a_row["image_rid"]);
444 $this->setValid($a_row["valid"]);
445 $this->setConfiguration($a_row["conf"]
446 ? unserialize($a_row["conf"], ["allowed_classes" => false])
447 : null);
448 }
setCriteria(string $a_value)
setImage(?string $a_value)
setValid(string $a_value)
setConfiguration(?array $a_value=null)
setDescription(string $a_value)
setTypeId(string $a_id)

◆ importImage()

ilBadge::importImage ( string  $a_name,
string  $a_file 
)
Exceptions
BadgeException

Definition at line 365 of file class.ilBadge.php.

368 : void {
369 if (file_exists($a_file)) {
370 $this->setImage($a_name);
371 copy($a_file, $this->getImagePath()); // #18280
372
373 $this->update();
374 } else {
375 throw BadgeException::uploadedBadgeImageFileNotFound($this);
376 }
377 }
getImagePath(bool $a_full_path=true)
copy(int $a_new_parent_id, string $copy_suffix)

◆ isActive()

ilBadge::isActive ( )

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

270 : bool
271 {
272 return $this->active;
273 }
bool $active

◆ prepareJson()

ilBadge::prepareJson ( string  $a_base_url,
string  $a_img_suffix 
)
protected

Definition at line 570 of file class.ilBadge.php.

573 : stdClass {
574 $json = new stdClass();
575 $json->{"@context"} = "https://w3id.org/openbadges/v1";
576 $json->type = "BadgeClass";
577 $json->id = $a_base_url . "class.json";
578 $json->name = $this->getTitle();
579 $json->description = $this->getDescription();
580 $json->image = $a_base_url . "image." . $a_img_suffix;
581 $json->criteria = $a_base_url . "criteria.txt";
582 $json->issuer = ilBadgeHandler::getInstance()->getIssuerStaticUrl();
583
584 return $json;
585 }

◆ read()

ilBadge::read ( int  $a_id)
protected

Definition at line 420 of file class.ilBadge.php.

420 : void
421 {
423
424 $set = $ilDB->query("SELECT * FROM badge_badge" .
425 " WHERE id = " . $ilDB->quote($a_id, "integer"));
426 if ($ilDB->numRows($set)) {
427 $row = $ilDB->fetchAssoc($set);
428 $this->importDBRow($row);
429 }
430 }
importDBRow(array $a_row)

References $ilDB.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setActive()

ilBadge::setActive ( bool  $a_value)

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

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

◆ setConfiguration()

ilBadge::setConfiguration ( ?array  $a_value = null)

Definition at line 315 of file class.ilBadge.php.

315 : void
316 {
317 if (is_array($a_value) && !count($a_value)) {
318 $a_value = null;
319 }
320 $this->config = $a_value;
321 }

◆ setCriteria()

ilBadge::setCriteria ( string  $a_value)

Definition at line 295 of file class.ilBadge.php.

295 : void
296 {
297 $this->criteria = trim($a_value);
298 }

◆ setDescription()

ilBadge::setDescription ( string  $a_value)

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

285 : void
286 {
287 $this->desc = trim($a_value);
288 }

◆ setId()

ilBadge::setId ( int  $a_id)

Definition at line 235 of file class.ilBadge.php.

235 : void
236 {
237 $this->id = $a_id;
238 }

◆ setImage()

ilBadge::setImage ( ?string  $a_value)

Definition at line 328 of file class.ilBadge.php.

328 : void
329 {
330 if ($a_value !== null) {
331 $this->image = trim($a_value);
332 }
333 }

◆ setImageRid()

ilBadge::setImageRid ( ?string  $image_rid)

Definition at line 615 of file class.ilBadge.php.

615 : void
616 {
617 $this->image_rid = $image_rid;
618 }

Referenced by ilBadgeManagementGUI\cloneBadgeTemplate(), and ILIAS\Badge\ilBadgeImage\processImageUpload().

+ Here is the caller graph for this function:

◆ setParentId()

ilBadge::setParentId ( int  $a_id)

Definition at line 245 of file class.ilBadge.php.

245 : void
246 {
247 $this->parent_id = $a_id;
248 }

◆ setTitle()

ilBadge::setTitle ( string  $a_value)

Definition at line 275 of file class.ilBadge.php.

275 : void
276 {
277 $this->title = trim($a_value);
278 }

◆ setTypeId()

ilBadge::setTypeId ( string  $a_id)

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

255 : void
256 {
257 $this->type_id = trim($a_id);
258 }

◆ setValid()

ilBadge::setValid ( string  $a_value)

Definition at line 305 of file class.ilBadge.php.

305 : void
306 {
307 $this->valid = trim($a_value);
308 }

◆ update()

ilBadge::update ( )

Definition at line 471 of file class.ilBadge.php.

471 : void
472 {
474
475 if (!$this->getId()) {
476 $this->create();
477 return;
478 }
479
480 $fields = $this->getPropertiesForStorage();
481
482 $ilDB->update(
483 "badge_badge",
484 $fields,
485 ["id" => ["integer", $this->getId()]]
486 );
487 }

References $ilDB, and ILIAS\Survey\Mode\getId().

Referenced by ilBadgeManagementGUI\cloneBadgeTemplate(), and ILIAS\Badge\ilBadgeImage\processImageUpload().

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

◆ uploadImage()

ilBadge::uploadImage ( array  $a_upload_meta)
Exceptions
BadgeException

Definition at line 343 of file class.ilBadge.php.

345 : void {
346 if ($this->getId() &&
347 $a_upload_meta["tmp_name"]) {
348 $this->setImage($a_upload_meta["name"]);
349 $path = $this->getImagePath();
350
351 try {
352 if (ilFileUtils::moveUploadedFile($a_upload_meta['tmp_name'], $this->getImagePath(false), $path)) {
353 $this->update();
354 }
355 } catch (ilException $e) {
356 throw BadgeException::moveUploadedBadgeImageFailed($this, $e);
357 }
358
359 }
360 }
Base class for ILIAS Exception handling.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file

References Vendor\Package\$e, $path, and ilFileUtils\moveUploadedFile().

+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilBadge::$active = false
protected

Definition at line 31 of file class.ilBadge.php.

◆ $config

array ilBadge::$config = null
protected

Definition at line 37 of file class.ilBadge.php.

◆ $criteria

string ilBadge::$criteria = ""
protected

Definition at line 38 of file class.ilBadge.php.

◆ $db

ilDBInterface ilBadge::$db
protected

Definition at line 27 of file class.ilBadge.php.

◆ $desc

string ilBadge::$desc = ""
protected

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

◆ $id

int ilBadge::$id = 0
protected

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

◆ $image

string ilBadge::$image = ""
protected

Definition at line 34 of file class.ilBadge.php.

◆ $image_rid

string ilBadge::$image_rid = null
protected

Definition at line 35 of file class.ilBadge.php.

◆ $log

ilLogger ilBadge::$log
private

Definition at line 26 of file class.ilBadge.php.

◆ $parent_id

int ilBadge::$parent_id = 0
protected

Definition at line 29 of file class.ilBadge.php.

◆ $resource_storage

Services ilBadge::$resource_storage
private

Definition at line 40 of file class.ilBadge.php.

◆ $title

string ilBadge::$title = ""
protected

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

◆ $type_id

string ilBadge::$type_id = ""
protected

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

◆ $valid

string ilBadge::$valid = ""
protected

Definition at line 36 of file class.ilBadge.php.


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