public function configureData() { $top = new Block_Top($this->tpl); $top->configure(); // If some user are connected if ($user = Model_User::getLoggedUser()) { $this->tpl->assignSection('noLogin'); } else { $this->tpl->assignSection('login'); } }
public function configureData() { // Configure top block $top = new Block_Top(); $top->configure(); // Configure active block $active = new Block_Question_Active(); $active->configure(); // Configure archive block $archive = new Block_Question_Archive(); $archive->configure(); }
public function configureData() { // Configure top block $top = new Block_Top($this->tpl); $top->configure(); // If no user is logged or this page's user is not logged if (($user = Model_User::getLoggedUser()) == false || strtolower($user->getLogin()) != strtolower($this->getParameter('login'))) { // TODO : 500 } $this->tpl->assignSection('private'); $this->tpl->assignVar(array('profile_id' => $user->getId(), 'profile_login' => $user->getLogin(), 'profile_avatar' => $user->getAvatarUri('large'))); }
public function configureData() { // Configure top block $top = new Block_Top($this->tpl); $top->configure(); $profile = new Model_User($this->getParameter('login')); $this->tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_avatar' => $profile->getAvatarUri('large'))); // If a user is logged if ($user = Model_User::getLoggedUser()) { // If I'm on my profile if ($user->getId() == $profile->getId()) { $this->tpl->assignSection('private'); } } }
public function configureData() { // Configure top block $top = new Block_Top(); $top->configure(); if ($this->displayActive()) { // Configure active block $active = new Block_Question_Active(); $active->configure(); } if ($this->displayArchives()) { // Configure archive block $archive = new Block_Question_Archive(); $archive->configure(); } }
public function configureData() { // Configure top block $top = new Block_Top(); $top->configure(); $profile = Model_User::getInstanceByLogin($_GET['login']); Globals::$tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_sex' => $profile->getGender(), 'profile_avatar' => $profile->getAvatarURL('large'), 'profile_region' => $profile->getZipName(), 'profile_gender' => $profile->getGender())); // If a user is logged if ($user = Model_User::getLoggedUser()) { // If I'm on my profile if ($user->getId() == $profile->getId()) { Globals::$tpl->assignSection('private'); // Assign friends infos foreach ($user->getFriends('latest', false) as $friend) { Globals::$tpl->assignLoopVar('request', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('medium'))); } } } Globals::$tpl->assignVar(array('profile_totalVote' => number_format($profile->getTotalResults(), 0, ',', ' '), 'profile_totalPredictionWon' => number_format($profile->getTotalCommonGuesses(), 0, ',', ' '), 'profile_totalPredictionLost' => number_format($profile->getTotalUnusualGuesses(), 0, ',', ' '), 'profile_predictionAccuracy' => number_format(round($profile->getPercentCommonGuesses()), 0, ',', ' '), 'profile_global_distance' => round($profile->getDistanceGlobal()), 'profile_friend_distance' => round($profile->getDistanceFriend()))); // List all friends $friends = $profile->getFriends('latest', true); foreach ($friends as $friend) { Globals::$tpl->assignLoopVar('friend', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar_medium' => $friend->getAvatarURL('medium'), 'avatar_small' => $friend->getAvatarURL('small'), 'predictionAccuracy_his' => round($friend->getPercentGuessesGood()), 'predictionAccuracy_my' => round($friend->getPercentFriendGuessesGood()))); } // Compute user's feelings $profileFeelings = $profile->getFeelings(); $colors = Conf::get('GRAPH_COLORS'); $data[] = array('value' => $profileFeelings->getPercentPersonality() / 100 * 0.95 + 0.05, 'label' => 'Personalité', 'color' => $colors[0]); $data[] = array('value' => $profileFeelings->getPercentSurrounding() / 100 * 0.95 + 0.05, 'label' => 'Environement', 'color' => $colors[1]); $data[] = array('value' => $profileFeelings->getPercentKnowledge() / 100 * 0.95 + 0.05, 'label' => 'Savoir', 'color' => $colors[2]); $data[] = array('value' => $profileFeelings->getPercentExperience() / 100 * 0.95 + 0.05, 'label' => 'Experience', 'color' => $colors[3]); $data[] = array('value' => $profileFeelings->getPercentThoughts() / 100 * 0.95 + 0.05, 'label' => 'Pensées', 'color' => $colors[4]); $data[] = array('value' => $profileFeelings->getPercentSensitivity() / 100 * 0.95 + 0.05, 'label' => 'Sensibilité', 'color' => $colors[5]); Globals::$tpl->assignVar('feeling_data', json_encode($data)); // No friends ? if ($profile->getFriendsTotal() == 0) { Globals::$tpl->assignSection('noFriends'); } }
public function configureData() { $top = new Block_Top($this->tpl); $top->configure(); $id = $this->getParameter('u'); $key = $this->getParameter('k'); if (Tool::isOk($id) && Tool::isOk($key)) { // If some user are connected if ($user = Model_User::getLoggedUser()) { $this->tpl->assignSection('confirm_ok'); } else { if (Model_User::isKeyValid($id, $key)) { Model_User::validateRegistration($id); Model_User::login($id); $this->tpl->assignSection('confirm_ok'); } else { $this->tpl->assignSection('confirm_error'); } } } else { $this->tpl->assignSection('confirm_wait'); } }
public function configureData() { //Configure top block $top = new Block_Top(); $top->configure(); }
public function configureData() { // Configure top block $top = new Block_Top(); $top->configure(); $profile = new Model_User($_GET['login']); Globals::$tpl->assignVar(array('profile_id' => $profile->getId(), 'profile_login' => $profile->getLogin(), 'profile_sex' => $profile->getGender(false), 'profile_avatar' => $profile->getAvatarURL('large'), 'profile_region' => $profile->getZipName(), 'profile_gender' => $profile->getGender())); // Get stats on friends $profileFriendsStats = $profile->getGuessFriendsStats(); // If a user is logged if ($user = Model_User::getLoggedUser()) { // If I'm on my profile if ($user->getId() == $profile->getId()) { Globals::$tpl->assignSection('private'); // Get pending friend requests $pendingFriends = $user->getPendingFriends(); // Assign friends infos foreach ($pendingFriends as $friend) { Globals::$tpl->assignLoopVar('request', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('medium'))); } } } $profileTotalVotes = $profile->getTotalVotes(); Globals::$tpl->assignVar(array('profile_totalVote' => $profileTotalVotes, 'profile_totalPredictionWon' => 0, 'profile_totalPredictionLost' => 0, 'profile_predictionAccuracy' => 0, 'profile_global_distance' => 0, 'profile_friend_distance' => 0)); // Get stats on profil's user guesses according to global votes $profileGGS = $profile->getGuessGlobalStats(); if ($profileGGS['guesses'] != 0) { Globals::$tpl->assignVar(array('profile_totalPredictionWon' => $profileGGS['goodGuesses'], 'profile_totalPredictionLost' => $profileGGS['badGuesses'], 'profile_predictionAccuracy' => round($profileGGS['goodGuesses'] / $profileGGS['guesses'] * 100))); } // List all friends $friends = $profile->getFriends(); foreach ($friends as $friend) { Globals::$tpl->assignLoopVar('friend', array('id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar_medium' => $friend->getAvatarURL('medium'), 'avatar_small' => $friend->getAvatarURL('small'))); foreach ($profileFriendsStats as $stat) { // Get stats on profil's user gusses if ($friend->getId() == $stat['user']->getId()) { Globals::$tpl->assignLoopVar('friend.stat', array('predictionAccuracy_his' => round($stat['his_guesses'] == 0 ? 0 : $stat['his_goodGuesses'] / $stat['his_guesses'] * 100), 'predictionAccuracy_my' => round($stat['my_guesses'] == 0 ? 0 : $stat['my_goodGuesses'] / $stat['my_guesses'] * 100))); } } } // If profile's user already voted if ($profileTotalVotes != 0) { $totalQuestions = Model_Question::getTotalQuestions(); // Get stats on profil's user votes according to global votes $profileAGS = $profile->getAnswerGlobalStats(); if ($profileAGS['votes'] != 0) { Globals::$tpl->assignVar(array('profile_global_distance' => round(($profileAGS['votes'] - $profileAGS['goodVotes']) / $profileAGS['votes'] * $totalQuestions))); } // Get stats on profil's user votes according to his friends votes $profileAFS = $profile->getAnswerFriendStats(); if ($profileAFS['votes'] != 0) { Globals::$tpl->assignVar(array('profile_friend_distance' => round(($profileAFS['votes'] - $profileAFS['goodVotes']) / $profileAFS['votes'] * $totalQuestions))); } } // Compute user's feelings $profileFeelings = $profile->getFeelings(); $maxFeelingScore = 0; foreach ($profileFeelings as $total) { $maxFeelingScore = $maxFeelingScore < $total ? $total : $maxFeelingScore; } $feelings = array('Personalité', 'Environement', 'Savoir', 'Experience', 'Réflexion', 'Sensibilité'); $colors = Conf::get('GRAPH_COLORS'); $data = array(); foreach ($feelings as $id => $label) { Globals::$tpl->assignLoopVar('feeling', array('label' => $label, 'percent' => round($maxFeelingScore == 0 ? 0 : $profileFeelings[$id + 1] / $maxFeelingScore * 100))); $data[] = array('value' => ($maxFeelingScore ? 1 - $profileFeelings[$id + 1] / $maxFeelingScore : 0) * 0.95 + 0.05, 'label' => $label, 'color' => $colors[$id]); } Globals::$tpl->assignVar('feeling_data', json_encode($data)); // No friends ? if (count($friends) == 0 && (!isset($pendingFriends) || count($pendingFriends) == 0)) { Globals::$tpl->assignSection('noFriends'); } }