ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAdvancedMDRecord Class Reference
+ Collaboration diagram for ilAdvancedMDRecord:

Public Member Functions

 __construct (int $a_record_id=0)
 Singleton constructor To create an array of new records (without saving them) call the constructor directly. More...
 
 setDefaultLanguage (string $language_code)
 
 getDefaultLanguage ()
 
 delete ()
 
 enabledScope ()
 
 enableScope (bool $a_stat)
 
 setScopes (array $a_scopes)
 
 getScopes ()
 Get scopes. More...
 
 getScopeRefIds ()
 
 save ()
 
 update ()
 
 validate ()
 
 setGlobalPosition (int $position)
 
 getGlobalPosition ()
 
 getRecordId ()
 
 setActive (bool $a_active)
 
 isActive ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setImportId (string $a_id_string)
 
 getImportId ()
 
 setAssignedObjectTypes (array $a_obj_types)
 
 appendAssignedObjectType (string $a_obj_type, string $a_sub_type, bool $a_optional=false)
 
 getAssignedObjectTypes ()
 
 isAssignedObjectType (string $a_obj_type, string $a_sub_type)
 
 setParentObject (int $a_obj_id)
 
 getParentObject ()
 
 toXML (ilXmlWriter $writer)
 To Xml. More...
 
 __destruct ()
 
 _clone (array &$a_fields_map, int $a_parent_obj_id=null)
 

Static Public Member Functions

static _getInstanceByRecordId (int $a_record_id)
 
static _getActiveSearchableRecords ()
 Get active searchable records. More...
 
static _lookupTitle (int $a_record_id)
 
static _lookupRecordIdByImportId (string $a_ilias_id)
 
static _getAssignableObjectTypes (bool $a_include_text=false)
 Get assignable object type public. More...
 
static _getActivatedObjTypes ()
 get activated obj types More...
 
static _getRecords ()
 Get records public. More...
 
static _getAllRecordsByObjectType ()
 Get records by obj_type Note: this returns only records with no sub types! More...
 
