Browse Source

iassign v2017.11.13

Lucas de Souza 5 years ago
commit
5716a4da9c
100 changed files with 2825 additions and 0 deletions
  1. 77 0
      README
  2. 9 0
      backup/index.html
  3. 73 0
      backup/moodle2/backup_iassign_activity_task.class.php
  4. 132 0
      backup/moodle2/backup_iassign_stepslib.php
  5. 9 0
      backup/moodle2/index.html
  6. 115 0
      backup/moodle2/restore_iassign_activity_task.class.php
  7. 154 0
      backup/moodle2/restore_iassign_stepslib.php
  8. 51 0
      classes/event/course_module_instance_list_viewed.php
  9. 99 0
      classes/event/course_module_viewed.php
  10. 99 0
      classes/event/iassign_created.php
  11. 99 0
      classes/event/iassign_deleted.php
  12. 99 0
      classes/event/iassign_updated.php
  13. 9 0
      classes/event/index.html
  14. 99 0
      classes/event/submission_comment_created.php
  15. 99 0
      classes/event/submission_comment_updated.php
  16. 99 0
      classes/event/submission_created.php
  17. 99 0
      classes/event/submission_updated.php
  18. 99 0
      classes/event/submission_viewed.php
  19. 9 0
      classes/index.html
  20. 118 0
      db/access.php
  21. 9 0
      db/index.html
  22. 172 0
      db/install.php
  23. 175 0
      db/install.xml
  24. 35 0
      db/log.php
  25. 45 0
      db/uninstall.php
  26. 227 0
      db/upgrade.php
  27. 72 0
      grade.php
  28. 434 0
      iassign_form.php
  29. BIN
      icon/add.gif
  30. BIN
      icon/add_iassign.gif
  31. BIN
      icon/add_ilm_iassign.gif
  32. BIN
      icon/add_param.gif
  33. BIN
      icon/addgreen.gif
  34. BIN
      icon/block.gif
  35. BIN
      icon/comment_close red.gif
  36. BIN
      icon/comment_close_green.gif
  37. BIN
      icon/comment_close_red1.gif
  38. BIN
      icon/comment_close_yellown.gif
  39. BIN
      icon/comment_read.gif
  40. BIN
      icon/comment_unread.gif
  41. BIN
      icon/config_ilm.gif
  42. BIN
      icon/confirm.gif
  43. BIN
      icon/copy_ilm.gif
  44. BIN
      icon/copy_param.gif
  45. BIN
      icon/correct.gif
  46. BIN
      icon/default_ilm.gif
  47. BIN
      icon/default_ilm_disabled.gif
  48. BIN
      icon/delete2.gif
  49. BIN
      icon/delete_assign_disable.gif
  50. BIN
      icon/delete_dir.gif
  51. BIN
      icon/delete_dir_disable.gif
  52. BIN
      icon/delete_iassign.gif
  53. BIN
      icon/delete_ilm.gif
  54. BIN
      icon/delete_ilm_disable.gif
  55. BIN
      icon/delete_param.gif
  56. BIN
      icon/dir.gif
  57. BIN
      icon/down_disable.gif
  58. BIN
      icon/download_all_assign.gif
  59. BIN
      icon/download_all_assign_disabled.gif
  60. BIN
      icon/download_assign.gif
  61. BIN
      icon/duplicate_iassign.gif
  62. BIN
      icon/edit_iassign.gif
  63. BIN
      icon/edit_iassign_disable.gif
  64. BIN
      icon/edit_ilm.gif
  65. BIN
      icon/edit_param.gif
  66. BIN
      icon/example.gif
  67. BIN
      icon/export_ilm.gif
  68. BIN
      icon/feedback_correct.gif
  69. BIN
      icon/feedback_incorrect.gif
  70. BIN
      icon/file.gif
  71. BIN
      icon/hbar_blue.gif
  72. BIN
      icon/hbar_blue_l.gif
  73. BIN
      icon/hbar_blue_r.gif
  74. BIN
      icon/hbar_green.gif
  75. BIN
      icon/hbar_green_l.gif
  76. BIN
      icon/hbar_green_r.gif
  77. BIN
      icon/hbar_orange.gif
  78. BIN
      icon/hbar_orange_l.gif
  79. BIN
      icon/hbar_orange_r.gif
  80. BIN
      icon/hbar_red.gif
  81. BIN
      icon/hbar_red_l.gif
  82. BIN
      icon/hbar_red_r.gif
  83. BIN
      icon/help_ilm.gif
  84. BIN
      icon/hide_iassign.gif
  85. BIN
      icon/hide_ilm.gif
  86. BIN
      icon/hide_param.gif
  87. BIN
      icon/home.gif
  88. BIN
      icon/icon.gif
  89. BIN
      icon/incorrect.gif
  90. 9 0
      icon/index.html
  91. BIN
      icon/left_disable.gif
  92. BIN
      icon/move_down_iassign.gif
  93. BIN
      icon/move_up_iassign.gif
  94. BIN
      icon/next_activity.gif
  95. BIN
      icon/next_student.gif
  96. BIN
      icon/next_student_activity.gif
  97. BIN
      icon/no_edit_iassign.gif
  98. BIN
      icon/not_post.gif
  99. BIN
      icon/open_dir.gif
  100. 0 0
      icon/post.gif

+ 77 - 0
README

@@ -0,0 +1,77 @@
+iAssign version 2.1.70
+------------------------
+
+By iMatica/iMath - free interactive tools for teaching-learning Math
+   Patricia Rodrigues <patricnet@ig.com.br>, Leônidas O. Brandão <leo@ime.usp.br>
+
+
+.: About iAssign :.
+
+This is the iAssign (Interactive Assignment) package, an iMath free system to enrich activities in Moodle. 
+It is created by Patricia Rodrigues and Leônidas de Oliveira Brandão.
+
+iAssign's goal is to increase interactivity in activities related to specific subjects (such as Geometry, Functions, Programming,...)
+in a flexible way. 
+
+In order to improve interactivity, iAssign makes use of iLM (interactive Learning Module),
+that is any interactive tool that runs under a Web browser.
+Typically an iLM is a Java applet with a few (mandatory) communication methods, all based on HTTP protocol.
+This implies that any applet can easily became an iLM and can be integrated to Moodle under iAssign package. 
+
+If the iLM offers automatic assessment functionality, iAssign is able
+to deal with it. Under such iLM, iAssign provides immediate feedback to
+the student, and the teachers can get instant information about their
+activities (including reports about the student performance).
+
+It can be added new iLM into iAssign, at any time, but (for security
+reason), only the administrator has the privilege of integrating new iLM into iAssign.
+Once integrated, an iLM can be used by anyone registered in its Moodle.
+For instance, an user with privileges of "teacher" is allowed to use
+the iAssign authoring tools to create activities with any iLM
+(like iGeom, iGraf, or iVprog, respectively to related to the subjects, Geometry, Functions and Programming).
+
+The main features of iAssign package are:
+ - The authoring tool to allow any teacher to easily prepare activities to students. Activities can be:
+   + an exercise (the student must send an answer, and if the iLM has automatic assessment, its results (right/wrong) is also registered);
+   + a test (the student does the activity, if iLM has automatic assessment, the student gets immediate feedback, but no data is recorded in Moodle's database);
+   + an example (the student can interact with the example, but nothing is recorded).
+ - Reports about students activities: 
+   + teachers can see, e.g., a survey or statistics about student's answers and can have quick access to any submited answer;
+   + the students have a survey of their activities (including their grades)
+ - Integration with general Moodle grades
+ - A filter that allows the insertion of iLM content into any (asynchronous) Moodle text.
+
+Besides, as the majority of Moodle modules, iAssign can export (as backup) one activity or a complete lesson (a set of activities).
+
+Note: This plugin is part of iAssign SET see more in https://moodle.org/plugins/browse.php?list=set&id=54
+
+.: Quick install instructions (to be used by the system administrator) :.
+
+0) Be sure you have (at least) Moodle 2.4 until Moodle 2.6 installed
+1) Be sure to have the latest language package, such as English (en), Portuguese (pt_br).
+2) Be sure to have the latest version of the module iAssign (see in https://github.com/leonidasbrandao/iAssign master)
+3) Unpack 'iAssign.2.1.x.zip' (or 'iAssign.2.1.x.tgz')
+4) Copy the 'iassign' module directory into the "mod" subdirectory of Moodle installation
+5) Under role "administrator", go to the 'Site administration' and click on 'Notifications'
+6) Have fun.
+
+
+.: What is news :.
+
+Considering the iAssign for Moodle 1.9, the new featuress in this version are:
+
+ - the teacher can produce a new interactive activity directly "on-line", using the new iLM editor (but is still possible to upload files);
+ - in a course with more than one teacher, it is now possible to use a local repository.
+ - See more in http://docs.moodle.org/en/iAssign.
+
+
+Comments and suggestions are always welcome at http://www.matematica.br/iassign or https://github.com/leonidasbrandao/iAssign.
+(if the comment area is missing, please send us an email).
+
+
+Best regards,
+
+Leônidas <leo@ime.usp.br> and Patricia <patricnet@ig.com.br>
+
+Institute of Mathematics and Statistics - University of São Paulo
+iMath/LInE : http://www.matematica.br : http://line.ime.usp.br

+ 9 - 0
backup/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

+ 73 - 0
backup/moodle2/backup_iassign_activity_task.class.php

@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * This file contains the backup task for the iAssign module
+ * 
+ * Release Notes:
+ * - v 1.1 2014/01/06
+ * 		+ Fix bug in activity name, remove tag filter (backup_iassign_activity_task::define_my_settings).
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.1 2014/01/06
+ * @package mod_iassign_backup
+ * @since 2012
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *  
+ * @see backup_activity_task
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+require_once($CFG->dirroot . '/mod/iassign/backup/moodle2/backup_iassign_stepslib.php');
+
+/**
+ * Provides the steps to perform one complete backup of the iAssign instance
+ * @see backup_activity_task
+ */
+class backup_iassign_activity_task extends backup_activity_task {
+
+  /**
+   * No specific settings for this activity
+   */
+  protected function define_my_settings () {
+
+    //TODO Retirar quando atualizar todo os iassigns que estão com a tag &lt;ia_uc&gt;
+    $temp = explode("&lt;ia_uc&gt;", $this->name);
+    $this->name = $temp[0];
+  }
+
+  /**
+   * Defines a backup step to store the instance data in the iassign.xml file
+   */
+  protected function define_my_steps () {
+    $this->add_step(new backup_iassign_activity_structure_step('iassign_structure', 'iassign.xml'));
+  }
+
+  /**
+   * Encodes URLs to various iAssign scripts
+   * @param string $content some HTML text that eventually contains URLs to the activity instance scripts
+   * @return string The content with the URLs encoded
+   */
+  static public function encode_content_links ($content) {
+    global $CFG;
+
+    $base = preg_quote($CFG->wwwroot, "/");
+    //  $base = preg_quote($CFG->wwwroot.'/mod/iassign','#');
+    // Link to the list of choices
+    $search = "/(" . $base . "\/mod\/iassign\/index.php\?id\=)([0-9]+)/";
+    $content = preg_replace($search, '$@IASSIGNINDEX*$2@$', $content);
+
+    // Link to choice view by moduleid
+    $search = "/(" . $base . "\/mod\/iassign\/view.php\?id\=)([0-9]+)/";
+    $content = preg_replace($search, '$@IASSIGNVIEWBYID*$2@$', $content);
+
+    return $content;
+  }
+
+}

+ 132 - 0
backup/moodle2/backup_iassign_stepslib.php

