|
@@ -112,7 +112,6 @@
|
|
|
* - http:
|
|
|
*/
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -310,27 +309,24 @@ class iassign {
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
eval($action_iassign[$this->action]);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
function auto_evaluate () {
|
|
|
-
|
|
|
global $COURSE, $CFG, $USER, $DB, $OUTPUT;
|
|
|
|
|
|
if (!has_capability('mod/iassign:runautoevaluate', $USER->context, $USER->id))
|
|
|
exit;
|
|
|
|
|
|
print $OUTPUT->header();
|
|
|
-
|
|
|
print $OUTPUT->footer();
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
function move_activity () {
|
|
@@ -360,7 +356,7 @@ class iassign {
|
|
|
$id_context = $context_file->id;
|
|
|
|
|
|
$iassign_statement = $DB->get_record("iassign_statement", array("id" => $iassign_id));
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
|
|
|
$files = $fs->get_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $iassign_statement->file);
|
|
|
|
|
@@ -415,7 +411,7 @@ class iassign {
|
|
|
if ($id_ = $DB->insert_record("iassign_statement", $iassign_statement)) {
|
|
|
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$files = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $iassign_statement->file);
|
|
|
|
|
|
foreach ($files as $value) {
|
|
@@ -443,7 +439,7 @@ class iassign {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
function get_answer () {
|
|
|
|
|
|
global $USER, $CFG, $DB, $OUTPUT;
|
|
@@ -464,6 +460,7 @@ class iassign {
|
|
|
|
|
|
$iLM_PARAM_ActivityEvaluation = optional_param('iLM_PARAM_ActivityEvaluation', 0, PARAM_INT);
|
|
|
$iLM_PARAM_RealGrade = optional_param('iLM_PARAM_RealGrade', 0, PARAM_FLOAT);
|
|
|
+
|
|
|
|
|
|
$iLM_PARAM_ArchiveContent = optional_param('iLM_PARAM_ArchiveContent', NULL, PARAM_RAW);
|
|
|
$MA_POST_Info = optional_param('MA_POST_Info', NULL, PARAM_FORMAT);
|
|
@@ -511,6 +508,7 @@ class iassign {
|
|
|
|
|
|
$status = 3;
|
|
|
$grade_student = $iLM_PARAM_RealGrade;
|
|
|
+
|
|
|
$msg = '<tr><td colspan=2>' . iassign_icons::insert('feedback_correct') . '<br>' . get_string('get_answer_correct', 'iassign') . '</td>';
|
|
|
|
|
|
|
|
@@ -602,11 +600,8 @@ class iassign {
|
|
|
$newentry->experiment = 1;
|
|
|
|
|
|
if (!$newentry->id = $DB->insert_record("iassign_submission", $newentry)) {
|
|
|
-
|
|
|
print_error('error_insert', 'iassign');
|
|
|
-
|
|
|
} else {
|
|
|
-
|
|
|
|
|
|
$event = \mod_iassign\event\submission_created::create(array(
|
|
|
'objectid' => $this->iassign->id,
|
|
@@ -742,6 +737,26 @@ class iassign {
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function htmlcode_2_export ($course_fullname, $course_id, $iassign_block_id, $iassign_block_name, $array_iassign_name, $array_iassign_id, $userid, $username) {
|
|
|
+ $str_html = "<html dir='ltr' lang='pt-br' xml:lang='pt-br'>
|
|
|
+ <head>
|
|
|
+ <title>" . get_string('pluginname', 'iassign') . "</title>\n"; // 'iAssign: interactive Learning Activities'
|
|
|
+ $str_html .= " </head>
|
|
|
+ <body>\n";
|
|
|
+ $tam = sizeof($array_iassign_name);
|
|
|
+ for ($ii=0; $ii<$tam; $ii++) {
|
|
|
+
|
|
|
+ }
|
|
|
+ $str_html .= "
|
|
|
+ </body>\n</html>";
|
|
|
+ return $str_html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
function export_package_answer () {
|
|
@@ -879,6 +894,7 @@ class iassign {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
function add_edit_iassign () {
|
|
|
global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
|
require_once('iassign_form.php');
|
|
@@ -931,11 +947,12 @@ class iassign {
|
|
|
$param->iassign_list = array();
|
|
|
if ($iassign_statement) {
|
|
|
foreach ($iassign_statement as $iassign) {
|
|
|
- $param->iassign_list[$iassign->id] = 0;
|
|
|
- $COURSE->iassign_list[$iassign->id] = new stdClass();
|
|
|
- $COURSE->iassign_list[$iassign->id]->id = $iassign->id;
|
|
|
- $COURSE->iassign_list[$iassign->id]->name = $iassign->name;
|
|
|
- $COURSE->iassign_list[$iassign->id]->enable = 1;
|
|
|
+ $iassignid = $iassign->id;
|
|
|
+ $param->iassign_list[$iassignid] = 0;
|
|
|
+ $COURSE->iassign_list[$iassignid] = new stdClass();
|
|
|
+ $COURSE->iassign_list[$iassignid]->id = $iassignid;
|
|
|
+ $COURSE->iassign_list[$iassignid]->name = $iassign->name;
|
|
|
+ $COURSE->iassign_list[$iassignid]->enable = 1;
|
|
|
}
|
|
|
}
|
|
|
$param->iassign_ilmid = 0;
|
|
@@ -1010,32 +1027,34 @@ class iassign {
|
|
|
$total_of_activities = count($all_others_iassign_statement) + 1;
|
|
|
|
|
|
$inter = array();
|
|
|
- if ($all_others_iassign_statement)
|
|
|
+ if ($all_others_iassign_statement) {
|
|
|
foreach ($all_others_iassign_statement as $iassign)
|
|
|
if (in_array($iassign->id, $dependency))
|
|
|
$inter[] = $iassign->id;
|
|
|
+ }
|
|
|
|
|
|
if ($all_others_iassign_statement) {
|
|
|
foreach ($all_others_iassign_statement as $iassign) {
|
|
|
- $COURSE->iassign_list[$iassign->id] = new stdClass();
|
|
|
- $COURSE->iassign_list[$iassign->id]->name = $iassign->name;
|
|
|
- $COURSE->iassign_list[$iassign->id]->id = $iassign->id;
|
|
|
+ $iassignid = $iassign->id;
|
|
|
+ $COURSE->iassign_list[$iassignid] = new stdClass();
|
|
|
+ $COURSE->iassign_list[$iassignid]->name = $iassign->name;
|
|
|
+ $COURSE->iassign_list[$iassignid]->id = $iassignid;
|
|
|
|
|
|
- if (in_array($iassign->id, $dependency))
|
|
|
- $param->iassign_list[$iassign->id] = 1;
|
|
|
+ if (in_array($iassignid, $dependency))
|
|
|
+ $param->iassign_list[$iassignid] = 1;
|
|
|
else
|
|
|
- $param->iassign_list[$iassign->id] = 0;
|
|
|
+ $param->iassign_list[$iassignid] = 0;
|
|
|
|
|
|
- if (in_array($iassign->id, $array_dependency))
|
|
|
- $COURSE->iassign_list[$iassign->id]->enable = 0;
|
|
|
+ if (in_array($iassignid, $array_dependency))
|
|
|
+ $COURSE->iassign_list[$iassignid]->enable = 0;
|
|
|
else
|
|
|
- $COURSE->iassign_list[$iassign->id]->enable = 1;
|
|
|
+ $COURSE->iassign_list[$iassignid]->enable = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$param->iassign_ilmid = $iassign_statement_current->iassign_ilmid;
|
|
|
$param->fileold = 0;
|
|
|
- $param->file = 0;
|
|
|
+ $param->file = 0;
|
|
|
$param->filename = '';
|
|
|
$param->grade = $iassign_statement_current->grade;
|
|
|
$param->timecreated = $iassign_statement_current->timecreated;
|
|
@@ -1049,7 +1068,8 @@ class iassign {
|
|
|
$param->max_experiment = $iassign_statement_current->max_experiment;
|
|
|
$param->automatic_evaluate = $iassign_statement_current->automatic_evaluate;
|
|
|
$param->show_answer = $iassign_statement_current->show_answer;
|
|
|
- $fs = get_file_storage();
|
|
|
+
|
|
|
+ $fs = get_file_storage();
|
|
|
|
|
|
$files = $fs->get_area_files($context->id, $component, $filearea, $iassign_statement_current->file);
|
|
|
if ($files) {
|
|
@@ -1634,7 +1654,8 @@ class iassign {
|
|
|
}
|
|
|
|
|
|
print $OUTPUT->box('<p><strong>' . $last_iassign . '</strong></p>' . "\n");
|
|
|
- if (!$enderecoPOST) $enderecoPOST = "";
|
|
|
+
|
|
|
+ if (!$enderecoPOST) $enderecoPOST = "";
|
|
|
|
|
|
print $OUTPUT->box($ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity));
|
|
|
|
|
@@ -1988,6 +2009,7 @@ class iassign {
|
|
|
die();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
function export_csv () {
|
|
|
global $USER, $CFG, $DB, $OUTPUT;
|
|
@@ -2000,15 +2022,13 @@ class iassign {
|
|
|
$c = 1;
|
|
|
foreach ($iassign_list as $iassign) {
|
|
|
$fields .= ", activity_id_$c, activity_name_$c, total_submissions_activity_$c, grade_activity_$c"
|
|
|
- . ", status_activity_$c, ilm_id_activity_$c, ilm_name_activity_$c";
|
|
|
+ . ", status_activity_$c, ilm_id_activity_$c, ilm_name_activity_$c";
|
|
|
$c ++;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
$params = array('shortname' => 'student');
|
|
|
- $role = $DB->get_record_sql(
|
|
|
- "SELECT s.id, s.shortname FROM {role} s " .
|
|
|
- " WHERE s.shortname = :shortname", $params);
|
|
|
+ $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params);
|
|
|
$context = context_course::instance($this->course->id);
|
|
|
$params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
$students = $DB->get_records_sql(
|
|
@@ -2040,23 +2060,24 @@ class iassign {
|
|
|
case 0:
|
|
|
$str .= '"not_post",';
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
$str .= $iassign->iassign_ilmid . ',';
|
|
|
|
|
|
$ilm_activity = $DB->get_record("iassign_ilm", array('id' => $iassign->iassign_ilmid));
|
|
|
$str .= '"' . $ilm_activity->name . '"';
|
|
|
- }
|
|
|
+ }
|
|
|
$str .= "\n";
|
|
|
- }
|
|
|
+ }
|
|
|
$str = $fields . "\n" . $str;
|
|
|
header("Content-disposition: attachment; filename=report.csv");
|
|
|
header("Pragma: no-cache");
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
|
|
|
header('Content-Length: ' . strlen($str));
|
|
|
header('Connection: close');
|
|
|
- echo $str;
|
|
|
+ print $str;
|
|
|
flush();
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
function report () {
|
|
@@ -2247,12 +2268,11 @@ class iassign {
|
|
|
else
|
|
|
print '<td> <a href="' . $url . '" ' . $last_solution_submission . '>' . $feedback . '</a> </td>' . "\n";
|
|
|
print '<td> </td>';
|
|
|
- print '</tr>';
|
|
|
+ print '</tr>' . "\n";
|
|
|
if ($sum_comment > 0 && $sum_verify_message > 0)
|
|
|
print '<tr><td colspan="2"> <a href="' . $url . '"> ' . $comment . '</a> (' . $sum_verify_message . '/' . $sum_comment . ') </td></tr>' . "\n";
|
|
|
else if ($sum_comment > 0)
|
|
|
print '<tr><td colspan="2"> <a href="' . $url . '"> ' . $comment . '</a> (' . $sum_comment . ') </td></tr>' . "\n";
|
|
|
-
|
|
|
print '</table>' . "\n";
|
|
|
}
|
|
|
|
|
@@ -3417,10 +3437,6 @@ class iassign {
|
|
|
if ($receiver == 2)
|
|
|
$newentry->teacher = $USER->id;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if (!$newentry->id = $DB->insert_record("iassign_submission", $newentry))
|
|
|
return_home_course('error_insert_submissions');
|
|
|
else {
|
|
@@ -3593,7 +3609,9 @@ class activity {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
function new_iassign ($param) {
|
|
|
global $DB;
|
|
|
|
|
@@ -3617,7 +3635,11 @@ class activity {
|
|
|
$newentry->author_name = $param->author_name;
|
|
|
$newentry->author_modified_name = $param->author_modified_name;
|
|
|
$newentry->iassign_ilmid = $param->iassign_ilmid;
|
|
|
- $newentry->file = $param->file;
|
|
|
+
|
|
|
+ $newentry->file = $param->file;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$newentry->grade = $param->grade;
|
|
|
$newentry->timemodified = time();
|
|
|
$newentry->timecreated = time();
|
|
@@ -3644,12 +3666,21 @@ class activity {
|
|
|
if ($id) {
|
|
|
$component = 'mod_iassign';
|
|
|
$filearea = 'exercise';
|
|
|
- $fs = get_file_storage();
|
|
|
+
|
|
|
+ $fs = get_file_storage();
|
|
|
$file = $fs->get_file_by_id($param->file);
|
|
|
- $itemid = $file->get_itemid() + $id;
|
|
|
+
|
|
|
+ $itemid = $file->get_itemid() + $id;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$newfile = $fs->create_file_from_storedfile(array('contextid' => $param->context->id, 'component' => $component, 'filearea' => $filearea, 'itemid' => $itemid), $file);
|
|
|
+
|
|
|
$updateentry = new stdClass();
|
|
|
$updateentry->id = $id;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$updateentry->file = $newfile->get_itemid();
|
|
|
if (!$DB->update_record("iassign_statement", $updateentry))
|
|
|
print_error('error_add', 'iassign');
|
|
@@ -3767,7 +3798,7 @@ class activity {
|
|
|
|
|
|
$component = 'mod_iassign';
|
|
|
$filearea = 'exercise';
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$file = $fs->get_file_by_id($param->file);
|
|
|
$fileold = $fs->get_file_by_id($param->fileold);
|
|
|
|
|
@@ -3782,7 +3813,9 @@ class activity {
|
|
|
|
|
|
if (!$fs->file_exists($param->context->id, $component, $filearea, $file->get_itemid(), $file->get_filepath(), $file->get_filename())) {
|
|
|
$itemid = $file->get_itemid() + $param->iassign_id;
|
|
|
+
|
|
|
$newfile = $fs->create_file_from_storedfile(array('contextid' => $param->context->id, 'component' => $component, 'filearea' => $filearea, 'itemid' => $itemid), $file);
|
|
|
+
|
|
|
$param->file = $newfile->get_itemid();
|
|
|
} else
|
|
|
$param->file = $file->get_itemid();
|
|
@@ -3806,7 +3839,8 @@ class activity {
|
|
|
|
|
|
$newentry->iassign_ilmid = $param->iassign_ilmid;
|
|
|
|
|
|
- $newentry->file = $param->file;
|
|
|
+ $newentry->file = $param->file;
|
|
|
+
|
|
|
$newentry->grade = $param->grade;
|
|
|
$newentry->author_modified_name = $param->author_modified_name;
|
|
|
|
|
@@ -4045,7 +4079,7 @@ class ilm {
|
|
|
|
|
|
class ilm_settings {
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -4068,7 +4102,7 @@ class ilm_settings {
|
|
|
|
|
|
static function applet_filetime ($file_jar) {
|
|
|
$filetime = "";
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$files_jar = explode(",", $file_jar);
|
|
|
foreach ($files_jar as $one_file) {
|
|
|
$file = $fs->get_file_by_id($one_file);
|
|
@@ -4084,7 +4118,7 @@ class ilm_settings {
|
|
|
|
|
|
static function applet_default ($file_jar) {
|
|
|
$is_default = true;
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$files_jar = explode(",", $file_jar);
|
|
|
foreach ($files_jar as $one_file) {
|
|
|
$file = $fs->get_file_by_id($one_file);
|
|
@@ -4247,7 +4281,7 @@ class ilm_settings {
|
|
|
|
|
|
$return = null;
|
|
|
$file_jar = array();
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
$contextsystem = context_system::instance();
|
|
|
$files_ilm = $fs->get_area_files($contextuser->id, 'user', 'draft', $itemid);
|
|
@@ -4255,17 +4289,17 @@ class ilm_settings {
|
|
|
if ($files_ilm) {
|
|
|
|
|
|
foreach ($files_ilm as $value) {
|
|
|
-
|
|
|
+
|
|
|
if ($iassign_ilm->type == 1) {
|
|
|
-
|
|
|
+
|
|
|
$ext = pathinfo($value->get_filename(), PATHINFO_EXTENSION);
|
|
|
-
|
|
|
+
|
|
|
if ((strtolower($ext) == 'zip')) {
|
|
|
-
|
|
|
+
|
|
|
$destination = 'ilm_debug/' . $value->get_filename();
|
|
|
$value->copy_content_to($destination);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
$zip = new ZipArchive();
|
|
|
$extracted = './ilm';
|
|
|
$dir = "";
|
|
@@ -4291,17 +4325,17 @@ class ilm_settings {
|
|
|
$zip->extractTo($extracted);
|
|
|
$zip->close();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
unlink($destination);
|
|
|
- } else {
|
|
|
-
|
|
|
+ } else {
|
|
|
+
|
|
|
unlink($destination);
|
|
|
print_error('error_add_ilm_zip', 'iassign');
|
|
|
}
|
|
|
|
|
|
return $dir;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
if ($value->get_filename() != '.') {
|
|
|
$file_ilm = array(
|
|
@@ -4326,7 +4360,8 @@ class ilm_settings {
|
|
|
$fs->delete_area_files($contextsystem->id, 'mod_iassign', 'ilm', $file->get_itemid());
|
|
|
}
|
|
|
}
|
|
|
- } else
|
|
|
+ }
|
|
|
+ else
|
|
|
$return = $iassign_ilm->file_jar;
|
|
|
|
|
|
$delete_file = $fs->delete_area_files($contextuser->id, 'user', 'draft', $itemid);
|
|
@@ -4349,7 +4384,7 @@ class ilm_settings {
|
|
|
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$zip = new zip_packer();
|
|
|
$files = $fs->get_directory_files($contextuser->id, 'user', 'draft', $itemid, '/');
|
|
|
foreach ($files as $file) {
|
|
@@ -4418,7 +4453,7 @@ class ilm_settings {
|
|
|
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$zip = new zip_packer();
|
|
|
$files = $fs->get_directory_files($contextuser->id, 'user', 'draft', $itemid, '/');
|
|
|
$files_extract = null;
|
|
@@ -4448,7 +4483,7 @@ class ilm_settings {
|
|
|
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$zip = new zip_packer();
|
|
|
$files = $fs->get_directory_files($contextuser->id, 'user', 'draft', $itemid, '/');
|
|
|
$files_extract = null;
|
|
@@ -4691,7 +4726,7 @@ class ilm_settings {
|
|
|
return "./" . $diretorio;
|
|
|
}
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$file_jar = array();
|
|
|
$files_ilm = explode(",", $application_xml->file_jar);
|
|
|
$contextsystem = context_system::instance();
|
|
@@ -4717,7 +4752,7 @@ class ilm_settings {
|
|
|
unlink($file);
|
|
|
}
|
|
|
return $file_jar;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -4734,7 +4769,7 @@ class ilm_settings {
|
|
|
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$zip = new zip_packer();
|
|
|
$files = $fs->get_directory_files($contextuser->id, 'user', 'draft', $itemid, '/');
|
|
|
foreach ($files as $file) {
|
|
@@ -4850,7 +4885,7 @@ class ilm_settings {
|
|
|
die;
|
|
|
}
|
|
|
$zip = new zip_packer();
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$contextuser = context_user::instance($USER->id);
|
|
|
$files_extract = $zip->extract_to_pathname($zip_filename, $CFG->dataroot . '/temp/');
|
|
|
|
|
@@ -5106,13 +5141,15 @@ class ilm_manager {
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
$fileid = optional_param('fileid', NULL, PARAM_INT);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$md_file = $fs->get_file_by_id($fileid);
|
|
|
$ilm_content_file = $md_file->get_content();
|
|
|
return $ilm_content_file;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
+
|
|
|
function ilm_editor_new () {
|
|
|
global $CFG, $DB, $OUTPUT, $PAGE;
|
|
|
|
|
@@ -5161,6 +5198,7 @@ class ilm_manager {
|
|
|
$_SESSION['file_name'] = $filename;
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
$this->write_file_iassign($stringArchiveContent, $filename);
|
|
|
|
|
@@ -5178,7 +5216,7 @@ class ilm_manager {
|
|
|
$str_submitbutton_name = "submit_iLM_Answer()";
|
|
|
}
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$files = $fs->get_area_files($context->id, 'mod_iassign', 'activity');
|
|
|
$files_array = '';
|
|
|
foreach ($files as $value) {
|
|
@@ -5207,16 +5245,8 @@ class ilm_manager {
|
|
|
docFormOnLineEditor.iLM_PARAM_ArchiveContent.value = resposta_exerc[0];
|
|
|
var files = new Array(" . $files_array . ");
|
|
|
var filename = docFormOnLineEditor.filename.value+'.'+'" . $extension . "';
|
|
|
-" .
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- "
|
|
|
if (docFormOnLineEditor.filename.value=='') {
|
|
|
-
|
|
|
+
|
|
|
alert('" . get_string('error_file_null_iassign', 'iassign') . "');
|
|
|
return false;
|
|
|
}
|
|
@@ -5294,7 +5324,7 @@ class ilm_manager {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -5389,6 +5419,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
function write_file_iassign ($stringArchiveContent, $filename) {
|
|
@@ -5396,7 +5427,7 @@ class ilm_manager {
|
|
|
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
$context = context_course::instance($this->id);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$dirid = $this->get_dir_ilm('dirid');
|
|
|
$dir = $fs->get_file_by_id($dirid);
|
|
|
|
|
@@ -5408,8 +5439,11 @@ class ilm_manager {
|
|
|
'userid' => $USER->id,
|
|
|
'author' => $USER->firstname . ' ' . $USER->lastname, 'license' => 'allrightsreserved',
|
|
|
'filename' => $filename);
|
|
|
+
|
|
|
|
|
|
+
|
|
|
$file_course = $fs->create_file_from_string($fileinfo, $stringArchiveContent);
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -5438,7 +5472,7 @@ class ilm_manager {
|
|
|
$dirid = $this->get_dir_ilm('dirid');
|
|
|
|
|
|
if ($stringArchiveContent != (-1)) {
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$file = $fs->get_file_by_id($fileid);
|
|
|
if (!$file) {
|
|
|
print $OUTPUT->notification(get_string('error_view_ilm', 'iassign'), 'notifyproblem');
|
|
@@ -5456,7 +5490,10 @@ class ilm_manager {
|
|
|
'timecreated' => $file->get_timecreated(),
|
|
|
'filename' => $file->get_filename());
|
|
|
$file->delete();
|
|
|
+
|
|
|
+
|
|
|
$file_course = $fs->create_file_from_string($fileinfo, $stringArchiveContent);
|
|
|
+
|
|
|
}
|
|
|
$output = "<script type='text/javascript'>
|
|
|
|
|
@@ -5478,7 +5515,7 @@ class ilm_manager {
|
|
|
function tag_ilm ($fileid) {
|
|
|
global $DB;
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$width = '600';
|
|
|
$height = '400';
|
|
|
$file = $fs->get_file_by_id($fileid);
|
|
@@ -5498,7 +5535,7 @@ class ilm_manager {
|
|
|
function delete_file_ilm () {
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$fileid = optional_param('fileid', NULL, PARAM_RAW);
|
|
|
$file = $fs->get_file_by_id($fileid);
|
|
|
if ($file)
|
|
@@ -5510,7 +5547,7 @@ class ilm_manager {
|
|
|
|
|
|
function delete_selected_ilm () {
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
|
$files_id = explode(",", optional_param('files_id', '', PARAM_TEXT));
|
|
|
$dirid = $this->get_dir_ilm('dirid');
|
|
@@ -5538,7 +5575,7 @@ class ilm_manager {
|
|
|
global $USER, $COURSE;
|
|
|
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$fileid = optional_param('fileid', NULL, PARAM_INT);
|
|
|
$filename = optional_param('filename', NULL, PARAM_RAW);
|
|
|
|
|
@@ -5565,7 +5602,7 @@ class ilm_manager {
|
|
|
|
|
|
function rename_file_ilm () {
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$fileid = optional_param('fileid', NULL, PARAM_INT);
|
|
|
$filename = optional_param('filename', NULL, PARAM_TEXT);
|
|
|
|
|
@@ -5699,7 +5736,7 @@ class ilm_manager {
|
|
|
$zip_filename = $CFG->dataroot . '/temp/backup-iassign-files-' . date("Ymd-Hi") . '.zip';
|
|
|
$zip = new zip_archive();
|
|
|
$zip->open($zip_filename);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
foreach ($files_id as $file_id) {
|
|
|
$file = $fs->get_file_by_id($file_id);
|
|
|
if (!$file->is_directory())
|
|
@@ -5812,7 +5849,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
function get_dir_ilm ($key) {
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
|
$dirid = optional_param('dirid', 0, PARAM_INT);
|
|
|
$dir_home = $fs->get_file($context->id, 'mod_iassign', 'activity', 0, $dir_base = '/', '.');
|
|
@@ -5839,7 +5876,7 @@ class ilm_manager {
|
|
|
$dir_base = $this->get_dir_ilm('dir_base');
|
|
|
|
|
|
$context = context_course::instance($this->id);
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
|
|
|
$fs->create_directory($context->id, 'mod_iassign', 'activity', 0, $dir_base . $dirname . "/", $USER->id);
|
|
|
$dir_base = $fs->get_file($context->id, 'mod_iassign', 'activity', 0, $dir_base . $dirname . "/", '.');
|
|
@@ -5851,7 +5888,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
function delete_dir_ilm () {
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
$context = context_course::instance($this->id);
|
|
|
$dir = $fs->get_file_by_id($this->get_dir_ilm('dirid'));
|
|
@@ -5871,7 +5908,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
function rename_dir_ilm () {
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
$context = context_course::instance($this->id);
|
|
|
$dir = $fs->get_file_by_id($this->get_dir_ilm('dirid'));
|
|
@@ -5894,7 +5931,7 @@ class ilm_manager {
|
|
|
|
|
|
function selected_move_ilm () {
|
|
|
global $PAGE, $OUTPUT, $CFG;
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
|
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
@@ -5987,7 +6024,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
function move_files_ilm () {
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
|
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
@@ -6026,7 +6063,7 @@ class ilm_manager {
|
|
|
function recover_files_ilm () {
|
|
|
global $DB, $USER;
|
|
|
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$courseid = optional_param('id', NULL, PARAM_INT);
|
|
|
$dirid = $this->get_dir_ilm('dirid');
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
@@ -6053,7 +6090,9 @@ class ilm_manager {
|
|
|
'license' => 'allrightsreserved',
|
|
|
'timecreated' => time(),
|
|
|
'filename' => $iassign_statement_activity_item->name . "." . $extension[1]);
|
|
|
+
|
|
|
$newfile = $fs->create_file_from_string($fileinfo, $value->get_content());
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -6064,11 +6103,42 @@ class ilm_manager {
|
|
|
die();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function get_files_in_context (&$allfiles, $contextid, $extension, $userid) {
|
|
|
+
|
|
|
+
|
|
|
+ $fs = get_file_storage();
|
|
|
+ $dir_base = $this->get_dir_ilm('dir_base');
|
|
|
+ $files_course = $fs->get_directory_files($contextid, 'mod_iassign', 'activity', 0, $dir_base, false, true, 'filename');
|
|
|
+ $countf = 0;
|
|
|
+ $array_files_id = array();
|
|
|
+ foreach ($files_course as $item_fc) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $itemid = $item_fc->get_id();
|
|
|
+ if (!in_array($itemid, $array_files_id)) {
|
|
|
+
|
|
|
+ $allfiles[] = $item_fc;
|
|
|
+ $array_files_id[] = $itemid;
|
|
|
+ $countf++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $countf;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
function view_files_ilm ($iassign_ilm_class, $extension) {
|
|
|
global $CFG, $DB, $USER, $OUTPUT;
|
|
|
- $fs = get_file_storage();
|
|
|
+ $fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
|
$ilmid = optional_param('ilmid', NULL, PARAM_INT);
|
|
|
$dirid = $this->get_dir_ilm('dirid');
|
|
@@ -6144,7 +6214,7 @@ class ilm_manager {
|
|
|
$dirs_array .= "''";
|
|
|
$error_dir_exists = get_string('error_dir_exists', 'iassign');
|
|
|
|
|
|
-
|
|
|
+
|
|
|
$code_javascript_ilm = "
|
|
|
<script type='text/javascript'>
|
|
|
|
|
@@ -6352,13 +6422,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
$one_file = $array_all_files[$ii];
|
|
|
-------
|
|
|
-
|
|
|
- for ($ii=$count_all_files-1; $ii>0; $ii--) {
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- $one_file = $array_all_files[$ii];
|
|
|
|
|
|
$filename = $one_file->get_filename();
|
|
|
$filepath = $one_file->get_filepath();
|
|
@@ -6832,4 +6896,4 @@ class iassign_log {
|
|
|
print_error('error_add_log', 'iassign');
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }
|