static _getActivatedRecordsByObjectType (string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
 Get activated records by object type. More...
 
static _getSelectedRecordsByObject (string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
 
static isFilteredByScope ($a_ref_id, array $scopes)
 Check if a given ref id is not filtered by scope restriction. More...
 
static _delete ($a_record_id)
 
static saveObjRecSelection (int $a_obj_id, string $a_sub_type="", array $a_records=null, bool $a_delete_before=true)
 Save repository object record selection. More...
 
static deleteObjRecSelection (int $a_obj_id)
 Delete repository object record selection. More...
 
static getObjRecSelection (int $a_obj_id, string $a_sub_type="")
 Get repository object record selection. More...
 
static getSharedRecords (int $a_obj1_id, int $a_obj2_id, string $a_sub_type="-")
 

Protected Member Functions

 setRecordId (int $record_id)
 
 generateImportId ()
 generate unique record id More...
 

Protected Attributes

int $record_id
 
int $global_position = 0
 
string $import_id = ''
 
bool $active = false
 
string $title = ''
 
string $description = ''
 
string $language_default = ''
 
array $obj_types = array()
 
int $parent_obj = 0
 
bool $scope_enabled = false
 
array $scopes = []
 
ilDBInterface $db
 

Private Member Functions

 read ()
 

Static Private Attributes

static $instances = []
 

Detailed Description

Definition at line 12 of file class.ilAdvancedMDRecord.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecord::__construct ( int  $a_record_id = 0)

Singleton constructor To create an array of new records (without saving them) call the constructor directly.

Otherwise call getInstance... public

Parameters
intrecord id

Definition at line 45 of file class.ilAdvancedMDRecord.php.

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

46  {
47  global $DIC;
48 
49  $this->db = $DIC->database();
50  $this->record_id = $a_record_id;
51 
52  if ($this->getRecordId()) {
53  $this->read();
54  }
55  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ __destruct()

ilAdvancedMDRecord::__destruct ( )

Definition at line 746 of file class.ilAdvancedMDRecord.php.

References getRecordId().

747  {
748  unset(self::$instances[$this->getRecordId()]);
749  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _clone()

ilAdvancedMDRecord::_clone ( array &  $a_fields_map,
int  $a_parent_obj_id = null 
)

Definition at line 834 of file class.ilAdvancedMDRecord.php.

References getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getParentObject(), getRecordId(), getTitle(), isActive(), and setActive().

835  {
836  $new_obj = new self();
837  $new_obj->setActive($this->isActive());
838  $new_obj->setTitle($this->getTitle());
839  $new_obj->setDescription($this->getDescription());
840  $new_obj->setParentObject($a_parent_obj_id
841  ?: $this->getParentObject());
842  $new_obj->setAssignedObjectTypes($this->getAssignedObjectTypes());
843  $new_obj->setDefaultLanguage($this->getDefaultLanguage());
844  $new_obj->save();
845 
846  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
847  $new_def = $definition->_clone($new_obj->getRecordId());
848  $a_fields_map[$definition->getFieldId()] = $new_def->getFieldId();
849  }
850 
852  $record_translation->cloneRecord($new_obj->getRecordId());
853 
854  return $new_obj;
855  }
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ Here is the call graph for this function:

◆ _delete()

static ilAdvancedMDRecord::_delete (   $a_record_id)
static

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

References $DIC, $ilDB, $query, $res, and ilAdvancedMDFieldDefinition\getInstancesByRecordId().

Referenced by delete().

379  : void
380  {
381  global $DIC;
382 
383  $ilDB = $DIC['ilDB'];
384 
385  // Delete fields
386  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field) {
387  $field->delete();
388  }
389 
390  $query = "DELETE FROM adv_md_record " .
391  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
392  $res = $ilDB->manipulate($query);
393 
394  $query = "DELETE FROM adv_md_record_objs " .
395  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
396  $res = $ilDB->manipulate($query);
397  }
$res
Definition: ltiservices.php:69
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getActivatedObjTypes()

static ilAdvancedMDRecord::_getActivatedObjTypes ( )
static

get activated obj types

Returns
string[]

Definition at line 170 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $obj_types, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedSearchGUI\__setSearchOptions(), ilAdvancedSearchGUI\initAdvancedMetaDataForm(), and ilAdvancedMDSettingsGUI\updateSubstitutions().

170  : array
171  {
172  global $DIC;
173 
174  $ilDB = $DIC['ilDB'];
175 
176  $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo " .
177  "JOIN adv_md_record amr ON amo.record_id = amr.record_id " .
178  "WHERE active = 1 ";
179  $res = $ilDB->query($query);
180  $obj_types = [];
181  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
182  $obj_types[] = (string) $row->obj_type;
183  }
184  return $obj_types;
185  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ _getActivatedRecordsByObjectType()

static ilAdvancedMDRecord::_getActivatedRecordsByObjectType ( string  $a_obj_type,
string  $a_sub_type = "",
bool  $a_only_optional = false 
)
static

Get activated records by object type.

Returns
ilAdvancedMDRecord[]

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

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSessionExporter\getActiveAdvMDRecords(), ilWikiExporter\getActiveAdvMDRecords(), ilExerciseExporter\getActiveAdvMDRecords(), ilGlossaryExporter\getActiveAdvMDRecords(), ilStudyProgrammeTypeDBRepository\getAllAMDRecords(), ilOrgUnitType\getAvailableAdvancedMDRecords(), ilContainerFilterAdvMDAdapter\getAvailableRecordSets(), and ilAdvancedMDRecordGUI\parseRecordSelection().

244  : array {
245  global $DIC;
246 
247  $ilDB = $DIC['ilDB'];
248 
249  if ($a_sub_type == "") {
250  $a_sub_type = "-";
251  }
252 
253  $records = [];
254  $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro " .
255  "JOIN adv_md_record amr ON amr.record_id = amro.record_id " .
256  "WHERE active = 1 " .
257  "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
258  "AND sub_type = " . $ilDB->quote($a_sub_type, 'text');
259 
260  if ($a_only_optional) {
261  $query .= " AND optional =" . $ilDB->quote(1, 'integer');
262  }
263 
264  // #16428
265  $query .= "ORDER by parent_obj DESC, record_id";
266 
267  $res = $ilDB->query($query);
268  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
269  $records[] = self::_getInstanceByRecordId((int) $row->record_id);
270  }
271  return $records;
272  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ _getActiveSearchableRecords()

static ilAdvancedMDRecord::_getActiveSearchableRecords ( )
static

Get active searchable records.

Returns
ilAdvancedMDRecord[]

Definition at line 69 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

69  : array
70  {
71  global $DIC;
72 
73  $ilDB = $DIC['ilDB'];
74 
75  $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr " .
76  "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
77  "WHERE searchable = 1 AND active = 1 ";
78 
79  $res = $ilDB->query($query);
80  $records = [];
81  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
82  $records[] = self::_getInstanceByRecordId((int) $row->record_id);
83  }
84  return $records;
85  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query

◆ _getAllRecordsByObjectType()

static ilAdvancedMDRecord::_getAllRecordsByObjectType ( )
static

Get records by obj_type Note: this returns only records with no sub types!

Returns
array<string, array<int, ilAdvancedMDRecord>

Definition at line 214 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, ilECSSetting\ecsConfigured(), ilDBConstants\FETCHMODE_OBJECT, and ilECSUtils\getPossibleRemoteTypes().

Referenced by ilAdvancedMDSettingsGUI\initFormSubstitutions(), and ilAdvancedMDSettingsGUI\setSubTabs().

214  : array
215  {
216  global $DIC;
217 
218  $ilDB = $DIC['ilDB'];
219 
220  $records = [];
221  $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=" . $ilDB->quote("-", "text");
222  $res = $ilDB->query($query);
223  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
224  $records[(string) $row->obj_type][] = self::_getInstanceByRecordId((int) $row->record_id);
225  }
226  // #13359 hide ecs if not configured
228  $filter = ilECSUtils::getPossibleRemoteTypes(false);
229  $filter[] = 'rtst';
230  $records = array_diff_key($records, array_flip($filter));
231  }
232 
233  return $records;
234  }
$res
Definition: ltiservices.php:69
static ecsConfigured()
Checks if an ecs server is configured.
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAssignableObjectTypes()

static ilAdvancedMDRecord::_getAssignableObjectTypes ( bool  $a_include_text = false)
static

Get assignable object type public.

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

References $DIC, $lng, ilECSSetting\ecsConfigured(), and ilECSUtils\getPossibleRemoteTypes().

Referenced by ilAdvancedMDRecordTableGUI\fillRow(), ilAdvancedMDSettingsGUI\initForm(), ilObjectMetaDataGUI\isAdvMDAvailable(), and ilAdvancedMDSettingsGUI\loadRecordFormData().

