コード例 #1
0
ファイル: start.php プロジェクト: iionly/jpatchwork
function jpatchwork_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'sample';
    }
    elgg_set_context('jpatchwork');
    $page_type = $page[0];
    switch ($page_type) {
        case 'sample':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:sample_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/sample');
            elgg_set_viewtype('default');
            break;
        case 'frozenbubble':
            $area2 = elgg_view_title(elgg_echo('jpatchwork:frozenbubble_title'));
            // Add the form to this section
            elgg_set_viewtype('xml');
            $area2 .= elgg_view('jpatchwork/frozenbubble');
            elgg_set_viewtype('default');
            break;
        default:
            return false;
    }
    // Format page
    $body = elgg_view('page/layouts/one_sidebar', array('content' => $area2));
    // Draw it
    echo elgg_view_page(elgg_echo('jpatchwork:title'), $body);
    return true;
}
コード例 #2
0
ファイル: start.php プロジェクト: rasul/Elgg
/**
 * Profile page handler
 *
 * @param array $page Array of page elements, forwarded by the page handling mechanism
 */
function profile_page_handler($page)
{
    if (isset($page[0])) {
        $username = $page[0];
        $user = get_user_by_username($username);
        elgg_set_page_owner_guid($user->guid);
    }
    // short circuit if invalid or banned username
    if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
        register_error(elgg_echo('profile:notfound'));
        forward();
    }
    $action = NULL;
    if (isset($page[1])) {
        $action = $page[1];
    }
    if ($action == 'edit') {
        // use the core profile edit page
        $base_dir = elgg_get_root_path();
        require "{$base_dir}pages/profile/edit.php";
        return;
    }
    // main profile page
    $params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3);
    $content = elgg_view_layout('widgets', $params);
    $body = elgg_view_layout('one_column', array('content' => $content));
    echo elgg_view_page($title, $body);
}
コード例 #3
0
ファイル: start.php プロジェクト: elgg/elgg
/**
 * Redirect the requestor to the new URL
 * Checks the plugin setting to determine the course of action:
 * a) Displays an error page with the new URL
 * b) Forwards to the new URL and displays an error message
 * c) Silently forwards to the new URL
 *
 * @param string $url Relative or absolute URL
 * @return mixed
 */
function legacy_urls_redirect($url)
{
    $method = elgg_get_plugin_setting('redirect_method', 'legacy_urls');
    // we only show landing page or queue warning if html generating page
    $viewtype = elgg_get_viewtype();
    if ($viewtype != 'default' && !elgg_does_viewtype_fallback($viewtype)) {
        $method = 'immediate';
    }
    switch ($method) {
        case 'landing':
            $content = elgg_view('legacy_urls/message', array('url' => $url));
            $body = elgg_view_layout('error', array('content' => $content));
            echo elgg_view_page('', $body, 'error');
            return true;
            break;
        case 'immediate_error':
            // drop through after setting error message
            register_error(elgg_echo('changebookmark'));
        case 'immediate':
        default:
            $url = elgg_normalize_url($url);
            header("HTTP/1.1 301 Moved Permanently");
            header("Location: {$url}");
            exit;
            break;
    }
}
コード例 #4
0
ファイル: blog_lib.php プロジェクト: adamboardman/Elgg
/**
 * Returns HTML to edit a blog post.
 *
 * @param int $guid
 * @param int annotation id optional revision to edit
 * @return string html
 */
function blog_get_page_content_edit($guid, $revision = NULL)
{
    $vars = array();
    if ($guid) {
        $blog = get_entity((int) $guid);
        if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
            $vars['entity'] = $blog;
            if ($revision) {
                $revision = get_annotation((int) $revision);
                $vars['revision'] = $revision;
                if (!$revision || !($revision->entity_guid == $guid)) {
                    $content = elgg_echo('blog:error:revision_not_found');
                }
            }
            elgg_push_breadcrumb($blog->title, $blog->getURL());
            elgg_push_breadcrumb(elgg_echo('edit'));
            $content = elgg_view('blog/forms/edit', $vars);
            $sidebar = elgg_view('blog/sidebar_revisions', array('entity' => $blog));
            //$sidebar .= elgg_view('blog/sidebar_related');
        } else {
            $content = elgg_echo('blog:error:post_not_found');
        }
    } else {
        elgg_push_breadcrumb(elgg_echo('blog:new'));
        $content = elgg_view('blog/forms/edit', $vars);
        //$sidebar = elgg_view('blog/sidebar_related');
    }
    return array('content' => $content, 'sidebar' => $sidebar);
}
コード例 #5
0
ファイル: SrokapForm.php プロジェクト: socialweb/PiGo
 /**
  * @param ElggPlugin $plugin
  * @return string
  */
 public function outputPluginSettingsForm($plugin)
 {
     $translationPrefix = elgg_extract('translationPrefix', $this->options);
     $result = '<div>';
     foreach ($this->fields as $name => $field) {
         $result .= '<div class="mbm">';
         $result .= '<label>' . elgg_echo($translationPrefix . $name) . '</label> ';
         $description = elgg_extract('description', $field);
         if ($description) {
             $result .= '<div class="mbs">' . $description . '</div> ';
         }
         $params = $field;
         $type = elgg_extract('type', $field);
         $params['name'] = "params[{$name}]";
         if ($plugin) {
             $params['value'] = $plugin->{$name};
         }
         if (!isset($params['value']) || $params['value'] === null) {
             $params['value'] = elgg_extract('default', $field);
         }
         $result .= elgg_view('input/' . $type, $params);
         $result .= '</div>';
     }
     $result .= '</div>';
     return $result;
 }
コード例 #6
0
ファイル: start.php プロジェクト: elgg/twitter_api
/**
 * Serves pages for twitter.
 *
 * @param array $page
 * @return bool
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        return false;
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            elgg_gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            echo elgg_view('resources/twitter_api/interstitial');
            break;
        default:
            return false;
    }
    return true;
}
コード例 #7
0
ファイル: functions.php プロジェクト: coldtrick/wizard
/**
 * Replace profile field placeholders with input fields
 *
 * @param string $text the text to replace in
 *
 * @return false|string
 */
