ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBadge Class Reference

Class ilBadge. More...

+ Collaboration diagram for ilBadge:

Public Member Functions

 __construct ($a_id=null)
 Constructor. More...
 
 clone (int $target_parent_obj_id)
 
 getTypeInstance ()
 
 copy ($a_new_parent_id)
 
 getId ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setTypeId ($a_id)
 
 getTypeId ()
 
 setActive ($a_value)
 
 isActive ()
 
 setTitle ($a_value)
 
 getTitle ()
 
 setDescription ($a_value)
 
 getDescription ()
 
 setCriteria ($a_value)
 
 getCriteria ()
 
 setValid ($a_value)
 
 getValid ()
 
 setConfiguration (array $a_value=null)
 
 getConfiguration ()
 
 getImage ()
 
 uploadImage (array $a_upload_meta)
 
 importImage ($a_name, $a_file)
 
 getImagePath ($a_full_path=true)
 
 create ()
 
 update ()
 
 delete ()
 
 getParentMeta ()
 
 getStaticUrl ()
 
 deleteStaticFiles ()
 

Static Public Member Functions

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

Protected Member Functions

 setId ($a_id)
 
 setImage ($a_value)
 
 getFilePath ($a_id, $a_subdir=null)
 Init file system storage. More...
 
 read ($a_id)
 
 importDBRow (array $a_row)
 
 getPropertiesForStorage ()
 
 prepareJson ($a_base_url, $a_img_suffix)
 

Protected Attributes

 $lng
 
 $db
 
 $id
 
 $parent_id
 
 $type_id
 
 $active
 
 $title
 
 $desc
 
 $image
 
 $valid
 
 $config
 
 $criteria
 

Detailed Description

Class ilBadge.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilBadge::__construct (   $a_id = null)

Constructor.

Parameters
int$a_id
Returns
self

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

40 {
41 global $DIC;
42
43 $this->lng = $DIC->language();
44 $this->db = $DIC->database();
45 if ($a_id) {
46 $this->read($a_id);
47 }
48 }
read($a_id)
global $DIC
Definition: goto.php:24

References $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 101 of file class.ilBadge.php.

101 : void
102 {
103 $this->setParentId($target_parent_obj_id);
104 $this->setActive(false);
105
106 if ($this->getId()) {
107 $img = $this->getImagePath();
108
109 $this->setId(0);
110 $this->create();
111
112 if ($img) {
113 // see uploadImage()
114 copy($img, $this->getImagePath());
115 }
116 }
117 }
copy($a_new_parent_id)
getImagePath($a_full_path=true)
setParentId($a_id)
setActive($a_value)
setId($a_id)
$img
Definition: imgupload.php:57

References $img, copy(), create(), getId(), getImagePath(), setActive(), setId(), and setParentId().

Referenced by ILIAS\UI\Implementation\Component\Table\PresentationRow\withAction(), ILIAS\UI\Implementation\Component\Table\PresentationRow\withContent(), ILIAS\UI\Implementation\Component\Table\Presentation\withData(), 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\PresentationRow\withImportantFields(), 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 (   $a_new_parent_id)

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

128 {
130
131 $this->setTitle($this->getTitle() . " " . $lng->txt("copy_of_suffix"));
132 $this->setParentId($a_new_parent_id);
133 $this->setActive(false);
134
135 if ($this->getId()) {
136 $img = $this->getImagePath();
137
138 $this->setId(null);
139 $this->create();
140
141 if ($img) {
142 // see uploadImage()
143 copy($img, $this->getImagePath());
144 }
145 }
146 }
setTitle($a_value)

References $img, $lng, copy(), create(), getId(), getImagePath(), getTitle(), setActive(), setId(), setParentId(), and setTitle().

Referenced by clone(), copy(), and importImage().

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

◆ create()

ilBadge::create ( )

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

