19 declare(strict_types=1);
33 'expositive' =>
'Expositive',
38 'exercise' =>
'Exercise',
39 'simulation' =>
'Simulation',
40 'questionnaire' =>
'Questionnaire',
41 'diagram' =>
'Diagram',
47 'narrative text' =>
'NarrativeText',
49 'experiment' =>
'Experiment',
50 'problem statement' =>
'ProblemStatement',
51 'self assessment' =>
'SelfAssessment',
52 'lecture' =>
'Lecture' 56 'very low' =>
'VeryLow',
60 'very high' =>
'VeryHigh' 64 'very low' =>
'VeryLow',
68 'very high' =>
'VeryHigh' 72 'teacher' =>
'Teacher',
74 'learner' =>
'Learner',
75 'manager' =>
'Manager' 80 'higher education' =>
'HigherEducation',
81 'training' =>
'Training',
86 'very easy' =>
'VeryEasy',
89 'difficult' =>
'Difficult',
90 'very difficult' =>
'VeryDifficult' 125 if (!$a_typical_age_range_id) {
129 $typ->setMetaId($a_typical_age_range_id);
138 $typ->setParentType(
'meta_educational');
153 if (!$a_description_id) {
157 $des->setMetaId($a_description_id);
166 $des->setParentType(
'meta_educational');
181 if (!$a_language_id) {
185 $lan->setMetaId($a_language_id);
194 $lan->setParentType(
'meta_educational');
206 $this->interactivity_type = $a_iat;
224 case 'Questionnaire':
231 case 'NarrativeText':
234 case 'ProblemStatement':
235 case 'SelfAssessment':
237 $this->learning_resource_type = $a_lrt;
258 $this->interactivity_level = $a_iat;
279 $this->semantic_density = $a_sd;
299 $this->intended_end_user_role = $a_ieur;
314 switch ($a_context) {
316 case 'HigherEducation':
319 $this->context = $a_context;
334 switch ($a_difficulty) {
339 case 'VeryDifficult':
340 $this->difficulty = $a_difficulty;
360 if (!$months && !$days && !$hours && !$minutes && !$seconds) {
366 $tlt .= ($months .
'M');
369 $tlt .= ($days .
'D');
371 if ($hours || $minutes || $seconds) {
375 $tlt .= ($hours .
'H');
378 $tlt .= ($minutes .
'M');
381 $tlt .= ($seconds .
'S');
389 $this->typical_learning_time = $a_tlt;
400 if ($time_arr === []) {
403 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];
409 $fields[
'meta_educational_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_educational'));
411 if ($this->db->insert(
'il_meta_educational', $fields)) {
431 return (
bool) $this->db->update(
432 'il_meta_educational',
434 array(
"meta_educational_id" => array(
'integer', $this->
getMetaId()))
438 public function delete():
bool 441 $query =
"DELETE FROM il_meta_educational " .
443 $res = $this->db->manipulate($query);
475 $interactivity_type = (string) array_search(
477 self::INTERACTIVITY_TYPE_TRANSLATION
479 $interactivity_level = (string) array_search(
481 self::INTERACTIVITY_LEVEL_TRANSLATION
483 $semantic_density = (string) array_search(
485 self::SEMANTIC_DENSITY_TRANSLATION
487 $difficulty = (string) array_search(
489 self::DIFFICULTY_TRANSLATION
493 'rbac_id' => array(
'integer', $this->
getRBACId()),
494 'obj_id' => array(
'integer', $this->
getObjId()),
495 'obj_type' => array(
'text', $this->
getObjType()),
496 'interactivity_type' => array(
'text', $interactivity_type),
498 'interactivity_level' => array(
'text', $interactivity_level),
499 'semantic_density' => array(
'text', $semantic_density),
502 'difficulty' => array(
'text', $difficulty),
510 $query =
"SELECT * FROM il_meta_educational " .
511 "WHERE meta_educational_id = " . $this->db->quote($this->
getMetaId(),
'integer');
513 $res = $this->db->query($query);
518 if (key_exists($row->interactivity_type ??
'', self::INTERACTIVITY_TYPE_TRANSLATION)) {
519 $row->interactivity_type = self::INTERACTIVITY_TYPE_TRANSLATION[$row->interactivity_type ??
''];
521 if (key_exists($row->interactivity_level ??
'', self::INTERACTIVITY_LEVEL_TRANSLATION)) {
522 $row->interactivity_level = self::INTERACTIVITY_LEVEL_TRANSLATION[$row->interactivity_level ??
''];
524 if (key_exists($row->semantic_density ??
'', self::SEMANTIC_DENSITY_TRANSLATION)) {
525 $row->semantic_density = self::SEMANTIC_DENSITY_TRANSLATION[$row->semantic_density ??
''];
527 if (key_exists($row->difficulty ??
'', self::DIFFICULTY_TRANSLATION)) {
528 $row->difficulty = self::DIFFICULTY_TRANSLATION[$row->difficulty ??
''];
532 $this->
setObjId((
int) $row->obj_id);
569 foreach ($typ_ages as
$id) {
573 if (is_object(
$key)) {
574 $key->toXML($writer);
577 if (!count($typ_ages)) {
579 $typ->toXML($writer);
588 $key->toXML($writer);
593 $lang->toXML($writer);
599 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 603 $ilDB = $DIC->database();
605 $query =
"SELECT meta_educational_id FROM il_meta_educational " .
606 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
607 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
611 return (
int) $row->meta_educational_id;
620 $ilDB = $DIC->database();
622 $a_obj_id = $a_obj_id ?: $a_rbac_id;
624 $query =
"SELECT typical_learning_time FROM il_meta_educational " .
625 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
626 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
630 if (!count($time_arr)) {
633 return 60 * 60 * 24 * 30 * $time_arr[0] +
634 60 * 60 * 24 * $time_arr[1] +
635 60 * 60 * $time_arr[2] +
647 $learning_resource_type = (string) array_search(
649 self::LEARNING_RESOURCE_TYPE_TRANSLATION
656 'learning_resource_type',
657 $learning_resource_type
666 $intended_end_user_role = (string) array_search(
668 self::INTENDED_END_USER_ROLE_TRANSLATION
672 'il_meta_end_usr_role',
673 'meta_end_usr_role_id',
675 'intended_end_user_role',
676 $intended_end_user_role
685 $context = (string) array_search(
687 self::CONTEXT_TRANSLATION
709 if ($data_value ===
'') {
717 $id_field => [
'integer', $next_id = $this->db->nextId($table)],
718 'rbac_id' => [
'integer', $this->
getRBACId()],
719 'obj_id' => [
'integer', $this->
getObjId()],
721 'parent_type' => [
'text',
'meta_educational'],
722 'parent_id' => [
'integer', $this->
getMetaId()],
723 $data_field => [
'text', $data_value]
731 [$data_field => [
'text', $data_value]],
732 [$id_field => [
'integer', $id]]
742 $query =
"SELECT * FROM il_meta_lr_type WHERE meta_lr_type_id = " .
745 $res = $this->db->query($query);
746 if ($row = $this->db->fetchAssoc(
$res)) {
747 if (key_exists($row[
'learning_resource_type'], self::LEARNING_RESOURCE_TYPE_TRANSLATION)) {
748 $row[
'learning_resource_type'] = self::LEARNING_RESOURCE_TYPE_TRANSLATION[$row[
'learning_resource_type']];
759 $query =
"SELECT * FROM il_meta_end_usr_role WHERE meta_end_usr_role_id = " .
762 $res = $this->db->query($query);
763 if ($row = $this->db->fetchAssoc(
$res)) {
764 if (key_exists($row[
'intended_end_user_role'], self::INTENDED_END_USER_ROLE_TRANSLATION)) {
765 $row[
'intended_end_user_role'] = self::INTENDED_END_USER_ROLE_TRANSLATION[$row[
'intended_end_user_role']];
776 $query =
"SELECT * FROM il_meta_context WHERE meta_context_id = " .
779 $res = $this->db->query($query);
780 if ($row = $this->db->fetchAssoc(
$res)) {
781 if (key_exists($row[
'context'], self::CONTEXT_TRANSLATION)) {
782 $row[
'context'] = self::CONTEXT_TRANSLATION[$row[
'context']];
793 $query =
"DELETE FROM il_meta_lr_type WHERE parent_type = 'meta_educational' 794 AND parent_id = " . $this->db->quote($this->
getMetaId(),
'integer');
795 $res = $this->db->manipulate($query);
803 $query =
"DELETE FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational' 804 AND parent_id = " . $this->db->quote($this->
getMetaId(),
'integer');
805 $res = $this->db->manipulate($query);
813 $query =
"DELETE FROM il_meta_context WHERE parent_type = 'meta_educational' 814 AND parent_id = " . $this->db->quote($this->
getMetaId(),
'integer');
815 $res = $this->db->manipulate($query);
847 $query =
"SELECT meta_lr_type_id FROM il_meta_lr_type WHERE parent_type = 'meta_educational' 848 AND parent_id = " . $this->db->quote($parent_id,
'integer') .
849 " ORDER BY meta_lr_type_id";
851 $res = $this->db->query($query);
852 if ($row = $this->db->fetchAssoc(
$res)) {
853 $this->learning_resource_type_id = (
int) $row[
'meta_lr_type_id'];
862 $query =
"SELECT meta_end_usr_role_id FROM il_meta_end_usr_role WHERE parent_type = 'meta_educational' 863 AND parent_id = " . $this->db->quote($parent_id,
'integer') .
864 " ORDER BY meta_end_usr_role_id";
866 $res = $this->db->query($query);
867 if ($row = $this->db->fetchAssoc(
$res)) {
868 $this->intended_end_user_role_id = (
int) $row[
'meta_end_usr_role_id'];
877 $query =
"SELECT meta_context_id FROM il_meta_context WHERE parent_type = 'meta_educational' 878 AND parent_id = " . $this->db->quote($parent_id,
'integer') .
879 " ORDER BY meta_context_id";
881 $res = $this->db->query($query);
882 if ($row = $this->db->fetchAssoc(
$res)) {
883 $this->context_id = (
int) $row[
'meta_context_id'];
890 public function setMetaId(
int $a_meta_id,
bool $a_read_data =
true): void
895 parent::setMetaId($a_meta_id, $a_read_data);
readFirstIntendedEndUserRole()
Compatibility fix for legacy MD classes for new db tables.
string $intended_end_user_role
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTypicalLearningTimeSeconds()
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)
int $intended_end_user_role_id
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
getLearningResourceType()
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
readFirstContext()
Compatibility fix for legacy MD classes for new db tables.
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)
string $typical_learning_time
const const LEARNING_RESOURCE_TYPE_TRANSLATION
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)
string $learning_resource_type
const const const const const const const string $interactivity_type
readIntendedEndUserRoleId(int $parent_id)
Compatibility fix for legacy MD classes for new db tables.
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)
string $interactivity_level
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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