127  : array
128  {
129  global $DIC;
130 
131  $objDefinition = $DIC['objDefinition'];
132  $lng = $DIC['lng'];
133 
134  $types = array();
135  $filter = array();
136  $amet_types = $objDefinition->getAdvancedMetaDataTypes();
137 
139  $filter = array_merge($filter, ilECSUtils::getPossibleRemoteTypes(false));
140  $filter[] = 'rtst';
141  }
142 
143  foreach ($amet_types as $at) {
144  if (in_array($at["obj_type"], $filter)) {
145  continue;
146  }
147 
148  if ($a_include_text) {
149  $text = $lng->txt("obj_" . $at["obj_type"]);
150  if ($at["sub_type"] != "") {
151  $lng->loadLanguageModule($at["obj_type"]);
152  $text .= ": " . $lng->txt($at["obj_type"] . "_" . $at["sub_type"]);
153  } else {
154  $at["sub_type"] = "-";
155  }
156  $at["text"] = $text;
157  }
158 
159  $types[] = $at;
160  }
161 
162  sort($types);
163  return $types;
164  }
static ecsConfigured()
Checks if an ecs server is configured.
$lng
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getInstanceByRecordId()

◆ _getRecords()

static ilAdvancedMDRecord::_getRecords ( )
static

Get records public.

Parameters
arrayarray of record objects
Returns
ilAdvancedMDRecord[]

Definition at line 194 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, _getInstanceByRecordId(), and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDValues\_cloneValues(), ilLuceneAdvancedSearchFields\getFields(), and ilAdvancedMDSettingsGUI\getParsedRecordObjects().

194  : array
195  {
196  global $DIC;
197 
198  $ilDB = $DIC['ilDB'];
199 
200  $query = "SELECT record_id FROM adv_md_record ORDER BY gpos ";
201  $res = $ilDB->query($query);
202  $records = [];
203  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
204  $records[] = ilAdvancedMDRecord::_getInstanceByRecordId((int) $row->record_id);
205  }
206  return $records;
207  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
static _getInstanceByRecordId(int $a_record_id)
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSelectedRecordsByObject()

static ilAdvancedMDRecord::_getSelectedRecordsByObject ( string  $a_obj_type,
int  $a_id,
string  $a_sub_type = "",
bool  $is_ref_id = true 
)
static
Parameters
string$a_obj_type
int$a_id
string$a_sub_type
bool$is_ref_id
Returns
array<int, ilAdvancedMDRecord>

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

References ilContainer\_lookupContainerSetting(), ilObject\_lookupObjId(), and ilObjectServiceSettingsGUI\CUSTOM_METADATA.

