3declare(strict_types=1);
78 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
92 $id = parent::create();
100 INSERT INTO sahs_lm (id, api_adapter, c_type, editable, seq_exp_mode,localization)
101 VALUES (%s,%s,%s,%s,%s,%s)',
102 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
124 'SELECT * FROM sahs_lm WHERE id = %s',
126 array($this->
getId())
135 $this->
setSubType((
string) $lm_rec[
"c_type"]);
141 $this->
setTries((
int) $lm_rec[
"question_tries"]);
156 $this->
setWidth((
int) $lm_rec[
"width"]);
157 $this->
setHeight((
int) $lm_rec[
"height"]);
164 if ($lm_rec[
"mastery_score"] !=
null) {
185 'SELECT localization FROM sahs_lm WHERE id = %s',
191 if ($lm_rec[
"localization"] !=
"" && in_array($lm_rec[
"localization"], $inst_lang)) {
192 return $lm_rec[
"localization"];
205 $obj_set =
$ilDB->queryF(
206 'SELECT c_type FROM sahs_lm WHERE id = %s',
210 $obj_rec =
$ilDB->fetchAssoc($obj_set);
212 return $obj_rec[
"c_type"];
235 $this->tries = $a_tries;
245 $this->localization = $a_val;
262 'SELECT question_tries FROM sahs_lm WHERE id = %s',
268 return (
int) $lm_rec[
'question_tries'];
299 return $lm_data_dir .
"/lm_" . $this->
getId();
315 $this->api_adapter = $a_api;
332 $this->api_func_prefix = $a_prefix;
348 $this->credit_mode = $a_credit_mode;
356 $this->lesson_mode = $a_lesson_mode;
365 if (
$DIC->user()->getId() == 13) {
384 $this->style_id = $a_style_id;
408 if ($a_auto_review ==
null) {
409 $this->auto_review =
'n';
411 $this->auto_review = $a_auto_review;
430 $this->max_attempt = $a_max_attempt;
445 $this->assigned_glossary = $a_assigned_glossary;
450 $this->module_version = $a_module_version;
460 $this->session = $a_session;
476 $this->no_menu = $a_no_menu;
492 $this->hide_navig = $a_hide_navig;
503 return $lm_set->get(
"scormdebug_disable_cache") ==
"1";
514 return $lm_set->get(
"scorm_without_session") ==
"1";
525 return $lm_set->get(
"scormdebug_global_activate") ===
"1";
538 $this->ie_force_render = $a_ie_force_render;
551 $this->fourth_edition = $a_fourth_edition;
561 $this->sequencing = $a_sequencing;
571 $this->interactions = $a_interactions;
581 $this->objectives = $a_objectives;
591 $this->comments = $a_comments;
601 $this->time_from_lms = $a_time_from_lms;
611 $this->check_values = $a_check_values;
634 $this->debug = $a_debug;
655 $this->auto_continue = $a_auto_continue;
670 $this->auto_last_visited = $a_auto_last_visited;
696 $this->auto_suspend = $a_auto_suspend;
721 $this->open_mode = $a_open_mode;
731 $this->width = $a_width;
741 $this->height = $a_height;
751 $this->mastery_score = $a_mastery_score;
765 if (
$type ===
"scorm2004") {
766 $set =
$ilDB->query(
"SELECT minnormalmeasure FROM cp_objective, cp_node" .
767 " WHERE satisfiedbymeasure=1 AND minnormalmeasure is not null AND cp_objective.cp_node_id=cp_node.cp_node_id AND" .
768 " slm_id = " .
$ilDB->quote($this->getID(),
"integer"));
769 while ($rec =
$ilDB->fetchAssoc($set)) {
770 $tmpval = $rec[
"minnormalmeasure"] * 100;
771 if (!in_array($tmpval, $a_result)) {
772 $a_result[] = $tmpval;
776 $set =
$ilDB->query(
"SELECT masteryscore FROM sc_item,scorm_object" .
777 " WHERE sc_item.masteryscore is not null AND sc_item.obj_id=scorm_object.obj_id AND" .
778 " slm_id = " .
$ilDB->quote($this->getID(),
"integer"));
779 while ($rec =
$ilDB->fetchAssoc($set)) {
780 if (!in_array($rec[
"masteryscore"], $a_result)) {
781 $a_result[] = $rec[
"masteryscore"];
785 $s_result = implode(
", ", $a_result);
786 $this->mastery_score_values = $s_result;
801 $this->id_setting = $a_id_setting;
811 $this->name_setting = $a_name_setting;
822 $statement =
$ilDB->manipulateF(
825 SET api_adapter = %s,
826 api_func_prefix = %s,
828 default_lesson_mode = %s,
837 unlimited_session = %s,
853 auto_last_visited = %s,
856 ie_force_render = %s,
947 $set =
$ilDB->query(
"SELECT DISTINCT id FROM sahs_lm WHERE " .
948 " glossary = " .
$ilDB->quote($a_glo_id,
"integer"));
950 while ($rec =
$ilDB->fetchAssoc($set)) {
966 $set =
$ilDB->query(
"SELECT DISTINCT glossary FROM sahs_lm WHERE " .
967 " id = " .
$ilDB->quote($a_slm_id,
"integer"));
968 $rec =
$ilDB->fetchAssoc($set);
969 $glo_id = $rec[
"glossary"];
978 $this->sub_type = $a_sub_type;
996 public function delete():
bool
1003 if (!parent::delete()) {
1015 'DELETE FROM sahs_lm WHERE id = %s',
1017 array($this->
getId())
1020 $ilLog->debug(
"SAHS Delete(SAHSLM), Subtype: " . $this->
getSubType());
1024 $r_id = $sc_tree->readRootId();
1026 $items = $sc_tree->getSubTree($sc_tree->getNodeData($r_id));
1027 foreach ($items as $item) {
1029 if (is_object($sc_object)) {
1030 $sc_object->delete();
1033 $sc_tree->removeTree($sc_tree->getTreeId());
1041 SELECT aicc_object.obj_id FROM aicc_object, aicc_units
1042 WHERE aicc_object.obj_id = aicc_units.obj_id
1043 AND aicc_object.slm_id = %s',
1045 array($this->
getId())
1048 while ($row =
$ilDB->fetchAssoc(
$res)) {
1049 $obj_id = $row[
'obj_id'];
1052 DELETE FROM aicc_units WHERE obj_id = %s',
1060 SELECT aicc_object.obj_id FROM aicc_object, aicc_course
1061 WHERE aicc_object.obj_id = aicc_course.obj_id
1062 AND aicc_object.slm_id = %s',
1064 array($this->
getId())
1067 while ($row =
$ilDB->fetchAssoc(
$res)) {
1068 $obj_id = $row[
'obj_id'];
1071 DELETE FROM aicc_course WHERE obj_id = %s',
1079 DELETE FROM aicc_object WHERE slm_id = %s',
1081 array($this->
getId())
1085 $q_log =
"DELETE FROM scorm_tracking WHERE obj_id = " .
$ilDB->quote($this->
getId());
1086 $ilLog->write(
"SAHS Delete(SAHSLM): " . $q_log);
1089 'DELETE FROM scorm_tracking WHERE obj_id = %s',
1091 array($this->
getId())
1094 $q_log =
"DELETE FROM sahs_user WHERE obj_id = " .
$ilDB->quote($this->
getId());
1095 $ilLog->write(
"SAHS Delete(SAHSLM): " . $q_log);
1098 'DELETE FROM sahs_user WHERE obj_id = %s',
1100 array($this->
getId())
1116 if (strcmp($this->
getSubType(),
"scorm2004") == 0) {
1118 if (!is_null(
$res)) {
1119 return $res * 100.0;
1138 if (strcmp($this->
getSubType(),
'scorm2004') == 0) {
1173 public function cloneObject(
int $a_target_id,
int $a_copy_id = 0,
bool $a_omit_tree =
false): ?
ilObject
1180 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
1181 if ($new_obj !==
null) {
1187 if ($cp_options->isRootNode($this->getRefId())) {
1188 $new_obj->setOfflineStatus(
true);
1202 $new_obj->setModuleVersion(1);
1205 $new_obj->setTries($this->
getTries());
1207 $new_obj->setNoMenu($this->
getNoMenu());
1209 $new_obj->setFourth_edition($this->getFourth_edition());
1215 $new_obj->setDebug($this->
getDebug());
1220 $new_obj->setWidth($this->
getWidth());
1221 $new_obj->setHeight($this->
getHeight());
1260 $new_obj->populateByDirectoy($source_obj->getDataDirectory());
1267 $new_obj->readObject();
1270 $obj_settings->cloneSettings($new_obj->getId());
1273 $collection = $olp->getCollectionInstance();
1275 $collection->cloneCollection($new_obj->getRefId(), $cp_options->getCopyId());
1288 $usr =
$DIC->user();
1290 $studentId = (string) $usr->getId();
1291 if ($idSetting % 2 == 1) {
1292 $studentId = $usr->getLogin();
1294 if ($idSetting > 3) {
1295 $studentId .=
'_o_' . $this->
getId();
1296 } elseif ($idSetting > 1) {
1297 $studentId .=
'_r_' . $this->
getRefId();
1310 $usr =
$DIC->user();
1314 $studentName = $usr->getLastname() .
', ' . $usr->getFirstname();
1317 $studentName = $usr->getFirstname() .
' ' . $usr->getLastname();
1320 $studentName = $usr->getFullname();
1323 switch ($usr->getGender()) {
1325 $studentName =
$lng->
txt(
'salutation_f') .
' ';
1329 $studentName =
$lng->
txt(
'salutation_m') .
' ';
1337 $studentName =
$lng->
txt(
'salutation') .
' ';
1339 $studentName .= $usr->getLastname();
1342 $studentName = $usr->getFirstname();
1345 return $studentName;
1355 $setUrl =
"ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->getRefID();
1357 $setTarget =
"ilContObj" . $this->
getId();
1365 $setUrl =
"javascript:void(0); onclick=startSAHS('" . $setUrl .
"','ilContObj" . $this->
getId() .
"'," . $om .
"," .
$width .
"," .
$height .
");";
1369 $button->setCaption(
"view");
1370 $button->setPrimary(
true);
1371 $button->setUrl($setUrl);
1372 $button->setTarget($setTarget);
static _getInstance(int $a_copy_id)
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static renameExecutables(string $a_dir)
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getLangKey()
Return lang key.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getInstalledLanguages()
Get installed languages.
static getLogger(string $a_component_id)
Get component logger.
static _lookupDiskUsage(int $a_id)
Returns the number of bytes used on the harddisk by the learning module with the specified object id.
Class ilObjSCORMLearningModule.
setModuleVersion(int $a_module_version)
getAPIFunctionsPrefix()
get api functions prefix
getDefaultLessonMode()
get default lesson mode
setAutoContinue(bool $a_auto_continue)
getMaxPoints()
Returns score.max for the learning module, refered to the last sco where score.max is set.
getViewButton()
get button for view
setDefaultLessonMode(string $a_lesson_mode)
set default lesson mode
setAssignedGlossary(int $a_assigned_glossary)
getAPIAdapterName()
get api adapter name
getApiStudentId()
Get cmi.core.student_id / cmi.learner_id for API.
createDataDirectory()
creates data directory for package files ("./data/lm_data/lm_<id>")
setTries(int $a_tries)
Set default tries for questions.
getHideNavig()
hide navigation tree
getApiStudentName()
Get cmi.core.student_name / cmi.learner_name for API note: 'lastname, firstname' is required for SCOR...
getDiskUsage()
Gets the disk usage of the object in bytes.
setSequencing(bool $a_sequencing)
static getScormModulesForGlossary(int $a_glo_id)
Get SCORM modules that assign a certain glossary.
setNoMenu(bool $a_no_menu)
disable menu
setSession(bool $a_session)
setSubType(string $a_sub_type)
setCheck_values(bool $a_check_values)
getFourth_Edition()
SCORM 2004 4th edition features.
setInteractions(bool $a_interactions)
getIe_force_render()
force Internet Explorer to render again after some Milliseconds - useful for learning Modules with a ...
getDataDirectory(?string $mode="filesystem")
get data directory of lm
setAutoReview(bool $a_auto_review)
set auto review as true/false for SCORM 1.2
setStyleSheetId(int $a_style_id)
set ID of assigned style sheet object
setFourth_edition(bool $a_fourth_edition)
setObjectives(bool $a_objectives)
setLocalization(string $a_val)
setMasteryScore(?int $a_mastery_score)
getAutoReviewChar()
get auto review as Char for SCORM 2004
getCreditMode()
get credit mode
getPointsInPercent()
Returns the points in percent for the learning module This is called by the certificate generator if ...
getOpenMode()
open_mode 0: in Tab/new Window like in previous versions 1: in iFrame with width=100% and heigth=100%...
setIe_force_render(bool $a_ie_force_render)
static lookupAssignedGlossary(int $a_slm_id)
Get SCORM modules that assign a certain glossary.
setIdSetting(int $a_id_setting)
setAPIAdapterName(string $a_api)
set api adapter name
setHideNavig(bool $a_hide_navig)
disable menu
string $mastery_score_values
getCacheDeactivated()
BrowserCacheDisabled for SCORM 2004 / ENABLE_JS_DEBUG.
create(bool $upload=false)
create file based lm
setMaxAttempt(int $a_max_attempt)
setAPIFunctionsPrefix(string $a_prefix)
set api functions prefix
__construct(int $a_id=0, bool $a_call_by_reference=true)
Constructor.
getAutoReview()
get auto review as true/false for SCORM 1.2
checkMasteryScoreValues()
check mastery_score / min_normalized_measure of SCOs (SCORM 1.2) / objectives (SCORM 2004)
populateByDirectoy(string $a_dir, string $a_filename="")
Populate by directory.
getStyleSheetId()
get ID of assigned style sheet object
getSessionDeactivated()
sessionDisabled for SCORM 2004
setTime_from_lms(bool $a_time_from_lms)
setCreditMode(string $a_credit_mode)
set credit mode
setAutoReviewChar(?string $a_auto_review)
set auto review as Char for SCORM 2004
setOpenMode(int $a_open_mode)
getDebugActivated()
debugActivated
setNameSetting(int $a_name_setting)
setAuto_last_visited(bool $a_auto_last_visited)
setComments(bool $a_comments)
static getAffectiveLocalization(int $a_id)
Get affective localization.
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
setAutoSuspend(bool $a_auto_suspend)
static _getTries(int $a_id)
obsolet?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getUniqueScaledScoreForUser(int $a_id, int $a_user)
Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score....
static _getMaxScoreForUser(int $a_id, int $a_user)
Returns score.max for the learning module, refered to the last sco where score.max is set.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
cloneMetaData(ilObject $target_obj)
Copy meta data.
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static & _getInstance(int $a_id, int $a_slm_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static yn2tf(string $a_yn)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc