本文整理汇总了PHP中UserManager::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::findById方法的具体用法?PHP UserManager::findById怎么用?PHP UserManager::findById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::findById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUser
public function getUser()
{
if (!$this->user) {
$manager = new UserManager($this->database);
$this->user = $manager->findById($this->id_user);
}
return $this->user;
}
示例2: getAuthor
public function getAuthor()
{
if (!$this->author) {
$manager = new UserManager($this->database);
$this->author = $manager->findById($this->id_author);
}
return $this->author;
}
示例3: getAuthor
public function getAuthor()
{
if (!$this->user) {
$userManager = new UserManager($this->db);
$this->user = $userManager->findById($this->id_author);
}
return $this->user;
}
示例4: getLast
public function getLast()
{
$manager = new UserManager($this->db);
$query = "SELECT * FROM article ORDER BY date DESC LIMIT 20";
$res = mysqli_query($this->db, $query);
$listArticle = array();
while ($art = mysqli_fetch_object($res, 'Article')) {
$user = $manager->findById($art->getId_user());
$art->setUser($user);
$listArticle[] = $art;
}
return $listArticle;
}
示例5: sortByName
public function sortByName()
{
$sbn = new UserManager($this->db);
$query = "SELECT * FROM rubrique ORDER BY name";
$res = mysqli_query($this->db, $query);
$listRubrique = array();
while ($rubrique = mysqli_fetch_object($res, 'Rubrique')) {
$user = $sbn->findById($rubrique->getIdAuthor());
// var_dump($user);
$rubrique->setIdAuthor($user);
$listRubrique[] = $rubrique;
}
return $listRubrique;
}
示例6: findSharesForElement
/**
* Created by PhpStorm.
* User: Crocell
* Date: 12/06/14
* Time: 22:23
*/
function findSharesForElement($idElement, $idUser)
{
$idElement = new MongoId($idElement);
$idUser = new MongoId($idUser);
//vérification de l'existence de l'élément
$elementManager = new ElementManager();
$element = $elementManager->findById($idElement);
if (array_key_exists('error', $element)) {
return $element;
}
if ($element['idOwner'] != $idUser) {
return array('error' => 'You need to be the owner of the file to get sharing information on it.');
}
$rightManager = new RightManager();
$rightCriteria = array('state' => (int) 1, 'idElement' => $idElement);
$rights = $rightManager->find($rightCriteria);
$userManager = new UserManager();
$refRightManager = new RefRightManager();
$userFieldsToReturn = array('email' => TRUE);
$refRightFieldsToReturn = array('code' => TRUE);
$user = $refRight = NULL;
foreach ($rights as $key => $right) {
$user = $userManager->findById($right['idUser'], $userFieldsToReturn);
$refRight = $refRightManager->findById($right['idRefRight'], $refRightFieldsToReturn);
if (array_key_exists('error', $user) || array_key_exists('error', $refRight)) {
unset($rights[$key]);
}
unset($rights[$key]['idUser']);
unset($rights[$key]['idRefRight']);
$rights[$key]['user'] = $user;
$rights[$key]['refRight'] = $refRight;
}
if (empty($rights)) {
return array('error' => 'No righ found for the element');
} else {
return $rights;
}
}
示例7: UserManager
<?php
if (isset($_GET['id'])) {
$manager = new UserManager($db);
$user = $manager->findById($_GET['id']);
if (is_string($user)) {
require 'views/home.phtml';
} else {
require 'views/edit_profil.phtml';
}
} else {
require 'views/home.phtml';
}
示例8: TopicManager
<?php
$topicManager = new TopicManager($db);
$topic = $topicManager->findById($_GET['id']);
$userManager = new UserManager($db);
$userTopic = $userManager->findById($topic->getIdAuthor());
try {
$test = $topicManager->addVue($topic->getId());
$link = $userManager->deletLink($_SESSION['id'], $topic->getId());
} catch (Exception $e) {
$errors = $e->getMessage();
echo $errors;
}
require "views/forum/topic.phtml";
示例9: CategoryManager
<?php
$categoryManager = new CategoryManager($db);
$category = $categoryManager->findById($_GET['id']);
$userManager = new UserManager($db);
$userCategory = $userManager->findById($category->idAuthor);
require 'views/forum/category.phtml';
?>
示例10: RubriqueManager
<?php
if (isset($_GET['id'])) {
$manager = new RubriqueManager($db);
$rubrique = $manager->findById($_GET['id']);
$manager2 = new UserManager($db);
$author = $manager2->findById($rubrique->getIdAuthor());
/*$author = $rubrique->getAuthor();*/
require 'views/rubrique.phtml';
}
示例11: intval
<?php
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
$userManager = new UserManager($db);
$user = $userManager->findById($id);
require 'views/profil.phtml';
} else {
require 'views/login.phtml';
}
示例12: PostManager
<?php
$postManager = new PostManager($db);
$posts = $postManager->getList($_GET['id']);
$userManager = new UserManager($db);
$i = 0;
$c = count($posts);
while ($i < $c) {
$post = $posts[$i];
$postUser = $postManager->getListUser($post->getIdAuthor());
$NpostUser = count($postUser);
$userPost = $userManager->findById($post->getIdAuthor());
require 'views/forum/posts.phtml';
$i++;
}
示例13: TopicManager
<?php
$topicManager = new TopicManager($db);
$topics = $topicManager->getList($_GET['id']);
$userManager = new UserManager($db);
$postManager = new PostManager($db);
$i = 0;
$c = count($topics);
while ($i < $c) {
$topic = $topics[$i];
$link = $userManager->findLink($_SESSION['id'], $topic->getId());
$userTopic = $userManager->findById($topic->getIdAuthor());
$lastPost = $postManager->getLastByTopic($topic->getId());
if ($lastPost == TRUE) {
$userLastPost = $userManager->findById($lastPost->getIdAuthor());
$posts = $postManager->getList($topic->getId());
$Nrep = count($posts) - 1;
}
require 'views/forum/topics.phtml';
$i++;
}
示例14: SCategoryManager
<?php
$sCategoryManager = new SCategoryManager($db);
$sCategory = $sCategoryManager->findById($_GET['id']);
$userManager = new UserManager($db);
$userSCategory = $userManager->findById($sCategory->getIdAuthor());
require 'views/forum/sCategory.phtml';
?>
示例15: getByIdSousRubrique
public function getByIdSousRubrique($idSousRubrique)
{
$manager = new UserManager($this->db);
$query = "SELECT * FROM topic WHERE id_sous_rubrique='" . $idSousRubrique . "' ORDER BY date DESC LIMIT 20";
$res = mysqli_query($this->db, $query);
$listTopic = array();
while ($topic = mysqli_fetch_object($res, 'Topic', array($this->db))) {
$user = $manager->findById($topic->getIdAuthor());
$topic->setAuthor($user);
$listTopic[] = $topic;
}
return $listTopic;
}