aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/content_stats
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/widgets/content_stats')
-rw-r--r--views/default/widgets/content_stats/content.php28
-rw-r--r--views/default/widgets/content_stats/edit.php23
2 files changed, 51 insertions, 0 deletions
diff --git a/views/default/widgets/content_stats/content.php b/views/default/widgets/content_stats/content.php
new file mode 100644
index 000000000..56772047d
--- /dev/null
+++ b/views/default/widgets/content_stats/content.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Content stats widget
+ */
+
+$max = $vars['entity']->num_display;
+
+$entity_stats = get_entity_statistics();
+$object_stats = $entity_stats['object'];
+arsort($object_stats);
+$object_stats = array_slice($object_stats, 0, $max);
+
+echo '<table class="elgg-table-alt">';
+echo '<tr><th>' . elgg_echo('widget:content_stats:type') . '</th>';
+echo '<th>' . elgg_echo('widget:content_stats:number') . '</th></tr>';
+foreach ($object_stats as $subtype => $num) {
+ $name = elgg_echo("item:object:$subtype");
+ echo "<tr><td>$name</td><td>$num</td></tr>";
+}
+echo '</table>';
+
+echo '<div class="mtm">';
+echo elgg_view('output/url', array(
+ 'href' => 'admin/statistics/overview',
+ 'text' => elgg_echo('more'),
+ 'is_trusted' => true,
+));
+echo '</div>';
diff --git a/views/default/widgets/content_stats/edit.php b/views/default/widgets/content_stats/edit.php
new file mode 100644
index 000000000..f1a050df8
--- /dev/null
+++ b/views/default/widgets/content_stats/edit.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Content statistics widget edit view
+ */
+
+
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 8;
+}
+
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(5, 8, 10, 12, 15, 20),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
+?>
+<p>
+ <?php echo elgg_echo('widget:numbertodisplay'); ?>:
+ <?php echo $dropdown; ?>
+</p>