Elgg  Version 1.9
add_panel.php
Go to the documentation of this file.
1 <?php
10 $widgets = $vars['widgets'];
11 $context = $vars['context'];
12 $exact = elgg_extract('exact_match', $vars, false);
13 
15 uasort($widget_types, create_function('$a,$b', 'return strcmp($a->name,$b->name);'));
16 
18 foreach ($widgets as $column_widgets) {
19  foreach ($column_widgets as $widget) {
20  $current_handlers[] = $widget->handler;
21  }
22 }
23 
24 ?>
25 <div class="elgg-widgets-add-panel hidden clearfix" id="widgets-add-panel">
26  <p>
27  <?php echo elgg_echo('widgets:add:description'); ?>
28  </p>
29  <ul>
30 <?php
31  foreach ($widget_types as $handler => $widget_type) {
32  // check if widget added and only one instance allowed
33  if ($widget_type->multiple == false && in_array($handler, $current_handlers)) {
34  $class = 'elgg-state-unavailable';
35  $tooltip = elgg_echo('widget:unavailable');
36  } else {
37  $class = 'elgg-state-available';
38  $tooltip = $widget_type->description;
39  }
40 
41  if ($widget_type->multiple) {
42  $class .= ' elgg-widget-multiple';
43  } else {
44  $class .= ' elgg-widget-single';
45  }
46 
47  echo "<li title=\"$tooltip\" class=\"$class\" data-elgg-widget-type=\"$handler\">$widget_type->name</li>";
48  }
49 ?>
50  </ul>
51 <?php
52  echo elgg_view('input/hidden', array(
53  'name' => 'widget_context',
54  'value' => $context
55  ));
56  echo elgg_view('input/hidden', array(
57  'name' => 'show_access',
58  'value' => (int)$vars['show_access']
59  ));
60 ?>
61 </div>
$context
Definition: add_panel.php:11
ul
Definition: admin.php:44
$widget_types
Definition: add_panel.php:14
p
Definition: admin.php:118
$widget
Definition: delete.php:9
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1464
$exact
Definition: add_panel.php:12
fieldset div
Definition: admin.php:462
if(isset($vars['id'])) $class
Definition: ajax_loader.php:19
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg echo
Translates a string.
Definition: languages.js:43
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
$widgets
Widget add panel.
Definition: add_panel.php:10
elgg_get_widget_types($context="", $exact=false)
Get the widget types for a context.
Definition: widgets.php:119
$handler
Definition: add.php:10
$current_handlers
Definition: add_panel.php:17
if(file_exists($welcome)) $vars
Definition: upgrade.php:93