当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_User::getLoggedUser方法代码示例

本文整理汇总了PHP中Model_User::getLoggedUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::getLoggedUser方法的具体用法?PHP Model_User::getLoggedUser怎么用?PHP Model_User::getLoggedUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_User的用法示例。


在下文中一共展示了Model_User::getLoggedUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayActive

 private function displayActive()
 {
     if (!isset($this->displayActive)) {
         $this->displayActive = Model_User::getLoggedUser() === false ? false : true;
     }
     return $this->displayActive;
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:7,代码来源:Homepage.php

示例2: configureData

 public function configureData()
 {
     if (!Tool::isOk($_POST['id']) || !($user = Model_User::getLoggedUser()) || $user->getId() != $_POST['id'] || !Tool::isOk($_POST['zip']) || !isset($_POST['gender']) || !Tool::isOk($_POST['login'])) {
         header('Location: ' . Conf::get('ROOT_PATH'));
         exit;
     }
     DB::update('UPDATE `user` SET
         `zip`="' . $_POST['zip'] . '",
         `male`="' . $_POST['gender'] . '"
         WHERE `id`="' . $_POST['id'] . '"');
     if (isset($_FILES) && isset($_FILES['avatar']) && $_FILES['avatar']['error'] != 4) {
         $size = filesize($_FILES['avatar']['tmp_name']);
         $stat = stat($_FILES['avatar']['tmp_name']);
         if ($size[0] <= 1680 && $size[1] <= 1680 && $stat['size'] <= 450 * 1024) {
             $extention = strtolower(preg_replace('#.+\\.([a-zA-Z]+)$#isU', '$1', $_FILES['avatar']['name']));
             $original = Conf::get('MEDIA_DIR') . 'avatar/original/' . $_POST['id'] . '.' . $extention;
             move_uploaded_file($_FILES['avatar']['tmp_name'], $original);
             $sizeSmall = explode('x', Conf::get('AVATAR_SMALL_SIZE'));
             $sizeMedium = explode('x', Conf::get('AVATAR_MEDIUM_SIZE'));
             $sizeLarge = explode('x', Conf::get('AVATAR_LARGE_SIZE'));
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_LARGE_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeLarge[0], isset($sizeLarge[1]) ? $sizeLarge[1] : false, true);
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_MEDIUM_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeMedium[0], isset($sizeMedium[1]) ? $sizeMedium[1] : false, true);
             Tool::redimage($original, Conf::get('MEDIA_DIR') . 'avatar/' . Conf::get('AVATAR_SMALL_SIZE') . '/' . $_POST['id'] . '.jpg', $sizeSmall[0], isset($sizeSmall[1]) ? $sizeSmall[1] : false, true);
         }
     }
     $_SESSION['feedback'] = 'Your informations has been updated';
     header('Location: ' . Conf::get('ROOT_PATH') . $_POST['login']);
 }
开发者ID:Hiswe,项目名称:Opipop,代码行数:28,代码来源:submit.php

