Can create posts for groups.

This commit is contained in:
Pierre HUBERT
2018-07-16 14:38:07 +02:00
parent 770fa95eb7
commit cd772c03c3
6 changed files with 189 additions and 47 deletions

View File

@ -11,6 +11,7 @@ class Notification {
* Elements type
*/
const USER_PAGE = "user_page";
const GROUP_PAGE = "group_page";
const CONVERSATION = "conversation";
const CONVERSATION_MESSAGE = "conversation_message";
const POST = "post";

View File

@ -75,6 +75,22 @@ class Post extends BaseUniqueObjectFromUser {
return $this->kind_page == Posts::PAGE_KIND_USER ? $this->kind_page_id : 0;
}
//Set and get the target group ID
public function set_group_id(int $group_id){
if($group_id > 0){
$this->set_kind_page(Posts::PAGE_KIND_GROUP);
$this->kind_page_id = $group_id;
}
}
public function has_group_id() : bool {
return $this->kind_page_id > 0 && $this->kind_page == Posts::PAGE_KIND_GROUP;
}
public function get_group_id() : int {
return $this->kind_page == Posts::PAGE_KIND_GROUP ? $this->kind_page_id : 0;
}
//Set and get content
public function set_content(string $content){