aboutsummaryrefslogtreecommitdiff
path: root/views/default/layout/objects/widget.php
blob: 1ba274aa6960e7fa17189955d12b1e7e8d40274b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
 * Widget object
 *
 * @uses $vars['entity']
 */

$widget = $vars['entity'];
if (!elgg_instanceof($widget, 'object', 'widget')) {
	return true;
}

// @todo catch for disabled plugins
$widgettypes = elgg_get_widget_types('all');

$handler = $widget->handler;

$title = $widget->getTitle();

$can_edit = $widget->canEdit();

$widget_id = "elgg-widget-$widget->guid";
$widget_instance = "elgg-widget-instance-$handler";

?>
<div class="elgg-widget draggable <?php echo $widget_instance?>" id="<?php echo $widget_id; ?>">
	<div class="elgg-widget-title drag-handle">
		<h3><?php echo $title; ?></h3>
	</div>
	<?php
	if ($can_edit) {
		echo elgg_view('layout/objects/widget/controls', array('widget' => $widget));
	}
	?>
	<div class="elgg-widget-container">
		<?php
		if ($can_edit) {
			echo elgg_view('layout/objects/widget/settings', array('widget' => $widget));
		}
		?>
		<div class="elgg-widget-content">
			<?php
			if (elgg_view_exists("widgets/$handler/content")) {
				echo elgg_view("widgets/$handler/content", $vars);
			} else {
				elgg_deprecated_notice("widgets use content as the display view", 1.8);
				echo elgg_view("widgets/$handler/view", $vars);				
			}
			?>
		</div>
	</div>
</div>