@@ -0,0 +1,132 @@
+<?php
+
+/**
+ * Define all the backup steps that will be used by the backup_iassign_activity_task
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2012
+ * @package mod_iassign_backup
+ * @since 2012
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *  
+ * @see backup_activity_structure_step
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Define the complete choice structure for backup, with file and id annotations
+ * @see backup_activity_structure_step
+ */
+class backup_iassign_activity_structure_step extends backup_activity_structure_step {
+
+  /**
+   * Define the structure for the iassign activity
+   * @return void Return the root element (choice), wrapped into standard activity structure
+   */
+  protected function define_structure () {
+
+    // To know if we are including userinfo
+    $userinfo = $this->get_setting_value('userinfo');
+
+    $iassign = new backup_nested_element('iassign', array('id'), array('name',
+      'course',
+      'intro',
+      'introformat',
+      'activity_group',
+      'grade',
+      'timeavailable',
+      'timedue',
+      'preventlate',
+      'test',
+      'max_experiment'));
+
+    $statements = new backup_nested_element('statements');
+
+    $statement = new backup_nested_element('statement', array('id'), array('name',
+      'iassignid',
+      'type_iassign',
+      'proposition',
+      'author_name',
+      'author_modified_name',
+      'iassign_ilmid',
+      'file',
+      'grade',
+      'timecreated',
+      'timemodified',
+      'timeavailable',
+      'timedue',
+      'preventlate',
+      'test',
+      'special_param1',
+      'position',
+      'visible',
+      'max_experiment',
+      'dependency',
+      'automatic_evaluate',
+      'show_answer'));
+
+    $iassign_submissions = new backup_nested_element('iassign_submissions');
+
+    $iassign_submission = new backup_nested_element('iassign_submission', array('id'), array('iassign_statementid',
+      'userid',
+      'timecreated',
+      'timemodified',
+      'grade',
+      'teacher',
+      'answer',
+      'experiment',
+      'status'));
+
+    $iassign_submission_comments = new backup_nested_element('iassign_submission_comments');
+
+    $iassign_submission_comment = new backup_nested_element('iassign_submission_comment', array('id'), array('iassign_submissionid',
+      'comment_authorid',
+      'timecreated',
+      'comment',
+      'return_status',
+      'receiver'));
+    // Build the tree
+
+    $iassign->add_child($statements);
+    $statements->add_child($statement);
+
+    $statement->add_child($iassign_submissions);
+    $iassign_submissions->add_child($iassign_submission);
+
+    $iassign_submission->add_child($iassign_submission_comments);
+    $iassign_submission_comments->add_child($iassign_submission_comment);
+
+
+    // Define sources
+    $iassign->set_source_table('iassign', array('id' => backup::VAR_ACTIVITYID));
+
+    $statement->set_source_sql('
+            SELECT *
+              FROM {iassign_statement}
+             WHERE iassignid = ?', array(backup::VAR_PARENTID));
+
+    if($userinfo) {
+      $iassign_submission->set_source_table('iassign_submission', array('iassign_statementid' => backup::VAR_PARENTID));
+
+      $iassign_submission_comment->set_source_table('iassign_submission_comment', array('iassign_submissionid' => backup::VAR_PARENTID));
+    }
+
+    // Define id annotations
+    $iassign_submission->annotate_ids('user', 'userid');
+    $iassign_submission->annotate_ids('user', 'teacher');
+    $iassign_submission_comment->annotate_ids('user', 'comment_authorid');
+
+    // Define file annotations
+    $iassign->annotate_files('mod_iassign', 'exercise', null); // This file area hasn't itemid
+
+    return $this->prepare_activity_structure($iassign);
+  }
+
+}

+ 9 - 0
backup/moodle2/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

+ 115 - 0
backup/moodle2/restore_iassign_activity_task.class.php

@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * Define all the backup steps that will be used by the backup_iassign_activity_task
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2012
+ * @package mod_iassign_backup
+ * @since 2012
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *  
+ * @see restore_activity_task
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+require_once($CFG->dirroot . '/mod/iassign/backup/moodle2/restore_iassign_stepslib.php');
+
+/**
+ * iassign restore task that provides all the settings and steps to perform one complete restore of the activity.
+ */
+class restore_iassign_activity_task extends restore_activity_task {
+
+  /**
+   * Define (add) particular settings this activity can have.
+   */
+  protected function define_my_settings () {
+    // No particular settings for this activity
+  }
+
+  /**
+   * Define (add) particular steps this activity can have.
+   */
+  protected function define_my_steps () {
+    // iAssign only has one structure step
+    $this->add_step(new restore_iassign_activity_structure_step('iassign_structure', 'iassign.xml'));
+  }
+
+  /**
+   * Define the contents in the activity that must be
+   * processed by the link decoder.
+   * @return array Return a content of activity
+   */
+  static public function define_decode_contents () {
+    $contents = array();
+
+    $contents[] = new restore_decode_content('iassign', array('name'), 'iassign');
+
+    return $contents;
+  }
+
+  /**
+   * Define the decoding rules for links belonging
+   * to the activity to be executed by the link decoder.
+   * @return array Return the restore decode rule.
+   */
+  static public function define_decode_rules () {
+    $rules = array();
+
+    $rules[] = new restore_decode_rule('IASSIGNVIEWBYID', '/mod/iassign/view.php?id=$1', 'course_module');
+    $rules[] = new restore_decode_rule('IASSIGNINDEX', '/mod/iassign/index.php?id=$1', 'course_module');
+
+    return $rules;
+  }
+
+  /**
+   * Define the restore log rules that will be applied
+   * by the {@link restore_logs_processor} when restoring
+   * iassign logs. It must return one array
+   * of {@link restore_log_rule} objects.
+   * @return array Return the restore log rule.
+   */
+  static public function define_restore_log_rules () {
+    $rules = array();
+
+    $rules[] = new restore_log_rule('iassign', 'add', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'update', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'view', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'view submission', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'upload', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'update comment', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'update submission', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'delete iassign', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'add comment', 'view.php?id={course_module}', '{iassign}');
+    $rules[] = new restore_log_rule('iassign', 'add submission', 'view.php?id={course_module}', '{iassign}');
+    // more...
+
+    return $rules;
+  }
+
+  /**
+   * Define the restore log rules that will be applied
+   * by the {@link restore_logs_processor} when restoring
+   * course logs. It must return one array
+   * of {@link restore_log_rule} objects
+   *
+   * Note this rules are applied when restoring course logs
+   * by the restore final task, but are defined here at
+   * activity level. All them are rules not linked to any module instance (cmid = 0)
+   *
+   * @return array Return the restore log rule of course.
+   */
+  static public function define_restore_log_rules_for_course () {
+    $rules = array();
+
+    return $rules;
+  }
+
+}

+ 154 - 0
backup/moodle2/restore_iassign_stepslib.php

@@ -0,0 +1,154 @@
+<?php
+
+/**
+ * Define all the restore steps that will be used by the restore_iassign_activity_task
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2012
+ * @package mod_iassign_backup
+ * @since 2012
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *  
+ * @see restore_activity_structure_step
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Define the complete assignment structure for restore, with file and id annotations.
+ * @see restore_activity_structure_step
+ */
+class restore_iassign_activity_structure_step extends restore_activity_structure_step {
+
+  /**
+   * Define the structure of the restore workflow
+   * @return void Adds support for the 'exercise' path that is common to all the activities.
+   */
+  protected function define_structure () {
+
+    $paths = array();
+    // To know if we are including userinfo
+    $userinfo = $this->get_setting_value('userinfo');
+
+
+    // Define each element separated
+    $paths[] = new restore_path_element('iassign', '/activity/iassign');
+    $paths[] = new restore_path_element('iassign_statement', '/activity/iassign/statements/statement');
+
+
+
+    if($userinfo) {
+      $iassign_submissions = new restore_path_element('iassign_submission', '/activity/iassign/statements/statement/iassign_submissions/iassign_submission');
+      $paths[] = $iassign_submissions;
+      $iassign_submission_comments = new restore_path_element('iassign_submission_comment', '/activity/iassign/statements/statement/iassign_submissions/iassign_submission/iassign_submission_comments/iassign_submission_comment');
+      $paths[] = $iassign_submission_comments;
+    }
+    return $this->prepare_activity_structure($paths);
+  }
+
+  /**
+   * Process an ia restore
+   * @param object $data The data in object form
+   */
+  protected function process_iassign ($data) {
+    global $DB;
+
+    $data = (object) $data;
+    $oldid = $data->id;
+    $data->course = $this->get_courseid();
+    $newitemid = $DB->insert_record('iassign', $data);
+    $this->apply_activity_instance($newitemid);
+  }
+
+  /**
+   * Process a iassign_statement restore.
+   * @param object $data The data in object form
+   */
+  protected function process_iassign_statement ($data) {
+    global $DB, $CFG;
+
+    require_once($CFG->dirroot . '/mod/iassign/locallib.php');
+    $data = (object) $data;
+    $oldid = $data->id;
+    $data->iassignid = $this->get_new_parentid('iassign');
+    $newitemid = $DB->insert_record('iassign_statement', $data);
+    $this->set_mapping('iassign_statement', $oldid, $newitemid, true); // Has related fileareas
+    activity::add_calendar($newitemid);
+  }
+
+  /**
+   * Process a iassign_submission restore.
+   * @param object $data The data in object form
+   */
+  protected function process_iassign_submission ($data) {
+    global $DB;
+
+    $data = (object) $data;
+    $oldid = $data->id;
+    $data->iassign_statementid = $this->get_new_parentid('iassign_statement');
+    $data->userid = $this->get_mappingid('user', $data->userid);
+    $data->teacher = $this->get_mappingid('user', $data->teacher);
+    $newitemid = $DB->insert_record('iassign_submission', $data);
+    $this->set_mapping('iassign_submission', $oldid, $newitemid, true); // Has related fileareas
+  }
+
+  /**
+   * Process a iassign_submission_comment restore.
+   * @param object $data The data in object form
+   */
+  protected function process_iassign_submission_comment ($data) {
+    global $DB;
+
+    $data = (object) $data;
+    $oldid = $data->id;
+    $data->iassign_submissionid = $this->get_new_parentid('iassign_submission');
+    $data->comment_authorid = $this->get_mappingid('user', $data->comment_authorid);
+    $newitemid = $DB->insert_record('iassign_submission_comment', $data);
+    $this->set_mapping('iassign_submission_comment', $oldid, $newitemid, true); // Has related fileareas
+  }
+
+  /**
+   * Once the database tables have been fully restored, restore the files.
+   */
+  protected function after_execute () {
+    global $CFG, $DB;
+
+    $this->add_related_files('mod_iassign', 'exercise', null);
+
+    $fs = get_file_storage();
+
+    $iassigns = $DB->get_records('iassign', array('course' => $this->get_courseid()));
+    foreach ($iassigns as $iassign) {
+      $iassign_statements = $DB->get_records('iassign_statement', array('iassignid' => $iassign->id));
+      foreach ($iassign_statements as $iassign_statement) {
+        $files = $DB->get_records('files', array('component' => 'mod_iassign', 'filearea' => 'exercise', 'itemid' => $iassign_statement->file));
+        if($files) {
+          $filename = array();
+          foreach ($files as $value) {
+            if($value->filename != '.') {
+              $filename = explode(".", $value->filename);
+            }
+          }
+          $extension = "";
+          if(count($filename) > 1)
+            $extension = strtolower($filename[count($filename) - 1]);
+
+          $iassign_ilms = $DB->get_records('iassign_ilm', array('parent' => 0, 'enable' => 1));
+          foreach ($iassign_ilms as $iassign_ilm) {
+            $extensions = explode(",", $iassign_ilm->extension);
+            if(in_array($extension, $extensions))
+              $iassign_statement->iassign_ilmid = $iassign_ilm->id;
+          }
+          $DB->update_record("iassign_statement", $iassign_statement);
+        }
+      }
+    }
+  }
+
+}

+ 51 - 0
classes/event/course_module_instance_list_viewed.php

@@ -0,0 +1,51 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission created event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/10/14
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
+
+  /**
+   * Create the event from course record.
+   *
+   * @param \stdClass $course
+   * @return course_module_instance_list_viewed
+   */
+  public static function create_from_course (\stdClass $course) {
+    $params = array(
+      'context' => \context_course::instance($course->id)
+    );
+    $event = \mod_iassign\event\course_module_instance_list_viewed::create($params);
+    $event->add_record_snapshot('course', $course);
+    return $event;
+  }
+
+}