function wizard_replace_profile_fields($text)
{
    if (empty($text) || !is_string($text)) {
        return false;
    }
    $regex = '/{{profile_([a-z0-9_-]+)}}/i';
    $matches = [];
    preg_match_all($regex, $text, $matches);
    if (empty($matches)) {
        return $text;
    }
    $placeholders = $matches[0];
    $profile_names = $matches[1];
    foreach ($placeholders as $index => $placeholder) {
        if (strpos($text, $placeholder) === false) {
            // already replaced
            continue;
        }
        $input = elgg_view('input/profile_field', ['name' => $profile_names[$index]]);
        if (empty($input)) {
            elgg_log("Wizard unable to replace profile placeholder: {$placeholder}", 'WARNING');
        } else {
            elgg_log("Wizard replace profile placeholder: {$placeholder}");
        }
        $text = str_replace($placeholder, $input, $text);
    }
    return $text;
}
コード例 #8
0
ファイル: start.php プロジェクト: amcfarlane1251/ongarde
function au_group_tag_menu_page_handler($page, $identifier)
{
    //show the page of search results
    // assumes url of group/guid/tag
    // if the tag is 'all' then will display a tagcloud
    switch ($page[0]) {
        case 'group':
            $entity = get_entity($page[1]);
            if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') {
                return false;
            }
            elgg_push_breadcrumb($entity->name, $entity->getURL());
            //should be OK if this is empty
            $tag = $page[2];
            elgg_push_breadcrumb($tag);
            if ($tag == "all") {
                //show a tag cloud for all group tags
                //arbitrarily set to a max of 640 tags - should be enough for anyone :-)
                $title = elgg_echo("au_group_tag_menu:tagcloud");
                $options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags'));
                $thetags = elgg_get_tags($options);
                //make it an alphabetical tag cloud, not with most popular first
                sort($thetags);
                //find the highest tag count for scaling the font
                $max = 0;
                foreach ($thetags as $key) {
                    if ($key->total > $max) {
                        $max = $key->total;
                    }
                }
                $content = "  ";
                //loop through and generate tags so they display nicely
                //in the group, not as a dumb search page
                foreach ($thetags as $key) {
                    $url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag);
                    $taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag'));
                    //  get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this)
                    $size = round(log($key->total) / log($max + 0.0001) * 100) + 30;
                    if ($size < 100) {
                        $size = 100;
                    }
                    // generate the link
                    $content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> &nbsp; ";
                }
            } else {
                //show the results for the selected tag
                $title = elgg_echo("au_group_tag_menu:title") . "{$tag}";
                $options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false);
                $content = elgg_list_entities_from_metadata($options);
            }
            //display the page
            if (!$content) {
                $content = elgg_echo('au_group_tag_menu:noresults');
            }
            $layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false));
            echo elgg_view_page($title, $layout);
            break;
    }
    return true;
}
コード例 #9
0
 /**
  * Setups entity interactions menu
  *
  * @param string $hook   "register"
  * @param string $type   "menu:interactions"
  * @param array  $menu   Menu
  * @param array  $params Hook parameters
  * @uses $params['entity'] An entity that we are interacting with
  * @uses $params['active_tab'] Currently active tab, default to 'comments'
  * @return array
  */
 public static function interactionsMenuSetup($hook, $type, $menu, $params)
 {
     $entity = elgg_extract('entity', $params, false);
     /* @var ElggEntity $entity */
     if (!elgg_instanceof($entity)) {
         return $menu;
     }
     $active_tab = elgg_extract('active_tab', $params);
     // Commenting
     $comments_count = $entity->countComments();
     $can_comment = $entity->canComment();
     if ($can_comment) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments', 'text' => $entity instanceof Comment ? elgg_echo('interactions:reply:create') : elgg_echo('interactions:comment:create'), 'href' => "stream/comments/{$entity->guid}", 'priority' => 200, 'data-trait' => 'comments', 'item_class' => 'interactions-action'));
     }
     if ($can_comment || $comments_count) {
         $menu[] = ElggMenuItem::factory(array('name' => 'comments:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'comments', 'type' => 'comments', 'count' => $comments_count)), 'href' => "stream/comments/{$entity->guid}", 'selected' => $active_tab == 'comments', 'priority' => 100, 'data-trait' => 'comments', 'item_class' => 'interactions-tab'));
     }
     if (elgg_is_active_plugin('likes')) {
         // Liking and unliking
         $likes_count = $entity->countAnnotations('likes');
         $can_like = $entity->canAnnotate(0, 'likes');
         $does_like = elgg_annotation_exists($entity->guid, 'likes');
         if ($can_like) {
             $before_text = elgg_echo('interactions:likes:before');
             $after_text = elgg_echo('interactions:likes:after');
             $menu[] = ElggMenuItem::factory(array('name' => 'likes', 'text' => $does_like ? $after_text : $before_text, 'href' => "action/stream/like?guid={$entity->guid}", 'is_action' => true, 'priority' => 400, 'link_class' => 'interactions-state-toggler', 'item_class' => 'interactions-action', 'data-guid' => $entity->guid, 'data-trait' => 'likes', 'data-state' => $does_like ? 'after' : 'before'));
         }
         if ($can_like || $likes_count) {
             $menu[] = ElggMenuItem::factory(array('name' => 'likes:badge', 'text' => elgg_view('framework/interactions/elements/badge', array('entity' => $entity, 'icon' => 'likes', 'type' => 'likes', 'count' => $likes_count)), 'href' => "stream/likes/{$entity->guid}", 'selected' => $active_tab == 'likes', 'data-trait' => 'likes', 'priority' => 300, 'item_class' => 'interactions-tab'));
         }
     }
     return $menu;
 }
コード例 #10
0
ファイル: start.php プロジェクト: hypeJunction/Elgg-menus_api
/**
 *
 * @param type $menu_name
 * @param array $params
 */
function menus_api_view_menu($menu_name, array $params = [])
{
    $params = menus_api_prepare_params($menu_name, $params);
    $menu = menus_api_get_menu($menu_name, $params);
    $params['menu'] = menus_api_prepare_menu($menu, $params);
    return elgg_view('navigation/menu/default', $params);
}
コード例 #11
0
 /**
  * dropzone/upload action handler
  * @return array
  */
 public function handleUploads()
 {
     $subtype = get_input('subtype');
     if (!$subtype) {
         $subtype = elgg_get_plugin_setting('default_upload_subtype', 'hypeDropzone', 'file');
     }
     $uploads = $this->saveUploadedFiles('dropzone', ['owner_guid' => elgg_get_logged_in_user_guid(), 'container_guid' => get_input('container_guid') ?: ELGG_ENTITIES_ANY_VALUE, 'subtype' => $subtype, 'access_id' => ACCESS_PRIVATE, 'origin' => get_input('origin', 'dropzone')]);
     $output = array();
     foreach ($uploads as $upload) {
         $messages = array();
         $success = true;
         if ($upload->error) {
             $messages[] = $upload->error;
             $success = false;
             ${$guid} = false;
         } else {
             $file = $upload->file;
             $guid = $file->guid;
             $html = elgg_view('input/hidden', array('name' => get_input('input_name', 'guids[]'), 'value' => $file->guid));
         }
         $file_output = array('messages' => $messages, 'success' => $success, 'guid' => $guid, 'html' => $html);
         $output[] = elgg_trigger_plugin_hook('upload:after', 'dropzone', array('upload' => $upload), $file_output);
     }
     return $output;
 }
コード例 #12
0
ファイル: HookHandlers.php プロジェクト: n8b/VMN
 /**
  * Output an embedded view of a URL
  *
  * @param string $hook   'format:src'
  * @param string $type   'embed'
  * @param string $return HTML
  * @param array  $params Hook params
  * @return string
  */
 function formatEmbedView($hook, $type, $return, $params)
 {
     $src = elgg_extract('src', $params);
     unset($params['src']);
     $params['href'] = $src;
     return elgg_view('output/card', $params);
 }
コード例 #13
0
ファイル: start.php プロジェクト: elgg/notifications
/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    elgg_gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    set_input('username', $page[1]);
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            echo elgg_view('resources/notifications/groups');
            break;
        case 'personal':
            echo elgg_view('resources/notifications/index');
            break;
        default:
            return false;
    }
    return true;
}
コード例 #14
0
ファイル: list_users.php プロジェクト: elainenaomi/labxp2014
function view_adm_permission($entities, $vars = array(), $offset = 0, $limit = 10, $full_view = true, $listTypeToggle = true, $pagination = true)
{
    if (!is_int($offset)) {
        $offset = (int) get_input('offset', 0);
    }
    // list type can be passed as request parameter
    $listType = get_input('list_type', 'list');
    if (get_input('listtype')) {
        elgg_deprecated_notice("'listtype' has been deprecated by 'list_type' for lists", 1.8);
        $listType = get_input('listtype');
    }
    if (is_array($vars)) {
        // new function
        $defaults = array('items' => $entities, 'list_class' => 'elgg-list-entity', 'full_view' => true, 'pagination' => true, 'list_type' => $list_type, 'list_type_toggle' => false, 'offset' => $offset, 'limit' => null);
        $vars = array_merge($defaults, $vars);
    } else {
        // old function parameters
        elgg_deprecated_notice("Please update your use of elgg_view_entity_list()", 1.8);
        $vars = array('items' => $entities, 'count' => (int) $vars, 'offset' => $offset, 'limit' => (int) $limit, 'full_view' => $full_view, 'pagination' => $pagination, 'list_type' => $list_type, 'list_type_toggle' => $listTypeToggle, 'list_class' => 'elgg-list-entity');
    }
    if (!$vars["limit"] && !$vars["offset"]) {
        // no need for pagination if listing is unlimited
        $vars["pagination"] = false;
    }
    if ($vars['view_path_list']) {
        return elgg_view($vars['view_path_list'], $vars);
    }
    if ($vars['list_type'] != 'list') {
        return elgg_view('page/components/gallery', $vars);
    } else {
        return elgg_view('page/components/list', $vars);
    }
}
コード例 #15
0
ファイル: start.php プロジェクト: elgg/messageboard
/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            echo elgg_view('resources/messageboard/owner');
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            echo elgg_view('resources/messageboard/add');
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            echo elgg_view('resources/messageboard/owner');
            break;
        default:
            return false;
    }
    return true;
}
コード例 #16
0
 public function execute()
 {
     $this->uploads = hypeApps()->uploader->handle('dropzone', array('subtype' => $this->subtype, 'container_guid' => $this->container_guid, 'access_id' => ACCESS_PRIVATE));
     $output = array();
     foreach ($this->uploads as $upload) {
         $messages = array();
         $success = true;
         if ($upload->error) {
             $messages[] = $upload->error;
             $success = false;
             $guid = false;
         } else {
             $file = $upload->file;
             if (!$file instanceof \ElggEntity) {
                 $messages[] = elgg_echo('dropzone:file_not_entity');
                 $success = false;
             } else {
                 $guid = $file->getGUID();
                 $html = elgg_view('input/hidden', array('name' => $this->input_name, 'value' => $file->getGUID()));
             }
         }
         $file_output = array('messages' => $messages, 'success' => $success, 'guid' => $guid, 'html' => $html);
         $output[] = elgg_trigger_plugin_hook('upload:after', 'dropzone', array('upload' => $upload), $file_output);
     }
     $this->result->output = json_encode($output);
 }
