<?php echo elgg_view_field(['#type' => 'text', 'name' => 'sitename', '#label' => elgg_echo('installation:sitename'), 'value' => elgg_get_config('sitename')]); echo elgg_view_field(['#type' => 'text', 'name' => 'sitedescription', '#label' => elgg_echo('installation:sitedescription'), 'value' => elgg_get_config('sitedescription')]); echo elgg_view_field(['#type' => 'email', 'name' => 'siteemail', '#label' => elgg_echo('installation:siteemail'), 'value' => elgg_get_site_entity()->email, 'class' => 'elgg-input-text']); echo elgg_view_field(['#type' => 'number', 'name' => 'default_limit', '#label' => elgg_echo('installation:default_limit'), 'value' => elgg_get_config('default_limit'), 'min' => 1, 'step' => 1]); echo elgg_view_field(['#type' => 'select', 'name' => 'language', '#label' => elgg_echo('installation:language'), 'value' => elgg_get_config('language'), 'options_values' => get_installed_translations()]); $footer = elgg_view('input/submit', ['value' => elgg_echo('save')]); elgg_set_form_footer($footer);
<?php /** * Used to show plugin settings for both users and admins. * * @package Elgg.Core * @subpackage Plugins */ $plugin = elgg_extract('entity', $vars); $plugin_id = $plugin->getID(); $user_guid = elgg_extract('user_guid', $vars, elgg_get_logged_in_user_guid()); // Do we want to show admin settings or user settings $type = elgg_extract('type', $vars, ''); if ($type != 'user') { $type = ''; } if (elgg_view_exists("plugins/{$plugin_id}/{$type}settings")) { echo elgg_view("plugins/{$plugin_id}/{$type}settings", $vars); } echo elgg_view_field(['#type' => 'hidden', 'name' => 'plugin_id', 'value' => $plugin_id]); echo elgg_view_field(['#type' => 'hidden', 'name' => 'user_guid', 'value' => $user_guid]); $footer = elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('save')]); elgg_set_form_footer($footer);
/** * Widget edit num_display * * @uses $vars['entity'] ElggWidget * @uses $vars['name'] (optional) The name of the attribute, defaults to 'num_display' * @uses $vars['default'] (optional) The default value if no value is set, defaults to first option */ $widget = elgg_extract('entity', $vars); if (!$widget instanceof \ElggWidget) { return; } unset($vars['widget']); $name = elgg_extract('name', $vars, 'num_display'); $vars['name'] = "params[{$name}]"; if (!isset($vars['label'])) { $vars['label'] = elgg_echo('widget:numbertodisplay'); } $vars['#label'] = $vars['label']; unset($vars['label']); if (!isset($vars['options'])) { $vars['options'] = [5, 8, 10, 12, 15, 20]; } $value = sanitize_int($widget->{$name}, false); if (!$value) { $value = elgg_extract('default', $vars, $vars['options'][0]); } $vars['value'] = $value; $vars['#type'] = 'select'; echo elgg_view_field($vars);
<?php /** * Elgg log rotator plugin settings. * * @package ElggLogRotate */ $plugin = elgg_extract('entity', $vars); echo elgg_view_field(['#type' => 'select', '#label' => elgg_echo('logrotate:period'), 'name' => 'params[period]', 'options_values' => ['weekly' => elgg_echo('interval:weekly'), 'monthly' => elgg_echo('interval:monthly'), 'yearly' => elgg_echo('interval:yearly')], 'value' => $plugin->period]); echo elgg_view_field(['#type' => 'select', '#label' => elgg_echo('logrotate:delete'), 'name' => 'params[delete]', 'options_values' => ['weekly' => elgg_echo('logrotate:week'), 'monthly' => elgg_echo('logrotate:month'), 'yearly' => elgg_echo('logrotate:year'), 'never' => elgg_echo('logrotate:never')], 'value' => $plugin->delete]);
if (!empty($value)) { $value .= ', '; } $value .= $md->value; $access_id = $md->access_id; } } else { $value = $metadata->value; $access_id = $metadata->access_id; } } else { $value = ''; $access_id = ACCESS_DEFAULT; } // sticky form values take precedence over saved ones if (isset($sticky_values[$shortname])) { $value = $sticky_values[$shortname]; } if (isset($sticky_values['accesslevel'][$shortname])) { $access_id = $sticky_values['accesslevel'][$shortname]; } $id = "profile-{$shortname}"; $input = elgg_view("input/{$valtype}", ['name' => $shortname, 'value' => $value, 'id' => $id]); $access_input = elgg_view('input/access', ['name' => "accesslevel[{$shortname}]", 'value' => $access_id]); echo elgg_view('elements/forms/field', ['input' => $input . $access_input, 'label' => elgg_view('elements/forms/label', ['label' => elgg_echo("profile:{$shortname}"), 'id' => $id])]); } } elgg_clear_sticky_form('profile:edit'); echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $entity->guid)); echo elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('save'), '#class' => 'elgg-foot']);
$symlink_warning = '<p class="elgg-text-help">' . elgg_echo('installation:cache_symlink:description') . '</p>'; if ($cache_symlinked) { $params['class'] = 'elgg-state-disabled'; $params['label_class'] = 'elgg-state-disabled'; $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], elgg_echo('installation:cache_symlink:warning')); } $symlink_input = elgg_view('input/checkbox', $params); $symlink_source = elgg_get_root_path() . 'cache/'; $symlink_target = elgg_get_cache_path() . 'views_simplecache/'; $symlink_paths_help = elgg_echo('installation:cache_symlink:paths', [$symlink_source, $symlink_target]); $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], $symlink_paths_help); // minify $minify_description = elgg_echo('installation:minify:description'); $minify_js_input = elgg_view("input/checkbox", array('label' => elgg_echo('installation:minify_js:label'), 'name' => 'simplecache_minify_js', 'checked' => (bool) elgg_get_config('simplecache_minify_js'), 'label_class' => $simple_cache_disabled_class, 'switch' => true)); $minify_css_input = elgg_view("input/checkbox", array('label' => elgg_echo('installation:minify_css:label'), 'name' => 'simplecache_minify_css', 'checked' => (bool) elgg_get_config('simplecache_minify_css'), 'label_class' => $simple_cache_disabled_class, 'switch' => true)); $system_cache_input = elgg_view_field(['#type' => 'checkbox', 'label' => elgg_echo('installation:systemcache:label'), 'help' => elgg_echo('installation:systemcache:description'), 'name' => 'system_cache_enabled', 'switch' => true, 'checked' => elgg_is_system_cache_enabled(), '#class' => 'mtm']); $body = <<<BODY \t<div> \t\t{$simple_cache_input} \t\t{$simple_cache_warning} \t</div> \t<div> \t\t{$symlink_input} \t\t{$symlink_warning} \t</div> \t<div> \t\t<p>{$minify_description}</p> \t\t{$minify_js_input}<br /> \t\t{$minify_css_input} \t</div>
<?php /** * Provide a way of setting your default access * * @package Elgg * @subpackage Core */ if (!elgg_get_config('allow_user_default_access')) { return; } $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $default_access = $user->getPrivateSetting('elgg_default_access'); if ($default_access === null) { $default_access = elgg_get_config('default_access'); } $title = elgg_echo('default_access:settings'); $content = elgg_view_field(array('#type' => 'access', 'name' => 'default_access', 'value' => $default_access, '#label' => elgg_echo('default_access:label'))); echo elgg_view_module('info', $title, $content);
<?php /** * Group activity widget settings */ $widget = elgg_extract('entity', $vars); // once autocomplete is working use that $groups = $widget->getOwnerEntity()->getGroups(['limit' => false]); $mygroups = []; if (!$widget->group_guid) { $mygroups[0] = ''; } foreach ($groups as $group) { $mygroups[$group->guid] = $group->name; } echo elgg_view_field(['#type' => 'select', 'name' => 'params[group_guid]', '#label' => elgg_echo('groups:widget:group_activity:edit:select'), 'value' => $widget->group_guid, 'options_values' => $mygroups]); // set default value if (!isset($widget->num_display)) { $widget->num_display = 8; } echo elgg_view('object/widget/edit/num_display', ['entity' => $widget]); echo elgg_view('input/hidden', ['name' => 'title']);
<?php /** * Elgg login form * * @package Elgg * @subpackage Core */ elgg_require_js('forms/login'); echo elgg_view_field(['#type' => 'text', 'name' => 'username', 'autofocus' => true, 'required' => true, '#label' => elgg_echo('loginusername')]); echo elgg_view_field(['#type' => 'password', 'name' => 'password', 'required' => true, '#label' => elgg_echo('password')]); echo elgg_view('login/extend', $vars); if (isset($vars['returntoreferer'])) { echo elgg_view_field(['#type' => 'hidden', 'name' => 'returntoreferer', 'value' => 'true']); } ob_start(); ?> <div class="elgg-foot"> <label class="mtm float-alt"> <input type="checkbox" name="persistent" value="true" /> <?php echo elgg_echo('user:persistent'); ?> </label> <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); echo elgg_view_menu('login', array('sort_by' => 'priority', 'class' => 'elgg-menu-general elgg-menu-hz mtm')); ?> </div> <?php
} echo elgg_view_field(['#type' => 'access', '#label' => elgg_echo('groups:visibility'), 'name' => 'vis', 'id' => 'groups-vis', 'value' => $visibility, 'options_values' => $visibility_options, 'entity' => $entity, 'entity_type' => 'group', 'entity_subtype' => '']); } $access_mode_params = ['#type' => 'select', '#label' => elgg_echo('groups:content_access_mode'), 'name' => 'content_access_mode', 'id' => 'groups-content-access-mode', 'value' => $content_access_mode, 'options_values' => [ElggGroup::CONTENT_ACCESS_MODE_UNRESTRICTED => elgg_echo('groups:content_access_mode:unrestricted'), ElggGroup::CONTENT_ACCESS_MODE_MEMBERS_ONLY => elgg_echo('groups:content_access_mode:membersonly')]]; if ($entity) { // Disable content_access_mode field for hidden groups because the setting // will be forced to members_only regardless of the entered value if ($entity->access_id === $entity->group_acl) { $access_mode_params['disabled'] = 'disabled'; } if ($entity->getContentAccessMode() == ElggGroup::CONTENT_ACCESS_MODE_UNRESTRICTED) { // Warn the user that changing the content access mode to more // restrictive will not affect the existing group content $access_mode_params['#help'] = elgg_echo('groups:content_access_mode:warning'); } } echo elgg_view_field($access_mode_params); if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_logged_in())) { $members = []; $dbprefix = elgg_get_config('dbprefix'); $batch = new ElggBatch('elgg_get_entities_from_relationship', ['type' => 'user', 'relationship' => 'member', 'relationship_guid' => $entity->getGUID(), 'inverse_relationship' => true, 'limit' => false, 'callback' => false, 'joins' => ["JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"], 'selects' => ['ue.*'], 'order_by' => 'ue.name ASC']); foreach ($batch as $member) { $option_text = "{$member->name} (@{$member->username})"; $members[$member->guid] = htmlspecialchars($option_text, ENT_QUOTES, "UTF-8", false); } $owner_guid_options = ['#type' => 'select', '#label' => elgg_echo('groups:owner'), 'name' => 'owner_guid', 'id' => 'groups-owner-guid', 'value' => $owner_guid, 'options_values' => $members, 'class' => 'groups-owner-input']; if ($owner_guid == elgg_get_logged_in_user_guid()) { $owner_guid_options['#help'] = elgg_echo('groups:owner:warning'); } echo elgg_view_field($owner_guid_options); }
<?php /** * Advanced site settings, system section. */ $body = elgg_view_field(['#type' => 'text', 'name' => 'wwwroot', '#label' => elgg_echo('installation:wwwroot'), 'value' => elgg_get_config('wwwroot')]); $body .= elgg_view_field(['#type' => 'text', 'name' => 'path', '#label' => elgg_echo('installation:path'), 'value' => elgg_get_config('path')]); $dataroot_in_settings = !empty($GLOBALS['_ELGG']->dataroot_in_settings); $body .= elgg_view_field(['#type' => 'text', 'name' => 'dataroot', '#label' => elgg_echo('installation:dataroot'), 'value' => elgg_get_config('dataroot'), 'readonly' => $dataroot_in_settings, 'class' => $dataroot_in_settings ? 'elgg-state-disabled' : '', '#help' => $dataroot_in_settings ? elgg_echo('admin:settings:in_settings_file') : '']); echo elgg_view_module('inline', elgg_echo('admin:legend:system'), $body, ['id' => 'elgg-settings-advanced-system']);
<?php /** * Advanced site settings, content access section. */ $field = ['#type' => 'access', 'options_values' => [ACCESS_PRIVATE => elgg_echo('PRIVATE'), ACCESS_FRIENDS => elgg_echo('access:friends:label'), ACCESS_LOGGED_IN => elgg_echo('LOGGED_IN'), ACCESS_PUBLIC => elgg_echo('PUBLIC')], 'name' => 'default_access', '#label' => elgg_echo('installation:sitepermissions'), '#help' => elgg_echo('admin:site:access:warning'), 'value' => elgg_get_config('default_access')]; if (!elgg_is_active_plugin('friends')) { unset($field['options_values'][ACCESS_FRIENDS]); } $body = elgg_view_field($field); $body .= elgg_view_field(['#type' => 'checkbox', 'label' => elgg_echo('installation:allow_user_default_access:label'), '#help' => elgg_echo('installation:allow_user_default_access:description'), 'name' => 'allow_user_default_access', 'checked' => (bool) elgg_get_config('allow_user_default_access')]); echo elgg_view_module('inline', elgg_echo('admin:legend:content_access'), $body, ['id' => 'elgg-settings-advanced-content-access']);
/** * Renders a form field * * @param string $input_type Input type, used to generate an input view ("input/$input_type") * @param array $vars Fields and input vars. * Field vars contain both field and input params. 'label', 'help', * and 'field_class' params will not be passed on to the input view. * Others, including 'required' and 'id', will be available to the * input view. Both 'label' and 'help' params accept HTML, and * will be printed unescaped within their wrapper element. * @return string * * @since 2.1 * @deprecated 2.3 Use elgg_view_field() */ function elgg_view_input($input_type, array $vars = array()) { elgg_deprecated_notice(__FUNCTION__ . '() is deprecated. Use elgg_view_field()', '2.3'); $vars['#type'] = $input_type; if (isset($vars['label']) && $input_type !== 'checkbox') { $vars['#label'] = $vars['label']; unset($vars['label']); } if (isset($vars['help'])) { $vars['#help'] = $vars['help']; unset($vars['help']); } if (isset($vars['field_class'])) { $vars['#class'] = $vars['field_class']; unset($vars['field_class']); } return elgg_view_field($vars); }
* @uses $vars['align'] Field alignment (vertical|horizontal) * If set to horizontal, fields will be rendered * with inline display * @uses $vars['justify'] Text justification (left|right|center) * @uses $vars['legend'] Optional fieldset legend * @uses $vars['fields'] An array of field options * Field options should be suitable for use in * elgg_view_field() */ $vars['class'] = elgg_extract_class($vars, ['elgg-fieldset', 'clearfix']); $align = elgg_extract('align', $vars, 'vertical'); unset($vars['align']); $vars['class'][] = "elgg-fieldset-{$align}"; $justify = elgg_extract('justify', $vars, ''); unset($vars['justify']); if ($justify) { $vars['class'][] = "elgg-justify-{$justify}"; } $legend = elgg_extract('legend', $vars); unset($vars['legend']); $fields = (array) elgg_extract('fields', $vars, []); unset($vars['fields']); $fieldset = ''; if ($legend) { $vars['class'] = 'elgg-fieldset-has-legend'; $fieldset .= elgg_format_element('legend', [], $legend); } foreach ($fields as $field) { $fieldset .= elgg_view_field($field); } echo elgg_format_element('fieldset', $vars, $fieldset);
<?php /** * Discussion topic reply form body * * @uses $vars['topic'] A discussion topic object * @uses $vars['entity'] A discussion reply object * @uses $vars['inline'] Display a shortened form? */ $topic = elgg_extract('topic', $vars); $reply = elgg_extract('entity', $vars); $inline = elgg_extract('inline', $vars, false); echo elgg_view_field(['#type' => 'hidden', 'name' => 'topic_guid', 'value' => $topic ? $topic->guid : '']); echo elgg_view_field(['#type' => 'hidden', 'name' => 'guid', 'value' => $reply ? $reply->guid : '']); if ($reply) { $label = elgg_echo('discussion:reply:edit'); $value = $reply->description; $action = elgg_echo('save'); } else { $label = elgg_echo('reply:this'); $value = ''; $action = elgg_echo('reply'); } echo elgg_view_field(['#type' => 'longtext', '#label' => $label, 'name' => 'description', 'value' => $value, 'visual' => !$inline, 'editor_type' => 'simple']); $buttons = [['#type' => 'submit', 'value' => $action]]; if ($inline) { $buttons[] = ['#type' => 'button', 'type' => 'reset', 'text' => elgg_echo('cancel'), 'class' => 'elgg-button-cancel']; } $footer = elgg_view_field(['#type' => 'fieldset', 'fields' => $buttons, 'align' => 'horizontal']); elgg_set_form_footer($footer);
<?php /** * Advanced site settings, debugging section. */ $body = elgg_view_field(['#type' => 'select', 'options_values' => ['0' => elgg_echo('installation:debug:none'), 'ERROR' => elgg_echo('installation:debug:error'), 'WARNING' => elgg_echo('installation:debug:warning'), 'NOTICE' => elgg_echo('installation:debug:notice'), 'INFO' => elgg_echo('installation:debug:info')], 'name' => 'debug', '#label' => elgg_echo('installation:debug:label'), '#help' => elgg_echo('installation:debug'), 'value' => elgg_get_config('debug')]); echo elgg_view_module('inline', elgg_echo('admin:legend:debug'), $body, ['id' => 'elgg-settings-advanced-debugging']);
<?php /** * Provide a way of setting your full name. * * @package Elgg * @subpackage Core */ $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $title = elgg_echo('user:name:label'); $content .= elgg_view_field(array('#type' => 'text', 'name' => 'name', 'value' => $user->name, '#label' => elgg_echo('name'))); echo elgg_view_module('info', $title, $content);
<?php /** * Provide a way of setting your email * * @package Elgg * @subpackage Core */ $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $title = elgg_echo('email:settings'); $content = ''; if (elgg_get_config('security_email_require_password') && $user->getGUID() === elgg_get_logged_in_user_guid()) { // user needs to provide current password in order to be able to change his/her email address $content .= elgg_view_field(array('#type' => 'password', '#label' => elgg_echo('email:address:password'), '#help' => elgg_echo('email:address:password:help'), 'name' => 'email_password')); } $content .= elgg_view_field(array('#type' => 'email', 'name' => 'email', 'value' => $user->email, '#label' => elgg_echo('email:address:label'))); echo elgg_view_module('info', $title, $content);
echo elgg_view_field(array('#type' => 'select', 'name' => 'f5', 'id' => 'f5', 'options' => array('option 1', 'option 2', ['text' => 'disabled', 'disabled' => true]), '#label' => 'Select input (dropdown) (.elgg-input-dropdown) with a disabled option:')); echo elgg_view_field(array('#type' => 'select', 'name' => 'f51[]', 'id' => 'f51', 'options_values' => array('value 1' => 'option 1', 'value 2' => 'option 2', 'value 3' => 'option 3'), 'multiple' => true, '#label' => 'Select input (multiselect) (.elgg-input-dropdown):')); echo elgg_view_field(array('#type' => 'access', 'name' => 'f6', 'id' => 'f6', 'value' => ACCESS_PUBLIC, '#label' => 'Access input (.elgg-input-access):')); echo elgg_view_field(array('#type' => 'file', 'name' => 'f7', 'id' => 'f7', '#label' => 'File input (.elgg-input-file):')); echo elgg_view_field(array('#type' => 'url', 'name' => 'f8', 'id' => 'f8', 'value' => 'http://elgg.org/', '#label' => 'URL input (.elgg-input-url):')); echo elgg_view_field(array('#type' => 'tags', 'name' => 'f9', 'id' => 'f9', 'value' => 'one, two, three', '#label' => 'Tags input (.elgg-input-tags):')); echo elgg_view_field(array('#type' => 'email', 'name' => 'f10', 'id' => 'f10', 'value' => '*****@*****.**', '#label' => 'Email input (.elgg-input-email):')); echo elgg_view_field(array('#type' => 'autocomplete', 'name' => 'f11', 'id' => 'f11', 'match_on' => array('groups', 'friends'), '#label' => 'Autocomplete input (.elgg-input-autocomplete):')); echo elgg_view_field(array('#type' => 'date', 'name' => 'f12', 'id' => 'f12', 'value' => '2012-12-31', '#label' => 'Date input (.elgg-input-date):')); $year = date('Y'); echo elgg_view_field(array('#type' => 'date', 'name' => 'f12-custom', 'id' => 'f12-custom', 'value' => "{$year}/02/01", 'timestamp' => true, 'datepicker_options' => array('dateFormat' => 'yy/mm/dd', 'changeMonth' => false, 'changeYear' => false, 'minDate' => "{$year}/01/15", 'maxDate' => "{$year}/02/15"), '#label' => 'Date input (.elgg-input-date) with custom options:', '#help' => 'Select a date from 15 Jan to 15 Feb')); echo elgg_view_field(array('#type' => 'userpicker', 'name' => 'f13', 'id' => 'f13', '#label' => 'User picker input (.elgg-user-picker):')); echo elgg_view_field(array('#type' => 'userpicker', 'name' => 'f16', 'id' => 'f16', 'limit' => 1, '#label' => 'User picker input (with max 1 results) (.elgg-user-picker):')); echo elgg_view_field(array('#type' => 'plaintext', 'name' => 'f15', 'id' => 'f15', 'value' => $ipsum, '#label' => 'Plain textarea input (.elgg-input-plaintext):')); echo elgg_view_field(array('#type' => 'longtext', 'name' => 'f14', 'id' => 'f14', 'value' => $ipsum, '#label' => 'Long textarea input (.elgg-input-longtext):')); echo elgg_view_field(array('#type' => 'longtext', 'name' => 'f14a', 'id' => 'f14a', 'value' => $ipsum, 'editor' => false, '#label' => 'Long textarea input (.elgg-input-longtext) with a disabled editor:')); echo elgg_view_field(array('#type' => 'longtext', 'name' => 'f14b', 'id' => 'f14b', 'value' => $ipsum, 'visual' => false, '#label' => 'Long textarea input (.elgg-input-longtext) without a visual editor activated by default:')); echo elgg_view_field(array('#type' => 'longtext', 'name' => 'f14c', 'id' => 'f14c', 'value' => $ipsum, 'editor_type' => 'simple', '#label' => 'Long textarea input (.elgg-input-longtext) with the editor_type configured as "simple":')); echo elgg_view_field(array('#type' => 'number', 'name' => 'f15', 'id' => 'f15', 'value' => 1, 'min' => 1, 'step' => 1, '#label' => 'Number input (.elgg-input-number) with custom options:', '#help' => 'Enter an integer number larger than zero')); $dt = new \DateTime(null, new \DateTimeZone('UTC')); $hour_options = array(); $hour_options_ts = range(0, 24 * 60 * 60, 900); // step of 15 minutes foreach ($hour_options_ts as $ts) { $hour_options[$ts] = $dt->setTimestamp($ts)->format('g:ia'); } echo elgg_view_field(array('#type' => 'fieldset', 'name' => 'f16', 'legend' => 'Fieldset with a legend', 'fields' => [['#type' => 'text', '#label' => 'Text field', 'required' => true], ['#type' => 'fieldset', '#label' => 'Date and time fieldset', 'align' => 'horizontal', 'fields' => [['#type' => 'date', 'value' => time(), 'timestamp' => true, '#label' => 'Date'], ['#type' => 'select', '#label' => 'Time', 'options' => $hour_options]]], ['#type' => 'fieldset', '#label' => 'Nested fieldset', '#help' => 'Fieldset with horizontal alignment of fields', 'align' => 'horizontal', 'fields' => [['#type' => 'button', 'type' => 'submit', 'text' => 'Save', 'icon' => 'save'], ['#type' => 'button', 'text' => 'Download', 'icon' => 'download', 'class' => 'elgg-button-action'], ['#type' => 'button', 'type' => 'reset', 'text' => 'Cancel', 'icon' => 'remove']]]])); ?> </fieldset> </form>
<?php /** * Group edit form * * This view contains the group profile field configuration * * @package ElggGroups */ $name = elgg_extract('name', $vars); $group_profile_fields = (array) elgg_get_config('group'); echo elgg_view_field(['#type' => 'file', '#label' => elgg_echo('groups:icon'), 'name' => 'icon']); echo elgg_view_field(['#type' => 'text', '#label' => elgg_echo('groups:name'), 'required' => true, 'name' => 'name', 'value' => $name]); // show the configured group profile fields foreach ($group_profile_fields as $shortname => $valtype) { $options = ['#type' => $valtype, 'name' => $shortname, 'value' => elgg_extract($shortname, $vars)]; if ($valtype !== 'hidden') { $options['#label'] = elgg_echo("groups:{$shortname}"); } echo elgg_view_field($options); }
<?php /** * Provide a way of setting your password * * @package Elgg * @subpackage Core */ $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $title = elgg_echo('user:set:password'); // only make the admin user enter current password for changing his own password. $admin = ''; if (!elgg_is_admin_logged_in() || elgg_is_admin_logged_in() && $user->guid == elgg_get_logged_in_user_guid()) { $admin .= elgg_view_field(array('#type' => 'password', 'name' => 'current_password', '#label' => elgg_echo('user:current_password:label'))); } $password = elgg_view_field(array('#type' => 'password', 'name' => 'password', '#label' => elgg_echo('user:password:label'))); $password2 = elgg_view_field(array('#type' => 'password', 'name' => 'password2', '#label' => elgg_echo('user:password2:label'))); $content = $admin . $password . $password2; echo elgg_view_module('info', $title, $content);
<?php /** * Advanced site settings, site section. */ $strength = _elgg_get_site_secret_strength(); $current_strength = elgg_echo('site_secret:current_strength'); $strength_text = elgg_echo("site_secret:strength:{$strength}"); $strength_msg = elgg_echo("site_secret:strength_msg:{$strength}"); $body = '<p>' . elgg_echo('admin:site:secret:intro') . '</p>'; $body .= elgg_view_module('main', "{$current_strength}: {$strength_text}", $strength_msg, ['class' => $strength != 'strong' ? 'elgg-message elgg-state-error' : 'elgg-message elgg-state-success']); $body .= elgg_view_field(['#type' => 'checkbox', 'label' => elgg_echo('admin:site:secret:regenerate'), 'value' => 1, 'name' => 'regenerate_site_secret', '#help' => elgg_echo('admin:site:secret:regenerate:help')]); echo elgg_view_module('inline', elgg_echo('admin:legend:security'), $body, ['id' => 'elgg-settings-advanced-security']);
<?php if (!elgg_is_admin_logged_in()) { // only admins are allowed to change the username return; } $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $body .= elgg_view_field(['#type' => 'text', '#help' => elgg_echo('user:username:help'), 'name' => 'username', 'value' => $user->username]); echo elgg_view_module('info', elgg_echo('username'), $body);
/** * Edit blog form * * @package Blog */ $blog = get_entity($vars['guid']); $vars['entity'] = $blog; $draft_warning = elgg_extract('draft_warning', $vars); if ($draft_warning) { echo '<span class="mbm elgg-text-help">' . $draft_warning . '</span>'; } $categories_vars = $vars; $categories_vars['#type'] = 'categories'; $fields = [['#label' => elgg_echo('title'), '#type' => 'text', 'name' => 'title', 'id' => 'blog_title', 'value' => elgg_extract('title', $vars)], ['#label' => elgg_echo('blog:excerpt'), '#type' => 'text', 'name' => 'excerpt', 'id' => 'blog_excerpt', 'value' => elgg_html_decode(elgg_extract('excerpt', $vars))], ['#label' => elgg_echo('blog:body'), '#type' => 'longtext', 'name' => 'description', 'id' => 'blog_description', 'value' => elgg_extract('description', $vars)], ['#label' => elgg_echo('tags'), '#type' => 'tags', 'name' => 'tags', 'id' => 'blog_tags', 'value' => elgg_extract('tags', $vars)], $categories_vars, ['#label' => elgg_echo('comments'), '#type' => 'select', 'name' => 'comments_on', 'id' => 'blog_comments_on', 'value' => elgg_extract('comments_on', $vars), 'options_values' => ['On' => elgg_echo('on'), 'Off' => elgg_echo('off')]], ['#label' => elgg_echo('access'), '#type' => 'access', 'name' => 'access_id', 'id' => 'blog_access_id', 'value' => elgg_extract('access_id', $vars), 'entity' => elgg_extract('entity', $vars), 'entity_type' => 'object', 'entity_subtype' => 'blog'], ['#label' => elgg_echo('status'), '#type' => 'select', 'name' => 'status', 'id' => 'blog_status', 'value' => elgg_extract('status', $vars), 'options_values' => ['draft' => elgg_echo('status:draft'), 'published' => elgg_echo('status:published')]], ['#type' => 'hidden', 'name' => 'container_guid', 'value' => elgg_get_page_owner_guid()], ['#type' => 'hidden', 'name' => 'guid', 'value' => elgg_extract('guid', $vars)]]; foreach ($fields as $field) { echo elgg_view_field($field); } $save_status = elgg_echo('blog:save_status'); if ($blog) { $saved = date('F j, Y @ H:i', $blog->time_created); } else { $saved = elgg_echo('never'); } $footer = <<<___HTML <div class="elgg-subtext mbm"> \t{$save_status} <span class="blog-save-status-time">{$saved}</span> </div> ___HTML; $footer .= elgg_view('input/submit', ['value' => elgg_echo('save'), 'name' => 'save']); // published blogs do not get the preview button if (!$blog || $blog->status != 'published') {
<?php /** * Edit settings for river widget */ $widget = elgg_extract('entity', $vars); // dashboard widget has type parameter if (elgg_in_context('dashboard')) { if (!isset($widget->content_type)) { $widget->content_type = 'friends'; } echo elgg_view_field(['#type' => 'select', 'name' => 'params[content_type]', '#label' => elgg_echo('river:widget:type'), 'value' => $widget->content_type, 'options_values' => ['friends' => elgg_echo('river:widgets:friends'), 'all' => elgg_echo('river:widgets:all')]]); } echo elgg_view('object/widget/edit/num_display', ['entity' => $widget, 'default' => 8]); // pass the context so we have the correct output upon save. $context = elgg_in_context('dashboard') ? 'dashboard' : 'profile'; echo elgg_view('input/hidden', ['name' => 'context', 'value' => $context]);
<?php /** * Elgg forgotten password. * * @package Elgg * @subpackage Core */ $username = elgg_extract('username', $vars, ''); echo elgg_view('output/longtext', ['value' => elgg_echo('user:password:text')]); echo elgg_view_field(['#type' => 'text', '#label' => elgg_echo('loginusername'), 'name' => 'username', 'value' => $username, 'autofocus' => empty($username)]); echo elgg_view_field(['#type' => 'captcha']); $footer = elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('request')]); elgg_set_form_footer($footer);
<?php /** * Reset user password form */ echo elgg_view('output/longtext', ['value' => elgg_echo('user:changepassword:change_password_confirm')]); $fields = [['#type' => 'hidden', 'name' => 'u', 'value' => elgg_extract('guid', $vars)], ['#type' => 'hidden', 'name' => 'c', 'value' => elgg_extract('code', $vars)], ['#type' => 'password', '#label' => elgg_echo('user:password:label'), 'name' => 'password1'], ['#type' => 'password', '#label' => elgg_echo('user:password2'), 'name' => 'password2']]; foreach ($fields as $field) { echo elgg_view_field($field); } $footer = elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('changepassword')]); elgg_set_form_footer($footer);
<?php /** * Friend widget options */ $widget = elgg_extract('entity', $vars); // set default value for icon size if (!isset($widget->icon_size)) { $widget->icon_size = 'small'; } echo elgg_view('object/widget/edit/num_display', ['entity' => $widget, 'default' => 12, 'label' => elgg_echo('friends:num_display'), 'options' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 30, 50, 100]]); echo elgg_view_field(['#type' => 'select', 'name' => 'params[icon_size]', '#label' => elgg_echo('friends:icon_size'), 'value' => $widget->icon_size, 'options_values' => ['small' => elgg_echo('friends:small'), 'tiny' => elgg_echo('friends:tiny')]]);
<?php /** * Provide a way of setting your language prefs * * @package Elgg * @subpackage Core */ $user = elgg_get_page_owner_entity(); if (!$user instanceof ElggUser) { return; } $title = elgg_echo('user:set:language'); $content = elgg_view_field(array('#type' => 'select', 'name' => 'language', 'value' => $user->language, 'options_values' => get_installed_translations(), '#label' => elgg_echo('user:language:label'))); echo elgg_view_module('info', $title, $content);
<?php /** * Add a new field to the set of custom profile fields */ echo elgg_view('output/longtext', ['value' => elgg_echo('profile:explainchangefields')]); echo elgg_view_field(['#type' => 'text', '#label' => elgg_echo('profile:label'), 'name' => 'label']); echo elgg_view_field(['#type' => 'select', '#label' => elgg_echo('profile:type'), 'name' => 'type', 'options_values' => ['text' => elgg_echo('profile:field:text'), 'longtext' => elgg_echo('profile:field:longtext'), 'tags' => elgg_echo('profile:field:tags'), 'url' => elgg_echo('profile:field:url'), 'email' => elgg_echo('profile:field:email'), 'location' => elgg_echo('profile:field:location'), 'date' => elgg_echo('profile:field:date')]]); $footer = elgg_view_field(['#type' => 'submit', 'name' => elgg_echo('add'), 'value' => elgg_echo('add')]); elgg_set_form_footer($footer);