+ 99 - 0
classes/event/course_module_viewed.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign course module viewed event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/10/14
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class course_module_viewed extends \core\event\course_module_viewed {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'r'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING;
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventcoursemoduleviewed', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has viewed the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'view',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/iassign_created.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign created event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/10/14
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class iassign_created extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'c'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_TEACHING;
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventiassigncreated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has created the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'add',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/iassign_deleted.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign deleted event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class iassign_deleted extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'd'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_TEACHING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventiassigndeleted', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has deleted the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'delete iassign',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/iassign_updated.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign updated event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class iassign_updated extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'u'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_TEACHING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventiassignupdated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has updated the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'update',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 9 - 0
classes/event/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

+ 99 - 0
classes/event/submission_comment_created.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission comment created event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class submission_comment_created extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'c'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventsubmissioncommentcreated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has created submission of comment updated the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'add comment',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/submission_comment_updated.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission comment update event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class submission_comment_updated extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'u'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventsubmissioncommentupdated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has viewed  activity submission of comment updated the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'update comment',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/submission_created.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission created event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class submission_created extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'c'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventsubmissioncreated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has created submission the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'add submission',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/submission_updated.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission updated event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class submission_updated extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'u'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventsubmissionupdated', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has update submission the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'update submission',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 99 - 0
classes/event/submission_viewed.php

@@ -0,0 +1,99 @@
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * The mod_iassign submission viewed event.
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2015/07/12
+ * @package mod_iassign
+ * @since 2015/07/12
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_iassign\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class submission_viewed extends \core\event\base {
+
+  /**
+   * Init method.
+   */
+  protected function init () {
+    $this->data['crud'] = 'r'; // c(reate), r(ead), u(pdate), d(elete)
+    $this->data['edulevel'] = self::LEVEL_PARTICIPATING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
+    $this->data['objecttable'] = 'iassign';
+  }
+
+  /**
+   * Returns localised general event name.
+   *
+   * @return string
+   */
+  public static function get_name () {
+    return get_string('eventsubmissionviewed', 'mod_iassign');
+  }
+
+  /**
+   * Returns non-localised event description with id's for admin use only.
+   *
+   * @return string
+   */
+  public function get_description () {
+    return "The user with id '$this->userid' has viewed  activity submission the iAssign with id '$this->objectid' in " .
+        "the iAssign activity with course module id '$this->contextinstanceid'.";
+  }
+
+  /**
+   * Get URL related to the action.
+   *
+   * @return \moodle_url
+   */
+  public function get_url () {
+    return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
+  }
+
+  /**
+   * Return the legacy event log data.
+   *
+   * @return array|null
+   */
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'iassign', 'view submission',
+      "view.php?id={$this->contextinstanceid}",
+      $this->objectid, $this->contextinstanceid);
+  }
+
+  /**
+   * Custom validation.
+   *
+   * @throws \coding_exception
+   * @return void
+   */
+  protected function validate_data () {
+    parent::validate_data();
+    // Make sure this class is never used without proper object details.
+    if(!$this->contextlevel === CONTEXT_MODULE) {
+      throw new \coding_exception('Context level must be CONTEXT_MODULE.');
+    }
+  }
+
+}

+ 9 - 0
classes/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

+ 118 - 0
db/access.php

