Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
edit.php
Go to the documentation of this file.
1 <?php
6 // dashboard widget has type parameter
7 if (elgg_in_context('dashboard')) {
8  if (!isset($vars['entity']->content_type)) {
9  $vars['entity']->content_type = 'friends';
10  }
11  $params = array(
12  'name' => 'params[content_type]',
13  'value' => $vars['entity']->content_type,
14  'options_values' => array(
15  'friends' => elgg_echo('river:widgets:friends'),
16  'all' => elgg_echo('river:widgets:all'),
17  ),
18  );
19  $type_dropdown = elgg_view('input/select', $params);
20  ?>
21  <div>
22  <?php echo elgg_echo('river:widget:type'); ?>:
23  <?php echo $type_dropdown; ?>
24  </div>
25  <?php
26 }
27 
28 $num_display = sanitize_int($vars['entity']->num_display, false);
29 // set default value for display number
30 if (!$num_display) {
31  $num_display = 8;
32 }
33 
34 $params = array(
35  'name' => 'params[num_display]',
36  'value' => $num_display,
37  'options' => array(5, 8, 10, 12, 15, 20),
38 );
39 $num_dropdown = elgg_view('input/select', $params);
40 
41 ?>
42 <div>
43  <?php echo elgg_echo('widget:numbertodisplay'); ?>:
44  <?php echo $num_dropdown; ?>
45 </div>
46 
47 <?php
48 // pass the context so we have the correct output upon save.
49 if (elgg_in_context('dashboard')) {
50  $context = 'dashboard';
51 } else {
52  $context = 'profile';
53 }
54 
55 echo elgg_view('input/hidden', array(
56  'name' => 'context',
57  'value' => $context
58 ));
$num_display
Banned users widget edit view.
Definition: edit.php:6
$context
Definition: add.php:11
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$num_dropdown
Definition: edit.php:39
$vars['entity']
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: pageowner.php:241
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
if($entity->hasIcon('master')) $params
Definition: edit.php:27
sanitize_int($int, $signed=true)
Sanitizes an integer for database use.
Definition: database.php:180