Browse Source

Update several codes in 2019/04/03 (now allow admin user to export all NASA-TLX answers)

Leonidas O Brandao 6 years ago
parent
commit
aeb76746b6

+ 36 - 0
classes/event/course_module_instance_list_viewed.php

@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * The mod_nasatlx submission created event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\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_nasatlx\event\course_module_instance_list_viewed::create($params);
+    $event->add_record_snapshot('course', $course);
+    return $event;
+    }
+
+  }

+ 70 - 0
classes/event/course_module_viewed.php

@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * The mod_nasatlx course module viewed event.
+ *
+ * Reach this event after administrative feature to export/list NASA-TLX/LInE questionnaires.
+ * 
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\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'] = 'nasatlx';
+    }
+
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventcoursemoduleviewed', 'mod_nasatlx');
+    }
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+
+    return array($this->courseid, 'nasatlx', '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.');
+      }
+    }
+
+  }

+ 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>

+ 71 - 0
classes/event/nasatlx_created.php

@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * The mod_nasatlx created event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class nasatlx_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'] = 'nasatlx';
+    }
+
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventnasatlxcreated', 'mod_nasatlx');
+    }
+
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', '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.');
+      }
+    }
+
+  }

+ 71 - 0
classes/event/nasatlx_deleted.php

@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * The mod_nasatlx deleted event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class nasatlx_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'] = 'nasatlx';
+    }
+
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventnasatlxdeleted', 'mod_nasatlx');
+    }
+
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+        "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', 'delete nasatlx',
+                 "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.');
+      }
+    }
+
+  }

+ 65 - 0
classes/event/nasatlx_updated.php

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * The mod_nasatlx updated event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class nasatlx_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'] = 'nasatlx';
+    }
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventnasatlxupdated', 'mod_nasatlx');
+    }
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', '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.');
+      }
+    }
+
+  }

+ 65 - 0
classes/event/submission_created.php

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * The mod_nasatlx submission created event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\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'] = 'nasatlx';
+    }
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventsubmissioncreated', 'mod_nasatlx');
+    }
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', '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.');
+      }
+    }
+
+  }

+ 65 - 0
classes/event/submission_updated.php

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * The mod_nasatlx submission updated event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\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'] = 'nasatlx';
+    }
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventsubmissionupdated', 'mod_nasatlx');
+    }
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', '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.');
+      }
+    }
+
+  }

+ 65 - 0
classes/event/submission_viewed.php

@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * The mod_nasatlx submission viewed event.
+ *
+ * @author    Leônidas O. Brandão
+ * @version   v 0.1 2019/03/04
+ * @package   mod_nasatlx
+ * @category  event
+ * @since     2019/03/04
+ * @copyright LInE (line.ime.usp.br) - Computer Science Dep. of IME-USP (Brazil)
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
+ */
+
+namespace mod_nasatlx\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'] = 'nasatlx';
+    }
+
+  /// Returns localised general event name.
+  //  @return string
+  public static function get_name () {
+    return get_string('eventsubmissionviewed', 'mod_nasatlx');
+    }
+
+  /// 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 NASA-TLX/LInE with id '$this->objectid' in " .
+           "the NASA-TLX/LInE 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/nasatlx/view.php', array('id' => $this->contextinstanceid));
+    }
+
+  /// Return the legacy event log data.
+  //  @return array|null
+  public function get_legacy_logdata () {
+    return array($this->courseid, 'nasatlx', '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>

+ 90 - 36
db/access.php

@@ -25,48 +25,102 @@
  *
  * The variable name for the capability definitions array is $capabilities
  *
+ * @author Leônidas O. Brandão
+ * @version v 1.0 2014/01/01
+ * @since 2014/01/01
  * @package    mod_nasatlx
- * @copyright  2014 LInE - http://line.ime.usp.br
+ * @copyright  2014 LInE - http://line.ime.usp.br - Computer Science Dep. of IME-USP (Brazil)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
 defined('MOODLE_INTERNAL') || die();
 
 $capabilities = array(
-/***************************** remove these comment marks and modify the code as needed
-
- 'mod/nasatlx:addinstance' => array(
-   'riskbitmask' => RISK_XSS,
-
-   'captype' => 'write',
-   'contextlevel' => CONTEXT_COURSE,
-   'archetypes' => array(
-     'editingteacher' => CAP_ALLOW,
-     'manager' => CAP_ALLOW
-   ),
-   'clonepermissionsfrom' => 'moodle/course:manageactivities'
- ),
-
-    'mod/nasatlx:view' => array(
-        'captype' => 'read',
-        'contextlevel' => CONTEXT_MODULE,
-        'legacy' => array(
-            'guest' => CAP_ALLOW,
-            'student' => CAP_ALLOW,
-            'teacher' => CAP_ALLOW,
-            'editingteacher' => CAP_ALLOW,
-            'admin' => CAP_ALLOW
-        )
+  'mod/nasatlx: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/nasatlx:editnasatlx' => array(
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:evaluatenasatlx' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:viewnasatlxall' => array(
+    'captype' => 'read',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:viewreport' => array(
+    'captype' => 'read',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'teacher' => CAP_ALLOW,
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:submitnasatlx' => array(
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'student' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:deletenasatlxnull' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'editingteacher' => CAP_ALLOW,
+      'coursecreator' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:deletenasatlxnotnull' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_MODULE,
+    'legacy' => array(
+      'manager' => CAP_ALLOW
+    )
+  ),
+  'mod/nasatlx:addinstance' => array(
+    'riskbitmask' => RISK_XSS,
+    'captype' => 'write',
+    'contextlevel' => CONTEXT_COURSE,
+    'archetypes' => array(
+      'editingteacher' => CAP_ALLOW,
+      'manager' => CAP_ALLOW
     ),
-
-    'mod/nasatlx:submit' => array(
-        'riskbitmask' => RISK_SPAM,
-        'captype' => 'write',
-        'contextlevel' => CONTEXT_MODULE,
-        'legacy' => array(
-            'student' => CAP_ALLOW
-        )
-    ),
-******************************/
+    'clonepermissionsfrom' => 'moodle/course:manageactivities'
+  ),
 );
-

+ 6 - 10
db/install.xml

@@ -28,26 +28,22 @@
         <FIELD NAME="scale2" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale1" NEXT="scale3"/>
         <FIELD NAME="scale3" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale2" NEXT="scale4"/>
         <FIELD NAME="scale4" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale3" NEXT="scale5"/>
-        <FIELD NAME="scale5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale4" NEXT="scale6"/>
-        <FIELD NAME="scale6" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale5" NEXT="calc1"/>
+        <FIELD NAME="scale5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale4" NEXT="calc1"/>
 
-        <FIELD NAME="calc1" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale6" NEXT="calc2"/>
+        <FIELD NAME="calc1" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="scale5" NEXT="calc2"/>
         <FIELD NAME="calc2" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc1" NEXT="calc3"/>
         <FIELD NAME="calc3" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc2" NEXT="calc4"/>
         <FIELD NAME="calc4" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc3" NEXT="calc5"/>
-        <FIELD NAME="calc5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc4" NEXT="calc6"/>
-        <FIELD NAME="calc6" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc5" NEXT="peso1"/>
+        <FIELD NAME="calc5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc4" NEXT="peso1"/>
 
-        <FIELD NAME="peso1" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc6" NEXT="peso2"/>
+        <FIELD NAME="peso1" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="calc5" NEXT="peso2"/>
         <FIELD NAME="peso2" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso1" NEXT="peso3"/>
         <FIELD NAME="peso3" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso2" NEXT="peso4"/>
         <FIELD NAME="peso4" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso3" NEXT="peso5"/>
-        <FIELD NAME="peso5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso4" NEXT="peso6"/>
-        <FIELD NAME="peso6" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso5" NEXT="pares"/>
+        <FIELD NAME="peso5" TYPE="float" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" PREVIOUS="peso4" NEXT="cm_id"/>
 
-        <FIELD NAME="pares" TYPE="text" LENGHT="2000" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" PREVIOUS="peso6" NEXT="cmid"/>
 
-        <FIELD NAME="cmid" TYPE="text" LENGHT="200" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" PREVIOUS="pares" NEXT="course"/>
+        <FIELD NAME="cmid" TYPE="text" LENGHT="200" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" PREVIOUS="peso5" NEXT="course"/>
         <FIELD NAME="course" TYPE="text" LENGHT="200" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" PREVIOUS="cm_id" NEXT="user"/>
         <FIELD NAME="user" TYPE="text" LENGHT="200" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" PREVIOUS="course" NEXT="created"/>
         <FIELD NAME="created" TYPE="datetime" NOTNULL="false" SEQUENCE="false" PREVIOUS="user" />

+ 39 - 121
db/upgrade.php

@@ -23,127 +23,45 @@ defined('MOODLE_INTERNAL') || die();
  * @param int $oldversion
  * @return bool
  */
-function xmldb_nasatlx_upgrade($oldversion) {
-    global $DB;
-
-    $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
-
-    // And upgrade begins here. For each one, you'll need one
-    // block of code similar to the next one. Please, delete
-    // this comment lines once this file start handling proper
-    // upgrade code.
-
-    // if ($oldversion < YYYYMMDD00) { //New version in version.php
-    //
-    // }
-
-    // Lines below (this included)  MUST BE DELETED once you get the first version
-    // of your module ready to be installed. They are here only
-    // for demonstrative purposes and to show how the nasatlx
-    // iself has been upgraded.
-
-    // For each upgrade block, the file nasatlx/version.php
-    // needs to be updated . Such change allows Moodle to know
-    // that this file has to be processed.
-
-    // To know more about how to write correct DB upgrade scripts it's
-    // highly recommended to read information available at:
-    //   http://docs.moodle.org/en/Development:XMLDB_Documentation
-    // and to play with the XMLDB Editor (in the admin menu) and its
-    // PHP generation posibilities.
-
-    // First example, some fields were added to install.xml on 2007/04/01
-    if ($oldversion < 2007040100) {
-
-        // Define field course to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $field = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id');
-
-        // Add field course
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Define field intro to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null,'name');
-
-        // Add field intro
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Define field introformat to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
-            'intro');
-
-        // Add field introformat
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Once we reach this point, we can store the new version and consider the module
-        // upgraded to the version 2007040100 so the next time this block is skipped
-        upgrade_mod_savepoint(true, 2007040100, 'nasatlx');
-    }
-
-    // Second example, some hours later, the same day 2007/04/01
-    // two more fields and one index were added to install.xml (note the micro increment
-    // "01" in the last two digits of the version
-    if ($oldversion < 2007040101) {
-
-        // Define field timecreated to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
-            'introformat');
-
-        // Add field timecreated
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Define field timemodified to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
-            'timecreated');
-
-        // Add field timemodified
-        if (!$dbman->field_exists($table, $field)) {
-            $dbman->add_field($table, $field);
-        }
-
-        // Define index course (not unique) to be added to nasatlx
-        $table = new xmldb_table('nasatlx');
-        $index = new xmldb_index('courseindex', XMLDB_INDEX_NOTUNIQUE, array('course'));
-
-        // Add index to course field
-        if (!$dbman->index_exists($table, $index)) {
-            $dbman->add_index($table, $index);
-        }
-
-        // Another save point reached
-        upgrade_mod_savepoint(true, 2007040101, 'nasatlx');
-    }
-
-    // Third example, the next day, 2007/04/02 (with the trailing 00), some actions were performed to install.php,
-    // related with the module
-    if ($oldversion < 2007040200) {
-
-        // insert here code to perform some actions (same as in install.php)
-
-        upgrade_mod_savepoint(true, 2007040200, 'nasatlx');
-    }
-
-    // And that's all. Please, examine and understand the 3 example blocks above. Also
-    // it's interesting to look how other modules are using this script. Remember that
-    // the basic idea is to have "blocks" of code (each one being executed only once,
-    // when the module version (version.php) is updated.
-
-    // Lines above (this included) MUST BE DELETED once you get the first version of
-    // yout module working. Each time you need to modify something in the module (DB
-    // related, you'll raise the version and add one upgrade block here.
+
+function xmldb_nasatlx_upgrade ($oldversion) {
+  global $DB;
+
+  $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
+
+  //D echo "./mod/nasatlx/db/upgrade.php: entrou xmldb_nasatlx_upgrade, oldversion=$oldversion<br/>";
+
+  //D General form to update after new version
+  // if ($oldversion < YYYYMMDD00) { //New version in version.php
+  //   }
+
+  // add_to_log() has been deprecated, please rewrite your code to the new events API
+  // line 50 of /lib/deprecatedlib.php: call to debugging()
+  // line 45 of /mod/nasatlx/view.php: call to add_to_log()
+
+  // The initial version of NASA-TLX does not defined capabilities, fix it with 'access.php'!
+  if ($oldversion < 2019030100) {
+
+    // get_records_sql
+    // get_recordset_sql
+    //DEBUG To test NASA-TLX capabilities in table '*_capabilities': id name captype contextlevel component riskbitmask
+    //D $list_nasalti_capabilities = $DB->get_records_sql("SELECT * FROM {capabilities} WHERE component='mod_nasatlx';");
+    //D $num_cap = sizeof($list_nasalti_capabilities);
+    //D echo "./mod/nasatlx/db/upgrade.php: #list_nasalti_capabilities=" . sizeof($list_nasalti_capabilities) . "<br/>";
+    //D print_r($list_nasalti_capabilities); echo "<br/>";
+
+    //D exit; // foreach ();
+
+    //D if ($num_cap == 0) {
+    //D   $newentry = new stdClass();
 
     // Final return of upgrade result (true, all went good) to Moodle.
     return true;
-}
+    } // if ($oldversion < 2019030400)
+
+  //D echo "./mod/nasatlx/db/upgrade.php: fim 'xmldb_nasatlx_upgrade(...)'<br/>";
+  } // function xmldb_nasatlx_upgrade($oldversion)
+
+// First this script is loaded, after it the 'xmldb_nasatlx_upgrade($oldversion)' is executed
+
+//D echo "./mod/nasatlx/db/upgrade.php: fim<br/>";

