/** * Wrap list views into a container that can be manipulated * * @param string $hook "view" * @param string $type "page/components/list" or "page/components/gallery" * @param string $view View * @param array $params Hook params * @return string Wrapped view */ function wrap_list_view_hook($hook, $type, $view, $params) { $viewtype = elgg_extract('viewtype', $params, 'default'); if ($viewtype !== 'default') { return; } $vars = elgg_extract('vars', $params); $pagination = elgg_extract('pagination', $vars, false); $pagination_type = elgg_extract('pagination_type', $vars, elgg_get_plugin_setting('pagination_type', 'hypeLists')); if (!$pagination || !$pagination_type) { return $view; } $no_results = elgg_extract('no_results', $vars, ''); $no_results_str = $no_results instanceof Closure ? $no_results() : $no_results; $list_classes = $type == 'page/components/gallery' ? ['elgg-gallery'] : ['elgg-list']; if (isset($vars['list_class'])) { $list_classes[] = $vars['list_class']; } $list_id = isset($vars['list_id']) ? $vars['list_id'] : ''; if (!$list_id) { $list_id = md5(serialize(array(elgg_extract('container_class', $vars), implode(' ', $list_classes), elgg_extract('item_class', $vars), $no_results_str, elgg_extract('pagination', $vars), elgg_extract('base_url', $vars)))); } $container_class = array_filter(array('elgg-list-container', elgg_extract('container_class', $vars))); $wrapper_params = array('class' => implode(' ', $container_class), 'data-list-id' => $list_id, 'data-base-url' => elgg_extract('base_url', $vars), 'data-count' => elgg_extract('count', $vars, 0), 'data-pagination' => $pagination_type, 'data-pagination-position' => elgg_extract('position', $vars, $pagination_type === 'infinite' ? 'both' : 'after'), 'data-pagination-num-pages' => (int) elgg_extract('num_pages', $vars, 10), 'data-text-no-results' => $no_results_str, 'data-limit' => elgg_extract('limit', $vars, 10), 'data-offset' => elgg_extract('offset', $vars, 0), 'data-offset-key' => elgg_extract('offset_key', $vars, 'offset'), 'data-lazy-load' => (int) elgg_extract('lazy_load', $vars, 6), 'data-auto-refresh' => elgg_extract('auto_refresh', $vars, false), 'data-reversed' => elgg_extract('reversed', $vars, false), 'data-list-time' => get_input('list_time', time()), 'data-list-classes' => implode(' ', $list_classes)); foreach ($vars as $key => $val) { if (substr($key, 0, 5) === 'data-' && !array_key_exists($key, $wrapper_params)) { $wrapper_params[$key] = $val; } } $view .= elgg_view('js/framework/lists/require'); return elgg_format_element('div', $wrapper_params, $view); }
/** * Returns form body HTML * @return string */ public function viewBody() { // Get sticky values $sticky_values = hypePrototyper()->prototype->getStickyValues($this->action); hypePrototyper()->prototype->clearStickyValues($this->action); // Get validation errors and messages $validation_status = hypePrototyper()->prototype->getValidationStatus($this->action); hypePrototyper()->prototype->clearValidationStatus($this->action); // Prepare fields $i = 0; foreach ($this->fields as $field) { if (!$field instanceof Field) { continue; } if ($field->getInputView() === false) { continue; } $shortname = $field->getShortname(); if (isset($sticky_values[$shortname])) { $field->setStickyValue($sticky_values[$shortname]); } if (isset($validation_status[$shortname])) { $field->setValidation($validation_status[$shortname]['status'], $validation_status[$shortname]['messages']); } $output .= $field->viewInput(array('index' => $i, 'entity' => $this->entity)); $i++; } $submit = elgg_view('prototyper/input/submit', array('entity' => $this->entity, 'action' => $this->action)); $output .= elgg_format_element('div', array('class' => 'elgg-foot'), $submit); return $output; }
/** * Test elgg_format_element() */ public function testElggFormatElement() { $tests = array('<span>a&b</span>' => array('tag_name' => 'span', 'text' => 'a&b', 'encode_text' => true), '<img src="a&b">' => array('tag_name' => 'img', 'src' => 'a&b', 'text' => 'ignored'), '<foo />' => array('tag_name' => 'foo', 'is_void' => true, 'is_xml' => true)); foreach ($tests as $expected => $vars) { $this->assertEqual(elgg_format_element($vars), $expected); } try { elgg_format_element(array()); $this->fail('Failed to throw exception'); } catch (InvalidArgumentException $e) { $this->pass(); } }
/** * Show the group access status indicator * * @param string $hook the name of the hook * @param string $type the type of the hook * @param \ElggMenuItem[] $return_value current return vaue * @param array $params supplied params * * @return void|\ElggMenuItem[] */ public static function showGroupHiddenIndicator($hook, $type, $return_value, $params) { $entity = elgg_extract('entity', $params); if (!$entity instanceof \ElggGroup) { return; } if (!group_tools_show_hidden_indicator($entity)) { return; } $access_id_string = get_readable_access_level($entity->access_id); $text = elgg_format_element('span', ['title' => $access_id_string], elgg_view_icon('eye')); $return_value[] = \ElggMenuItem::factory(['name' => 'hidden_indicator', 'text' => $text, 'href' => false, 'priority' => 1]); return $return_value; }
/** * Add menu items to the topbar * * @param string $hook the name of the hook * @param string $type the type of the hook * @param \ElggMenuItem[] $return_value the current return value * @param array $params supplied params * * @return void|\ElggMenuItem[] */ public static function register($hook, $type, $return_value, $params) { $user = elgg_get_logged_in_user_entity(); if (empty($user)) { return; } $options = ['type' => 'user', 'count' => true, 'relationship' => 'friendrequest', 'relationship_guid' => $user->getGUID(), 'inverse_relationship' => true]; $count = elgg_get_entities_from_relationship($options); if (empty($count)) { return; } $return_value[] = \ElggMenuItem::factory(['name' => 'friend_request', 'href' => "friend_request/{$user->username}", 'text' => elgg_view_icon('user') . elgg_format_element('span', ['class' => 'friend-request-new'], $count), 'title' => elgg_echo('friend_request:menu'), 'priority' => 301]); return $return_value; }
/** * Render the index in the export for every page below the provided page * * @param ElggObject $page the page to render for * * @return false|string */ function pages_tools_render_index(ElggObject $page) { if (!pages_tools_is_valid_page($page)) { return false; } $children = pages_tools_get_ordered_children($page); if (empty($children)) { return false; } $result = ""; foreach ($children as $child) { $content = elgg_view("output/url", array("text" => $child->title, "href" => "#page_" . $child->getGUID(), "title" => $child->title)); $child_index = pages_tools_render_index($child); if (!empty($child_index)) { $content .= elgg_format_element('ul', array(), $child_index); } $result .= elgg_format_element('li', array(), $content); } return $result; }
/** * Change menu item in the longtext menu * * @param string $hook 'prepare' * @param string $type 'menu:longtext' * @param ElggMenuItem[] $return_value the current menu items * @param array $params supplied params * * @return ElggMenuItem[] */ public static function longtextMenuPrepare($hook, $type, $return_value, $params) { if (!is_array($return_value)) { return; } foreach ($return_value as $section => $menu_items) { if (!is_array($menu_items)) { continue; } foreach ($menu_items as $menu_item) { if ($menu_item->getName() !== 'embed') { continue; } echo elgg_format_element('script', [], 'require(["embed_extended/site"]);'); $link_class = $menu_item->getLinkClass(); $link_class = str_ireplace('elgg-lightbox', 'elgg-embed-lightbox', $link_class); $menu_item->setLinkClass($link_class); $menu_item->setHref('embed'); } } }
/** * Adds static pages to the search advanced autocomplete dropdown * * @param string $hook 'autocomplete' * @param string $type 'search_advanced' * @param array $return_value current search results * @param array $params supplied params * * @return array */ public static function searchAdvancedAutocomplete($hook, $type, $return_value, $params) { $query = elgg_extract('query', $params); if (empty($query)) { return; } $limit = (int) elgg_extract('limit', $params, 5); $options = ['type' => 'object', 'subtype' => \StaticPage::SUBTYPE, 'limit' => $limit, 'joins' => ['JOIN ' . elgg_get_config('dbprefix') . 'objects_entity oe ON e.guid = oe.guid'], 'wheres' => ["(oe.title LIKE '%{$query}%' OR oe.description LIKE '%{$query}%')"]]; $entities = elgg_get_entities($options); if (empty($entities)) { return; } if (count($entities) >= $limit) { $options['count'] = true; $static_count = elgg_get_entities($options); } else { $static_count = count($entities); } $return_value[] = ['type' => 'placeholder', 'content' => elgg_format_element('label', [], elgg_echo('item:object:static') . ' (' . $static_count . ')'), 'href' => elgg_normalize_url('search?entity_subtype=static&entity_type=object&search_type=entities&q=' . $query)]; foreach ($entities as $entity) { $return_value[] = ['type' => 'object', 'value' => $entity->title, 'href' => $entity->getURL(), 'content' => elgg_view('static/search_advanced/item', ['entity' => $entity])]; } return $return_value; }
/** * Render an entity profile * * @param array $vars Vars to pass to teach field view * @return string HTML */ public function view($vars = array()) { $output = ''; $vars['entity'] = $this->entity; foreach ($this->fields as $field) { if (!$field instanceof Field) { continue; } if ($field->getOutputView() === false) { continue; } if ($field->getType() == 'hidden' || $field->getValueType() == 'hidden') { continue; } if ($field->isHiddenOnProfile()) { continue; } $field_view = $field->viewOutput($vars); if ($field_view) { $output .= elgg_format_element('div', array('class' => 'prototyper-output'), $field_view); } } return $output; }
/** * Callback function for username preg_replace_callback * * @param array $matches An array of matches * @return string */ public static function callbackEmail($matches) { if (empty($matches[2])) { return $matches[0]; } return $matches[1] . elgg_format_element('a', array('class' => 'scraper-email', 'href' => "mailto:{$matches[2]}", 'data-qualifier' => 'email'), $matches[2]); }
} // count members $member_count = $group->getMembers(['count' => true]); // count how manyu members are notified by email $notification_options = ['type' => 'user', 'count' => true, 'relationship' => 'notifyemail', 'relationship_guid' => $group->getGUID(), 'inverse_relationship' => true]; $notification_count = elgg_get_entities_from_relationship($notification_options); if (elgg_is_active_plugin('site_notifications')) { // maybe more members are being notified by site $notification_options['relationship'] = 'notifysite'; $site_notification_count = elgg_get_entities_from_relationship($notification_options); if (!empty($site_notification_count)) { if ($site_notification_count > $notification_count) { $notification_count = $site_notification_count; } } } // start building content $title = elgg_echo('group_tools:notifications:title'); $content = elgg_format_element('div', ['class' => 'mbm'], elgg_echo('group_tools:notifications:description', [$member_count, $notification_count])); // enable notification for everyone if ($member_count > $notification_count) { $content .= elgg_view('output/url', ['href' => "action/group_tools/notifications?toggle=enable&guid={$group->getGUID()}", 'text' => elgg_echo('group_tools:notifications:enable'), 'class' => 'elgg-button elgg-button-submit mrm', 'confirm' => true]); } // disable notification if ($notification_count > 0) { $content .= elgg_view('output/url', ['href' => "action/group_tools/notifications?toggle=disable&guid={$group->getGUID()}", 'text' => elgg_echo('group_tools:notifications:disable'), 'class' => 'elgg-button elgg-button-submit', 'confirm' => true]); } // disclaimer about timing $content .= elgg_format_element('div', ['class' => 'elgg-quiet mtm'], elgg_echo('group_tools:notifications:disclaimer')); // echo content echo elgg_view_module('info', $title, $content);
<?php $owner = $vars['entity']->getOwnerEntity(); $tips = ''; if ($owner->getGUID() === elgg_get_logged_in_user_guid()) { $completeness = profile_manager_profile_completeness($owner); $percentage_complete = $completeness['percentage_completeness']; // save the percentage $owner->profile_completeness_percentage = $percentage_complete; $missing_fields = $completeness['missing_fields']; if (count($missing_fields) > 0) { $rand_key = array_rand($missing_fields); $field = $missing_fields[$rand_key]; $tips = elgg_echo('widgets:profile_completeness:view:tips', ['<b>' . $field->getTitle() . '</b>']); } else { $tips = elgg_echo('widgets:profile_completeness:view:complete'); } } else { if ($owner->profile_completeness_percentage) { $percentage_complete = $owner->profile_completeness_percentage; } else { $completeness = profile_manager_profile_completeness($owner); $percentage_complete = $completeness["percentage_completeness"]; } } $progress = elgg_format_element('div', ['id' => 'widget_profile_completeness_progress'], "{$percentage_complete}%"); $progress .= elgg_format_element('div', ['id' => 'widget_profile_completeness_progress_bar', 'style' => "width: {$percentage_complete}%;"]); echo elgg_format_element('div', ['id' => 'widget_profile_completeness_container'], $progress); echo $tips;
if ($auto_save_annotations) { $revisions[] = $auto_save_annotations[0]; } $saved_revisions = $blog->getAnnotations(['annotation_name' => 'blog_revision', 'reverse_order_by' => true, 'limit' => false]); $revisions = array_merge($revisions, $saved_revisions); if (empty($revisions)) { return; } $load_base_url = "blog/edit/{$blog->getGUID()}"; // show the "published revision" $published_item = ''; if ($blog->status == 'published') { $load = elgg_view('output/url', ['href' => $load_base_url, 'text' => elgg_echo('status:published'), 'is_trusted' => true]); $time = elgg_format_element('span', ['class' => 'elgg-subtext'], elgg_view_friendly_time($blog->time_created)); $published_item = elgg_format_element('li', [], "{$load}: {$time}"); } $n = count($revisions); $revisions_list = ''; foreach ($revisions as $revision) { $time = elgg_format_element('span', ['class' => 'elgg-subtext'], elgg_view_friendly_time($revision->time_created)); if ($revision->name == 'blog_auto_save') { $revision_lang = elgg_echo('blog:auto_saved_revision'); } else { $revision_lang = elgg_echo('blog:revision') . " {$n}"; } $load = elgg_view('output/url', array('href' => "{$load_base_url}/{$revision->id}", 'text' => $revision_lang, 'is_trusted' => true)); $revisions_list .= elgg_format_element('li', ['class' => 'auto-saved'], "{$load}: {$time}"); $n--; } $body = elgg_format_element('ul', ['class' => 'blog-revisions'], $published_item . $revisions_list); echo elgg_view_module('aside', elgg_echo('blog:revisions'), $body);
<?php $group = elgg_extract('entity', $vars); $subgroup = elgg_extract('subgroup', $vars); if (!$group instanceof ElggGroup || !$subgroup instanceof ElggGroup) { return; } elgg_push_context('widgets'); // use widgets context so no entity menu is used if (\AU\SubGroups\can_move_subgroup($subgroup, $group)) { $class = 'au-subgroups-parentable'; } else { $class = 'au-subgroups-non-parentable'; } $action_url = elgg_normalize_url("action/au_subgroups/move?parent_guid={$group->guid}"); $action_url = elgg_add_action_tokens_to_url($action_url); $view = elgg_view_entity($group, array('full_view' => false)); echo elgg_format_element('div', ['class' => \AU\SubGroups\can_move_subgroup($subgroup, $group) ? 'au-subgroups-parentable' : 'au-subgroups-non-parentable', 'data-action' => $action_url], $view); elgg_pop_context();
$list_class = "elgg-categories"; if (isset($vars['list_class'])) { $list_class = "{$list_class} {$vars['list_class']}"; } $item_class = "elgg-category"; if (isset($vars['item_class'])) { $item_class = "{$item_class} {$vars['item_class']}"; } $list_items = array(); foreach ($vars['categories'] as $category) { if (!hypeCategories()->categories->instanceOfCategory($category)) { continue; } $children = hypeCategories()->categories->getSubcategories($category, array('count' => true)); if ($children > 0) { continue; } $crumbs = array(); $hierarchy = hypeCategories()->categories->getHierarchy($category, false, true); foreach ($hierarchy as $h) { $crumbs[] = $h->getDisplayName(); } $list_items[] = elgg_format_element('li', array('class' => $item_class), elgg_view('output/url', array('href' => $category->getURL(), 'title' => implode(" ‣ ", $crumbs), 'text' => $category->getDisplayName()))); } if (empty($list_items)) { return; } $icon = elgg_format_element('li', array(), elgg_view_icon('categories', $icon_class)); $list = implode('', $list_items); echo elgg_format_element('ul', array('class' => $list_class), $icon . $list);
<?php /** * Display a list of notification subjects */ elgg_ajax_gatekeeper(); $guid = elgg_extract('guid', $vars); $notification = get_entity($guid); if (!$notification instanceof ElggNotification) { forward('', '403'); } $content = elgg_view_entity_list($notification->getSubjects()); echo elgg_format_element('div', ['class' => 'notifier-lightbox-wrapper'], $content);
$form_data .= '<table class="elgg-table">'; $form_data .= '<thead>'; $form_data .= '<tr>'; $form_data .= '<th class="center">' . elgg_view('input/checkbox', ['name' => 'checkall', 'default' => false]) . '</th>'; $form_data .= '<th>' . elgg_echo('groups:group') . '</th>'; $form_data .= '<th class="center">' . elgg_echo('groups:edit') . '</th>'; $form_data .= '<th class="center">' . elgg_echo('groups:delete') . '</th>'; $form_data .= '</tr>'; $form_data .= '</thead>'; // add group rows $rows = []; foreach ($batch as $group) { $cells = []; // brief view $icon = elgg_view_entity_icon($group, 'tiny'); $params = ['entity' => $group, 'metadata' => '', 'subtitle' => $group->briefdescription]; $list_body = elgg_view('group/elements/summary', $params); $group_summary = elgg_view_image_block($icon, $list_body); $cells[] = elgg_format_element('td', ['class' => 'center'], elgg_view('input/checkbox', ['name' => 'group_guids[]', 'value' => $group->getGUID(), 'default' => false])); $cells[] = elgg_format_element('td', [], $group_summary); $cells[] = elgg_format_element('td', ['class' => 'center'], elgg_view('output/url', ['text' => elgg_view_icon('settings-alt'), 'title' => elgg_echo('edit'), 'href' => "groups/edit/{$group->getGUID()}"])); $cells[] = elgg_format_element('td', ['class' => 'center'], elgg_view('output/url', ['text' => elgg_view_icon('delete-alt'), 'title' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'), 'href' => "action/groups/delete?guid={$group->getGUID()}"])); $rows[] = elgg_format_element('tr', [], implode('', $cells)); } $form_data .= elgg_format_element('tbody', [], implode('', $rows)); $form_data .= '</table>'; $form_data .= $delete_button; // pagination $form_data .= elgg_view('navigation/pagination', ['limit' => $limit, 'offset' => $offset, 'count' => $group_count]); echo elgg_view('input/form', ['id' => 'group-tools-admin-bulk-delete', 'action' => 'action/group_tools/admin/bulk_delete', 'body' => $form_data]); elgg_require_js('group_tools/group_bulk_delete');
unset($vars['class']); $list_class[] = 'elgg-input-checkboxes'; $list_class[] = "elgg-{$vars['align']}"; $id = elgg_extract('id', $vars, ''); unset($vars['id']); if (is_array($vars['value'])) { $values = array_map('elgg_strtolower', $vars['value']); } else { $values = array(elgg_strtolower($vars['value'])); } $input_vars = $vars; $input_vars['default'] = false; if ($vars['name']) { $input_vars['name'] = "{$vars['name']}[]"; } unset($input_vars['align']); unset($input_vars['options']); // include a default value so if nothing is checked 0 will be passed. if ($vars['name'] && $vars['default'] !== false) { echo elgg_view('input/hidden', ['name' => $vars['name'], 'value' => $default]); } $checkboxes = ''; foreach ($vars['options'] as $label => $value) { $input_vars['checked'] = in_array(elgg_strtolower($value), $values); $input_vars['value'] = $value; $input_vars['label'] = $label; $input = elgg_view('input/checkbox', $input_vars); $checkboxes .= "<li>{$input}</li>"; } echo elgg_format_element('ul', ['class' => $list_class, 'id' => $id], $checkboxes);
*/ $current_language = elgg_extract('language', $vars); $english = elgg_extract('english', $vars); $translation = elgg_extract('translation', $vars); $plugin = elgg_extract('plugin', $vars); $row_rel = elgg_extract('row_rel', $vars); if (!empty($row_rel)) { $row_rel = 'rel="' . $row_rel . '"'; } $en_flag = elgg_view('output/te_flag', ['language' => 'en']); $lang_flag = elgg_view('output/te_flag', ['language' => $current_language]); // English information $row = '<tr ' . $row_rel . '>'; $row .= '<td>' . $en_flag . '</td>'; $row .= '<td>'; $row .= elgg_view_icon('key', ['title' => $english['key'], 'class' => 'float-alt translation-editor-translation-key']); $row .= elgg_format_element('pre', ['class' => 'translation_editor_pre'], nl2br(htmlspecialchars($english['value']))); $row .= '</td>'; $row .= '</tr>'; // Custom language information $translation_value = elgg_extract('value', $translation); $row_count = max(2, count(explode('\\n', $translation_value))); $key = elgg_extract('key', $translation); $text_options = ['name' => "translation[{$current_language}][{$plugin}][{$key}]", 'value' => $translation_value, 'rows' => $row_count, 'class' => 'translation-editor-input']; $row .= '<tr ' . $row_rel . '>'; $row .= '<td>' . $lang_flag . '</td>'; $row .= '<td>'; $row .= elgg_view('input/plaintext', $text_options); $row .= '</td>'; $row .= '</tr>'; echo $row;
} $contents = $body . $footer; if ($show_inner) { $contents = elgg_format_element('div', ['class' => 'elgg-inner'], $contents); } echo elgg_format_element('div', $attrs, $contents); } else { //Normal Style Below $attrs['class'][] = 'panel panel-custom'; if ($type) { $attrs['class'][] = "elgg-module-{$type}"; } $header = elgg_extract('header', $vars); if ($title) { $header = elgg_format_element('h2', ['class' => ''], $title); } if ($header !== null) { $header = elgg_format_element('div', ['class' => 'panel-heading'], $header); } $body = elgg_format_element('div', ['class' => 'panel-body clearfix'], $body); if ($footer) { $footer = elgg_format_element('div', ['class' => 'panel-footer text-right'], $footer); } $contents = $header . $body . $footer; if ($show_inner) { $contents = elgg_format_element('div', ['class' => 'elgg-inner'], $contents); } echo elgg_format_element('div', $attrs, $contents); //echo $checkPage; } }
$row_attrs['class'][] = "elgg-item-{$type}"; $row_attrs['data-elgg-guid'] = $guid; $row_attrs['data-elgg-type-subtype'] = "{$type}:{$subtype}"; if ($subtype) { $row_attrs['class'][] = "elgg-item-{$type}-{$subtype}"; } } else { if (is_callable(array($item, 'getType'))) { $type = $item->getType(); $row_attrs['data-elgg-id'] = $item->id; $row_attrs['data-elgg-type'] = $type; } } $row = ''; foreach ($columns as $column) { $cell = trim($column->renderCell($item, $type, $vars)); if (!preg_match('~^<t[dh]~i', $cell)) { $cell = "<td>{$cell}</td>"; } $row .= $cell; } $rows .= elgg_format_element('tr', $row_attrs, $row); } $body = "{$headings}<tbody>{$rows}</tbody>"; if ($position == 'before' || $position == 'both') { echo $nav; } echo elgg_format_element('table', ['class' => $table_classes], $body); if ($position == 'after' || $position == 'both') { echo $nav; }
$plugin = elgg_extract('entity', $vars); $noyes_options = ['no' => elgg_echo('option:no'), 'yes' => elgg_echo('option:yes')]; $url_postfix_replacements = ['{guid}']; $setting = elgg_echo('newsletter:settings:allow_groups'); $setting .= elgg_view('input/select', ['name' => 'params[allow_groups]', 'value' => $plugin->allow_groups, 'options_values' => $noyes_options, 'class' => 'mls']); $setting .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('newsletter:settings:allow_groups:description')); echo elgg_format_element('div', [], $setting); $setting = elgg_echo('newsletter:settings:include_existing_users'); $setting .= elgg_view('input/select', ['name' => 'params[include_existing_users]', 'value' => $plugin->include_existing_users, 'options_values' => array_reverse($noyes_options), 'class' => 'mls']); $setting .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('newsletter:settings:include_existing_users:description')); echo elgg_format_element('div', [], $setting); $setting = elgg_echo('newsletter:settings:custom_from'); $setting .= elgg_view('input/select', ['name' => 'params[custom_from]', 'value' => $plugin->custom_from, 'options_values' => $noyes_options, 'class' => 'mls']); $setting .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('newsletter:settings:custom_from:description')); echo elgg_format_element('div', [], $setting); $setting = elgg_echo('newsletter:settings:custom_from:domains'); $setting .= elgg_view('input/text', ['name' => 'params[custom_from_domains]', 'value' => $plugin->custom_from_domains]); $setting .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('newsletter:settings:custom_from:domains:description')); echo elgg_format_element('div', [], $setting); // url postfix $url_postfix = elgg_view('output/longtext', ['value' => elgg_echo('newsletter:settings:url_postfix:description')]); if ($plugin->url_postfix_name || $plugin->url_postfix_value) { $url_postfix .= elgg_format_element('div', ['class' => 'elgg-message elgg-state-error'], elgg_echo('newsletter:settings:url_postfix:upgrade')); } $url_postfix .= '<div>'; $url_postfix .= elgg_echo('newsletter:settings:url_postfix:setting'); $url_postfix .= elgg_view('input/plaintext', ['name' => 'params[url_postfix]', 'value' => $plugin->url_postfix]); $url_postfix .= elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('newsletter:settings:url_postfix:setting:description', [implode(' ', $url_postfix_replacements)])); $url_postfix .= '</div>'; echo elgg_view_module('inline', elgg_echo('newsletter:settings:url_postfix'), $url_postfix);
<?php /** * Elgg Feedback plugin * Feedback interface for Elgg sites * * for Elgg 1.8 onwards by iionly * iionly@gmx.de * * List the latest feedback entries */ $entity = elgg_extract('entity', $vars); echo elgg_view('lists/feedback', array('limit' => $entity->num_display ?: 4)); $more_link = elgg_view('output/url', array('href' => 'feedback/all', 'text' => elgg_echo('link:view:all'))); echo elgg_format_element('div', ['class' => 'elgg-widget-more'], $more_link);
if (isset($vars['returntoreferer'])) { echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true')); } ?> <?php /* echo elgg_view_menu('login', array( 'sort_by' => 'priority', 'class' => 'elgg-menu-general elgg-menu-hz mtm', )); */ echo '<a href="' . $site_url . 'forgotpassword" class="col-xs-12 mrgn-tp-md">' . elgg_echo('user:forgot') . '</a>'; ?> </div> <?php //stat tracking groups and discussions $groups = elgg_get_entities(array('count' => true, 'types' => 'group')); $discussions = elgg_get_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'count' => true)); //Nick - adding some stats to the bottom of the landing / login page (Should only appear on that page) if (elgg_in_context('login')) { $inside_stats = ['<span class="login-big-num">' . $groups . '</span> ' . elgg_echo('groups'), elgg_echo('wet:login:departments'), elgg_echo('wet:login:discussions', array($discussions))]; foreach ($inside_stats as $stat) { $insides .= '<div class="col-sm-4 text-center login-stats-child">' . $stat . '</div>'; } $nextrow = elgg_format_element('div', array('class' => 'col-sm-6 col-sm-offset-3 mrgn-tp-lg login-stats'), $insides); echo elgg_format_element('div', array('class' => 'col-sm-12'), $nextrow); }
<?php $entity = elgg_extract('entity', $vars); if (!$entity instanceof ElggEntity) { return; } $input_params = elgg_extract('input', $vars, array()); $name = elgg_extract('name', $input_params, 'categories'); $value = elgg_extract('value', $input_params, array()); $multiple = elgg_extract('multiple', $input_params, hypeCategories()->config->allowsMultipleInput()); if (hypeCategories()->categories->instanceOfCategory($entity)) { $has_children = hypeCategories()->categories->getSubcategories($entity, array('count' => true)); $checkbox = elgg_format_element('input', array('type' => $multiple === false ? 'radio' : 'checkbox', 'name' => "{$name}[]", 'value' => $entity->guid, 'checked' => is_array($value) && in_array($entity->guid, $value), 'class' => $has_children ? 'categories-tree-input-node' : 'categories-tree-input-leaf')); $title = $entity->getDisplayName(); } else { if ($entity instanceof ElggSite) { $title = elgg_echo('categories:select:site'); } else { if ($entity instanceof ElggGroup) { $title = elgg_echo('categories:select:group'); } else { $title = elgg_echo('categories:select'); } } } $label = elgg_format_element('span', array('class' => 'categories-tree-label'), $title); echo elgg_format_element('label', array('class' => 'categories-tree-node'), $checkbox . $label);
<?php $plugin = elgg_extract('entity', $vars); echo elgg_format_element('label', [], elgg_echo('target_blank:settings:link_suffix')); echo elgg_view('input/text', ['name' => 'params[link_suffix]', 'value' => $plugin->link_suffix]); echo elgg_format_element('div', ['class' => 'elgg-subtext'], elgg_echo('target_blank:settings:link_suffix:info'));
$upload_title = elgg_echo('media:upload'); $upload_mod = '<div class="elgg-text-help">' . elgg_echo('media:upload:instructions') . '</div>'; $upload_mod .= elgg_view("input/file", ['name' => 'media', 'class' => 'media-upload-input']); echo elgg_view_module('aside', $upload_title, $upload_mod, ['class' => 'media-upload-module']); // Cropper module $cropper_title = elgg_echo('media:crop:title'); $cropper_mod = elgg_format_element('p', ['class' => 'elgg-text-help'], elgg_echo('media:create:instructions')); $img = ''; $sizes = elgg_media_get_thumb_sizes($entity, $type); $ratio = $sizes['small']['square'] ? 1 : $sizes['small']['w'] / $sizes['small']['h']; if (elgg_has_media($entity, $type)) { $x = $y = 0; $width = $height = $sizes['master']['w']; if ($entity->{"{$type}_x2"} > $entity->{"{$type}_x1"} && $entity->{"{$type}_y2"} > $entity->{"{$type}_y1"}) { $x = (int) $entity->{"{$type}_x1"}; $y = (int) $entity->{"{$type}_y1"}; $width = (int) $entity->{"{$type}_x2"} - (int) $entity->{"{$type}_x1"}; $height = (int) $entity->{"{$type}_y2"} - (int) $entity->{"{$type}_y1"}; } $img = elgg_view('output/img', ['src' => $entity->getIconURL(['type' => $type, 'size' => 'master']), 'alt' => elgg_echo('media'), 'data-x' => $x, 'data-y' => $y, 'data-width' => $width, 'data-height' => $height]); } $cropper_mod .= elgg_format_element('div', ['class' => 'media-cropper-preview'], $img); foreach (['x1', 'y1', 'x2', 'y2'] as $coord) { $cropper_mod .= elgg_view('input/hidden', ['name' => $coord, 'value' => (int) $entity->{$coord}, "data-{$coord}" => true]); } $cropper_mod .= elgg_view('input/hidden', ['name' => 'type', 'value' => $type]); echo elgg_view_module('aside', $cropper_title, $cropper_mod, ['class' => 'media-cropper-module hidden', 'data-ratio' => $ratio]); $footer = elgg_view('input/submit', ['value' => elgg_echo('save'), 'disabled' => true, 'class' => 'elgg-state-disabled elgg-button-submit']); $footer .= elgg_view('input/hidden', ['name' => 'guid', 'value' => $entity->guid]); echo elgg_format_element('div', ['class' => 'elgg-foot'], $footer);
<?php /** * User account settings. * * Plugins should extend "forms/account/settings" to add to the settings. */ $user = elgg_get_page_owner_entity(); $form_body = elgg_view('forms/account/settings', $vars); $submit = elgg_view('input/submit', ['value' => elgg_echo('save'), 'class' => 'btn btn-primary']); $hidden = ''; if ($user) { // we need to include the user GUID so that admins can edit the settings of other users $hidden = elgg_view('input/hidden', ['name' => 'guid', 'value' => $user->guid]); } $form_body .= elgg_format_element('div', ['class' => 'elgg-foot'], $submit . $hidden); echo $form_body; //remove group notifications tab elgg_unregister_menu_item('page', '2_group_notify'); elgg_unregister_menu_item('page', '1_plugins');
$li_classes[] = 'elgg-state-selected'; $tab_selected = true; } $tabbed_cat_titles .= elgg_format_element('li', ['class' => $li_classes], $tab_link); } else { $cat_header = elgg_format_element('div', ['class' => 'elgg-head'], "<h3>{$title}</h3>"); } } $cat_body = elgg_format_element('div', ['class' => 'elgg-body'], "<fieldset>{$fields_result}</fieldset>"); $category_classes[] = 'profiles_go_register_category'; $category_classes[] = 'elgg-module'; $category_classes[] = 'elgg-module-info'; $cat_result = elgg_format_element('div', ['class' => $category_classes], $cat_header . $cat_body); if ($tabbed) { $tabbed_cat_content .= $cat_result; } else { $result .= $cat_result; } } if ($tabbed) { if ($tabbed_cat_titles) { $result .= elgg_format_element('ul', ['class' => 'elgg-tabs elgg-htabs', 'id' => 'profiles_go_register_tabbed'], $tabbed_cat_titles); $result .= elgg_format_element('div', [], $tabbed_cat_content); } else { $result .= $tabbed_cat_content; } } } if (!empty($result)) { echo elgg_format_element('fieldset', [], $result); }
<?php /** * A layout for the newsletter, to be used in preview, online and mail * * @uses $vars['entity'] The newsletter to be viewed */ $language = get_current_language(); $entity = elgg_extract('entity', $vars); $head = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; $head .= '<base target="_blank" />'; $head .= elgg_format_element('title', [], $entity->title); $body = elgg_format_element('style', ['type' => 'text/css'], elgg_view('newsletter/view/css', $vars)); $body .= elgg_view('newsletter/view/body', $vars); echo elgg_view('page/elements/html', ['head' => $head, 'body' => $body]);