@@ -0,0 +1,118 @@
+<?php
+
+/**
+ * Capability definitions for the ia module.
+ * 
+ * The system has four possible values for a capability:
+ *  - CAP_ALLOW
+ *  - CAP_PREVENT
+ *  - CAP_PROHIBIT
+ *  - CAP_INHERIT
+ * Hardening_new_Roles_system: <a href="http://docs.moodle.org/en/Development">http://docs.moodle.org/en/Development</a>
+ *  - manager - manageristrators can do anything at all courses.
+ *  - coursecreator - Creators can create new courses to courses and act as teachers.
+ *  - editingteacher - Teachers can do everything on a course, change, and evaluate activities.
+ *  - teacher - Moderators can interact and evaluate but can not modify the activities.
+ *  - student - Students usually have fewer privileges on a course.
+ *  - guest - Guests have minimal privileges and can not publish texts.
+ *  - user  - All users who login.
+ * 
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2010/09/27
+ * @package mod_iassign_db
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+$capabilities = array(
+  'mod/iassign:view' => array(
+    'captype' => 'read',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'guest' => CAP_ALLOW,
+      'student' => CAP_ALLOW,
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:editiassign' => array(
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:evaluateiassign' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:viewiassignall' => array(
+    'captype' => 'read',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:viewreport' => array(
+    'captype' => 'read',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:submitiassign' => array(
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'student' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:deleteiassignnull' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:deleteiassignnotnull' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/iassign:addinstance' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_COURSE,
+    'archetypes' => array(
+      'editingteacher' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    ),
+    'clonepermissionsfrom' => 'moodle/course:manageactivities'
+  ),
+);

+ 9 - 0
db/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

+ 172 - 0
db/install.php

@@ -0,0 +1,172 @@
+<?php
+
+/**
+ * Script for install all ilm in iassign table.
+ *
+ * This file replaces:
+ * STATEMENTS section in db/install.xml
+ * lib.php/modulename_install() post installation hook partially defaults.php.
+ *
+ * Release Notes:
+ * - v 1.4 2017/02/16
+ *   + Insert iVProgH5, updated iGeom, iGraf, iComb, iHanoi
+ * - v 1.3 2013/12/12
+ *   + Language support in iLM
+ * - v 1.2 2013/09/19
+ *   + Change path file for ilm, consider version in pathname
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @author Luciano Oliveira Borges
+ * @version v 1.2 2013/09/19
+ * @package mod_iassign_db
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ *
+ * <b>License</b>
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+require_once ($CFG->dirroot . '/mod/iassign/locallib.php');
+
+function xmldb_iassign_install() {
+  global $DB, $USER, $CFG;
+
+  $records = array(
+    // iGeom 5.9.21
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), array('iGeom', 'http://www.matematica.br/igeom', '5.9.21', 'Java', '{"en":"Interactive Geometry on the Internet","pt_br":"Geometria Interativa na Internet"}', 'geo', 'iGeom.jar', 'IGeomApplet.class', 800, 600, 1, time(), $USER->id, time(), 1)),
+    // iGraf 4.4.0.10
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), array('iGraf', 'http://www.matematica.br/igraf', '4.4.0.10', 'Java', '{"en":"Interactive Graphic on the Internet","pt_br":"Gráficos Interativos na Internet"}', 'grf', 'iGraf.jar', 'igraf.IGraf.class', 840, 600, 1, time(), $USER->id, time(), 1)),
+    // iComb 0.9.5
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), array('iComb', 'http://www.matematica.br/icomb', '0.9.5', 'Java', '{"en":"Combinatorics Interactive on the Internet","pt_br":"Combinatória Interativa na Internet"}', 'icb,cmb', 'iComb.jar', 'icomb.IComb.class', 750, 685, 1, time(), $USER->id, time(), 1)),
+    // iVProg2 2.1.0
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), array('iVProg2', 'http://www.matematica.br/ivprog2', '2.1.0', 'Java', '{"en":"Visual Interactive Programming on the Internet","pt_br":"Programação visual interativa na Internet"}', 'ivp2', 'iVProg2.jar', 'usp.ime.line.ivprog.Ilm.class', 800, 700, 1, time(), $USER->id, time(), 1)),
+    // iTangram2 0.4.6
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'),
+            array('iTangram2', 'http://www.matematica.br/itangram', '0.4.6', 'Java', '{"en":"The Objective of the game is to reproduce the form of the model using all 7 pieces of iTangram","pt_br":"O Objetivo do jogo é reproduzir a forma do modelo usando todas as 7 peças do iTangram"}', 'itg2', 'iTangram2.jar', 'ilm.line.itangram2.Tangram', 800, 600, 1, time(), $USER->id, time(), 1)),
+    // iHanoi 3.1.0
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'),
+            array('iHanoi', 'http://www.matematica.br/ihanoi', '3.1.0', 'Java', '{"en":"The Objective to move N discs from stick A to C, following some rule (from the game Towers of Hanoi)","pt_br":"O objetivo é mover N discos da haste A para C, seguindo algumas regras (implementa o jogo Torres de Hanói)"}', 'ihn', 'iHanoi.jar', 'ihanoi.iHanoi', 730, 450, 1, time(), $USER->id, time(), 1)),
+    // Risco 2
+    array_combine(
+            array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'),
+            array('Risko', 'http://risko.pcc.usp.br/', '2.2.23', 'Java', '{"en":"Interactive computational tool for teaching geometry","pt_br":"Ferramenta computacional interativa para o ensino de geometria"}', 'rsk', 'Risko.jar', 'RiskoApplet.class', 800, 600, 1, time(), $USER->id, time(), 0)),
+    // iVProgH5 0.1 - HTML5
+    array_combine(
+             array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), 
+             array('iVProgH5', 'http://www.matematica.br/ivprogh5', '0.1.0', 'HTML5', '{"en":"Visual Interactive Programming on the Internet HTML5","pt_br":"Programação visual interativa na Internet"}', 'ivph', 'ilm/ivprog-html/', 'main.html', 800, 600, 1, time(), $USER->id, time(), 1)),
+    // fractions 0.1 - HTML5
+    array_combine(
+             array('name', 'url', 'version', 'type', 'description', 'extension', 'file_jar', 'file_class', 'width', 'height', 'enable', 'timemodified', 'author', 'timecreated', 'evaluate'), 
+             array('iFractions', 'http://www.line.ime.usp.br', '0.1.0', 'HTML5', '{"en":"Visual Interactive Fractions Learning","pt_br":"Aprendizagem visual interativa de frações"}', 'frc', 'ilm/ifractions/', 'index.html', 1000, 600, 1, time(), $USER->id, time(), 1))
+      );
+
+  $fs = get_file_storage();
+  $is_delete = true;
+  $context = context_system::instance();
+  $ilm_path = $CFG->dirroot . "/mod/iassign/ilm/";
+
+  foreach ($records as $record) {
+
+    // Verify if there is a previous iLM (an old version that must be kept)
+    $iassign_ilm_parent = $DB->get_record('iassign_ilm', array('name' => $record['name'], 'parent' => 0));
+
+    $ilm_exists = false;
+    if ($iassign_ilm_parent) {
+      if ($iassign_ilm_parent->version != $record['version'])
+        $record['parent'] = $iassign_ilm_parent->id;
+      else
+        $ilm_exists = true;
+      }
+
+    if (strtolower($record['type']) != 'html5') {
+      $filenames = explode(",", $record['file_jar']); // get the JAR filename as "*.jar" or just first name if it is HTML5
+      $file_jar = array(); // If there are several '*.jar' for this iLM
+      // If the iLM is a set of JAR files (this was the case for iComb 0.9) get all '*.jar' files separated by ','
+      foreach ($filenames as $filename) {
+        if (!$ilm_exists) {
+
+          $name_ilm = $record['name'];
+          $version_ilm = $record['version'];
+
+          $file_ilm = array(
+             'userid' => $USER->id, // ID of context
+             'contextid' => $context->id, // ID of context
+             'component' => 'mod_iassign', // usually = table name
+             'filearea' => 'ilm', // usually = table name (e.g, in table '*_files' all iAssign exercises will have 'filearea="exercise"')
+             'itemid' => 0,
+             'filepath' => '/iassign/ilm/' . iassign_utils::format_pathname($name_ilm) . '/' . iassign_utils::format_pathname($version_ilm) . '/', // any path beginning and ending in /
+             'filename' => $filename); // any filename
+          //TODO iLM_HTML5 : What model to implement to HTML5?
+          //TODO 1. The first version of iLM HTML5 in '/var/www/html/moodle/mod/iassign/ilm/ilm-nome' and others in '/var/moodledata/filedir/'?
+          //TODO 2. Inserting new iLM HTML5 by ZIP file => explode it and register in '/var/moodledata/filedir/'?
+          // Create file using the content: the file information is inserted in the Moodle table '*_files'
+          // The real file will be registered in Moodle data (default '/var/moodledata/filedir/xx/yy' - 'xxyy' is the first 4 char in '*_files.contenthash')
+          //TODO Keep this even change the model to not insert iLM HTML5 (need this object to connect with '*_iassign_ilm' bellow)
+          $file_ilm = $fs->create_file_from_string($file_ilm, file_get_contents($ilm_path . $filename));
+
+          if ($file_ilm)
+            $is_delete &= @unlink($ilm_path . $filename);
+          array_push($file_jar, $file_ilm->get_id()); // register the '*_files.id' for all JAR package from this iLM
+          }
+        else
+          $is_delete &= @unlink($ilm_path . $filename);
+        } // foreach ($filenames as $filename)
+      
+      $record['file_jar'] = implode(",", $file_jar);
+    }
+    if (!empty($file_jar)) {
+      $DB->insert_record('iassign_ilm', $record, false); // insert new iLM in the table '*_iassign_ilm'
+    }
+  } // foreach ($records as $record)
+  // Add iAssign button to the Atto Editor
+  $toolbar = get_config('editor_atto', 'toolbar');
+  if (strpos($toolbar, 'iassign') === false && $toolbar && $toolbar != '') {
+    $groups = explode("\n", $toolbar);
+    // Try to put iassign in the html group.
+    $found = false;
+    foreach ($groups as $i => $group) {
+      $parts = explode('=', $group);
+      if (trim($parts[0]) == 'other') {
+        $groups[$i] = 'other = ' . trim($parts[1]) . ', iassign';
+        $found = true;
+        }
+      }
+
+    // if the group is not found, create the other group and insert it there
+    // Maybe unecessary as the other group is a standard, but if the user has changed it?
+    if (!$found) {
+      do {
+        $last = array_pop($groups);
+      } while (empty($last) && !empty($groups));
+      $groups[] = 'other = iassign';
+      $groups[] = $last;
+      }
+
+    // Update $toolbar and add to the config
+    $toolbar = implode("\n", $groups);
+    set_config('toolbar', $toolbar, 'editor_atto');
+    } // if (strpos($toolbar, 'iassign') === false && $toolbar && $toolbar != '')
+  // end Add
+
+  $is_delete &= @unlink($ilm_path . "index.*");
+
+  if ($is_delete && is_dir($ilm_path))
+    @rmdir($ilm_path);
+
+  // log event -----------------------------------------------------
+  if (class_exists('plugin_manager'))
+    $pluginman = plugin_manager::instance();
+  else
+    $pluginman = core_plugin_manager::instance();
+  $plugins = $pluginman->get_plugins();
+  iassign_log::add_log('install', 'version: ' . $plugins['mod']['iassign']->versiondb);
+  // log event -----------------------------------------------------
+  }
+
+// function xmldb_iassign_install()

+ 175 - 0
db/install.xml

@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"  ?>
+<XMLDB PATH="mod/iassign/db" VERSION="20101022" COMMENT="XMLDB file for Moodle mod/iassign" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceScheiaLocation="../../../lib/xmldb/xmldb.xsd">
+    <TABLES>
+        <TABLE NAME="iassign_ilm" COMMENT="Info about Interactive Learning Module - iLM" NEXT= "iassign_ilm_config">
+            <FIELDS>
+                <FIELD NAME="id"           TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="true"                ENUM="false" COMMENT="Primary key of table"                                            NEXT="name"/>
+                <FIELD NAME="name"         TYPE="char" LENGTH="20"     NOTNULL="true"                 SEQUENCE="false"               ENUM="false" COMMENT="Name of the iLM"                         PREVIOUS="id"           NEXT="version"/>
+                <FIELD NAME="version"      TYPE="char" LENGTH="30"     NOTNULL="true"                 SEQUENCE="false"               ENUM="false" COMMENT="Version of the iLM"                      PREVIOUS="name"         NEXT="version"/>
+                <FIELD NAME="type"         TYPE="char" LENGTH="20"     NOTNULL="true"                 SEQUENCE="false"               ENUM="false" COMMENT="Type of the iLM"                         PREVIOUS="version"      NEXT="description"/>
+                <FIELD NAME="description"  TYPE="text" LENGTH="medium" NOTNULL="false"                SEQUENCE="false"               ENUM="false" COMMENT="Description of the iLM"                  PREVIOUS="type"         NEXT="url"/>
+                <FIELD NAME="url"          TYPE="text" LENGTH="small"  NOTNULL="false"                SEQUENCE="false"               ENUM="false" COMMENT="URL of iLM"                              PREVIOUS="description"  NEXT="extension"/>
+                <FIELD NAME="extension"    TYPE="char" LENGTH="30"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false"               ENUM="false" COMMENT="File extension iLM"                      PREVIOUS="url"          NEXT="parent"/>
+                <FIELD NAME="parent"       TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="id iLM parent. 0 - parent"               PREVIOUS="extension"    NEXT="file_jar"/>
+                <FIELD NAME="file_jar"     TYPE="char" LENGTH="255"    NOTNULL="true" UNSIGNED="true" SEQUENCE="false"               ENUM="false" COMMENT="File name JAR"                           PREVIOUS="parent"       NEXT="file_class"/>
+                <FIELD NAME="file_class"   TYPE="char" LENGTH="255"    NOTNULL="true" UNSIGNED="true" SEQUENCE="false"               ENUM="false" COMMENT="File name class"                         PREVIOUS="file_jar"     NEXT="width"/>
+                <FIELD NAME="width"        TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="800" ENUM="false" COMMENT="Width of area to display the iLM"        PREVIOUS="file_class"   NEXT="height"/>
+                <FIELD NAME="height"       TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="700" ENUM="false" COMMENT="Heigth of area to display the iLM"       PREVIOUS="width"        NEXT="enable"/>
+                <FIELD NAME="enable"       TYPE="int"  LENGTH="1"                     UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="Status iLM. 0 - disabled / 1 - enabled"  PREVIOUS="height"       NEXT="timemodified"/>
+                <FIELD NAME="timemodified" TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="Date of last modification"               PREVIOUS="enable"       NEXT="author"/>
+                <FIELD NAME="author"       TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="id of the author of the iLM"             PREVIOUS="timemodified" NEXT="timecreated"/>
+                <FIELD NAME="timecreated"  TYPE="int"  LENGTH="10"     NOTNULL="true" UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="Date of registration of iLM"             PREVIOUS="author"       NEXT="evaluate"/>
+                <FIELD NAME="evaluate"     TYPE="int"  LENGTH="1"                     UNSIGNED="true" SEQUENCE="false" DEFAULT="0"   ENUM="false" COMMENT="iLM has automatic evaluator? 0-no/1-yes" PREVIOUS="timecreated"/>
+            </FIELDS>
+            <KEYS>
+                <KEY   NAME="primary"      TYPE="primary" FIELDS="id"/>
+            </KEYS>
+            <INDEXES>
+                <INDEX NAME="name_version"          UNIQUE="true" FIELDS="name,version" NEXT="file_jar"/>
+                <INDEX NAME="file_jar"      UNIQUE="true" FIELDS="file_jar" PREVIOUS="name_version"/>
+            </INDEXES>
+        </TABLE>
+        <TABLE NAME="iassign_ilm_config" COMMENT="Info about config iLM" PREVIOUS="iassign_ilm" NEXT= "iassign">
+            <FIELDS>
+                <FIELD NAME="id"             TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"             SEQUENCE="true"  ENUM="false"  COMMENT="Primary key of table"                                                                NEXT="iassign_ilmid"/>
+                <FIELD NAME="iassign_ilmid"  TYPE="int"  LENGTH="10"     NOTNULL="true"                              SEQUENCE="false" ENUM="false"  COMMENT="id iLM"                                                    PREVIOUS="id"             NEXT="param_type"/>
+                <FIELD NAME="param_type"     TYPE="char" LENGTH="100"    NOTNULL="true"  UNSIGNED="true"             SEQUENCE="false" ENUM="false"  COMMENT="Parameter type"                                            PREVIOUS="iassign_ilmid"  NEXT="param_name"/>
+                <FIELD NAME="param_name"     TYPE="char" LENGTH="100"    NOTNULL="true"  UNSIGNED="true"             SEQUENCE="false" ENUM="false"  COMMENT="Parameter name"                                            PREVIOUS="param_type"     NEXT="param_value"/>
+                <FIELD NAME="param_value"    TYPE="char" LENGTH="100"    NOTNULL="true"  UNSIGNED="true"             SEQUENCE="false" ENUM="false"  COMMENT="Parameter value"                                           PREVIOUS="param_name"     NEXT="description"/>
+                <FIELD NAME="description"    TYPE="text" LENGTH="medium" NOTNULL="false"                             SEQUENCE="false" ENUM="false"  COMMENT="Parameter description"                                     PREVIOUS="param_value"    NEXT="visible"/>
+                <FIELD NAME="visible"        TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false"  COMMENT="Parameter visible in the editing activities? 0-no/1-yes"   PREVIOUS="description"/>
+            </FIELDS>
+            <KEYS>
+                <KEY NAME="primary"           TYPE="primary" FIELDS="id"     NEXT="iassign_ilmid"/>
+                <KEY NAME="iassign_ilmid"     TYPE="foreign" FIELDS="iassign_ilmid" REFTABLE="iassign_ilm" REFFIELDS="id" PREVIOUS="primary"/>
+            </KEYS>
+        </TABLE>
+        <TABLE NAME="iassign" COMMENT="Instances of the module iAssign" PREVIOUS="iassign_ilm_config" NEXT="iassign_log">
+            <FIELDS>
+                <FIELD NAME="id"             	TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"              	SEQUENCE="true"  ENUM="false" COMMENT="Primary key of table"                                                          										NEXT="course"/>
+                <FIELD NAME="course"         	TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="id of the course in which the activity is inserted"          	  						PREVIOUS="id"     			NEXT="name"/>
+                <FIELD NAME="name"     			TYPE="char" LENGTH="255" 	NOTNULL="true"                             	 	SEQUENCE="false" ENUM="false" COMMENT="Name of the instance of activity"                            	  						PREVIOUS="course" 			NEXT="intro"/>
+                <FIELD NAME="intro" 			TYPE="text" 				NOTNULL="false"					 				SEQUENCE="false" COMMENT="The description of the assignment. This field is used by feature MOD_INTRO."   						PREVIOUS="name" 			NEXT="introformat"/>
+                <FIELD NAME="introformat" 		TYPE="int" 	LENGTH="4" 		NOTNULL="true" 					 DEFAULT="0" 	SEQUENCE="false" COMMENT="The format of the description field of the assignment. This field is used by feature MOD_INTRO."		PREVIOUS="intro" 			NEXT="activity_group"/>
+                <FIELD NAME="activity_group" 	TYPE="int"  LENGTH="1"   	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="1" 	SEQUENCE="false" ENUM="false" COMMENT="Type grouping. 0-do not group / 1-group by type of activity" 	  						PREVIOUS="introformat"   	NEXT="grade"/>
+                <FIELD NAME="grade"             TYPE="int"  LENGTH="11"     NOTNULL="true"  UNSIGNED="false" DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Maximum score for activity"                                       						PREVIOUS="activity_group"	NEXT="timeavailable"/>
+                <FIELD NAME="timeavailable"     TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Date of opening activity"                                         						PREVIOUS="grade"          	NEXT="timedue"/>
+                <FIELD NAME="timedue"           TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Closing date of the activity"                                     						PREVIOUS="timeavailable"  	NEXT="preventlate"/>
+                <FIELD NAME="preventlate"       TYPE="int"  LENGTH="2"      NOTNULL="false" UNSIGNED="true"  DEFAULT="1" 	SEQUENCE="false" ENUM="false" COMMENT="Allow sending late? 0 - no / 1 - yes"                             						PREVIOUS="timedue"        	NEXT="test"/>
+                <FIELD NAME="test"              TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Activity to release test after closing time? 0 - no / 1 - yes"    						PREVIOUS="preventlate"    	NEXT="max_experiment"/>
+                <FIELD NAME="max_experiment"    TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Maximum number of attempts. 0 - unlimited"                        						PREVIOUS="test"/>
+            </FIELDS>
+            <KEYS>
+                <KEY   NAME="primary" TYPE="primary" FIELDS="id" />
+            </KEYS>
+            <INDEXES>
+                <INDEX NAME="course"  UNIQUE="false" FIELDS="course"/>
+            </INDEXES>
+        </TABLE>
+        <TABLE NAME="iassign_log" COMMENT="Logs of the module iAssign" PREVIOUS="iassign" NEXT="iassign_statement">
+            <FIELDS>
+                <FIELD NAME="id"       		TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"              	SEQUENCE="true"  ENUM="false" COMMENT="Primary key of table"                            						NEXT="time"/>
+                <FIELD NAME="time"     		TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Date of log activity"                            PREVIOUS="id"          	NEXT="userid"/>
+                <FIELD NAME="userid"   		TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Id of active user"                               PREVIOUS="time" 		NEXT="ip"/>
+                <FIELD NAME="ip"       		TYPE="char" LENGTH="255"    NOTNULL="true"                               	SEQUENCE="false" ENUM="false" COMMENT="Ip of active user"                               PREVIOUS="userid"   	NEXT="course"/>
+                <FIELD NAME="course"   		TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Id of the active course"          	  			PREVIOUS="ip"     		NEXT="cmid"/>
+                <FIELD NAME="cmid"          TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Id of the active course module"                  PREVIOUS="course" 		NEXT="ilmid"/>
+                <FIELD NAME="ilmid"         TYPE="int"  LENGTH="10"  	NOTNULL="true" 	UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="Id of the iLM "			                  		PREVIOUS="cmid" 		NEXT="action"/>
+                <FIELD NAME="action"     	TYPE="char" LENGTH="255" 	NOTNULL="true"                             	 	SEQUENCE="false" ENUM="false" COMMENT="Action of user in active course"                 PREVIOUS="ilmid" 		NEXT="info"/>
+                <FIELD NAME="info" 			TYPE="text" LENGTH="medium"	NOTNULL="false"					 				SEQUENCE="false" 			  COMMENT="The additional information of log"   			PREVIOUS="action" 		NEXT="language"/>
+                <FIELD NAME="language" 		TYPE="char"	LENGTH="10"		NOTNULL="true" 					 				SEQUENCE="false" ENUM="false" COMMENT="The language code of active user"				PREVIOUS="info" 		NEXT="user_agent"/>
+                <FIELD NAME="user_agent"	TYPE="char" LENGTH="255" 	NOTNULL="true"                             	 	SEQUENCE="false" ENUM="false" COMMENT="User agent  of active user"                      PREVIOUS="language"		NEXT="javascript"/>
+                <FIELD NAME="javascript"    TYPE="int"  LENGTH="1" 		NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="User agent allow Javascript ? 0 - no / 1 - yes"  PREVIOUS="user_agent"	NEXT="java"/>
+                <FIELD NAME="java"     		TYPE="int"  LENGTH="1" 		NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" 	SEQUENCE="false" ENUM="false" COMMENT="User agent allow Java ? 0 - no / 1 - yes"        PREVIOUS="javascript"/>
+            </FIELDS>
+            <KEYS>
+                <KEY   NAME="primary" TYPE="primary" FIELDS="id" />
+            </KEYS>
+            <INDEXES>
+                <INDEX NAME="course"  UNIQUE="false" FIELDS="course"/>
+            </INDEXES>
+        </TABLE>
+        <TABLE NAME="iassign_statement" COMMENT="Info about interactive activities"  PREVIOUS="iassign_log" NEXT="iassign_submission">
+            <FIELDS>
+                <FIELD NAME="id"                       TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"              SEQUENCE="true"  ENUM="false" COMMENT="Primary key of table"                                                                             NEXT="name"/>
+                <FIELD NAME="name"                     TYPE="char" LENGTH="255"    NOTNULL="true"                               SEQUENCE="false" ENUM="false" COMMENT="Title of activity"                                                PREVIOUS="id"                   NEXT="iassignid"/>
+                <FIELD NAME="iassignid"                TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="id of the task in which the activity is inserted"                 PREVIOUS="name"                 NEXT="type_iassign"/>
+                <FIELD NAME="type_iassign"             TYPE="int"  LENGTH="2"      NOTNULL="true"  UNSIGNED="true"  DEFAULT="3" SEQUENCE="false" ENUM="false" COMMENT="Type of activity. 1 - example / 2 - test / 3 - exercise"          PREVIOUS="iassignid"            NEXT="proposition"/>
+                <FIELD NAME="proposition"              TYPE="text" LENGTH="medium" NOTNULL="false"                              SEQUENCE="false" ENUM="false" COMMENT="Proposition the activity"                                         PREVIOUS="type_iassign"         NEXT="author_name"/>
+                <FIELD NAME="author_name"              TYPE="char" LENGTH="255"    NOTNULL="true"                               SEQUENCE="false" ENUM="false" COMMENT="Author name the activity"                                         PREVIOUS="proposition"          NEXT="author_modified_name"/>
+                <FIELD NAME="author_modified_name"     TYPE="char" LENGTH="255"    NOTNULL="true"                               SEQUENCE="false" ENUM="false" COMMENT="Name of last author to modify the activity"                       PREVIOUS="author_name"          NEXT="iassign_ilmid"/>
+                <FIELD NAME="iassign_ilmid"            TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"              SEQUENCE="false" ENUM="false" COMMENT="iLM id used in the activity"                                      PREVIOUS="author_modified_name" NEXT="file"/>
+                <FIELD NAME="file"                     TYPE="char" LENGTH="255"    NOTNULL="false"                              SEQUENCE="false" ENUM="false" COMMENT="Address and file name of the activity"                            PREVIOUS="iassign_ilmid"        NEXT="grade"/>
+                <FIELD NAME="grade"                    TYPE="int"  LENGTH="11"     NOTNULL="true"  UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Maximum score for activity"                                       PREVIOUS="file"                 NEXT="timemodified"/>
+                <FIELD NAME="timemodified"             TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Date of last modification"                                        PREVIOUS="grade"                NEXT="timecreated"/>
+                <FIELD NAME="timecreated"              TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Date of creation"                                                 PREVIOUS="timemodified"         NEXT="timeavailable"/>
+                <FIELD NAME="timeavailable"            TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Date of opening activity"                                         PREVIOUS="timecreated"          NEXT="timedue"/>
+                <FIELD NAME="timedue"                  TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Closing date of the activity"                                     PREVIOUS="timeavailable"        NEXT="preventlate"/>
+                <FIELD NAME="preventlate"              TYPE="int"  LENGTH="2"      NOTNULL="false" UNSIGNED="true"  DEFAULT="1" SEQUENCE="false" ENUM="false" COMMENT="Allow sending late? 0 - no / 1 - yes"                             PREVIOUS="timedue"              NEXT="test"/>
+                <FIELD NAME="test"                     TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Activity to release test after closing time? 0 - no / 1 - yes"    PREVIOUS="preventlate"          NEXT="special_param1"/>
+                <FIELD NAME="special_param1"           TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Activity contains algorithm? 0 - no / 1 - yes"                    PREVIOUS="test"                 NEXT="position" />
+                <FIELD NAME="position"                 TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Position of activity within the group"                            PREVIOUS="special_param1"       NEXT="visible"/>
+                <FIELD NAME="visible"                  TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="1" SEQUENCE="false" ENUM="false" COMMENT="Status of viewing activity. 0 – hide / 1 - show"                  PREVIOUS="position"             NEXT="max_experiment"/>
+                <FIELD NAME="max_experiment"           TYPE="int"  LENGTH="10"     NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Maximum number of attempts. 0 - unlimited"                        PREVIOUS="visible"              NEXT="dependency"/>
+                <FIELD NAME="dependency"               TYPE="char" LENGTH="255"    NOTNULL="true"  UNSIGNED="true"  DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="List the activities that this activity depends. 0 - independent"  PREVIOUS="max_experiment"       NEXT="automatic_evaluate"/>
+                <FIELD NAME="automatic_evaluate"       TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="1" SEQUENCE="false" ENUM="false" COMMENT="Using automatic evaluation activity?0 - no / 1 - yes"             PREVIOUS="dependency"           NEXT="show_answer"/>
+                <FIELD NAME="show_answer"              TYPE="int"  LENGTH="1"      NOTNULL="false" UNSIGNED="true"  DEFAULT="1" SEQUENCE="false" ENUM="false" COMMENT="Show automatic evaluation results to students? 0 - no / 1 - yes"  PREVIOUS="automatic_evaluate"/>
+            </FIELDS>
+            <KEYS>
+                <KEY NAME="primary"       TYPE="primary" FIELDS="id" NEXT="iassignid"/>
+                <KEY NAME="iassignid"     TYPE="foreign" FIELDS="iassignid"     REFTABLE="iassign"     REFFIELDS="id" PREVIOUS="primary" NEXT="iassign_ilmid"/>
+                <KEY NAME="iassign_ilmid" TYPE="foreign" FIELDS="iassign_ilmid" REFTABLE="iassign_ilm" REFFIELDS="id" PREVIOUS="iassignid"/>
+            </KEYS>
+        </TABLE>
+        <TABLE NAME="iassign_submission" COMMENT="Info about submissions of interactive activities" PREVIOUS="iassign_statement" NEXT="iassign_submission_comment">
+            <FIELDS>
+                <FIELD NAME="id"                  TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"              SEQUENCE="true"   ENUM="false" COMMENT="Primary key of table"                                                                                                              NEXT="iassign_statementid"/>
+                <FIELD NAME="iassign_statementid" TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="id interactive activity"                                                                            PREVIOUS="id"                  NEXT="userid"/>
+                <FIELD NAME="userid"              TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="id of submitting author"                                                                            PREVIOUS="iassign_statementid" NEXT="timecreated"/>
+                <FIELD NAME="timecreated"         TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Date of first submission"                                                                           PREVIOUS="userid"              NEXT="timemodified"/>
+                <FIELD NAME="timemodified"        TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Date last modified"                                                                                 PREVIOUS="timecreated"         NEXT="grade"/>
+                <FIELD NAME="grade"               TYPE="int"  LENGTH="11"  NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Grade of evaluation"                                                                                PREVIOUS="timemodified"        NEXT="teacher"/>
+                <FIELD NAME="teacher"             TYPE="int"  LENGTH="10"  NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="id teacher"                                                                                         PREVIOUS="grade"               NEXT="answer"/>
+                <FIELD NAME="answer"              TYPE="text" LENGTH="big" NOTNULL="true"                              SEQUENCE="false"  ENUM="false" COMMENT="String with the last solution sent by the student"                                                  PREVIOUS="teacher"             NEXT="experiment"/>
+                <FIELD NAME="experiment"          TYPE="int"  LENGTH="1"   NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Total  of submissions"                                                                              PREVIOUS="answer"              NEXT="status"/>
+                <FIELD NAME="status"              TYPE="int"  LENGTH="1"   NOTNULL="true" UNSIGNED="true"  DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Status of activities. 0-not submitted/1-submitted/2-evaluated as incorrect/3-evaluated as correct"  PREVIOUS="experiment"/>
+            </FIELDS>
+            <KEYS>
+                <KEY NAME="primary"             TYPE="primary" FIELDS="id" NEXT="iassign_statementid"/>
+                <KEY NAME="iassign_statementid" TYPE="foreign" FIELDS="iassign_statementid" REFTABLE="iassign_statement" REFFIELDS="id" PREVIOUS="primary"/>
+            </KEYS>
+            <INDEXES>
+                <INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
+            </INDEXES>
+        </TABLE>
+        <TABLE NAME="iassign_submission_comment" COMMENT="Comments of interactive activities" PREVIOUS="iassign_submission" NEXT="iassign_security">
+            <FIELDS>
+                <FIELD NAME="id"                    TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true"             SEQUENCE="true"   ENUM="false" COMMENT="Primary key of table"                                                            NEXT="iassign_submissionid"/>
+                <FIELD NAME="iassign_submissionid"  TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="id submission comment"                          PREVIOUS="id"                    NEXT="comment_authorid"/>
+                <FIELD NAME="comment_authorid"      TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="id author comment"                              PREVIOUS="iassign_submissionid"  NEXT="timecreated"/>
+                <FIELD NAME="timecreated"           TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Date of sending the comment"                    PREVIOUS="comment_authorid"      NEXT="comment"/>
+                <FIELD NAME="comment"               TYPE="text" LENGTH="big"  NOTNULL="true"                             SEQUENCE="false"  ENUM="false" COMMENT="Comment"                                        PREVIOUS="timecreated"           NEXT="return_status"/>
+                <FIELD NAME="return_status"         TYPE="int"  LENGTH="1"    NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="Status of return. 0 - unread / 1 -read"         PREVIOUS="comment"               NEXT="receiver"/>
+                <FIELD NAME="receiver"              TYPE="int"  LENGTH="1"    NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"  ENUM="false" COMMENT="1 - message to teacher. 2 - message to student" PREVIOUS="return_status"/>
+            </FIELDS>
+            <KEYS>
+                <KEY NAME="primary"              TYPE="primary" FIELDS="id" NEXT="iassign_submissionid"/>
+                <KEY NAME="iassign_submissionid" TYPE="foreign" FIELDS="iassign_submissionid" REFTABLE="iassign_submission" REFFIELDS="id" PREVIOUS="primary"/>
+            </KEYS>
+        </TABLE>
+        <TABLE NAME="iassign_security" COMMENT="Info about secure access to interactive activities" PREVIOUS="iassign_submission_comment">
+            <FIELDS>
+                <FIELD NAME="id"                  TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true"             SEQUENCE="true"  ENUM="false"  COMMENT="Primary key of table"                                                     NEXT="iassign_statementid"/>
+                <FIELD NAME="iassign_statementid" TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false"  COMMENT="id interactive activity"                   PREVIOUS="id"                  NEXT="userid"/>
+                <FIELD NAME="userid"              TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false"  COMMENT="id of submitting author"                   PREVIOUS="iassign_statementid" NEXT="file"/>
+                <FIELD NAME="file"                TYPE="text" LENGTH="big"  NOTNULL="true"                             SEQUENCE="false" ENUM="false"  COMMENT="Origin of activity sent"                   PREVIOUS="userid"              NEXT="timecreated"/>
+                <FIELD NAME="timecreated"         TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false"  COMMENT="Moment that the activity has been invoked" PREVIOUS="file"                NEXT="view"/>
+                <FIELD NAME="view"                TYPE="int"  LENGTH="10"   NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false"  COMMENT="Preview control flag of the iLM"           PREVIOUS="timecreated"/>
+            </FIELDS>
+            <KEYS>
+                <KEY NAME="primary"      TYPE="primary" FIELDS="id" NEXT="iassign_statementid"/>
+                <KEY NAME="iassign_statementid" TYPE="foreign" FIELDS="iassign_statementid" REFTABLE="iassign_statement" REFFIELDS="id" PREVIOUS="primary"/>
+            </KEYS>
+        </TABLE>
+    </TABLES>
+</XMLDB>

+ 35 - 0
db/log.php

@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Definition of log events
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2010/09/27
+ * @package mod_iassign_db
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Array of log events.
+ */
+$logs = array(
+  array('module' => 'iassign', 'action' => 'view', 'mtable' => 'iassign_view', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'add', 'mtable' => 'iassign_add', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'update', 'mtable' => 'iassign_update', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'view submission', 'mtable' => 'iassign_view_submission', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'upload', 'mtable' => 'iassign_upload', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'update comment', 'mtable' => 'iassign_update_comment', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'update submission', 'mtable' => 'iassign_update_submission', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'delete iassign', 'mtable' => 'iassign_delete', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'add comment', 'mtable' => 'iassign_add_comment', 'field' => 'name'),
+  array('module' => 'iassign', 'action' => 'add submission', 'mtable' => 'iassign_add_comment', 'field' => 'name'),
+);