+ 2 - 0
grade.php

@@ -3,6 +3,8 @@
 /**
  * Redirect the user to the appropriate submission related page
  *
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package   mod_nasatlx
  * @category  grade
  * @copyright 2014 LInE - http://line.ime.usp.br

+ 2 - 0
index.php

@@ -7,6 +7,8 @@
  * You can have a rather longer description of the file as well,
  * if you like, and it can span multiple lines.
  *
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package    mod_nasatlx
  * @copyright  2014 LInE
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

+ 25 - 28
lang/en/nasatlx.php

@@ -1,40 +1,37 @@
 <?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/>.
-
-
 /**
  * English strings for nasatlx
  *
  * You can have a rather longer description of the file as well,
  * if you like, and it can span multiple lines.
  *
- * @package    mod_nasatlx
- * @copyright  2011 Your Name
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package   mod_nasatlx
+ * @version v 0.1 2019/03/04
+ * @category  grade
+ * @copyright 2014 LInE - http://line.ime.usp.br
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
 defined('MOODLE_INTERNAL') || die();
 
-$string['modulename'] = 'nasatlx';
-$string['modulenameplural'] = 'nasatlxs';
-$string['modulename_help'] = 'Use the nasatlx module for... | The nasatlx module allows...';
-$string['nasatlxfieldset'] = 'Custom example fieldset';
-$string['nasatlxname'] = 'nasatlx name';
-$string['nasatlxname_help'] = 'This is the content of the help tooltip associated with the nasatlxname field. Markdown syntax is supported.';
-$string['nasatlx'] = 'nasatlx';
-$string['pluginadministration'] = 'nasatlx administration';
-$string['pluginname'] = 'nasatlx';
+$string['modulename'] = 'NASA-TLX (LInE-IME-USP)';
+$string['modulenameplural'] = 'NASA-TLX by LInE/IME/USP';
+$string['modulename_help'] = 'Use the NASA-TLX (by LInE) to compare the users perception related to two different implementations of any course/software';
+
+//$string[''] = '';
+$string['config_nasatlx']                     = 'Insert NASA-TLX/LInE block';
+$string['view_nasatlx']                       = 'View all questionnaire NASA-TLX/LInE';
+$string['list_all_nasatlx']                   = 'List all NASA-TLX/LInE questionnaires in all courses';
+$string['list_all_nasatlx_empty']             = 'There is none NASA-TLX questionnaire';
+$string['list_all_nasatlx_ans_empty']         = 'There is none answer to this NASA-TLX questionnaire';
+$string['export_all_nasatlx'] = 'Export all NASA-TLX/LInE questionnaires in all courses';
+$string['export_all_nasatlx_help'] = 'With this option you can export all NASA-TLX/LInE questionnaires in all courses, with all the students\' answer';
+
+$string['nasatlxfieldset'] = 'Personalized example about fieldset';
+$string['nasatlxname'] = 'NASA-TLX/LInE';
+$string['nasatlxname_help'] = 'The module NASA-TLX/LInE is an implementation of NASA-TLX protocol to verify the impact of ' .
+        'two different courses (or implementations) over the users\' perceptions.';
+$string['nasatlx'] = 'NASA-TLX (LInE)';
+$string['pluginadministration'] = 'NASA-TLX/LInE Administration';
+$string['pluginname'] = 'NASA-TLX (LInE-IME-USP): administrative area';

+ 37 - 0
lang/pt_br/nasatlx.php

@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Portuguese/Brazil strings for NASA-TLX by LInE
+ *
+ * You can have a rather longer description of the file as well,
+ * if you like, and it can span multiple lines.
+ *
+ * @package   mod_nasatlx
+ * @version v 0.1 2019/03/04
+ * @category  grade
+ * @copyright 2014 LInE - http://line.ime.usp.br
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$string['modulename'] = 'NASA-TLX (LInE-IME-USP)';
+$string['modulenameplural'] = 'NASA-TLX do LInE/IME/USP';
+$string['modulename_help'] = 'Use o NASA-TLX (do LInE) para comparar a percepção cognitiva sobre usuários para comparar duas implementações sobr o Moodle';
+
+//$string[''] = '';
+$string['config_nasatlx']                     = 'Insira bloco NASA-TLX/LInE';
+$string['view_nasatlx']                       = 'Visualizar todos os questionários NASA-TLX/LInE';
+$string['list_all_nasatlx']                   = 'Listar todos os questionários em todos os cursos';
+$string['list_all_nasatlx_empty']             = 'Não existe sequer um questionário NASA-TLX';
+$string['list_all_nasatlx_ans_empty']         = 'Não existe respostas para esse questionário NASA-TLX';
+$string['export_all_nasatlx'] = 'Exportar todos os questionários em todos os cursos';
+$string['export_all_nasatlx_help'] = 'Com esta opção você pode exportar todos os questionários NASA-TLX/LInE, em todos os cursos, com os todos os dados de todos os alunos';
+
+$string['nasatlxfieldset'] = 'Exemplo de personalizados de conjunto de campos';
+$string['nasatlxname'] = 'NASA-TLX/LInE';
+$string['nasatlxname_help'] = 'O módulo NASA-TLX/LInE é uma implementação do protocolo NASA-TLX para testar o impacto, ' .
+        'quanto à percepção da carga congnitiva sobre usuários, comparando-se duas implementações';
+$string['nasatlx'] = 'NASA-TLX (LInE)';
+$string['pluginadministration'] = 'Administração do NASA-TLX/LInE';
+$string['pluginname'] = 'NASA-TLX (LInE-IME-USP): administrative area';

+ 239 - 303
lib.php

@@ -1,380 +1,316 @@
 <?php
 
 /**
- * Library of interface functions and constants for module nasatlx
- *
- * All the core Moodle functions, neeeded to allow the module to work
- * integrated in Moodle should be placed here.
- * All the nasatlx specific functions, needed to implement all the module
- * logic, should go to locallib.php. This will help to save some memory when
+ * Library of interface functions and constants for module nasatlx from LInE-IME-USP.
+ * All the core Moodle functions, neeeded to allow the module to work integrated in Moodle should be placed here.
+ * All the nasatlx specific functions, needed to implement all the module logic, should go to locallib.php.
+ * This will help to save some memory when
  * Moodle is performing actions across all modules.
- *
+ * 
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package    mod_nasatlx
  * @copyright  2014 LInE - http://line.ime.usp.br
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
+ **/
 
 defined('MOODLE_INTERNAL') || die();
 
-/** example constant */
+/// example constant
 //define('NEWMODULE_ULTIMATE_ANSWER', 42);
 
-////////////////////////////////////////////////////////////////////////////////
-// Moodle core API                                                            //
-////////////////////////////////////////////////////////////////////////////////
 
