Definition at line 24 of file class.ilBadge.php.
◆ __construct()
ilBadge::__construct |
( |
?int |
$a_id = null , |
|
|
?Container |
$container = null |
|
) |
| |
◆ clone()
ilBadge::clone |
( |
int |
$target_parent_obj_id | ) |
|
Definition at line 121 of file class.ilBadge.php.
121 : void
122 {
125
126 if ($this->
getId()) {
129 $new_collection_id = $this->resource_storage->manage()->clone($current_collection_id);
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 }
Class ResourceIdentification.
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().
◆ copy()
ilBadge::copy |
( |
int |
$a_new_parent_id, |
|
|
string |
$copy_suffix |
|
) |
| |
Definition at line 148 of file class.ilBadge.php.
151 : void {
155
156 if ($this->
getId()) {
160 if ($old_rid !== null) {
164 }
165 }
166 }
setTitle(string $a_value)
◆ create()
◆ delete()
◆ deleteStaticFiles()
ilBadge::deleteStaticFiles |
( |
| ) |
|
◆ getConfiguration()
ilBadge::getConfiguration |
( |
| ) |
|
◆ getCriteria()
◆ getDescription()
ilBadge::getDescription |
( |
| ) |
|
◆ getExtendedTypeCaption()
static ilBadge::getExtendedTypeCaption |
( |
ilBadgeType |
$a_type | ) |
|
|
static |
◆ getFilePath()
ilBadge::getFilePath |
( |
int |
$a_id, |
|
|
?string |
$a_subdir = null |
|
) |
| |
|
protected |
Definition at line 395 of file class.ilBadge.php.
398 : string {
400 $storage->create();
401
402 $path = $storage->getAbsolutePath() .
"/";
403
404 if ($a_subdir) {
405 $path .= $a_subdir .
"/";
406
407 if (!is_dir(
$path)) {
409 }
410 }
411
413 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
References $path.
◆ getId()
◆ getImage()
◆ 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) {
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().
◆ getImageRid()
◆ getInstancesByParentId()
static ilBadge::getInstancesByParentId |
( |
int |
$a_parent_id, |
|
|
?array |
$a_filter = null |
|
) |
| |
|
static |
◆ getInstancesByType()
static ilBadge::getInstancesByType |
( |
string |
$a_type_id | ) |
|
|
static |
- Returns
- self[]
Definition at line 100 of file class.ilBadge.php.
102 : array {
104
106
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);
116 }
117
119 }
References $res.
◆ getObjectInstances()
static ilBadge::getObjectInstances |
( |
?array |
$filter = null | ) |
|
|
static |
- Parameters
-
array{type | string, 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 {
191
193
194 $rows = [];
195
196 $where = '';
197
198 if ($filter['type']) {
200 }
201 if ($filter['title']) {
203 }
204 if ($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' .
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' .
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().
◆ getParentId()
◆ 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 {
543 $parent_title = "";
544 if ($parent_type) {
546 $deleted = false;
547 } else {
548
550 if ($parent["type"]) {
551 $parent_type = $parent["type"];
552 $parent_title = $parent["title"];
553 }
554 $deleted = true;
555 }
556
557 return [
559 "type" => $parent_type,
560 "title" => $parent_title,
561 "deleted" => $deleted
562 ];
563 }
static get(int $a_object_id)
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().
◆ getPropertiesForStorage()
ilBadge::getPropertiesForStorage |
( |
| ) |
|
|
protected |
◆ getTitle()
◆ getTypeId()
◆ getTypeInstance()
ilBadge::getTypeInstance |
( |
| ) |
|
◆ getValid()
◆ importDBRow()
ilBadge::importDBRow |
( |
array |
$a_row | ) |
|
|
protected |
Definition at line 432 of file class.ilBadge.php.
434 : void {
435 $this->
setId($a_row[
"id"]);
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)
◆ importImage()
ilBadge::importImage |
( |
string |
$a_name, |
|
|
string |
$a_file |
|
) |
| |
- Exceptions
-
Definition at line 365 of file class.ilBadge.php.
368 : void {
369 if (file_exists($a_file)) {
372
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()
◆ 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";
580 $json->image = $a_base_url . "image." . $a_img_suffix;
581 $json->criteria = $a_base_url . "criteria.txt";
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);
429 }
430 }
importDBRow(array $a_row)
References $ilDB.
Referenced by __construct().
◆ 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 | ) |
|
◆ 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 | ) |
|
◆ 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()
◆ uploadImage()
ilBadge::uploadImage |
( |
array |
$a_upload_meta | ) |
|
- Exceptions
-
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"]);
350
351 try {
354 }
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().
◆ $active
bool ilBadge::$active = false |
|
protected |
◆ $config
array ilBadge::$config = null |
|
protected |
◆ $criteria
string ilBadge::$criteria = "" |
|
protected |
◆ $db
◆ $desc
string ilBadge::$desc = "" |
|
protected |
◆ $id
◆ $image
string ilBadge::$image = "" |
|
protected |
◆ $image_rid
string ilBadge::$image_rid = null |
|
protected |
◆ $log
◆ $parent_id
int ilBadge::$parent_id = 0 |
|
protected |
◆ $resource_storage
◆ $title
string ilBadge::$title = "" |
|
protected |
◆ $type_id
string ilBadge::$type_id = "" |
|
protected |
◆ $valid
string ilBadge::$valid = "" |
|
protected |
The documentation for this class was generated from the following file: