public function add_member($uid) { if (!isset($this->_members[$uid])) { Database::insert("user_group", array("gid" => $this->gid, "uid" => $uid)); $d = new UserObject(); $d->load($uid); $this->_members[$uid] = $d; } }
public function discussions() { if (User::get_user_logged_id() != null) { $messages = MessagesDB::getDiscussions(User::get_user_logged_id()); $theme = new Theme(); $theme->set_title(t("Messagerie")); foreach ($messages as $m) { $user = new UserObject(); $user->load($m->conversation); $messagetype = ""; if ($m->sid == $m->conversation && $m->read == 0) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-envelope fa-fw" title="Message lu"></i></div>'; } else { if ($m->sid == $m->conversation && $m->read == 1) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-envelope fa-fw" title="Message lu"></i></div>'; } elseif ($m->rid == $m->conversation && $m->read == 0) { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-reply fa-fw" title="Réponse envoyée"></i></div>'; } else { $messagetype = '<div class="messagerie_bloc_icone"><i class="fa fa-check fa-fw" title="Réponse envoyée et lu"></i></div>'; } } $theme->add_to_body('<div class="messagerie"> <div class="messagerie_avatar_area"> <div class="messagerie_avatar avatar" style="background-image:url(' . $user->get_avatar() . ')"> </div> <div class="messagerie_nom"><a>' . $user->firstname . ' <br/>' . $user->lastname . '</a></div> </div> <div class="messagerie_bloc ' . ($m->read == 0 && $m->sid == $m->conversation ? "messagerie_bloc_new" : "") . '" onclick="window.location.href=\'' . Page::url("/messages/" . $m->conversation) . '\'"> <div class="messagerie_bloc_informations"><span>' . $user->firstname . ' ' . $user->lastname . '</span> : <div class="messagerie_bloc_informations_date"><i class="fa fa-clock-o fa-fw"></i> ' . date(t("d-m-Y à H:i"), $m->sent_on) . '</div></div> <div class="messagerie_bloc_texte"> <div class="messagerie_bloc_texte_inside">' . $m->message . '</div> </div>' . $messagetype . '</div> <div class="clear"></div> </div>'); } $theme->process_theme(Theme::STRUCT_DEFAULT); } }
public static function page_profile($id_user = null) { $theme = new Theme(); $isMyProfil = false; if ($id_user == null) { $id_user = self::get_user_logged_id(); $isMyProfil = true; } $u = new UserObject(); $u->load($id_user); $url_avatar = $u->get_avatar(); $output = ""; $output .= "<div id=\"profil_top\">"; $output .= "<div id=\"profil_top_avatar\" class=\"avatar\" style=\"background-image:url({$url_avatar});\">"; if ($isMyProfil) { $output .= Theme::linking(Page::url("/profile/settings/avatar"), "<span id=\"profil_top_avatar_changeBG\"></span><span id=\"profil_top_avatar_changeTxt\">" . t("Modifier") . "</span>"); } $output .= "</div>"; $output .= "<div id=\"profil_top_avatar_nom\">"; if ($isMyProfil) { $output .= "<i class=\"fa fa-user fa-fw\" title=\"Mon profil\"></i>"; } $output .= $u->firstname . " " . $u->lastname; $output .= "</div>"; $output .= "</div>"; $output .= "<div class=\"page_contenu_sep\"></div>"; $output .= "<div id=\"profil_buttons\">"; $result = method_invoke_all("hook_profile_view", array($id_user)); foreach ($result as $r) { $output .= $r; } $output .= "<div class=\"clear\"></div>"; $output .= "</div>"; $theme->add_to_body($output); $theme->process_theme(Theme::STRUCT_DEFAULT); }
public static function decline($id_user) { $u = User::get_user_logged_id(); $a = new UserObject(); if ($u != null) { if ($a->load($id_user)) { if (!FriendshipObject::isFriend($u, $id_user) && sizeof($req = FriendshipObject::loadAllPendingRequests($id_user, $u)) > 0) { $friendship = new FriendshipObject(); $friendship->load($id_user, $u); $friendship->delete(); } header("location: " . Page::url("/profile/{$id_user}")); return; } header("location: " . Page::url("/profile")); return; } header("location: " . Page::url("/")); return; }