|
@@ -406,12 +406,12 @@ class iassign {
|
|
$ilm_list = $DB->get_records("iassign_ilm");
|
|
$ilm_list = $DB->get_records("iassign_ilm");
|
|
|
|
|
|
// Get list of enrolled students:
|
|
// Get list of enrolled students:
|
|
- $params = array('shortname' => 'student');
|
|
|
|
- $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
|
|
+ $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params_temp);
|
|
$context = context_course::instance($this->course->id);
|
|
$context = context_course::instance($this->course->id);
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students_list = $DB->get_records_sql(
|
|
$students_list = $DB->get_records_sql(
|
|
- "SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " . " WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " . " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ "SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " . " WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " . " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
$json_obj = new stdclass();
|
|
$json_obj = new stdclass();
|
|
$json_obj->submissions = [];
|
|
$json_obj->submissions = [];
|
|
@@ -449,7 +449,10 @@ class iassign {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- $diretorio = $CFG->dataroot . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR;
|
|
|
|
|
|
+ //2021 $diretorio = $CFG->dataroot . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR;
|
|
|
|
+ //TODO: tem que criar moodledata/temp/iassign_files
|
|
|
|
+ $diretorio = $CFG->dataroot . DIRECTORY_SEPARATOR . 'temp'
|
|
|
|
+ . DIRECTORY_SEPARATOR . 'iassign_files' . DIRECTORY_SEPARATOR;
|
|
|
|
|
|
$zip_filename = $diretorio . 'package_iassign_'.time().'.zip';
|
|
$zip_filename = $diretorio . 'package_iassign_'.time().'.zip';
|
|
|
|
|
|
@@ -482,7 +485,7 @@ class iassign {
|
|
$date = new DateTime();
|
|
$date = new DateTime();
|
|
$date->setTimestamp($item->timecreated);
|
|
$date->setTimestamp($item->timecreated);
|
|
|
|
|
|
- $new_file = $individual_dir . DIRECTORY_SEPARATOR . iassign_utils::format_filename('submission_' . ($i++) . '_' . date_format($date, 'Y-m-d_H-i-s') . '.' . $extension_ilm);
|
|
|
|
|
|
+ $new_file = $individual_dir . DIRECTORY_SEPARATOR . iassign_utils::format_filename('submission_' . ($i++) . '_' . date_format($date, 'Y-m-d_H-i-s')) . '.' . $extension_ilm;
|
|
|
|
|
|
$zip->add_file_from_string($new_file, $item->answer);
|
|
$zip->add_file_from_string($new_file, $item->answer);
|
|
|
|
|
|
@@ -605,8 +608,6 @@ class iassign {
|
|
|
|
|
|
$atual_submission = $DB->get_record('iassign_allsubmissions', array('id' => $submissionid));
|
|
$atual_submission = $DB->get_record('iassign_allsubmissions', array('id' => $submissionid));
|
|
|
|
|
|
- //print_r($atual_submission);
|
|
|
|
-
|
|
|
|
$all_submissions = $DB->get_records('iassign_allsubmissions',
|
|
$all_submissions = $DB->get_records('iassign_allsubmissions',
|
|
array('iassign_statementid' => $atual_submission->iassign_statementid, 'userid' => $atual_submission->userid));
|
|
array('iassign_statementid' => $atual_submission->iassign_statementid, 'userid' => $atual_submission->userid));
|
|
|
|
|
|
@@ -645,7 +646,9 @@ class iassign {
|
|
}
|
|
}
|
|
$statement = $DB->get_record('iassign_statement', array('id' => $atual_submission->iassign_statementid));
|
|
$statement = $DB->get_record('iassign_statement', array('id' => $atual_submission->iassign_statementid));
|
|
|
|
|
|
- print ilm_settings::build_ilm_tags($statement->iassign_ilmid, ['type' => "view", 'Proposition' => $url]);
|
|
|
|
|
|
+ print
|
|
|
|
+ //array("type" => "editor_new", "notSEND" => "true")
|
|
|
|
+ ilm_settings::build_ilm_tags($statement->iassign_ilmid, ['type' => "activity", 'Proposition' => $url, "notSEND" => "false"]);
|
|
print '</center>';
|
|
print '</center>';
|
|
}
|
|
}
|
|
|
|
|
|
@@ -727,12 +730,12 @@ class iassign {
|
|
print '<i onclick="download_submission(\'block\', 0, 0, '.$iassignid.')" class="fa fa-download" style="float: right; color: #1fa67a; font-size: 1.5rem; cursor: pointer; margin-left: 1rem; margin-top: .2rem;" aria-hidden="true"></i> </h2>';
|
|
print '<i onclick="download_submission(\'block\', 0, 0, '.$iassignid.')" class="fa fa-download" style="float: right; color: #1fa67a; font-size: 1.5rem; cursor: pointer; margin-left: 1rem; margin-top: .2rem;" aria-hidden="true"></i> </h2>';
|
|
|
|
|
|
// Get list of enrolled students:
|
|
// Get list of enrolled students:
|
|
- $params = array('shortname' => 'student');
|
|
|
|
- $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
|
|
+ $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params_temp);
|
|
$context = context_course::instance($this->course->id);
|
|
$context = context_course::instance($this->course->id);
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students_list = $DB->get_records_sql(
|
|
$students_list = $DB->get_records_sql(
|
|
- "SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " . " WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " . " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ "SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " . " WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " . " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
print '<div>';
|
|
print '<div>';
|
|
foreach ($exercises_list as $exercise) {
|
|
foreach ($exercises_list as $exercise) {
|
|
@@ -827,14 +830,14 @@ class iassign {
|
|
$exercises_list = $DB->get_records("iassign_statement", array("iassignid" => $iassignid));
|
|
$exercises_list = $DB->get_records("iassign_statement", array("iassignid" => $iassignid));
|
|
|
|
|
|
// Get list of enrolled students:
|
|
// Get list of enrolled students:
|
|
- $params = array('shortname' => 'student');
|
|
|
|
- $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
|
|
+ $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params_temp);
|
|
$context = context_course::instance($this->course->id);
|
|
$context = context_course::instance($this->course->id);
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students_list = $DB->get_records_sql(
|
|
$students_list = $DB->get_records_sql(
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
- " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
print $OUTPUT->header();
|
|
print $OUTPUT->header();
|
|
|
|
|
|
@@ -890,10 +893,10 @@ class iassign {
|
|
"ilm": "' . $CFG->wwwroot . '/mod/iassign/' . $iassign_ilm->file_jar . $iassign_ilm->file_class . '",
|
|
"ilm": "' . $CFG->wwwroot . '/mod/iassign/' . $iassign_ilm->file_jar . $iassign_ilm->file_class . '",
|
|
"submited": ['; // "
|
|
"submited": ['; // "
|
|
|
|
|
|
- $params = array('iassign_statementid' => $exercise->id);
|
|
|
|
|
|
+ $params_temp = array('iassign_statementid' => $exercise->id);
|
|
$submited = $DB->get_records_sql( // Get userid and his grade
|
|
$submited = $DB->get_records_sql( // Get userid and his grade
|
|
"SELECT s.userid, s.grade FROM {iassign_submission} s " .
|
|
"SELECT s.userid, s.grade FROM {iassign_submission} s " .
|
|
- " WHERE s.iassign_statementid = :iassign_statementid", $params);
|
|
|
|
|
|
+ " WHERE s.iassign_statementid = :iassign_statementid", $params_temp);
|
|
|
|
|
|
foreach ($submited as $ss) {
|
|
foreach ($submited as $ss) {
|
|
print($ss->userid . ',');
|
|
print($ss->userid . ',');
|
|
@@ -1286,7 +1289,7 @@ var exercises = [ '; // '
|
|
|
|
|
|
print ' <tr data-student="' . $student->userid . '">
|
|
print ' <tr data-student="' . $student->userid . '">
|
|
<td>' . $OUTPUT->render($avatar) . ' <span class="student-name">' . $user->firstname . ' ' . $user->lastname . '</span></td>
|
|
<td>' . $OUTPUT->render($avatar) . ' <span class="student-name">' . $user->firstname . ' ' . $user->lastname . '</span></td>
|
|
- </tr>' . "\n";
|
|
|
|
|
|
+ </tr>' . "\n"; // "
|
|
}
|
|
}
|
|
|
|
|
|
print " </tbody>
|
|
print " </tbody>
|
|
@@ -1904,6 +1907,7 @@ var exercises = [ '; // '
|
|
|
|
|
|
|
|
|
|
/// Add or Edit interactive activities
|
|
/// Add or Edit interactive activities
|
|
|
|
+ // Get here when editing form and and submitted form data
|
|
// @calledby $this->action()
|
|
// @calledby $this->action()
|
|
function add_edit_iassign () {
|
|
function add_edit_iassign () {
|
|
global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
@@ -1915,13 +1919,13 @@ var exercises = [ '; // '
|
|
$param = new stdClass(); // parameters to build data to the form - see bellow "$mform = new mod_iassign_form(...); $mform->set_data($param);
|
|
$param = new stdClass(); // parameters to build data to the form - see bellow "$mform = new mod_iassign_form(...); $mform->set_data($param);
|
|
|
|
|
|
$param->action = $this->action; // hidden
|
|
$param->action = $this->action; // hidden
|
|
-
|
|
|
|
$param->id = $id; // hidden
|
|
$param->id = $id; // hidden
|
|
|
|
+
|
|
|
|
+$param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
|
+
|
|
$COURSE->cm = $id;
|
|
$COURSE->cm = $id;
|
|
$COURSE->iassignid = $iassignid;
|
|
$COURSE->iassignid = $iassignid;
|
|
$COURSE->iassign_file_id = NULL;
|
|
$COURSE->iassign_file_id = NULL;
|
|
-// echo "<br/><br/><br/>locallib.php: add_edit_iassign(): id=$id, iassignid=$iassignid, action=" . $this->action . "<br/>\n";
|
|
|
|
-// locallib.php: add_edit_iassign(): id=18612, iassignid=1355, action=edit
|
|
|
|
|
|
|
|
$context = context_module::instance($this->cm->id);
|
|
$context = context_module::instance($this->cm->id);
|
|
|
|
|
|
@@ -1940,10 +1944,10 @@ var exercises = [ '; // '
|
|
if ($this->action == 'add') {
|
|
if ($this->action == 'add') {
|
|
$iassign_data = $DB->get_record("iassign", array('id' => $iassignid));
|
|
$iassign_data = $DB->get_record("iassign", array('id' => $iassignid));
|
|
|
|
|
|
- $params = array('iassignid' => $iassignid);
|
|
|
|
|
|
+ $params_temp = array('iassignid' => $iassignid);
|
|
|
|
|
|
$query_str = "SELECT s.id, s.name, s.dependency FROM {iassign_statement} s WHERE s.iassignid = :iassignid ORDER BY s.position ASC";
|
|
$query_str = "SELECT s.id, s.name, s.dependency FROM {iassign_statement} s WHERE s.iassignid = :iassignid ORDER BY s.position ASC";
|
|
- $iassign_statement = $DB->get_records_sql($query_str, $params); //
|
|
|
|
|
|
+ $iassign_statement = $DB->get_records_sql($query_str, $params_temp); //
|
|
$total_of_activities = count($iassign_statement);
|
|
$total_of_activities = count($iassign_statement);
|
|
|
|
|
|
$param->iassignid = $iassignid;
|
|
$param->iassignid = $iassignid;
|
|
@@ -1992,8 +1996,7 @@ var exercises = [ '; // '
|
|
|
|
|
|
$this_activity = $this->activity->get_activity();
|
|
$this_activity = $this->activity->get_activity();
|
|
|
|
|
|
- if ($this_activity != null) {
|
|
|
|
- //2019 $iassign_statement_current = $DB->get_record("iassign_statement", array("id" => $this_activity->id));
|
|
|
|
|
|
+ if ($this_activity != null) { // first enter here: fill form data
|
|
$iassign_statement_current = $this_activity; // $DB->get_record("iassign_statement", array("id" => $this_activity->id));
|
|
$iassign_statement_current = $this_activity; // $DB->get_record("iassign_statement", array("id" => $this_activity->id));
|
|
|
|
|
|
$param->iassign_id = $iassign_statement_current->id; // oculto
|
|
$param->iassign_id = $iassign_statement_current->id; // oculto
|
|
@@ -2003,8 +2006,6 @@ var exercises = [ '; // '
|
|
$param->type_iassign = $iassign_statement_current->type_iassign;
|
|
$param->type_iassign = $iassign_statement_current->type_iassign;
|
|
$param->store_all_submissions = $iassign_statement_current->store_all_submissions;
|
|
$param->store_all_submissions = $iassign_statement_current->store_all_submissions;
|
|
|
|
|
|
- //2019: Moodle 3 uses proposition in 'textarea' as "('text' => <text>, 'format' => '')
|
|
|
|
- //2019 $param->proposition = $iassign_statement_current->proposition;
|
|
|
|
$param->proposition = array('text' => $iassign_statement_current->proposition, ''); //'format' => $instance->introformat
|
|
$param->proposition = array('text' => $iassign_statement_current->proposition, ''); //'format' => $instance->introformat
|
|
|
|
|
|
$param->author_name = $iassign_statement_current->author_name; // oculto
|
|
$param->author_name = $iassign_statement_current->author_name; // oculto
|
|
@@ -2036,11 +2037,6 @@ var exercises = [ '; // '
|
|
// Get all activities in the same iAssigment block:
|
|
// Get all activities in the same iAssigment block:
|
|
$str_query = "SELECT id, name FROM {iassign_statement} WHERE iassignid = '" . $iassignid . "' AND id!='" . $iassign_statement_current->id . "' ORDER BY position ASC";
|
|
$str_query = "SELECT id, name FROM {iassign_statement} WHERE iassignid = '" . $iassignid . "' AND id!='" . $iassign_statement_current->id . "' ORDER BY position ASC";
|
|
$all_others_iassign_statement = $DB->get_records_sql($str_query);
|
|
$all_others_iassign_statement = $DB->get_records_sql($str_query);
|
|
-//echo "<br/><br/><br/>1. all_others_iassign_statement="; print_r($all_others_iassign_statement); echo "<br/>";
|
|
|
|
-// [5426] => stdClass Object ( [id] => 5426 [name] => 1. iHanói: com 3 discos )
|
|
|
|
-// [5428] => stdClass Object ( [id] => 5428 [name] => 1. iFrações: trator 1, fase 1 )
|
|
|
|
-// [5427] => stdClass Object ( [id] => 5427 [name] => 1. iFrações: trator 1, fase 2 )
|
|
|
|
-// [5429] => stdClass Object ( [id] => 5429 [name] => 1. iVProg. Ler e imprimir inteiro. ) )
|
|
|
|
|
|
|
|
$total_of_activities = count($all_others_iassign_statement) + 1;
|
|
$total_of_activities = count($all_others_iassign_statement) + 1;
|
|
|
|
|
|
@@ -2068,7 +2064,7 @@ var exercises = [ '; // '
|
|
else
|
|
else
|
|
$COURSE->iassign_list[$iassignid]->enable = 1;
|
|
$COURSE->iassign_list[$iassignid]->enable = 1;
|
|
} // foreach ($all_others_iassign_statement as $iassign)
|
|
} // foreach ($all_others_iassign_statement as $iassign)
|
|
- }
|
|
|
|
|
|
+ } // if ($all_others_iassign_statement)
|
|
|
|
|
|
$param->iassign_ilmid = $iassign_statement_current->iassign_ilmid; // define iLM ID to be used to define 'select' on 'iassign_form.php'
|
|
$param->iassign_ilmid = $iassign_statement_current->iassign_ilmid; // define iLM ID to be used to define 'select' on 'iassign_form.php'
|
|
|
|
|
|
@@ -2077,13 +2073,13 @@ var exercises = [ '; // '
|
|
$param->file = 0; //TODO Criar campo 'iassign_statement.filesid' para registar 'files.id' - abaixo faz '$file->get_id();'
|
|
$param->file = 0; //TODO Criar campo 'iassign_statement.filesid' para registar 'files.id' - abaixo faz '$file->get_id();'
|
|
$param->filename = '';
|
|
$param->filename = '';
|
|
$param->grade = $iassign_statement_current->grade;
|
|
$param->grade = $iassign_statement_current->grade;
|
|
- $param->timecreated = $iassign_statement_current->timecreated; // oculto
|
|
|
|
|
|
+ $param->timecreated = $iassign_statement_current->timecreated; // hidden
|
|
$param->timeavailable = $iassign_statement_current->timeavailable;
|
|
$param->timeavailable = $iassign_statement_current->timeavailable;
|
|
$param->timedue = $iassign_statement_current->timedue;
|
|
$param->timedue = $iassign_statement_current->timedue;
|
|
$param->preventlate = $iassign_statement_current->preventlate;
|
|
$param->preventlate = $iassign_statement_current->preventlate;
|
|
$param->test = $iassign_statement_current->test;
|
|
$param->test = $iassign_statement_current->test;
|
|
- $param->special_param1 = $iassign_statement_current->special_param1;
|
|
|
|
- $param->position = $iassign_statement_current->position; // oculto
|
|
|
|
|
|
+ $param->special_param1 = $iassign_statement_current->special_param1; // 'special_param1 == 1' => script of iGeom
|
|
|
|
+ $param->position = $iassign_statement_current->position; // hidden
|
|
$param->visible = $iassign_statement_current->visible;
|
|
$param->visible = $iassign_statement_current->visible;
|
|
$param->max_experiment = $iassign_statement_current->max_experiment;
|
|
$param->max_experiment = $iassign_statement_current->max_experiment;
|
|
$param->automatic_evaluate = $iassign_statement_current->automatic_evaluate;
|
|
$param->automatic_evaluate = $iassign_statement_current->automatic_evaluate;
|
|
@@ -2124,10 +2120,19 @@ var exercises = [ '; // '
|
|
$param->position = $total_of_activities;
|
|
$param->position = $total_of_activities;
|
|
|
|
|
|
// Create form and associate its data
|
|
// Create form and associate its data
|
|
- // $mform = new mod_iassign_form(null, null, null, null, array('id'=>'mform1')); // ./mod/iassign/iassign_form.php
|
|
|
|
-
|
|
|
|
- $mform = new mod_iassign_form(null, null, null, null, array('id'=>'mform1'));
|
|
|
|
- $mform->set_data($param);
|
|
|
|
|
|
+ // 'mform1' is used in: ./mod/iassign/iassign_form.php, ./mod/iassign/settings_form.php
|
|
|
|
+ // new mod_iassign_form(...) in ./mod/iassign/iassign_form.php extends /lib/formslib.php:
|
|
|
|
+ // /lib/formslib.php: __construct($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true, $ajaxformdata=null)
|
|
|
|
+ if (isset($param->iassign_ilmid)) {
|
|
|
|
+ // array is additional atributes to 'form'
|
|
|
|
+ // 'special_param1 == 1' => script of iGeom : <select class="custom-select" name="special_param1" id="id_special_param1"> "Assignment with script(algorithm)? (Applicable only to iGeom iLM)"
|
|
|
|
+ $mform = new mod_iassign_form(null, array('special_param1'=>$param->special_param1), 'post', null, array('id'=>'mform1', 'iassign_ilmid'=>$param->iassign_ilmid), true, null);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $mform = new mod_iassign_form(null, null, null, null, array('id'=>'mform1')); // ./mod/iassign/iassign_form.php
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $mform->set_data($param); // define data in the form
|
|
|
|
|
|
if ($mform->is_cancelled()) {
|
|
if ($mform->is_cancelled()) {
|
|
$this->return_home_course('iassign_cancel');
|
|
$this->return_home_course('iassign_cancel');
|
|
@@ -2290,19 +2295,19 @@ var exercises = [ '; // '
|
|
|
|
|
|
$grade_iassign = $DB->get_record("iassign", array("id" => $iassignid));
|
|
$grade_iassign = $DB->get_record("iassign", array("id" => $iassignid));
|
|
$grades = NULL;
|
|
$grades = NULL;
|
|
- $params = array('itemname' => $grade_iassign->name);
|
|
|
|
- $params['iteminstance'] = $iassignid;
|
|
|
|
- $params['gradetype'] = GRADE_TYPE_VALUE;
|
|
|
|
|
|
+ $params_temp = array('itemname' => $grade_iassign->name);
|
|
|
|
+ $params_temp['iteminstance'] = $iassignid;
|
|
|
|
+ $params_temp['gradetype'] = GRADE_TYPE_VALUE;
|
|
//2016 if ($sum_grade != 0) {
|
|
//2016 if ($sum_grade != 0) {
|
|
- $params['grademax'] = $sum_grade;
|
|
|
|
- $params['rawgrademax'] = $sum_grade;
|
|
|
|
- //2016 } else { $params['grademax'] = 0; $params['rawgrademax'] = 0; }
|
|
|
|
- $params['grademin'] = 0;
|
|
|
|
|
|
+ $params_temp['grademax'] = $sum_grade;
|
|
|
|
+ $params_temp['rawgrademax'] = $sum_grade;
|
|
|
|
+ //2016 } else { $params_temp['grademax'] = 0; $params_temp['rawgrademax'] = 0; }
|
|
|
|
+ $params_temp['grademin'] = 0;
|
|
// @calls /lib/gradelib.php: call to grade_item->insert()
|
|
// @calls /lib/gradelib.php: call to grade_item->insert()
|
|
//TODO: is there any error here in Moodle version 3.0?
|
|
//TODO: is there any error here in Moodle version 3.0?
|
|
//TODO: Incorrect property 'grademax' found when inserting grade object
|
|
//TODO: Incorrect property 'grademax' found when inserting grade object
|
|
//TODO: line 899 of /mod/iassign/locallib.php: call to grade_update()
|
|
//TODO: line 899 of /mod/iassign/locallib.php: call to grade_update()
|
|
- grade_update('mod/iassign', $grade_iassign->course, 'mod', 'iassign', $iassignid, 0, $grades, $params);
|
|
|
|
|
|
+ grade_update('mod/iassign', $grade_iassign->course, 'mod', 'iassign', $iassignid, 0, $grades, $params_temp);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2333,15 +2338,15 @@ var exercises = [ '; // '
|
|
|
|
|
|
$grades['userid'] = $userid;
|
|
$grades['userid'] = $userid;
|
|
$grades['rawgrade'] = $total_grade; // sum of all submissions for this iAssign activity
|
|
$grades['rawgrade'] = $total_grade; // sum of all submissions for this iAssign activity
|
|
- $params = array('itemname' => $grade_iassign->name);
|
|
|
|
- $params['iteminstance'] = $iassignid;
|
|
|
|
- $params['gradetype'] = GRADE_TYPE_VALUE;
|
|
|
|
|
|
+ $params_temp = array('itemname' => $grade_iassign->name);
|
|
|
|
+ $params_temp['iteminstance'] = $iassignid;
|
|
|
|
+ $params_temp['gradetype'] = GRADE_TYPE_VALUE;
|
|
|
|
|
|
//2016 if ($sum_grade != 0) { // depois eliminar comentario
|
|
//2016 if ($sum_grade != 0) { // depois eliminar comentario
|
|
- $params['grademax'] = $sum_grade;
|
|
|
|
- $params['rawgrademax'] = $sum_grade;
|
|
|
|
- //2016 } else { $params['grademax'] = 0; $params['rawgrademax'] = 0; }
|
|
|
|
- grade_update('mod/iassign', $grade_iassign->course, 'mod', 'iassign', $iassignid, 0, $grades, $params);
|
|
|
|
|
|
+ $params_temp['grademax'] = $sum_grade;
|
|
|
|
+ $params_temp['rawgrademax'] = $sum_grade;
|
|
|
|
+ //2016 } else { $params_temp['grademax'] = 0; $params_temp['rawgrademax'] = 0; }
|
|
|
|
+ grade_update('mod/iassign', $grade_iassign->course, 'mod', 'iassign', $iassignid, 0, $grades, $params_temp);
|
|
}
|
|
}
|
|
|
|
|
|
/// Display caption of icons
|
|
/// Display caption of icons
|
|
@@ -3116,14 +3121,14 @@ var exercises = [ '; // '
|
|
}
|
|
}
|
|
|
|
|
|
// Finding enrolled students:
|
|
// Finding enrolled students:
|
|
- $params = array('shortname' => 'student');
|
|
|
|
- $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
|
|
+ $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {role} s WHERE s.shortname = :shortname", $params_temp);
|
|
$context = context_course::instance($this->course->id);
|
|
$context = context_course::instance($this->course->id);
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students = $DB->get_records_sql(
|
|
$students = $DB->get_records_sql(
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
- " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
foreach ($students as $student) {
|
|
foreach ($students as $student) {
|
|
$str .= $student->userid . ',';
|
|
$str .= $student->userid . ',';
|
|
@@ -3233,17 +3238,17 @@ var exercises = [ '; // '
|
|
if ($num_exerc > 1) {
|
|
if ($num_exerc > 1) {
|
|
|
|
|
|
// $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {$CFG->prefix}role s WHERE s.shortname = 'student'");
|
|
// $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {$CFG->prefix}role s WHERE s.shortname = 'student'");
|
|
- $params = array('shortname' => 'student');
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
$role = $DB->get_record_sql(
|
|
$role = $DB->get_record_sql(
|
|
"SELECT s.id, s.shortname FROM {role} s " .
|
|
"SELECT s.id, s.shortname FROM {role} s " .
|
|
- " WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ " WHERE s.shortname = :shortname", $params_temp);
|
|
|
|
|
|
// $students = $DB->get_records_sql("SELECT s.userid, a.firstname, a.lastname FROM {$CFG->prefix}role_assignments s, {$CFG->prefix}user a WHERE s.contextid = '$context->id' AND s.userid = a.id AND s.roleid = '$role->id' ORDER BY a.firstname ASC,a.lastname ASC");
|
|
// $students = $DB->get_records_sql("SELECT s.userid, a.firstname, a.lastname FROM {$CFG->prefix}role_assignments s, {$CFG->prefix}user a WHERE s.contextid = '$context->id' AND s.userid = a.id AND s.roleid = '$role->id' ORDER BY a.firstname ASC,a.lastname ASC");
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students = $DB->get_records_sql(
|
|
$students = $DB->get_records_sql(
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
- " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
print '<tr><th class="header c1">' . get_string('students', 'iassign') . '</th>' . "\n";
|
|
print '<tr><th class="header c1">' . get_string('students', 'iassign') . '</th>' . "\n";
|
|
|
|
|
|
@@ -3292,10 +3297,10 @@ var exercises = [ '; // '
|
|
|
|
|
|
// Get student comments
|
|
// Get student comments
|
|
// $student_submissions_comment = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment WHERE iassign_submissionid = '$student_submissions->id'");
|
|
// $student_submissions_comment = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment WHERE iassign_submissionid = '$student_submissions->id'");
|
|
- $params = array('iassign_submissionid' => $student_submissions->id);
|
|
|
|
|
|
+ $params_temp = array('iassign_submissionid' => $student_submissions->id);
|
|
$student_submissions_comment = $DB->get_record_sql(
|
|
$student_submissions_comment = $DB->get_record_sql(
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
- "WHERE iassign_submissionid = :iassign_submissionid", $params);
|
|
|
|
|
|
+ "WHERE iassign_submissionid = :iassign_submissionid", $params_temp);
|
|
if ($student_submissions_comment) // student has comment
|
|
if ($student_submissions_comment) // student has comment
|
|
foreach ($student_submissions_comment as $tmp)
|
|
foreach ($student_submissions_comment as $tmp)
|
|
$sum_comment = $tmp;
|
|
$sum_comment = $tmp;
|
|
@@ -3325,12 +3330,12 @@ var exercises = [ '; // '
|
|
// $verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment " .
|
|
// $verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment " .
|
|
// "WHERE iassign_submissionid = '$student_submissions->id' AND return_status='0' AND receiver='1'");
|
|
// "WHERE iassign_submissionid = '$student_submissions->id' AND return_status='0' AND receiver='1'");
|
|
|
|
|
|
- $params = array('iassign_submissionid' => $student_submissions->id, 'return_status' => '0', 'receiver' => '1');
|
|
|
|
|
|
+ $params_temp = array('iassign_submissionid' => $student_submissions->id, 'return_status' => '0', 'receiver' => '1');
|
|
$verify_message = $DB->get_record_sql(
|
|
$verify_message = $DB->get_record_sql(
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
"WHERE iassign_submissionid = :iassign_submissionid " .
|
|
"WHERE iassign_submissionid = :iassign_submissionid " .
|
|
" AND return_status= :return_status " .
|
|
" AND return_status= :return_status " .
|
|
- " AND receiver= :receiver", $params);
|
|
|
|
|
|
+ " AND receiver= :receiver", $params_temp);
|
|
|
|
|
|
if ($verify_message)
|
|
if ($verify_message)
|
|
foreach ($verify_message as $tmp)
|
|
foreach ($verify_message as $tmp)
|
|
@@ -3517,18 +3522,18 @@ var exercises = [ '; // '
|
|
|
|
|
|
if ($i > 1) {
|
|
if ($i > 1) {
|
|
// $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {$CFG->prefix}role s WHERE s.shortname = 'student'");
|
|
// $role = $DB->get_record_sql("SELECT s.id, s.shortname FROM {$CFG->prefix}role s WHERE s.shortname = 'student'");
|
|
- $params = array('shortname' => 'student');
|
|
|
|
|
|
+ $params_temp = array('shortname' => 'student');
|
|
$role = $DB->get_record_sql(
|
|
$role = $DB->get_record_sql(
|
|
"SELECT s.id, s.shortname FROM {role} s " .
|
|
"SELECT s.id, s.shortname FROM {role} s " .
|
|
- " WHERE s.shortname = :shortname", $params);
|
|
|
|
|
|
+ " WHERE s.shortname = :shortname", $params_temp);
|
|
|
|
|
|
// $students = $DB->get_records_sql("SELECT s.userid, a.firstname, a.lastname FROM {$CFG->prefix}role_assignments s, {$CFG->prefix}user a WHERE s.contextid = '$context->id' AND s.userid = a.id AND s.roleid = '$role->id' ORDER BY a.firstname ASC,a.lastname ASC");
|
|
// $students = $DB->get_records_sql("SELECT s.userid, a.firstname, a.lastname FROM {$CFG->prefix}role_assignments s, {$CFG->prefix}user a WHERE s.contextid = '$context->id' AND s.userid = a.id AND s.roleid = '$role->id' ORDER BY a.firstname ASC,a.lastname ASC");
|
|
|
|
|
|
- $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
|
|
|
+ $params_temp = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
$students = $DB->get_records_sql(
|
|
$students = $DB->get_records_sql(
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
"SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
" WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
- " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
|
|
|
+ " ORDER BY a.firstname ASC,a.lastname ASC", $params_temp);
|
|
|
|
|
|
$total = 0;
|
|
$total = 0;
|
|
$sum_student = 0;
|
|
$sum_student = 0;
|
|
@@ -4226,9 +4231,9 @@ var exercises = [ '; // '
|
|
$sum_comment = 0;
|
|
$sum_comment = 0;
|
|
$iassign_submissions = $DB->get_records('iassign_submission', array('iassign_statementid' => $iassign_current));
|
|
$iassign_submissions = $DB->get_records('iassign_submission', array('iassign_statementid' => $iassign_current));
|
|
foreach ($iassign_submissions as $iassign_submission) {
|
|
foreach ($iassign_submissions as $iassign_submission) {
|
|
- $params = array('iassign_submissionid' => $iassign_submission->id, 'return_status' => '0', 'receiver' => '1');
|
|
|
|
|
|
+ $params_temp = array('iassign_submissionid' => $iassign_submission->id, 'return_status' => '0', 'receiver' => '1');
|
|
$verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
$verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
- " WHERE iassign_submissionid = :iassign_submissionid AND return_status= :return_status AND receiver= :receiver", $params);
|
|
|
|
|
|
+ " WHERE iassign_submissionid = :iassign_submissionid AND return_status= :return_status AND receiver= :receiver", $params_temp);
|
|
if ($verify_message)
|
|
if ($verify_message)
|
|
foreach ($verify_message as $tmp)
|
|
foreach ($verify_message as $tmp)
|
|
$sum_comment += $tmp;
|
|
$sum_comment += $tmp;
|
|
@@ -4314,10 +4319,10 @@ var exercises = [ '; // '
|
|
// receiver=2 - message to student
|
|
// receiver=2 - message to student
|
|
// $verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment WHERE iassign_submissionid = '$iassign_submission->id' and return_status= 0 and receiver=2");
|
|
// $verify_message = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment WHERE iassign_submissionid = '$iassign_submission->id' and return_status= 0 and receiver=2");
|
|
|
|
|
|
- $params = array('iassign_submissionid' => $iassign_submission->id, 'return_status' => '0', 'receiver' => '2');
|
|
|
|
|
|
+ $params_temp = array('iassign_submissionid' => $iassign_submission->id, 'return_status' => '0', 'receiver' => '2');
|
|
$verify_message = $DB->get_record_sql(
|
|
$verify_message = $DB->get_record_sql(
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
"SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
- " WHERE iassign_submissionid = :iassign_submissionid AND return_status= :return_status AND receiver= :receiver", $params);
|
|
|
|
|
|
+ " WHERE iassign_submissionid = :iassign_submissionid AND return_status= :return_status AND receiver= :receiver", $params_temp);
|
|
|
|
|
|
if ($verify_message)
|
|
if ($verify_message)
|
|
foreach ($verify_message as $tmp)
|
|
foreach ($verify_message as $tmp)
|
|
@@ -4505,23 +4510,23 @@ var exercises = [ '; // '
|
|
// verificar se existe uma submissão para o exercício e aluno informados
|
|
// verificar se existe uma submissão para o exercício e aluno informados
|
|
if (!$iassign_submission) {
|
|
if (!$iassign_submission) {
|
|
$iassign_submission = $DB->get_record("iassign_submission", array("iassign_statementid" => $this->activity->get_activity()->id, "userid" => $USER->id));
|
|
$iassign_submission = $DB->get_record("iassign_submission", array("iassign_statementid" => $this->activity->get_activity()->id, "userid" => $USER->id));
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
if (!$iassign_submission) {
|
|
if (!$iassign_submission) {
|
|
$iassign_statement_activity_item = $DB->get_record("iassign_statement", array("id" => $this->activity->get_activity()->id));
|
|
$iassign_statement_activity_item = $DB->get_record("iassign_statement", array("id" => $this->activity->get_activity()->id));
|
|
-
|
|
|
|
$id_submission = $this->new_submission($iassign_statement_activity_item->id, $this->userid_iassign, $receiver);
|
|
$id_submission = $this->new_submission($iassign_statement_activity_item->id, $this->userid_iassign, $receiver);
|
|
$this->iassign_submission_current = $id_submission;
|
|
$this->iassign_submission_current = $id_submission;
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
$id_submission = $iassign_submission->id;
|
|
$id_submission = $iassign_submission->id;
|
|
} // if (!$iassign_submission)
|
|
} // if (!$iassign_submission)
|
|
// $comments = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment
|
|
// $comments = $DB->get_record_sql("SELECT COUNT(iassign_submissionid) FROM {$CFG->prefix}ia_assign_submissions_comment
|
|
// WHERE iassign_submissionid = '$id_submission' and comment='$submission_comment' and comment_authorid='$USER->id'"); //
|
|
// WHERE iassign_submissionid = '$id_submission' and comment='$submission_comment' and comment_authorid='$USER->id'"); //
|
|
// Attention: this Moodle function 'get_record_sql' makes a replace in ':comment'
|
|
// Attention: this Moodle function 'get_record_sql' makes a replace in ':comment'
|
|
- $params = array("iassign_submissionid" => $id_submission, "comment" => $submission_comment, "comment_authorid" => $USER->id);
|
|
|
|
|
|
+ $params_temp = array("iassign_submissionid" => $id_submission, "comment" => $submission_comment, "comment_authorid" => $USER->id);
|
|
$comments = $DB->get_record_sql(
|
|
$comments = $DB->get_record_sql(
|
|
- "SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
|
|
- " WHERE iassign_submissionid = :iassign_submissionid AND comment= :comment AND comment_authorid= :comment_authorid", $params);
|
|
|
|
|
|
+ "SELECT COUNT(iassign_submissionid) FROM {iassign_submission_comment} " .
|
|
|
|
+ " WHERE iassign_submissionid = :iassign_submissionid AND comment= :comment AND comment_authorid= :comment_authorid", $params_temp);
|
|
|
|
|
|
if ($comments)
|
|
if ($comments)
|
|
foreach ($comments as $tmp)
|
|
foreach ($comments as $tmp)
|
|
@@ -6828,7 +6833,6 @@ class ilm_manager {
|
|
function add_ilm () {
|
|
function add_ilm () {
|
|
$fileid = optional_param('fileid', NULL, PARAM_INT);
|
|
$fileid = optional_param('fileid', NULL, PARAM_INT);
|
|
$filename = optional_param('filename', NULL, PARAM_TEXT);
|
|
$filename = optional_param('filename', NULL, PARAM_TEXT);
|
|
-
|
|
|
|
$output = "
|
|
$output = "
|
|
<script type='text/javascript'>
|
|
<script type='text/javascript'>
|
|
//<![CDATA[
|
|
//<![CDATA[
|
|
@@ -8054,10 +8058,10 @@ class iassign_utils {
|
|
if (is_object($text)) // with iAssign did not filtered text from JSON format
|
|
if (is_object($text)) // with iAssign did not filtered text from JSON format
|
|
$text = json_decode($text)->{current_language()};
|
|
$text = json_decode($text)->{current_language()};
|
|
// $text = htmlspecialchars($text); // not good ideia, it results strange at 'iassign_ilm' field
|
|
// $text = htmlspecialchars($text); // not good ideia, it results strange at 'iassign_ilm' field
|
|
- $array1 = array("(", ")", ",", "/", "\\", "!", "@", "#", "$", "&", "*", "+", "!", "?", ".", " ",
|
|
|
|
|
|
+ $array1 = array("(", ")", ",", "/", "\\", "!", "@", "#", "$", "&", "*", "+", "!", "?", ".", " ", ":",
|
|
"á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "ẽ", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü",
|
|
"á", "à", "â", "ã", "ä", "é", "è", "ê", "ë", "ẽ", "í", "ì", "î", "ï", "ó", "ò", "ô", "õ", "ö", "ú", "ù", "û", "ü",
|
|
"ç", "Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç");
|
|
"ç", "Á", "À", "Â", "Ã", "Ä", "É", "È", "Ê", "Ë", "Í", "Ì", "Î", "Ï", "Ó", "Ò", "Ô", "Õ", "Ö", "Ú", "Ù", "Û", "Ü", "Ç");
|
|
- $array2 = array("", "", "_", "_", "_", "", "", "", "", "", "", "", "", "", "_", "_",
|
|
|
|
|
|
+ $array2 = array("", "", "_", "_", "_", "", "", "", "", "", "", "", "", "", "_", "_", "-",
|
|
"a", "a", "a", "a", "a", "e", "e", "e", "e", "e", "i", "i", "i", "i", "o", "o", "o", "o", "o", "u", "u", "u", "u",
|
|
"a", "a", "a", "a", "a", "e", "e", "e", "e", "e", "i", "i", "i", "i", "o", "o", "o", "o", "o", "u", "u", "u", "u",
|
|
"c", "A", "A", "A", "A", "A", "E", "E", "E", "E", "I", "I", "I", "I", "O", "O", "O", "O", "O", "U", "U", "U", "U", "C");
|
|
"c", "A", "A", "A", "A", "A", "E", "E", "E", "E", "I", "I", "I", "I", "O", "O", "O", "O", "O", "U", "U", "U", "U", "C");
|
|
|
|
|