[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/grade/report/grader/yui/src/gradereporttable/js/ -> gradereporttable.js (source)

   1  // This file is part of Moodle - http://moodle.org/
   2  //
   3  // Moodle is free software: you can redistribute it and/or modify
   4  // it under the terms of the GNU General Public License as published by
   5  // the Free Software Foundation, either version 3 of the License, or
   6  // (at your option) any later version.
   7  //
   8  // Moodle is distributed in the hope that it will be useful,
   9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11  // GNU General Public License for more details.
  12  //
  13  // You should have received a copy of the GNU General Public License
  14  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  15  /* eslint-disable no-unused-vars */
  16  
  17  /**
  18   * Grader Report Functionality.
  19   *
  20   * @module    moodle-gradereport_grader-gradereporttable
  21   * @package   gradereport_grader
  22   * @copyright 2014 UC Regents
  23   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   * @author    Alfonso Roman <aroman@oid.ucla.edu>
  25   */
  26  
  27  /**
  28   * @module moodle-gradereport_grader-gradereporttable
  29   */
  30  
  31  var SELECTORS = {
  32          FOOTERTITLE: '.avg .header',
  33          FOOTERCELLS: '#user-grades .avg .cell',
  34          FOOTERROW: '#user-grades .avg',
  35          GRADECELL: 'td.grade',
  36          GRADERTABLE: '.gradeparent table',
  37          GRADEPARENT: '.gradeparent',
  38          HEADERCELLS: '#user-grades .heading .cell',
  39          HEADERCELL: '.gradebook-header-cell',
  40          HEADERROW: '#user-grades tr.heading',
  41          STUDENTHEADER: '#studentheader',
  42          USERCELL: '#user-grades .user.cell',
  43          USERMAIL: '#user-grades .useremail'
  44      },
  45      CSS = {
  46          OVERRIDDEN: 'overridden',
  47          TOOLTIPACTIVE: 'tooltipactive'
  48      };
  49  
  50  /**
  51   * The Grader Report Table.
  52   *
  53   * @namespace M.gradereport_grader
  54   * @class ReportTable
  55   * @constructor
  56   */
  57  function ReportTable() {
  58      ReportTable.superclass.constructor.apply(this, arguments);
  59  }
  60  
  61  Y.extend(ReportTable, Y.Base, {
  62      /**
  63       * Array of EventHandles.
  64       *
  65       * @type EventHandle[]
  66       * @property _eventHandles
  67       * @protected
  68       */
  69      _eventHandles: [],
  70  
  71      /**
  72       * A Node reference to the grader table.
  73       *
  74       * @property graderTable
  75       * @type Node
  76       */
  77      graderTable: null,
  78  
  79      /**
  80       * Setup the grader report table.
  81       *
  82       * @method initializer
  83       */
  84      initializer: function() {
  85          // Some useful references within our target area.
  86          this.graderRegion = Y.one(SELECTORS.GRADEPARENT);
  87          this.graderTable = Y.one(SELECTORS.GRADERTABLE);
  88  
  89          // Setup the floating headers.
  90          this.setupFloatingHeaders();
  91      },
  92  
  93      /**
  94       * Get the text content of the username for the specified grade item.
  95       *
  96       * @method getGradeUserName
  97       * @param {Node} cell The grade item cell to obtain the username for
  98       * @return {String} The string content of the username cell.
  99       */
 100      getGradeUserName: function(cell) {
 101          var userrow = cell.ancestor('tr'),
 102              usercell = userrow.one("th.user .username");
 103  
 104          if (usercell) {
 105              return usercell.get('text');
 106          } else {
 107              return '';
 108          }
 109      },
 110  
 111      /**
 112       * Get the text content of the item name for the specified grade item.
 113       *
 114       * @method getGradeItemName
 115       * @param {Node} cell The grade item cell to obtain the item name for
 116       * @return {String} The string content of the item name cell.
 117       */
 118      getGradeItemName: function(cell) {
 119          var itemcell = Y.one("th.item[data-itemid='" + cell.getData('itemid') + "']");
 120          if (itemcell) {
 121              return itemcell.get('text');
 122          } else {
 123              return '';
 124          }
 125      },
 126  
 127      /**
 128       * Get the text content of any feedback associated with the grade item.
 129       *
 130       * @method getGradeFeedback
 131       * @param {Node} cell The grade item cell to obtain the item name for
 132       * @return {String} The string content of the feedback.
 133       */
 134      getGradeFeedback: function(cell) {
 135          return cell.getData('feedback');
 136      }
 137  });
 138  
 139  Y.namespace('M.gradereport_grader').ReportTable = ReportTable;
 140  Y.namespace('M.gradereport_grader').init = function(config) {
 141      return new Y.M.gradereport_grader.ReportTable(config);
 142  };


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1