コード例 #17
0
ファイル: page_handlers.php プロジェクト: Daltonmedia/stripe
/**
 * Stripe related pages
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function stripe_page_handler($page, $handler)
{
    gatekeeper();
    $username = elgg_extract(0, $page, false);
    if ($username) {
        $user = get_user_by_username($username);
    }
    if (!elgg_instanceof($user) || !$user->canEdit()) {
        $user = elgg_get_logged_in_user_entity();
        forward("{$handler}/{$user->username}");
    }
    elgg_set_context('settings');
    elgg_set_page_owner_guid($user->guid);
    elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
    $context = elgg_extract(1, $page, 'cards');
    $action = elgg_extract(2, $page, 'all');
    $view = "stripe/pages/{$context}/{$action}";
    if (elgg_view_exists($view)) {
        $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
        $title = elgg_echo("stripe:{$context}:{$action}");
        $content = elgg_view($view, $params);
        $sidebar = elgg_view('stripe/sidebar', $params);
        $filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
    }
    if ($content) {
        if (elgg_is_xhr()) {
            echo $content;
        } else {
            $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
            echo elgg_view_page($title, $layout);
        }
        return true;
    }
    return false;
}
コード例 #18
0
ファイル: start.php プロジェクト: sh3llc0de/elgg-jssor
function jssor_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    $entity = $params['entity'];
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'photos') {
        return $return;
    }
    if (elgg_instanceof($entity, 'object', 'image')) {
        $album = $entity->getContainerEntity();
        $url = 'jssor/album?guid=' . $album->getGUID() . '&i=' . $entity->getGUID();
        $params = array('href' => $url, 'text' => elgg_echo('jssor:gallery:view'));
        $text = elgg_view('output/url', $params);
        $options = array('name' => 'gallery_view', 'text' => $text, 'priority' => 40);
        $return[] = ElggMenuItem::factory($options);
    }
    if (elgg_instanceof($entity, 'object', 'album')) {
        $album = $entity;
        $offset = get_input('offset');
        if ($offset) {
            $url = 'jssor/album?guid=' . $album->getGUID() . '&o=' . get_input('offset');
        } else {
            $url = 'jssor/album?guid=' . $album->getGUID();
        }
        $params = array('href' => $url, 'text' => elgg_echo('jssor:gallery:view'));
        $text = elgg_view('output/url', $params);
        $options = array('name' => 'gallery_view', 'text' => $text, 'priority' => 40);
        $return[] = ElggMenuItem::factory($options);
    }
    return $return;
}
コード例 #19
0
/**
 * External pages page handler
 *
 * @param array  $page    URL segements
 * @param string $handler Handler identifier
 * @return bool
 */
