ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMDEducational.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
33  'active' => 'Active',
34  'expositive' => 'Expositive',
35  'mixed' => 'Mixed'
36  ];
37 
39  'exercise' => 'Exercise',
40  'simulation' => 'Simulation',
41  'questionnaire' => 'Questionnaire',
42  'diagram' => 'Diagram',
43  'figure' => 'Figure',
44  'graph' => 'Graph',
45  'index' => 'Index',
46  'slide' => 'Slide',
47  'table' => 'Table',
48  'narrative text' => 'NarrativeText',
49  'exam' => 'Exam',
50  'experiment' => 'Experiment',
51  'problem statement' => 'ProblemStatement',
52  'self assessment' => 'SelfAssessment',
53  'lecture' => 'Lecture'
54  ];
55 
57  'very low' => 'VeryLow',
58  'low' => 'Low',
59  'medium' => 'Medium',
60  'high' => 'High',
61  'very high' => 'VeryHigh'
62  ];
63 
64  private const SEMANTIC_DENSITY_TRANSLATION = [
65  'very low' => 'VeryLow',
66  'low' => 'Low',
67  'medium' => 'Medium',
68  'high' => 'High',
69  'very high' => 'VeryHigh'
70  ];
71 
73  'teacher' => 'Teacher',
74  'author' => 'Author',
75  'learner' => 'Learner',
76  'manager' => 'Manager'
77  ];
78 
79  private const CONTEXT_TRANSLATION = [
80  'school' => 'School',
81  'higher education' => 'HigherEducation',
82  'training' => 'Training',
83  'other' => 'Other'
84  ];
85 
86  private const DIFFICULTY_TRANSLATION = [
87  'very easy' => 'VeryEasy',
88  'easy' => 'Easy',
89  'medium' => 'Medium',
90  'difficult' => 'Difficult',
91  'very difficult' => 'VeryDifficult'
92  ];
93 
94  private string $interactivity_type = '';
95  private string $learning_resource_type = '';
96  private string $interactivity_level = '';
97  private string $semantic_density = '';
98  private string $intended_end_user_role = '';
99  private string $context = '';
100  private string $difficulty = '';
101  private string $typical_learning_time = '';
102 
103 
107  private int $learning_resource_type_id = 0;
108  private int $intended_end_user_role_id = 0;
109  private int $context_id = 0;
110 
114  public function getTypicalAgeRangeIds(): array
115  {
117  $this->getRBACId(),
118  $this->getObjId(),
119  $this->getMetaId(),
120  'meta_educational'
121  );
122  }
123 
124  public function getTypicalAgeRange(int $a_typical_age_range_id): ?ilMDTypicalAgeRange
125  {
126  if (!$a_typical_age_range_id) {
127  return null;
128  }
129  $typ = new ilMDTypicalAgeRange();
130  $typ->setMetaId($a_typical_age_range_id);
131 
132  return $typ;
133  }
134 
136  {
137  $typ = new ilMDTypicalAgeRange($this->getRBACId(), $this->getObjId(), $this->getObjType());
138  $typ->setParentId($this->getMetaId());
139  $typ->setParentType('meta_educational');
140 
141  return $typ;
142  }
143 
147  public function getDescriptionIds(): array
148  {
149  return ilMDDescription::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_educational');
150  }
151 
152  public function getDescription(int $a_description_id): ?ilMDDescription
153  {
154  if (!$a_description_id) {
155  return null;
156  }
157  $des = new ilMDDescription();
158  $des->setMetaId($a_description_id);
159 
160  return $des;
161  }
162 
163  public function addDescription(): ilMDDescription
164  {
165  $des = new ilMDDescription($this->getRBACId(), $this->getObjId(), $this->getObjType());
166  $des->setParentId($this->getMetaId());
167  $des->setParentType('meta_educational');
168 
169  return $des;
170  }
171 
175  public function getLanguageIds(): array
176  {
177  return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_educational');
178  }
179 
180  public function getLanguage(int $a_language_id): ?ilMDLanguage
181  {
182  if (!$a_language_id) {
183  return null;
184  }
185  $lan = new ilMDLanguage();
186  $lan->setMetaId($a_language_id);
187 
188  return $lan;
189  }
190 
191  public function addLanguage(): ilMDLanguage
192  {
193  $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId(), $this->getObjType());
194  $lan->setParentId($this->getMetaId());
195  $lan->setParentType('meta_educational');
196 
197  return $lan;
198  }
199 
200  // SET/GET
201  public function setInteractivityType(string $a_iat): bool
202  {
203  switch ($a_iat) {
204  case 'Active':
205  case 'Expositive':
206  case 'Mixed':
207  $this->interactivity_type = $a_iat;
208  return true;
209 
210  default:
211  return false;
212  }
213  }
214 
215  public function getInteractivityType(): string
216  {
218  }
219 
220  public function setLearningResourceType(string $a_lrt): bool
221  {
222  switch ($a_lrt) {
223  case 'Exercise':
224  case 'Simulation':
225  case 'Questionnaire':
226  case 'Diagram':
227  case 'Figure':
228  case 'Graph':
229  case 'Index':
230  case 'Slide':
231  case 'Table':
232  case 'NarrativeText':
233  case 'Exam':
234  case 'Experiment':
235  case 'ProblemStatement':
236  case 'SelfAssessment':
237  case 'Lecture':
238  $this->learning_resource_type = $a_lrt;
239  return true;
240 
241  default:
242  return false;
243  }
244  }
245 
246  public function getLearningResourceType(): string
247  {
249  }
250 
251  public function setInteractivityLevel(string $a_iat): bool
252  {
253  switch ($a_iat) {
254  case 'VeryLow':
255  case 'Low':
256  case 'Medium':
257  case 'High':
258  case 'VeryHigh':
259  $this->interactivity_level = $a_iat;
260  return true;
261 
262  default:
263  return false;
264  }
265  }
266 
267  public function getInteractivityLevel(): string
268  {
270  }
271 
272  public function setSemanticDensity(string $a_sd): bool
273  {
274  switch ($a_sd) {
275  case 'VeryLow':
276  case 'Low':
277  case 'Medium':
278  case 'High':
279  case 'VeryHigh':
280  $this->semantic_density = $a_sd;
281  return true;
282 
283  default:
284  return false;
285  }
286  }
287 
288  public function getSemanticDensity(): string
289  {
291  }
292 
293  public function setIntendedEndUserRole(string $a_ieur): bool
294  {
295  switch ($a_ieur) {
296  case 'Teacher':
297  case 'Author':
298  case 'Learner':
299  case 'Manager':
300  $this->intended_end_user_role = $a_ieur;
301  return true;
302 
303  default:
304  return false;
305  }
306  }
307 
308  public function getIntendedEndUserRole(): string
309  {
311  }
312 
313  public function setContext(string $a_context): bool
314  {
315  switch ($a_context) {
316  case 'School':
317  case 'HigherEducation':
318  case 'Training':
319  case 'Other':
320  $this->context = $a_context;
321  return true;
322 
323  default:
324  return false;
325  }
326  }
327 
328  public function getContext(): string
329  {
330  return $this->context;
331  }
332 
333  public function setDifficulty(string $a_difficulty): bool
334  {
335  switch ($a_difficulty) {
336  case 'VeryEasy':
337  case 'Easy':
338  case 'Medium':
339  case 'Difficult':
340  case 'VeryDifficult':
341  $this->difficulty = $a_difficulty;
342  return true;
343 
344  default:
345  return false;
346  }
347  }
348 
349  public function getDifficulty(): string
350  {
351  return $this->difficulty;
352  }
353 
355  int $months,
356  int $days,
357  int $hours,
358  int $minutes,
359  int $seconds
360  ): bool {
361  if (!$months && !$days && !$hours && !$minutes && !$seconds) {
362  $this->setTypicalLearningTime('PT00H00M');
363  return true;
364  }
365  $tlt = 'P';
366  if ($months) {
367  $tlt .= ($months . 'M');
368  }
369  if ($days) {
370  $tlt .= ($days . 'D');
371  }
372  if ($hours || $minutes || $seconds) {
373  $tlt .= 'T';
374  }
375  if ($hours) {
376  $tlt .= ($hours . 'H');
377  }
378  if ($minutes) {
379  $tlt .= ($minutes . 'M');
380  }
381  if ($seconds) {
382  $tlt .= ($seconds . 'S');
383  }
384  $this->setTypicalLearningTime($tlt);
385  return true;
386  }
387 
388  public function setTypicalLearningTime(string $a_tlt): void
389  {
390  $this->typical_learning_time = $a_tlt;
391  }
392 
393  public function getTypicalLearningTime(): string
394  {
396  }
397 
399  {
401  if ($time_arr === []) {
402  return 0;
403  }
404  return 60 * 60 * 24 * 30 * $time_arr[0] + 60 * 60 * 24 * $time_arr[1] + 60 * 60 * $time_arr[2] + 60 * $time_arr[3] + $time_arr[4];
405  }
406 
407  public function save(): int
408  {
409  $fields = $this->__getFields();
410  $fields['meta_educational_id'] = array('integer', $next_id = $this->db->nextId('il_meta_educational'));
411 
412  if ($this->db->insert('il_meta_educational', $fields)) {
413  $this->setMetaId($next_id);
416  $this->createOrUpdateContext();
417  return $this->getMetaId();
418  }
419  return 0;
420  }
421 
422  public function update(): bool
423  {
424  if (!$this->getMetaId()) {
425  return false;
426  }
427 
430  $this->createOrUpdateContext();
431 
432  return (bool) $this->db->update(
433  'il_meta_educational',
434  $this->__getFields(),
435  array("meta_educational_id" => array('integer', $this->getMetaId()))
436  );
437  }
438 
439  public function delete(): bool
440  {
441  if ($this->getMetaId()) {
442  $query = "DELETE FROM il_meta_educational " .
443  "WHERE meta_educational_id = " . $this->db->quote($this->getMetaId(), ilDBConstants::T_INTEGER);
444  $res = $this->db->manipulate($query);
445 
448  $this->deleteAllContexts();
449 
450  foreach ($this->getTypicalAgeRangeIds() as $id) {
451  $typ = $this->getTypicalAgeRange($id);
452  $typ->delete();
453  }
454  foreach ($this->getDescriptionIds() as $id) {
455  $des = $this->getDescription($id);
456  $des->delete();
457  }
458  foreach ($this->getLanguageIds() as $id) {
459  $lan = $this->getLanguage($id);
460  $lan->delete();
461  }
462 
463  return true;
464  }
465  return false;
466  }
467 
471  public function __getFields(): array
472  {
476  $interactivity_type = (string) array_search(
477  $this->getInteractivityType(),
478  self::INTERACTIVITY_TYPE_TRANSLATION
479  );
480  $interactivity_level = (string) array_search(
481  $this->getInteractivityLevel(),
482  self::INTERACTIVITY_LEVEL_TRANSLATION
483  );
484  $semantic_density = (string) array_search(
485  $this->getSemanticDensity(),
486  self::SEMANTIC_DENSITY_TRANSLATION
487  );
488  $difficulty = (string) array_search(
489  $this->getDifficulty(),
490  self::DIFFICULTY_TRANSLATION
491  );
492 
493  return array(
494  'rbac_id' => array('integer', $this->getRBACId()),
495  'obj_id' => array('integer', $this->getObjId()),
496  'obj_type' => array('text', $this->getObjType()),
497  'interactivity_type' => array('text', $interactivity_type),
498  //'learning_resource_type' => array('text', $this->getLearningResourceType()),
499  'interactivity_level' => array('text', $interactivity_level),
500  'semantic_density' => array('text', $semantic_density),
501  //'intended_end_user_role' => array('text', $this->getIntendedEndUserRole()),
502  //'context' => array('text', $this->getContext()),
503  'difficulty' => array('text', $difficulty),
504  'typical_learning_time' => array('text', $this->getTypicalLearningTime())
505  );
506  }
507 
508  public function read(): bool
509  {
510  if ($this->getMetaId()) {
511  $query = "SELECT * FROM il_meta_educational " .
512  "WHERE meta_educational_id = " . $this->db->quote($this->getMetaId(), 'integer');
513 
514  $res = $this->db->query($query);
515  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
519  if (key_exists($row->interactivity_type ?? '', self::INTERACTIVITY_TYPE_TRANSLATION)) {
520  $row->interactivity_type = self::INTERACTIVITY_TYPE_TRANSLATION[$row->interactivity_type ?? ''];
521  }
522  if (key_exists($row->interactivity_level ?? '', self::INTERACTIVITY_LEVEL_TRANSLATION)) {
523  $row->interactivity_level = self::INTERACTIVITY_LEVEL_TRANSLATION[$row->interactivity_level ?? ''];
524  }
525  if (key_exists($row->semantic_density ?? '', self::SEMANTIC_DENSITY_TRANSLATION)) {
526  $row->semantic_density = self::SEMANTIC_DENSITY_TRANSLATION[$row->semantic_density ?? ''];
527  }
528  if (key_exists($row->difficulty ?? '', self::DIFFICULTY_TRANSLATION)) {
529  $row->difficulty = self::DIFFICULTY_TRANSLATION[$row->difficulty ?? ''];
530  }
531 
532  $this->setRBACId((int) $row->rbac_id);
533  $this->setObjId((int) $row->obj_id);
534  $this->setObjType($row->obj_type ?? '');
535  $this->setInteractivityType($row->interactivity_type ?? '');
536  //$this->setLearningResourceType($row->learning_resource_type ?? '');
537  $this->setInteractivityLevel($row->interactivity_level ?? '');
538  $this->setSemanticDensity($row->semantic_density ?? '');
539  //$this->setIntendedEndUserRole($row->intended_end_user_role ?? '');
540  //$this->setContext($row->context ?? '');
541  $this->setDifficulty($row->difficulty ?? '');
542  $this->setTypicalLearningTime($row->typical_learning_time ?? '');
543  }
544 
547  $this->readFirstContext();
548  return true;
549  }
550  return false;
551  }
552 
553  public function toXML(ilXmlWriter $writer): void
554  {
555  $writer->xmlStartTag(
556  'Educational',
557  array(
558  'InteractivityType' => $this->getInteractivityType() ?: 'Active',
559  'LearningResourceType' => $this->getLearningResourceType() ?: 'Exercise',
560  'InteractivityLevel' => $this->getInteractivityLevel() ?: 'Medium',
561  'SemanticDensity' => $this->getSemanticDensity() ?: 'Medium',
562  'IntendedEndUserRole' => $this->getIntendedEndUserRole() ?: 'Learner',
563  'Context' => $this->getContext() ?: 'Other',
564  'Difficulty' => $this->getDifficulty() ?: 'Medium'
565  )
566  );
567 
568  // TypicalAgeRange
569  $typ_ages = $this->getTypicalAgeRangeIds();
570  foreach ($typ_ages as $id) {
571  $key = $this->getTypicalAgeRange($id);
572 
573  // extra test due to bug 5316 (may be due to eLaix import)
574  if (is_object($key)) {
575  $key->toXML($writer);
576  }
577  }
578  if (!count($typ_ages)) {
579  $typ = new ilMDTypicalAgeRange($this->getRBACId(), $this->getObjId());
580  $typ->toXML($writer);
581  }
582 
583  // TypicalLearningTime
584  $writer->xmlElement('TypicalLearningTime', null, $this->getTypicalLearningTime());
585 
586  // Description
587  foreach ($this->getDescriptionIds() as $id) {
588  $key = $this->getDescription($id);
589  $key->toXML($writer);
590  }
591  // Language
592  foreach ($this->getLanguageIds() as $id) {
593  $lang = $this->getLanguage($id);
594  $lang->toXML($writer);
595  }
596  $writer->xmlEndTag('Educational');
597  }
598 
599  // STATIC
600  public static function _getId(int $a_rbac_id, int $a_obj_id): int
601  {
602  global $DIC;
603 
604  $ilDB = $DIC->database();
605 
606  $query = "SELECT meta_educational_id FROM il_meta_educational " .
607  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
608  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
609 
610  $res = $ilDB->query($query);
611  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
612  return (int) $row->meta_educational_id;
613  }
614  return 0;
615  }
616 
617  public static function _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id = 0): int
618  {
619  global $DIC;
620 
621  $ilDB = $DIC->database();
622 
623  $a_obj_id = $a_obj_id ?: $a_rbac_id;
624 
625  $query = "SELECT typical_learning_time FROM il_meta_educational " .
626  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
627  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
628  $res = $ilDB->query($query);
629  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
630  $time_arr = ilMDUtils::_LOMDurationToArray((string) $row->typical_learning_time);
631  if (!count($time_arr)) {
632  return 0;
633  }
634  return 60 * 60 * 24 * 30 * $time_arr[0] +
635  60 * 60 * 24 * $time_arr[1] +
636  60 * 60 * $time_arr[2] +
637  60 * $time_arr[3] +
638  $time_arr[4];
639  }
640  return 0;
641  }
642 
646  protected function createOrUpdateLearningResourceType(): void
647  {
648  $learning_resource_type = (string) array_search(
649  $this->getLearningResourceType(),
650  self::LEARNING_RESOURCE_TYPE_TRANSLATION
651  );
652 
653  $this->learning_resource_type_id = $this->createOrUpdateInNewTable(
654  'il_meta_lr_type',
655  'meta_lr_type_id',
656  $this->getLearningResourceTypeId(),
657  'learning_resource_type',
658  $learning_resource_type
659  );
660  }
661 
665  protected function createOrUpdateIntendedEndUserRole(): void
666  {
667  $intended_end_user_role = (string) array_search(
668  $this->getIntendedEndUserRole(),
669  self::INTENDED_END_USER_ROLE_TRANSLATION
670  );
671 
672  $this->intended_end_user_role_id = $this->createOrUpdateInNewTable(
673  'il_meta_end_usr_role',
674  'meta_end_usr_role_id',
675  $this->getIntendedEndUserRoleId(),
676  'intended_end_user_role',
677  $intended_end_user_role
678  );
679  }
680 
684  protected function createOrUpdateContext(): void
685  {
686  $context = (string) array_search(
687  $this->getContext(),
688  self::CONTEXT_TRANSLATION
689  );
690 
691  $this->context_id = $this->createOrUpdateInNewTable(
692  'il_meta_context',
693  'meta_context_id',
694  $this->getContextId(),
695  'context',
696  $context
697  );
698  }
699 
703  protected function createOrUpdateInNewTable(
704  string $table,
705  string $id_field,
706  int $id,
707  string $data_field,
708  string $data_value
709  ): int {
710  if ($data_value === '') {
711  return 0;
712  }
713 
714  if (!$id) {
715  $this->db->insert(
716  $table,
717  [
718  $id_field => ['integer', $next_id = $this->db->nextId($table)],
719  'rbac_id' => ['integer', $this->getRBACId()],
720  'obj_id' => ['integer', $this->getObjId()],
721  'obj_type' => ['text', $this->getObjType()],
722  'parent_type' => ['text', 'meta_educational'],
723  'parent_id' => ['integer', $this->getMetaId()],
724  $data_field => ['text', $data_value]
725  ]
726  );
727  return $next_id;
728  }
729 
730  $this->db->update(
731  $table,
732  [$data_field => ['text', $data_value]],
733  [$id_field => ['integer', $id]]
734  );
735  return $id;
736  }
737 
741  protected function readFirstLearningResourceType(): void
742  {
743  $query = "SELECT * FROM il_meta_lr_type WHERE meta_lr_type_id = " .
744  $this->db->quote($this->getLearningResourceTypeId(), 'integer');
745 
746  $res = $this->db->query($query);
747  if ($row = $this->db->fetchAssoc($res)) {
748  if (key_exists($row['learning_resource_type'], self::LEARNING_RESOURCE_TYPE_TRANSLATION)) {
749  $row['learning_resource_type'] = self::LEARNING_RESOURCE_TYPE_TRANSLATION[$row['learning_resource_type']];
750  }
751  $this->setLearningResourceType((string) $row['learning_resource_type']);
752  }
753  }
754 
758  protected function readFirstIntendedEndUserRole(): void
759  {
760  $query = "SELECT * FROM il_meta_end_usr_role WHERE meta_end_usr_role_id = " .
761  $this->db->quote($this->getIntendedEndUserRoleId(), 'integer');
762 
763  $res = $this->db->query($query);
764  if ($row = $this->db->fetchAssoc($res)) {
765  if (key_exists($row['intended_end_user_role'], self::INTENDED_END_USER_ROLE_TRANSLATION)) {
766  $row['intended_end_user_role'] = self::INTENDED_END_USER_ROLE_TRANSLATION[$row['intended_end_user_role']];
767  }
768  $this->setIntendedEndUserRole((string) $row['intended_end_user_role']);
769  }
770  }
771 
775  protected function readFirstContext(): void
776  {
777  $query = "SELECT * FROM il_meta_context WHERE meta_context_id = " .
778  $this->db->quote($this->getContextId(), 'integer');
779 
780  $res = $this->db->query($query);
781  if ($row = $this->db->fetchAssoc($res)) {
782  if (key_exists($row['context'], self::CONTEXT_TRANSLATION)) {
783  $row['context'] = self::CONTEXT_TRANSLATION[$row['context']];
784  }
785  $this->setContext((string) $row['context']);
786  }
787  }
788 
792  protected function deleteAllLearningResourceTypes(): void
793  {
794  $query = "DELETE FROM il_meta_lr_type WHERE parent_type = 'meta_educational'
795  AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
796  $res = $this->db->manipulate($query);
797  }
798 
802  protected function deleteAllIntendedEndUserRoles(): void
803  {
804  $query = "DELETE FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational'
805  AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
806  $res = $this->db->manipulate($query);
807  }
808 
812  protected function deleteAllContexts(): void
813  {
814  $query = "DELETE FROM il_meta_context WHERE parent_type = 'meta_educational'
815  AND parent_id = " . $this->db->quote($this->getMetaId(), 'integer');
816  $res = $this->db->manipulate($query);
817  }
818 
822  protected function getLearningResourceTypeId(): int
823  {
825  }
826 
830  protected function getIntendedEndUserRoleId(): int
831  {
833  }
834 
838  protected function getContextId(): int
839  {
840  return $this->context_id;
841  }
842 
846  protected function readLearningResourceTypeId(int $parent_id): void
847  {
848  $query = "SELECT meta_lr_type_id FROM il_meta_lr_type WHERE parent_type = 'meta_educational'
849  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
850  " ORDER BY meta_lr_type_id";
851 
852  $res = $this->db->query($query);
853  if ($row = $this->db->fetchAssoc($res)) {
854  $this->learning_resource_type_id = (int) $row['meta_lr_type_id'];
855  }
856  }
857 
861  protected function readIntendedEndUserRoleId(int $parent_id): void
862  {
863  $query = "SELECT meta_end_usr_role_id FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational'
864  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
865  " ORDER BY meta_end_usr_role_id";
866 
867  $res = $this->db->query($query);
868  if ($row = $this->db->fetchAssoc($res)) {
869  $this->intended_end_user_role_id = (int) $row['meta_end_usr_role_id'];
870  }
871  }
872 
876  protected function readContextId(int $parent_id): void
877  {
878  $query = "SELECT meta_context_id FROM il_meta_context WHERE parent_type = 'meta_educational'
879  AND parent_id = " . $this->db->quote($parent_id, 'integer') .
880  " ORDER BY meta_context_id";
881 
882  $res = $this->db->query($query);
883  if ($row = $this->db->fetchAssoc($res)) {
884  $this->context_id = (int) $row['meta_context_id'];
885  }
886  }
887 
891  public function setMetaId(int $a_meta_id, bool $a_read_data = true): void
892  {
893  $this->readLearningResourceTypeId($a_meta_id);
894  $this->readIntendedEndUserRoleId($a_meta_id);
895  $this->readContextId($a_meta_id);
896  parent::setMetaId($a_meta_id, $a_read_data);
897  }
898 }
readFirstIntendedEndUserRole()
Compatibility fix for legacy MD classes for new db tables.
$res
Definition: ltiservices.php:66
static _LOMDurationToArray(string $a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
const const const const const INTENDED_END_USER_ROLE_TRANSLATION
readContextId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
readFirstLearningResourceType()
Compatibility fix for legacy MD classes for new db tables.
setTypicalLearningTime(string $a_tlt)
getTypicalAgeRange(int $a_typical_age_range_id)
setIntendedEndUserRole(string $a_ieur)
createOrUpdateLearningResourceType()
Compatibility fix for legacy MD classes for new db tables.
createOrUpdateIntendedEndUserRole()
Compatibility fix for legacy MD classes for new db tables.
getDescription(int $a_description_id)
setInteractivityLevel(string $a_iat)
setMetaId(int $a_meta_id, bool $a_read_data=true)
Compatibility fix for legacy MD classes for new db tables.
deleteAllLearningResourceTypes()
Compatibility fix for legacy MD classes for new db tables.
getIntendedEndUserRoleId()
Compatibility fix for legacy MD classes for new db tables.
deleteAllContexts()
Compatibility fix for legacy MD classes for new db tables.
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
setRBACId(int $a_id)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
deleteAllIntendedEndUserRoles()
Compatibility fix for legacy MD classes for new db tables.
static _getId(int $a_rbac_id, int $a_obj_id)
int $learning_resource_type_id
Compatibility fix for legacy MD classes for new db tables.
xmlEndTag(string $tag)
Writes an endtag.
const const const INTERACTIVITY_LEVEL_TRANSLATION
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
readFirstContext()
Compatibility fix for legacy MD classes for new db tables.
setObjId(int $a_id)
static _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id=0)
setInteractivityType(string $a_iat)
setContext(string $a_context)
const const const const const const const DIFFICULTY_TRANSLATION
const const const const SEMANTIC_DENSITY_TRANSLATION
setDifficulty(string $a_difficulty)
const const LEARNING_RESOURCE_TYPE_TRANSLATION
global $DIC
Definition: shib_login.php:22
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
getContextId()
Compatibility fix for legacy MD classes for new db tables.
getLanguage(int $a_language_id)
setLearningResourceType(string $a_lrt)
$lang
Definition: xapiexit.php:25
const const const const const const const string $interactivity_type
readIntendedEndUserRoleId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
createOrUpdateInNewTable(string $table, string $id_field, int $id, string $data_field, string $data_value)
Compatibility fix for legacy MD classes for new db tables.
setSemanticDensity(string $a_sd)
const INTERACTIVITY_TYPE_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
createOrUpdateContext()
Compatibility fix for legacy MD classes for new db tables.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
toXML(ilXmlWriter $writer)
getLearningResourceTypeId()
Compatibility fix for legacy MD classes for new db tables.
setObjType(string $a_type)
setPhysicalTypicalLearningTime(int $months, int $days, int $hours, int $minutes, int $seconds)
readLearningResourceTypeId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
const const const const const const CONTEXT_TRANSLATION