3declare(strict_types=1);
52 if (!$a_typical_age_range_id) {
56 $typ->setMetaId($a_typical_age_range_id);
65 $typ->setParentType(
'meta_educational');
80 if (!$a_description_id) {
84 $des->setMetaId($a_description_id);
93 $des->setParentType(
'meta_educational');
108 if (!$a_language_id) {
112 $lan->setMetaId($a_language_id);
121 $lan->setParentType(
'meta_educational');
133 $this->interactivity_type = $a_iat;
151 case 'Questionnaire':
158 case 'NarrativeText':
161 case 'ProblemStatement':
162 case 'SelfAssessment':
164 $this->learning_resource_type = $a_lrt;
185 $this->interactivity_level = $a_iat;
206 $this->semantic_density = $a_sd;
226 $this->intended_end_user_role = $a_ieur;
241 switch ($a_context) {
243 case 'HigherEducation':
246 $this->context = $a_context;
261 switch ($a_difficulty) {
266 case 'VeryDifficult':
267 $this->difficulty = $a_difficulty;
287 if (!$months && !$days && !$hours && !$minutes && !$seconds) {
293 $tlt .= ($months .
'M');
296 $tlt .= ($days .
'D');
298 if ($hours || $minutes || $seconds) {
302 $tlt .= ($hours .
'H');
305 $tlt .= ($minutes .
'M');
308 $tlt .= ($seconds .
'S');
316 $this->typical_learning_time = $a_tlt;
321 return $this->typical_learning_time;
327 if ($time_arr === []) {
330 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];
335 $fields = $this->__getFields();
336 $fields[
'meta_educational_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_educational'));
338 if ($this->db->insert(
'il_meta_educational', $fields)) {
339 $this->setMetaId($next_id);
340 return $this->getMetaId();
347 return $this->getMetaId() && $this->db->update(
348 'il_meta_educational',
349 $this->__getFields(),
350 array(
"meta_educational_id" => array(
'integer', $this->getMetaId()))
354 public function delete():
bool
356 if ($this->getMetaId()) {
357 $query =
"DELETE FROM il_meta_educational " .
361 foreach ($this->getTypicalAgeRangeIds() as
$id) {
362 $typ = $this->getTypicalAgeRange(
$id);
365 foreach ($this->getDescriptionIds() as
$id) {
366 $des = $this->getDescription(
$id);
369 foreach ($this->getLanguageIds() as
$id) {
385 'rbac_id' => array(
'integer', $this->getRBACId()),
386 'obj_id' => array(
'integer', $this->getObjId()),
387 'obj_type' => array(
'text', $this->getObjType()),
388 'interactivity_type' => array(
'text', $this->getInteractivityType()),
389 'learning_resource_type' => array(
'text', $this->getLearningResourceType()),
390 'interactivity_level' => array(
'text', $this->getInteractivityLevel()),
391 'semantic_density' => array(
'text', $this->getSemanticDensity()),
392 'intended_end_user_role' => array(
'text', $this->getIntendedEndUserRole()),
393 'context' => array(
'text', $this->getContext()),
394 'difficulty' => array(
'text', $this->getDifficulty()),
395 'typical_learning_time' => array(
'text', $this->getTypicalLearningTime())
401 if ($this->getMetaId()) {
402 $query =
"SELECT * FROM il_meta_educational " .
403 "WHERE meta_educational_id = " . $this->db->quote($this->getMetaId(),
'integer');
407 $this->setRBACId((
int) $row->rbac_id);
408 $this->setObjId((
int) $row->obj_id);
409 $this->setObjType((
string) $row->obj_type);
410 $this->setInteractivityType((
string) $row->interactivity_type);
411 $this->setLearningResourceType((
string) $row->learning_resource_type);
412 $this->setInteractivityLevel((
string) $row->interactivity_level);
413 $this->setSemanticDensity((
string) $row->semantic_density);
414 $this->setIntendedEndUserRole((
string) $row->intended_end_user_role);
415 $this->setContext((
string) $row->context);
416 $this->setDifficulty((
string) $row->difficulty);
417 $this->setTypicalLearningTime((
string) $row->typical_learning_time);
429 'InteractivityType' => $this->getInteractivityType() ?:
'Active',
430 'LearningResourceType' => $this->getLearningResourceType() ?:
'Exercise',
431 'InteractivityLevel' => $this->getInteractivityLevel() ?:
'Medium',
432 'SemanticDensity' => $this->getSemanticDensity() ?:
'Medium',
433 'IntendedEndUserRole' => $this->getIntendedEndUserRole() ?:
'Learner',
434 'Context' => $this->getContext() ?:
'Other',
435 'Difficulty' => $this->getDifficulty() ?:
'Medium'
440 $typ_ages = $this->getTypicalAgeRangeIds();
441 foreach ($typ_ages as
$id) {
442 $key = $this->getTypicalAgeRange(
$id);
445 if (is_object(
$key)) {
446 $key->toXML($writer);
449 if (!count($typ_ages)) {
451 $typ->toXML($writer);
455 $writer->
xmlElement(
'TypicalLearningTime',
null, $this->getTypicalLearningTime());
458 foreach ($this->getDescriptionIds() as
$id) {
459 $key = $this->getDescription(
$id);
460 $key->toXML($writer);
463 foreach ($this->getLanguageIds() as
$id) {
465 $lang->toXML($writer);
471 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int
477 $query =
"SELECT meta_educational_id FROM il_meta_educational " .
478 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
479 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
483 return (
int) $row->meta_educational_id;
494 $a_obj_id = $a_obj_id ?: $a_rbac_id;
496 $query =
"SELECT typical_learning_time FROM il_meta_educational " .
497 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
498 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
502 if (!count($time_arr)) {
505 return 60 * 60 * 24 * 30 * $time_arr[0] +
506 60 * 60 * 24 * $time_arr[1] +
507 60 * 60 * $time_arr[2] +
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
setLearningResourceType(string $a_lrt)
getDescription(int $a_description_id)
setDifficulty(string $a_difficulty)
getTypicalLearningTimeSeconds()
setTypicalLearningTime(string $a_tlt)
getLanguage(int $a_language_id)
setPhysicalTypicalLearningTime(int $months, int $days, int $hours, int $minutes, int $seconds)
setInteractivityLevel(string $a_iat)
getLearningResourceType()
setContext(string $a_context)
setIntendedEndUserRole(string $a_ieur)
string $intended_end_user_role
string $interactivity_level
setInteractivityType(string $a_iat)
string $typical_learning_time
string $interactivity_type
setSemanticDensity(string $a_sd)
toXML(ilXmlWriter $writer)
string $learning_resource_type
static _getTypicalLearningTimeSeconds(int $a_rbac_id, int $a_obj_id=0)
static _getId(int $a_rbac_id, int $a_obj_id)
getTypicalAgeRange(int $a_typical_age_range_id)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
static _LOMDurationToArray(string $a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...