ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAdvancedMDRecord Class Reference
+ Collaboration diagram for ilAdvancedMDRecord:

Public Member Functions

 __construct ($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 ()
 Delete. More...
 
 enabledScope ()
 Is scope enabled. More...
 
 enableScope ($a_stat)
 Enable scope restrictions. More...
 
 setScopes (array $a_scopes)
 Set scopes. More...
 
 getScopes ()
 Get scopes. More...
 
 getScopeRefIds ()
 Get scope gef_ids. More...
 
 save ()
 save More...
 
 update ()
 update More...
 
 validate ()
 Validate settings. More...
 
 setGlobalPosition (int $position)
 Set global position. More...
 
 getGlobalPosition ()
 
 getRecordId ()
 Get record id. More...
 
 setActive ($a_active)
 Set active. More...
 
 isActive ()
 Check if record is active. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 get title More...
 
 setDescription ($a_description)
 set description More...
 
 getDescription ()
 get description More...
 
 setImportId ($a_id_string)
 set import id More...
 
 getImportId ()
 get import id More...
 
 setAssignedObjectTypes ($a_obj_types)
 Set assigned object types. More...
 
 appendAssignedObjectType ($a_obj_type, $a_sub_type, $a_optional=false)
 append assigned object types More...
 
 getAssignedObjectTypes ()
 Get assigned object types. More...
 
 isAssignedObjectType ($a_obj_type, $a_sub_type)
 Is assigned object type? More...
 
 setParentObject ($a_obj_id)
 
 getParentObject ()
 
 toXML (ilXmlWriter $writer)
 To Xml. More...
 
 __destruct ()
 Destructor. More...
 
 _clone (array &$a_fields_map, $a_parent_obj_id=null)
 Clone record. More...
 

Static Public Member Functions

static _getInstanceByRecordId ($a_record_id)
 Get instance by record id. More...
 
static _getActiveSearchableRecords ()
 Get active searchable records. More...
 
static _lookupTitle ($a_record_id)
 Lookup title. More...
 
static _lookupRecordIdByImportId ($a_ilias_id)
 Lookup record Id by import id. More...
 
static _getAssignableObjectTypes ($a_include_text=false)
 Get assignable object type. More...
 
static _getActivatedObjTypes ()
 get activated obj types More...
 
static _getRecords ()
 Get records. More...
 
static _getAllRecordsByObjectType ()
 Get records by obj_type Note: this returns only records with no sub types! public. More...
 
static _getActivatedRecordsByObjectType ($a_obj_type, $a_sub_type="", $a_only_optional=false)
 Get activated records by object type. More...
 
static _getSelectedRecordsByObject ($a_obj_type, $a_ref_id, $a_sub_type="")
 Get selected records by object. More...
 
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)
 Delete record and all related data. More...
 
