19declare(strict_types=1);
72 protected \ILIAS\DI\UIServices
$ui;
79 public function __construct(
int $a_id = 0,
bool $a_call_by_reference =
true)
82 $this->
ui = $DIC->ui();
95 $id = parent::create();
103 INSERT INTO sahs_lm (id, api_adapter, c_type, editable, seq_exp_mode,localization)
104 VALUES (%s,%s,%s,%s,%s,%s)',
105 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
127 'SELECT * FROM sahs_lm WHERE id = %s',
129 array($this->
getId())
137 $this->
setSubType((
string) $lm_rec[
"c_type"]);
143 $this->
setTries((
int) $lm_rec[
"question_tries"]);
158 $this->
setWidth((
int) $lm_rec[
"width"]);
159 $this->
setHeight((
int) $lm_rec[
"height"]);
166 if ($lm_rec[
"mastery_score"] !=
null) {
187 'SELECT localization FROM sahs_lm WHERE id = %s',
193 if ($lm_rec[
"localization"] !=
"" && in_array($lm_rec[
"localization"], $inst_lang)) {
194 return $lm_rec[
"localization"];
207 $obj_set =
$ilDB->queryF(
208 'SELECT c_type FROM sahs_lm WHERE id = %s',
212 $obj_rec =
$ilDB->fetchAssoc($obj_set);
213 if ($obj_rec ==
null || $obj_rec[
"c_type"] ==
null) {
216 return $obj_rec[
"c_type"];
239 $this->tries = $a_tries;
249 $this->localization = $a_val;
266 'SELECT question_tries FROM sahs_lm WHERE id = %s',
272 return (
int) $lm_rec[
'question_tries'];
303 return $lm_data_dir .
"/lm_" . $this->
getId();
319 $this->api_adapter = $a_api;
336 $this->api_func_prefix = $a_prefix;
345 $currentMode = $learningProgress->getCurrentMode();
358 $this->lesson_mode = $a_lesson_mode;
367 if (
$DIC->user()->getId() == 13) {
386 $this->style_id = $a_style_id;
410 if ($a_auto_review ==
null) {
411 $this->auto_review =
'n';
413 $this->auto_review = $a_auto_review;
432 $this->max_attempt = $a_max_attempt;
447 $this->assigned_glossary = $a_assigned_glossary;
452 $this->module_version = $a_module_version;
462 $this->session = $a_session;
478 $this->no_menu = $a_no_menu;
494 $this->hide_navig = $a_hide_navig;
505 return $lm_set->get(
"scormdebug_disable_cache") ==
"1";
516 return $lm_set->get(
"scorm_without_session") ==
"1";
527 return $lm_set->get(
"scormdebug_global_activate") ===
"1";
540 $this->ie_force_render = $a_ie_force_render;
553 $this->fourth_edition = $a_fourth_edition;
563 $this->sequencing = $a_sequencing;
573 $this->interactions = $a_interactions;
583 $this->objectives = $a_objectives;
593 $this->comments = $a_comments;
603 $this->time_from_lms = $a_time_from_lms;
613 $this->check_values = $a_check_values;
636 $this->debug = $a_debug;
657 $this->auto_continue = $a_auto_continue;
672 $this->auto_last_visited = $a_auto_last_visited;
698 $this->auto_suspend = $a_auto_suspend;
723 $this->open_mode = $a_open_mode;
733 $this->width = $a_width;
743 $this->height = $a_height;
753 $this->mastery_score = $a_mastery_score;
767 if (
$type ===
"scorm2004") {
768 $set =
$ilDB->query(
"SELECT minnormalmeasure FROM cp_objective, cp_node" .
769 " WHERE satisfiedbymeasure=1 AND minnormalmeasure is not null AND cp_objective.cp_node_id=cp_node.cp_node_id AND" .
770 " slm_id = " .
$ilDB->quote($this->getID(),
"integer"));
771 while ($rec =
$ilDB->fetchAssoc($set)) {
772 $tmpval = $rec[
"minnormalmeasure"] * 100;
773 if (!in_array($tmpval, $a_result)) {
774 $a_result[] = $tmpval;
778 $set =
$ilDB->query(
"SELECT masteryscore FROM sc_item,scorm_object" .
779 " WHERE sc_item.masteryscore is not null AND sc_item.obj_id=scorm_object.obj_id AND" .
780 " slm_id = " .
$ilDB->quote($this->getID(),
"integer"));
781 while ($rec =
$ilDB->fetchAssoc($set)) {
782 if (!in_array($rec[
"masteryscore"], $a_result)) {
783 $a_result[] = $rec[
"masteryscore"];
787 $s_result = implode(
", ", $a_result);
788 $this->mastery_score_values = $s_result;
803 $this->id_setting = $a_id_setting;
813 $this->name_setting = $a_name_setting;
824 $statement =
$ilDB->manipulateF(
827 SET api_adapter = %s,
828 api_func_prefix = %s,
830 default_lesson_mode = %s,
839 unlimited_session = %s,
855 auto_last_visited = %s,
858 ie_force_render = %s,
949 $set =
$ilDB->query(
"SELECT DISTINCT id FROM sahs_lm WHERE " .
950 " glossary = " .
$ilDB->quote($a_glo_id,
"integer"));
952 while ($rec =
$ilDB->fetchAssoc($set)) {
968 $set =
$ilDB->query(
"SELECT DISTINCT glossary FROM sahs_lm WHERE " .
969 " id = " .
$ilDB->quote($a_slm_id,
"integer"));
970 $rec =
$ilDB->fetchAssoc($set);
971 $glo_id = $rec[
"glossary"];
980 $this->sub_type = $a_sub_type;
998 public function delete():
bool
1005 if (!parent::delete()) {
1017 'DELETE FROM sahs_lm WHERE id = %s',
1019 array($this->
getId())
1022 $ilLog->debug(
"SAHS Delete(SAHSLM), Subtype: " . $this->
getSubType());
1026 $r_id = $sc_tree->readRootId();
1028 $items = $sc_tree->getSubTree($sc_tree->getNodeData($r_id));
1029 foreach ($items as $item) {
1031 if (is_object($sc_object)) {
1032 $sc_object->delete();
1035 $sc_tree->removeTree($sc_tree->getTreeId());
1043 SELECT aicc_object.obj_id FROM aicc_object, aicc_units
1044 WHERE aicc_object.obj_id = aicc_units.obj_id
1045 AND aicc_object.slm_id = %s',
1047 array($this->
getId())
1050 while ($row =
$ilDB->fetchAssoc(
$res)) {
1051 $obj_id = $row[
'obj_id'];
1054 DELETE FROM aicc_units WHERE obj_id = %s',
1062 SELECT aicc_object.obj_id FROM aicc_object, aicc_course
1063 WHERE aicc_object.obj_id = aicc_course.obj_id
1064 AND aicc_object.slm_id = %s',
1066 array($this->
getId())
1069 while ($row =
$ilDB->fetchAssoc(
$res)) {
1070 $obj_id = $row[
'obj_id'];
1073 DELETE FROM aicc_course WHERE obj_id = %s',
1081 DELETE FROM aicc_object WHERE slm_id = %s',
1083 array($this->
getId())
1087 $q_log =
"DELETE FROM scorm_tracking WHERE obj_id = " .
$ilDB->quote($this->
getId());
1088 $ilLog->write(
"SAHS Delete(SAHSLM): " . $q_log);
1091 'DELETE FROM scorm_tracking WHERE obj_id = %s',
1093 array($this->
getId())
1096 $q_log =
"DELETE FROM sahs_user WHERE obj_id = " .
$ilDB->quote($this->
getId());
1097 $ilLog->write(
"SAHS Delete(SAHSLM): " . $q_log);
1100 'DELETE FROM sahs_user WHERE obj_id = %s',
1102 array($this->
getId())
1117 $ilUser =
$DIC->user();
1118 if (strcmp($this->
getSubType(),
"scorm2004") == 0) {
1120 if (!is_null(
$res)) {
1121 return $res * 100.0;
1138 $ilUser =
$DIC->user();
1140 if (strcmp($this->
getSubType(),
'scorm2004') == 0) {
1175 public function cloneObject(
int $a_target_id,
int $a_copy_id = 0,
bool $a_omit_tree =
false): ?
ilObject
1179 $ilUser =
$DIC->user();
1182 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
1183 if ($new_obj !==
null) {
1189 if ($cp_options->isRootNode($this->getRefId())) {
1190 $new_obj->setOfflineStatus(
true);
1204 $new_obj->setModuleVersion(1);
1206 $new_obj->setTries($this->
getTries());
1208 $new_obj->setNoMenu($this->
getNoMenu());
1210 $new_obj->setFourth_edition($this->getFourth_edition());
1216 $new_obj->setDebug($this->
getDebug());
1221 $new_obj->setWidth($this->
getWidth());
1222 $new_obj->setHeight($this->
getHeight());
1261 $new_obj->populateByDirectoy($source_obj->getDataDirectory());
1268 $new_obj->readObject();
1271 $obj_settings->cloneSettings($new_obj->getId());
1274 $collection = $olp->getCollectionInstance();
1276 $collection->cloneCollection($new_obj->getRefId(), $cp_options->getCopyId());
1289 $usr =
$DIC->user();
1291 $studentId = (string) $usr->getId();
1292 if ($idSetting % 2 == 1) {
1293 $studentId = $usr->getLogin();
1295 if ($idSetting > 3) {
1296 $studentId .=
'_o_' . $this->
getId();
1297 } elseif ($idSetting > 1) {
1298 $studentId .=
'_r_' . $this->
getRefId();
1311 $usr =
$DIC->user();
1315 $studentName = $usr->getLastname() .
', ' . $usr->getFirstname();
1318 $studentName = $usr->getFirstname() .
' ' . $usr->getLastname();
1321 $studentName = $usr->getFullname();
1324 switch ($usr->getGender()) {
1326 $studentName =
$lng->
txt(
'salutation_f') .
' ';
1330 $studentName =
$lng->
txt(
'salutation_m') .
' ';
1338 $studentName =
$lng->
txt(
'salutation') .
' ';
1340 $studentName .= $usr->getLastname();
1343 $studentName = $usr->getFirstname();
1346 return $studentName;
1356 $setUrl =
"ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->getRefID();
1358 $setTarget =
"ilContObj" . $this->
getId();
1366 $setUrl =
"javascript:void(0); onclick=startSAHS('" . $setUrl .
"','ilContObj" . $this->
getId() .
"'," . $om .
"," .
$width .
"," .
$height .
");";
1378 $button->setCaption(
"start_lm");
1379 $button->setPrimary(
true);
1380 $button->setUrl($setUrl);
1381 $button->setTarget($setTarget);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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.
const LP_MODE_SCORM_PACKAGE
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 ("./public/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)
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?
Class ilObjSCORM2004LearningModule.
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.
Class ilObjSCORMLearningModule.
static getInstance(int $obj_id)
Class ilObject Basic functions for all objects.
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)
static yn2tf(string $a_yn)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc