47 $this->db = $DIC->database();
48 $this->export_id = $a_export_id;
49 if ($this->export_id) {
56 if (self::$instance) {
57 return self::$instance;
71 $ilDB = $DIC->database();
74 $query =
'SELECT MAX(export_id) exp FROM export_options ' .
75 'GROUP BY export_id ';
79 $exp_id = $row->exp + 1;
81 $query =
'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value) ' .
83 $ilDB->quote($exp_id,
'integer') .
', ' .
84 $ilDB->quote(self::KEY_INIT,
'integer') .
', ' .
85 $ilDB->quote(0,
'integer') .
', ' .
86 $ilDB->quote(0,
'integer') .
', ' .
87 $ilDB->quote(0,
'integer') .
' ' .
99 foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as
$ref_id => $mode) {
100 if ($mode == self::EXPORT_BUILD) {
114 foreach ((array) $this->ref_options[self::KEY_ITEM_MODE] as
$ref_id => $mode) {
115 if ($mode != self::EXPORT_OMIT) {
133 public function addOption(
int $a_keyword,
int $a_ref_id,
int $a_obj_id, $a_value): void
135 $query =
"SELECT MAX(pos) position FROM export_options";
140 $pos = (
int) $row->position;
144 $query =
'INSERT INTO export_options (export_id,keyword,ref_id,obj_id,value,pos) ' .
146 $this->db->quote($this->
getExportId(),
'integer') .
', ' .
147 $this->db->quote($a_keyword,
'integer') .
', ' .
148 $this->db->quote($a_ref_id,
'integer') .
', ' .
149 $this->db->quote($a_obj_id,
'integer') .
', ' .
150 $this->db->quote($a_value,
'integer') .
', ' .
151 $this->db->quote($pos,
'integer') .
' ' .
153 $this->db->manipulate(
$query);
162 return $this->options[$a_keyword] ?? null;
173 return $this->obj_options[$a_keyword][$a_obj_id] ?? null;
184 return $this->ref_options[$a_keyword][$a_ref_id] ?? null;
187 public function delete():
void 189 $query =
"DELETE FROM export_options " .
190 "WHERE export_id = " . $this->db->quote($this->
getExportId(),
'integer');
191 $this->db->manipulate(
$query);
196 $this->options = array();
197 $this->obj_options = array();
198 $this->ref_options = array();
200 $query =
"SELECT * FROM export_options " .
201 "WHERE export_id = " . $this->db->quote($this->
getExportId(),
'integer') .
' ' .
206 $this->ref_options[(
int) $row->keyword][(
int) $row->ref_id] = $row->value;
209 $this->obj_options[(
int) $row->keyword][(
int) $row->obj_id] = $row->value;
211 if (!$row->ref_id and !$row->obj_id) {
212 $this->options[(
int) $row->keyword] = $row->value;
getOptionByRefId(int $a_ref_id, int $a_keyword)
Get option by.
static newInstance(int $a_export_id)
getSubitemsForExport()
Get all subitems with mode != self::EXPORT_OMIT.
addOption(int $a_keyword, int $a_ref_id, int $a_obj_id, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static ilExportOptions $instance
getSubitemsForCreation(int $a_source_id)
Get all subitems with mode ilExportOptions::EXPORT_BUILD
__construct(int $a_export_id)
getOption(int $a_keyword)
static allocateExportId()
getOptionByObjId(int $a_obj_id, int $a_keyword)
Get option by.