static saveObjRecSelection ($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
 Save repository object record selection. More...
 
static getObjRecSelection ($a_obj_id, $a_sub_type="")
 Get repository object record selection. More...
 
static getSharedRecords ($a_obj1_id, $a_obj2_id, $a_sub_type="-")
 Get shared records. More...
 

Protected Member Functions

 generateImportId ()
 generate unique record id More...
 

Protected Attributes

 $record_id
 
 $global_position
 
 $import_id
 
 $active
 
 $title
 
 $description
 
 $language_default
 
 $obj_types = array()
 
 $db = null
 
 $parent_obj
 
 $scope_enabled = false
 
 $scopes = []
 

Private Member Functions

 read ()
 read record and assiged object types More...
 

Static Private Attributes

static $instances = array()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecord::__construct (   $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 56 of file class.ilAdvancedMDRecord.php.

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

57  {
58  global $DIC;
59 
60  $ilDB = $DIC['ilDB'];
61 
62  $this->record_id = $a_record_id;
63  $this->db = $ilDB;
64 
65  if ($this->getRecordId()) {
66  $this->read();
67  }
68  }
global $DIC
Definition: goto.php:24
read()
read record and assiged object types
global $ilDB
+ Here is the call graph for this function:

◆ __destruct()

ilAdvancedMDRecord::__destruct ( )

Destructor.

public

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

References getRecordId().

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

Member Function Documentation

◆ _clone()

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

Clone record.

Parameters
array&$a_fields_map
type$a_parent_obj_id
Returns
self

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

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

1030  {
1031  $new_obj = new self();
1032  $new_obj->setActive($this->isActive());
1033  $new_obj->setTitle($this->getTitle());
1034  $new_obj->setDescription($this->getDescription());
1035  $new_obj->setParentObject($a_parent_obj_id
1036  ? $a_parent_obj_id
1037  : $this->getParentObject());
1038  $new_obj->setAssignedObjectTypes($this->getAssignedObjectTypes());
1039  $new_obj->setDefaultLanguage($this->getDefaultLanguage());
1040  $new_obj->save();
1041 
1042  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1043  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
1044  $new_def = $definition->_clone($new_obj->getRecordId());
1045  $a_fields_map[$definition->getFieldId()] = $new_def->getFieldId();
1046  }
1047 
1049  $record_translation->cloneRecord($new_obj->getRecordId());
1050 
1051  return $new_obj;
1052  }
getDescription()
get description
isActive()
Check if record is active.
getAssignedObjectTypes()
Get assigned object types.
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

Delete record and all related data.

public

Parameters
intrecord id

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

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

Referenced by delete().

442  {
443  global $DIC;
444 
445  $ilDB = $DIC['ilDB'];
446 
447  // Delete fields
448  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($a_record_id) as $field) {
449  $field->delete();
450  }
451 
452  $query = "DELETE FROM adv_md_record " .
453  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
454  $res = $ilDB->manipulate($query);
455 
456  $query = "DELETE FROM adv_md_record_objs " .
457  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
458  $res = $ilDB->manipulate($query);
459  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
+ 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

public

Parameters
stringobj types

Definition at line 215 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().

216  {
217  global $DIC;
218 
219  $ilDB = $DIC['ilDB'];
220 
221  $query = "SELECT DISTINCT(obj_type) FROM adv_md_record_objs amo " .
222  "JOIN adv_md_record amr ON amo.record_id = amr.record_id " .
223  "WHERE active = 1 ";
224  $res = $ilDB->query($query);
225  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
226  $obj_types[] = $row->obj_type;
227  }
228  return $obj_types ? $obj_types : array();
229  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _getActivatedRecordsByObjectType()

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

Get activated records by object type.

public

Parameters
stringobj_type
Returns
ilAdvancedMDRecord[]

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

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

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

295  {
296  global $DIC;
297 
298  $ilDB = $DIC['ilDB'];
299 
300  $records = array();
301 
302  if ($a_sub_type == "") {
303  $a_sub_type = "-";
304  }
305 
306  $query = "SELECT amro.record_id record_id FROM adv_md_record_objs amro " .
307  "JOIN adv_md_record amr ON amr.record_id = amro.record_id " .
308  "WHERE active = 1 " .
309  "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
310  "AND sub_type = " . $ilDB->quote($a_sub_type, 'text');
311 
312  if ($a_only_optional) {
313  $query .= " AND optional =" . $ilDB->quote(1, 'integer');
314  }
315 
316  // #16428
317  $query .= "ORDER by parent_obj DESC, record_id";
318 
319  $res = $ilDB->query($query);
320  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
321  $records[] = self::_getInstanceByRecordId($row->record_id);
322  }
323 
324  return $records;
325  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _getActiveSearchableRecords()

static ilAdvancedMDRecord::_getActiveSearchableRecords ( )
static

Get active searchable records.

public

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

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

95  {
96  global $DIC;
97 
98  $ilDB = $DIC['ilDB'];
99 
100  $query = "SELECT DISTINCT(amr.record_id) FROM adv_md_record amr " .
101  "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " .
102  "WHERE searchable = 1 AND active = 1 ";
103 
104  $res = $ilDB->query($query);
105  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
106  $records[] = self::_getInstanceByRecordId($row->record_id);
107  }
108  return $records ? $records : array();
109  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB

◆ _getAllRecordsByObjectType()

static ilAdvancedMDRecord::_getAllRecordsByObjectType ( )
static

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

Parameters

Definition at line 262 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().

263  {
264  global $DIC;
265 
266  $ilDB = $DIC['ilDB'];
267 
268  $records = array();
269 
270  $query = "SELECT * FROM adv_md_record_objs WHERE sub_type=" . $ilDB->quote("-", "text");
271  $res = $ilDB->query($query);
272  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
273  $records[$row->obj_type][] = self::_getInstanceByRecordId($row->record_id);
274  }
275  // #13359 hide ecs if not configured
277  $filter = ilECSUtils::getPossibleRemoteTypes(false);
278  $filter[] = 'rtst';
279  $records = array_diff_key($records, array_flip($filter));
280  }
281 
282  return $records;
283  }
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
static ecsConfigured()
Checks if an ecs server is configured.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAssignableObjectTypes()

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

Get assignable object type.

public

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

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

