diff options
Diffstat (limited to 'views/default/widgets')
| -rw-r--r-- | views/default/widgets/admin_welcome/content.php | 16 | ||||
| -rw-r--r-- | views/default/widgets/content_stats/content.php | 7 | ||||
| -rw-r--r-- | views/default/widgets/control_panel/content.php | 38 | ||||
| -rw-r--r-- | views/default/widgets/friends/content.php | 28 | ||||
| -rw-r--r-- | views/default/widgets/new_users/content.php | 6 | ||||
| -rw-r--r-- | views/default/widgets/online_users/content.php | 14 | ||||
| -rw-r--r-- | views/default/widgets/river_widget/content.php | 27 | ||||
| -rw-r--r-- | views/default/widgets/river_widget/edit.php | 58 |
8 files changed, 168 insertions, 26 deletions
diff --git a/views/default/widgets/admin_welcome/content.php b/views/default/widgets/admin_welcome/content.php index dd7078837..f4b92ea66 100644 --- a/views/default/widgets/admin_welcome/content.php +++ b/views/default/widgets/admin_welcome/content.php @@ -3,5 +3,17 @@ * Welcome widget for admins */ -?> -Welcome to Elgg
\ No newline at end of file +// 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 index 568ebeeff..56772047d 100644 --- a/views/default/widgets/content_stats/content.php +++ b/views/default/widgets/content_stats/content.php @@ -19,7 +19,10 @@ foreach ($object_stats as $subtype => $num) { } echo '</table>'; +echo '<div class="mtm">'; echo elgg_view('output/url', array( - 'href' => 'pg/admin/statistics/overview', - 'text' => 'more', + 'href' => 'admin/statistics/overview', + 'text' => elgg_echo('more'), + 'is_trusted' => true, )); +echo '</div>'; 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 index f20f00194..98814c244 100644 --- a/views/default/widgets/friends/content.php +++ b/views/default/widgets/friends/content.php @@ -1,14 +1,9 @@ <?php - /** - * Elgg Friends * Friend widget display view * - * @package ElggFriends - * @subpackage Core */ - // owner of the widget $owner = $vars['entity']->getOwnerEntity(); @@ -18,20 +13,13 @@ $num = (int) $vars['entity']->num_display; // get the correct size $size = $vars['entity']->icon_size; -// Get the user's friends -if ($owner) { - $friends = $owner->getFriends("", $num); -} -// If there are any friends to view, view them -if (is_array($friends) && sizeof($friends) > 0) { - - echo "<div id=\"widget_friends_list\">"; - - foreach($friends as $friend) { - echo "<div class=\"widget_friends_singlefriend\" >"; - echo elgg_view_entity_icon(get_user($friend->guid), $size); - echo "</div>"; +if (elgg_instanceof($owner, 'user')) { + $html = $owner->listFriends('', $num, array( + 'size' => $size, + 'list_type' => 'gallery', + 'pagination' => false + )); + if ($html) { + echo $html; } - - echo "</div>"; } diff --git a/views/default/widgets/new_users/content.php b/views/default/widgets/new_users/content.php index cfa7d8bda..ba85e7421 100644 --- a/views/default/widgets/new_users/content.php +++ b/views/default/widgets/new_users/content.php @@ -1,7 +1,11 @@ <?php +/** + * New users admin widget + */ echo elgg_list_entities(array( 'type' => 'user', 'subtype'=> null, - 'full_view' => FALSE + 'full_view' => false, + 'pagination' => false, ));
\ No newline at end of file diff --git a/views/default/widgets/online_users/content.php b/views/default/widgets/online_users/content.php index e1ff69811..6e0cc7abb 100644 --- a/views/default/widgets/online_users/content.php +++ b/views/default/widgets/online_users/content.php @@ -1,3 +1,15 @@ <?php +/** + * Online users widget + */ -echo $users_online = get_online_users();
\ No newline at end of file +$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/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 |
