49         $this->ass_domain = $DIC->exercise()->internal()->domain()->assignment();
    55         return array(
"4.1.0", 
"4.4.0", 
"5.0.0", 
"5.1.0", 
"5.2.0", 
"5.3.0", 
"9.0");
    58     protected function getXmlNamespace(
string $a_entity, 
string $a_schema_version): string
    60         return "https://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
    63     protected function getTypes(
string $a_entity, 
string $a_version): array
    65         if ($a_entity == 
"exc") {
    71                         "Description" => 
"text",
    73                         "PassNr" => 
"integer",
    74                         "ShowSubmissions" => 
"integer"    83                         "Description" => 
"text",
    85                         "PassNr" => 
"integer",
    86                         "ShowSubmissions" => 
"integer",
    87                         "ComplBySubmission" => 
"integer"    96                         "Description" => 
"text",
    98                         "PassNr" => 
"integer",
    99                         "NrMandatoryRandom" => 
"integer",
   100                         "ShowSubmissions" => 
"integer",
   101                         "ComplBySubmission" => 
"integer",
   102                         "Tfeedback" => 
"integer"   107         if ($a_entity == 
"exc_assignment") {
   108             switch ($a_version) {
   112                         "ExerciseId" => 
"integer",
   113                         "Deadline" => 
"text",
   114                         "Instruction" => 
"text",
   116                         "Mandatory" => 
"integer",
   117                         "OrderNr" => 
"integer",
   118                         "Dir" => 
"directory");
   123                         "ExerciseId" => 
"integer",
   125                         "Deadline" => 
"integer",
   126                         "Instruction" => 
"text",
   128                         "Mandatory" => 
"integer",
   129                         "OrderNr" => 
"integer",
   133                         ,
"PeerMin" => 
"integer"   134                         ,
"PeerDeadline" => 
"integer"   136                         ,
"FeedbackFile" => 
"integer"   137                         ,
"FeedbackCron" => 
"integer"   138                         ,
"FeedbackDate" => 
"integer"   139                         ,
"FeedbackDir" => 
"directory"   145                         "ExerciseId" => 
"integer",
   147                         "Deadline" => 
"integer",
   148                         "Instruction" => 
"text",
   150                         "Mandatory" => 
"integer",
   151                         "OrderNr" => 
"integer",
   155                         ,
"PeerMin" => 
"integer"   156                         ,
"PeerDeadline" => 
"integer"   157                         ,
"PeerFile" => 
"integer"   158                         ,
"PeerPersonal" => 
"integer"   160                         ,
"FeedbackFile" => 
"integer"   161                         ,
"FeedbackCron" => 
"integer"   162                         ,
"FeedbackDate" => 
"integer"   163                         ,
"FeedbackDir" => 
"directory"   170                         "ExerciseId" => 
"integer",
   172                         "Deadline" => 
"integer",
   173                         "Deadline2" => 
"integer",
   174                         "Instruction" => 
"text",
   176                         "Mandatory" => 
"integer",
   177                         "OrderNr" => 
"integer",
   178                         "TeamTutor" => 
"integer",
   179                         "MaxFile" => 
"integer",
   183                         ,
"PeerMin" => 
"integer"   184                         ,
"PeerDeadline" => 
"integer"   185                         ,
"PeerFile" => 
"integer"   186                         ,
"PeerPersonal" => 
"integer"   187                         ,
"PeerChar" => 
"integer"   188                         ,
"PeerUnlock" => 
"integer"   189                         ,
"PeerValid" => 
"integer"   190                         ,
"PeerText" => 
"integer"   191                         ,
"PeerRating" => 
"integer"   192                         ,
"PeerCritCat" => 
"integer"   194                         ,
"FeedbackFile" => 
"integer"   195                         ,
"FeedbackCron" => 
"integer"   196                         ,
"FeedbackDate" => 
"integer"   197                         ,
"FeedbackDir" => 
"directory"   202                         "ExerciseId" => 
"integer",
   204                         "Deadline" => 
"integer",
   205                         "Deadline2" => 
"integer",
   206                         "Instruction" => 
"text",
   208                         "Mandatory" => 
"integer",
   209                         "OrderNr" => 
"integer",
   210                         "TeamTutor" => 
"integer",
   211                         "MaxFile" => 
"integer",
   212                         "Dir" => 
"directory",
   214                         "WebDataDir" => 
"directory"   217                         ,
"PeerMin" => 
"integer"   218                         ,
"PeerDeadline" => 
"integer"   219                         ,
"PeerFile" => 
"integer"   220                         ,
"PeerPersonal" => 
"integer"   221                         ,
"PeerChar" => 
"integer"   222                         ,
"PeerUnlock" => 
"integer"   223                         ,
"PeerValid" => 
"integer"   224                         ,
"PeerText" => 
"integer"   225                         ,
"PeerRating" => 
"integer"   226                         ,
"PeerCritCat" => 
"integer"   228                         ,
"FeedbackFile" => 
"integer"   229                         ,
"FeedbackCron" => 
"integer"   230                         ,
"FeedbackDate" => 
"integer"   231                         ,
"FeedbackDir" => 
"directory"   232                         ,
"FbDateCustom" => 
"integer"   233                         ,
"DeadlineMode" => 
"integer"   234                         ,
"RelativeDeadline" => 
"integer"   235                         ,
"RelDeadlineLastSubm" => 
"integer"   240                         "ExerciseId" => 
"integer",
   242                         "Deadline" => 
"integer",
   243                         "Deadline2" => 
"integer",
   244                         "Instruction" => 
"text",
   246                         "Mandatory" => 
"integer",
   247                         "OrderNr" => 
"integer",
   248                         "TeamTutor" => 
"integer",
   249                         "MaxFile" => 
"integer",
   250                         "InstructionCollection" => 
"rscollection",
   252                         "WebDataDir" => 
"directory"   255                         ,
"PeerMin" => 
"integer"   256                         ,
"PeerDeadline" => 
"integer"   257                         ,
"PeerFile" => 
"integer"   258                         ,
"PeerPersonal" => 
"integer"   259                         ,
"PeerChar" => 
"integer"   260                         ,
"PeerUnlock" => 
"integer"   261                         ,
"PeerValid" => 
"integer"   262                         ,
"PeerText" => 
"integer"   263                         ,
"PeerRating" => 
"integer"   264                         ,
"PeerCritCat" => 
"integer"   266                         ,
"FeedbackFile" => 
"integer"   267                         ,
"FeedbackCron" => 
"integer"   268                         ,
"FeedbackDate" => 
"integer"   269                         ,
"FeedbackDir" => 
"directory"   270                         ,
"FbDateCustom" => 
"integer"   271                         ,
"DeadlineMode" => 
"integer"   272                         ,
"RelativeDeadline" => 
"integer"   273                         ,
"RelDeadlineLastSubm" => 
"integer"   278         if ($a_entity == 
"exc_cit_cat") {
   279             switch ($a_version) {
   286                         ,
"Parent" => 
"integer"   293         if ($a_entity == 
"exc_cit") {
   294             switch ($a_version) {
   301                         ,
"Parent" => 
"integer"   306                         ,
"Required" => 
"integer"   313         if ($a_entity == 
"exc_ass_file_order") {
   314             switch ($a_version) {
   319                     , 
"AssignmentId" => 
"integer"   320                     , 
"Filename" => 
"text"   321                     , 
"OrderNr" => 
"integer"   326         if ($a_entity == 
"exc_ass_reminders") {
   327             switch ($a_version) {
   332                         "AssignmentId" => 
"integer",
   333                         "ExerciseId" => 
"integer",
   334                         "Status" => 
"integer",
   335                         "Start" => 
"integer",
   337                         "Frequency" => 
"integer",
   338                         "LastSend" => 
"integer",
   339                         "TemplateId" => 
"integer"   346     public function readData(
string $a_entity, 
string $a_version, array $a_ids): void
   350         if (!is_array($a_ids)) {
   351             $a_ids = array($a_ids);
   354         if ($a_entity == 
"exc") {
   355             switch ($a_version) {
   358                         " pass_mode, pass_nr, show_submissions" .
   359                         " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
   360                         " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
   367                         " pass_mode, pass_nr, show_submissions, compl_by_submission" .
   368                         " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
   369                         " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
   376                         " pass_mode, pass_nr, show_submissions, compl_by_submission, tfeedback,nr_mandatory_random" .
   377                         " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
   378                         " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
   383         if ($a_entity == 
"exc_assignment") {
   384             switch ($a_version) {
   387                         " instruction, title, start_time, mandatory, order_nr" .
   388                         " FROM exc_assignment" .
   389                         " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
   394                         " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
   395                         " fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
   396                         " FROM exc_assignment" .
   397                         " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
   402                         " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
   403                         " peer_file, peer_prsl peer_personal, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
   404                         " FROM exc_assignment" .
   405                         " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
   413                         " instruction, title, start_time, mandatory, order_nr, team_tutor, max_file, peer, peer_min," .
   414                         " peer_dl peer_deadline, peer_file, peer_prsl peer_personal, peer_char, peer_unlock, peer_valid," .
   415                         " peer_text, peer_rating, peer_crit_cat, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date," .
   416                         " fb_date_custom, rel_deadline_last_subm, deadline_mode, relative_deadline" .
   417                         " FROM exc_assignment" .
   418                         " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
   423         if ($a_entity == 
"exc_crit_cat") {
   424             switch ($a_version) {
   430                         " FROM exc_crit_cat" .
   431                         " WHERE " . 
$ilDB->in(
"parent", $a_ids, 
false, 
"integer"));
   436         if ($a_entity == 
"exc_crit") {
   437             switch ($a_version) {
   443                         ", descr, pos, required, def" .
   445                         " WHERE " . 
$ilDB->in(
"parent", $a_ids, 
false, 
"integer"));
   446                     foreach ($this->data as $k => $v) {
   447                         $this->data[$k][
"DefJson"] = 
"";
   448                         if ($v[
"Def"] != 
"") {
   449                             $this->data[$k][
"DefJson"] = json_encode(unserialize($v[
"Def"], [
'allowed_classes' => 
false]));
   456         if ($a_entity == 
"exc_ass_file_order") {
   457             switch ($a_version) {
   461                         " FROM exc_ass_file_order" .
   462                         " WHERE " . 
$ilDB->in(
"assignment_id", $a_ids, 
false, 
"integer"));
   467         if ($a_entity == 
"exc_ass_reminders") {
   468             switch ($a_version) {
   471                     $this->
getDirectDataFromQuery(
"SELECT type, ass_id, exc_id, status, start, end, freq, last_send, template_id" .
   472                         " FROM exc_ass_reminders" .
   473                         " WHERE " . 
$ilDB->in(
"ass_id", $a_ids, 
false, 
"integer"));
   482     public function getXmlRecord(
string $a_entity, 
string $a_version, array $a_set): array
   484         if ($a_entity == 
"exc_assignment") {
   486             if ($a_set[
"StartTime"] != 
"") {
   490             if ($a_set[
"Deadline"] != 
"") {
   494             if ($a_set[
"Deadline2"] != 
"") {
   499             $if = $this->ass_domain->instructionFiles((
int) $a_set[
"Id"]);
   500             $a_set[
"InstructionCollection"] = $if->getCollectionIdString();
   504             $a_set[
"FeedbackDir"] = $fstorage->getGlobalFeedbackPath();
   507             $fswebstorage = 
new ilFSWebStorageExercise($a_set[
'ExerciseId'], $a_set[
'Id']);
   508             $a_set[
'WebDataDir'] = $fswebstorage->getAbsolutePath();
   512         if ($a_entity == 
"exc_ass_reminders") {
   513             if ($a_set[
"End"] != 
"") {
   517             if ($a_set[
"LastSend"] != 
"") {
   529         ?array $a_rec = null,
   534                 switch ($a_version) {
   539                             "exc_assignment" => array(
"ids" => $a_rec[
"Id"] ?? null)
   547                             "exc_crit_cat" => array(
"ids" => $a_rec[
"Id"] ?? null),
   548                             "exc_assignment" => array(
"ids" => $a_rec[
"Id"] ?? null)
   555                     "exc_crit" => array(
"ids" => $a_rec[
"Id"] ?? null)
   558             case "exc_assignment":
   559                 switch ($a_version) {
   563                             "exc_ass_file_order" => array(
"ids" => $a_rec[
"Id"] ?? null),
   564                             "exc_ass_reminders" => array(
"ids" => $a_rec[
"Id"] ?? null)
   586         string $a_schema_version
   588         $a_rec = $this->
stripTags($a_rec, [
"Instruction"]);
   590         $a_rec[
"Instruction"] = $purifier->purify((
string) ($a_rec[
"Instruction"] ?? 
""));
   594                 if ($new_id = $a_mapping->
getMapping(
'Services/Container', 
'objs', $a_rec[
'Id'])) {
   598                     $newObj->setType(
"exc");
   602                 $newObj->setTitle($a_rec[
"Title"]);
   603                 $newObj->setDescription($a_rec[
"Description"]);
   604                 $newObj->setPassMode($a_rec[
"PassMode"]);
   605                 $newObj->setPassNr((
int) $a_rec[
"PassNr"]);
   606                 $newObj->setNrMandatoryRandom((
int) $a_rec[
"NrMandatoryRandom"]);
   607                 $newObj->setShowSubmissions((
bool) (
int) $a_rec[
"ShowSubmissions"]);
   608                 $newObj->setCompletionBySubmission((
bool) (
int) $a_rec[
"ComplBySubmission"]);
   609                 $newObj->setTutorFeedback((
int) $a_rec[
"Tfeedback"]);
   612                 $this->current_exc = $newObj;
   614                 $a_mapping->
addMapping(
"Modules/Exercise", 
"exc", $a_rec[
"Id"], $newObj->getId());
   615                 $a_mapping->
addMapping(
'Services/Object', 
'objs', $a_rec[
'Id'], $newObj->getId());
   616                 $a_mapping->
addMapping(
'Services/AdvancedMetaData', 
'parent', $a_rec[
'Id'], $newObj->getId());
   620                     $a_rec[
"Id"] . 
":0:exc",
   621                     $newObj->getId() . 
":0:exc"   625             case "exc_assignment":
   626                 $exc_id = $a_mapping->
getMapping(
"Modules/Exercise", 
"exc", $a_rec[
"ExerciseId"]);
   628                     if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
   635                     $ass->setExerciseId($exc_id);
   637                     if ($a_rec[
"StartTime"] != 
"") {
   642                     if ($a_rec[
"Deadline"] != 
"") {
   647                     $ass->setInstruction($a_rec[
"Instruction"] ?? 
"");
   648                     $ass->setTitle($a_rec[
"Title"] ?? 
"");
   649                     $ass->setMandatory((
bool) ($a_rec[
"Mandatory"] ?? 
false));
   650                     $ass->setOrderNr((
int) ($a_rec[
"OrderNr"] ?? 0));
   653                     $ass->setType((
int) ($a_rec[
"Type"] ?? 0));
   656                     $ass->setPeerReview((
bool) ($a_rec[
"Peer"] ?? 
false));
   657                     $ass->setPeerReviewMin((
int) ($a_rec[
"PeerMin"] ?? 0));
   658                     $ass->setPeerReviewDeadline((
int) $a_rec[
"PeerDeadline"]);
   659                     $ass->setFeedbackFile($a_rec[
"FeedbackFile"] ?? 
"");
   660                     $ass->setFeedbackCron((
bool) ($a_rec[
"FeedbackCron"] ?? 
false));
   661                     $ass->setFeedbackDate((
int) ($a_rec[
"FeedbackDate"] ?? 0));
   664                     $ass->setPeerReviewFileUpload((
bool) ($a_rec[
"PeerFile"] ?? 
false));
   665                     $ass->setPeerReviewPersonalized((
bool) ($a_rec[
"PeerPersonal"] ?? 
false));
   668                     if (($a_rec[
"Deadline2"] ?? 
"") !== 
"") {
   670                         $ass->setExtendedDeadline($deadline->get(
IL_CAL_UNIX));
   672                     $ass->setMaxFile((
int) ($a_rec[
"MaxFile"] ?? 0));
   673                     $ass->setTeamTutor((
bool) ($a_rec[
"TeamTutor"] ?? 
false));
   674                     $ass->setPeerReviewChars((
int) ($a_rec[
"PeerChar"] ?? null));
   675                     $ass->setPeerReviewSimpleUnlock((
int) ($a_rec[
"PeerUnlock"] ?? 0));
   676                     $ass->setPeerReviewValid((
int) ($a_rec[
"PeerValid"] ?? 0));
   677                     $ass->setPeerReviewText((
bool) ($a_rec[
"PeerText"] ?? 
false));
   678                     $ass->setPeerReviewRating((
bool) ($a_rec[
"PeerRating"] ?? 
false));
   681                     $ass->setFeedbackDateCustom((
int) ($a_rec[
"FbDateCustom"] ?? 0));
   682                     $ass->setRelDeadlineLastSubmission((
int) ($a_rec[
"RelDeadlineLastSubm"] ?? 0));
   683                     $ass->setDeadlineMode((
int) ($a_rec[
"DeadlineMode"] ?? 0));
   684                     $ass->setRelativeDeadline((
int) ($a_rec[
"RelativeDeadline"] ?? 0));
   687                     if ($a_rec[
"PeerCritCat"]) {
   688                         $ass->setPeerReviewCriteriaCatalogue((
int) $a_mapping->
getMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"PeerCritCat"]));
   697                     $dir = str_replace(
"..", 
"", ($a_rec[
"InstructionCollection"] ?? 
""));
   699                         $if = $this->ass_domain->instructionFiles($ass->getId());
   702                         $dir = str_replace(
"..", 
"", ($a_rec[
"Dir"] ?? 
""));    
   704                             $if = $this->ass_domain->instructionFiles($ass->getId());
   707                         $dir = str_replace(
"..", 
"", ($a_rec[
"WebDataDir"] ?? 
""));    
   709                             $if = $this->ass_domain->instructionFiles($ass->getId());
   715                     $dir = str_replace(
"..", 
"", $a_rec[
"FeedbackDir"]);
   718                         $target_dir = $fstorage->getGlobalFeedbackPath();
   725                         $ar->setId($ass->getId());
   726                         $ar->setTemplateRefId(0);
   727                         $ar->setContainerRefId(0);
   731                     $a_mapping->
addMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"Id"], $ass->getId());
   737                 $exc_id = $a_mapping->
getMapping(
"Modules/Exercise", 
"exc", $a_rec[
"Parent"]);
   740                     $crit_cat->setParent($exc_id);
   741                     $crit_cat->setTitle($a_rec[
"Title"]);
   742                     $crit_cat->setPosition($a_rec[
"Pos"]);
   745                     $a_mapping->
addMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"Id"], $crit_cat->getId());
   750                 $crit_cat_id = $a_mapping->
getMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"Parent"]);
   751                 if ($crit_cat_id > 0) {
   753                     $crit->setParent($crit_cat_id);
   754                     $crit->setTitle($a_rec[
"Title"]);
   755                     $crit->setDescription($a_rec[
"Descr"]);
   756                     $crit->setPosition($a_rec[
"Pos"]);
   757                     $crit->setRequired($a_rec[
"Required"]);
   758                     $crit->importDefinition($a_rec[
"Def"], $a_rec[
"DefJson"]);
   763             case "exc_ass_file_order":
   765                 $ass_id = $a_mapping->
getMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"AssignmentId"]);
   771             case "exc_ass_reminders":
   773                 $new_ass_id = $a_mapping->
getMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"AssId"]);
   774                 $new_exc_id = $a_mapping->
getMapping(
'Modules/Exercise', 
'exc', $a_rec[
'ExcId']);
   778                 $rmd->setReminderStatus($a_rec[
"Status"]);
   779                 $rmd->setReminderStart((
int) ($a_rec[
"Start"] ?? 0));
   780                 $rmd->setReminderEnd((
int) $end->get(
IL_CAL_UNIX));
   781                 $rmd->setReminderFrequency((
int) ($a_rec[
"Freq"] ?? 0));
   782                 $rmd->setReminderLastSend((
int) ($a_rec[
"LastSend"] ?? 0));
   783                 $rmd->setReminderMailTemplate((
int) ($a_rec[
"TemplateId"] ?? 0));
   795         if ($entity === 
"exc_assignment" && $field === 
"InstructionCollection") {
   796             return $this->ass_domain->instructionFiles((
int) $record[
"Id"])->getCollection();
 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...
 
getXmlRecord(string $a_entity, string $a_version, array $a_set)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir. 
 
Assignments domain service. 
 
Class ResourceCollection. 
 
static getInstanceByType(string $a_type)
 
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
getMapping(string $a_comp, string $a_entity, string $a_old_id)
 
ilObjExercise $current_exc
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getTypes(string $a_entity, string $a_version)
 
getXmlNamespace(string $a_entity, string $a_schema_version)
 
static instructionFileInsertOrder(string $a_filename, int $a_ass_id, int $a_order_nr=0)
 
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
create()
Create directory. 
 
readData(string $a_entity, string $a_version, array $a_ids)
 
stripTags(array $rec, array $omit_keys=[])
 
DomainService $ass_domain
 
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
getCollection(array $record, string $entity, string $schema_version, string $field, string $value)