-/**
- * Returns the information on whether the module supports a feature
- *
- * @see plugin_supports() in lib/moodlelib.php
- * @param string $feature FEATURE_xx constant for requested feature
- * @return mixed true if the feature is supported, null if unknown
- */
+ /// Returns the information on whether the module supports a feature
+ //  @see plugin_supports() in lib/moodlelib.php
+ //  @param string $feature FEATURE_xx constant for requested feature
+ //  @return mixed true if the feature is supported, null if unknown
 function nasatlx_supports($feature) {
-    switch($feature) {
-        case FEATURE_MOD_INTRO:         return true;
-        case FEATURE_SHOW_DESCRIPTION:  return true;
+  switch($feature) {
+     case FEATURE_MOD_INTRO:         return true;
+     case FEATURE_SHOW_DESCRIPTION:  return true;
 
-        default:                        return null;
+     default:                        return null;
     }
-}
-
-/**
- * Saves a new instance of the nasatlx into the database
- *
- * Given an object containing all the necessary data,
- * (defined by the form in mod_form.php) this function
- * will create a new instance and return the id number
- * of the new instance.
- *
- * @param object $nasatlx An object from the form in mod_form.php
- * @param mod_nasatlx_mod_form $mform
- * @return int The id of the newly inserted nasatlx record
- */
+  }
+
+ /// Saves a new instance of the nasatlx into the database
+ //  Given an object containing all the necessary data,
+ //  (defined by the form in mod_form.php) this function
+ //  will create a new instance and return the id number
+ //  of the new instance.
+ //  @param object $nasatlx An object from the form in mod_form.php
+ //  @param mod_nasatlx_mod_form $mform
+ //  @return int The id of the newly inserted nasatlx record
 function nasatlx_add_instance(stdClass $nasatlx, mod_nasatlx_mod_form $mform = null) {
-    global $DB;
+  global $DB;
 
-    $nasatlx->timecreated = time();
+  $nasatlx->timecreated = time();
 
-    # You may have to add extra stuff in here #
+  # You may have to add extra stuff in here #
 
-    return $DB->insert_record('nasatlx', $nasatlx);
-}
+  return $DB->insert_record('nasatlx', $nasatlx);
+  }
 
-/**
- * Updates an instance of the nasatlx in the database
- *
- * Given an object containing all the necessary data,
- * (defined by the form in mod_form.php) this function
- * will update an existing instance with new data.
- *
- * @param object $nasatlx An object from the form in mod_form.php
- * @param mod_nasatlx_mod_form $mform
- * @return boolean Success/Fail
- */
+ /// Updates an instance of the nasatlx in the database
+ //  Given an object containing all the necessary data,
+ //  (defined by the form in mod_form.php) this function
+ //  will update an existing instance with new data.
+ //  @param object $nasatlx An object from the form in mod_form.php
+ //  @param mod_nasatlx_mod_form $mform
+ //  @return boolean Success/Fail
 function nasatlx_update_instance(stdClass $nasatlx, mod_nasatlx_mod_form $mform = null) {
-    global $DB;
+  global $DB;
 
-    $nasatlx->timemodified = time();
-    $nasatlx->id = $nasatlx->instance;
+  $nasatlx->timemodified = time();
+  $nasatlx->id = $nasatlx->instance;
 
-    # You may have to add extra stuff in here #
+  # You may have to add extra stuff in here #
 
-    return $DB->update_record('nasatlx', $nasatlx);
-}
+  return $DB->update_record('nasatlx', $nasatlx);
+  }
 
-/**
- * Removes an instance of the nasatlx from the database
- *
- * Given an ID of an instance of this module,
- * this function will permanently delete the instance
- * and any data that depends on it.
- *
- * @param int $id Id of the module instance
- * @return boolean Success/Failure
- */
+ /// Removes an instance of the nasatlx from the database
+ //  Given an ID of an instance of this module,
+ //  this function will permanently delete the instance
+ //  and any data that depends on it.
+ //  @param int $id Id of the module instance
+ //  @return boolean Success/Failure
 function nasatlx_delete_instance($id) {
-    global $DB;
+  global $DB;
 
-    if (! $nasatlx = $DB->get_record('nasatlx', array('id' => $id))) {
-        return false;
+  if (! $nasatlx = $DB->get_record('nasatlx', array('id' => $id))) {
+     return false;
     }
 
-    # Delete any dependent records here #
+  # Delete any dependent records here #
 
-    $DB->delete_records('nasatlx', array('id' => $nasatlx->id));
+  $DB->delete_records('nasatlx', array('id' => $nasatlx->id));
 
-    return true;
-}
+  return true;
+  }
 
-/**
- * Returns a small object with summary information about what a
- * user has done with a given particular instance of this module
- * Used for user activity reports.
- * $return->time = the time they did it
- * $return->info = a short text description
- *
- * @return stdClass|null
- */
+ /// Returns a small object with summary information about what a
+ //  user has done with a given particular instance of this module
+ //  Used for user activity reports.
+ //  $return->time = the time they did it
+ //  $return->info = a short text description
+ //  @return stdClass|null
 function nasatlx_user_outline($course, $user, $mod, $nasatlx) {
 
-    $return = new stdClass();
-    $return->time = 0;
-    $return->info = '';
-    return $return;
-}
-
-/**
- * Prints a detailed representation of what a user has done with
- * a given particular instance of this module, for user activity reports.
- *
- * @param stdClass $course the current course record
- * @param stdClass $user the record of the user we are generating report for
- * @param cm_info $mod course module info
- * @param stdClass $nasatlx the module instance record
- * @return void, is supposed to echp directly
- */
+  $return = new stdClass();
+  $return->time = 0;
+  $return->info = '';
+  return $return;
+  }
+
+ /// Prints a detailed representation of what a user has done with
+ //  a given particular instance of this module, for user activity reports.
+ //  @param stdClass $course the current course record
+ //  @param stdClass $user the record of the user we are generating report for
+ //  @param cm_info $mod course module info
+ //  @param stdClass $nasatlx the module instance record
+ //  @return void, is supposed to echp directly
 function nasatlx_user_complete($course, $user, $mod, $nasatlx) {
-}
+  }
 
-/**
- * Given a course and a time, this module should find recent activity
- * that has occurred in nasatlx activities and print it out.
- * Return true if there was output, or false is there was none.
- *
- * @return boolean
- */
+ /// Given a course and a time, this module should find recent activity
+ //  that has occurred in nasatlx activities and print it out.
+ //  Return true if there was output, or false is there was none.
+ //  @return boolean
 function nasatlx_print_recent_activity($course, $viewfullnames, $timestart) {
-    return false;  //  True if anything was printed, otherwise false
-}
-
-/**
- * Prepares the recent activity data
- *
- * This callback function is supposed to populate the passed array with
- * custom activity records. These records are then rendered into HTML via
- * {@link nasatlx_print_recent_mod_activity()}.
- *
- * @param array $activities sequentially indexed array of objects with the 'cmid' property
- * @param int $index the index in the $activities to use for the next record
- * @param int $timestart append activity since this time
- * @param int $courseid the id of the course we produce the report for
- * @param int $cmid course module id
- * @param int $userid check for a particular user's activity only, defaults to 0 (all users)
- * @param int $groupid check for a particular group's activity only, defaults to 0 (all groups)
- * @return void adds items into $activities and increases $index
- */
+  return false;  //  True if anything was printed, otherwise false
+  }
+
+ /// Prepares the recent activity data
+ //  This callback function is supposed to populate the passed array with
+ //  custom activity records. These records are then rendered into HTML via
+ //  {@link nasatlx_print_recent_mod_activity()  }.
+ //  @param array $activities sequentially indexed array of objects with the 'cmid' property
+ //  @param int $index the index in the $activities to use for the next record
+ //  @param int $timestart append activity since this time
+ //  @param int $courseid the id of the course we produce the report for
+ //  @param int $cmid course module id
+ //  @param int $userid check for a particular user's activity only, defaults to 0 (all users)
+ //  @param int $groupid check for a particular group's activity only, defaults to 0 (all groups)
+ //  @return void adds items into $activities and increases $index
 function nasatlx_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
-}
+  }
 
-/**
- * Prints single activity item prepared by {@see nasatlx_get_recent_mod_activity()}
+ /// Prints single activity item prepared by {@see nasatlx_get_recent_mod_activity()  }
 
- * @return void
- */
+ //  @return void
 function nasatlx_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) {
-}
+  }
 
-/**
- * Function to be run periodically according to the moodle cron
- * This function searches for things that need to be done, such
- * as sending out mail, toggling flags etc ...
- *
- * @return boolean
- * @todo Finish documenting this function
- **/
+ /// Function to be run periodically according to the moodle cron
+ //  This function searches for things that need to be done, such
+ //  as sending out mail, toggling flags etc ...
+ //  @return boolean
+ //  @todo Finish documenting this function
 function nasatlx_cron () {
-    return true;
-}
+  return true;
+  }
 
-/**
- * Returns all other caps used in the module
- *
- * @example return array('moodle/site:accessallgroups');
- * @return array
- */
+ /// Returns all other caps used in the module
+ //  @example return array('moodle/site:accessallgroups');
+ //  @return array
 function nasatlx_get_extra_capabilities() {
-    return array();
-}
+  return array();
+  }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Gradebook API                                                              //
 ////////////////////////////////////////////////////////////////////////////////
 
-/**
- * Is a given scale used by the instance of nasatlx?
- *
- * This function returns if a scale is being used by one nasatlx
- * if it has support for grading and scales. Commented code should be
- * modified if necessary. See forum, glossary or journal modules
- * as reference.
- *
- * @param int $nasatlxid ID of an instance of this module
- * @return bool true if the scale is used by the given nasatlx instance
- */
+ /// Is a given scale used by the instance of nasatlx?
+ //  This function returns if a scale is being used by one nasatlx
+ //  if it has support for grading and scales. Commented code should be
+ //  modified if necessary. See forum, glossary or journal modules
+ //  as reference.
+ //  @param int $nasatlxid ID of an instance of this module
+ //  @return bool true if the scale is used by the given nasatlx instance
 function nasatlx_scale_used($nasatlxid, $scaleid) {
-    global $DB;
-
-    /** @example */
-    if ($scaleid and $DB->record_exists('nasatlx', array('id' => $nasatlxid, 'grade' => -$scaleid))) {
-        return true;
-    } else {
-        return false;
+  global $DB;
+  /// @example
+  if ($scaleid and $DB->record_exists('nasatlx', array('id' => $nasatlxid, 'grade' => -$scaleid))) {
+     return true;
+     }
+  else {
+    return false;
     }
-}
+  }
 
