mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Returns group visibility
This commit is contained in:
parent
feeebcbae3
commit
44181ee5c7
@ -18,6 +18,15 @@ class GroupsController {
|
|||||||
4 => "visitor"
|
4 => "visitor"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API groups visibility levels
|
||||||
|
*/
|
||||||
|
const GROUPS_VISIBILITY_LEVELS = array(
|
||||||
|
GroupInfo::OPEN_GROUP => "open",
|
||||||
|
GroupInfo::PRIVATE_GROUP => "private",
|
||||||
|
GroupInfo::SECRET_GROUP => "secrete"
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a group
|
* Create a group
|
||||||
*
|
*
|
||||||
@ -228,6 +237,7 @@ class GroupsController {
|
|||||||
$data["icon_url"] = $info->get_logo_url();
|
$data["icon_url"] = $info->get_logo_url();
|
||||||
$data["number_members"] = $info->get_number_members();
|
$data["number_members"] = $info->get_number_members();
|
||||||
$data["membership"] = self::GROUPS_MEMBERSHIP_LEVELS[$info->get_membership_level()];
|
$data["membership"] = self::GROUPS_MEMBERSHIP_LEVELS[$info->get_membership_level()];
|
||||||
|
$data["visibility"] = self::GROUPS_VISIBILITY_LEVELS[$info->get_visibility()];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,7 @@ class GroupsComponent {
|
|||||||
$info->set_name($data["name"]);
|
$info->set_name($data["name"]);
|
||||||
$info->set_number_members($this->countMembers($info->get_id()));
|
$info->set_number_members($this->countMembers($info->get_id()));
|
||||||
$info->set_membership_level($this->getMembershipLevel(userID, $info->get_id()));
|
$info->set_membership_level($this->getMembershipLevel(userID, $info->get_id()));
|
||||||
|
$info->set_visibility($data["visibility"]);
|
||||||
|
|
||||||
if($data["path_logo"] != null && $data["path_logo"] != "" && $data["path_logo"] != "null")
|
if($data["path_logo"] != null && $data["path_logo"] != "" && $data["path_logo"] != "null")
|
||||||
$info->set_logo($data["path_logo"]);
|
$info->set_logo($data["path_logo"]);
|
||||||
|
@ -10,11 +10,17 @@ class GroupInfo extends BaseUniqueObject {
|
|||||||
//Path to group logo in user data
|
//Path to group logo in user data
|
||||||
const PATH_GROUPS_LOGO = "groups_logo";
|
const PATH_GROUPS_LOGO = "groups_logo";
|
||||||
|
|
||||||
|
//Groups visibility
|
||||||
|
const OPEN_GROUP = 0;
|
||||||
|
const PRIVATE_GROUP = 1;
|
||||||
|
const SECRET_GROUP = 2;
|
||||||
|
|
||||||
//Private fields
|
//Private fields
|
||||||
private $name;
|
private $name;
|
||||||
private $number_members = -1;
|
private $number_members = -1;
|
||||||
private $logo;
|
private $logo;
|
||||||
private $membership_level = -1;
|
private $membership_level = -1;
|
||||||
|
private $visiblity;
|
||||||
|
|
||||||
|
|
||||||
//Get and set the name of group
|
//Get and set the name of group
|
||||||
@ -83,4 +89,17 @@ class GroupInfo extends BaseUniqueObject {
|
|||||||
public function get_membership_level() : int {
|
public function get_membership_level() : int {
|
||||||
return $this->membership_level;
|
return $this->membership_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get and set group visibility
|
||||||
|
public function set_visibility(int $visibility){
|
||||||
|
$this->visibility = $visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function has_visibility() : bool {
|
||||||
|
return $this->visibility > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_visibility() : int {
|
||||||
|
return $this->visibility;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user