Referenced by ilSoapInstallationInfoXMLWriter\__buildClient(), ilAdvancedMDRecordTableGUI\fillRow(), ilSoapAdministration\getNIC(), ilAdvancedMDSettingsGUI\initForm(), ilObjectMetaDataGUI\isAdvMDAvailable(), and ilAdvancedMDSettingsGUI\loadRecordFormData().

169  {
170  global $DIC;
171 
172  $objDefinition = $DIC['objDefinition'];
173  $lng = $DIC['lng'];
174 
175  $types = array();
176  $filter = array();
177  $amet_types = $objDefinition->getAdvancedMetaDataTypes();
178 
180  $filter = array_merge($filter, ilECSUtils::getPossibleRemoteTypes(false));
181  $filter[] = 'rtst';
182  }
183 
184  foreach ($amet_types as $at) {
185  if (in_array($at["obj_type"], $filter)) {
186  continue;
187  }
188 
189  if ($a_include_text) {
190  $text = $lng->txt("obj_" . $at["obj_type"]);
191  if ($at["sub_type"] != "") {
192  $lng->loadLanguageModule($at["obj_type"]);
193  $text .= ": " . $lng->txt($at["obj_type"] . "_" . $at["sub_type"]);
194  } else {
195  $at["sub_type"] = "-";
196  }
197  $at["text"] = $text;
198  }
199 
200  $types[] = $at;
201  }
202 
203  sort($types);
204  return $types;
205  }
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
static ecsConfigured()
Checks if an ecs server is configured.
$lng
global $DIC
Definition: goto.php:24
+ 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 240 of file class.ilAdvancedMDRecord.php.

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

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

241  {
242  global $DIC;
243 
244  $ilDB = $DIC['ilDB'];
245 
246  $query = "SELECT record_id FROM adv_md_record ORDER BY gpos ";
247  $res = $ilDB->query($query);
248  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
249  $records[] = ilAdvancedMDRecord::_getInstanceByRecordId($row->record_id);
250  }
251  return $records ? $records : array();
252  }
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getSelectedRecordsByObject()

static ilAdvancedMDRecord::_getSelectedRecordsByObject (   $a_obj_type,
  $a_ref_id,
  $a_sub_type = "" 
)
static

Get selected records by object.

Parameters
string$a_obj_typeobject type
string$a_ref_idreference id
string$a_sub_typesub type

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

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