+ 45 - 0
db/uninstall.php

@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * This file replaces the legacy STATEMENTS section in db/install.xml,
+ * lib.php/modulename_install() post installation hook and partially defaults.php
+ *
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @author Luciano Oliveira Borges
+ * @version v 1.2 2013/08/20
+ * @package mod_iassign_db
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * This is called at the beginning of the uninstallation process to give the module
+ * a chance to clean-up its hacks, bits etc. where possible.
+ * @return bool Return true if success.
+ */
+require_once ($CFG->dirroot . '/mod/iassign/locallib.php');
+
+function xmldb_iassign_uninstall () {
+  global $DB;
+  $fs = get_file_storage();
+
+  $context_system = context_system::instance();
+  $fs->delete_area_files($context_system->id, 'mod_iassign', 'ilm');
+
+  $courses = $DB->get_records('course');
+  foreach ($courses as $course) {
+    $context_course = context_course::instance($course->id);
+    $fs->delete_area_files($context_course->id, 'mod_iassign', 'exercise');
+    $fs->delete_area_files($context_course->id, 'mod_iassign', 'activity');
+  }
+
+  return true;
+}

+ 227 - 0
db/upgrade.php

@@ -0,0 +1,227 @@
+<?php
+
+/**
+ * This file keeps track of upgrades to the lams module.
+ * 
+ * Sometimes, changes between versions involve
+ * alterations to database structures and other
+ * major things that may break installations.
+ * The upgrade function in this file will attempt
+ * to perform all the necessary actions to upgrade
+ * your older installtion to the current version.
+ * If there's something it cannot do itself, it
+ * will tell you what you need to do.
+ * The commands in here will all be database-neutral,
+ * using the functions defined in lib/ddllib.php
+ * 
+ * - v 1.4 2013/09/19
+ *     + Insert general fields for iassign statement (grade, timeavaliable, timedue, preventlate, test, max_experiment).
+ *     + Change index field 'name' in 'iassign_ilm' table to index field 'name,version'.
+ * - v 1.2 2013/08/30
+ * + Change 'filearea' for new concept for files.
+ * + Change path file for ilm, consider version in pathname.
+ * 
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @author Luciano Oliveira Borges
+ * @version v 1.4 2013/09/19
+ * @package mod_iassign_db
+ * @since 2010/12/21
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *  
+ * @param $oldversion Number of the old version. 
+ */
+
+require_once ($CFG->dirroot . '/mod/iassign/locallib.php');
+
+function xmldb_iassign_upgrade ($oldversion) {
+
+  global $CFG, $DB, $USER;
+
+  $dbman = $DB->get_manager();
+
+  if ($oldversion < 2014012100) {
+    // Define field and index in iLM table to be added
+    $table = new xmldb_table('iassign_ilm');
+    $index_name = new xmldb_index('name');
+    $index_name->set_attributes(XMLDB_INDEX_UNIQUE, array('name'));
+    if ($dbman->index_exists($table, $index_name)) {
+      $dbman->drop_index($table, $index_name, $continue = true, $feedback = true);
+      }
+    $index_name_version = new xmldb_index('name_version');
+    $index_name_version->set_attributes(XMLDB_INDEX_UNIQUE, array('name', 'version'));
+    if (!$dbman->index_exists($table, $index_name_version)) {
+      $dbman->add_index($table, $index_name_version, $continue = true, $feedback = true);
+      }
+
+    // Fix field name in ilm table to be added.
+    $table = new xmldb_table('iassign_ilm');
+    $field_height = new xmldb_field('heigth', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '600', 'width');
+    if ($dbman->field_exists($table, $field_height))
+      $dbman->rename_field($table, $field_height, 'height');
+
+    // Define fields in iassign table to be added.
+    $table = new xmldb_table('iassign');
+    $field_intro = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
+    if (!$dbman->field_exists($table, $field_intro))
+      $dbman->add_field($table, $field_intro);
+    $field_introformat = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'intro');
+    if (!$dbman->field_exists($table, $field_introformat))
+      $dbman->add_field($table, $field_introformat);
+    $field_grade = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '11', null, XMLDB_NOTNULL, null, '0', 'activity_group');
+    if (!$dbman->field_exists($table, $field_grade))
+      $dbman->add_field($table, $field_grade);
+    $field_timeavailable = new xmldb_field('timeavailable', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'grade');
+    if (!$dbman->field_exists($table, $field_timeavailable))
+      $dbman->add_field($table, $field_timeavailable);
+    $field_timedue = new xmldb_field('timedue', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'timeavailable');
+    if (!$dbman->field_exists($table, $field_timedue))
+      $dbman->add_field($table, $field_timedue);
+    $field_preventlate = new xmldb_field('preventlate', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '1', 'timedue');
+    if (!$dbman->field_exists($table, $field_preventlate))
+      $dbman->add_field($table, $field_preventlate);
+    $field_test = new xmldb_field('test', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, '0', 'preventlate');
+    if (!$dbman->field_exists($table, $field_test))
+      $dbman->add_field($table, $field_test);
+    $field_max_experiment = new xmldb_field('max_experiment', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'test');
+    if (!$dbman->field_exists($table, $field_max_experiment))
+      $dbman->add_field($table, $field_max_experiment);
+
+    if (!$dbman->table_exists($table)) {
+      $field_id = new xmldb_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
+      $field_time = new xmldb_field('time', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id');
+      $field_userid = new xmldb_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'time');
+      $field_ip = new xmldb_field('ip', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'userid');
+      $field_course = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'ip');
+      $field_cmid = new xmldb_field('cmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'course');
+      $field_ilmid = new xmldb_field('ilmid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'cmid');
+      $field_action = new xmldb_field('action', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'ilmid');
+      $field_info = new xmldb_field('info', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'action');
+      $field_language = new xmldb_field('language', XMLDB_TYPE_CHAR, '10', null, null, null, null, 'info');
+      $field_user_agent = new xmldb_field('user_agent', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'language');
+      $field_javascript = new xmldb_field('javascript', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'user_agent');
+      $field_java = new xmldb_field('java', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'javascript');
+
+      $key = new xmldb_key('primary');
+      $key->set_attributes(XMLDB_KEY_PRIMARY, array('id'), null, null);
+
+      $index = new xmldb_index('course');
+      $index->set_attributes(XMLDB_INDEX_NOTUNIQUE, array('course'));
+
+      $table->addField($field_id);
+      $table->addField($field_time);
+      $table->addField($field_userid);
+      $table->addField($field_ip);
+      $table->addField($field_course);
+      $table->addField($field_cmid);
+      $table->addField($field_ilmid);
+      $table->addField($field_action);
+      $table->addField($field_info);
+      $table->addField($field_language);
+      $table->addField($field_user_agent);
+      $table->addField($field_javascript);
+      $table->addField($field_java);
+
+      $table->addKey($key);
+
+      $table->addIndex($index);
+
+      $status = $dbman->create_table($table);
+      } // if (!$dbman->table_exists($table))
+
+    // Now update Moodle table '*_files' related to the iAssign: insert new field 'filearea'
+    $fs = get_file_storage();
+    $is_delete = true;
+    $ilm_path = $CFG->dirroot . "/mod/iassign/ilm/";
+
+    // All iAssign 'exercises' must get the label 'exercise'
+    $exercise_files = $DB->get_records('files', array("component" => "mod_iassign", "filearea" => "activity"));
+    foreach ($exercise_files as $exercise_file) {
+      $exercise_file->filearea = "exercise";
+      $DB->update_record('files', $exercise_file);
+      }
+
+    // All iAssign iLM (usually 'JAR package') must get the label 'activity'
+    $activity_files = $DB->get_records('files', array("component" => "mod_iassign", "filearea" => "ilm"));
+    foreach ($activity_files as $activity_file) {
+      $activity_file->filearea = "activity";
+      $DB->update_record('files', $activity_file);
+      }
+
+    // iAssign savepoint reached
+    upgrade_mod_savepoint(true, 2014012100, 'iassign');
+    } // if ($oldversion < 2014012100)
+
+  if ($oldversion < 2017021900) { // update to migrate from 2016021300 to 2017021900 (2.2.00)
+    // iassign_ilm : id; name; version; description; url; extension; parent; file_jar; file_class; width; height; enable; timemodified; author; timecreated; evaluate
+    $count_iassign_ilm = $DB->count_records_sql('SELECT COUNT(id) FROM {iassign_ilm}'); // count the number of existing iLM in table '*_iassign_ilm'
+    if ($count_iassign_ilm>0) { // Insert new iLM: iVProgH5 (package in HTML5 technology)
+
+      // Insert an entry in the Moodle table '*_files'
+      $context = context_system::instance();
+      $file_ilm = array(
+        'userid' => $USER->id, // ID of context
+        'contextid' => $context->id, // ID of context
+        'component' => 'mod_iassign', // usually = table name
+        'filearea' => 'ilm', // in table '*_files' all iAssign exercises will have 'filearea="exercise"' and all iLM must be 'ilm'
+        'itemid' => 0,
+        'filepath' => '/iassign/ilm/', // any path beginning and ending in /
+        'filename' => "ivprog-html/main.html"); // any filename: use the starting point of iVProgH5
+
+      // Now update Moodle table '*_files' related to the iAssign: insert new field 'filearea'
+      $fs = get_file_storage();
+      $is_delete = true;
+      $ilm_path = $CFG->dirroot . "/mod/iassign/ilm/";
+
+      //TODO iLM_HTML5 : What model to implement to HTML5?
+      //TODO 1. The first version of iLM HTML5 in '/var/www/html/moodle/mod/iassign/ilm/ilm-nome' and others in '/var/moodledata/filedir/'?
+      //TODO 2. Inserting new iLM HTML5 by ZIP file => explode it and register in '/var/moodledata/filedir/'?
+
+      // Create file using the content: the file information is inserted in the Moodle table '*_files'
+      // The real file will be registered in Moodle data (default '/var/moodledata/filedir/xx/yy' - 'xxyy' is the first 4 char in '*_files.contenthash')
+      //TODO Keep this even change the model to not insert iLM HTML5 (need this object to connect with '*_iassign_ilm' bellow)
+      $file_ilm = $fs->create_file_from_string($file_ilm, file_get_contents($ilm_path . "ivprog-html/main.html"));
+
+      if ($file_ilm)
+        $is_delete &= @unlink($ilm_path . "ivprog-html");
+
+      // Insert an entry in iAssign table '*_iassign_ilm'
+      $newentry = new stdClass();
+      $newentry->name = 'iVProgH5';
+      $newentry->url = 'http://www.matematica.br/ivprogh5';
+      $newentry->version = '0.1.0';
+      $newentry->description = '{"en":"Visual Interactive Programming on the Internet HTML5","pt_br":"Programação visual interativa na Internet"}';
+      $newentry->extension = 'ivph';
+      $newentry->file_jar = 'iVProgH5'; // to JAR this is the '*_files.id' correponding to the iLM storaged in '/var/moodledata/filedir/'
+      $newentry->file_class = 'ivprog-html/main.html';
+      $newentry->width = 800;
+      $newentry->height = 700;
+      $newentry->enable = 1;
+      $newentry->timemodified = time();
+      $newentry->author = $USER->id;
+      $newentry->timecreated = time();
+      $newentry->evaluate = 1;
+
+      // $DB->insert_records('iassign_ilm', $newentry);
+      $newentry->id = $DB->insert_record("iassign_ilm", $newentry);
+
+      // iAssign savepoint reached
+      upgrade_mod_savepoint(true, 2017021900, 'iassign');
+      } // if ($count_iassign_ilm>0)
+
+    } // if ($oldversion < 2017021900)
+
+  // log event -----------------------------------------------------
+  if (class_exists('plugin_manager'))
+    $pluginman = plugin_manager::instance();
+  else
+    $pluginman = core_plugin_manager::instance();
+  $plugins = $pluginman->get_plugins();
+  iassign_log::add_log('upgrade', 'version: ' . $plugins['mod']['iassign']->versiondisk);
+  // log event -----------------------------------------------------
+
+  return true;
+  }

