aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/widgets')
-rw-r--r--views/default/widgets/admin_welcome/content.php19
-rw-r--r--views/default/widgets/content_stats/content.php28
-rw-r--r--views/default/widgets/content_stats/edit.php23
-rw-r--r--views/default/widgets/control_panel/content.php38
-rw-r--r--views/default/widgets/friends/content.php25
-rw-r--r--views/default/widgets/friends/edit.php52
-rw-r--r--views/default/widgets/new_users/content.php11
-rw-r--r--views/default/widgets/new_users/edit.php23
-rw-r--r--views/default/widgets/online_users/content.php15
-rw-r--r--views/default/widgets/online_users/edit.php22
-rw-r--r--views/default/widgets/river_widget/content.php27
-rw-r--r--views/default/widgets/river_widget/edit.php58
12 files changed, 341 insertions, 0 deletions
diff --git a/views/default/widgets/admin_welcome/content.php b/views/default/widgets/admin_welcome/content.php
new file mode 100644
index 000000000..f4b92ea66
--- /dev/null
+++ b/views/default/widgets/admin_welcome/content.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Welcome widget for admins
+ */
+
+// section => string replacements.
+$sections = array(
+ 'intro' => array(),
+ 'admin_overview' => array(),
+ 'outro' => array()
+);
+
+// don't use longtext because it filters output.
+// that's annoying.
+echo '<div class="elgg-output">';
+foreach ($sections as $section => $strings) {
+ echo '<p>' . elgg_echo("admin:widget:admin_welcome:$section", $strings) . '</p>';
+}
+echo '</div>'; \ No newline at end of file
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>
diff --git a/views/default/widgets/control_panel/content.php b/views/default/widgets/control_panel/content.php
new file mode 100644
index 000000000..a348d612f
--- /dev/null
+++ b/views/default/widgets/control_panel/content.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Admin control panel widget
+ */
+
+elgg_register_menu_item('admin_control_panel', array(
+ 'name' => 'flush',
+ 'text' => elgg_echo('admin:cache:flush'),
+ 'href' => 'action/admin/site/flush_cache',
+ 'is_action' => true,
+ 'link_class' => 'elgg-button elgg-button-action',
+));
+
+// @todo Move in this in ElggUpgradeManager::isLocked() when #4682 fixed
+$is_locked = _elgg_upgrade_is_locked();
+
+if (!$is_locked) {
+ elgg_register_menu_item('admin_control_panel', array(
+ 'name' => 'upgrade',
+ 'text' => elgg_echo('upgrade'),
+ 'href' => 'upgrade.php',
+ 'link_class' => 'elgg-button elgg-button-action',
+ ));
+} else {
+ elgg_register_menu_item('admin_control_panel', array(
+ 'name' => 'unlock_upgrade',
+ 'text' => elgg_echo('upgrade:unlock'),
+ 'href' => 'action/admin/site/unlock_upgrade',
+ 'is_action' => true,
+ 'link_class' => 'elgg-button elgg-button-action',
+ 'confirm' => elgg_echo('upgrade:unlock:confirm'),
+ ));
+}
+
+echo elgg_view_menu('admin_control_panel', array(
+ 'class' => 'elgg-menu-hz',
+ 'item_class' => 'mrm',
+));
diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php
new file mode 100644
index 000000000..98814c244
--- /dev/null
+++ b/views/default/widgets/friends/content.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Friend widget display view
+ *
+ */
+
+// owner of the widget
+$owner = $vars['entity']->getOwnerEntity();
+
+// the number of friends to display
+$num = (int) $vars['entity']->num_display;
+
+// get the correct size
+$size = $vars['entity']->icon_size;
+
+if (elgg_instanceof($owner, 'user')) {
+ $html = $owner->listFriends('', $num, array(
+ 'size' => $size,
+ 'list_type' => 'gallery',
+ 'pagination' => false
+ ));
+ if ($html) {
+ echo $html;
+ }
+}
diff --git a/views/default/widgets/friends/edit.php b/views/default/widgets/friends/edit.php
new file mode 100644
index 000000000..c7e6b06ff
--- /dev/null
+++ b/views/default/widgets/friends/edit.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Friend widget options
+ *
+ */
+
+// set default value for display number
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 12;
+}
+
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50, 100),
+);
+$display_dropdown = elgg_view('input/dropdown', $params);
+
+
+// handle upgrade to 1.7.2 from previous versions
+if ($vars['entity']->icon_size == 1) {
+ $vars['entity']->icon_size = 'small';
+} elseif ($vars['entity']->icon_size == 2) {
+ $vars['entity']->icon_size = 'tiny';
+}
+
+// set default value for icon size
+if (!isset($vars['entity']->icon_size)) {
+ $vars['entity']->icon_size = 'small';
+}
+
+$params = array(
+ 'name' => 'params[icon_size]',
+ 'value' => $vars['entity']->icon_size,
+ 'options_values' => array(
+ 'small' => elgg_echo('friends:small'),
+ 'tiny' => elgg_echo('friends:tiny'),
+ ),
+);
+$size_dropdown = elgg_view('input/dropdown', $params);
+
+
+?>
+<p>
+ <?php echo elgg_echo('friends:num_display'); ?>:
+ <?php echo $display_dropdown; ?>
+</p>
+
+<p>
+ <?php echo elgg_echo('friends:icon_size'); ?>:
+ <?php echo $size_dropdown; ?>
+</p>
diff --git a/views/default/widgets/new_users/content.php b/views/default/widgets/new_users/content.php
new file mode 100644
index 000000000..ba85e7421
--- /dev/null
+++ b/views/default/widgets/new_users/content.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * New users admin widget
+ */
+
+echo elgg_list_entities(array(
+ 'type' => 'user',
+ 'subtype'=> null,
+ 'full_view' => false,
+ 'pagination' => false,
+)); \ No newline at end of file
diff --git a/views/default/widgets/new_users/edit.php b/views/default/widgets/new_users/edit.php
new file mode 100644
index 000000000..ed07213cb
--- /dev/null
+++ b/views/default/widgets/new_users/edit.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * New users widget edit view
+ */
+
+
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 5;
+}
+
+$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>
diff --git a/views/default/widgets/online_users/content.php b/views/default/widgets/online_users/content.php
new file mode 100644
index 000000000..6e0cc7abb
--- /dev/null
+++ b/views/default/widgets/online_users/content.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Online users widget
+ */
+
+$count = find_active_users(600, 10, 0, true);
+$objects = find_active_users(600, 10);
+
+if ($objects) {
+ echo elgg_view_entity_list($objects, array(
+ 'count' => $count,
+ 'limit' => 10,
+ 'pagination' => false,
+ ));
+}
diff --git a/views/default/widgets/online_users/edit.php b/views/default/widgets/online_users/edit.php
new file mode 100644
index 000000000..66f03a745
--- /dev/null
+++ b/views/default/widgets/online_users/edit.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Online users 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>
diff --git a/views/default/widgets/river_widget/content.php b/views/default/widgets/river_widget/content.php
new file mode 100644
index 000000000..867fc9db6
--- /dev/null
+++ b/views/default/widgets/river_widget/content.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Activity widget content view
+ */
+
+$num = (int) $vars['entity']->num_display;
+
+$options = array(
+ 'limit' => $num,
+ 'pagination' => false,
+);
+
+if (elgg_in_context('dashboard')) {
+ if ($vars['entity']->content_type == 'friends') {
+ $options['relationship_guid'] = elgg_get_page_owner_guid();
+ $options['relationship'] = 'friend';
+ }
+} else {
+ $options['subject_guid'] = elgg_get_page_owner_guid();
+}
+
+$content = elgg_list_river($options);
+if (!$content) {
+ $content = elgg_echo('river:none');
+}
+
+echo $content;
diff --git a/views/default/widgets/river_widget/edit.php b/views/default/widgets/river_widget/edit.php
new file mode 100644
index 000000000..228212e47
--- /dev/null
+++ b/views/default/widgets/river_widget/edit.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Edit settings for river widget
+ */
+
+// dashboard widget has type parameter
+if (elgg_in_context('dashboard')) {
+ if (!isset($vars['entity']->content_type)) {
+ $vars['entity']->content_type = 'friends';
+ }
+ $params = array(
+ 'name' => 'params[content_type]',
+ 'value' => $vars['entity']->content_type,
+ 'options_values' => array(
+ 'friends' => elgg_echo('river:widgets:friends'),
+ 'all' => elgg_echo('river:widgets:all'),
+ ),
+ );
+ $type_dropdown = elgg_view('input/dropdown', $params);
+ ?>
+ <div>
+ <?php echo elgg_echo('river:widget:type'); ?>:
+ <?php echo $type_dropdown; ?>
+ </div>
+ <?php
+}
+
+
+// set default value for number to display
+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),
+);
+$num_dropdown = elgg_view('input/dropdown', $params);
+
+?>
+<div>
+ <?php echo elgg_echo('widget:numbertodisplay'); ?>:
+ <?php echo $num_dropdown; ?>
+</div>
+
+<?php
+// pass the context so we have the correct output upon save.
+if (elgg_in_context('dashboard')) {
+ $context = 'dashboard';
+} else {
+ $context = 'profile';
+}
+
+echo elgg_view('input/hidden', array(
+ 'name' => 'context',
+ 'value' => $context
+)); \ No newline at end of file