function expages_page_handler($page, $handler)
{
    if ($handler == 'expages') {
        expages_url_forwarder($page[1]);
    }
    $type = strtolower($handler);
    $title = elgg_echo("expages:{$type}");
    $header = elgg_view_title($title);
    $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1));
    if ($object) {
        $content .= elgg_view('output/longtext', array('value' => $object[0]->description));
    } else {
        $content .= elgg_echo("expages:notset");
    }
    $content = elgg_view('expages/wrapper', array('content' => $content));
    if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
        $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
        echo elgg_view_page($title, $body);
    } else {
        elgg_load_css('elgg.walled_garden');
        $body = elgg_view_layout('walled_garden', array('content' => $header . $content));
        echo elgg_view_page($title, $body, 'walled_garden');
    }
    return true;
}
コード例 #20
0
ファイル: start.php プロジェクト: tjcaverly/Elgg
/**
 * Add a like button to river actions
 */
function likes_river_menu_setup($hook, $type, $return, $params)
{
    if (elgg_is_logged_in()) {
        $item = $params['item'];
        // only like group creation #3958
        if ($item->type == "group" && $item->view != "river/group/create") {
            return $return;
        }
        // don't like users #4116
        if ($item->type == "user") {
            return $return;
        }
        $object = $item->getObjectEntity();
        if (!elgg_in_context('widgets') && $item->annotation_id == 0) {
            if ($object->canAnnotate(0, 'likes')) {
                $hasLiked = elgg_annotation_exists($object->guid, 'likes');
                // Always register both. That makes it super easy to toggle with javascript
                $return[] = ElggMenuItem::factory(array('name' => 'like', 'href' => elgg_add_action_tokens_to_url("/action/likes/add?guid={$object->guid}"), 'text' => elgg_view_icon('thumbs-up'), 'title' => elgg_echo('likes:likethis'), 'item_class' => $hasLiked ? 'hidden' : '', 'priority' => 100));
                $return[] = ElggMenuItem::factory(array('name' => 'unlike', 'href' => elgg_add_action_tokens_to_url("/action/likes/delete?guid={$object->guid}"), 'text' => elgg_view_icon('thumbs-up-alt'), 'title' => elgg_echo('likes:remove'), 'item_class' => $hasLiked ? '' : 'hidden', 'priority' => 100));
                // likes count
                $count = elgg_view('likes/count', array('entity' => $object));
                if ($count) {
                    $return[] = ElggMenuItem::factory(array('name' => 'likes_count', 'text' => $count, 'href' => false, 'priority' => 101));
                }
            }
        }
    }
    return $return;
}
コード例 #21
0
ファイル: start.php プロジェクト: Ruthkaveke/tumchat
function customstyle_page_handler($page)
{
    gatekeeper();
    elgg_set_context('customstyle');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('customstyle');
    $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
    switch ($page[0]) {
        case 'colors':
            $body = elgg_view('customstyle/colors');
            break;
        case 'background':
            $body = elgg_view('customstyle/background');
            break;
        case 'personalize':
            $body = elgg_view('customstyle/default');
            break;
        default:
            $body = elgg_view('customstyle/default');
            break;
    }
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
コード例 #22
0
ファイル: start.php プロジェクト: thehereward/Elgg
/**
 * External pages page handler
 *
 * @param array  $page    URL segements
 * @param string $handler Handler identifier
 * @return bool
 */
function expages_page_handler($page, $handler)
{
    if ($handler == 'expages') {
        expages_url_forwarder($page[1]);
    }
    $type = strtolower($handler);
    $title = elgg_echo("expages:{$type}");
    $header = elgg_view_title($title);
    $object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1));
    if ($object) {
        $content .= elgg_view('output/longtext', array('value' => $object[0]->description));
    } else {
        $content .= elgg_echo("expages:notset");
    }
    $content = elgg_view('expages/wrapper', array('content' => $content));
    if (elgg_is_admin_logged_in()) {
        elgg_register_menu_item('title', array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/appearance/expages?type={$type}", 'link_class' => 'elgg-button elgg-button-action'));
    }
    if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
        $body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
        echo elgg_view_page($title, $body);
    } else {
        elgg_load_css('elgg.walled_garden');
        $body = elgg_view_layout('walled_garden', array('content' => $header . $content));
        echo elgg_view_page($title, $body, 'walled_garden');
    }
    return true;
}
コード例 #23
0
ファイル: Router.php プロジェクト: n8b/VMN
 /**
  * Handles embedded URLs
  *
  * @param array $page URL segments
  * @return boolean
  */
 function handlePages($page)
 {
     $url = get_input('url');
     $handle = get_input('handle');
     $iframe = get_input('iframe', false);
     $site = elgg_get_site_entity();
     if (!$handle) {
         $handle = $site->guid;
     }
     if (!$url || !$handle) {
         return false;
     }
     $parse = elgg_is_logged_in();
     switch ($page[0]) {
         default:
             $data = $this->model->get($url, $handle, $parse);
             $layout = elgg_view('output/card', array('href' => $url, 'handle' => $handle));
             $shell = $iframe ? 'iframe' : 'default';
             echo elgg_view_page($data['title'], $layout, $shell);
             break;
         case 'json':
             $data = $this->model->get($url, $handle, $parse);
             header('Content-Type: application/json');
             echo json_encode($data);
             exit;
     }
     return true;
 }