403 {
405
406 if ($this->getId()) {
407 return $this->update();
408 }
409
410 $id = $ilDB->nextId("badge_badge");
411 $this->setId($id);
412
413 $fields = $this->getPropertiesForStorage();
414
415 $fields["id"] = array("integer", $id);
416 $fields["parent_id"] = array("integer", $this->getParentId());
417 $fields["type_id"] = array("text", $this->getTypeId());
418
419 $ilDB->insert("badge_badge", $fields);
420 }
getPropertiesForStorage()
global $ilDB

References $db, $id, $ilDB, getId(), getParentId(), getPropertiesForStorage(), getTypeId(), setId(), and update().

Referenced by clone(), copy(), and update().

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

◆ delete()

ilBadge::delete ( )

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

440 {
442
443 if (!$this->getId()) {
444 return;
445 }
446
447 if (file_exists($this->getImagePath())) {
448 unlink($this->getImagePath());
449 }
450
451 $this->deleteStaticFiles();
452
454
455 $ilDB->manipulate("DELETE FROM badge_badge" .
456 " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
457 }
static deleteByBadgeId($a_badge_id)
deleteStaticFiles()

References $db, $ilDB, ilBadgeAssignment\deleteByBadgeId(), deleteStaticFiles(), getId(), and getImagePath().

+ Here is the call graph for this function:

◆ deleteStaticFiles()

ilBadge::deleteStaticFiles ( )

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

545 {
546 // remove instance files
547 $path = ilBadgeHandler::getInstance()->getBadgePath($this);
548 if (is_dir($path)) {
549 ilUtil::delDir($path);
550 }
551 }
static getInstance()
Constructor.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References ilUtil\delDir(), and ilBadgeHandler\getInstance().

Referenced by delete().

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

◆ getConfiguration()

ilBadge::getConfiguration ( )

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

291 {
292 return $this->config;
293 }

References $config.

Referenced by getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ getCriteria()

ilBadge::getCriteria ( )

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

267 {
268 return $this->criteria;
269 }

References $criteria.

Referenced by getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ getDescription()

ilBadge::getDescription ( )

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

257 {
258 return $this->desc;
259 }

References $desc.

Referenced by getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ getExtendedTypeCaption()

static ilBadge::getExtendedTypeCaption ( ilBadgeType  $a_type)
static

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

554 {
555 global $DIC;
556
557 $lng = $DIC->language();
558
559 return $a_type->getCaption() . " (" .
560 ($a_type instanceof ilBadgeAuto
561 ? $lng->txt("badge_subtype_auto")
562 : $lng->txt("badge_subtype_manual")) . ")";
563 }
Manual Badge Auto.
getCaption()
Get caption.

References $DIC, $lng, and ilBadgeType\getCaption().

Referenced by ilBadgeTableGUI\getItems(), ilBadgeUserTableGUI\getItems(), ilObjectBadgeTableGUI\getItems(), ilBadgeTableGUI\initFilter(), ilObjectBadgeTableGUI\initFilter(), and ilBadgeManagementGUI\listBadges().

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

◆ getFilePath()

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

Init file system storage.

Parameters
type$a_id
type$a_subdir
Returns
string

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

352 {
353 $storage = new ilFSStorageBadge($a_id);
354 $storage->create();
355
356 $path = $storage->getAbsolutePath() . "/";
357
358 if ($a_subdir) {
359 $path .= $a_subdir . "/";
360
361 if (!is_dir($path)) {
362 mkdir($path);
363 }
364 }
365
366 return $path;
367 }

Referenced by getImagePath().

+ Here is the caller graph for this function:

◆ getId()

ilBadge::getId ( )

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

207 {
208 return $this->id;
209 }

References $id.

Referenced by clone(), copy(), ilBadgeHandler\countStaticBadgeInstances(), create(), delete(), ilBadgeHandler\getBadgePath(), getImagePath(), update(), and uploadImage().

+ Here is the caller graph for this function:

◆ getImage()

ilBadge::getImage ( )

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

301 {
302 return $this->image;
303 }

References $image.

Referenced by getImagePath(), getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ getImagePath()

ilBadge::getImagePath (   $a_full_path = true)

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

333 {
334 if ($this->getId()) {
335 $suffix = strtolower(array_pop(explode(".", $this->getImage())));
336 if ($a_full_path) {
337 return $this->getFilePath($this->getId()) . "img" . $this->getId() . "." . $suffix;
338 } else {
339 return "img" . $this->getId() . "." . $suffix;
340 }
341 }
342 }
getFilePath($a_id, $a_subdir=null)
Init file system storage.

References getFilePath(), getId(), and getImage().

Referenced by clone(), copy(), delete(), ilBadgeAssignment\getImagePath(), importImage(), ilBadgeManagementGUI\setBadgeFormValues(), and uploadImage().

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

◆ getInstancesByParentId()

static ilBadge::getInstancesByParentId (   $a_parent_id,
array  $a_filter = null 
)
static

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

51 {
52 global $DIC;
53
54 $ilDB = $DIC->database();
55
56 $res = array();
57
58 $sql = "SELECT * FROM badge_badge" .
59 " WHERE parent_id = " . $ilDB->quote($a_parent_id);
60
61 if ($a_filter) {
62 if ($a_filter["title"]) {
63 $sql .= " AND " . $ilDB->like("title", "text", "%" . trim($a_filter["title"]) . "%");
64 }
65 if ($a_filter["type"]) {
66 $sql .= " AND type_id = " . $ilDB->quote($a_filter["type"], "integer");
67 }
68 }
69
70 $set = $ilDB->query($sql .
71 " ORDER BY title");
72 while ($row = $ilDB->fetchAssoc($set)) {
73 $obj = new self();
74 $obj->importDBRow($row);
75 $res[] = $obj;
76 }
77
78 return $res;
79 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, and $res.

Referenced by ilObjCourse\cloneObject(), ilBadgeHandler\getAvailableManualBadges(), ilBadgeAssignment\getInstancesByParentId(), ilBadgeTableGUI\getItems(), and ilBadgeUserTableGUI\getItems().

+ Here is the caller graph for this function:

◆ getInstancesByType()

static ilBadge::getInstancesByType (   $a_type_id)
static

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

82 {
83 global $DIC;
84
85 $ilDB = $DIC->database();
86
87 $res = array();
88
89 $set = $ilDB->query("SELECT * FROM badge_badge" .
90 " WHERE type_id = " . $ilDB->quote($a_type_id) .
91 " ORDER BY title");
92 while ($row = $ilDB->fetchAssoc($set)) {
93 $obj = new self();
94 $obj->importDBRow($row);
95 $res[] = $obj;
96 }
97
98 return $res;
99 }

References $DIC, $ilDB, and $res.

Referenced by ilBadgeHandler\triggerEvaluation().

+ Here is the caller graph for this function:

◆ getObjectInstances()

static ilBadge::getObjectInstances ( array  $a_filter = null)
static

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

149 {
150 global $DIC;
151
152 $ilDB = $DIC->database();
153
154 $res = $raw = array();
155
156 $where = "";
157
158 if ($a_filter["type"]) {
159 $where .= " AND bb.type_id = " . $ilDB->quote($a_filter["type"], "text");
160 }
161 if ($a_filter["title"]) {
162 $where .= " AND " . $ilDB->like("bb.title", "text", "%" . $a_filter["title"] . "%");
163 }
164 if ($a_filter["object"]) {
165 $where .= " AND " . $ilDB->like("od.title", "text", "%" . $a_filter["object"] . "%");
166 }
167
168 $set = $ilDB->query("SELECT bb.*, od.title parent_title, od.type parent_type" .
169 " FROM badge_badge bb" .
170 " JOIN object_data od ON (bb.parent_id = od.obj_id)" .
171 " WHERE od.type <> " . $ilDB->quote("bdga", "text") .
172 $where);
173 while ($row = $ilDB->fetchAssoc($set)) {
174 $raw[] = $row;
175 }
176
177 $set = $ilDB->query("SELECT bb.*, od.title parent_title, od.type parent_type" .
178 " FROM badge_badge bb" .
179 " JOIN object_data_del od ON (bb.parent_id = od.obj_id)" .
180 " WHERE od.type <> " . $ilDB->quote("bdga", "text") .
181 $where);
182 while ($row = $ilDB->fetchAssoc($set)) {
183 $row["deleted"] = true;
184 $raw[] = $row;
185 }
186
187 foreach ($raw as $row) {
188 // :TODO:
189
190 $res[] = $row;
191 }
192
193 return $res;
194 }

References $DIC, $ilDB, and $res.

Referenced by ilObjectBadgeTableGUI\getItems().

+ Here is the caller graph for this function:

◆ getParentId()

ilBadge::getParentId ( )

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

217 {
218 return $this->parent_id;
219 }

References $parent_id.

Referenced by create(), and getParentMeta().

+ Here is the caller graph for this function:

◆ getParentMeta()

ilBadge::getParentMeta ( )

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

480 {
481 $parent_type = ilObject::_lookupType($this->getParentId());
482 if ($parent_type) {
483 $parent_title = ilObject::_lookupTitle($this->getParentId());
484 $deleted = false;
485 } else {
486 // already deleted?
487 $parent = ilObjectDataDeletionLog::get($this->getParentId());
488 if ($parent["type"]) {
489 $parent_type = $parent["type"];
490 $parent_title = $parent["title"];
491 }
492 $deleted = true;
493 }
494
495 return array(
496 "id" => $this->getParentId(),
497 "type" => $parent_type,
498 "title" => $parent_title,
499 "deleted" => $deleted
500 );
501 }
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type

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

+ Here is the call graph for this function:

◆ getPropertiesForStorage()

ilBadge::getPropertiesForStorage ( )
protected

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

460 {
461 return array(
462 "active" => array("integer", $this->isActive()),
463 "title" => array("text", $this->getTitle()),
464 "descr" => array("text", $this->getDescription()),
465 "crit" => array("text", $this->getCriteria()),
466 "image" => array("text", $this->getImage()),
467 "valid" => array("text", $this->getValid()),
468 "conf" => array("text", $this->getConfiguration()
469 ? serialize($this->getConfiguration())
470 : null)
471 );
472 }
getConfiguration()

References getConfiguration(), getCriteria(), getDescription(), getImage(), getTitle(), getValid(), and isActive().

Referenced by create(), and update().

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

◆ getStaticUrl()

ilBadge::getStaticUrl ( )

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

524 {
525 $path = ilBadgeHandler::getInstance()->getBadgePath($this);
526
527 $base_url = ILIAS_HTTP_PATH . substr($path, 1);
528
529 if (!file_exists($path . "class.json")) {
530 $img_suffix = array_pop(explode(".", $this->getImage()));
531
532 $json = json_encode($this->prepareJson($base_url, $img_suffix));
533 file_put_contents($path . "class.json", $json);
534
535 // :TODO: scale?
536 copy($this->getImagePath(), $path . "image." . $img_suffix);
537
538 file_put_contents($path . "criteria.txt", $this->getCriteria());
539 }
540
541 return $base_url . "class.json";
542 }
prepareJson($a_base_url, $a_img_suffix)

References ilBadgeHandler\getInstance().

+ Here is the call graph for this function:

◆ getTitle()

ilBadge::getTitle ( )

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

247 {
248 return $this->title;
249 }

References $title.

Referenced by copy(), getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ getTypeId()

ilBadge::getTypeId ( )

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

227 {
228 return $this->type_id;
229 }

References $type_id.

Referenced by create(), and getTypeInstance().

+ Here is the caller graph for this function:

◆ getTypeInstance()

ilBadge::getTypeInstance ( )

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

120 {
121 if ($this->getTypeId()) {
122 $handler = ilBadgeHandler::getInstance();
123 return $handler->getTypeInstanceByUniqueId($this->getTypeId());
124 }
125 }

References ilBadgeHandler\getInstance(), and getTypeId().

+ Here is the call graph for this function:

◆ getValid()

ilBadge::getValid ( )

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

277 {
278 return $this->valid;
279 }

References $valid.

Referenced by getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ importDBRow()

ilBadge::importDBRow ( array  $a_row)
protected

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

387 {
388 $this->setId($a_row["id"]);
389 $this->setParentId($a_row["parent_id"]);
390 $this->setTypeId($a_row["type_id"]);
391 $this->setActive($a_row["active"]);
392 $this->setTitle($a_row["title"]);
393 $this->setDescription($a_row["descr"]);
394 $this->setCriteria($a_row["crit"]);
395 $this->setImage($a_row["image"]);
396 $this->setValid($a_row["valid"]);
397 $this->setConfiguration($a_row["conf"]
398 ? unserialize($a_row["conf"])
399 : null);
400 }
setCriteria($a_value)
setValid($a_value)
setConfiguration(array $a_value=null)
setTypeId($a_id)
setImage($a_value)
setDescription($a_value)

References setActive(), setConfiguration(), setCriteria(), setDescription(), setId(), setImage(), setParentId(), setTitle(), setTypeId(), and setValid().

Referenced by read().

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

◆ importImage()

ilBadge::importImage (   $a_name,
  $a_file 
)

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

323 {
324 if (file_exists($a_file)) {
325 $this->setImage($a_name);
326 copy($a_file, $this->getImagePath()); // #18280
327
328 $this->update();
329 }
330 }

References copy(), getImagePath(), setImage(), and update().

+ Here is the call graph for this function:

◆ isActive()

ilBadge::isActive ( )

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

237 {
238 return $this->active;
239 }

References $active.

Referenced by getPropertiesForStorage(), and ilBadgeManagementGUI\setBadgeFormValues().

+ Here is the caller graph for this function:

◆ prepareJson()

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

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

509 {
510 $json = new stdClass();
511 $json->{"@context"} = "https://w3id.org/openbadges/v1";
512 $json->type = "BadgeClass";
513 $json->id = $a_base_url . "class.json";
514 $json->name = $this->getTitle();
515 $json->description = $this->getDescription();
516 $json->image = $a_base_url . "image." . $a_img_suffix;
517 $json->criteria = $a_base_url . "criteria.txt";
518 $json->issuer = ilBadgeHandler::getInstance()->getIssuerStaticUrl();
519
520 return $json;
521 }

◆ read()

ilBadge::read (   $a_id)
protected

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

375 {
377
378 $set = $ilDB->query("SELECT * FROM badge_badge" .
379 " WHERE id = " . $ilDB->quote($a_id, "integer"));
380 if ($ilDB->numRows($set)) {
381 $row = $ilDB->fetchAssoc($set);
382 $this->importDBRow($row);
383 }
384 }
importDBRow(array $a_row)

References $db, $ilDB, and importDBRow().

Referenced by __construct().

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

◆ setActive()

ilBadge::setActive (   $a_value)

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

232 {
233 $this->active = (bool) $a_value;
234 }

Referenced by clone(), copy(), and importDBRow().

+ Here is the caller graph for this function:

◆ setConfiguration()

ilBadge::setConfiguration ( array  $a_value = null)

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

282 {
283 if (is_array($a_value) &&
284 !sizeof($a_value)) {
285 $a_value = null;
286 }
287 $this->config = $a_value;
288 }

Referenced by importDBRow().

+ Here is the caller graph for this function:

◆ setCriteria()

ilBadge::setCriteria (   $a_value)

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

262 {
263 $this->criteria = trim($a_value);
264 }

Referenced by importDBRow().

+ Here is the caller graph for this function:

◆ setDescription()

ilBadge::setDescription (   $a_value)

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

252 {
253 $this->desc = trim($a_value);
254 }

Referenced by importDBRow().

+ Here is the caller graph for this function:

◆ setId()

ilBadge::setId (   $a_id)
protected

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

202 {
203 $this->id = (int) $a_id;
204 }

Referenced by clone(), copy(), create(), and importDBRow().

+ Here is the caller graph for this function:

◆ setImage()

ilBadge::setImage (   $a_value)
protected

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

296 {
297 $this->image = trim($a_value);
298 }

Referenced by importDBRow(), importImage(), and uploadImage().

+ Here is the caller graph for this function:

◆ setParentId()

ilBadge::setParentId (   $a_id)

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

212 {
213 $this->parent_id = (int) $a_id;
214 }

Referenced by clone(), copy(), and importDBRow().

+ Here is the caller graph for this function:

◆ setTitle()

ilBadge::setTitle (   $a_value)

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

242 {
243 $this->title = trim($a_value);
244 }

Referenced by copy(), and importDBRow().

+ Here is the caller graph for this function:

◆ setTypeId()

ilBadge::setTypeId (   $a_id)

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

222 {
223 $this->type_id = trim($a_id);
224 }

Referenced by importDBRow().

+ Here is the caller graph for this function:

◆ setValid()

ilBadge::setValid (   $a_value)

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

272 {
273 $this->valid = trim($a_value);
274 }

Referenced by importDBRow().

+ Here is the caller graph for this function:

◆ update()

ilBadge::update ( )

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

423 {
425
426 if (!$this->getId()) {
427 return $this->create();
428 }
429
430 $fields = $this->getPropertiesForStorage();
431
432 $ilDB->update(
433 "badge_badge",
434 $fields,
435 array("id" => array("integer", $this->getId()))
436 );
437 }

References $db, $ilDB, create(), getId(), and getPropertiesForStorage().

Referenced by create(), importImage(), and uploadImage().

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

◆ uploadImage()

ilBadge::uploadImage ( array  $a_upload_meta)
Parameters
array$a_upload_meta
Exceptions
ilFileUtilsException

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

310 {
311 if ($this->getId() &&
312 $a_upload_meta["tmp_name"]) {
313 $this->setImage($a_upload_meta["name"]);
314 $path = $this->getImagePath();
315
316 if (ilUtil::moveUploadedFile($a_upload_meta["tmp_name"], $this->getImagePath(false), $path)) {
317 $this->update();
318 }
319 }
320 }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

References getId(), getImagePath(), ilUtil\moveUploadedFile(), setImage(), and update().

+ Here is the call graph for this function:

Field Documentation

◆ $active

ilBadge::$active
protected

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

Referenced by isActive().

◆ $config

ilBadge::$config
protected

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

Referenced by getConfiguration().

◆ $criteria

ilBadge::$criteria
protected

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

Referenced by getCriteria().

◆ $db

ilBadge::$db
protected

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

Referenced by create(), delete(), read(), and update().

◆ $desc

ilBadge::$desc
protected

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

Referenced by getDescription().

◆ $id

ilBadge::$id
protected

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

Referenced by create(), and getId().

◆ $image

ilBadge::$image
protected

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

Referenced by getImage().

◆ $lng

ilBadge::$lng
protected

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

Referenced by copy().

◆ $parent_id

ilBadge::$parent_id
protected

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

Referenced by getParentId().

◆ $title

ilBadge::$title
protected

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

Referenced by getTitle().

◆ $type_id

ilBadge::$type_id
protected

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

Referenced by getTypeId().

◆ $valid

ilBadge::$valid
protected

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

Referenced by getValid().


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