+ 72 - 0
grade.php

@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * This script contains all the stuff to display evaluate.
+ * 
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2010/12/21
+ * @package mod_iassign
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once("../../config.php");
+
+// Recovery th ID of active user.
+$id = required_param('id', PARAM_INT); // Course module ID
+
+// Constrain the url for redirect user.
+$url = new moodle_url('/mod/iassign/view.php'); // novo
+
+if ($id) {
+  if (!$cm = get_coursemodule_from_id('iassign', $id)) {
+    print_error('invalidcoursemodule');
+    }
+
+  if (!$iassign = $DB->get_record("iassign", array("id" => $cm->instance))) {
+    print_error('invalidid', 'iassign');
+    }
+
+  if (!$course = $DB->get_record("course", array("id" => $iassign->course))) {
+    print_error('coursemisconf', 'iassign');
+    }
+  $url->param('id', $id);
+  }
+else {
+  if (!$iassign = $DB->get_record("iassign", array("id" => $a))) {
+    print_error('invalidid', 'iassign');
+    }
+  if (!$course = $DB->get_record("course", array("id" => $iassign->course))) {
+    print_error('coursemisconf', 'iassign');
+    }
+  if (!$cm = get_coursemodule_from_instance("iassign", $iassign->id, $course->id)) {
+    print_error('invalidcoursemodule');
+    }
+  $url->param('a', $a);
+  }
+
+$PAGE->set_url($url);
+
+require_login($course, true, $cm);
+
+$PAGE->set_title(format_string($iassign->name));
+$PAGE->set_heading($course->fullname);
+
+require_once ("$CFG->dirroot/mod/iassign/locallib.php");
+
+
+/// Get an instance of iassign.
+$iassigninstance = new iassign($iassign, $cm, $course);
+
+if (has_capability('mod/iassign:viewreport', context_module::instance($cm->id))) {
+  $iassigninstance->action = 'report';
+  $iassigninstance->stats();
+  }
+elseif (has_capability('mod/iassign:submitiassign', context_module::instance($cm->id)))
+  $iassigninstance->stats_students();
+else
+  $iassigninstance->view();

