diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-06-11 14:58:43 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-06-11 14:58:43 +0000 |
commit | 90960088561357dae617344cfbf6ae8fba955c42 (patch) | |
tree | 87c218005baba31402eb948910650cef129fafec | |
parent | 1af60ae2122e23b0a73ebe88ab448866927a6a92 (diff) | |
download | elgg-90960088561357dae617344cfbf6ae8fba955c42.tar.gz elgg-90960088561357dae617344cfbf6ae8fba955c42.tar.bz2 |
Refs #3523 added a view for write access in pages plugin
git-svn-id: http://code.elgg.org/elgg/trunk@9171 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/pages/start.php | 2 | ||||
-rw-r--r-- | mod/pages/views/default/input/write_access.php | 35 |
2 files changed, 36 insertions, 1 deletions
diff --git a/mod/pages/start.php b/mod/pages/start.php index fded5fee9..744306649 100644 --- a/mod/pages/start.php +++ b/mod/pages/start.php @@ -65,7 +65,7 @@ function pages_init() { 'description' => 'longtext', 'tags' => 'tags', 'access_id' => 'access', - 'write_access_id' => 'access', + 'write_access_id' => 'write_access', )); elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'pages_owner_block_menu'); diff --git a/mod/pages/views/default/input/write_access.php b/mod/pages/views/default/input/write_access.php new file mode 100644 index 000000000..69277ca20 --- /dev/null +++ b/mod/pages/views/default/input/write_access.php @@ -0,0 +1,35 @@ +<?php +/** + * Write access + * + * Removes the public option found in input/access + * + * @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 entity for this access control (uses write_access_id) + */ + +$options = get_write_access_array(); +unset($options[ACCESS_PUBLIC]); + +$defaults = array( + 'class' => 'elgg-input-access', + 'disabled' => FALSE, + 'value' => get_default_access(), + 'options_values' => $options, +); + +if (isset($vars['entity'])) { + $defaults['value'] = $vars['entity']->write_access_id; + unset($vars['entity']); +} + +$vars = array_merge($defaults, $vars); + +if ($vars['value'] == ACCESS_DEFAULT) { + $vars['value'] = get_default_access(); +} +$vars['value'] = ($vars['value'] == ACCESS_PUBLIC) ? ACCESS_LOGGED_IN : $vars['value']; + +echo elgg_view('input/dropdown', $vars); |