From eb1f78b48658b9ffaac228652a390102ab886dea Mon Sep 17 00:00:00 2001 From: ewinslow Date: Mon, 21 Feb 2011 20:25:58 +0000 Subject: Refs #2950: Moved widget code to object/widget/* git-svn-id: http://code.elgg.org/elgg/trunk@8386 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/object/widget.php | 73 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) (limited to 'views/default/object/widget.php') diff --git a/views/default/object/widget.php b/views/default/object/widget.php index efc8ef9ae..ce2dc33da 100644 --- a/views/default/object/widget.php +++ b/views/default/object/widget.php @@ -1,9 +1,74 @@ handler; + +$title = $widget->getTitle(); + +$edit_area = ''; +$can_edit = $widget->canEdit(); +if ($can_edit) { + $edit_area = elgg_view('object/widget/elements/settings', array( + 'widget' => $widget, + 'show_access' => $show_access, + )); +} +$controls = elgg_view('object/widget/elements/controls', array( + 'widget' => $widget, + 'show_edit' => $edit_area != '', +)); + +// don't show content for default widgets +if (elgg_in_context('default_widgets')) { + $content = ''; +} else { + if (elgg_view_exists("widgets/$handler/content")) { + $content = elgg_view("widgets/$handler/content", $vars); + } else { + elgg_deprecated_notice("widgets use content as the display view", 1.8); + $content = elgg_view("widgets/$handler/view", $vars); + } +} + +$widget_id = "elgg-widget-$widget->guid"; +$widget_instance = "elgg-widget-instance-$handler"; +$widget_class = "elgg-module elgg-module-widget"; +if ($can_edit) { + $widget_class .= " elgg-state-draggable $widget_instance"; +} else { + $widget_class .= " elgg-state-fixed $widget_instance"; +} + +$widget_header = <<
$title + $controls +HEADER; + +$widget_body = << + $content + +BODY; + +echo elgg_view('page/components/module', array( + 'class' => $widget_class, + 'id' => $widget_id, + 'body' => $widget_body, + 'header' => $widget_header, +)); -- cgit v1.2.3