statistics.mustache 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <%
  19. content_for :page_title, t(:page_title, "Statistics for %{account}", :account => @account.name)
  20. @active_tab = "statistics"
  21. css_bundle :statistics
  22. js_bundle :account_statistics
  23. %>
  24. <% @customLinks = account_custom_links; if @customLinks %>
  25. <% content_for :right_side do %>
  26. <% @customLinks.each do |link| %>
  27. <a href="<%= link[:url] %>" role="button" class="btn button-sidebar-wide"><i class="<%= link[:icon_class] %>" role="presentation"></i> <%= link[:text] %></a>
  28. <% end %>
  29. <% end %>
  30. <% end %>
  31. <h1 class="screenreader-only">{{#t}}Account Statistics{{/t}}</h1>
  32. <% if @counts_report %>
  33. <h2>{{#t}}General Numbers{{/t}}</h2>
  34. <table class="numbers_table">
  35. <tr>
  36. <th scope="row"><%= before_label(:generated_at, "Generated") %></th>
  37. <td><%= datetime_string(@counts_report['generated_at']) %></td>
  38. <td>&nbsp;</td>
  39. </tr>
  40. <tr>
  41. <th scope="row"><%= before_label(:courses, "Courses") %></th>
  42. <td><%= n(@counts_report['courses']) %></td>
  43. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="courses" data-name="{{#t}}Courses") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  44. </tr>
  45. <tr>
  46. <th scope="row"><%= before_label(:teachers, "Teachers") %></th>
  47. <td><%= n(@counts_report['teachers']) %></td>
  48. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="teachers" data-name="{{#t}}Teachers") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  49. </tr>
  50. <tr>
  51. <th scope="row"><%= before_label(:students, "Students") %></th>
  52. <td><%= n(@counts_report['students']) %></td>
  53. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="students" data-name="{{#t}}Students") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  54. </tr>
  55. <tr>
  56. <th scope="row"><%= before_label(:users, "Users") %></th>
  57. <td><%= n(@counts_report['users']) %></td>
  58. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="users" data-name="{{#t}}Users") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  59. </tr>
  60. <tr>
  61. <th scope="col">{{#t}}File Storage{{/t}}</th>
  62. <td></td>
  63. <td></td>
  64. </tr>
  65. <tr>
  66. <th scope="row">&nbsp;&nbsp;<%= before_label(:uploaded_storage, "Uploaded") %></th>
  67. <td class='number'>
  68. <%= t(:uploaded_data, { :one => "%{file_size} *from one file*", :other => "%{file_size} *from %{count} files*" },
  69. :file_size => number_to_human_size(@counts_report['files_size'] || 0), :count => @counts_report['files'],
  70. :wrapper => '<span style="font-size: 0.8em;">\1</span>') %>
  71. </td>
  72. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="files_size" data-name="{{#t}}Uploaded File Storage") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  73. </tr>
  74. <tr>
  75. <th scope="row">&nbsp;&nbsp;<%= before_label(:media_storage, "Media") %></th>
  76. <td class='number'>
  77. <%= t(:media_data, { :one => "%{file_size} *from one file*", :other => "%{file_size} *from %{count} files*" },
  78. :file_size => number_to_human_size(@counts_report['media_files_size'] || 0), :count => @counts_report['media_files'],
  79. :wrapper => '<span style="font-size: 0.8em;">\1</span>') %>
  80. </td>
  81. <td style="font-size: 0.8em; padding-left: 20px;"><a href="#" class="over_time_link" data-key="media_files_size" data-name="{{#t}}Media File Storage") %>"><%= t(:over_time_link, "over time{{/t}}</a></td>
  82. </tr>
  83. </table>
  84. <% end %>
  85. <% if can_do @account, @current_user, :read_course_list %>
  86. <% if @account == Account.default %>
  87. <h2>{{#t}}Recently Created Courses{{/t}}</h2>
  88. <ul id="recently_created_item_list" class="item_list">
  89. <% @recently_created_courses.each do |course| %>
  90. <li>
  91. <a href="<%= course_path(course.id) %>" class="header"><%= course.name %></a>
  92. <div class="sub_header">
  93. <% teacher = course.teachers.first %>
  94. <% if teacher %>
  95. <%= mt(:created_at_by, "created %{at} by [%{teacher}](%{url})",
  96. :at => datetime_string(course.created_at),
  97. :teacher => teacher.name,
  98. :url => user_url(teacher.id)) %>
  99. <% else %>
  100. <%= t(:created_at, "created %{at}",
  101. :at => datetime_string(course.created_at)) %>
  102. <% end %>
  103. </div>
  104. </li>
  105. <% end %>
  106. <% if @recently_started_courses.empty? %>
  107. <li>{{#t}}None to show{{/t}}</li>
  108. <% end %>
  109. </ul>
  110. <% end %>
  111. <h2>{{#t}}Recently Started Courses{{/t}}</h2>
  112. <ul id="recently_started_item_list" class="item_list">
  113. <% @recently_started_courses.each do |course| %>
  114. <li>
  115. <a href="<%= course_path(course.id) %>" class="header"><%= course.name %></a>
  116. <div class="sub_header"><%= t(:started_at, "started %{at}", :at => datetime_string(course.start_at) ) %></div>
  117. </li>
  118. <% end %>
  119. <% if @recently_started_courses.empty? %>
  120. <li>{{#t}}None to show{{/t}}</li>
  121. <% end %>
  122. </ul>
  123. <h2>{{#t}}Recently Ended Courses{{/t}}</h2>
  124. <ul id="recently_ended_item_list" class="item_list">
  125. <% @recently_ended_courses.each do |course| %>
  126. <li>
  127. <a href="<%= course_path(course.id) %>" class="header"><%= course.name %></a>
  128. <div class="sub_header"><%= t(:concluded_at, "concluded %{at}", :at => datetime_string(course.conclude_at) ) %></div>
  129. </li>
  130. <% end %>
  131. <% if @recently_ended_courses.empty? %>
  132. <li>{{#t}}None to show{{/t}}</li>
  133. <% end %>
  134. </ul>
  135. <% end %>
  136. <% if can_do @account, @current_user, :read_roster %>
  137. <h2>{{#t}}Recently Logged-In Users{{/t}}</h2>
  138. <ul id="recently_logged_in_item_list" class="item_list">
  139. <% @recently_logged_users.each do |user| %>
  140. <li>
  141. <a href="<%= user_path(user.id) %>" class="header"><%= user.name %></a>
  142. <div class="sub_header"><%= t(:last_logged_in_at, "last logged in %{at}", :at => datetime_string(user.pseudonyms.map{|p| [p.current_login_at, p.last_login_at]}.flatten.compact.max) ) %></div>
  143. </li>
  144. <% end %>
  145. <% if @recently_logged_users.empty? %>
  146. <li>{{#t}}None to show{{/t}}</li>
  147. <% end %>
  148. </ul>
  149. <% end %>
  150. <div id="over_time_dialog" style="display: none;">
  151. <div id='over_time' style='width: 600px; height: 240px;'></div>
  152. <div style="text-align: right;">
  153. <a href="#" class="csv_url xls">{{#t}}Download csv{{/t}}</a>
  154. </div>
  155. <a href="<%= context_url(@context, :context_statistics_graph_url, '{{ attribute }}') %>" class="over_time_url" style="display: none;">&nbsp;</a>
  156. </div>
  157. <script type="text/javascript" src="//www.google.com/jsapi"></script>
  158. <script> google.load('visualization', '1', {'packages':['annotatedtimeline']}); </script>