Ejemplo n.º 1
0
<?php

$entity_guid = (int) get_input('entity_guid');
if (empty($entity_guid)) {
    return;
}
$nav = theme_haarlem_intranet_get_quick_nav($entity_guid);
$form_vars = array();
$body_vars = array('values' => $nav, 'entity_guid' => $entity_guid);
$form = elgg_view_form('theme_haarlem_intranet/quick_nav', $form_vars, $body_vars);
echo elgg_view_module('info', elgg_echo('theme_haarlem_intranet:quick_nav:title'), $form, array('class' => 'theme-haarlem-intranet-quick-nav-wrapper'));
?>
<script>
	$('.elgg-form-theme-haarlem-intranet-quick-nav > fieldset').sortable({
		items: '.elgg-discover',
		handle: '.elgg-icon-cursor-drag-arrow'
	});
</script>
Ejemplo n.º 2
0
/**
 * Add menu items to owner_block menu
 *
 * @param string         $hook         the name of the hook
 * @param string         $type         the type of the hook
 * @param ElggMenuItem[] $return_value current return value
 * @param mixed          $params       supplied params
 *
 * @return ElggMenuItem[]
 */
function theme_haarlem_intranet_quick_nav_menu($hook, $type, $return_value, $params)
{
    if (empty($params) || !is_array($params)) {
        return $return_value;
    }
    $entity = elgg_extract('entity', $params);
    if (empty($entity) || !elgg_instanceof($entity, 'group') && !elgg_instanceof($entity, 'object', 'widget')) {
        return $return_value;
    }
    $nav = theme_haarlem_intranet_get_quick_nav($entity->getGUID());
    if (!empty($nav)) {
        // show items
        foreach ($nav as $index => $config) {
            $icon = '';
            if (!empty($config['icon'])) {
                $icon = elgg_view_icon($config['icon']);
            }
            $return_value[] = ElggMenuItem::factory(array('name' => "quick_nav_{$index}", 'text' => $icon . $config['text'], 'href' => $config['href'], 'target' => elgg_extract('target', $config), 'section' => 'quick_nav', 'priority' => $index));
        }
    }
    // show add button
    if ($entity->canEdit()) {
        elgg_load_js('lightbox');
        elgg_load_css('lightbox');
        elgg_load_js('theme_haarlem_intranet_quick_nav');
        $return_value[] = ElggMenuItem::factory(array('name' => 'quick_nav_edit', 'text' => elgg_view_icon('plus') . elgg_echo('theme_haarlem_intranet:quick_nav:edit'), 'href' => "ajax/view/theme_haarlem_intranet/forms/quick_nav?entity_guid={$entity->getGUID()}", 'link_class' => 'elgg-lightbox', 'section' => 'quick_nav', 'priority' => 9999999));
    }
    return $return_value;
}