Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release_7' into adn_7
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyer-ilias committed Feb 29, 2024
2 parents 7e8a9f4 + 2dfe92f commit 21baf70
Show file tree
Hide file tree
Showing 1,239 changed files with 12,693 additions and 10,543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(PageMetricsRepository $pageMetricsRepository, Factor
*/
protected function doesPageExistsForLanguage(int $contentPageId, string $language) : bool
{
return ilContentPagePage::_exists(self::OBJ_TYPE, $contentPageId, $language);
return ilContentPagePage::_exists(self::OBJ_TYPE, $contentPageId, $language, true);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Modules/ContentPage/classes/class.ilObjContentPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
$ot = ilObjectTranslation::getInstance($this->getId());
$ot->copy($new_obj->getId());

if (ilContentPagePage::_exists($this->getType(), $this->getId())) {
if (ilContentPagePage::_exists($this->getType(), $this->getId(), '', true)) {
$translations = ilContentPagePage::lookupTranslations($this->getType(), $this->getId());
foreach ($translations as $language) {
$originalPageObject = new ilContentPagePage($this->getId(), 0, $language);
Expand Down Expand Up @@ -226,7 +226,7 @@ protected function doDelete()
{
parent::doDelete();

if (ilContentPagePage::_exists($this->getType(), $this->getId())) {
if (ilContentPagePage::_exists($this->getType(), $this->getId(), '', true)) {
$originalPageObject = new ilContentPagePage($this->getId());
$originalPageObject->delete();
}
Expand Down
6 changes: 4 additions & 2 deletions Modules/Forum/classes/class.ilObjForumGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1541,10 +1541,12 @@ public function prepareThreadScreen(ilObjForum $a_forum_obj)
ilUtil::infoPanel();

$this->tpl->setTitleIcon(ilObject::_getIcon("", "big", "frm"));

$this->tabs->setBackTarget(
$this->lng->txt('all_topics'),
'ilias.php?baseClass=ilRepositoryGUI&ref_id=' . $_GET['ref_id']
$this->ctrl->getLinkTarget(
$this,
'showThreads'
)
);

/**
Expand Down
17 changes: 0 additions & 17 deletions Modules/LTIConsumer/LuceneObjectDefinition.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ObjectDefinition xmlns:xi="http://www.w3.org/2001/XInclude" type="lti">
<Document type="default">
<!--
<xi:include href="../../Services/Object/LuceneDataSource.xml" />
<xi:include href="../../Services/Tagging/LuceneDataSource.xml" />
<xi:include href="../../Services/MetaData/LuceneDataSource.xml" />
-->
<DataSource type="JDBC" action="append">
<Query>
SELECT title FROM object_data
</Query>
<Param format="list" type="int" value="objId" />
<Field store="YES" index="ANALYZED" column="title" type="text" name="propertyLow" />
</DataSource>
<DataSource type="JDBC" action="append">
<Query>
SELECT description FROM object_data
</Query>
<Param format="list" type="int" value="objId" />
<Field store="YES" index="ANALYZED" column="description" type="text" name="propertyLow" />
</DataSource>
</Document>
</ObjectDefinition>
8 changes: 4 additions & 4 deletions Modules/Scorm2004/classes/class.ilSCORM13MDImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct($a_manifest_dom, $a_obj_id)
*/
public function setTitle($a_val)
{
$this->title = $a_val;
$this->title = ilUtil::stripSlashes($a_val);
}

/**
Expand All @@ -57,7 +57,7 @@ public function setTitle($a_val)
*/
public function getTitle()
{
return $this->title;
return ilUtil::stripSlashes($this->title);
}

/**
Expand All @@ -67,7 +67,7 @@ public function getTitle()
*/
public function setDescription($a_val)
{
$this->description = $a_val;
$this->description = ilUtil::stripSlashes($a_val);
}

/**
Expand All @@ -77,7 +77,7 @@ public function setDescription($a_val)
*/
public function getDescription()
{
return $this->description;
return ilUtil::stripSlashes($this->description);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions Modules/Scorm2004/classes/class.ilSCORM13PlayerGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,7 @@ private function logDirectory()
public function openLog()
{
$filename = $_GET['logFile'];
$filename = str_replace('/', '', $filename);
//Header
header('Content-Type: text/html; charset=UTF-8');
echo file_get_contents($this->logDirectory() . "/" . $filename);
Expand Down Expand Up @@ -1827,6 +1828,7 @@ public function postLogEntry()
//delete files
if ($logdata->action == "DELETE") {
$filename = $logdata->value;
$filename = str_replace('/', '', $filename);
$path = $this->logDirectory() . "/" . $filename;
unlink($path);
return;
Expand Down
4 changes: 4 additions & 0 deletions Modules/Scorm2004/classes/ilSCORM13Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ public function il_import($packageFolder, $packageId, $ilias, $validate, $reimpo
$j['base'] = $packageFolder . '/';
$j['foreignId'] = floatval($x['foreignId']); // manifest cp_node_id for associating global (package wide) objectives
$j['id'] = strval($x['id']); // manifest id for associating global (package wide) objectives
$j['item']['title'] = ilUtil::stripSlashes($j['item']['title']);
for ($i = 0; $i < count($j['item']['item']); $i++) {
$j['item']['item'][$i]['title'] = ilUtil::stripSlashes($j['item']['item'][$i]['title']);
}


//last step - build ADL Activity tree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function startParsing()

public function getPackageTitle()
{
return $this->package_title;
return ilUtil::stripSlashes($this->package_title);
}

/*
Expand Down Expand Up @@ -328,14 +328,14 @@ public function handlerCharacterData($a_xml_parser, $a_data)
switch ($this->getAncestorElement(1)) {
case "organization":
$this->current_organization->setTitle(
$this->current_organization->getTitle() . $a_data
ilUtil::stripSlashes($this->current_organization->getTitle() . $a_data)
);
$this->package_title = $this->current_organization->getTitle();
$this->package_title = ilUtil::stripSlashes($this->current_organization->getTitle());
break;

case "item":
$this->item_stack[count($this->item_stack) - 1]->setTitle(
$this->item_stack[count($this->item_stack) - 1]->getTitle() . $a_data
ilUtil::stripSlashes($this->item_stack[count($this->item_stack) - 1]->getTitle() . $a_data)
);
break;
}
Expand Down
43 changes: 26 additions & 17 deletions Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ public function uploadObject()
$name = $this->lng->txt("no_title");
}

$description = "";

$subType = $_POST["sub_type"];

// always import authoring packages as scorm2004, see bug #27801
Expand Down Expand Up @@ -456,43 +458,50 @@ public function uploadObject()
$fType = $sFile["type"];
$cFileTypes = ["application/zip", "application/x-compressed","application/x-zip-compressed"];
if (in_array($fType, $cFileTypes)) {
$timeStamp = time();
$tempFile = $sFile["tmp_name"];
$lmDir = ilUtil::getWebspaceDir("filesystem") . "/lm_data/";
$lmTempDir = $lmDir . $timeStamp;
if (!file_exists($lmTempDir)) {
mkdir($lmTempDir, 0755, true);
}
$lmTempDir = ilUtil::ilTempnam();
ilUtil::makeDir($lmTempDir);
$zar = new ZipArchive();
$zar->open($tempFile);
$zar->extractTo($lmTempDir);
$zar->close();
ilUtil::renameExecutables($lmTempDir);
require_once "./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
$importer = new ilScormAiccImporter();
$import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, strlen($a_filename) - 4);
// $import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, strlen($a_filename) - 4);
$import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, -4);
$importFromXml = false;
if ($importer->importXmlRepresentation("sahs", null, $import_dirname, "") == true) {
$importFromXml = true;
}
$mprops = [];
$mprops = $importer->moduleProperties;
$subType = $mprops["SubType"];
if ($subType == "scorm") {
include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
$newObj = new ilObjSCORMLearningModule();
if ($importFromXml && isset($mprops["SubType"])) {
$subType = $mprops["SubType"];
if ($subType == "scorm") {
include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
$newObj = new ilObjSCORMLearningModule();
} else {
include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
$newObj = new ilObjSCORM2004LearningModule();
// $newObj->setEditable($_POST["editable"]=='y');
// $newObj->setImportSequencing($_POST["import_sequencing"]);
// $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
}
$name = $mprops['Title'];
$description = $mprops['Description'];
} else {
include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
$newObj = new ilObjSCORM2004LearningModule();
// $newObj->setEditable($_POST["editable"]=='y');
// $newObj->setImportSequencing($_POST["import_sequencing"]);
// $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
ilUtil::delDir($lmTempDir, false);
ilUtil::sendFailure($this->lng->txt("import_file_not_valid"), true);
return;
}
}
break;
}

$newObj->setTitle($name);
$newObj->setSubType($subType);
$newObj->setDescription("");
$newObj->setDescription($description);
$newObj->setOfflineStatus(true);
$newObj->create(true);
$newObj->createReference();
Expand Down
10 changes: 5 additions & 5 deletions Modules/ScormAicc/classes/class.ilScormAiccDataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ilScormAiccDataSet extends ilDataSet
/**
* @var string[][]
*/
public $properties = [
public $properties = [
//"OfflineZipCreated" => "datetime",
"Id" => ["db_col" => "id", "db_type" => "integer"],
//"EntryPage" => "integer",
Expand Down Expand Up @@ -168,7 +168,7 @@ public function writeData($a_entity, $a_version, $a_id, $data = [])
$od_columns [$value["db_col"]] = [$value["db_type"], $data[$key]];
}

if (count($od_columns) > 0) {
if (isset($od_columns) && count($od_columns) > 0) {
$od_conditions ["obj_id"] = ["integer", $a_id];
$ilDB->update("object_data", $od_columns, $od_conditions);
}
Expand Down Expand Up @@ -214,8 +214,8 @@ public function getExtendedXmlRepresentation($a_entity, $a_schema_version, int $
$id = $this->data["id"];

// requirements
require_once( dirname(__DIR__,3) . "/Services/Export/classes/class.ilExport.php");
require_once(dirname(__DIR__,3) . "/Services/Xml/classes/class.ilXmlWriter.php");
require_once(dirname(__DIR__, 3) . "/Services/Export/classes/class.ilExport.php");
require_once(dirname(__DIR__, 3) . "/Services/Xml/classes/class.ilXmlWriter.php");


// prepare archive skeleton
Expand Down Expand Up @@ -395,7 +395,7 @@ private function buildProperties($a_entity, $a_omit_header = false)

foreach ($this->data as $key => $value) {
$writer->xmlElement($this->getElementNameByDbColumn($key), null, $value, true, true);
$writer->appendXML("\n");
$writer->appendXML("\n");
}

$writer->xmlEndTag("DataSet");
Expand Down
16 changes: 11 additions & 5 deletions Modules/ScormAicc/classes/class.ilScormAiccImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public function importXmlRepresentation($a_entity, $a_id, $a_import_dirname, $a_
// $importDir = $this->getImportDirectory();
// $a_import_dirname = $lmTempDir . '/' . basename($importDir);
// if (!file_exists($tempFile)) {
// $tempFile = $importDir . '/content.zip';
// $a_import_dirname = $importDir;
// $tempFile = $importDir . '/content.zip';
// $a_import_dirname = $importDir;
// }
// if (!file_exists($lmTempDir)) {
// mkdir($lmTempDir, 0755, true);
// mkdir($lmTempDir, 0755, true);
// }
// $zar = new ZipArchive();
// $zar->open($tempFile);
Expand All @@ -68,7 +68,13 @@ public function importXmlRepresentation($a_entity, $a_id, $a_import_dirname, $a_
$xml = file_get_contents($propertiesFile);

if (isset($xml)) {
$xmlRoot = simplexml_load_string($xml);
$use_internal_errors = libxml_use_internal_errors(true);
$xmlRoot = simplexml_load_string(trim($xml));
libxml_use_internal_errors($use_internal_errors);
if (!$xmlRoot instanceof SimpleXMLElement) {
$ilLog->write('XML for SCORM Import is: ' . $xml . $xmlRoot);
return false;
}

foreach ($this->dataset->properties as $key => $value) {
$this->moduleProperties[$key] = $xmlRoot->$key;
Expand All @@ -79,7 +85,7 @@ public function importXmlRepresentation($a_entity, $a_id, $a_import_dirname, $a_
foreach ($this->moduleProperties as $key => $xmlRoot) {
$xmlRootValue = $xmlRoot->__toString();
$filteredValue = preg_replace('%\s%', '', $xmlRootValue);
$this->moduleProperties[$key] = $filteredValue;
$this->moduleProperties[$key] = ilUtil::stripSlashes($filteredValue);
}

if ($a_id != null && $new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
Expand Down
8 changes: 4 additions & 4 deletions Modules/Test/classes/class.ilObjTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8134,15 +8134,15 @@ public static function _getBestPass($active_id)
);
if ($result->numRows()) {
$bestrow = null;
$bestfactor = 0;
$bestfactor = 0.0;
while ($row = $ilDB->fetchAssoc($result)) {
if ($row["maxpoints"] > 0) {
$factor = $row["points"] / $row["maxpoints"];
$factor = (float) ($row["points"] / $row["maxpoints"]);
} else {
$factor = 0;
$factor = 0.0;
}

if ($factor === 0 && $bestfactor === 0
if ($factor === 0.0 && $bestfactor === 0.0
|| $factor > $bestfactor) {
$bestrow = $row;
$bestfactor = $factor;
Expand Down
32 changes: 11 additions & 21 deletions Modules/Test/classes/class.ilObjTestGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1068,27 +1068,17 @@ private function userResultsGatewayObject()
$this->forwardToEvaluationGUI();
}

private function testResultsGatewayObject()
{
global $DIC, $ilPluginAdmin;
$this->tabs_gui->clearTargets();

$this->prepareOutput();
$this->addHeaderAction();

$this->ctrl->setCmdClass('ilParticipantsTestResultsGUI');
$this->ctrl->setCmd('showParticipants');


$gui = new ilParticipantsTestResultsGUI();
$gui->setTestObj($this->object);

$factory = new ilTestQuestionSetConfigFactory($this->tree, $DIC->database(), $ilPluginAdmin, $this->object);
$gui->setQuestionSetConfig($factory->getQuestionSetConfig());
$gui->setObjectiveParent(new ilTestObjectiveOrientedContainer());
$gui->setTestAccess($this->getTestAccess());
$this->tabs_gui->activateTab('results');
$this->ctrl->forwardCommand($gui);
private function testResultsGatewayObject() : void
{
$this->ctrl->redirectByClass(
[
ilRepositoryGUI::class,
__CLASS__,
ilTestResultsGUI::class,
ilParticipantsTestResultsGUI::class
],
'showParticipants'
);
}

/**
Expand Down
8 changes: 7 additions & 1 deletion Modules/Test/classes/class.ilTestServiceGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,13 @@ public function getPassListOfAnswers(&$result_array, $active_id, $pass, $show_so

if ($show_best_solution) {
$compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'Modules/Test');
$compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
$test_session = $this->testSessionFactory->getSession($active_id);
if ($pass <= $test_session->getLastFinishedPass()) {
$compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
} else {
$compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant_no_answer'));
}

$compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
$result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, false, $show_question_only, $show_feedback);
$best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
Expand Down
Loading

0 comments on commit 21baf70

Please sign in to comment.