|
@@ -4,8 +4,11 @@
|
|
|
* This class provides all the functionality for an ia (interactive activities).
|
|
|
*
|
|
|
* Release Notes:
|
|
|
+ * - v 4.9.8 2022/09/15
|
|
|
+ * + Fix iLM edition (now is possible to update fields 'reevaluate', 'editingbehavior' and 'evaluate' of table 'iassign_ilm')
|
|
|
* - v 4.9.7 2022/02/11
|
|
|
- * + Try to fix teacher edit of activity changing 'statement.id' to 'statement.file' in 'add_edit_iassign()'
|
|
|
+ * + Try to fix teacher edit of activity changing 'statement.id' to 'statement.file' in 'add_edit_iassign()';
|
|
|
+ * + Changed fix to activities order in 'show_iassign()', from "student view" to "teacher view"
|
|
|
*
|
|
|
* - v 4.9.6 2022/01/21
|
|
|
* + Try to fix view activity not sent through report ("view_iassign_current()": else if (!$student_answer) $loadTeacherActivity=true;)
|
|
@@ -133,12 +136,9 @@
|
|
|
$CONF_WWW = 1;
|
|
|
|
|
|
|
|
|
-
|
|
|
- * Standard base class for all iAssign
|
|
|
- */
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
class iassign {
|
|
|
-
|
|
|
var $cm;
|
|
|
var $course;
|
|
|
var $iassign;
|
|
@@ -213,7 +213,7 @@ class iassign {
|
|
|
$this->return = $CFG->wwwroot . "/mod/iassign/view.php?id=" . $this->cm->id;
|
|
|
$this->bottonPost = 0;
|
|
|
$this->view_iassign = optional_param('action', false, PARAM_BOOL);
|
|
|
- $this->activity = new activity(optional_param('iassign_current', NULL, PARAM_TEXT));
|
|
|
+ $this->activity = new activity(optional_param('iassign_current', NULL, PARAM_TEXT));
|
|
|
|
|
|
$this->view();
|
|
|
}
|
|
@@ -364,6 +364,7 @@ class iassign {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
function get_teacher_exercise () {
|
|
|
global $DB, $COURSE;
|
|
|
|
|
@@ -374,7 +375,12 @@ class iassign {
|
|
|
|
|
|
|
|
|
|
|
|
- $files = $fs->get_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $iassign_statement->id);
|
|
|
+
|
|
|
+ $files = $fs->get_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $iassign_statement->id);
|
|
|
+ if (!$files) {
|
|
|
+
|
|
|
+ $files = $fs->get_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $iassign_statement->filesid);
|
|
|
+ }
|
|
|
|
|
|
foreach ($files as $file) {
|
|
|
if ($file->get_filename() != ".") {
|
|
@@ -641,11 +647,8 @@ class iassign {
|
|
|
$url = "" . $CFG->wwwroot . "/mod/iassign/view.php?action=get_individual_submission&" . $param_aux . "&submissionid=" . $submissionid;
|
|
|
|
|
|
$atual_submission = $DB->get_record('iassign_allsubmissions', array('id' => $submissionid));
|
|
|
-
|
|
|
$atual_statement = $DB->get_record("iassign_statement", array("id" => $atual_submission->iassign_statementid));
|
|
|
-
|
|
|
- $all_submissions = $DB->get_records('iassign_allsubmissions',
|
|
|
- array('iassign_statementid' => $atual_submission->iassign_statementid, 'userid' => $atual_submission->userid));
|
|
|
+ $all_submissions = $DB->get_records('iassign_allsubmissions', array('iassign_statementid' => $atual_submission->iassign_statementid, 'userid' => $atual_submission->userid));
|
|
|
|
|
|
$user = $DB->get_record('user', array('id' => $atual_submission->userid));
|
|
|
|
|
@@ -726,7 +729,7 @@ class iassign {
|
|
|
|
|
|
$files_ids = $DB->get_records_sql('SELECT id FROM {files} WHERE component="mod_iassign" AND itemid=' . $filesid_from);
|
|
|
|
|
|
- print 'Arquivos a serem copiados: ';
|
|
|
+ print("Files to be copied: ");
|
|
|
print_r($files_ids);
|
|
|
|
|
|
foreach ($files_ids as $fileid) {
|
|
@@ -833,7 +836,7 @@ class iassign {
|
|
|
return $DB->get_records("iassign_statement", array("iassignid" => $iassignid));
|
|
|
}
|
|
|
|
|
|
- function get_courses_enroled_as_teacher($userid) {
|
|
|
+ function get_courses_enroled_as_teacher ($userid) {
|
|
|
$all_enroled = enrol_get_users_courses($userid);
|
|
|
$return = array();
|
|
|
foreach ($all_enroled as $enroled) {
|
|
@@ -935,9 +938,7 @@ class iassign {
|
|
|
|
|
|
print '<div>';
|
|
|
foreach ($exercises_list as $exercise) {
|
|
|
-
|
|
|
$submissions_list = $DB->get_records("iassign_allsubmissions", array("iassign_statementid" => $exercise->id));
|
|
|
-
|
|
|
$iassign_ilm = $DB->get_record("iassign_ilm", array("id" => $exercise->iassign_ilmid));
|
|
|
|
|
|
print '
|
|
@@ -956,7 +957,6 @@ class iassign {
|
|
|
print '<div class="collapse" style="padding: 0 1.5rem;" id="item-'.$exercise->id.'">';
|
|
|
|
|
|
foreach ($students_list as $student) {
|
|
|
-
|
|
|
$total = 0;
|
|
|
$student_submissions = [];
|
|
|
foreach ($submissions_list as $submission) {
|
|
@@ -1081,7 +1081,6 @@ class iassign {
|
|
|
|
|
|
|
|
|
foreach ($exercises_list as $exercise) {
|
|
|
-
|
|
|
$iassign_ilm = $DB->get_record("iassign_ilm", array("id" => $exercise->iassign_ilmid));
|
|
|
|
|
|
print '
|
|
@@ -1106,10 +1105,9 @@ class iassign {
|
|
|
}
|
|
|
print ']
|
|
|
},'; // close "
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
print " ];\n";
|
|
|
print '
|
|
|
var total_submissions = 0;
|
|
@@ -1241,7 +1239,6 @@ class iassign {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
function getStudentAnswerURL () {
|
|
|
return actual_answer_url;
|
|
@@ -1261,7 +1258,6 @@ class iassign {
|
|
|
$(".progress-bar").css("width", temp + "%").text(temp + "%");
|
|
|
if (temp >= 100) {
|
|
|
$(".progress-bar").removeClass("progress-bar-animated progress-bar-striped");
|
|
|
-
|
|
|
$("#button_start").prop("disabled", false);
|
|
|
$("#button_stop").prop("disabled", true);
|
|
|
$("input:checkbox").attr("disabled", false);
|
|
@@ -1270,7 +1266,6 @@ class iassign {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
function postResultAutoEval (grade = null) {
|
|
@@ -1375,7 +1370,6 @@ class iassign {
|
|
|
actual_student++;
|
|
|
run_individual_evaluation();
|
|
|
} else {
|
|
|
-
|
|
|
actual_student = 0;
|
|
|
|
|
|
if (actual_exercise < selected_exercises.length) {
|
|
@@ -1411,7 +1405,6 @@ class iassign {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
function stop_evaluation () {
|
|
|
stoped = true;
|
|
|
|
|
@@ -1420,34 +1413,26 @@ class iassign {
|
|
|
$(".progress-bar").removeClass("progress-bar-animated progress-bar-striped");
|
|
|
$("input:checkbox").attr("disabled", false);
|
|
|
$("#evaluate_alerts").text("' . get_string('auto_evaluate_stopped', 'iassign') . '");
|
|
|
- clearInterval(var_interval);
|
|
|
- }
|
|
|
-var exercises = [ '; // '
|
|
|
+ clearInterval(var_interval);
|
|
|
+ }
|
|
|
+ var exercises = [ '; // '
|
|
|
|
|
|
foreach ($exercises_list as $exercise) {
|
|
|
print $exercise->id . ',';
|
|
|
}
|
|
|
-
|
|
|
print ' ];';
|
|
|
-
|
|
|
print ' var students = [ ';
|
|
|
-
|
|
|
foreach ($students_list as $student) {
|
|
|
print $student->userid . ',';
|
|
|
}
|
|
|
print '];';
|
|
|
-
|
|
|
print ' var ilms = [';
|
|
|
-
|
|
|
foreach ($exercises_list as $exercise) {
|
|
|
$iassign_ilm = $DB->get_record("iassign_ilm", array("id" => $exercise->iassign_ilmid));
|
|
|
print "'" . $CFG->wwwroot . "/mod/iassign/" . $iassign_ilm->file_jar . "/" . $iassign_ilm->file_class . "',";
|
|
|
}
|
|
|
-
|
|
|
print ']';
|
|
|
-
|
|
|
print '</script>';
|
|
|
-
|
|
|
print '
|
|
|
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
@@ -1477,9 +1462,9 @@ var exercises = [ '; // '
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>'; // "
|
|
|
+
|
|
|
|
|
|
foreach ($students_list as $student) {
|
|
|
-
|
|
|
$user = $DB->get_record('user', array('id' => $student->userid));
|
|
|
$avatar = new user_picture($user);
|
|
|
$avatar->courseid = $COURSE->id;
|
|
@@ -1562,64 +1547,87 @@ var exercises = [ '; // '
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
function duplicate_activity () {
|
|
|
global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
|
|
|
|
- $id = $this->cm->id;
|
|
|
+
|
|
|
$iassignid = optional_param('iassign_current', NULL, PARAM_TEXT);
|
|
|
|
|
|
$context = context_module::instance($this->cm->id);
|
|
|
|
|
|
- $contextuser = context_user::instance($USER->id);
|
|
|
+
|
|
|
+echo "locallib.php: duplicate_activity()<br/>";
|
|
|
+echo "cm.id=" . $id . ", iassignid=" . $iassignid . ", context.id=" . $contextuser->id . "<br/>";
|
|
|
|
|
|
|
|
|
$iassign_statement = $DB->get_record("iassign_statement", array("id" => $iassignid));
|
|
|
+echo "{iassign_statement}: #iassign_statement=" . count($iassign_statement) . "<br/>";
|
|
|
|
|
|
|
|
|
- $id_source_copy = $iassign_statement->id;
|
|
|
- $iassign_statement->id=0;
|
|
|
+ $original_iassign_statement_id = $iassign_statement->id;
|
|
|
+ $iassign_statement->id=0;
|
|
|
|
|
|
|
|
|
- $iassign_statement->name = get_string('duplicate_iassign_prefix', 'iassign') . ' ' . $iassign_statement->name;
|
|
|
+ $iassign_statement->name = get_string('duplicate_iassign_prefix', 'iassign') . ' ' . $iassign_statement->name;
|
|
|
|
|
|
|
|
|
- $author = $DB->get_record("user", array('id' => $USER->id));
|
|
|
- $iassign_statement->author_modified_name = $author->firstname . ' ' . $author->lastname;
|
|
|
+ $author = $DB->get_record("user", array('id' => $USER->id));
|
|
|
+ $iassign_statement->author_modified_name = $author->firstname . ' ' . $author->lastname;
|
|
|
$iassign_statement->author_modified = $iassign_statement->author_modified_name;
|
|
|
+echo "iassign_statement.id=" . $iassign_statement->id . ",iassign_statement.name =" . $iassign_statement->name . ", id_source_copy=" . $original_iassign_statement_id .
|
|
|
+", author.id=" . $author->id . ", author.firstname=" . $author->firstname . "<br/>";
|
|
|
|
|
|
|
|
|
- if ($id_ = $DB->insert_record("iassign_statement", $iassign_statement)) {
|
|
|
+
|
|
|
+if (1==1) {
|
|
|
|
|
|
|
|
|
$fs = get_file_storage();
|
|
|
|
|
|
- $files = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $id_source_copy);
|
|
|
+ $files = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $original_iassign_statement_id);
|
|
|
+echo "{files}: #files=" . count($files) . "<br/>";
|
|
|
+
|
|
|
|
|
|
foreach ($files as $value) {
|
|
|
if ($value->get_filename() != ".") {
|
|
|
- $last_id = $DB->get_record_sql('SELECT itemid FROM {files} WHERE component="mod_iassign" ORDER BY itemid DESC LIMIT 1')->itemid;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+echo "{files}: id=" . $value->id . "=" . $value->get_id() . ", filename=" . $value->filename . ", itemid=" . $value->itemid . ", contextid=" . $value->contextid . ", component=" . $value->component
|
|
|
+. ", filearea=" . $value->filearea . ", userid=" . $value->userid . "<br/>";
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- $newfile = $fs->create_file_from_storedfile(array('contextid' => $context->id, 'component' => 'mod_iassign', 'filearea' => 'exercise', 'itemid' => $id_), $value);
|
|
|
+
|
|
|
+
|
|
|
+ $newfile = $fs->create_file_from_storedfile(array('contextid' => $context->id, 'component' => 'mod_iassign', 'filearea' => 'exercise', 'itemid' => $new_iassign_statement_id), $value);
|
|
|
|
|
|
+
|
|
|
$updateentry = new stdClass();
|
|
|
- $updateentry->id = $id_;
|
|
|
+ $updateentry->id = $new_iassign_statement_id;
|
|
|
+
|
|
|
|
|
|
- $updateentry->filesid = $id_;
|
|
|
+ $updateentry->filesid = $newfile->get_id();
|
|
|
|
|
|
|
|
|
$DB->update_record("iassign_statement", $updateentry);
|
|
|
+*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- iassign_log::add_log('duplicate_iassign_exercise', 'name: ' . $author->firstname, $id_, $this->cm->id);
|
|
|
+
|
|
|
|
|
|
- $this->return_home_course('duplicated_activity');
|
|
|
+
|
|
|
exit;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
function add_comment () {
|
|
@@ -2282,7 +2290,102 @@ var exercises = [ '; // '
|
|
|
|
|
|
$this->action = 'viewsubmission';
|
|
|
$this->view_iassign_current();
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ static function update_iassign_statement_files ($iassign_statement_id, $context_id, $component, $filearea, $files_ilmid) {
|
|
|
+ global $DB;
|
|
|
+
|
|
|
+
|
|
|
+ $sql_query = "SELECT * FROM {files} WHERE component='mod_iassign' AND filearea='exercise' AND contextid=" . $context_id . " AND itemid=" . $files_ilmid;
|
|
|
+
|
|
|
+ $elem_in_files = $DB->get_records_sql($sql_query);
|
|
|
+ if (!$elem_in_files) {
|
|
|
+ print "Vazio! <br/>";
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ foreach ($elem_in_files as $element_file) {
|
|
|
+ if ($element_file->filename != '.') {
|
|
|
+ $file1 = $element_file;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $newentry = new stdClass();
|
|
|
+ $newentry->id = $element_file->id; $newentry->itemid = $iassign_statement_id;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ $newentry = new stdClass();
|
|
|
+ $newentry->id = $iassign_statement_id; $newentry->filesid = $file1->id;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ static function get_update_files ($context_id, $component, $filearea, $iassign_statement, $fs) {
|
|
|
+
|
|
|
+echo "<br/><br/><br/><br/><br/>get_update_files: iassign_statement: " . $context_id . ", " . $component . ", " . $filearea . ", " .
|
|
|
+ "id=" . $iassign_statement->id . ", file=" . $iassign_statement->file . ", filesid=" . $iassign_statement->filesid .
|
|
|
+ ", iassign_ilmid =" . $iassign_statement->iassign_ilmid . ",name=" . $iassign_statement->name . "<br/>\n";
|
|
|
+ $msgAux = ""; $must_update_files_itemid = 0;
|
|
|
+
|
|
|
+
|
|
|
+ $files = $fs->get_area_files($context_id, $component, $filearea, $iassign_statement->id);
|
|
|
+ if (!$files) {
|
|
|
+ $msgAux .= "- Nao com 'iassign_statement.id'<br/>\n"; $must_update_files_itemid = 1;
|
|
|
+ $files = $fs->get_area_files($context_id, $component, $filearea, $iassign_statement->file);
|
|
|
+ if (!$files) {
|
|
|
+ $msgAux .= "- Nao com 'iassign_statement.file'<br/>\n";
|
|
|
+ $files = $fs->get_area_files($context_id, $component, $filearea, $iassign_statement->filesid);
|
|
|
+ if (!$files) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ echo "ERRO completo: " . $msgAux;
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else { $must_update_files_itemid = $iassign_statement->filesid; echo "OK 3, nao com 'id', nem com 'file', mas pegou com 'iassign_statement.filesid'=" . $iassign_statement->filesid . "<br/>\n"; }
|
|
|
+ }
|
|
|
+ else { $must_update_files_itemid = $iassign_statement->file; echo "OK 2, nao com 'id', pegou com 'iassign_statement.file'=" . $iassign_statement->file . "<br/>\n"; }
|
|
|
+ }
|
|
|
+ else echo "OK 1, pegou com 'iassign_statement.id'=" . $iassign_statement->id . "<br/>\n";
|
|
|
+
|
|
|
+ if ($must_update_files_itemid!=0) {
|
|
|
+ $res_update = iassign::update_iassign_statement_files($iassign_statement->id, $context_id, $component, $filearea, $must_update_files_itemid);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($files as $file) { if ($file->get_filename() != '.') break; }
|
|
|
+
|
|
|
+
|
|
|
+ echo "files[.]: id=" . $files_id . ", itemid=" . $files_itemid . "<br/>\n";
|
|
|
+ return $file;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -2370,9 +2473,7 @@ var exercises = [ '; // '
|
|
|
$param->show_answer = 1;
|
|
|
}
|
|
|
elseif ($this->action == 'edit') {
|
|
|
-
|
|
|
$COURSE->iassign_list = array();
|
|
|
-
|
|
|
$this_activity = $this->activity->get_activity();
|
|
|
|
|
|
if ($this_activity != null) {
|
|
@@ -2465,19 +2566,77 @@ var exercises = [ '; // '
|
|
|
$param->automatic_evaluate = $iassign_statement_current->automatic_evaluate;
|
|
|
$param->show_answer = $iassign_statement_current->show_answer;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$fs = get_file_storage();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- $files = $fs->get_area_files($context->id, $component, $filearea, $iassign_statement_current->file);
|
|
|
-
|
|
|
- if ($files) {
|
|
|
- foreach ($files as $file) {
|
|
|
- if ($file->get_filename() != '.') {
|
|
|
- $param->filename = $file->get_filename();
|
|
|
- $param->file = $file->get_id();
|
|
|
- $param->fileold = $file->get_id();
|
|
|
- $COURSE->iassign_file_id = $file->get_id();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($iassign_statement_current->file)
|
|
|
+ $files_list = $fs->get_area_files($context->id, $component, $filearea, $iassign_statement_current->file);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (!$files_list) {
|
|
|
+
|
|
|
+
|
|
|
+ $files_list = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $iassign_statement_current->filesid);
|
|
|
+ if (!$files_list) {
|
|
|
+
|
|
|
+ $files_list = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $iassign_statement_current->id);
|
|
|
+ }
|
|
|
+
|
|
|
+ $files_list = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $iassign_statement_current->filesid);
|
|
|
+ if ($files_list) {
|
|
|
+
|
|
|
+ $is_obj = $iassign_statement_current;
|
|
|
+ $count_fs = 0;
|
|
|
+ foreach ($files_list as $one_files) {
|
|
|
+ if ($count_fs==0) $f1_obj = $one_files;
|
|
|
+ else if ($count_fs==1) $f2_obj = $one_files;
|
|
|
+ $count_fs++;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ require_once('files_functions.php');
|
|
|
+ $result = update_iassignstatement_files($DB, $is_obj->id, $f1_obj->get_id(), $is_obj, $f1_obj, $f2_obj);
|
|
|
+ if (!$result) print "Could not change {iassign_statement}.filesid=" . $is_obj->id . " or {files}.itemid=" . $f1_obj->itemid . "<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($files_list) {
|
|
|
+ foreach ($files_list as $file_item) {
|
|
|
+ if ($file_item->get_filename() != '.') {
|
|
|
+ $param->filename = $file_item->get_filename();
|
|
|
+ $param->file = $file_item->get_id();
|
|
|
+ $param->fileold = $file_item->get_id();
|
|
|
+ $COURSE->iassign_file_id = $file_item->get_id();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2639,7 +2798,7 @@ var exercises = [ '; // '
|
|
|
}
|
|
|
}
|
|
|
return $dependency;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -2776,7 +2935,7 @@ var exercises = [ '; // '
|
|
|
\core\notification::error(get_string('activity_not_found', 'iassign'));
|
|
|
print $OUTPUT->footer();
|
|
|
exit;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
$ilm = new ilm($iassign_statement_activity_item->iassign_ilmid);
|
|
|
|
|
@@ -3051,24 +3210,18 @@ var exercises = [ '; // '
|
|
|
print activity::toggle_columns_script();
|
|
|
|
|
|
if ($iassign_submission && $allow_resubmission) {
|
|
|
-
|
|
|
|
|
|
print $OUTPUT->box_start();
|
|
|
-
|
|
|
print '<p><strong>' . $last_iassign . '</strong></p>';
|
|
|
-
|
|
|
+
|
|
|
$enderecoPOST = "";
|
|
|
-
|
|
|
|
|
|
print $ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, false);
|
|
|
-
|
|
|
|
|
|
|
|
|
print $OUTPUT->box_end();
|
|
|
-
|
|
|
}
|
|
|
else {
|
|
|
-
|
|
|
|
|
|
|
|
|
$loadTeacherActivity = false;
|
|
@@ -3087,7 +3240,6 @@ var exercises = [ '; // '
|
|
|
print activity::toggle_columns_script();
|
|
|
|
|
|
print $OUTPUT->box($ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3187,10 +3339,9 @@ var exercises = [ '; // '
|
|
|
|
|
|
$enderecoPOST = "" . $CFG->wwwroot . "/mod/iassign/view.php?" . $param_aux;
|
|
|
|
|
|
- $this->activity->view_dates();
|
|
|
+ $this->activity->view_dates();
|
|
|
|
|
|
if ($this->view_iassign) {
|
|
|
-
|
|
|
print $OUTPUT->box_start();
|
|
|
|
|
|
print '<table width=100% border=0 valign="top">' . "\n";
|
|
@@ -3321,7 +3472,6 @@ var exercises = [ '; // '
|
|
|
print '</tr></table>' . "\n";
|
|
|
|
|
|
|
|
|
-
|
|
|
print '<table width=100% border=0 valign="top">' . "\n";
|
|
|
print '<td width=80% align="left">';
|
|
|
print '<strong>' . $last_iassign . ' ' . get_string('repeat_msg', 'iassign') . '</strong></td>' . "\n";
|
|
@@ -3336,15 +3486,7 @@ var exercises = [ '; // '
|
|
|
print '<p class="mt-5"><strong>' . get_string('proposition', 'iassign') . '</strong></p>' . "\n";
|
|
|
print '<div class="proposition">' . $iassign_statement_activity_item->proposition . '</div>' . "\n";
|
|
|
|
|
|
- $output = '';
|
|
|
-
|
|
|
- if (!$iassign_ilm) {
|
|
|
- $iassign_ilm = new stdClass();
|
|
|
- $iassign_ilm->file_jar = "";
|
|
|
- }
|
|
|
-
|
|
|
- $output .= $OUTPUT->box_start();
|
|
|
-
|
|
|
+ $output = $OUTPUT->box_start();
|
|
|
$USER->iassignEdit = $this->bottonPost;
|
|
|
|
|
|
|
|
@@ -3369,7 +3511,7 @@ var exercises = [ '; // '
|
|
|
$output .= $ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -3385,14 +3527,11 @@ var exercises = [ '; // '
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
$output .= $OUTPUT->box_end();
|
|
|
print $output;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
print $OUTPUT->box_end();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -3433,7 +3572,6 @@ var exercises = [ '; // '
|
|
|
|
|
|
$output .= $OUTPUT->box_start();
|
|
|
|
|
|
-
|
|
|
|
|
|
$output .= "<a id='comments'></a>";
|
|
|
$output .= " <table id='outlinetable' class='generaltable boxaligncenter' cellpadding='5' width='100%'> \n";
|
|
@@ -5384,7 +5522,7 @@ class activity {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
function __construct ($id) {
|
|
|
global $DB;
|
|
@@ -5433,14 +5571,14 @@ class activity {
|
|
|
|
|
|
$bottonDelete_yes = get_string('delete_iassign', 'iassign');
|
|
|
$deleteiassignyes = $CFG->wwwroot . "/mod/iassign/view.php?id=" . $USER->cm . "&action=deleteyes&iassign_current=" . $this->activity->id;
|
|
|
- $output .= "<form name='formDelete' id='formDelete' method='post' action='$deleteiassignyes' enctype='multipart/form-data'>\n";
|
|
|
- $output .= " <input type=submit value='$bottonDelete_yes'/>\n";
|
|
|
+ $output .= "<form name='formDelete' id='formDelete' method='post' action='" . $deleteiassignyes . "' enctype='multipart/form-data'>\n";
|
|
|
+ $output .= " <input type=submit value='" . $bottonDelete_yes . "'/>\n";
|
|
|
$output .= "</form>\n";
|
|
|
$output .= '</td><td>';
|
|
|
$bottonDelete_no = get_string('delete_cancel', 'iassign');
|
|
|
$deleteiassignno = $CFG->wwwroot . "/mod/iassign/view.php?id=" . $USER->cm . "&action=deleteno&iassign_current=" . $this->activity->id;
|
|
|
- $output .= "<form name='formDelete' id='formDelete' method='post' action='$deleteiassignno' enctype='multipart/form-data'>\n";
|
|
|
- $output .= " <p><input type=submit value='$bottonDelete_no'/></p>\n";
|
|
|
+ $output .= "<form name='formDelete' id='formDelete' method='post' action='" . $deleteiassignno . "' enctype='multipart/form-data'>\n";
|
|
|
+ $output .= " <p><input type=submit value='" . $bottonDelete_no . "'/></p>\n";
|
|
|
$output .= "</form>\n";
|
|
|
$output .= '</td></tr></table>' . "\n";
|
|
|
$output .= $OUTPUT->box_end();
|
|
@@ -5554,7 +5692,7 @@ class activity {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
function new_iassign ($param) {
|
|
@@ -5618,8 +5756,8 @@ class activity {
|
|
|
|
|
|
$itemid = $file->get_itemid() + $id;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -5734,7 +5872,7 @@ class activity {
|
|
|
if ($events) {
|
|
|
foreach ($events as $value) {
|
|
|
if ($value->description == $iassign_statement_activity_item->name) {
|
|
|
- $DB->delete_records('event', array('id' => $value->id));
|
|
|
+ $DB->delete_records('event', array('id' => $value->id));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5752,7 +5890,6 @@ class activity {
|
|
|
$fileold = $fs->get_file_by_id($param->fileold);
|
|
|
|
|
|
if ($param->file != $param->fileold) {
|
|
|
-
|
|
|
if ($fileold) {
|
|
|
$fileoldarea = $fs->get_area_files($fileold->get_contextid(), $fileold->get_component(), $fileold->get_filearea(), $fileold->get_itemid());
|
|
|
foreach ($fileoldarea as $value) {
|
|
@@ -5785,14 +5922,10 @@ class activity {
|
|
|
else
|
|
|
$proposition_text = $proposition;
|
|
|
$newentry->proposition = $proposition_text;
|
|
|
-
|
|
|
$newentry->iassign_ilmid = $param->iassign_ilmid;
|
|
|
-
|
|
|
$newentry->filesid = $param->file;
|
|
|
-
|
|
|
$newentry->grade = $param->grade;
|
|
|
$newentry->author_modified_name = $param->author_modified_name;
|
|
|
-
|
|
|
$newentry->timemodified = time();
|
|
|
if ($param->type_iassign == 1) {
|
|
|
$newentry->timedue = 0;
|
|
@@ -6135,9 +6268,13 @@ class ilm_settings {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -6149,7 +6286,7 @@ class ilm_settings {
|
|
|
$iassign_ilm = $DB->get_record('iassign_ilm', array('id' => $ilm_id));
|
|
|
|
|
|
$param = new stdClass();
|
|
|
-
|
|
|
+
|
|
|
$param->action = $action;
|
|
|
$param->ilm_id = $ilm_id;
|
|
|
$CFG->action_ilm = $action;
|
|
@@ -6171,11 +6308,15 @@ class ilm_settings {
|
|
|
$param->enable = 0;
|
|
|
$param->timecreated = time();
|
|
|
$param->timemodified = time();
|
|
|
- $param->evaluate = 0;
|
|
|
+ $param->evaluate = 0;
|
|
|
+ $param->reevaluate = 0;
|
|
|
+ $param->editingbehavior = 0;
|
|
|
+ $param->submissionbehavior = 0;
|
|
|
$param->parent = 0;
|
|
|
}
|
|
|
elseif ($action == 'edit') {
|
|
|
if ($iassign_ilm) {
|
|
|
+
|
|
|
$description = json_decode($iassign_ilm->description);
|
|
|
|
|
|
$param->title = get_string('edit_ilm', 'iassign');
|
|
@@ -6214,10 +6355,13 @@ class ilm_settings {
|
|
|
$param->enable = $iassign_ilm->enable;
|
|
|
$param->timecreated = $iassign_ilm->timecreated;
|
|
|
$param->timemodified = time();
|
|
|
- $param->evaluate = $iassign_ilm->evaluate;
|
|
|
+ $param->evaluate = $iassign_ilm->evaluate;
|
|
|
+ $param->reevaluate = $iassign_ilm->reevaluate;
|
|
|
+ $param->editingbehavior = $iassign_ilm->editingbehavior;
|
|
|
+ $param->submissionbehavior = $iassign_ilm->submissionbehavior;
|
|
|
$param->parent = $iassign_ilm->parent;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
elseif ($action == 'new_version') {
|
|
|
|
|
|
|
|
@@ -6255,9 +6399,12 @@ class ilm_settings {
|
|
|
$param->timecreated = time();
|
|
|
$param->timemodified = time();
|
|
|
$param->evaluate = $iassign_ilm->evaluate;
|
|
|
+ $param->reevaluate = $iassign_ilm->reevaluate;
|
|
|
+ $param->editingbehavior = $iassign_ilm->editingbehavior;
|
|
|
+ $param->submissionbehavior = $iassign_ilm->submissionbehavior;
|
|
|
$param->parent = $iassign_ilm->parent;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
elseif ($action == 'copy') {
|
|
|
$description = json_decode($iassign_ilm->description);
|
|
|
if ($iassign_ilm) {
|
|
@@ -6284,13 +6431,18 @@ class ilm_settings {
|
|
|
$param->timecreated = time();
|
|
|
$param->timemodified = time();
|
|
|
$param->evaluate = $iassign_ilm->evaluate;
|
|
|
+ $param->reevaluate = $iassign_ilm->reevaluate;
|
|
|
+ $param->editingbehavior = $iassign_ilm->editingbehavior;
|
|
|
+ $param->submissionbehavior = $iassign_ilm->submissionbehavior;
|
|
|
$param->parent = $iassign_ilm->parent;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return $param;
|
|
|
}
|
|
@@ -6466,11 +6618,16 @@ class ilm_settings {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+
|
|
|
static function edit_ilm ($param, $itemid) {
|
|
|
|
|
|
global $DB, $USER, $CFG;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
$iassign_t = $DB->get_record('iassign_ilm', array('id' => $param->id));
|
|
|
|
|
|
$pathtemp = $CFG->dataroot . '/temp/';
|
|
@@ -8122,7 +8279,6 @@ class ilm_manager {
|
|
|
'filename' => $iassign_statement_activity_item->name . "." . $extension[1]);
|
|
|
|
|
|
$newfile = $fs->create_file_from_string($fileinfo, $value->get_content());
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -8805,6 +8961,12 @@ class iassign_icons {
|
|
|
return $string;
|
|
|
}
|
|
|
|
|
|
+ static function insertIT ($icon, $title, $text_alt) {
|
|
|
+ global $CFG;
|
|
|
+ $string = '<img src="' . $CFG->wwwroot . '/mod/iassign/icon/' . $icon . '.gif" title="' . get_string($title, 'iassign') . '" alt="' . get_string($text_alt, 'iassign') . '"/>';
|
|
|
+ return $string;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|