-/**
- * Checks if scale is being used by any instance of nasatlx.
- *
- * This is used to find out if scale used anywhere.
- *
- * @param $scaleid int
- * @return boolean true if the scale is used by any nasatlx instance
- */
+ /// Checks if scale is being used by any instance of nasatlx.
+ //  This is used to find out if scale used anywhere.
+ //  @param $scaleid int
+ //  @return boolean true if the scale is used by any nasatlx instance
 function nasatlx_scale_used_anywhere($scaleid) {
-    global $DB;
-
-    /** @example */
-    if ($scaleid and $DB->record_exists('nasatlx', array('grade' => -$scaleid))) {
-        return true;
-    } else {
-        return false;
+  global $DB;
+  /// @example
+  if ($scaleid and $DB->record_exists('nasatlx', array('grade' => -$scaleid))) {
+     return true;
+     } 
+  else {
+    return false;
     }
-}
+  }
 
-/**
- * Creates or updates grade item for the give nasatlx instance
- *
- * Needed by grade_update_mod_grades() in lib/gradelib.php
- *
- * @param stdClass $nasatlx instance object with extra cmidnumber and modname property
- * @param mixed optional array/object of grade(s); 'reset' means reset grades in gradebook
- * @return void
- */
+ /// Creates or updates grade item for the give nasatlx instance
+ //  Needed by grade_update_mod_grades() in lib/gradelib.php
+ //  @param stdClass $nasatlx instance object with extra cmidnumber and modname property
+ //  @param mixed optional array/object of grade(s); 'reset' means reset grades in gradebook
+ //  @return void
 function nasatlx_grade_item_update(stdClass $nasatlx, $grades=null) {
-    global $CFG;
-    require_once($CFG->libdir.'/gradelib.php');
-
-    /** @example */
-    $item = array();
-    $item['itemname'] = clean_param($nasatlx->name, PARAM_NOTAGS);
-    $item['gradetype'] = GRADE_TYPE_VALUE;
-    $item['grademax']  = $nasatlx->grade;
-    $item['grademin']  = 0;
-
-    grade_update('mod/nasatlx', $nasatlx->course, 'mod', 'nasatlx', $nasatlx->id, 0, null, $item);
-}
-
-/**
- * Update nasatlx grades in the gradebook
- *
- * Needed by grade_update_mod_grades() in lib/gradelib.php
- *
- * @param stdClass $nasatlx instance object with extra cmidnumber and modname property
- * @param int $userid update grade of specific user only, 0 means all participants
- * @return void
- */
+  global $CFG;
+  require_once($CFG->libdir.'/gradelib.php');
+
+  /// @example
+  $item = array();
+  $item['itemname'] = clean_param($nasatlx->name, PARAM_NOTAGS);
+  $item['gradetype'] = GRADE_TYPE_VALUE;
+  $item['grademax']  = $nasatlx->grade;
+  $item['grademin']  = 0;
+
+  grade_update('mod/nasatlx', $nasatlx->course, 'mod', 'nasatlx', $nasatlx->id, 0, null, $item);
+  }
+
+ /// Update nasatlx grades in the gradebook
+ //  Needed by grade_update_mod_grades() in lib/gradelib.php
+ //  @param stdClass $nasatlx instance object with extra cmidnumber and modname property
+ //  @param int $userid update grade of specific user only, 0 means all participants
+ //  @return void
 function nasatlx_update_grades(stdClass $nasatlx, $userid = 0) {
-    global $CFG, $DB;
-    require_once($CFG->libdir.'/gradelib.php');
+  global $CFG, $DB;
+  require_once($CFG->libdir.'/gradelib.php');
 
-    /** @example */
-    $grades = array(); // populate array of grade objects indexed by userid
+  /// @example
+  $grades = array(); // populate array of grade objects indexed by userid
 
-    grade_update('mod/nasatlx', $nasatlx->course, 'mod', 'nasatlx', $nasatlx->id, 0, $grades);
-}
+  grade_update('mod/nasatlx', $nasatlx->course, 'mod', 'nasatlx', $nasatlx->id, 0, $grades);
+  }
 
 ////////////////////////////////////////////////////////////////////////////////
 // File API                                                                   //
 ////////////////////////////////////////////////////////////////////////////////
 
-/**
- * Returns the lists of all browsable file areas within the given module context
- *
- * The file area 'intro' for the activity introduction field is added automatically
- * by {@link file_browser::get_file_info_context_module()}
- *
- * @param stdClass $course
- * @param stdClass $cm
- * @param stdClass $context
- * @return array of [(string)filearea] => (string)description
- */
+ /// Returns the lists of all browsable file areas within the given module context
+ //  The file area 'intro' for the activity introduction field is added automatically
+ //  by {@link file_browser::get_file_info_context_module()  }
+ //  @param stdClass $course
+ //  @param stdClass $cm
+ //  @param stdClass $context
+ //  @return array of [(string)filearea] => (string)description
 function nasatlx_get_file_areas($course, $cm, $context) {
-    return array();
-}
-
-/**
- * File browsing support for nasatlx file areas
- *
- * @package mod_nasatlx
- * @category files
- *
- * @param file_browser $browser
- * @param array $areas
- * @param stdClass $course
- * @param stdClass $cm
- * @param stdClass $context
- * @param string $filearea
- * @param int $itemid
- * @param string $filepath
- * @param string $filename
- * @return file_info instance or null if not found
- */
+  return array();
+  }
+
+ /// File browsing support for nasatlx file areas
+ //  @package mod_nasatlx
+ //  @category files
+ //  @param file_browser $browser
+ //  @param array $areas
+ //  @param stdClass $course
+ //  @param stdClass $cm
+ //  @param stdClass $context
+ //  @param string $filearea
+ //  @param int $itemid
+ //  @param string $filepath
+ //  @param string $filename
+ //  @return file_info instance or null if not found
 function nasatlx_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
-    return null;
-}
-
-/**
- * Serves the files from the nasatlx file areas
- *
- * @package mod_nasatlx
- * @category files
- *
- * @param stdClass $course the course object
- * @param stdClass $cm the course module object
- * @param stdClass $context the nasatlx's context
- * @param string $filearea the name of the file area
- * @param array $args extra arguments (itemid, path)
- * @param bool $forcedownload whether or not force download
- * @param array $options additional options affecting the file serving
- */
-function nasatlx_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload, array $options=array()) {
-    global $DB, $CFG;
-
-    if ($context->contextlevel != CONTEXT_MODULE) {
-        send_file_not_found();
-    }
-
-    require_login($course, true, $cm);
-
+  return null;
+  }
+
+ /// Serves the files from the nasatlx file areas
+ //  @package mod_nasatlx
+ //  @category files
+ //  @param stdClass $course the course object
+ //  @param stdClass $cm the course module object
+ //  @param stdClass $context the nasatlx's context
+ //  @param string $filearea the name of the file area
+ //  @param array $args extra arguments (itemid, path)
+ //  @param bool $forcedownload whether or not force download
+ //  @param array $options additional options affecting the file serving
+function nasatlx_pluginfile ($course, $cm, $context, $filearea, array $args, $forcedownload, array $options=array()) {
+  global $DB, $CFG;
+  if ($context->contextlevel != CONTEXT_MODULE) {
     send_file_not_found();
-}
+    }
+  require_login($course, true, $cm);
+  send_file_not_found();
+  }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Navigation API                                                             //
 ////////////////////////////////////////////////////////////////////////////////
 
-/**
- * Extends the global navigation tree by adding nasatlx nodes if there is a relevant content
- *
- * This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.
- *
- * @param navigation_node $navref An object representing the navigation tree node of the nasatlx module instance
- * @param stdClass $course
- * @param stdClass $module
- * @param cm_info $cm
- */
+ /// Extends the global navigation tree by adding nasatlx nodes if there is a relevant content
+ //  This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.
+ //  @param navigation_node $navref An object representing the navigation tree node of the nasatlx module instance
+ //  @param stdClass $course
+ //  @param stdClass $module
+ //  @param cm_info $cm
 function nasatlx_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, cm_info $cm) {
-}
+  }
 
-/**
- * Extends the settings navigation with the nasatlx settings
- *
- * This function is called when the context for the page is a nasatlx module. This is not called by AJAX
- * so it is safe to rely on the $PAGE.
- *
- * @param settings_navigation $settingsnav {@link settings_navigation}
- * @param navigation_node $nasatlxnode {@link navigation_node}
- */
+ //  Extends the settings navigation with the nasatlx settings
+ //  This function is called when the context for the page is a nasatlx module. This is not called by AJAX
+ //  so it is safe to rely on the $PAGE.
+ //  @param settings_navigation $settingsnav {@link settings_navigation  }
+ //  @param navigation_node $nasatlxnode {@link navigation_node  }
 function nasatlx_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $nasatlxnode=null) {
-}
+  }
+
+
+// Used in: settings.php
+function is_debugging ($level = null, $debugdisplay = null) {
+  global $CFG, $USER;
+  // $CFG->debug = (int)$level;
+  // $CFG->debugdeveloper = (($CFG->debug & DEBUG_DEVELOPER) === DEBUG_DEVELOPER);
+  // echo "lib.php: is_debugging: debugdisplay=" . $CFG->debugdisplay . ", USER=$USER<br/>";
+  //echo "lib.php: is_debugging: NO_DEBUG_DISPLAY=" . NO_DEBUG_DISPLAY . ", USER=$USER<br/>";
+  if (!NO_DEBUG_DISPLAY) return true; // NO_DEBUG_DISPLAY is object
+  //if (!isset($CFG->debugdisplay) && $USER) return true;
+  return false;
+  }
+

+ 5 - 0
locallib.php