Referenced by ilGlossaryTerm\_copyTerm(), ilObjPortfolioBase\clonePagesAndSettings(), ilObjEmployeeTalkSeriesGUI\copyTemplateValues(), ilAdvancedMDRecordGUI\getActiveRecords(), ilObjBookingPool\getAdvancedMDFields(), ilPCAMDFormGUI\getAdvRecords(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilObjectMetaDataGUI\getBlockHTML(), ilAdvancedMDValues\getInstancesForObjectId(), ilObjectMetaDataGUI\getKeyValueList(), ilWikiFunctionsBlockGUI\getLegacyContent(), ilPCAMDPageList\handleCopiedContent(), ilObjectMetaDataGUI\hasActiveRecords(), ilObjWikiGUI\initSettingsForm(), ilAdvancedMDValues\preloadedRead(), and ilAdvancedMDValues\queryForRecords().

286  : array {
287  $records = array();
288 
289  if ($a_sub_type == "") {
290  $a_sub_type = "-";
291  }
292 
293  $a_obj_id = $is_ref_id
294  ? ilObject::_lookupObjId($a_id)
295  : $a_id;
296 
297  // object-wide metadata configuration setting
298  $config_setting = ilContainer::_lookupContainerSetting(
299  $a_obj_id,
301  ''
302  );
303 
304  $optional = array();
305  foreach (self::_getActivatedRecordsByObjectType($a_obj_type, $a_sub_type) as $record) {
306  // check scope
307  if ($is_ref_id && self::isFilteredByScope($a_id, $record->getScopes())) {
308  continue;
309  }
310  foreach ($record->getAssignedObjectTypes() as $item) {
311  if ($record->getParentObject()) {
312  // only matching local records
313  if ($record->getParentObject() != $a_obj_id) {
314  continue;
315  } // if object-wide setting is off, ignore local records
316  elseif (!$config_setting) {
317  continue;
318  }
319  }
320 
321  if ($item['obj_type'] == $a_obj_type &&
322  $item['sub_type'] == $a_sub_type) {
323  if ($item['optional']) {
324  $optional[] = $record->getRecordId();
325  }
326  $records[$record->getRecordId()] = $record;
327  }
328  }
329  }
330 
331  if ($optional) {
332  if (!$config_setting && !in_array($a_sub_type, array("orgu_type", "prg_type"))) { //#16925 + #17777
333  $selected = array();
334  } else {
335  $selected = self::getObjRecSelection($a_obj_id, $a_sub_type);
336  }
337  foreach ($optional as $record_id) {
338  if (!in_array($record_id, $selected)) {
339  unset($records[$record_id]);
340  }
341  }
342  }
343 
344  $orderings = new ilAdvancedMDRecordObjectOrderings();
345  $records = $orderings->sortRecords($records, $a_obj_id);
346 
347  return $records;
348  }
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupRecordIdByImportId()

static ilAdvancedMDRecord::_lookupRecordIdByImportId ( string  $a_ilias_id)
static

Definition at line 107 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDRecordParser\extractRecordId().

107  : int
108  {
109  global $DIC;
110 
111  $ilDB = $DIC['ilDB'];
112 
113  $query = "SELECT record_id FROM adv_md_record " .
114  "WHERE import_id = " . $ilDB->quote($a_ilias_id, 'text') . " ";
115  $res = $ilDB->query($query);
116  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117  return (int) $row->record_id;
118  }
119  return 0;
120  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilAdvancedMDRecord::_lookupTitle ( int  $a_record_id)
static

Definition at line 87 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilAdvancedMDSettingsGUI\initFormSubstitutions(), and ilECSSettingsGUI\prepareFieldSelection().

87  : string
88  {
89  static $title_cache = array();
90 
91  if (isset($title_cache[$a_record_id])) {
92  return $title_cache[$a_record_id];
93  }
94 
95  global $DIC;
96 
97  $ilDB = $DIC['ilDB'];
98 
99  $query = "SELECT title FROM adv_md_record " .
100  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
101  $res = $ilDB->query($query);
102  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
103 
104  return $title_cache[$a_record_id] = (string) $row->title;
105  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

◆ appendAssignedObjectType()

ilAdvancedMDRecord::appendAssignedObjectType ( string  $a_obj_type,
string  $a_sub_type,
bool  $a_optional = false 
)

Definition at line 621 of file class.ilAdvancedMDRecord.php.

621  : void
622  {
623  $this->obj_types[] = array(
624  "obj_type" => $a_obj_type,
625  "sub_type" => $a_sub_type,
626  "optional" => $a_optional
627  );
628  }

◆ delete()

ilAdvancedMDRecord::delete ( )

Definition at line 417 of file class.ilAdvancedMDRecord.php.

References _delete(), ilAdvancedMDRecordScope\deleteByRecordId(), and getRecordId().

Referenced by ilAdvancedMDSettingsGUI\deleteRecords().

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

◆ deleteObjRecSelection()

static ilAdvancedMDRecord::deleteObjRecSelection ( int  $a_obj_id)
static

Delete repository object record selection.

Definition at line 796 of file class.ilAdvancedMDRecord.php.

References $DIC, and $ilDB.

Referenced by ilAdvancedMDSettingsGUI\updateRecords().

796  : void
797  {
798  global $DIC;
799 
800  $ilDB = $DIC['ilDB'];
801 
802  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
803  " obj_id = " . $ilDB->quote($a_obj_id, "integer"));
804  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ enabledScope()

ilAdvancedMDRecord::enabledScope ( )

Definition at line 423 of file class.ilAdvancedMDRecord.php.

References $scope_enabled.

423  : bool
424  {
425  return $this->scope_enabled;
426  }

◆ enableScope()

ilAdvancedMDRecord::enableScope ( bool  $a_stat)

Definition at line 428 of file class.ilAdvancedMDRecord.php.

428  : void
429  {
430  $this->scope_enabled = $a_stat;
431  }

◆ generateImportId()

ilAdvancedMDRecord::generateImportId ( )
protected

generate unique record id

Definition at line 741 of file class.ilAdvancedMDRecord.php.

References getRecordId(), and IL_INST_ID.

Referenced by save(), and toXML().

741  : string
742  {
743  return 'il_' . IL_INST_ID . '_adv_md_record_' . $this->getRecordId();
744  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedObjectTypes()

ilAdvancedMDRecord::getAssignedObjectTypes ( )
Returns
array<int, array{obj_type: string, sub_type: string, optional: bool}>

Definition at line 633 of file class.ilAdvancedMDRecord.php.

References $obj_types.

Referenced by _clone(), isAssignedObjectType(), save(), toXML(), and update().

633  : array
634  {
635  return $this->obj_types;
636  }
+ Here is the caller graph for this function:

◆ getDefaultLanguage()

ilAdvancedMDRecord::getDefaultLanguage ( )

Definition at line 412 of file class.ilAdvancedMDRecord.php.

References $language_default.

Referenced by _clone(), save(), ilAdvancedMDSettingsGUI\saveRecord(), and update().

412  : string
413  {
415  }
+ Here is the caller graph for this function:

◆ getDescription()

ilAdvancedMDRecord::getDescription ( )

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

References $description.

Referenced by _clone(), save(), toXML(), and update().

597  : string
598  {
599  return $this->description;
600  }
+ Here is the caller graph for this function:

◆ getGlobalPosition()

ilAdvancedMDRecord::getGlobalPosition ( )

Definition at line 562 of file class.ilAdvancedMDRecord.php.

References $global_position.

Referenced by ilAdvancedMDRecordObjectOrderings\compareLocalRecords(), ilAdvancedMDRecordObjectOrderings\compareRecords(), and update().

562  : int
563  {
564  return $this->global_position;
565  }
+ Here is the caller graph for this function:

◆ getImportId()

ilAdvancedMDRecord::getImportId ( )

Definition at line 607 of file class.ilAdvancedMDRecord.php.

References $import_id.

Referenced by save().

607  : string
608  {
609  return $this->import_id;
610  }
+ Here is the caller graph for this function:

◆ getObjRecSelection()

static ilAdvancedMDRecord::getObjRecSelection ( int  $a_obj_id,
string  $a_sub_type = "" 
)
static

Get repository object record selection.

Parameters
int$a_obj_idobject id if repository object
array$a_recordsarray of record ids that are selected (in use) by the object
Returns
int[]

Definition at line 812 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, and ILIAS\Repository\int().

Referenced by ilAdvancedMDValues\_cloneValues(), ilObjPortfolioBase\clonePagesAndSettings(), ilObjEmployeeTalkSeriesGUI\copyTemplateValues(), ilWikiExporter\getActiveAdvMDRecords(), ilGlossaryExporter\getActiveAdvMDRecords(), ilAdvancedMDSettingsGUI\getParsedRecordObjects(), getSharedRecords(), and ilAdvancedMDRecordGUI\parseRecordSelection().

812  : array
813  {
814  global $DIC;
815 
816  $ilDB = $DIC['ilDB'];
817 
818  if ($a_sub_type == "") {
819  $a_sub_type = "-";
820  }
821 
822  $recs = array();
823  $set = $ilDB->query(
824  $r = "SELECT * FROM adv_md_obj_rec_select " .
825  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
826  " AND sub_type = " . $ilDB->quote($a_sub_type, "text")
827  );
828  while ($rec = $ilDB->fetchAssoc($set)) {
829  $recs[] = (int) $rec["rec_id"];
830  }
831  return $recs;
832  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParentObject()

ilAdvancedMDRecord::getParentObject ( )

Definition at line 654 of file class.ilAdvancedMDRecord.php.

References $parent_obj.

Referenced by _clone(), ilAdvancedMDSettingsGUI\deleteRecords(), and save().

654  : int
655  {
656  return $this->parent_obj;
657  }
+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDRecord::getRecordId ( )

Definition at line 567 of file class.ilAdvancedMDRecord.php.

References $record_id.

Referenced by __construct(), __destruct(), _clone(), ilAdvancedMDRecordObjectOrderings\compareLocalRecords(), delete(), generateImportId(), read(), save(), ilAdvancedMDSettingsGUI\saveRecord(), toXML(), and update().

567  : int
568  {
569  return $this->record_id;
570  }
+ Here is the caller graph for this function:

◆ getScopeRefIds()

ilAdvancedMDRecord::getScopeRefIds ( )
Returns
int[]

Definition at line 453 of file class.ilAdvancedMDRecord.php.

References $scope.

Referenced by toXML().

453  : array
454  {
455  $ref_ids = [];
456  foreach ($this->scopes as $scope) {
457  $ref_ids[] = $scope->getRefId();
458  }
459  return $ref_ids;
460  }
$scope
Definition: ltiregstart.php:53
+ Here is the caller graph for this function:

◆ getScopes()

ilAdvancedMDRecord::getScopes ( )

Get scopes.

Returns
ilAdvancedMDRecordScope[]

Definition at line 445 of file class.ilAdvancedMDRecord.php.

References $scopes.

Referenced by save(), and update().

445  : array
446  {
447  return $this->scopes;
448  }
+ Here is the caller graph for this function:

◆ getSharedRecords()

static ilAdvancedMDRecord::getSharedRecords ( int  $a_obj1_id,
int  $a_obj2_id,
string  $a_sub_type = "-" 
)
static

Definition at line 857 of file class.ilAdvancedMDRecord.php.

References $res, ilObject\_lookupType(), and getObjRecSelection().

857  : array
858  {
859  $obj_type = ilObject::_lookupType($a_obj1_id);
860  $sel = array_intersect(
861  ilAdvancedMDRecord::getObjRecSelection($a_obj1_id, $a_sub_type),
862  ilAdvancedMDRecord::getObjRecSelection($a_obj2_id, $a_sub_type)
863  );
864 
865  $res = array();
866 
867  foreach (self::_getRecords() as $record) {
868  // local records cannot be shared
869  if ($record->getParentObject()) {
870  continue;
871  }
872 
873  // :TODO: inactive records can be ignored?
874  if (!$record->isActive()) {
875  continue;
876  }
877 
878  // parse assigned types
879  foreach ($record->getAssignedObjectTypes() as $item) {
880  if ($item["obj_type"] == $obj_type &&
881  $item["sub_type"] == $a_sub_type) {
882  // mandatory
883  if (!$item["optional"]) {
884  $res[] = $record->getRecordId();
885  } // optional
886  elseif (in_array($record->getRecordId(), $sel)) {
887  $res[] = $record->getRecordId();
888  }
889  }
890  }
891  }
892 
893  return $res;
894  }
$res
Definition: ltiservices.php:69
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getTitle()

ilAdvancedMDRecord::getTitle ( )

Definition at line 587 of file class.ilAdvancedMDRecord.php.

References $title.

Referenced by _clone(), ilAdvancedMDSettingsGUI\confirmDeleteRecords(), ilAdvancedMDSettingsGUI\deleteRecords(), ilAdvancedMDSettingsGUI\exportRecords(), save(), toXML(), update(), and validate().

587  : string
588  {
589  return $this->title;
590  }
+ Here is the caller graph for this function:

◆ isActive()

ilAdvancedMDRecord::isActive ( )

Definition at line 577 of file class.ilAdvancedMDRecord.php.

References $active.

Referenced by _clone(), save(), toXML(), and update().

577  : bool
578  {
579  return $this->active;
580  }
+ Here is the caller graph for this function:

◆ isAssignedObjectType()

ilAdvancedMDRecord::isAssignedObjectType ( string  $a_obj_type,
string  $a_sub_type 
)

Definition at line 638 of file class.ilAdvancedMDRecord.php.

References getAssignedObjectTypes().

638  : bool
639  {
640  foreach ($this->getAssignedObjectTypes() as $t) {
641  if ($t["obj_type"] == $a_obj_type &&
642  $t["sub_type"] == $a_sub_type) {
643  return true;
644  }
645  }
646  return false;
647  }
+ Here is the call graph for this function:

◆ isFilteredByScope()

static ilAdvancedMDRecord::isFilteredByScope (   $a_ref_id,
array  $scopes 
)
static

Check if a given ref id is not filtered by scope restriction.

Parameters
int$a_ref_id
ilAdvancedMDRecordScope[]$scopes

Definition at line 355 of file class.ilAdvancedMDRecord.php.

References $GLOBALS, $scope, and ilTree\RELATION_PARENT.

Referenced by ilAdvancedMDSettingsGUI\getParsedRecordObjects().

355  : bool
356  {
357  $tree = $GLOBALS['DIC']->repositoryTree();
358  $logger = $GLOBALS['DIC']->logger()->amet();
359 
360  if (!count($scopes)) {
361  return false;
362  }
363  foreach ($scopes as $scope) {
364  $logger->debug('Comparing: ' . $a_ref_id . ' with: ' . $scope->getRefId());
365  if ($scope->getRefId() == $a_ref_id) {
366  $logger->debug('Elements are equal. No scope restrictions.');
367  return false;
368  }
369  if ($tree->getRelation($scope->getRefId(), $a_ref_id) == ilTree::RELATION_PARENT) {
370  $logger->debug('Node is child node. No scope restrictions.');
371  return false;
372  }
373  }
374  $logger->info('Scope filter matches.');
375 
376  return true;
377  }
$scope
Definition: ltiregstart.php:53
const RELATION_PARENT
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the caller graph for this function:

◆ read()

ilAdvancedMDRecord::read ( )
private

Definition at line 702 of file class.ilAdvancedMDRecord.php.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, getRecordId(), setActive(), setDefaultLanguage(), setDescription(), setGlobalPosition(), setImportId(), setParentObject(), setTitle(), and ilDBConstants\T_INTEGER.

Referenced by __construct().

702  : void
703  {
704  $query = "SELECT * FROM adv_md_record " .
705  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
706  $res = $this->db->query($query);
707  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
708  $this->setImportId((string) $row->import_id);
709  $this->setActive((bool) $row->active);
710  $this->setTitle((string) $row->title);
711  $this->setDescription((string) $row->description);
712  $this->setParentObject((int) $row->parent_obj);
713  $this->setGlobalPosition((int) $row->gpos);
714  $this->setDefaultLanguage((string) $row->lang_default);
715  }
716  $query = "SELECT * FROM adv_md_record_objs " .
717  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
718  $res = $this->db->query($query);
719  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
720  $this->obj_types[] = array(
721  "obj_type" => (string) $row->obj_type,
722  "sub_type" => (string) $row->sub_type,
723  "optional" => (bool) $row->optional
724  );
725  }
726 
727  $query = 'SELECT scope_id FROM adv_md_record_scope ' .
728  'WHERE record_id = ' . $this->db->quote($this->record_id, ilDBConstants::T_INTEGER);
729  $res = $this->db->query($query);
730  $this->scope_enabled = false;
731  $this->scopes = [];
732  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
733  $this->scope_enabled = true;
734  $this->scopes[] = new ilAdvancedMDRecordScope((int) $row->scope_id);
735  }
736  }
Scope restrictions for advanced md records.
$res
Definition: ltiservices.php:69
setDescription(string $a_description)
setDefaultLanguage(string $language_code)
$query
setImportId(string $a_id_string)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDRecord::save ( )

Definition at line 462 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, $scope, $type, generateImportId(), getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), getImportId(), getParentObject(), getRecordId(), getScopes(), getTitle(), isActive(), and ilDBConstants\T_TEXT.

