29        return array(
"4.1.0", 
"4.4.0", 
"5.0.0", 
"5.1.0", 
"5.2.0", 
"5.3.0");
 
   40        return "http://www.ilias.de/xml/Modules/Exercise/" . $a_entity;
 
   49    protected function getTypes($a_entity, $a_version)
 
   51        if ($a_entity == 
"exc") {
 
   57                        "Description" => 
"text",
 
   59                        "PassNr" => 
"integer",
 
   60                        "ShowSubmissions" => 
"integer" 
   69                        "Description" => 
"text",
 
   71                        "PassNr" => 
"integer",
 
   72                        "ShowSubmissions" => 
"integer",
 
   73                        "ComplBySubmission" => 
"integer" 
   81                        "Description" => 
"text",
 
   83                        "PassNr" => 
"integer",
 
   84                        "NrMandatoryRandom" => 
"integer",
 
   85                        "ShowSubmissions" => 
"integer",
 
   86                        "ComplBySubmission" => 
"integer",
 
   87                        "Tfeedback" => 
"integer" 
   92        if ($a_entity == 
"exc_assignment") {
 
   97                        "ExerciseId" => 
"integer",
 
   99                        "Instruction" => 
"text",
 
  101                        "Mandatory" => 
"integer",
 
  102                        "OrderNr" => 
"integer",
 
  103                        "Dir" => 
"directory");
 
  108                        "ExerciseId" => 
"integer",
 
  110                        "Deadline" => 
"integer",
 
  111                        "Instruction" => 
"text",
 
  113                        "Mandatory" => 
"integer",
 
  114                        "OrderNr" => 
"integer",
 
  118                        ,
"PeerMin" => 
"integer" 
  119                        ,
"PeerDeadline" => 
"integer" 
  121                        ,
"FeedbackFile" => 
"integer" 
  122                        ,
"FeedbackCron" => 
"integer" 
  123                        ,
"FeedbackDate" => 
"integer" 
  124                        ,
"FeedbackDir" => 
"directory" 
  130                        "ExerciseId" => 
"integer",
 
  132                        "Deadline" => 
"integer",
 
  133                        "Instruction" => 
"text",
 
  135                        "Mandatory" => 
"integer",
 
  136                        "OrderNr" => 
"integer",
 
  140                        ,
"PeerMin" => 
"integer" 
  141                        ,
"PeerDeadline" => 
"integer" 
  142                        ,
"PeerFile" => 
"integer" 
  143                        ,
"PeerPersonal" => 
"integer" 
  145                        ,
"FeedbackFile" => 
"integer" 
  146                        ,
"FeedbackCron" => 
"integer" 
  147                        ,
"FeedbackDate" => 
"integer" 
  148                        ,
"FeedbackDir" => 
"directory" 
  155                        "ExerciseId" => 
"integer",
 
  157                        "Deadline" => 
"integer",
 
  158                        "Deadline2" => 
"integer",
 
  159                        "Instruction" => 
"text",
 
  161                        "Mandatory" => 
"integer",
 
  162                        "OrderNr" => 
"integer",
 
  163                        "TeamTutor" => 
"integer",
 
  164                        "MaxFile" => 
"integer",
 
  168                        ,
"PeerMin" => 
"integer" 
  169                        ,
"PeerDeadline" => 
"integer" 
  170                        ,
"PeerFile" => 
"integer" 
  171                        ,
"PeerPersonal" => 
"integer" 
  172                        ,
"PeerChar" => 
"integer" 
  173                        ,
"PeerUnlock" => 
"integer" 
  174                        ,
"PeerValid" => 
"integer" 
  175                        ,
"PeerText" => 
"integer" 
  176                        ,
"PeerRating" => 
"integer" 
  177                        ,
"PeerCritCat" => 
"integer" 
  179                        ,
"FeedbackFile" => 
"integer" 
  180                        ,
"FeedbackCron" => 
"integer" 
  181                        ,
"FeedbackDate" => 
"integer" 
  182                        ,
"FeedbackDir" => 
"directory" 
  187                        "ExerciseId" => 
"integer",
 
  189                        "Deadline" => 
"integer",
 
  190                        "Deadline2" => 
"integer",
 
  191                        "Instruction" => 
"text",
 
  193                        "Mandatory" => 
"integer",
 
  194                        "OrderNr" => 
"integer",
 
  195                        "TeamTutor" => 
"integer",
 
  196                        "MaxFile" => 
"integer",
 
  197                        "Dir" => 
"directory",
 
  199                        "WebDataDir" => 
"directory" 
  202                        ,
"PeerMin" => 
"integer" 
  203                        ,
"PeerDeadline" => 
"integer" 
  204                        ,
"PeerFile" => 
"integer" 
  205                        ,
"PeerPersonal" => 
"integer" 
  206                        ,
"PeerChar" => 
"integer" 
  207                        ,
"PeerUnlock" => 
"integer" 
  208                        ,
"PeerValid" => 
"integer" 
  209                        ,
"PeerText" => 
"integer" 
  210                        ,
"PeerRating" => 
"integer" 
  211                        ,
"PeerCritCat" => 
"integer" 
  213                        ,
"FeedbackFile" => 
"integer" 
  214                        ,
"FeedbackCron" => 
"integer" 
  215                        ,
"FeedbackDate" => 
"integer" 
  216                        ,
"FeedbackDir" => 
"directory" 
  217                        ,
"FbDateCustom" => 
"integer" 
  218                        ,
"DeadlineMode" => 
"integer" 
  219                        ,
"RelativeDeadline" => 
"integer" 
  220                        ,
"RelDeadlineLastSubm" => 
"integer" 
  225        if ($a_entity == 
"exc_cit_cat") {
 
  226            switch ($a_version) {
 
  232                        ,
"Parent" => 
"integer" 
  239        if ($a_entity == 
"exc_cit") {
 
  240            switch ($a_version) {
 
  246                        ,
"Parent" => 
"integer" 
  251                        ,
"Required" => 
"integer" 
  258        if ($a_entity == 
"exc_ass_file_order") {
 
  259            switch ($a_version) {
 
  263                    , 
"AssignmentId" => 
"integer" 
  264                    , 
"Filename" => 
"text" 
  265                    , 
"OrderNr" => 
"integer" 
  270        if ($a_entity == 
"exc_ass_reminders") {
 
  271            switch ($a_version) {
 
  275                        "AssignmentId" => 
"integer",
 
  276                        "ExerciseId" => 
"integer",
 
  277                        "Status" => 
"integer",
 
  278                        "Start" => 
"integer",
 
  280                        "Frequency" => 
"integer",
 
  281                        "LastSend" => 
"integer",
 
  282                        "TemplateId" => 
"integer" 
  295    public function readData($a_entity, $a_version, $a_ids, $a_field = 
"")
 
  299        if (!is_array($a_ids)) {
 
  300            $a_ids = array($a_ids);
 
  303        if ($a_entity == 
"exc") {
 
  304            switch ($a_version) {
 
  307                        " pass_mode, pass_nr, show_submissions" .
 
  308                        " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
 
  309                        " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
 
  316                        " pass_mode, pass_nr, show_submissions, compl_by_submission" .
 
  317                        " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
 
  318                        " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
 
  324                        " pass_mode, pass_nr, show_submissions, compl_by_submission, tfeedback,nr_mandatory_random" .
 
  325                        " FROM exc_data JOIN object_data ON (exc_data.obj_id = object_data.obj_id)" .
 
  326                        " WHERE " . 
$ilDB->in(
"exc_data.obj_id", $a_ids, 
false, 
"integer"));
 
  331        if ($a_entity == 
"exc_assignment") {
 
  332            switch ($a_version) {
 
  335                        " instruction, title, start_time, mandatory, order_nr" .
 
  336                        " FROM exc_assignment" .
 
  337                        " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
 
  342                        " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
 
  343                        " fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
 
  344                        " FROM exc_assignment" .
 
  345                        " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
 
  350                        " instruction, title, start_time, mandatory, order_nr, peer, peer_min, peer_dl peer_deadline," .
 
  351                        " peer_file, peer_prsl peer_personal, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date" .
 
  352                        " FROM exc_assignment" .
 
  353                        " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
 
  360                        " instruction, title, start_time, mandatory, order_nr, team_tutor, max_file, peer, peer_min," .
 
  361                        " peer_dl peer_deadline, peer_file, peer_prsl peer_personal, peer_char, peer_unlock, peer_valid," .
 
  362                        " peer_text, peer_rating, peer_crit_cat, fb_file feedback_file, fb_cron feedback_cron, fb_date feedback_date," .
 
  363                        " fb_date_custom, rel_deadline_last_subm, deadline_mode, relative_deadline" .
 
  364                        " FROM exc_assignment" .
 
  365                        " WHERE " . 
$ilDB->in(
"exc_id", $a_ids, 
false, 
"integer"));
 
  370        if ($a_entity == 
"exc_crit_cat") {
 
  371            switch ($a_version) {
 
  376                        " FROM exc_crit_cat" .
 
  377                        " WHERE " . 
$ilDB->in(
"parent", $a_ids, 
false, 
"integer"));
 
  382        if ($a_entity == 
"exc_crit") {
 
  383            switch ($a_version) {
 
  388                        ", descr, pos, required, def" .
 
  390                        " WHERE " . 
$ilDB->in(
"parent", $a_ids, 
false, 
"integer"));
 
  391                    foreach ($this->data as $k => $v) {
 
  392                        $this->data[$k][
"DefJson"] = 
"";
 
  393                        if ($v[
"Def"] != 
"") {
 
  394                            $this->data[$k][
"DefJson"] = json_encode(unserialize($v[
"Def"]));
 
  401        if ($a_entity == 
"exc_ass_file_order") {
 
  402            switch ($a_version) {
 
  405                        " FROM exc_ass_file_order" .
 
  406                        " WHERE " . 
$ilDB->in(
"assignment_id", $a_ids, 
false, 
"integer"));
 
  411        if ($a_entity == 
"exc_ass_reminders") {
 
  412            switch ($a_version) {
 
  414                    $this->
getDirectDataFromQuery(
"SELECT type, ass_id, exc_id, status, start, end, freq, last_send, template_id" .
 
  415                        " FROM exc_ass_reminders" .
 
  416                        " WHERE " . 
$ilDB->in(
"ass_id", $a_ids, 
false, 
"integer"));
 
  430        if ($a_entity == 
"exc_assignment") {
 
  432            if ($a_set[
"StartTime"] != 
"") {
 
  436            if ($a_set[
"Deadline"] != 
"") {
 
  440            if ($a_set[
"Deadline2"] != 
"") {
 
  446            $a_set[
"Dir"] = $fstorage->getPath();
 
  449            $a_set[
"FeedbackDir"] = $fstorage->getGlobalFeedbackPath();
 
  453            $a_set[
'WebDataDir'] = $fswebstorage->getPath();
 
  457        if ($a_entity == 
"exc_ass_reminders") {
 
  458            if ($a_set[
"End"] != 
"") {
 
  462            if ($a_set[
"LastSend"] != 
"") {
 
  479                switch ($a_version) {
 
  484                            "exc_assignment" => array(
"ids" => $a_rec[
"Id"])
 
  491                            "exc_crit_cat" => array(
"ids" => $a_rec[
"Id"]),
 
  492                            "exc_assignment" => array(
"ids" => $a_rec[
"Id"])
 
  499                    "exc_crit" => array(
"ids" => $a_rec[
"Id"])
 
  502            case "exc_assignment":
 
  503                switch ($a_version) {
 
  506                            "exc_ass_file_order" => array(
"ids" => $a_rec[
"Id"]),
 
  507                            "exc_ass_reminders" => array(
"ids" => $a_rec[
"Id"])
 
  523    public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 
  525        $a_rec = $this->
stripTags($a_rec, [
"Instruction"]);
 
  527        $a_rec[
"Instruction"] = $purifier->purify((
string) ($a_rec[
"Instruction"] ?? 
""));
 
  531                if ($new_id = $a_mapping->getMapping(
'Services/Container', 
'objs', $a_rec[
'Id'])) {
 
  535                    $newObj->setType(
"exc");
 
  536                    $newObj->create(
true);
 
  539                $newObj->setTitle($a_rec[
"Title"]);
 
  540                $newObj->setDescription($a_rec[
"Description"]);
 
  541                $newObj->setPassMode($a_rec[
"PassMode"]);
 
  542                $newObj->setPassNr($a_rec[
"PassNr"]);
 
  543                $newObj->setNrMandatoryRandom((
int) $a_rec[
"NrMandatoryRandom"]);
 
  544                $newObj->setShowSubmissions($a_rec[
"ShowSubmissions"]);
 
  545                $newObj->setCompletionBySubmission($a_rec[
"ComplBySubmission"]);
 
  546                $newObj->setTutorFeedback($a_rec[
"Tfeedback"]);
 
  549                $this->current_exc = $newObj;
 
  551                $a_mapping->addMapping(
"Modules/Exercise", 
"exc", $a_rec[
"Id"], $newObj->getId());
 
  552                $a_mapping->addMapping(
'Services/Object', 
'objs', $a_rec[
'Id'], $newObj->getId());
 
  553                $a_mapping->addMapping(
'Services/AdvancedMetaData', 
'parent', $a_rec[
'Id'], $newObj->getId());
 
  554                $a_mapping->addMapping(
 
  557                    $a_rec[
"Id"] . 
":0:exc",
 
  558                    $newObj->getId() . 
":0:exc" 
  562            case "exc_assignment":
 
  563                $exc_id = $a_mapping->getMapping(
"Modules/Exercise", 
"exc", $a_rec[
"ExerciseId"]);
 
  565                    if (is_object($this->current_exc) && $this->current_exc->getId() == $exc_id) {
 
  566                        $exc = $this->current_exc;
 
  572                    $ass->setExerciseId($exc_id);
 
  574                    if ($a_rec[
"StartTime"] != 
"") {
 
  579                    if ($a_rec[
"Deadline"] != 
"") {
 
  584                    $ass->setInstruction($a_rec[
"Instruction"]);
 
  585                    $ass->setTitle($a_rec[
"Title"]);
 
  586                    $ass->setMandatory($a_rec[
"Mandatory"]);
 
  587                    $ass->setOrderNr($a_rec[
"OrderNr"]);
 
  590                    $ass->setType($a_rec[
"Type"]);
 
  593                    $ass->setPeerReview($a_rec[
"Peer"]);
 
  594                    $ass->setPeerReviewMin($a_rec[
"PeerMin"]);
 
  595                    $ass->setPeerReviewDeadline($a_rec[
"PeerDeadline"]);
 
  596                    $ass->setFeedbackFile($a_rec[
"FeedbackFile"]);
 
  597                    $ass->setFeedbackCron($a_rec[
"FeedbackCron"]);
 
  598                    $ass->setFeedbackDate($a_rec[
"FeedbackDate"]);
 
  601                    $ass->setPeerReviewFileUpload($a_rec[
"PeerFile"]);
 
  602                    $ass->setPeerReviewPersonalized($a_rec[
"PeerPersonal"]);
 
  605                    if ($a_rec[
"Deadline2"] != 
"") {
 
  607                        $ass->setExtendedDeadline($deadline->get(
IL_CAL_UNIX));
 
  609                    $ass->setMaxFile($a_rec[
"MaxFile"]);
 
  610                    $ass->setTeamTutor($a_rec[
"TeamTutor"]);
 
  611                    $ass->setPeerReviewChars($a_rec[
"PeerChar"]);
 
  612                    $ass->setPeerReviewSimpleUnlock($a_rec[
"PeerUnlock"]);
 
  613                    $ass->setPeerReviewValid($a_rec[
"PeerValid"]);
 
  614                    $ass->setPeerReviewText($a_rec[
"PeerText"]);
 
  615                    $ass->setPeerReviewRating($a_rec[
"PeerRating"]);
 
  618                    $ass->setFeedbackDateCustom($a_rec[
"FbDateCustom"]);
 
  619                    $ass->setRelDeadlineLastSubmission($a_rec[
"RelDeadlineLastSubm"]);
 
  620                    $ass->setDeadlineMode($a_rec[
"DeadlineMode"]);
 
  621                    $ass->setRelativeDeadline($a_rec[
"RelativeDeadline"]);
 
  624                    if ($a_rec[
"PeerCritCat"]) {
 
  625                        $ass->setPeerReviewCriteriaCatalogue($a_mapping->getMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"PeerCritCat"]));
 
  634                    $dir = str_replace(
"..", 
"", $a_rec[
"Dir"]);
 
  637                        $target_dir = $fstorage->getPath();
 
  642                    $dir = str_replace(
"..", 
"", $a_rec[
"FeedbackDir"]);
 
  645                        $target_dir = $fstorage->getGlobalFeedbackPath();
 
  651                    $fwebstorage->create();
 
  652                    $dir = str_replace(
"..", 
"", $a_rec[
"WebDataDir"]);
 
  655                        $target_dir = $fwebstorage->getPath();
 
  662                        $ar->setId($ass->getId());
 
  663                        $ar->setTemplateRefId(0);
 
  664                        $ar->setContainerRefId(0);
 
  668                    $a_mapping->addMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"Id"], $ass->getId());
 
  674                $exc_id = $a_mapping->getMapping(
"Modules/Exercise", 
"exc", $a_rec[
"Parent"]);
 
  677                    $crit_cat->setParent($exc_id);
 
  678                    $crit_cat->setTitle($a_rec[
"Title"]);
 
  679                    $crit_cat->setPosition($a_rec[
"Pos"]);
 
  682                    $a_mapping->addMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"Id"], $crit_cat->getId());
 
  687                $crit_cat_id = $a_mapping->getMapping(
"Modules/Exercise", 
"exc_crit_cat", $a_rec[
"Parent"]);
 
  688                if ($crit_cat_id > 0) {
 
  690                    $crit->setParent($crit_cat_id);
 
  691                    $crit->setTitle($a_rec[
"Title"]);
 
  692                    $crit->setDescription($a_rec[
"Descr"]);
 
  693                    $crit->setPosition($a_rec[
"Pos"]);
 
  694                    $crit->setRequired($a_rec[
"Required"]);
 
  695                    $crit->importDefinition($a_rec[
"Def"], $a_rec[
"DefJson"]);
 
  700            case "exc_ass_file_order":
 
  702                $ass_id = $a_mapping->getMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"AssignmentId"]);
 
  708            case "exc_ass_reminders":
 
  710                $new_ass_id = $a_mapping->getMapping(
"Modules/Exercise", 
"exc_assignment", $a_rec[
"AssId"]);
 
  711                $new_exc_id = $a_mapping->getMapping(
'Modules/Exercise', 
'exc', $a_rec[
'ExcId']);
 
  715                $rmd->setReminderStatus($a_rec[
"Status"]);
 
  716                $rmd->setReminderStart($a_rec[
"Start"]);
 
  718                $rmd->setReminderFrequency($a_rec[
"Freq"]);
 
  719                $rmd->setReminderLastSend($a_rec[
"LastSend"]);
 
  720                $rmd->setReminderMailTemplate($a_rec[
"TemplateId"]);
 
An exception for terminatinating execution or to throw for unit testing.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
stripTags(array $rec, array $omit_keys=[])
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
getImportDirectory()
Get import directory.
@classDescription Date and time handling
Item group active record class.
TODO: import/export reminder data with the exercise/assignment.
static instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr=0)
Store the file order in the database.
Class ilExcCriteriaCatalogue.
static getInstanceByType($a_type)
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record (export)
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getTypes($a_entity, $a_version)
Get field types for entity.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
getSupportedVersions()
Get supported versions.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.