@@ -1,11 +1,16 @@
 <?php
 
 /**
+ * This is an implementation of Nasa TLX protocol provided by Laboratory of Informatics in Education (LInE) - IME - USP
+ * LInE is coordinate by Leônidas de Oliveira Brandão (Computer Science Department at IME - USP).
+ *
  * Internal library of functions for module nasatlx
  *
  * All the nasatlx specific functions, needed to implement the module
  * logic, should go here. Never include this file from your lib.php!
  *
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package    mod_nasatlx
  * @copyright  2014 LInE - http://line.ime.usp.br
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

+ 4 - 1
mod_form.php

@@ -6,6 +6,8 @@
  * It uses the standard core Moodle formslib. For more info about them, please
  * visit: http://docs.moodle.org/en/Development:lib/formslib.php
  *
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package    mod_nasatlx
  * @copyright  2014 LInE - http://line.ime.usp.br
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -43,7 +45,8 @@ class mod_nasatlx_mod_form extends moodleform_mod {
         $mform->addHelpButton('name', 'nasatlxname', 'nasatlx');
 
         // Adding the standard "intro" and "introformat" fields
-        $this->add_intro_editor();
+        //Moodle 2: $this->add_intro_editor();
+        $this->standard_intro_elements(); //Moodle 3
 
         //-------------------------------------------------------------------------------
         // Adding the rest of nasatlx settings, spreeading all them into this fieldset

+ 0 - 199
nasatlx_leo_mac115_2015.php

@@ -1,199 +0,0 @@
-<?php
-
-// 2016/04/18
-// Dados do curso: "2015_2 - MAC115 - Introdução à Computação para Ciências Exatas e Tecnologia"
-// http://www.usp.br/line/mooc/course/view.php?id=21
-// Curso para IAG semestre 2 de 2015
-
-// Questionario NASA-TLX
-// Itens: "Demanda mental", "Demanda fisica", "Demanda de tempo", "Desempenho", "Esforco", "Frustracao"
-
-// O '$LST = 1' e' melhor para gerar tabelas para o R
-// $LST = 0; // 0 => lista por colunas (colunas formadas com todas as resposta dos alunos para cada tipo 'scale, peso ou calc')
-$LST = 1; // 1 => lista por linhas (cada linha tem as resposta de todos os alunos para cada tipo 'scale, peso ou calc')
-
-// $conn = mysql_connect("localhost", "root", "XYZAdminLMDlA00--"); // no 'www.usp.br/line/mooc'
-$conn = mysql_connect("localhost", "root", "sawgeo"); 
-$db = mysql_select_db("moodle2_6_1_2014_02");
-
-//$query = ""; echo "Aqui: " . $query . "<br/>"; exit;
-
-//$query_a = mysql_query("SELECT m_course.*, m_nasatlx.course as cid, m_nasatlx.name from m_nasatlx, m_course where m_nasatlx.course = m_course.id");
-//$query = "SELECT * FROM m_nasatlx_resps";
-$query = "SELECT * FROM m_nasatlx_resps GROUP BY cmid"; // group para evitar repetir
-$query_a = mysql_query($query);
-$cont = 0;
-
-// m_modules.id = 28 ; name = nasatlx
-// m_course = 21, 24
-// SELECT id,course,module,instance FROM m_course_modules WHERE m_course_modules.course = 21 AND m_course_modules.module = 28;
-// * 2015: MAC115: Detectando dificuldades em Introducao a Programacao
-//   m_course_modules : id,course,module,instance = 1446 24 28 25
-//   m_course_modules : id,course,module,instance = 1483 24 28 26
-// * "2015_2 - MAC115 - Introducao a Computacao para Ciencias Exatas e Tecnologia"
-//   m_course_modules : id,course,module,instance = 1195 21 28 23
-//   m_course_modules : id,course,module,instance = 1196 21 28 24
-
-// * 2015: MAC115: Detectando dificuldades em Introducão à Programacão
-//   m_course_modules.course = 24 => http://www.usp.br/line/mooc/course/view.php?id=24
-//     http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1446   Ao terminarem os exercícios: Avaliação de carga de trabalho
-//     http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1483   Ao terminarem os exercícios: Avaliação de carga de trabalho
-
-// * "2015_2 - MAC115 - Introdução à Computação para Ciências Exatas e Tecnologia"
-//   m_course_modules.course = 21 => http://www.usp.br/line/mooc/course/view.php?id=21
-//     http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1195   Nasa-TLX: questionário 1 sobre iVProg
-//     http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1196   Nasa-TLX: questionário 1 sobre VPL (linguagem C)
-
-// echo $query . "<br/>";
-
-// MAC115 - Semestre
-//  Nasa-TLX: questionário 1 sobre VPL (linguagem C)
-//   1196 : http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1196
-//  Nasa-TLX: questionário 1 sobre iVProg
-//   1195 : http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1195
-// MAC115 - Dificuldades
-//   1446 : http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1446
-//   1483 : http://www.usp.br/line/mooc/mod/nasatlx/view.php?id=1483 (ainda nao respondido!)
-// $vet_cmid = array(1446, 1483, 1195, 1196); // digitar aqui o vetor com todos os ''
-
-// MOOC - VPL 
-// Turma 1 -- VPL = http://localhost/mooc/course/view.php?id=2
-//  1. Algoritmos
-//      30  Nasa TLX - Como foram as atividades? -- http://localhost/mooc/mod/nasatlx/view.php?id=30
-//  2. Selecao
-//     193  Nasa TLX - Como foram as atividades? -- http://localhost/mooc/mod/nasatlx/view.php?id=193
-// MOOC - iVprog Java
-// Turma 2 -- iVProg Java = http://localhost/mooc/course/view.php?id=4
-//  1. Algoritmos
-//      68  MOOC - iVProg Java -- http://localhost/mooc/mod/nasatlx/view.php?id=68
-//  2. Selecao
-//     209  Nasa TLX - Como foram as atividades? -- http://localhost/mooc/mod/nasatlx/view.php?id=209
-$vet_cmid = array(30, 193, 68, 209, 1446, 1483, 1195, 1196); // digitar aqui o vetor com todos os ''
-
-$cmids = array(); // digitar aqui o vetor com todos os ''
-$cmids[1446] = "MAC115 - Dificuldades - Quinzena1";
-$cmids[1483] = "MAC115 - Dificuldades - Quinzena1";
-$cmids[1195] = "MAC115 - questionario 1 iVProg";
-$cmids[1196] = "MAC115 - questionario 1 VPL";
-$cmids[30]   = "MOOC - VPL : Turma 1 : 1. Algoritmos";
-$cmids[193]  = "MOOC - VPL : Turma 1 : 2. Selecao";
-$cmids[68]   = "MOOC - iVprog Java : Turma 2 : 1. Algoritmos";
-$cmids[209]  = "MOOC - iVprog Java : Turma 2 : 2. Selecao";
-
-/*
-// Listando respostas de questionario Nasa-TLX por
-while ($row = mysql_fetch_array($query_a)) {
-  $m_modules_id = intVal(strval(($row["cmid"])));
-  if (!in_array($m_modules_id, $vet_cmid))
-    continue;
-  echo "<h2>" . $cmids[$m_modules_id] . " " ." (m_modules.id = " . $m_modules_id . ") " . $row["cmid"] . "</h2>\n";
-  $query_r = mysql_query("SELECT * FROM m_nasatlx_resps WHERE cmid = " . $row["cmid"]);
-  echo "scale1;scale2;scale3;scale4;scale5;scale6;peso1;peso2;peso3;peso4;peso5;peso6;calc1;calc2;calc3;calc4;calc5;calc6\n";
-
-  while ($row2 = mysql_fetch_array($query_r)) {
-    echo 
-      $row2["scale1"] . ";" .
-      $row2["scale2"] . ";" .
-      $row2["scale3"] . ";" .
-      $row2["scale4"] . ";" .
-      $row2["scale5"] . ";" .
-      $row2["scale6"] . ";";
-    echo 
-      $row2["peso1"] . ";" .
-      $row2["peso2"] . ";" .
-      $row2["peso3"] . ";" .
-      $row2["peso4"] . ";" .
-      $row2["peso5"] . ";" .
-      $row2["peso6"] . ";";
-    echo 
-      $row2["calc1"] . ";" .
-      $row2["calc2"] . ";" .
-      $row2["calc3"] . ";" .
-      $row2["calc4"] . ";" .
-      $row2["calc5"] . ";" .
-      $row2["calc6"] . ";\n";
-    } // while ($row2 = mysql_fetch_array($query_r))
-  } // while ($row = mysql_fetch_array($query_a))
-*/
-
-
-
-// $LST = 0 => lista por colunas (colunas formadas com todas as resposta dos alunos para cada tipo 'scale, peso ou calc')
-// $LST = 1 => lista por linhas (cada linha tem as resposta de todos os alunos para cada tipo 'scale, peso ou calc')
-if ($LST==1) {
-
-  // Listando questionario Nasa-TLX por item
-  while ($row = mysql_fetch_array($query_a)) { // "SELECT * FROM m_nasatlx_resps GROUP BY cmid"
-
-    $m_modules_id = intVal(strval(($row["cmid"])));
-    if (!in_array($m_modules_id, $vet_cmid))
-      continue;
-    echo "<h3>" . $cmids[$m_modules_id] . " " ." (m_modules.id = " . $m_modules_id . ") " . $row["cmid"] . "</h3>\n";
-    // echo $cmids[intVal(strval(($row["cmid"])))]. " " ." - " . intVal(strval(($row["cmid"])))."\n";
-
-    $query_r = mysql_query("SELECT * FROM m_nasatlx_resps WHERE cmid = " . $row["cmid"] . " AND user > 7");
-
-    echo "ESCALA";
-    while ($row2 = mysql_fetch_array($query_r)) { // "SELECT * FROM m_nasatlx_resps WHERE cmid = " . $row["cmid"] . " AND user > 7"
-      echo ";" . $row2["user"] . "";
-      }
-    echo "<br/>\n";
-
-    mysql_data_seek($query_r, 0);
-
-    $escalas = array(); // array("scale1","scale2","scale3","scale4","scale5","scale6","peso1","peso2","peso3","peso4","peso5","peso6","calc1","calc2","calc3","calc4","calc5","calc6");
-    for ($i=0; $i<6; $i++) $escalas[] = "scale" . ($i+1);
-    for ($i=0; $i<6; $i++) $escalas[] = "peso" . ($i+1);
-    for ($i=0; $i<6; $i++) $escalas[] = "calc" . ($i+1);
-
-    foreach ($escalas as $e) {
-      mysql_data_seek($query_r, 0);
-      echo $e . "";
-      while ($row2 = mysql_fetch_array($query_r)) {
-        echo ";" . str_replace(".", ",", $row2[$e]);
-        }
-      echo "<br/>\n";
-      }
-
-    } // while ($row = mysql_fetch_array($query_a))
-
-  } // if ($LST==1)
-else { // else if ($LST==1)
-
-  //D echo "#vet_cmid = " . count($vet_cmid) . "<br/>\n";
-
-  // Listando questionarios Nasa-TLX
-  // Dados: "scale1","scale2","scale3","scale4","scale5","scale6","peso1","peso2","peso3","peso4","peso5","peso6","calc1","calc2","calc3","calc4","calc5","calc6"
-  for ($ii=0; $ii<count($vet_cmid); $ii++) {
-
-    // m_nasatlx_resps : id scale1 scale2 scale3 scale4 scale5 scale6 calc1 calc2 calc3 calc4 calc5 calc6 peso1 peso2 peso3 peso4 peso5 peso6 cmid course user created 
-    $query_questionario = "SELECT * FROM m_nasatlx_resps WHERE cmid = " . $vet_cmid[$ii] . " AND user > 7"; // nao pegar admins -  GROUP BY cmid
-    $result_questionario = mysql_query($query_questionario) or die(mysql_error());
-    $num1 = mysql_affected_rows(); // número de linhas removidas
-
-    //D echo "ii=$ii : vet_cmid[$ii]=$vet_cmid[$ii] : $query_questionario: $result_questionario => #=" . $num1 . "<br/>";
-
-    // Pegando dados do questionario $ii
-    for ($jj=0; $jj<$num1; $jj++) {
-      $row = mysql_fetch_array($result_questionario);
-      if (!$row)
-        continue;
-      $m_modules_id = intVal(strval(($row["cmid"])));
-      if ($jj==0)
-        echo "<h3>" . $cmids[$m_modules_id] . " " ." (m_modules.id = " . $m_modules_id . ") </h3>\n";
-
-      // cmid , course , user , created , scale1 , scale2 , scale3 , scale4 , scale5 , scale6 , peso1 , peso2 , peso3 , peso4 , peso5 , peso6 , calc1 , calc2 , calc3 , calc4 , calc5 , calc6
-      echo $row["cmid"] . ";" . $row["course"] . ";" . $row["user"] . ";" . $row["created"] . ";" .
-           $row["scale1"] . ";" . $row["scale2"] . ";" . $row["scale3"] . ";" . $row["scale4"] . ";" . $row["scale5"] . ";" . $row["scale6"] . ";" .
-           $row["peso1"] . ";" . $row["peso2"] . ";" . $row["peso3"] . ";" . $row["peso4"] . ";" . $row["peso5"] . ";" . $row["peso6"] . ";" .
-           $row["calc1"] . ";" . $row["calc2"] . ";" . $row["calc3"] . ";" . $row["calc4"] . ";" . $row["calc5"] . ";" . $row["calc6"] . "<br/>\n";
-      } // for ($jj=0; $jj<$num1; $jj++)
-
-    }  //for ($ii=0; $ii<count($vet_cmid); $ii)
-
-  } // else if ($LST==1)
-
-
-//echo "||" . $cont;
-
-?>