Referenced by ilAdvancedMDSettingsGUI\saveRecord().

462  : void
463  {
464  global $DIC;
465 
466  $ilDB = $DIC['ilDB'];
467 
468  // Save import id if given
469  $next_id = $ilDB->nextId('adv_md_record');
470 
471  $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description,parent_obj,lang_default) " .
472  "VALUES(" .
473  $ilDB->quote($next_id, 'integer') . ", " .
474  $this->db->quote($this->getImportId(), 'text') . ", " .
475  $this->db->quote($this->isActive(), 'integer') . ", " .
476  $this->db->quote($this->getTitle(), 'text') . ", " .
477  $this->db->quote($this->getDescription(), 'text') . ", " .
478  $this->db->quote($this->getParentObject(), 'integer') . ", " .
479  $this->db->quote($this->getDefaultLanguage(), ilDBConstants::T_TEXT) .
480  ")";
481  $res = $ilDB->manipulate($query);
482  $this->record_id = $next_id;
483 
484  if (!strlen($this->getImportId())) {
485  // set import id to default value
486  $query = "UPDATE adv_md_record " .
487  "SET import_id = " . $this->db->quote($this->generateImportId(), 'text') . " " .
488  "WHERE record_id = " . $this->db->quote($this->record_id, 'integer') . " ";
489  $res = $ilDB->manipulate($query);
490  }
491 
492  foreach ($this->getAssignedObjectTypes() as $type) {
493  global $DIC;
494  $ilDB = $DIC['ilDB'];
495  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
496  "VALUES( " .
497  $this->db->quote($this->getRecordId(), 'integer') . ", " .
498  $this->db->quote($type["obj_type"], 'text') . ", " .
499  $this->db->quote($type["sub_type"], 'text') . ", " .
500  $this->db->quote($type["optional"], 'integer') . " " .
501  ")";
502  $res = $ilDB->manipulate($query);
503  }
504 
505  foreach ($this->getScopes() as $scope) {
506  $scope->setRecordId($this->getRecordId());
507  $scope->save();
508  }
509  }
$res
Definition: ltiservices.php:69
$scope
Definition: ltiregstart.php:53
$type
global $DIC
Definition: feed.php:28
$query
generateImportId()
generate unique record id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObjRecSelection()

