ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSCORMOrganizations.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
29{
30 public string $default_organization;
31
36 public function __construct(int $a_id = 0)
37 {
38 global $DIC;
39 $lng = $DIC->language();
40
41 // title should be overrriden by ilSCORMExplorer
42 $this->setTitle($lng->txt("cont_organizations"));
43
45 $this->setType("sos");
46 }
47
48 public function getDefaultOrganization(): string
49 {
51 }
52
53 public function setDefaultOrganization(string $a_def_org): void
54 {
55 $this->default_organization = $a_def_org;
56 }
57
58 public function read(): void
59 {
60 global $DIC;
61 $ilDB = $DIC->database();
62
63 parent::read();
64
65 $obj_set = $ilDB->queryF(
66 'SELECT default_organization FROM sc_organizations WHERE obj_id = %s',
67 array('integer'),
68 array($this->getId())
69 );
70 $obj_rec = $ilDB->fetchAssoc($obj_set);
71 $this->setDefaultOrganization($obj_rec["default_organization"] ?? '');
72 }
73
74 public function create(): void
75 {
76 global $DIC;
77 $ilDB = $DIC->database();
78
79 parent::create();
80
81 $ilDB->manipulateF(
82 '
83 INSERT INTO sc_organizations (obj_id, default_organization) VALUES (%s, %s)',
84 array('integer', 'text'),
85 array($this->getId(), $this->getDefaultOrganization())
86 );
87 }
88
89 public function update(): void
90 {
91 global $DIC;
92 $ilDB = $DIC->database();
93
94 parent::update();
95
96 $ilDB->manipulateF(
97 '
98 UPDATE sc_organizations
99 SET default_organization = %s
100 WHERE obj_id = %s',
101 array('text', 'integer'),
102 array($this->getDefaultOrganization(), $this->getId())
103 );
104 }
105
106 public function delete(): void
107 {
108 global $DIC;
109 $ilDB = $DIC->database();
110
111 parent::delete();
112
113 $ilDB->manipulateF(
114 'DELETE FROM sc_organizations WHERE obj_id = %s',
115 array('integer'),
116 array($this->getId())
117 );
118 }
119}
Parent object for all SCORM objects, that are stored in table scorm_object.
setTitle(string $a_title)
setType(?string $a_type)
__construct(int $a_id=0)
Constructor.
update()
Updates database record for SCORM object.
create()
Create database record for SCORM object.
setDefaultOrganization(string $a_def_org)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26