コード例 #24
0
ファイル: start.php プロジェクト: hypeJunction/au_subgroups
function au_subgroups_pagehandler($page)
{
    // dirty check to avoid duplicate page handlers
    // since this should only be called from the route, groups hook
    if (strpos(current_page_url(), elgg_get_site_url() . 'au_subgroups') === 0) {
        return false;
    }
    switch ($page[0]) {
        case 'add':
            set_input('au_subgroup', true);
            set_input('au_subgroup_parent_guid', $page[1]);
            elgg_set_page_owner_guid($page[1]);
            echo elgg_view('resources/au_subgroups/add');
            return true;
            break;
        case 'list':
            elgg_set_page_owner_guid($page[1]);
            echo elgg_view('resources/au_subgroups/list');
            break;
        case 'delete':
            elgg_set_page_owner_guid($page[1]);
            echo elgg_view('resources/au_subgroups/delete');
            break;
        case 'openclosed':
            set_input('filter', $page[1]);
            echo elgg_view('resources/au_subgroups/openclosed');
            return true;
            break;
    }
    return false;
}
コード例 #25
0
ファイル: config.inc.php プロジェクト: rijojoy/MyIceBerg
function affiche_navbar($album, $deb, $i, $Max_pictures, $fichier)
{
    //echo "album=".$album." i=".$i." deb=".$deb;
    // navigation bar v1.1
    $content = "<h3>";
    $tab = array('title' => elgg_echo('diapos:backlist'), 'href' => "diapos", 'is_action' => false, 'text' => elgg_echo('diapos:backlist'));
    $content .= "[ " . elgg_view('output/url', $tab);
    // liste des pages accessibles
    $Nb_pages = (int) (count($fichier) / ($Max_pictures + 1)) + 1;
    for ($j = 1; $j <= $Nb_pages; $j++) {
        if ($deb == ($j - 1) * $Max_pictures) {
            $content .= " | <u>" . $j . "</u>";
        } else {
            $tab = array('title' => elgg_echo('diapos:goto') . " " . $j, 'href' => "diapos?album=" . $album . "&deb=" . (int) (($j - 1) * $Max_pictures), 'is_action' => false, 'text' => $j);
            $content .= " | " . elgg_view('output/url', $tab);
        }
    }
    /* 	$tab = array ('title' => elgg_echo('diapos:first'),'href' => "diapos?album=".$album."&deb=0",'is_action' => false,'text' => elgg_echo('diapos:first') );	
    	$content .= elgg_view('output/url', $tab)." | " ;
    	$tab = array ('title' => elgg_echo('diapos:end'),'href' => "diapos?album=".$album."&deb=".(int)(count($fichier)/$Max_pictures)*$Max_pictures,'is_action' => false,'text' => elgg_echo('diapos:end') );	
    	$content .= elgg_view('output/url', $tab) ; */
    if ($deb > 0) {
        // affiche le bouton previous
        $tab = array('title' => elgg_echo('diapos:previous'), 'href' => "diapos?album=" . $album . "&deb=" . (string) ($deb - $Max_pictures), 'is_action' => false, 'text' => elgg_echo('diapos:previous'));
        $content .= " | << " . elgg_view('output/url', $tab) . " ";
    }
    // next
    if ($i < count($fichier) && !empty($fichier)) {
        // affiche le bouton next
        $tab = array('title' => elgg_echo('diapos:next'), 'href' => "diapos?album=" . $album . "&deb=" . (string) ($deb + $Max_pictures), 'is_action' => false, 'text' => elgg_echo('diapos:next'));
        $content .= " | " . elgg_view('output/url', $tab) . " >>";
    }
    $content .= " ]</h3>";
    return $content;
}
コード例 #26
0
ファイル: start.php プロジェクト: rosanamontes/teranga.go
function hflts_page_handler($page)
{
    if (elgg_extract(0, $page) === 'collective') {
        $content = elgg_view('hflts/collective', array('nAlternativas' => $page[1], 'nCriterios' => $page[2], 'nExpertos' => $page[3], 'G' => $page[4], 'import_file' => $page[5], 'weight_file' => $page[6]));
        $params = array('title' => 'DM con datos de samples/set_' . $page[5] . '.csv (' . $page[6] . ')', 'content' => $content, 'filter' => '');
        $body = elgg_view_layout('content', $params);
        echo elgg_view_page('hflts', $body);
        return true;
    }
    set_input('username', $page[0]);
    //necesario
    $user = elgg_get_page_owner_entity();
    // ej strem
    $guid = elgg_get_page_owner_guid();
    // id de strem
    //aqui es donde tengo que filtrar por guid como en https://elgg.org/discussion/view/2268999/doubt-in-elgg-get-entities-from-metadata
    $valorations = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => 'evaluation_content', 'metadata_name_value_pairs' => array('name' => 'user_guid', 'value' => $guid), 'limit' => $vars['entity']->num_display, 'pagination' => false, 'order_by_metadata' => ['name' => 'state', 'direction' => 'ASC', 'as' => 'text']]);
    if (!$valorations) {
        $valorations = '<p class="mtm">' . elgg_echo('evaluationcontent:none') . '</p>';
    }
    $content = elgg_view('hflts/driver', array('valorations' => $valorations));
    $params = array('title' => 'Valoraciones de ' . $user->name, 'content' => $content, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page('hflts', $body);
}
コード例 #27
0
ファイル: start.php プロジェクト: rasul/Elgg
/**
 * Serves pages for upload and embed.
 *
 * @param $page
 */