static ilAdvancedMDRecord::saveObjRecSelection ( int  $a_obj_id,
string  $a_sub_type = "",
array  $a_records = null,
bool  $a_delete_before = true 
)
static

Save repository object record selection.

Parameters
int$a_obj_idobject id if repository object
string$a_sub_typesubtype
int[]$a_records array of record ids that are selected (in use) by the object
bool$a_delete_beforedelete before update
Returns
void

Definition at line 759 of file class.ilAdvancedMDRecord.php.

References $DIC, and $ilDB.

Referenced by ilAdvancedMDValues\_cloneValues(), ilObjPortfolioBase\clonePagesAndSettings(), ilObjEmployeeTalkSeriesGUI\copyTemplateValues(), ilOrgUnitType\getAvailableAdvancedMDRecords(), ilAdvancedMetaDataImporter\importXmlRepresentation(), ilAdvancedMDRecordGUI\saveSelection(), ilObjOrgUnit\update(), ilObjStudyProgramme\update(), ilStudyProgrammeType\updateAssignedStudyProgrammesIcons(), and ilAdvancedMDSettingsGUI\updateRecords().

764  : void {
765  global $DIC;
766 
767  $ilDB = $DIC['ilDB'];
768 
769  if ($a_sub_type == "") {
770  $a_sub_type = "-";
771  }
772 
773  if ($a_delete_before) {
774  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
775  " obj_id = " . $ilDB->quote($a_obj_id, "integer") .
776  " AND sub_type = " . $ilDB->quote($a_sub_type, "text"));
777  }
778 
779  if (is_array($a_records)) {
780  foreach ($a_records as $r) {
781  if ($r > 0) {
782  $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select " .
783  "(obj_id, rec_id, sub_type) VALUES (" .
784  $ilDB->quote($a_obj_id, "integer") . "," .
785  $ilDB->quote($r, "integer") . "," .
786  $ilDB->quote($a_sub_type, "text") .
787  ")");
788  }
789  }
790  }
791  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ setActive()

