[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/templates/ -> chart.mustache (source)

   1  {{!
   2      This file is part of Moodle - http://moodle.org/
   3  
   4      Moodle is free software: you can redistribute it and/or modify
   5      it under the terms of the GNU General Public License as published by
   6      the Free Software Foundation, either version 3 of the License, or
   7      (at your option) any later version.
   8  
   9      Moodle is distributed in the hope that it will be useful,
  10      but WITHOUT ANY WARRANTY; without even the implied warranty of
  11      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12      GNU General Public License for more details.
  13  
  14      You should have received a copy of the GNU General Public License
  15      along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  }}
  17  {{!
  18      Chart rendering.
  19  }}
  20  <div class="chart-area" id="chart-area-{{uniqid}}">
  21      <div class="chart-image" role="decoration" aria-describedby="chart-table-data-{{uniqid}}"></div>
  22      <div class="chart-table {{^withtable}}accesshide{{/withtable}}">
  23          <p class="chart-table-expand">
  24              <a href="#" aria-controls="chart-table-data-{{uniqid}}" role="button">
  25                  {{#str}}showchartdata, moodle{{/str}}
  26              </a>
  27          </p>
  28          <div class="chart-table-data" id="chart-table-data-{{uniqid}}" {{#withtable}}aria-expanded="false"{{/withtable}}></div>
  29      </div>
  30  </div>
  31  
  32  {{#js}}
  33  require([
  34      'jquery',
  35      'core/chart_builder',
  36      'core/chart_output_chartjs',
  37      'core/chart_output_htmltable',
  38  ], function($, Builder, Output, OutputTable) {
  39      var data = {{{chartdata}}},
  40          uniqid = "{{uniqid}}",
  41          chartArea = $('#chart-area-' + uniqid),
  42          chartImage = chartArea.find('.chart-image'),
  43          chartTable = chartArea.find('.chart-table-data'),
  44          chartLink = chartArea.find('.chart-table-expand a');
  45      Builder.make(data).then(function(ChartInst) {
  46          new Output(chartImage, ChartInst);
  47          new OutputTable(chartTable, ChartInst);
  48      });
  49  
  50      chartLink.on('click', function(e) {
  51          e.preventDefault();
  52          if (chartTable.is(':visible')) {
  53              chartTable.hide();
  54              chartLink.text({{#quote}}{{#str}}showchartdata, moodle{{/str}}{{/quote}});
  55              chartTable.attr('aria-expanded', false);
  56          } else {
  57              chartTable.show();
  58              chartLink.text({{#quote}}{{#str}}hidechartdata, moodle{{/str}}{{/quote}});
  59              chartTable.attr('aria-expanded', true);
  60          }
  61      });
  62  });
  63  {{/js}}


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