aboutsummaryrefslogtreecommitdiff
path: root/mod/pages/views/default/input
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-07-13 07:42:36 +0200
committerSem <sembrestels@riseup.net>2012-07-13 07:42:36 +0200
commit1d2ce9657a44398646ed1a3980d89a1d2f50fa05 (patch)
treecbf88cc42c02b8303056eaf39fc898ccb071d245 /mod/pages/views/default/input
parent7fd67bc8ac6882f1a73aa7f8f907cd6c2a694272 (diff)
downloadelgg-1d2ce9657a44398646ed1a3980d89a1d2f50fa05.tar.gz
elgg-1d2ce9657a44398646ed1a3980d89a1d2f50fa05.tar.bz2
Fixes #1334. Added dropdown to change the parent of a page.
Diffstat (limited to 'mod/pages/views/default/input')
-rw-r--r--mod/pages/views/default/input/parent.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/mod/pages/views/default/input/parent.php b/mod/pages/views/default/input/parent.php
new file mode 100644
index 000000000..f354129fe
--- /dev/null
+++ b/mod/pages/views/default/input/parent.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Parent picker
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['options_values']
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['entity'] Optional. The child entity (uses container_guid)
+ */
+
+elgg_load_library('elgg:pages');
+
+if (empty($vars['entity'])) {
+ $container = elgg_get_page_owner_entity();
+} else {
+ $container = $vars['entity']->getContainerEntity();
+}
+
+$pages = pages_get_navigation_tree($container);
+$options = array();
+
+foreach ($pages as $page) {
+ $spacing = "";
+ for ($i = 0; $i < $page['depth']; $i++) {
+ $spacing .= "--";
+ }
+ $options[$page['guid']] = "$spacing " . $page['title'];
+}
+
+$defaults = array(
+ 'class' => 'elgg-input-parent-picker',
+ 'options_values' => $options,
+);
+
+$vars = array_merge($defaults, $vars);
+
+echo elgg_view('input/dropdown', $vars);