+ 434 - 0
iassign_form.php

@@ -0,0 +1,434 @@
+<?php
+
+/**
+ * Form to add and edit interactive activities
+ * 
+ * 
+ * Release Notes:
+ * - v 1.5 2013/09/19
+ * 		+ Insert function for validation form (mod_iassign_form::validation).
+ * 		+ Fix bugs in download exercise file.
+ * - v 1.4 2013/08/21
+ * 		+ Change title link with message for get file for donwload file.
+ * - v 1.3 2013/08/15
+ * 		+ Change view file for allow download file.
+ * - v 1.2 2013/08/01
+ * 		+ Fix error in sql query for var $igeom.
+ * - v 1.1 2013/07/12
+ * 		+ Fix error messages of 'setType' in debug mode for hidden fields.
+ * 
+ * @author Patricia Alves Rodrigues
+ * @author Leônidas O. Brandão
+ * @author Luciano Oliveira Borges
+ * @version v 1.5 2013/09/19
+ * @package mod_iassign
+ * @since 2010/09/27
+ * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
+ * 
+ * <b>License</b> 
+ *  - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+/**
+ * Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
+ */
+if(!defined('MOODLE_INTERNAL')) {
+  die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
+}
+
+require_once ($CFG->libdir . '/formslib.php');
+require_once ($CFG->dirroot . '/course/moodleform_mod.php');
+require_once ($CFG->dirroot . '/mod/iassign/lib.php');
+
+/**
+ * This class create form based moodleform.
+ * @see moodleform
+ */
+class mod_iassign_form extends moodleform {
+
+  /**
+   * Add elements to form
+   */
+  function definition () {
+    global $CFG, $COURSE, $USER, $DB;
+    $mform = & $this->_form;
+    $instance = $this->_customdata;
+
+    $params = array('name' => '%iGeom%', 'parent' => 0);
+    $igeom = $DB->get_records_sql('SELECT s.id, s.name, s.parent 
+              							FROM {iassign_ilm} s
+              							WHERE s.name LIKE :name AND s.parent = :parent', $params);
+
+    $id = $COURSE->cm;
+    foreach ($igeom as $item)
+      $idigeom = $item->id;
+    
+    $tmps = $DB->get_records('iassign_ilm', array('enable' => 1));
+    $iassigns = $DB->get_records('iassign_statement', array('iassignid' => $COURSE->iassignid));
+
+    if($tmps) {
+      $ids = "";
+      $names = "";
+      $evaluates = "";
+      foreach ($tmps as $tmp) {
+        $ids .="'" . $tmp->id . "',";
+        $names .="'" . $tmp->name . "',";
+        $evaluates .="'" . $tmp->evaluate . "',";
+      }
+      $ids .="'0'";
+      $evaluates .="'0'";
+    }
+    $name_iassigns = "";
+    if($iassigns) {
+      foreach ($iassigns as $iassign) {
+        $name_iassigns .="'" . $iassign->name . "',";
+      }
+    }
+    $name_iassigns .="''";
+
+    $error_name = get_string('error_iassign_name', 'iassign');
+
+    /// @todo Código Javascript, verificar alternativa.
+    $code_javascript = "
+             <script type='text/javascript'>
+             //<![CDATA[
+        
+              var i;
+              var ids = new Array($ids);
+              var evaluates = new Array($evaluates);
+        
+              document.forms['mform1'].filename.disabled=1;  
+                
+              if(document.forms['mform1'].type_iassign.value==1){
+                 document.forms['mform1'].grade.style.display='none';
+                 document.forms['mform1'].max_experiment.style.display='none';
+              }else{
+                 document.forms['mform1'].grade.style.display='block';
+                 document.forms['mform1'].max_experiment.style.display='block';
+              }
+        
+             for (i=0;i<ids.length;i++){
+                if(ids[i]==document.forms['mform1'].iassign_ilmid.value && evaluates[i]==0){
+                   document.forms['mform1'].automatic_evaluate.style.display='none';
+                   document.forms['mform1'].show_answer.style.display='none';
+                   //document.forms['mform1'].automatic_evaluate.disabled=1;
+                  // document.forms['mform1'].show_answer.disabled=1;
+                }
+             }
+
+             if (document.forms['mform1'].iassign_ilmid.value==$idigeom){
+                document.forms['mform1'].special_param1.style.display='block';
+                document.forms['mform1'].special_param1.disabled=0;
+             }
+             else{
+                document.forms['mform1'].special_param1.style.display='none';
+                document.forms['mform1'].special_param1.value=0;
+                document.forms['mform1'].special_param1.disabled=1;
+             }
+   
+           
+            function confirm_name(name){
+              var i;
+              var names = new Array($name_iassigns);
+              for (i=0;i<names.length;i++){
+                    if(names[i]==name)
+                       alert('" . $error_name . "');
+               }  
+            }
+        
+            function config_ilm(id){
+                
+             if (id==$idigeom){
+                document.forms['mform1'].special_param1.style.display='block';
+                document.forms['mform1'].special_param1.disabled=0;
+                }
+             else{
+                document.forms['mform1'].special_param1.style.display='none';
+                document.forms['mform1'].special_param1.value=0;
+                document.forms['mform1'].special_param1.disabled=1;
+               }
+               var i;
+               var ids = new Array($ids);
+               var evaluates = new Array($evaluates);
+                 if(document.forms['mform1'].type_iassign.value==1){
+                         document.forms['mform1'].automatic_evaluate.disabled=1;
+                         document.forms['mform1'].show_answer.disabled=1;
+                         document.forms['mform1'].automatic_evaluate.value=0;
+                         document.forms['mform1'].show_answer.value=0;
+                 }
+                 else{
+                 for (i=0;i<ids.length;i++){
+                    if(ids[i]==id){
+        		            if(document.forms['mform1'].action.value=='edit'){
+                            if (evaluates[i]==0){
+                              document.forms['mform1'].automatic_evaluate.style.display='none';
+                              document.forms['mform1'].show_answer.style.display='none';
+                              document.forms['mform1'].automatic_evaluate.disabled=1;
+                              document.forms['mform1'].show_answer.disabled=1;
+                              document.forms['mform1'].automatic_evaluate.value=0;
+                              document.forms['mform1'].show_answer.value=0;
+                            }
+                            else
+                            {
+                              document.forms['mform1'].automatic_evaluate.style.display='block';
+                              document.forms['mform1'].show_answer.style.display='block';
+                              document.forms['mform1'].automatic_evaluate.disabled=0;
+                              document.forms['mform1'].show_answer.disabled=0;
+                              document.forms['mform1'].automatic_evaluate.value=1;
+                              document.forms['mform1'].show_answer.value=1;
+                            }
+                       }
+
+                       if(document.forms['mform1'].action.value=='add'){
+                            if (evaluates[i]==0){
+                              document.forms['mform1'].automatic_evaluate.style.display='none';
+                              document.forms['mform1'].show_answer.style.display='none';
+                              document.forms['mform1'].automatic_evaluate.disabled=1;
+                              document.forms['mform1'].show_answer.disabled=1;
+                              document.forms['mform1'].automatic_evaluate.value=0;
+                              document.forms['mform1'].show_answer.value=0;
+                            }
+                            else
+                            {
+                              document.forms['mform1'].automatic_evaluate.style.display='block';
+                              document.forms['mform1'].show_answer.style.display='block';
+                              document.forms['mform1'].automatic_evaluate.disabled=0;
+                              document.forms['mform1'].show_answer.disabled=0;
+                              document.forms['mform1'].automatic_evaluate.value=1;
+                              document.forms['mform1'].show_answer.value=1;
+                            }
+                        }
+                    }
+                   }
+                 }
+            }
+
+           function disable_answer(resp){
+             if (resp==0){
+                document.forms['mform1'].show_answer.value=0;
+                document.forms['mform1'].show_answer.disabled=1;
+             }
+             else{
+                document.forms['mform1'].show_answer.disabled=0;
+             }
+           }
+        
+          function view_ilm_manager(){
+             document.forms['mform1'].filename.disabled=1;    
+	     open_ilm_manager=window.open('$CFG->wwwroot/mod/iassign/ilm_manager.php?id=$COURSE->id&from=iassign&ilmid='+document.forms['mform1'].iassign_ilmid.value,'','width=1000,height=880,menubar=0,location=0,scrollbars,status,fullscreen,resizable');
+	  }
+          //]]>
+          </script>";
+
+
+
+    //-------------------------------------------------------------------------------
+    /// Adding the "title_type_iassign" fieldset, where all the common settings are showed
+
+    $mform->addElement('header', 'title_type_iassign', get_string('type_iassign', 'iassign'));
+    $type_iassign = array();
+    $type_iassign[1] = get_string('example', 'iassign');
+    $type_iassign[2] = get_string('test', 'iassign');
+    $type_iassign[3] = get_string('exercise', 'iassign');
+
+    $mform->addElement('select', 'type_iassign', get_string('choose_type_activity', 'iassign'), $type_iassign, array('onChange' => 'config_type(this.value);'));
+    $mform->setDefault('type_iassign', 3); // default type_iassign = 3
+    $mform->addHelpButton('type_iassign', 'helptypeiassign', 'iassign');
+    //-------------------------------------------------------------------------------
+    /// Adding the "data_activity" fieldset, where all the common settings are showed
+
+    $mform->addElement('header', 'data_activity', get_string('data_activity', 'iassign'));
+    $mform->addElement('static', 'author', get_string('author_id', 'iassign'));
+    $mform->addElement('static', 'author_modified', get_string('author_id_modified', 'iassign'));
+
+    /// Adding the standard "name" field
+    $mform->addElement('text', 'name', get_string('iassigntitle', 'iassign'), array('size' => '55', 'onChange' => 'confirm_name(this.value);'));
+    $mform->setType('name', PARAM_TEXT);
+    $mform->addRule('name', get_string('required', 'iassign'), 'required');
+
+    /// Adding the standard "proposition" field
+    $mform->addElement('htmleditor', 'proposition', get_string('proposition', 'iassign'));
+    $mform->setType('proposition', PARAM_RAW);
+    $mform->addRule('proposition', get_string('required', 'iassign'), 'required');
+
+    ///-----------------------------------------------------------------------------
+    /// Adding the "interactivy_learning_module" fieldset, where all the common settings are showed
+    $mform->addElement('header', 'interactivy_learning_module', get_string('interactivy_learning_module', 'iassign'));
+    //$mform->setExpanded('interactivy_learning_module');
+    // Search imas registered in the database
+    $ilms = search_iLM(1);
+
+    $applets = array();
+    foreach ($ilms as $ilm)
+      $applets[$ilm->id] = $ilm->name . ' ' . $ilm->version;
+    $mform->addElement('select', 'iassign_ilmid', get_string('choose_iLM', 'iassign'), $applets, array('onChange' => 'config_ilm(this.value);'));
+    $mform->addHelpButton('iassign_ilmid', 'helpchoose_ilm', 'iassign');
+
+    $fileurl = "";
+    $filename = "";
+    if(!is_null($COURSE->iassign_file_id)) {
+      $fs = get_file_storage();
+      $file = $fs->get_file_by_id($COURSE->iassign_file_id);
+      $fileurl = "{$CFG->wwwroot}/pluginfile.php/{$file->get_contextid()}/mod_iassign/exercise" . '/' . $file->get_itemid() . $file->get_filepath() . $file->get_filename();
+      $filename = $file->get_filename();
+    }
+    echo "123";
+    $html_div = '<div id="fitem_id_iassign_file_id" class="fitem required fitem_fgroup">';
+    $html_div .= '<div class="fitemtitle"><label for="id_iassign_file_id">' . get_string('choose_file', 'iassign');
+    $html_div .= '<img class="req" title="' . get_string('requiredelement', 'form') . '" alt="' . get_string('requiredelement', 'form') . '" src="' . $CFG->wwwroot . '/theme/image.php/standard/core/1379534589/req"></label></div>';
+    $html_div .= '<div class="felement fselect">';
+    $html_div .= '<span id="iassign_file_link" style="color:#000000;"><a href="' . $fileurl . '" target="_blank" title="' . get_string('download_file', 'iassign') . $filename . '">' . $filename . '</a></span>';
+    if($fileurl != "")
+      $html_div .= '&nbsp;&nbsp;&nbsp;';
+    $html_div .= '<input onclick="view_ilm_manager()" name="add_ilm" value="' . get_string('add_ilm', 'iassign') . '" type="button" id="id_add_ilm"/>';
+    $html_div .= '</div>';
+    $html_div .= '</div>';
+    $mform->addElement('html', $html_div);
+
+    //Applies only iLM iGeom
+    $mform->addElement('selectyesno', 'special_param1', get_string('special_param', 'iassign')); //$ynoptions
+    $mform->setDefault('special_param1', 0);
+    $mform->addHelpButton('special_param1', 'helpspecial_param', 'iassign');
+
+    ///-----------------------------------------------------------------------------
+    //Applies only when the iLM is automatic evaluate.
+    $mform->addElement('header', 'id_automatic_evaluate', get_string('only_automatic_evaluate', 'iassign'));
+
+    // Using automatic evaluation activity? 0 - no / 1 – yes
+    $mform->addElement('selectyesno', 'automatic_evaluate', get_string('automatic_evaluate', 'iassign'), array('onChange' => 'disable_answer(this.value);'));
+    $mform->disabledIf('automatic_evaluate', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    $mform->setDefault('automatic_evaluate', 0);
+    /// @todo Ver código comentado
+    //$mform->addHelpButton('automatic_evaluate', 'helpautomatic_evaluate', 'iassign');
+    //Show automatic evaluation results to students? 0 - no / 1 - yes
+    $mform->addElement('selectyesno', 'show_answer', get_string('show_answer', 'iassign'));
+    $mform->disabledIf('show_answer', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    // $mform->disabledIf('show_answer', 'automatic_evaluate', 'neq', 0);
+    $mform->setDefault('show_answer', 0);
+    //$mform->addHelpButton('show_answer', 'helpshow_answer', 'iassign');
+    ///-----------------------------------------------------------------------------
+    /// Adding the "duration_activity" fieldset, where all the common settings are showed
+    $mform->addElement('header', 'duration_activity', get_string('duration_activity', 'iassign'));
+
+    $mform->addElement('date_time_selector', 'timeavailable', get_string('availabledate', 'iassign'));
+    $mform->setDefault('timeavailable', time());
+    $mform->disabledIf('timeavailable', 'type_iassign', 'eq', 1); ///activity does not display if the type example
+    $mform->addElement('date_time_selector', 'timedue', get_string('duedate', 'iassign'));
+    $mform->setDefault('timedue', time() + 7 * 24 * 3600);
+    $mform->disabledIf('timedue', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    //
+    //Allow sending late? 0 - no or unlocked / 1 - yes or locked
+    $mform->addElement('selectyesno', 'preventlate', get_string('preventlate', 'iassign'));
+    $mform->setDefault('preventlate', 0);
+    $mform->addHelpButton('preventlate', 'helppreventlate', 'iassign');
+
+    $mform->disabledIf('preventlate', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    $mform->disabledIf('preventlate', 'type_iassign', 'eq', 2); //activity does not display if the type test
+    //Allow test after delivery? 0 - no or unlocked / 1 - yes or locked
+    $mform->addElement('selectyesno', 'test', get_string('permission_test', 'iassign'));
+    $mform->setDefault('test', 0);
+    $mform->addHelpButton('test', 'helptest', 'iassign');
+
+    $mform->disabledIf('test', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    $mform->disabledIf('test', 'type_iassign', 'eq', 2); //activity does not display if the type test
+    ///--------------
+    $mform->addElement('header', 'op_val', get_string('op_val', 'iassign'));
+
+    $mform->addElement('modgrade', 'grade', get_string('grade', 'iassign'));
+    $mform->setDefault('grade', 100);
+    $mform->disabledIf('grade', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    $mform->disabledIf('grade', 'type_iassign', 'eq', 2); //activity does not display if the type test
+
+    $max_experiment_options = array(0 => get_string('ilimit', 'iassign'));
+    for ($i = 1; $i <= 20; $i++)
+      $max_experiment_options[$i] = $i;
+
+    $mform->addElement('select', 'max_experiment', get_string('experiment', 'iassign'), $max_experiment_options);
+    $mform->setDefault('max_experiment', 0);
+    $mform->addHelpButton('max_experiment', 'helpexperiment', 'iassign');
+    $mform->disabledIf('max_experiment', 'type_iassign', 'eq', 1); //activity does not display if the type example
+    $mform->disabledIf('max_experiment', 'type_iassign', 'eq', 2); //activity does not display if the type test
+
+    if($COURSE->iassign_list) {
+      ///-------------- dependency
+      $mform->addElement('header', 'headerdependency', get_string('dependency', 'iassign'));
+      $mform->addHelpButton('headerdependency', 'helpdependency', 'iassign');
+
+      foreach ($COURSE->iassign_list as $iassign) {
+        $tmp = 'iassign_list[' . $iassign->id . ']';
+        if($iassign->enable == 1)
+          $mform->addElement('checkbox', $tmp, $iassign->name);
+      } //foreach ($COURSE->iassign_list as $iassign)
+    } //if ($COURSE->iassign_list)
+
+    $mform->addElement('hidden', 'dependency');
+    $mform->setType('dependency', PARAM_RAW);
+
+    ///-------------- config
+    $mform->addElement('header', 'config', get_string('general', 'iassign'));
+    $visibleoptions = array(1 => get_string('show'), 0 => get_string('hide'));
+
+    $mform->addElement('select', 'visible', get_string('visible', 'iassign'), $visibleoptions);
+    $mform->setDefault('visible', 0);
+
+    //-------------------------------------------------------------------------------
+    // Hidden fields
+    $mform->addElement('hidden', 'action');
+    $mform->setType('action', PARAM_TEXT);
+    $mform->addElement('hidden', 'oldname');
+    $mform->setType('oldname', PARAM_TEXT);
+    $mform->addElement('hidden', 'id');
+    $mform->setType('id', PARAM_TEXT);
+    $mform->addElement('hidden', 'iassign_id');
+    $mform->setType('iassign_id', PARAM_TEXT);
+    $mform->addElement('hidden', 'file', '0');
+    $mform->setType('file', PARAM_INT);
+    $mform->addElement('hidden', 'filename');
+    $mform->setType('filename', PARAM_TEXT);
+    $mform->addElement('hidden', 'fileold');
+    $mform->setType('fileold', PARAM_TEXT);
+    $mform->addElement('hidden', 'iassignid');
+    $mform->setType('iassignid', PARAM_TEXT);
+    $mform->addElement('hidden', 'author_name');
+    $mform->setType('author_name', PARAM_TEXT);
+    $mform->addElement('hidden', 'author_modified_name');
+    $mform->setType('author_modified_name', PARAM_TEXT);
+    $mform->addElement('hidden', 'timecreated');
+    $mform->setType('timecreated', PARAM_TEXT);
+    $mform->addElement('hidden', 'position');
+    $mform->setType('position', PARAM_TEXT);
+
+    $mform->addElement('html', $code_javascript);
+    // add standard elements, common to all modules
+    $this->add_action_buttons();
+  }
+
+  function validation ($data, $files) {
+    global $COURSE, $DB;
+    $errors = parent::validation($data, $files);
+    $mform = & $this->_form;
+    $errors = array();
+
+    if($mform->elementExists('name')) {
+      $value = trim($data['name']);
+      if($value == '') {
+        $errors['name'] = get_string('required', 'iassign');
+      }
+    }
+
+    if($mform->elementExists('proposition')) {
+      $value = trim($data['proposition']);
+      if($value == '') {
+        $errors['proposition'] = get_string('required', 'iassign');
+      }
+    }
+
+    if($mform->elementExists('file')) {
+      $value = trim($data['file']);
+      if($value == 0) {
+        $errors['iassign_ilmid'] = get_string('required_iassign_file', 'iassign');
+      }
+    }
+    return $errors;
+  }
+
+}

BIN
icon/add.gif


BIN
icon/add_iassign.gif


BIN
icon/add_ilm_iassign.gif


BIN
icon/add_param.gif


BIN
icon/addgreen.gif


BIN
icon/block.gif


BIN
icon/comment_close red.gif


BIN
icon/comment_close_green.gif


BIN
icon/comment_close_red1.gif


BIN
icon/comment_close_yellown.gif


BIN
icon/comment_read.gif


BIN
icon/comment_unread.gif


BIN
icon/config_ilm.gif


BIN
icon/confirm.gif


BIN
icon/copy_ilm.gif


BIN
icon/copy_param.gif


BIN
icon/correct.gif


BIN
icon/default_ilm.gif


BIN
icon/default_ilm_disabled.gif


BIN
icon/delete2.gif


BIN
icon/delete_assign_disable.gif


BIN
icon/delete_dir.gif


BIN
icon/delete_dir_disable.gif


BIN
icon/delete_iassign.gif


BIN
icon/delete_ilm.gif


BIN
icon/delete_ilm_disable.gif


BIN
icon/delete_param.gif


BIN
icon/dir.gif


BIN
icon/down_disable.gif


BIN
icon/download_all_assign.gif


BIN
icon/download_all_assign_disabled.gif


BIN
icon/download_assign.gif


BIN
icon/duplicate_iassign.gif


BIN
icon/edit_iassign.gif


BIN
icon/edit_iassign_disable.gif


BIN
icon/edit_ilm.gif


BIN
icon/edit_param.gif


BIN
icon/example.gif


BIN
icon/export_ilm.gif


BIN
icon/feedback_correct.gif


BIN
icon/feedback_incorrect.gif


BIN
icon/file.gif


BIN
icon/hbar_blue.gif


BIN
icon/hbar_blue_l.gif


BIN
icon/hbar_blue_r.gif


BIN
icon/hbar_green.gif


BIN
icon/hbar_green_l.gif


BIN
icon/hbar_green_r.gif


BIN
icon/hbar_orange.gif


BIN
icon/hbar_orange_l.gif


BIN
icon/hbar_orange_r.gif


BIN
icon/hbar_red.gif


BIN
icon/hbar_red_l.gif


BIN
icon/hbar_red_r.gif


BIN
icon/help_ilm.gif


BIN
icon/hide_iassign.gif


BIN
icon/hide_ilm.gif


BIN
icon/hide_param.gif


BIN
icon/home.gif


BIN
icon/icon.gif


BIN
icon/incorrect.gif


+ 9 - 0
icon/index.html

@@ -0,0 +1,9 @@
+<html>
+    <head>
+        <title>Acess not allowed! - Acesso não permitido</title>
+    </head>
+    <body style="color: #FF0000">
+        <p>Acesso não permitido!</p>
+        <p>Acess not allowed!</p>
+    </body>
+</html>

BIN
icon/left_disable.gif


BIN
icon/move_down_iassign.gif


BIN
icon/move_up_iassign.gif


BIN
icon/next_activity.gif


BIN
icon/next_student.gif


BIN
icon/next_student_activity.gif


BIN
icon/no_edit_iassign.gif


BIN
icon/not_post.gif


BIN
icon/open_dir.gif


+ 0 - 0
icon/post.gif


Some files were not shown because too many files changed in this diff