+ 0 - 85
nasatlx_pesq.php

@@ -1,85 +0,0 @@
-<?php
-
- // @copyright  2014 LInE - http://line.ime.usp.br
-
- $conn = mysql_connect("localhost", "root", "XYZAdminLMDlA00--");
- $db = mysql_select_db("moodle2_6_1_2014_02");
-
- //$query_a = mysql_query("select m_course.*, m_nasatlx.course as cid, m_nasatlx.name from m_nasatlx, m_course where m_nasatlx.course = m_course.id");
- $query_a = mysql_query("select * from m_nasatlx_resps where user in (115,49,15,100,122,158,180,112,193,130,137,138,41,75,210,174,37,165,102) group by cmid");
- $cont = 0;
-
- $cmids = array();
- $cmids[30] = "1 - T1";
- $cmids[193] = "2.4 - T1";
- $cmids[196] = "2.x Desafio - T1";
- $cmids[309] = "3.4 - T1";
- $cmids[314] = "Discursiva - T1";
-
-
- $cmids[68] = "1 - T2";
- $cmids[203] = "2 - T2";
- $cmids[204] = "2 Desafio - T2";
- $cmids[321] = "3.4 - T2";
- $cmids[324] = "Discursiva - T2";
-
- $cmids[88] = "1 - T3";
- $cmids[209] = "2 - T3";
- $cmids[215] = "2 Desafio - T3";
- $cmids[330] = "3.4 - T3";
- $cmids[333] = "Discursiva - T3";
-
-
-
- while ($d = mysql_fetch_array($query_a)) {
-  print $cmids[intVal(strval(($d["cmid"])))]. " " ." - " . intVal(strval(($d["cmid"])))."\n";
-  $query_r = mysql_query("select * from m_nasatlx_resps where  user in (115,49,15,100,122,158,180,112,193,130,137,138,41,75,210,174,37,165,102) and cmid = ".$d["cmid"]." and user > 7");
-  print "ESCALA";
-  while($d2 = mysql_fetch_array($query_r)){
-    print ";".$d2["user"]."";
-    }
-  print "\n";
-  
-  mysql_data_seek($query_r, 0);
-
-  $escalas = array();
-  for($i=0;$i<6;$i++)
-   $escalas[] = "scale".($i+1);
-  for($i=0;$i<6;$i++)
-   $escalas[] = "peso".($i+1);
-  for($i=0;$i<6;$i++)
-   $escalas[] = "calc".($i+1);
-
-  foreach($escalas as $e){
-    mysql_data_seek($query_r, 0);
-    print $e."";
-    while ($d2 = mysql_fetch_array($query_r)) {
-      print ";".str_replace(".", ",", $d2[$e]);
-      }
-    print "\n";
-    }
-
-  /*while($d2 = mysql_fetch_array($query_r)){
-   print 
-    $d2["scale1"].";".
-    $d2["scale2"].";".
-    $d2["scale3"].";".
-    $d2["scale4"].";".
-    $d2["scale5"].";".
-    $d2["scale6"].";";
-   print 
-    $d2["peso1"].";".
-    $d2["peso2"].";".
-    $d2["peso3"].";".
-    $d2["peso4"].";".
-    $d2["peso5"].";".
-    $d2["peso6"].";";
-   print 
-    $d2["calc1"].";".
-    $d2["calc2"].";".
-    $d2["calc3"].";".
-    $d2["calc4"].";".
-    $d2["calc5"].";".
-    $d2["calc6"].";\n";
-  }*/
-   }

+ 0 - 63
nasatlx_romenig.php

@@ -1,63 +0,0 @@
-<pre><?
-	$conn = mysql_connect("localhost", "root", "XYZAdminLMDlA00--");
-	$db = mysql_select_db("moodle2_6_1_2014_02");
-
-	//$query_a = mysql_query("select m_course.*, m_nasatlx.course as cid, m_nasatlx.name from m_nasatlx, m_course where m_nasatlx.course = m_course.id");
-	$query_a = mysql_query("select * from m_nasatlx_resps group by cmid");
-	$cont = 0;
-
-	$cmids = array();
-	$cmids[30] = "1 Exercícios - T1";
-	$cmids[193] = "2 Exercícios - T1";
-	$cmids[196] = "2 Desafio - T1";
-	$cmids[309] = "3 Exercícios - T1";
-	$cmids[314] = "3 Discursiva - T1";
-
-	$cmids[68] = "1 Exercícios - T2";
-	$cmids[203] = "2 Exercícios - T2";
-	$cmids[204] = "2 Desafio - T2";
-	$cmids[321] = "3 Exercícios - T2";
-	$cmids[324] = "3 Discursiva - T2";
-
-	$cmids[88] = "1 Exercícios - T3";
-	$cmids[209] = "2 Exercícios - T3";
-	$cmids[215] = "2 Desafio - T3";
-	$cmids[330] = "3 Exercícios - T3";
-	$cmids[333] = "3 Discursiva - T3";
-
-?>
-<? while($d = mysql_fetch_array($query_a)){ ?>
-			<h2><? echo $cmids[intVal(strval(($d["cmid"])))]. " " ." - " . intVal(strval(($d["cmid"]))); ?></h2>
-<?
-				$query_r = mysql_query("select * from m_nasatlx_resps where cmid = ".$d["cmid"]);
-				echo "scale1;scale2;scale3;scale4;scale5;scale6;peso1;peso2;peso3;peso4;peso5;peso6;calc1;calc2;calc3;calc4;calc5;calc6\n";
-				
-				while($d2 = mysql_fetch_array($query_r)){
-					echo 
-						$d2["scale1"].";".
-						$d2["scale2"].";".
-						$d2["scale3"].";".
-						$d2["scale4"].";".
-						$d2["scale5"].";".
-						$d2["scale6"].";";
-					echo 
-						$d2["peso1"].";".
-						$d2["peso2"].";".
-						$d2["peso3"].";".
-						$d2["peso4"].";".
-						$d2["peso5"].";".
-						$d2["peso6"].";";
-					echo 
-						$d2["calc1"].";".
-						$d2["calc2"].";".
-						$d2["calc3"].";".
-						$d2["calc4"].";".
-						$d2["calc5"].";".
-						$d2["calc6"].";\n";
-				}
-			?>
-		<? 
-			}
-
-			echo "||".$cont;
-		 ?>

BIN
pix/icon.gif


BIN
pix/icon.png


+ 112 - 0
settings.php