function embed_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'embed';
    }
    switch ($page[0]) {
        case 'upload':
            echo elgg_view('embed/upload');
            break;
        case 'embed':
        default:
            // trigger hook to get section tabs
            // use views for embed/section/
            //	listing
            //	item
            // default to embed/listing | item if not found.
            // @todo trigger for all right now. If we categorize these later we can trigger
            // for certain categories.
            $sections = elgg_trigger_plugin_hook('embed_get_sections', 'all', NULL, array());
            $upload_sections = elgg_trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array());
            elgg_sort_3d_array_by_value($sections, 'name');
            elgg_sort_3d_array_by_value($upload_sections, 'name');
            $active_section = get_input('active_section', NULL);
            $internal_name = get_input('internal_name', NULL);
            echo elgg_view('embed/embed', array('sections' => $sections, 'active_section' => $active_section, 'upload_sections' => $upload_sections, 'internal_name' => $internal_name));
            break;
    }
    // exit because this is in a modal display.
    exit;
}
コード例 #28
0
/**
 * Profile page handler
 *
 * @param array $page Array of URL segments passed by the page handling mechanism
 * @return bool
 */
function profile_page_handler($page)
{
    if (isset($page[0])) {
        $username = $page[0];
        $user = get_user_by_username($username);
        elgg_set_page_owner_guid($user->guid);
    } elseif (elgg_is_logged_in()) {
        forward(elgg_get_logged_in_user_entity()->getURL());
    }
    // short circuit if invalid or banned username
    if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
        register_error(elgg_echo('profile:notfound'));
        forward();
    }
    $action = NULL;
    if (isset($page[1])) {
        $action = $page[1];
    }
    if ($action == 'edit') {
        // use the core profile edit page
        $base_dir = elgg_get_root_path();
        require "{$base_dir}pages/profile/edit.php";
        return true;
    }
    $content = elgg_view('profile/layout', array('entity' => $user));
    $body = elgg_view_layout('one_column', array('content' => $content));
    echo elgg_view_page($user->name, $body);
    return true;
}
コード例 #29
0
ファイル: start.php プロジェクト: amcfarlane1251/ongarde
/**
 * Add a like button to river actions
 */