Referenced by ilGlossaryTerm\_copyTerm(), ilPCAMDPageList\findPages(), ilAdvancedMDRecordGUI\getActiveRecords(), ilObjBookingPool\getAdvancedMDFields(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilObjectMetaDataGUI\getBlockHTML(), ilAdvancedMDValues\getInstancesForObjectId(), ilObjectMetaDataGUI\getKeyValueList(), ilWikiFunctionsBlockGUI\getLegacyContent(), ilObjectMetaDataGUI\hasActiveRecords(), ilObjWikiGUI\initSettingsForm(), ilAdvancedMDValues\preloadedRead(), and ilAdvancedMDValues\queryForRecords().

335  {
336  $records = array();
337  // ilUtil::printBacktrace(10);
338  // var_dump($a_obj_type."-".$a_ref_id."-".$a_sub_type); exit;
339  if ($a_sub_type == "") {
340  $a_sub_type = "-";
341  }
342 
343  $a_obj_id = ilObject::_lookupObjId($a_ref_id);
344 
345  // object-wide metadata configuration setting
346  include_once 'Services/Container/classes/class.ilContainer.php';
347  include_once 'Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
348  $config_setting = ilContainer::_lookupContainerSetting(
349  $a_obj_id,
351  false
352  );
353 
354  $optional = array();
355  foreach (self::_getActivatedRecordsByObjectType($a_obj_type, $a_sub_type) as $record) {
356  // check scope
357  if (self::isFilteredByScope($a_ref_id, $record->getScopes())) {
358  continue;
359  }
360 
361  foreach ($record->getAssignedObjectTypes() as $item) {
362  if ($record->getParentObject()) {
363  // only matching local records
364  if ($record->getParentObject() != $a_obj_id) {
365  continue;
366  }
367  // if object-wide setting is off, ignore local records
368  elseif (!$config_setting) {
369  continue;
370  }
371  }
372 
373  if ($item['obj_type'] == $a_obj_type &&
374  $item['sub_type'] == $a_sub_type) {
375  if ($item['optional']) {
376  $optional[] = $record->getRecordId();
377  }
378  $records[$record->getRecordId()] = $record;
379  }
380  }
381  }
382 
383  if ($optional) {
384  if (!$config_setting && !in_array($a_sub_type, array("orgu_type", "prg_type"))) { //#16925 + #17777
385  $selected = array();
386  } else {
387  $selected = self::getObjRecSelection($a_obj_id, $a_sub_type);
388  }
389  foreach ($optional as $record_id) {
390  if (!in_array($record_id, $selected)) {
391  unset($records[$record_id]);
392  }
393  }
394  }
395 
396 
397  $orderings = new ilAdvancedMDRecordObjectOrderings();
398  $records = $orderings->sortRecords($records, $a_obj_id);
399 
400  return $records;
401  }
static _lookupObjId($a_id)
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupRecordIdByImportId()

static ilAdvancedMDRecord::_lookupRecordIdByImportId (   $a_ilias_id)
static

Lookup record Id by import id.

public

Parameters
stringilias id

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

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

Referenced by ilAdvancedMDRecordParser\extractRecordId().

148  {
149  global $DIC;
150 
151  $ilDB = $DIC['ilDB'];
152 
153  $query = "SELECT record_id FROM adv_md_record " .
154  "WHERE import_id = " . $ilDB->quote($a_ilias_id, 'text') . " ";
155  $res = $ilDB->query($query);
156  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
157  return $row->record_id;
158  }
159  return 0;
160  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupTitle()

static ilAdvancedMDRecord::_lookupTitle (   $a_record_id)
static

Lookup title.

public

Parameters
intrecord_id

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

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

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

120  {
121  static $title_cache = array();
122 
123  if (isset($title_cache[$a_record_id])) {
124  return $title_cache[$a_record_id];
125  }
126 
127  global $DIC;
128 
129  $ilDB = $DIC['ilDB'];
130 
131  $query = "SELECT title FROM adv_md_record " .
132  "WHERE record_id = " . $ilDB->quote($a_record_id, 'integer') . " ";
133  $res = $ilDB->query($query);
134  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
135 
136  return $title_cache[$a_record_id] = $row->title;
137  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ appendAssignedObjectType()

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

append assigned object types

public

Parameters
stringilias object type

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

792  {
793  $this->obj_types[] = array(
794  "obj_type" => $a_obj_type,
795  "sub_type" => $a_sub_type,
796  "optional" => (bool) $a_optional
797  );
798  }

◆ delete()

ilAdvancedMDRecord::delete ( )

Delete.

public

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

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

482  {
485  }
static deleteByRecordI($a_record_id)
delete by record id
static _delete($a_record_id)
Delete record and all related data.
+ Here is the call graph for this function:

◆ enabledScope()

ilAdvancedMDRecord::enabledScope ( )

Is scope enabled.

Returns
scope

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

References $scope_enabled.

492  {
493  return $this->scope_enabled;
494  }

◆ enableScope()

ilAdvancedMDRecord::enableScope (   $a_stat)

Enable scope restrictions.

Parameters
bool$a_stat

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

501  {
502  $this->scope_enabled = $a_stat;
503  }

◆ generateImportId()

ilAdvancedMDRecord::generateImportId ( )
protected

generate unique record id

protected

Returns

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

References getRecordId(), and IL_INST_ID.

Referenced by save(), and toXML().

940  {
941  return 'il_' . IL_INST_ID . '_adv_md_record_' . $this->getRecordId();
942  }
const IL_INST_ID
Definition: constants.php:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedObjectTypes()

ilAdvancedMDRecord::getAssignedObjectTypes ( )

Get assigned object types.

public

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

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

807  {
808  return $this->obj_types ? $this->obj_types : array();
809  }
+ Here is the caller graph for this function:

◆ getDefaultLanguage()

ilAdvancedMDRecord::getDefaultLanguage ( )

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

References $language_default.

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

469  :string
470  {
471  return (string) $this->language_default;
472  }
+ Here is the caller graph for this function:

◆ getDescription()

ilAdvancedMDRecord::getDescription ( )

get description

public

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

References $description.

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

745  {
746  return $this->description;
747  }
+ Here is the caller graph for this function:

◆ getGlobalPosition()

ilAdvancedMDRecord::getGlobalPosition ( )
Returns
int

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

References $global_position.

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

663  : int
664  {
665  return $this->global_position;
666  }
+ Here is the caller graph for this function:

◆ getImportId()

ilAdvancedMDRecord::getImportId ( )

get import id

public

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

References $import_id.

Referenced by save().

768  {
769  return $this->import_id;
770  }
+ Here is the caller graph for this function:

◆ getObjRecSelection()

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

Get repository object record selection.

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

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

References $DIC, and $ilDB.

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

1001  {
1002  global $DIC;
1003 
1004  $ilDB = $DIC['ilDB'];
1005 
1006  if ($a_sub_type == "") {
1007  $a_sub_type = "-";
1008  }
1009 
1010  $recs = array();
1011  $set = $ilDB->query(
1012  $r = "SELECT * FROM adv_md_obj_rec_select " .
1013  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") .
1014  " AND sub_type = " . $ilDB->quote($a_sub_type, "text")
1015  );
1016  while ($rec = $ilDB->fetchAssoc($set)) {
1017  $recs[] = $rec["rec_id"];
1018  }
1019  return $recs;
1020  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getParentObject()

ilAdvancedMDRecord::getParentObject ( )

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

References $parent_obj.

Referenced by _clone(), and save().

834  {
835  return $this->parent_obj;
836  }
+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDRecord::getRecordId ( )

Get record id.

public

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

References $record_id.

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

676  {
677  return $this->record_id;
678  }
+ Here is the caller graph for this function:

◆ getScopeRefIds()

ilAdvancedMDRecord::getScopeRefIds ( )

Get scope gef_ids.

Returns
type

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

Referenced by toXML().

528  {
529  $ref_ids = [];
530  foreach ($this->scopes as $scope) {
531  $ref_ids[] = $scope->getRefId();
532  }
533  return $ref_ids;
534  }
+ Here is the caller graph for this function:

◆ getScopes()

ilAdvancedMDRecord::getScopes ( )

Get scopes.

Returns
ilAdvancedMDRecordScope[]

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

References $scopes.

Referenced by save(), and update().

519  {
520  return $this->scopes;
521  }
+ Here is the caller graph for this function:

◆ getSharedRecords()

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

Get shared records.

Parameters
int$a_obj1_id
int$a_obj2_id
string$a_sub_type
Returns
array

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

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

1063  {
1064  $obj_type = ilObject::_lookupType($a_obj1_id);
1065  $sel = array_intersect(
1066  ilAdvancedMDRecord::getObjRecSelection($a_obj1_id, $a_sub_type),
1067  ilAdvancedMDRecord::getObjRecSelection($a_obj2_id, $a_sub_type)
1068  );
1069 
1070  $res = array();
1071 
1072  foreach (self::_getRecords() as $record) {
1073  // local records cannot be shared
1074  if ($record->getParentObject()) {
1075  continue;
1076  }
1077 
1078  // :TODO: inactive records can be ignored?
1079  if (!$record->isActive()) {
1080  continue;
1081  }
1082 
1083  // parse assigned types
1084  foreach ($record->getAssignedObjectTypes() as $item) {
1085  if ($item["obj_type"] == $obj_type &&
1086  $item["sub_type"] == $a_sub_type) {
1087  // mandatory
1088  if (!$item["optional"]) {
1089  $res[] = $record->getRecordId();
1090  }
1091  // optional
1092  elseif (in_array($record->getRecordId(), $sel)) {
1093  $res[] = $record->getRecordId();
1094  }
1095  }
1096  }
1097  }
1098 
1099  return $res;
1100  }
foreach($_POST as $key=> $value) $res
static _lookupType($a_id, $a_reference=false)
lookup object type
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
+ Here is the call graph for this function:

◆ getTitle()

ilAdvancedMDRecord::getTitle ( )

get title

public

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

References $title.

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

722  {
723  return $this->title;
724  }
+ Here is the caller graph for this function:

◆ isActive()

ilAdvancedMDRecord::isActive ( )

Check if record is active.

public

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

References $active.

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

699  {
700  return (bool) $this->active;
701  }
+ Here is the caller graph for this function:

◆ isAssignedObjectType()

ilAdvancedMDRecord::isAssignedObjectType (   $a_obj_type,
  $a_sub_type 
)

Is assigned object type?

Parameters

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

References getAssignedObjectTypes().

818  {
819  foreach ($this->getAssignedObjectTypes() as $t) {
820  if ($t["obj_type"] == $a_obj_type &&
821  $t["sub_type"] == $a_sub_type) {
822  return true;
823  }
824  }
825  return false;
826  }
getAssignedObjectTypes()
Get assigned object types.
+ 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
type$a_ref_id
ilAdvancedMDRecordScope[]$scopes

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

References $GLOBALS, and ilTree\RELATION_PARENT.

Referenced by ilAdvancedMDSettingsGUI\getParsedRecordObjects().

409  {
410  $tree = $GLOBALS['DIC']->repositoryTree();
411  $logger = $GLOBALS['DIC']->logger()->amet();
412 
413  if (!count($scopes)) {
414  return false;
415  }
416  foreach ($scopes as $scope) {
417  $logger->debug('Comparing: ' . $a_ref_id . ' with: ' . $scope->getRefId());
418  if ($scope->getRefId() == $a_ref_id) {
419  $logger->debug('Elements are equal. No scope restrictions.');
420  return false;
421  }
422  if ($tree->getRelation($scope->getRefId(), $a_ref_id) == ilTree::RELATION_PARENT) {
423  $logger->debug('Node is child node. No scope restrictions.');
424  return false;
425  }
426  }
427  $logger->info('Scope filter matches.');
428 
429  return true;
430  }
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

read record and assiged object types

private

Parameters

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

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

Referenced by __construct().

894  {
895  global $DIC;
896 
897  $ilDB = $DIC['ilDB'];
898 
899  $query = "SELECT * FROM adv_md_record " .
900  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
901  $res = $this->db->query($query);
902  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
903  $this->setImportId($row->import_id);
904  $this->setActive($row->active);
905  $this->setTitle($row->title);
906  $this->setDescription($row->description);
907  $this->setParentObject($row->parent_obj);
908  $this->setGlobalPosition((int) $row->gpos);
909  $this->setDefaultLanguage((string) $row->lang_default);
910  }
911  $query = "SELECT * FROM adv_md_record_objs " .
912  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
913  $res = $this->db->query($query);
914  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
915  $this->obj_types[] = array(
916  "obj_type" => $row->obj_type,
917  "sub_type" => $row->sub_type,
918  "optional" => (bool) $row->optional
919  );
920  }
921 
922  $query = 'SELECT scope_id FROM adv_md_record_scope ' .
923  'WHERE record_id = ' . $ilDB->quote($this->record_id);
924  $res = $ilDB->query($query);
925  $this->scope_enabled = false;
926  $this->scopes = [];
927  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
928  $this->scope_enabled = true;
929  $this->scopes[] = new ilAdvancedMDRecordScope($row->scope_id);
930  }
931  }
Scope restrictions for advanced md records.
setActive($a_active)
Set active.
setDescription($a_description)
set description
setGlobalPosition(int $position)
Set global position.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
setDefaultLanguage(string $language_code)
$query
setImportId($a_id_string)
set import id
setTitle($a_title)
Set title.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDRecord::save ( )