ilAdvancedMDRecord::setActive ( bool  $a_active)

Definition at line 572 of file class.ilAdvancedMDRecord.php.

Referenced by _clone(), and read().

572  : void
573  {
574  $this->active = $a_active;
575  }
+ Here is the caller graph for this function:

◆ setAssignedObjectTypes()

ilAdvancedMDRecord::setAssignedObjectTypes ( array  $a_obj_types)
Parameters
string[]
Todo:
is this format of $a_obj_types correct?

Definition at line 616 of file class.ilAdvancedMDRecord.php.

616  : void
617  {
618  $this->obj_types = $a_obj_types;
619  }

◆ setDefaultLanguage()

ilAdvancedMDRecord::setDefaultLanguage ( string  $language_code)
Parameters
string$language_code

Definition at line 407 of file class.ilAdvancedMDRecord.php.

Referenced by read(), and ilAdvancedMDSettingsGUI\saveRecord().

407  : void
408  {
409  $this->language_default = $language_code;
410  }
+ Here is the caller graph for this function:

◆ setDescription()

ilAdvancedMDRecord::setDescription ( string  $a_description)

Definition at line 592 of file class.ilAdvancedMDRecord.php.

Referenced by read().

592  : void
593  {
594  $this->description = $a_description;
595  }
+ Here is the caller graph for this function:

◆ setGlobalPosition()

ilAdvancedMDRecord::setGlobalPosition ( int  $position)

Definition at line 557 of file class.ilAdvancedMDRecord.php.

Referenced by ilAdvancedMDRecordObjectOrderings\compareRecords(), and read().

557  : void
558  {
559  $this->global_position = $position;
560  }
+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDRecord::setImportId ( string  $a_id_string)

Definition at line 602 of file class.ilAdvancedMDRecord.php.

Referenced by read().

602  : void
603  {
604  $this->import_id = $a_id_string;
605  }
+ Here is the caller graph for this function:

◆ setParentObject()

ilAdvancedMDRecord::setParentObject ( int  $a_obj_id)

Definition at line 649 of file class.ilAdvancedMDRecord.php.

Referenced by read().

649  : void
650  {
651  $this->parent_obj = $a_obj_id;
652  }
+ Here is the caller graph for this function:

◆ setRecordId()

ilAdvancedMDRecord::setRecordId ( int  $record_id)
protected

Definition at line 399 of file class.ilAdvancedMDRecord.php.

References $record_id.

399  : void
400  {
401  $this->record_id = $record_id;
402  }

◆ setScopes()

ilAdvancedMDRecord::setScopes ( array  $a_scopes)
Parameters
ilAdvancedMDRecordScope[]

Definition at line 436 of file class.ilAdvancedMDRecord.php.

436  : void
437  {
438  $this->scopes = $a_scopes;
439  }

◆ setTitle()

ilAdvancedMDRecord::setTitle ( string  $a_title)

Definition at line 582 of file class.ilAdvancedMDRecord.php.

Referenced by read().

582  : void
583  {
584  $this->title = $a_title;
585  }
+ Here is the caller graph for this function:

◆ toXML()

ilAdvancedMDRecord::toXML ( ilXmlWriter  $writer)

To Xml.

This method writes only the subset Record (including all fields) Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.

Definition at line 664 of file class.ilAdvancedMDRecord.php.