示例3: configure

 public function configure()
 {
     // If no user is logged or this page's user is not logged
     if (!($user = Model_User::getLoggedUser()) || strtolower($user->getId()) == strtolower($this->user->getId())) {
         // TODO : 500
     }
     Globals::$tpl->assignSection('private');
     Globals::$tpl->assignVar(array('profile_id' => $user->getId(), 'profile_login' => $user->getLogin(), 'profile_male' => $user->getGender(), 'profile_zip' => $user->getZip(), 'profile_edit_zip_' . $user->getZip() => ' selected="selected"', 'profile_edit_gender_' . $user->getGender() => ' selected="selected"'));
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:9,代码来源:Edit.php

示例4: configure

 public function configure()
 {
     // If some user are connected
     if ($user = Model_User::getLoggedUser()) {
         Globals::$tpl->assignSection('noLogin');
     } else {
         Globals::$tpl->assignSection('login');
     }
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:9,代码来源:Register.php

示例5: configure

 public function configure()
 {
     // Init category
     $category = new Model_Category(Conf::get('MAIN_CATEGORY'));
     if ($category->getQuestionsTotal(true) == 0) {
         return;
     }
     // Get logged user if there is one
     $user = Model_User::getLoggedUser();
     // Get questions
     $questions = $category->getQuestions('latest', $this->page, 1);
     // Loop through all questions
     foreach ($questions as $question) {
         Globals::$tpl->assignLoopVar('question', array('id' => $question->getId(), 'label' => $question->getLabel(), 'image' => $question->getImageURL('medium'), 'label_urlencoded' => urlencode($question->getLabel()), 'time' => Tool::timeWarp($question->getEndDate())));
         // Get answers
         $answers = $question->getAnswers();
         $friendsVotedId = array();
         if ($user) {
             $userResult = $user->getResult($question);
             $userGuess = $user->getGuess($question);
         }
         // Loop through all answers
         foreach ($answers as $answer) {
             Globals::$tpl->assignLoopVar('question.answer', array('id' => $answer->getId(), 'label' => $answer->getLabel()));
             if ($user && $userResult && $answer->getId() == $userResult->getAnswer()->getId()) {
                 Globals::$tpl->assignLoopVar('question.answer.user', array('class' => 'vote', 'label' => 'Mon opinion', 'id' => $user->getId(), 'login' => $user->getLogin(), 'image' => $user->getAvatarURL('small')));
             }
             if ($user && $userGuess && $answer->getId() == $userGuess->getAnswer()->getId()) {
                 Globals::$tpl->assignLoopVar('question.answer.user', array('class' => 'guess', 'label' => 'Mon pronostic', 'id' => $user->getId(), 'login' => $user->getLogin(), 'image' => 'media/layout/icon24x24/map_mini.png'));
             }
             if ($user) {
                 foreach ($user->getFriendGuesses($question) as $friendGuess) {
                     if ($answer->getId() == $friendGuess->getAnswer()->getId()) {
                         Globals::$tpl->assignLoopVar('question.answer.friend', array('class' => 'friend', 'userId' => $user->getId(), 'id' => $friendGuess->getFriend()->getId(), 'login' => $friendGuess->getFriend()->getLogin(), 'avatar' => $friendGuess->getFriend()->getAvatarURL('small')));
                         $friendsVotedId[] = $friendGuess->getFriend()->getId();
                     }
                 }
             }
         }
         if ($user && !$userResult) {
             Globals::$tpl->assignLoopVar('question.pendingUser', array('class' => 'vote', 'label' => 'Mon opinion', 'id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small')));
         }
         if ($user && !$userGuess) {
             Globals::$tpl->assignLoopVar('question.pendingUser', array('class' => 'guess', 'label' => 'Mon pronostic', 'id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small')));
         }
         if ($user) {
             // Construct unvoted friends list
             foreach ($user->getFriends() as $friend) {
                 if (!in_array($friend->getId(), $friendsVotedId)) {
                     Globals::$tpl->assignLoopVar('question.pendingFriend', array('class' => 'friend', 'userId' => $user->getId(), 'id' => $friend->getId(), 'login' => $friend->getLogin(), 'avatar' => $friend->getAvatarURL('small')));
                 }
             }
         }
     }
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:55,代码来源:Active.php

示例6: configureData

 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');
     }
 }
开发者ID:xpac27,项目名称:Crumplr,代码行数:11,代码来源:Register.php

示例7: configureData

 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')));
 }
开发者ID:xpac27,项目名称:Crumplr,代码行数:12,代码来源:Edit.php