save

public

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

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

543  {
544  global $DIC;
545 
546  $ilDB = $DIC['ilDB'];
547 
548  // Save import id if given
549  $next_id = $ilDB->nextId('adv_md_record');
550 
551  $query = "INSERT INTO adv_md_record (record_id,import_id,active,title,description,parent_obj,lang_default) " .
552  "VALUES(" .
553  $ilDB->quote($next_id, 'integer') . ", " .
554  $this->db->quote($this->getImportId(), 'text') . ", " .
555  $this->db->quote($this->isActive(), 'integer') . ", " .
556  $this->db->quote($this->getTitle(), 'text') . ", " .
557  $this->db->quote($this->getDescription(), 'text') . ", " .
558  $this->db->quote($this->getParentObject(), 'integer') . ", " .
559  $this->db->quote((string) $this->getDefaultLanguage(), ilDBConstants::T_TEXT) .
560  ")";
561  $res = $ilDB->manipulate($query);
562  $this->record_id = $next_id;
563 
564  if (!strlen($this->getImportId())) {
565  // set import id to default value
566  $query = "UPDATE adv_md_record " .
567  "SET import_id = " . $this->db->quote($this->generateImportId(), 'text') . " " .
568  "WHERE record_id = " . $this->db->quote($this->record_id, 'integer') . " ";
569  $res = $ilDB->manipulate($query);
570  }
571 
572  foreach ($this->getAssignedObjectTypes() as $type) {
573  global $DIC;
574 
575  $ilDB = $DIC['ilDB'];
576 
577  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
578  "VALUES( " .
579  $this->db->quote($this->getRecordId(), 'integer') . ", " .
580  $this->db->quote($type["obj_type"], 'text') . ", " .
581  $this->db->quote($type["sub_type"], 'text') . ", " .
582  $this->db->quote($type["optional"], 'integer') . " " .
583  ")";
584  $res = $ilDB->manipulate($query);
585  }
586 
587  foreach ($this->getScopes() as $scope) {
588  $scope->setRecordId($this->getRecordId());
589  $scope->save();
590  }
591  }
$type
getDescription()
get description
isActive()
Check if record is active.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
getAssignedObjectTypes()
Get assigned object types.
$query
global $ilDB
generateImportId()
generate unique record id
+ Here is the call graph for this function:

◆ saveObjRecSelection()

static ilAdvancedMDRecord::saveObjRecSelection (   $a_obj_id,
  $a_sub_type = "",
array  $a_records = null,
  $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

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

References $DIC, and $ilDB.

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

965  {
966  global $DIC;
967 
968  $ilDB = $DIC['ilDB'];
969 
970  if ($a_sub_type == "") {
971  $a_sub_type = "-";
972  }
973 
974  if ((bool) $a_delete_before) {
975  $ilDB->manipulate("DELETE FROM adv_md_obj_rec_select WHERE " .
976  " obj_id = " . $ilDB->quote($a_obj_id, "integer") .
977  " AND sub_type = " . $ilDB->quote($a_sub_type, "text"));
978  }
979 
980  if (is_array($a_records)) {
981  foreach ($a_records as $r) {
982  if ($r > 0) {
983  $ilDB->manipulate("INSERT INTO adv_md_obj_rec_select " .
984  "(obj_id, rec_id, sub_type) VALUES (" .
985  $ilDB->quote($a_obj_id, "integer") . "," .
986  $ilDB->quote($r, "integer") . "," .
987  $ilDB->quote($a_sub_type, "text") .
988  ")");
989  }
990  }
991  }
992  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ setActive()

ilAdvancedMDRecord::setActive (   $a_active)

Set active.

public

Parameters

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

Referenced by read().

688  {
689  $this->active = $a_active;
690  }
+ Here is the caller graph for this function:

◆ setAssignedObjectTypes()

ilAdvancedMDRecord::setAssignedObjectTypes (   $a_obj_types)

Set assigned object types.

public

Parameters
arrayarray(string) array of object types. E.g array('crs','crsl')

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

780  {
781  $this->obj_types = $a_obj_types;
782  }

◆ setDefaultLanguage()

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

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

Referenced by read().

465  {
466  $this->language_default = $language_code;
467  }
+ Here is the caller graph for this function:

◆ setDescription()

ilAdvancedMDRecord::setDescription (   $a_description)

set description

public

Parameters
stringdescription

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

Referenced by read().

734  {
735  $this->description = $a_description;
736  }
+ Here is the caller graph for this function:

◆ setGlobalPosition()

ilAdvancedMDRecord::setGlobalPosition ( int  $position)

Set global position.

Parameters
int$position

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

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

656  {
657  $this->global_position = $position;
658  }
+ Here is the caller graph for this function:

◆ setImportId()

ilAdvancedMDRecord::setImportId (   $a_id_string)

set import id

public

Parameters
stringimport id

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

Referenced by read().

757  {
758  $this->import_id = $a_id_string;
759  }
+ Here is the caller graph for this function:

◆ setParentObject()

ilAdvancedMDRecord::setParentObject (   $a_obj_id)

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

Referenced by read().

829  {
830  $this->parent_obj = $a_obj_id;
831  }
+ Here is the caller graph for this function:

◆ setScopes()

ilAdvancedMDRecord::setScopes ( array  $a_scopes)

Set scopes.

Parameters
array$a_scopes

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

510  {
511  $this->scopes = $a_scopes;
512  }

◆ setTitle()

ilAdvancedMDRecord::setTitle (   $a_title)

Set title.

public

Parameters
stringtitle

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

Referenced by read().

711  {
712  $this->title = $a_title;
713  }
+ 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.

public

Parameters
objectilXmlWriter

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

References $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().

848  {
849  $writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0,
850  'id' => $this->generateImportId()));
851  $writer->xmlElement('Title', null, $this->getTitle());
852  $writer->xmlElement('Description', null, $this->getDescription());
853 
855  $translations->toXML($writer);
856 
857  foreach ($this->getAssignedObjectTypes() as $obj_type) {
858  $optional = array("optional" => $obj_type["optional"]);
859  if ($obj_type["sub_type"] == "") {
860  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"]);
861  } else {
862  $writer->xmlElement('ObjectType', $optional, $obj_type["obj_type"] . ":" . $obj_type["sub_type"]);
863  }
864  }
865 
866  // scopes
867  if (count($this->getScopeRefIds())) {
868  $writer->xmlStartTag('Scope');
869  }
870  foreach ($this->getScopeRefIds() as $ref_id) {
872  $writer->xmlElement('ScopeEntry', ['id' => 'il_' . IL_INST_ID . '_' . $type . '_' . $ref_id]);
873  }
874  if (count($this->getScopeRefIds())) {
875  $writer->xmlEndTag('Scope');
876  }
877 
878 
879  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
880  foreach (ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->getRecordId()) as $definition) {
881  $definition->toXML($writer);
882  }
883  $writer->xmlEndTag('Record');
884  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
const IL_INST_ID
Definition: constants.php:38
$type
getScopeRefIds()
Get scope gef_ids.
getDescription()
get description
xmlEndTag($tag)
Writes an endtag.
isActive()
Check if record is active.
static _lookupObjId($a_id)
getAssignedObjectTypes()
Get assigned object types.
static _lookupType($a_id, $a_reference=false)
lookup object type
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static getInstancesByRecordId($a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
generateImportId()
generate unique record id
+ Here is the call graph for this function:

◆ update()

ilAdvancedMDRecord::update ( )

update

public

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

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

600  {
601  global $DIC;
602 
603  $ilDB = $DIC['ilDB'];
604 
605  $query = "UPDATE adv_md_record " .
606  "SET active = " . $this->db->quote($this->isActive(), 'integer') . ", " .
607  "title = " . $this->db->quote($this->getTitle(), 'text') . ", " .
608  "description = " . $this->db->quote($this->getDescription(), 'text') . ", " .
609  'gpos = ' . $this->db->quote($this->getGlobalPosition(), 'integer') . ', ' .
610  'lang_default = ' . $this->db->quote($this->getDefaultLanguage(), ilDBConstants::T_TEXT) . ' ' .
611  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
612  $res = $ilDB->manipulate($query);
613 
614  // Delete assignments
615  $query = "DELETE FROM adv_md_record_objs " .
616  "WHERE record_id = " . $this->db->quote($this->getRecordId(), 'integer') . " ";
617  $res = $ilDB->manipulate($query);
618 
619  // Insert assignments
620  foreach ($this->getAssignedObjectTypes() as $type) {
621  $query = "INSERT INTO adv_md_record_objs (record_id,obj_type,sub_type,optional) " .
622  "VALUES ( " .
623  $this->db->quote($this->getRecordId(), 'integer') . ", " .
624  $this->db->quote($type["obj_type"], 'text') . ", " .
625  $this->db->quote($type["sub_type"], 'text') . ", " .
626  $this->db->quote($type["optional"], 'integer') . " " .
627  ")";
628  $res = $ilDB->manipulate($query);
629  }
631  foreach ($this->getScopes() as $scope) {
632  $scope->setRecordId($this->getRecordId());
633  $scope->save();
634  }
635  }
static deleteByRecordI($a_record_id)
delete by record id
$type
getDescription()
get description
isActive()
Check if record is active.
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
getAssignedObjectTypes()
Get assigned object types.
$query
global $ilDB
+ Here is the call graph for this function:

◆ validate()

ilAdvancedMDRecord::validate ( )

Validate settings.

public

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

References getTitle().

644  {
645  if (!strlen($this->getTitle())) {
646  return false;
647  }
648  return true;
649  }
+ Here is the call graph for this function:

Field Documentation

◆ $active

ilAdvancedMDRecord::$active
protected

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

Referenced by isActive().

◆ $db

ilAdvancedMDRecord::$db = null
protected

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

◆ $description

ilAdvancedMDRecord::$description
protected

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

Referenced by getDescription().

◆ $global_position

ilAdvancedMDRecord::$global_position
protected

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

Referenced by getGlobalPosition().

◆ $import_id

ilAdvancedMDRecord::$import_id
protected

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

Referenced by getImportId().

◆ $instances

ilAdvancedMDRecord::$instances = array()
staticprivate

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

◆ $language_default

ilAdvancedMDRecord::$language_default
protected

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

Referenced by getDefaultLanguage().

◆ $obj_types

ilAdvancedMDRecord::$obj_types = array()
protected

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

Referenced by _getActivatedObjTypes().

◆ $parent_obj

ilAdvancedMDRecord::$parent_obj
protected

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

Referenced by getParentObject().

◆ $record_id

ilAdvancedMDRecord::$record_id
protected

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

Referenced by _getSelectedRecordsByObject(), and getRecordId().

◆ $scope_enabled

ilAdvancedMDRecord::$scope_enabled = false
protected

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

Referenced by enabledScope().

◆ $scopes

ilAdvancedMDRecord::$scopes = []
protected

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

Referenced by getScopes().

◆ $title

ilAdvancedMDRecord::$title
protected

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

Referenced by getTitle().


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