References $ref_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), generateImportId(), getAssignedObjectTypes(), getDescription(), ilAdvancedMDRecordTranslations\getInstanceByRecordId(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getRecordId(), getScopeRefIds(), getTitle(), IL_INST_ID, isActive(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

664  : void
665  {
666  $writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0,
667  'id' => $this->generateImportId()
668  ));
669  $writer->xmlElement('Title', null, $this->getTitle());
670  $writer->xmlElement('Description', null, $this->getDescription());
671 
673  $translations->toXML($writer);
674 
675  foreach ($this->getAssignedObjectTypes() as $obj_type) {
676  $optional = array("optional" => $obj_type["optional"]);
677  if ($obj_type["sub_type"] == "") {
678  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"]);
679  } else {
680  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
681  }
682  }
683 
684  // scopes
685  if (count($this->getScopeRefIds())) {
686  $writer->xmlStartTag('Scope');
687  }
688  foreach ($this->getScopeRefIds() as $ref_id) {
690  $writer->xmlElement('ScopeEntry', ['id' => 'il_' . IL_INST_ID . '_' . $type . '_' . $ref_id]);
691  }
692  if (count($this->getScopeRefIds())) {
693  $writer->xmlEndTag('Scope');
694  }
695 
696  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
697  $definition->toXML($writer);
698  }
699  $writer->xmlEndTag('Record');
700  }
const IL_INST_ID
Definition: constants.php:40
$type
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
static _lookupObjId(int $ref_id)
xmlEndTag(string $tag)
Writes an endtag.
$ref_id
Definition: ltiauth.php:67
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static _lookupType(int $id, bool $reference=false)
generateImportId()
generate unique record id
+ Here is the call graph for this function:

◆ update()

ilAdvancedMDRecord::update ( )

Definition at line 511 of file class.ilAdvancedMDRecord.php.

References $DIC, $ilDB, $query, $res, $scope, $type, ilAdvancedMDRecordScope\deleteByRecordId(), getAssignedObjectTypes(), getDefaultLanguage(), getDescription(), getGlobalPosition(), getRecordId(), getScopes(), getTitle(), isActive(), and ilDBConstants\T_TEXT.

511  : void
512  {
513  global $DIC;
514 
515  $ilDB = $DIC['ilDB'];
516 
517  $query = "UPDATE adv_md_record " .
518  "SET active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
519  "title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
520  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
521  'gpos = ' . $this->db->quote($this->getGlobalPosition(), 'integer') . ', ' .
522  'lang_default = ' . $this->db->quote($this->getDefaultLanguage(), ilDBConstants::T_TEXT) . ' ' .
523  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
524  $res = $ilDB->manipulate($query);
525 
526  // Delete assignments
527  $query = "DELETE FROM adv_md_record_objs " .
528  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
529  $res = $ilDB->manipulate($query);
530 
531  // Insert assignments
532  foreach ($this->getAssignedObjectTypes() as $type) {
533  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
534  "VALUES ( " .
535  $this->db->quote($this->getRecordId(), 'integer') . ", " .
536  $this->db->quote($type["obj_type"], 'text') . ", " .
537  $this->db->quote($type["sub_type"], 'text') . ", " .
538  $this->db->quote($type["optional"], 'integer') . " " .
539  ")";
540  $res = $ilDB->manipulate($query);
541  }
543  foreach ($this->getScopes() as $scope) {
544  $scope->setRecordId($this->getRecordId());
545  $scope->save();
546  }
547  }
$res
Definition: ltiservices.php:69
$scope
Definition: ltiregstart.php:53
$type
global $DIC
Definition: feed.php:28
$query
static deleteByRecordId(int $a_record_id)
+ Here is the call graph for this function:

◆ validate()

ilAdvancedMDRecord::validate ( )

Definition at line 549 of file class.ilAdvancedMDRecord.php.

References getTitle().

549  : bool
550  {
551  if (!strlen($this->getTitle())) {
552  return false;
553  }
554  return true;
555  }
+ Here is the call graph for this function:

Field Documentation

◆ $active

bool ilAdvancedMDRecord::$active = false
protected

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

Referenced by isActive().

◆ $db

ilDBInterface ilAdvancedMDRecord::$db
protected

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

◆ $description

string ilAdvancedMDRecord::$description = ''
protected

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

Referenced by getDescription().

◆ $global_position

int ilAdvancedMDRecord::$global_position = 0
protected

Definition at line 17 of file class.ilAdvancedMDRecord.php.

Referenced by getGlobalPosition().

◆ $import_id

string ilAdvancedMDRecord::$import_id = ''
protected

Definition at line 19 of file class.ilAdvancedMDRecord.php.

Referenced by getImportId().

◆ $instances

ilAdvancedMDRecord::$instances = []
staticprivate

Definition at line 14 of file class.ilAdvancedMDRecord.php.

◆ $language_default

string ilAdvancedMDRecord::$language_default = ''
protected

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

Referenced by getDefaultLanguage().

◆ $obj_types

array ilAdvancedMDRecord::$obj_types = array()
protected

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

Referenced by _getActivatedObjTypes(), and getAssignedObjectTypes().

◆ $parent_obj

int ilAdvancedMDRecord::$parent_obj = 0
protected

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

Referenced by getParentObject().

◆ $record_id

int ilAdvancedMDRecord::$record_id
protected

Definition at line 16 of file class.ilAdvancedMDRecord.php.

Referenced by getRecordId(), and setRecordId().

◆ $scope_enabled

bool ilAdvancedMDRecord::$scope_enabled = false
protected

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

Referenced by enabledScope().

◆ $scopes

array ilAdvancedMDRecord::$scopes = []
protected

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

Referenced by getScopes().

◆ $title

string ilAdvancedMDRecord::$title = ''
protected

Definition at line 21 of file class.ilAdvancedMDRecord.php.

Referenced by getTitle().


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