public function __construct()
 {
     $title = $body = $button = NULL;
     switch (pageArray(1)) {
         case "all":
         default:
             if (loggedIn()) {
                 $admin_groups = Setting::get("admin_groups");
                 if (!$admin_groups) {
                     $admin_groups = "users";
                 }
                 if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                     $button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
                 }
             }
             $title = "Groups";
             $body = display("pages/groups");
             break;
         case "create":
             $admin_groups = Setting::get("admin_groups");
             if (!$admin_groups) {
                 $admin_groups = "user";
             }
             if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
                 $title = "Create a Group";
                 $body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
             }
             break;
         case "view":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $edit_url = getSiteURL() . "groups/edit/{$guid}";
             $delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
             if ($group->ownerIsLoggedIn()) {
                 $button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
                 $button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
             }
             if (GroupsPlugin::loggedInUserCanJoin($group)) {
                 $join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
                 $button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
             }
             if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
                 $leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
                 $button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
             }
             $title = $group->title;
             $body = display("pages/group");
             break;
         case "edit":
             $guid = pageArray(2);
             $group = getEntity($guid);
             $title = "Edit " . $group->title;
             $body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
             break;
     }
     $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
 }
 public function __construct()
 {
     $guid = pageArray(2);
     if (GroupsPlugin::loggedInUserCanJoin($guid)) {
         $membership = new Groupmembership();
         $membership->group = $guid;
         $membership->member_guid = getLoggedInUserGuid();
         $membership->save();
         new SystemMessage("You have successfully joined a group");
         $group = getEntity($guid);
         new Activity(getLoggedInUserGuid(), "group:joined", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $group->getURL(), $group->title), $guid, $group->access_id);
         forward();
     }
 }
 static function accessHandlerDropdown()
 {
     $array = array();
     $access_handlers = Accesshandler::getAll();
     foreach ($access_handlers as $handler) {
         $array[$handler->handler] = translate("access_handler:" . $handler->handler);
     }
     if (isEnabledPlugin("Groups")) {
         $groups = GroupsPlugin::getGroups(getLoggedInUserGuid());
         foreach ($groups as $group) {
             $array[$group->guid] = $group->title . " Group";
         }
     }
     return $array;
 }
示例#4
0
$icon = $group->icon(MEDIUM, "media-object");
$url = $group->getURL();
$title = $group->title;
$description = truncate($group->description);
$owner_guid = $group->owner_guid;
$owner = getEntity($owner_guid);
$by = "Created by: <a href='" . $owner->getURL() . "'>" . $owner->full_name . "</a>" . friendlytime($group->time_created);
$members = GroupsPlugin::memberCount($group);
switch ($group->membership) {
    case "public":
        $type = "Public";
        break;
    case "friends":
        $type = "Friends";
}
if (GroupsPlugin::loggedInUserCanJoin($group)) {
    $join_url = getSiteURL() . "action/joinGroup/{$guid}";
    $join_url = addTokenToURL($join_url);
    $button = "<p style='margin-top:10px;'><a href='{$join_url}' class='btn btn-success btn-sm'>Join Group</a></p>";
}
echo <<<HTML
<div class='panel panel-default'>
    <div class='panel-body'>
        <div class="media">
            <div class="media-left">
                <a href="{$url}">
                    {$icon}
                </a>
            </div>
            <div class="media-body">