function likes_river_menu_setup($hook, $type, $return, $params)
{
    if (elgg_is_logged_in()) {
        $item = $params['item'];
        // only like group creation #3958
        if ($item->type == "group" && $item->view != "river/group/create") {
            return $return;
        }
        // don't like users #4116
        if ($item->type == "user") {
            return $return;
        }
        $object = $item->getObjectEntity();
        if ($item->annotation_id == 0) {
            if ($object->canAnnotate(0, 'likes')) {
                // like button
                $options = array('name' => 'likes', 'href' => false, 'text' => elgg_view('likes/button', array('entity' => $object)), 'is_action' => true, 'priority' => 100);
                $return[] = ElggMenuItem::factory($options);
                // likes count
                $count = elgg_view('likes/count', array('entity' => $object));
                if ($count) {
                    $options = array('name' => 'likes_count', 'text' => $count, 'href' => false, 'priority' => 101);
                    $return[] = ElggMenuItem::factory($options);
                }
            }
        }
    }
    return $return;
}
コード例 #30
0
ファイル: start.php プロジェクト: hypejunction/forms_api
 /**
  * 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
  */
 function elgg_view_input($input_type, array $vars = array())
 {
     static $id_num;
     if (!elgg_view_exists("input/{$input_type}")) {
         return '';
     }
     if ($input_type == 'hidden') {
         return elgg_view("input/{$input_type}", $vars);
     }
     $id = elgg_extract('id', $vars);
     if (!$id) {
         $id_num++;
         $id = "elgg-field-{$id_num}";
         $vars['id'] = $id;
     }
     $vars['input_type'] = $input_type;
     $label = elgg_view('elements/forms/label', $vars);
     unset($vars['label']);
     $help = elgg_view('elements/forms/help', $vars);
     unset($vars['help']);
     $required = elgg_extract('required', $vars);
     $field_class = (array) elgg_extract('field_class', $vars, array());
     unset($vars['field_class']);
     $input = elgg_view("elements/forms/input", $vars);
     return elgg_view('elements/forms/field', array('label' => $label, 'help' => $help, 'required' => $required, 'id' => $id, 'input' => $input, 'class' => $field_class, 'input_type' => $input_type));
 }