示例8: configureData

 public function configureData()
 {
     header("Cache-Control: no-cache");
     if (!($user = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to vote';
         echo 'register';
         exit;
     }
     if (Tool::isOk($_POST['question'])) {
         $question = new Model_Question($_POST['question']);
         if (isset($_POST['answer'])) {
             if ($_POST['answer'] == 0) {
                 if (Tool::isOk($_POST['vote']) && $_POST['vote'] == $user->getId()) {
                     // vote
                     $user->removeVote($question);
                 } else {
                     if (Tool::isOk($_POST['guess']) && $_POST['guess'] == $user->getId()) {
                         // guess
                         $user->removeGuess($question);
                     } else {
                         if (Tool::isOk($_POST['user']) && Tool::isOk($_POST['friend']) && $_POST['user'] == $user->getId()) {
                             // guess for friend
                             $user->removeGuessAboutFriend($question, new Model_User($_POST['friend']));
                         }
                     }
                 }
             } else {
                 $answer = new Model_Answer($_POST['answer'], $_POST['question']);
                 if (Tool::isOk($_POST['vote']) && $_POST['vote'] == $user->getId()) {
                     // vote
                     $user->removeVote($question);
                     $user->vote($question, $answer);
                 } else {
                     if (Tool::isOk($_POST['guess']) && $_POST['guess'] == $user->getId()) {
                         // guess
                         $user->removeGuess($question);
                         $user->guess($question, $answer);
                     } else {
                         if (Tool::isOk($_POST['user']) && Tool::isOk($_POST['friend']) && $_POST['user'] == $user->getId()) {
                             // guess for friend
                             $friend = new Model_User($_POST['friend']);
                             $user->removeGuessAboutFriend($question, $friend);
                             $user->guessAboutFriend($question, $friend, $answer);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:50,代码来源:Save.php

示例9: configureData

 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');
         }
     }
 }
开发者ID:xpac27,项目名称:Crumplr,代码行数:15,代码来源:User.php

示例10: configureData

 public function configureData()
 {
     if (!($user = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to add users to your friends';
         echo 'register';
         exit;
     }
     $userId = $user->getId();
     $friendId = $_POST['friendId'];
     if ($userId == $friendId) {
         $_SESSION['warning'] = 'You are allready friend with this persone';
         echo 'reload';
         exit;
     }
     if ($_POST['action'] == 'add' || $_POST['action'] == 'ask') {
         $rs_friend = DB::select('
             SELECT `valided`
             FROM `friend`
             WHERE (`user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '")
             OR (`user_id_1`="' . $userId . '" AND `user_id_2`="' . $friendId . '")
         ');
         if ($rs_friend['total'] == 0) {
             DB::insert('INSERT INTO `friend` (`user_id_1`, `user_id_2`, `date`) VALUES
             (
                 "' . $userId . '",
                 "' . $friendId . '",
                 "' . time() . '"
             )');
         }
     } else {
         if ($_POST['action'] == 'accept') {
             DB::update('UPDATE `friend` SET `valided`="1" WHERE `user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '"');
         } else {
             DB::delete('DELETE FROM `friend`
             WHERE (`user_id_1`="' . $friendId . '" AND `user_id_2`="' . $userId . '")
             OR (`user_id_1`="' . $userId . '" AND `user_id_2`="' . $friendId . '")
         ');
             echo 'reload';
             exit;
         }
     }
     echo json_encode(array('friendId' => $friendId, 'userId' => $userId, 'action' => $_POST['action']));
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:43,代码来源:AddToFriend.php

示例11: configureData

 public function configureData()
 {
     if (!($reader = Model_User::getLoggedUser())) {
         $_SESSION['warning'] = 'You need to be logged to add users to your friends';
         echo 'register';
         exit;
     }
     header('Content-Type: application/json; charset=utf-8');
     header("Cache-Control: no-cache");
     $result = array();
     if (isset($_POST['query']) && !empty($_POST['query'])) {
         $users = Model_User::search($_POST['query']);
         foreach ($users as $user) {
             if ($user->getId() != $reader->getId()) {
                 $result[] = array('id' => $user->getId(), 'login' => $user->getLogin(), 'avatar' => $user->getAvatarURL('small'));
             }
         }
     }
     echo json_encode($result);
 }
开发者ID:Hiswe,项目名称:Opipop,代码行数:20,代码来源:search.php

示例12: configure

 public function configure()
 {
     if ($user = Model_User::getLoggedUser()) {
         $this->tpl->assignVar(array('user_login' => $user->getLogin(), 'user_id' => $user->getId()));
         $this->tpl->assignSection('logged');
     } else {
         $this->tpl->assignSection('notLogged');
     }
     // If a feedback should be displayed
     if (Tool::isOk($_SESSION['feedback'])) {
         $this->tpl->assignSection('feedback');
         $this->tpl->assignVar('feedback', $_SESSION['feedback']);
         unset($_SESSION['feedback']);
     }
     // If a warning should be displayed
     if (Tool::isOk($_SESSION['warning'])) {
         $this->tpl->assignSection('warning');
         $this->tpl->assignVar('warning', $_SESSION['warning']);
         unset($_SESSION['warning']);
     }
 }
开发者ID:xpac27,项目名称:Crumplr,代码行数:21,代码来源:Top.php

示例13: configureData

 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');
     }
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:39,代码来源:User.php

示例14: configureData

 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');
     }
 }
开发者ID:Hiswe,项目名称:Opipop,代码行数:23,代码来源:Confirm.php

示例15: configure

 public function configure()
 {
     if ($user = Model_User::getLoggedUser()) {
         Globals::$tpl->assignVar(array('user_login' => $user->getLogin(), 'user_id' => $user->getId(), 'user_avatarURL' => $user->getAvatarURL('medium')));
         Globals::$tpl->assignSection('logged');
     } else {
         Globals::$tpl->assignVar(array('user_login' => '', 'user_id' => 0));
         Globals::$tpl->assignSection('notLogged');
     }
     // If a feedback should be displayed
     if (Tool::isOk($_SESSION['feedback'])) {
         Globals::$tpl->assignSection('feedback');
         Globals::$tpl->assignVar('feedback', $_SESSION['feedback']);
         unset($_SESSION['feedback']);
     }
     // If a warning should be displayed
     if (Tool::isOk($_SESSION['warning'])) {
         Globals::$tpl->assignSection('warning');
         Globals::$tpl->assignVar('warning', $_SESSION['warning']);
         unset($_SESSION['warning']);
     }
     // Did you know ?
     //$question   = Model_Question::getRandomQuestion(); // USE THE METHOD FROM MODEL CATEGORY !
     //$answers    = $question->getAnswers();
     //$didyouknow = $question->getDidyouknow();
     //foreach ($answers as $key => $answer)
     //{
     //$didyouknow = str_replace('{PERCENT_' . ($key + 1) . '}', number_format($answer->getPercentResultsMatching($question->getId()), 1, ',', ' '), $didyouknow);
     //}
     //$tpl->assignVar(array
     //(
     //'didyouknow_label' => $didyouknow,
     //'didyouknow_id'    => $question->getId(),
     //'didyouknow_guid'  => Tool::makeGuid($question->getLabel()),
     //));
 }
开发者ID:xpac27,项目名称:Opipop,代码行数:36,代码来源:Top.php


注:本文中的Model_User::getLoggedUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。