@@ -0,0 +1,112 @@
+<?php
+
+/**
+ * 
+ * This PHP script is invoked by Moodle every time it enters at Admin section (./admin/search.php).
+ * It provides a link to the NASA-TLX/LInE general configurations area ('pluginname').
+ * 
+ * @package   mod_nasatlx
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
+ * @category  
+ * @copyright 2014 LInE - http://line.ime.usp.br
+ * @license   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();
+
+global $OUTPUT, $CFG, $DB;
+require_once($CFG->dirroot . '/mod/nasatlx/lib.php');
+require_once($CFG->dirroot . '/mod/nasatlx/locallib.php');
+
+$action = optional_param('action', 'view', PARAM_TEXT);
+$ilm_id = optional_param('ilm_id', 0, PARAM_INT);
+$ilm_param_id = optional_param('ilm_param_id', 0, PARAM_INT);
+$ilm_id_parent = optional_param('ilm_id_parent', 0, PARAM_INT);
+$status = optional_param('status', 0, PARAM_INT);
+
+if (!$action && !$ilm_id) {
+  return; // nothing to be done (it is the Admin entering at the initial administrative section)
+  }
+
+//D echo "/mod/nasatlx/settings.php: action=$action<br/>";
+/*
+if ($action == 'visible') {
+  ilm_settings::visible_ilm($ilm_id, $status);
+  $action = 'config';
+  $ilm_id = $ilm_id_parent;
+  }
+else
+if ($action == 'visible_param') {
+  ilm_settings::visible_param($ilm_param_id, $status);
+  $action = 'config';
+  }
+else
+if ($action == 'export') {
+  ilm_settings::export_ilm($ilm_id);
+  $action = 'config';
+  }
+*/
+$str = '';
+//D if (!file_exists($CFG->dirroot . '/blocks/nasatlx_block/version.php')) {
+//D   $str .= $OUTPUT->box_start();
+//D   $str .= '<center>' . $OUTPUT->error_text(get_string('error_check_nasatlx_block', 'nasatlx')) . '</center>';
+//D   $str .= $OUTPUT->box_end();
+//D   }
+
+if ($action == 'view') {
+  //  echo "settings.php: action==view<br/>"; exit;
+  $url_export_all = new moodle_url('/mod/nasatlx/settings_nasatlx_line.php', array('action' => 'export'));
+  $action_add = new popup_action('click', $url_export_all, 'popup', array('width' => 900, 'height' => 650));
+  $link_export_all = $OUTPUT->action_link($url_export_all, get_string('export_all_nasatlx', 'nasatlx'), $action_add) . $OUTPUT->help_icon('export_all_nasatlx', 'nasatlx');
+
+  //TODO Implement export all questionnaires NASA-TLX/LInE and their associated data (all of them)
+  //DDD $url_import = new moodle_url('/mod/nasatlx/settings_nasatlx_line.php', array('action' => 'import'));
+  //DDD $action_import = new popup_action('click', $url_import, 'popup', array('width' => 900, 'height' => 650));
+  //DDD $link_import = $OUTPUT->action_link($url_import, get_string('export_nasatlx', 'nasatlx'), $action_import) . $OUTPUT->help_icon('export_nasatlx', 'nasatlx');
+
+  // First list all iLM from type HTML
+  // Table '*_nasatlx'      : id course name intro introformat timecreated timemodified 
+  // Table '*_nasatlx_resps': id scale1 scale2 scale3 scale4 scale5 calc1 calc2 calc3 calc4 calc5 peso1 peso2 peso3 peso4 peso5 cmid course user created
+
+  $nasatlx_list = $DB->get_records_sql("SELECT * FROM {nasatlx} WHERE 1 = 1");
+  //D foreach ($nasatlx_list as $nasa_item) echo " * " . $nasa_item->id . ", " . $nasa_item->course . ", " . $nasa_item->name . ", " . $nasa_item->intro . "<br/>";
+
+  $str .= '<table id="outlinetable" class="generaltable boxaligncenter" cellpadding="5" width="100%">' . chr(13);
+  $str .= '<tr><td colspan=2 align=left>' . $link_export_all . '</td>'; // must be implemented in 'settings_nasatlx_line.php'
+  // $str .= '<td colspan=2 align=right>' . $link_import . '</td></tr>';
+
+  if ($nasatlx_list) {
+
+    foreach ($nasatlx_list as $item_quest) {
+      $url_view_quest = new moodle_url('/admin/settings.php', array('section' => 'modsettingnasatlx', 'action' => 'config', 'ilm_id' => $item_quest->id));
+      //DDD $link_config = $OUTPUT->action_link($url_view_quest, nasatlx_icons::insert('config_ilm'));
+
+      $str .= '  <tr>' . chr(13);
+      $str .= '    <td class="header c1" width=75% title="fields: name, description"><strong>' . $item_quest->name . ' (' . $item_quest->id . ')</strong></td>' . chr(13);
+
+      $str .= '<td class="header c1" width=10% ><strong title="course id">' . $item_quest->course . '</strong></td>' . chr(13);
+      //TODO implement 'search_total_of_answers($id)': return the total of answers in this questionnaire
+      // $str .= '<td class="header c1" width=10% ><strong title="number of answers">' . search_total_of_answers($item_quest->id) . ':</strong></td>' . chr(13);
+      $str .= '</tr>';
+      } // foreach ($nasatlx_list as $item_quest)
+
+    } // if ($nasatlx_list)
+  $str .= '</table>';
+
+  $settings->add(new admin_setting_heading('nasatlx', get_string('view_nasatlx', 'nasatlx') . $OUTPUT->help_icon('modulename', 'nasatlx'), $str));
+
+  } // if ($action == 'view')
+else if ($action == 'confirm_upgrade') {
+  //D print "settings.php: 1 action==confirm_upgrade - to be implemented<br/>";
+  if (is_debugging()) print "nasatlx: settings.php: action==confirm_upgrade - to be implemented<br/>";
+  //  debugging("settings.php: action==confirm_upgrade - to be implemented<br/>", DEBUG_DEVELOPER);
+  } // else if ($action == 'confirm_upgrade')
+
+else if ($action == 'config') { // Administration > plugins > NASA-TLX/LInE : after select the iLM reaches this point
+  //D print "settings.php: action==config - to be implemented<br/>";
+  //debugging("settings.php: action==config - to be implemented<br/>", DEBUG_DEVELOPER);
+  //D if (is_debugging()) // declared in 'lib.php' // NOT WORKING!!!!
+  //D  print "<br/>&bnsp;<br/>&bnsp;<br/>&bnsp;<br/>&bnsp;<br/>&bnsp;<br/>&bnsp;<br/>&bnsp;nasatlx: settings.php: action==config - to be implemented<br/>";
+  }

+ 277 - 0
settings_nasatlx_line.php

