예제 #1
0
파일: content.php 프로젝트: smellems/wet4
<?php

/***********************************************************************
 * MODIFICATION LOG
 * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 *
 * USER 		DATE 			DESCRIPTION
 * MBlondin 	2016-03-11 		Creation of widget
 ***********************************************************************/
try {
    $user_guid = elgg_get_logged_in_user_guid();
    $site_url = elgg_get_site_url();
    $num_group = count(get_users_membership($user_guid));
    $title = get_user($user_guid)->job;
    $dept = get_user($user_guid)->department;
    $dipName = get_user($user_guid)->getDisplayName();
    $avatar = get_user($user_guid)->getIcon('medium');
    $Uname = get_user($user_guid)->username;
    $NumFriends = count(get_user_friends($user_guid));
    ?>
<div class="col-xs-12 col-md-12 col-lg-12 panel">
    <div class="col-lg-2 elgg-avatar elgg-avatar-medium-wet4">
        <img src="<?php 
    echo $avatar;
    ?>
" alt="Avatar of <?php 
    echo $dipName;
    ?>
" class="img-circle img-responsive" />
    </div>
    <div class="col-lg-7 brdr-rght">
예제 #2
0
파일: content.php 프로젝트: socialweb/PiGo
<?php

$widget = elgg_extract("entity", $vars);
$embed = elgg_extract("embed", $vars, false);
// check if logged if
if ($user = elgg_get_logged_in_user_entity()) {
    $owner = $widget->getOwnerEntity();
    if ($group_membership = get_users_membership($user->getGUID())) {
        $selected_group = ELGG_ENTITIES_ANY_VALUE;
        if (elgg_instanceof($owner, "group")) {
            // preselect the current group
            $selected_group = $owner->getGUID();
        }
        $group_selection_options = array();
        $group_access_options = array();
        if (!$selected_group) {
            // no group container, so add empty record, so a user is required to select a group (instead of defaulting to the first option)
            $group_selection_options[] = "";
            $group_access_options["-1"] = "";
        }
        foreach ($group_membership as $group) {
            $group_selection_options[$group->getGUID()] = $group->name;
            $group_access_options[$group->group_acl] = $group->getGUID();
        }
        // sort the groups by name
        natcasesort($group_selection_options);
        $form_vars = array("id" => "group-tools-start-discussion-widget-form", "action" => "action/discussion/save");
        $body_vars = array("groups" => $group_selection_options, "access" => $group_access_options, "container_guid" => $selected_group);
        echo elgg_view_form("discussion/quick_start", $form_vars, $body_vars);
    } elseif (!$embed) {
        // you must join a group in order to use this widget
예제 #3
0
파일: start.php 프로젝트: eokyere/elgg
/**
 * Hook to listen to read access control requests and return all the groups you are a member of.
 */
function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
    //error_log("READ: " . var_export($returnvalue));
    $user = $_SESSION['user'];
    if ($user) {
        $membership = get_users_membership($user->guid);
        if ($membership) {
            foreach ($membership as $group) {
                $returnvalue[$user->guid][$group->group_acl] = elgg_echo('groups:group') . ": " . $group->name;
            }
            return $returnvalue;
        }
    }
}
예제 #4
0
 function method_getGroups($params, $error)
 {
     if (!$this->is_loggedin()) {
         return array("err" => SESSION_ERROR);
     }
     $user = $_SESSION['user'];
     $entry = array();
     if ($params[0] == 'my') {
         // $groupobjects = get_entities("group", '', $user->guid);
         $groupobjects = get_users_membership($user->guid);
         if (is_array($groupobjects)) {
             foreach ($groupobjects as $group) {
                 $groupname = $group->name;
                 $groupowner = false;
                 if (!$group->isPublicMembership()) {
                     $groupname = '<font color="silver">[' . $groupname . ']</font>';
                 }
                 if ($group->owner_guid == $user->guid) {
                     $groupname = '<strong>* ' . $groupname . '</strong>';
                     $groupowner = true;
                 }
                 $entry[] = array($group->getGUID(), westorElggMan_getIcon($group, 'tiny'), $groupname, $groupowner, $group->isPublicMembership());
             }
         }
     } else {
         if (function_exists("elgg_get_entities")) {
             $groupobjects = elgg_get_entities(array("types" => "group", "limit" => MAXENTRIES));
         } else {
             $groupobjects = get_entities("group", "", 0, "", MAXENTRIES);
         }
         if (is_array($groupobjects)) {
             foreach ($groupobjects as $group) {
                 if ($group->isMember($user->guid)) {
                     continue;
                 }
                 $groupname = $group->name;
                 $groupowner = false;
                 if (!$group->isPublicMembership()) {
                     $groupname = '<font color="grey">[' . $groupname . ']</font>';
                 }
                 if ($group->owner_guid == $user->guid) {
                     $groupname = '<strong>* ' . $groupname . '</strong>';
                     $groupowner = true;
                 }
                 $entry[] = array($group->getGUID(), westorElggMan_getIcon($group, 'tiny'), $groupname, $groupowner, $group->isPublicMembership());
             }
         }
     }
     return $entry;
 }