19 declare(strict_types=1);
34 'expositive' =>
'Expositive',
39 'exercise' =>
'Exercise',
40 'simulation' =>
'Simulation',
41 'questionnaire' =>
'Questionnaire',
42 'diagram' =>
'Diagram',
48 'narrative text' =>
'NarrativeText',
50 'experiment' =>
'Experiment',
51 'problem statement' =>
'ProblemStatement',
52 'self assessment' =>
'SelfAssessment',
53 'lecture' =>
'Lecture' 57 'very low' =>
'VeryLow',
61 'very high' =>
'VeryHigh' 65 'very low' =>
'VeryLow',
69 'very high' =>
'VeryHigh' 73 'teacher' =>
'Teacher',
75 'learner' =>
'Learner',
76 'manager' =>
'Manager' 81 'higher education' =>
'HigherEducation',
82 'training' =>
'Training',
87 'very easy' =>
'VeryEasy',
90 'difficult' =>
'Difficult',
91 'very difficult' =>
'VeryDifficult' 126 if (!$a_typical_age_range_id) {
130 $typ->setMetaId($a_typical_age_range_id);
139 $typ->setParentType(
'meta_educational');
154 if (!$a_description_id) {
158 $des->setMetaId($a_description_id);
167 $des->setParentType(
'meta_educational');
182 if (!$a_language_id) {
186 $lan->setMetaId($a_language_id);
195 $lan->setParentType(
'meta_educational');
207 $this->interactivity_type = $a_iat;
225 case 'Questionnaire':
232 case 'NarrativeText':
235 case 'ProblemStatement':
236 case 'SelfAssessment':
238 $this->learning_resource_type = $a_lrt;
259 $this->interactivity_level = $a_iat;
280 $this->semantic_density = $a_sd;
300 $this->intended_end_user_role = $a_ieur;
315 switch ($a_context) {
317 case 'HigherEducation':
320 $this->context = $a_context;
335 switch ($a_difficulty) {
340 case 'VeryDifficult':
341 $this->difficulty = $a_difficulty;
361 if (!$months && !$days && !$hours && !$minutes && !$seconds) {
367 $tlt .= ($months .
'M');
370 $tlt .= ($days .
'D');
372 if ($hours || $minutes || $seconds) {
376 $tlt .= ($hours .
'H');
379 $tlt .= ($minutes .
'M');
382 $tlt .= ($seconds .
'S');
390 $this->typical_learning_time = $a_tlt;
401 if ($time_arr === []) {
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];
410 $fields[
'meta_educational_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_educational'));
412 if ($this->db->insert(
'il_meta_educational', $fields)) {
432 return (
bool) $this->db->update(
433 'il_meta_educational',
435 array(
"meta_educational_id" => array(
'integer', $this->
getMetaId()))
439 public function delete():
bool 442 $query =
"DELETE FROM il_meta_educational " .
444 $res = $this->db->manipulate($query);
476 $interactivity_type = (string) array_search(
478 self::INTERACTIVITY_TYPE_TRANSLATION
480 $interactivity_level = (string) array_search(
482 self::INTERACTIVITY_LEVEL_TRANSLATION
484 $semantic_density = (string) array_search(
486 self::SEMANTIC_DENSITY_TRANSLATION
488 $difficulty = (string) array_search(
490 self::DIFFICULTY_TRANSLATION
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),
499 'interactivity_level' => array(
'text', $interactivity_level),
500 'semantic_density' => array(
'text', $semantic_density),
503 'difficulty' => array(
'text', $difficulty),
511 $query =
"SELECT * FROM il_meta_educational " .
512 "WHERE meta_educational_id = " . $this->db->quote($this->
getMetaId(),
'integer');
514 $res = $this->db->query($query);
519 if (key_exists($row->interactivity_type ??
'', self::INTERACTIVITY_TYPE_TRANSLATION)) {
520 $row->interactivity_type = self::INTERACTIVITY_TYPE_TRANSLATION[$row->interactivity_type ??
''];
522 if (key_exists($row->interactivity_level ??
'', self::INTERACTIVITY_LEVEL_TRANSLATION)) {
523 $row->interactivity_level = self::INTERACTIVITY_LEVEL_TRANSLATION[$row->interactivity_level ??
''];
525 if (key_exists($row->semantic_density ??
'', self::SEMANTIC_DENSITY_TRANSLATION)) {
526 $row->semantic_density = self::SEMANTIC_DENSITY_TRANSLATION[$row->semantic_density ??
''];
528 if (key_exists($row->difficulty ??
'', self::DIFFICULTY_TRANSLATION)) {
529 $row->difficulty = self::DIFFICULTY_TRANSLATION[$row->difficulty ??
''];
533 $this->
setObjId((
int) $row->obj_id);
570 foreach ($typ_ages as
$id) {
574 if (is_object($key)) {
575 $key->toXML($writer);
578 if (!count($typ_ages)) {
580 $typ->toXML($writer);
589 $key->toXML($writer);
594 $lang->toXML($writer);
600 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 604 $ilDB = $DIC->database();
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');
612 return (
int) $row->meta_educational_id;
621 $ilDB = $DIC->database();
623 $a_obj_id = $a_obj_id ?: $a_rbac_id;
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');
631 if (!count($time_arr)) {
634 return 60 * 60 * 24 * 30 * $time_arr[0] +
635 60 * 60 * 24 * $time_arr[1] +
636 60 * 60 * $time_arr[2] +
648 $learning_resource_type = (string) array_search(
650 self::LEARNING_RESOURCE_TYPE_TRANSLATION
657 'learning_resource_type',
658 $learning_resource_type
667 $intended_end_user_role = (string) array_search(
669 self::INTENDED_END_USER_ROLE_TRANSLATION
673 'il_meta_end_usr_role',
674 'meta_end_usr_role_id',
676 'intended_end_user_role',
677 $intended_end_user_role
686 $context = (string) array_search(
688 self::CONTEXT_TRANSLATION
710 if ($data_value ===
'') {
718 $id_field => [
'integer', $next_id = $this->db->nextId($table)],
719 'rbac_id' => [
'integer', $this->
getRBACId()],
720 'obj_id' => [
'integer', $this->
getObjId()],
722 'parent_type' => [
'text',
'meta_educational'],
723 'parent_id' => [
'integer', $this->
getMetaId()],
724 $data_field => [
'text', $data_value]
732 [$data_field => [
'text', $data_value]],
733 [$id_field => [
'integer', $id]]
743 $query =
"SELECT * FROM il_meta_lr_type WHERE meta_lr_type_id = " .
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']];
760 $query =
"SELECT * FROM il_meta_end_usr_role WHERE meta_end_usr_role_id = " .
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']];
777 $query =
"SELECT * FROM il_meta_context WHERE meta_context_id = " .
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']];
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);
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);
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);
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";
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'];
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";
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'];
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";
882 $res = $this->db->query($query);
883 if ($row = $this->db->fetchAssoc(
$res)) {
884 $this->context_id = (
int) $row[
'meta_context_id'];
891 public function setMetaId(
int $a_meta_id,
bool $a_read_data =
true): void
896 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)
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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
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