@@ -0,0 +1,277 @@
+<?php
+
+/**
+ * Settings NASA-TLX/LInE manager. Reaches this code from administrative Moodle area, in setting 'plugins' of iAssign.
+ * 1. action==export: see a table with all data from NASA-TLX/LInE (all questionnaires, each one with all answers)
+ * 2. action==?
+ * 
+ * Release Notes:
+ * - v 0.1 2019/03/04
+ * 
+ * @package   mod_nasatlx
+ * @author    Leônidas de Oliveira Brandão
+ * @version   v 0.1 2019/03/04
+ * @category  
+ * @copyright 2014 LInE - http://line.ime.usp.br
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+global $CFG, $USER, $PAGE, $OUTPUT, $DB;
+
+require_once("../../config.php");
+require_once($CFG->dirroot . '/mod/nasatlx/locallib.php');
+//DDD require_once($CFG->dirroot . '/mod/nasatlx/settings_form.php');
+
+require_login();
+if (isguestuser()) {
+  die();
+  }
+
+//Parameters GET e POST (parâmetros GET e POST)
+$nasa_id = optional_param('nasa_id', 0, PARAM_INT);
+$action = optional_param('action', NULL, PARAM_TEXT);
+$url = new moodle_url('/admin/settings.php', array('section' => 'modsettingnasatlx'));
+//$from = optional_param('from', NULL, PARAM_TEXT);
+//$status = optional_param('status', 0, PARAM_INT);
+
+$contextuser = context_user::instance($USER->id);
+
+$PAGE->set_url($url);
+$PAGE->set_context($contextuser);
+$PAGE->blocks->show_only_fake_blocks(); //
+$PAGE->set_pagelayout('popup');
+
+//D echo "settings_nasatlx_line.php: 5 action=$action<br/>\n";
+
+if ($action == 'export') {
+  // echo "Export not yet implemented<br/>\n";
+
+  $title = get_string('export_all_nasatlx', 'nasatlx') . $OUTPUT->help_icon('export_all_nasatlx', 'nasatlx');
+  $PAGE->set_title($title);
+  // print($OUTPUT->notification(get_string('error_upload_ilm', 'nasatlx'), 'notifyproblem'));
+  print($OUTPUT->header());
+  print($OUTPUT->heading($title));
+  print "  <style>\n " .
+        " th.c { border: 1px solid #aaa; padding: 5px 10px; background-color: #6a9ada; } " .
+        " th { border: 1px solid #aaa; padding: 5px 10px; background-color: #5a8aca; } " .
+        " .td1l { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeeefe; text-align:left} " .
+        " .td1r { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeeefe; text-align:right} " .
+        " .td2l { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeefee; text-align:left} " .
+        " .td2r { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeefee; text-align:right}\n" .
+        "  </style>\n";
+
+  // Tables: 'nasatlx' (id, course, name, intro, timecreated, timemodified), 'course' (id, fullname)
+  //  SELECT m_nasatlx_resps.id, m_nasatlx_resps.cmid, m_nasatlx_resps.course, m_nasatlx_resps.user FROM m_course_modules, m_nasatlx, m_nasatlx_resps
+  //  WHERE m_nasatlx_resps.cmid=m_course_modules.id  AND  m_course_modules.instance=m_nasatlx.id  AND  m_nasatlx.id = 1;
+  $query1 = "SELECT n.*, c.id AS courseid, c.fullname FROM {nasatlx} n, {course} c WHERE c.id = n.course";
+  //D echo "$query1<br/>";
+
+  $nasatlx_quest = $DB->get_records_sql($query1); // *_nasatlx = id, course, name, intro, timecreated, timemodified
+  // foreach ($nasatlx_quest as $nasa_item) echo " * " . $nasa_item->id . ", " . $nasa_item->course . ", " . $nasa_item->name . ", " . $nasa_item->intro . "<br/>";
+
+  if (!$nasatlx_quest)
+     print get_string('list_all_nasatlx_empty', 'nasatlx') . "<br/>\n";
+  else { // There are NASA questionnaires
+
+    // $nasatlx_quest = Array ( [1] => stdClass Object ( [id] => 1 [course] => 2 [name] => Title questionnaire NASA-TLX/LInE [intro] => Text... [introformat] => 1 [timecreated] => 1551989761 [timemodified] => 0 [courseid] => 2 [fullname] => Curso teste ) )
+    //_ foreach ($nasatlx_quest as $item_nasa_quest) { // usually array[1]
+    //_   print "  <table class='nicetable'>\n";
+    //_   print "    <tr class='td1l'><th class='c' title='course id'>". $item_nasa_quest->courseid . "</th><th class='c' title='course fullname' colspan='24'>" . $item_nasa_quest->fullname . "</th></tr>\n";
+    //_   print "    <tr class='td2l'><th class='c' title='nasatlx id'>". $item_nasa_quest->id . "</th><th class='c' title='nasatlx name' colspan='24'>" . $item_nasa_quest->name . "</th></tr>\n";
+    //_   }
+    //_ print "  </table >\n<br/>\n";
+
+    print "  <table class='nicetable'>\n";      
+    $count1 = 0;
+    foreach ($nasatlx_quest as $item_nasa_quest) { // select all answer to the questionnaire $item_nasa_quest
+      $nasa_id = $item_nasa_quest->id;
+      print "    <tr class='td1l'><th class='c' title='course id'>". $item_nasa_quest->courseid . "</th><th class='c' title='course fullname' colspan='24'>" . $item_nasa_quest->fullname . "</th></tr>\n";
+      print "    <tr class='td2l'><th class='c' title='nasatlx id'>". $item_nasa_quest->id . "</th><th class='c' title='nasatlx name' colspan='24'>" . $item_nasa_quest->name . "</th></tr>\n";
+      // See tables: nasatlx_resps, nasatlx, course_modules, course
+      // $query_str = "SELECT s.id, s.name, s.dependency FROM {iassign_statement} s WHERE s.iassignid = :iassignid ORDER BY s.position ASC";
+      $query2 = "SELECT r.* FROM {nasatlx_resps} r, {course_modules} cm, {nasatlx} tlx WHERE " .
+               "r.cmid=cm.id AND cm.instance=tlx.id AND tlx.id = " . $nasa_id;
+      $nasatlx_answers = $DB->get_records_sql($query2);
+
+      if (!$nasatlx_quest)
+         print get_string('list_all_nasatlx_ans_empty', 'nasatlx') . "<br/r>\n";
+      else {
+        // *_nasatlx : id scale1 scale2 scale3 scale4 scale5 calc1 calc2 calc3 calc4 calc5 peso1 peso2 peso3 peso4 peso5 cmid course user created 
+        // print "    <tr><th>". $item_nasa_quest->id . "</th><th colspan='20'>" . $item_nasa_quest->name . "</th></tr>\n";
+        print "    <tr>\n";
+        print "      <th>id</th><th>scale1</th><th>scale2</th><th>scale3</th><th>scale4</th><th>scale5</th><th>scale6</th>\n" .
+              "      <th>calc1</th><th>calc2</th><th>calc3</th><th>calc4</th><th>calc5</th><th>calc6</th>\n";
+        print "      <th>peso1</th><th>peso2</th><th>peso3</th><th>peso4</th><th>peso5</th><th>peso6</th>\n" .
+              "      <th>pares</th><th>cmid</th><th>course</th><th>user</th><th>created</th></tr>\n";
+        $count2 = 0;
+        foreach ($nasatlx_answers as $answer) { // fields : id scale1 scale2 scale3 scale4 scale5 calc1 calc2 calc3 calc4 calc5 peso1 peso2 peso3 peso4 peso5 cmid course user created
+          print "    <tr>\n";
+          //D if ($count1==0) { echo "answer: "; print_r($answer); echo "<br/>"; }
+
+          foreach ($answer as $nvalue) { // turn the object in array (or use 'foreach ($answer as $nkey=>$nvalue)')
+            $count2++;
+            if ($count1 % 2 == 0) {
+              if ($count2 < 12) print "<td class='td1r'>" .  $nvalue . "</td>";
+              else print "<td class='td1l'>" .  $nvalue . "</td>";
+              }
+            else {
+              if ($count2 < 12) print "<td class='td2r'>" .  $nvalue . "</td>";
+              else print "<td class='td2l'>" .  $nvalue . "</td>";
+              }
+            $count1++;
+            } // foreach ($answer as $nvalue)
+
+          print "    </tr>\n";
+          } // foreach ($nasatlx_answers as $answer)
+        // $nasatlx_answers = $DB->get_records_sql($query2);
+        }
+
+      } // foreach ($nasatlx_quest as $item_nasa_quest)
+
+    print "  </table>\n";
+
+    } // else if (!$nasatlx_quest)
+
+  print "<br/><b>Total respostas: $count1<b><br/>\n";
+
+  print($OUTPUT->footer());
+  die;
+  } // if ($action == 'export')
+/*
+else
+if ($action == 'edit') { // Edit data of an NASA-TLX/LInE => processed in 'settings_form.php'
+  print "Edit not yet implemented<br/>\n";
+  //_ $title = get_string('edit_nasa_item', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $param = ilm_settings::add_edit_copy_nasa_item($nasa_id, $action);
+  //_ $description = $param->description_lang; // used to present the NASA-TLX/LInE description in 'settings_form.php' - {"en":"...","pt":"..."}
+  //_ $mform = new mod_ilm_form($param); // in 'settings_form.php': class mod_ilm_form
+  //_ $mform->set_data($param);
+  //_ if ($mform->is_cancelled()) {
+  //_   close_window();
+  //_   die;
+  //_   }
+  //_ else if ($formdata = $mform->get_submitted_data()) {
+  //_   ilm_settings::edit_nasa_item($formdata, $formdata->file);
+  //_   close_window(0, true);
+  //_   die;
+  //_   }
+  //_ print($OUTPUT->header());
+  //_ print($OUTPUT->heading($title));
+  //_ $mform->display();
+  //_ print($OUTPUT->footer());
+  //_ die;
+  }
+else
+
+if ($action == 'copy') {
+  print "Copy not yet implemented<br/>\n";
+  //_ $title = get_string('copy_nasa_item', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $param = ilm_settings::add_edit_copy_nasa_item($nasa_id, $action);
+
+  //_ $mform = new mod_ilm_form();
+  //_ $mform->set_data($param);
+  //_ if ($mform->is_cancelled()) {
+  //_   close_window();
+  //_   die;
+  //_   }
+  //_ else if ($formdata = $mform->get_data()) {
+  //_   ilm_settings::copy_new_version_ilm($formdata);
+  //_   close_window(0, true);
+  //_   die;
+  //_   }
+
+  //_ print($OUTPUT->header());
+  //_ print($OUTPUT->heading($title));
+  //_ $mform->display();
+  //_ print($OUTPUT->footer());
+  //_ die;
+  }
+else
+
+if ($action == 'confirm_remove_nasa_item') {
+  print "Remove not yet implemented<br/>\n";
+  //_ $title = get_string('remove_nasa_item', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $PAGE->set_pagelayout('base');
+  //_ $remove_nasa_item = ilm_settings::confirm_remove_nasa_item($nasa_id, $ilm_parent);
+  //_ print($OUTPUT->header());
+  //_ print($OUTPUT->heading($title));
+  //_ print($remove_nasa_item);
+  //_ print($OUTPUT->footer());
+  //_ die;
+  //_ }
+else
+
+if ($action == 'remove') {
+  print "Remove not yet implemented<br/>\n";
+  //_ $title = get_string('remove_nasa_item', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $PAGE->set_pagelayout('redirect');
+  //_ $parent = ilm_settings::remove_nasa_item($nasa_id);
+  //_ if ($parent == null) {
+  //_   $title = get_string('remove_nasa_item', 'nasatlx');
+  //_   $PAGE->set_title($title);
+  //_   $PAGE->set_pagelayout('base');
+  //_   $remove_nasa_item = ilm_settings::confirm_remove_nasa_item($nasa_id, $ilm_parent);
+  //_   print($OUTPUT->header());
+  //_   print($OUTPUT->heading($title));
+  //_   print($OUTPUT->notification(get_string('error_folder_permission_denied', 'nasatlx'), 'notifyproblem'));
+  //_   print($remove_nasa_item);
+  //_   print($OUTPUT->footer());
+  //_   die;
+  //_   }
+  //_ if ($parent == 0)
+  //_   redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'view')));
+  //_ else
+  //_   redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm_parent)));
+  //_ }
+else
+
+if ($action == 'default') {
+  //_ $title = get_string('default_ilm', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $PAGE->set_pagelayout('redirect');
+  //_ ilm_settings::default_ilm($nasa_id);
+  //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm_parent)));
+  }
+else
+
+if ($action == 'list') {
+  //_ $title = get_string('list_ilm', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $list_ilm = ilm_settings::list_ilm();
+  //_ print($OUTPUT->header());
+  //_ print($OUTPUT->heading($title . $OUTPUT->help_icon('list_ilm', 'nasatlx')));
+  //_ print($list_ilm);
+  //_ print($OUTPUT->footer());
+  //_ die;
+  }
+else
+
+if ($action == 'upgrade') {
+  //_ $title = get_string('upgrade_ilm_title', 'nasatlx');
+  //_ $PAGE->set_title($title);
+  //_ $PAGE->set_pagelayout('redirect');
+
+  //_ $ilm = ilm_settings::upgrade_ilm($nasa_id);
+  //_ if ($ilm == 0)
+  //_   redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'view')));
+  //_ else
+  //_   redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm)));
+  }
+else
+
+if ($action == 'view') {
+  $nasatlx_ilm = $DB->get_record('nasatlx_ilm', array('id' => $nasa_id));
+  $title = get_string('view_ilm', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx');
+  $PAGE->set_title($title . ': ' . $nasatlx_ilm->name . ' ' . $nasatlx_ilm->version);
+  $view_ilm = ilm_settings::view_ilm($nasa_id, $from);
+  print($OUTPUT->header());
+  print($OUTPUT->heading($title . ': ' . $nasatlx_ilm->name . ' ' . $nasatlx_ilm->version));
+  print($view_ilm);
+  print($OUTPUT->footer());
+  die;
+  }
+*/

+ 0 - 1
teste.php

@@ -1 +0,0 @@
-<?php echo phpinfo(); ?>

+ 10 - 7
version.php

@@ -3,9 +3,12 @@
 /**
  * Defines the version of nasatlx
  *
- * This code fragment is called by moodle_needs_upgrading() and
- * /admin/index.php
+ * This code fragment is called by moodle_needs_upgrading() and ./admin/index.php
  *
+ * This module is an implementation of the NASA-TLX protocol to test 2 different implementation under Moodle.
+ * 
+ * @author Leônidas O. Brandão
+ * @version v 0.1 2019/03/04
  * @package    mod_nasatlx
  * @copyright  2014 LInE - http://line.ime.usp.br
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -13,8 +16,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2010032200;      // The current module version (Date: YYYYMMDDXX)
-$plugin->requires  = 2014021100;      // Requires this Moodle version
-$plugin->cron      = 60;               // Period for cron to check this module (secs)
-$plugin->maturity = MATURITY_STABLE;
-$plugin->component = 'mod_nasatlx'; // To check on upgrade, that module sits in correct place
+$plugin->component = 'mod_nasatlx';   // To check on upgrade, that module sits in correct place
+$plugin->cron      = 0;               // Period for cron to check this module (secs)
+$plugin->maturity = MATURITY_STABLE;  // How stable the plugin is: MATURITY_ALPHA, MATURITY_BETA, MATURITY_RC, MATURITY_STABLE (Moodle 2.0 and above)
+$plugin->requires  = 2010031900;      // Requires this Moodle version
+$plugin->version   = 2019030100;      // 1 = 2014

File diff suppressed because it is too large
+ 114 - 53
view.php


File diff suppressed because it is too large
+ 0 - 571
view.php-


File diff suppressed because it is too large
+ 0 - 545
view_2014_04_21.php