• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserMapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: passwordReset

 public function passwordReset($request, $db)
 {
     $user_mapper = new UserMapper($db, $request);
     $username = filter_var($request->getParameter("username"), FILTER_SANITIZE_STRING);
     if (empty($username)) {
         throw new Exception("A username must be supplied", 400);
     } else {
         $list = $user_mapper->getUserByUsername($username);
         if (is_array($list['users']) && count($list['users'])) {
             $user = $list['users'][0];
             // neither user_id nor email are in the user resource returned by the mapper
             $user_id = $user_mapper->getUserIdFromUsername($username);
             $email = $user_mapper->getEmailByUserId($user_id);
             $recipients = array($email);
             // we need a token to send so we know it is a valid reset
             $token = $user_mapper->generatePasswordResetTokenForUserId($user_id);
             if (!$token) {
                 throw new Exception("Unable to generate a reset token", 400);
             }
             $emailService = new UserPasswordResetEmailService($this->config, $recipients, $user, $token);
             $emailService->sendEmail();
             header("Content-Length: 0", NULL, 202);
             exit;
         }
         throw new Exception("Can't find that user", 400);
     }
 }
开发者ID:e3betht,项目名称:joindin-api,代码行数:27,代码来源:EmailsController.php


示例2: __construct

 public function __construct()
 {
     $this->view = ViewManager::getInstance();
     // get the current user and put it to the view
     if (session_status() == PHP_SESSION_NONE) {
         session_start();
     }
     if (isset($_SESSION["currentuser"])) {
         $this->currentUser = new User(NULL, $_SESSION["currentuser"]);
         //add current user to the view, since some views require it
         $usermapper = new UserMapper();
         $this->tipo = $usermapper->buscarPorLogin($_SESSION["currentuser"]);
         /* print_r($this->tipo);
            die();*/
         $this->view->setVariable("tipo", $this->tipo);
         $this->view->setVariable("currentusername", $this->currentUser->getLogin());
     }
     if (isset($_SESSION["currentcod1"]) && isset($_SESSION["currentcod2"]) && isset($_SESSION["currentcod3"])) {
         $codigomapper1 = new CodigoMapper();
         $this->currentCod1 = $codigomapper1->buscarPinchoPorCodigo($_SESSION["currentcod1"]);
         $codigomapper2 = new CodigoMapper();
         $this->currentCod2 = $codigomapper2->buscarPinchoPorCodigo($_SESSION["currentcod2"]);
         $codigomapper3 = new CodigoMapper();
         $this->currentCod3 = $codigomapper3->buscarPinchoPorCodigo($_SESSION["currentcod3"]);
     }
 }
开发者ID:ragomez,项目名称:abp2015,代码行数:26,代码来源:BaseController.php


示例3: login

 /**
  * Tries to log the user using the username and password received in the post.
  */
 function login()
 {
     $text = $this->icfTemplating->getText();
     $username = $_POST["username"];
     $password = $_POST["password"];
     // No data for login...
     if ($username == "") {
         $this->controllerData["loginfailed"] = $text["incorrectinput"];
         $this->show_view();
         return;
     }
     // Get the user
     $userMapper = new UserMapper();
     $user = $userMapper->findByName($username);
     if ($user != null) {
         // The user exists, validate the password
         $login = $user->login($password);
         if ($login) {
             // User logged in !! register it in the session
             $session = new Session($user);
             // Redirect to home
             $this->show_home_view();
             return;
         }
     }
     // The login has failed, send the error
     $this->controllerData["loginfailed"] = $text["loginfailed"];
     // .. and display the data that the user gave to us
     $this->controllerData["username"] = $username;
     $this->controllerData["password"] = $password;
     $this->show_view();
 }
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:35,代码来源:loginController.php


示例4: findAction

 public function findAction()
 {
     $request = new Request();
     $request->initRequest();
     $post = $request->getPost();
     $roadMapper = new RoadMapper();
     $roads = $roadMapper->getByStartFinish($post['departure_point'], $post['destination_point'], "opened");
     $userMapper = new UserMapper();
     $carMapper = new CarMapper();
     $result = array();
     if ($roads) {
         foreach ($roads as $road) {
             $user = $userMapper->getUserByEmail($road->driverid);
             $car = $carMapper->getByAutoId($road->autoid);
             $roadMapper->clear();
             $getPoints = $roadMapper->getRoutPointsByRoad($road->id);
             $routPoints = array();
             foreach ($getPoints as $point) {
                 $routPoints[$point->pointqueue] = $point->point;
             }
             $result[] = array('startdate' => $road->startdate, 'start' => $road->start, 'start_adress' => $road->start_adress, 'finish' => $road->finish, 'finish_adress' => $road->finish_adress, 'freeseats' => $road->freeseats, 'price' => $road->price, 'terms' => $road->terms, 'rout_points' => $routPoints, 'username' => $user->username, 'surname' => $user->surname, 'rate' => $user->rate, 'photo' => $user->photo, 'age' => $user->getAge(), 'car_brand' => $car->brand, 'car_model' => $car->model);
             $userMapper->clear();
             $carMapper->clear();
             $roadMapper->clear();
         }
     }
     echo json_encode($result);
 }
开发者ID:G-Grand,项目名称:webosen2014_diplom,代码行数:28,代码来源:RoadController.php


示例5: testDelete

 public function testDelete()
 {
     $userMapper = new UserMapper();
     $userMapper->setId(2);
     $userMapper->deleteUser();
     $this->assertEquals(new User(), $userMapper->selectUser());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:7,代码来源:UserMapperTest.php


示例6: getAction

 public function getAction($request, $db)
 {
     $user_id = $this->getItemId($request);
     // verbosity
     $verbose = $this->getVerbosity($request);
     // pagination settings
     $start = $this->getStart($request);
     $resultsperpage = $this->getResultsPerPage($request);
     if (isset($request->url_elements[4])) {
         switch ($request->url_elements[4]) {
             case 'talks':
                 $talk_mapper = new TalkMapper($db, $request);
                 $list = $talk_mapper->getTalksBySpeaker($user_id, $resultsperpage, $start, $request, $verbose);
                 break;
             case 'attended':
                 $event_mapper = new EventMapper($db, $request);
                 $list = $event_mapper->getEventsAttendedByUser($user_id, $resultsperpage, $start, $request, $verbose);
                 break;
             default:
                 throw new InvalidArgumentException('Unknown Subrequest', 404);
                 break;
         }
     } else {
         $mapper = new UserMapper($db, $request);
         if ($user_id) {
             $list = $mapper->getUserById($user_id, $verbose);
         } else {
             $list = $mapper->getUserList($resultsperpage, $start, $verbose);
         }
     }
     return $list;
 }
开发者ID:jaytaph,项目名称:joind.in,代码行数:32,代码来源:UsersController.php


示例7: insertComment

 /**
  * 
  * @param Comment $comment_
  * @param array $arrayFilter
  * @throws InvalidArgumentException
  */
 public function insertComment(Comment $comment_, array $arrayFilter = array())
 {
     try {
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         $userMapper = new UserMapper();
         $announcementMapper = new AnnouncementMapper();
         $userMapper->setId($comment_->getIdUser());
         $user = $userMapper->selectUser();
         $announcementMapper->setId($comment_->getIdAnnouncement());
         $announcement = $announcementMapper->selectAnnouncement();
         if (!is_null($user->getId()) && !is_null($announcement->getId())) {
             return parent::insert($this->table, $comment_, $arrayFilter);
         } elseif (is_null($user->getId())) {
             throw new Exception('User is inexistant !');
         } elseif (is_null($announcement->getId())) {
             throw new Exception('Announcement is inexistant !');
         }
     } catch (InvalidArgumentException $e) {
         print $e->getMessage();
         exit;
     } catch (Exception $e) {
         print $e->getMessage();
         exit;
     }
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:33,代码来源:CommentMapper.class.php


示例8: insertMessage

 /**
  * 
  * @param Message $message_
  * @param array $arrayFilter
  * @throws InvalidArgumentException
  */
 public function insertMessage(Message $message_, array $arrayFilter = array())
 {
     try {
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         $userMapper = new UserMapper();
         $userMapper->setId($message_->getIdSender());
         $user_sender = $userMapper->selectUser();
         $userMapper->setId($message_->getIdReceiver());
         $user_receiver = $userMapper->selectUser();
         if (!is_null($user_sender->getId()) && !is_null($user_receiver->getId())) {
             return parent::insert($this->table, $message_, $arrayFilter);
         } elseif (is_null($user_sender->getId())) {
             throw new Exception('User sender does not exist !');
         } elseif (is_null($user_receiver->getId())) {
             throw new Exception('User receiver does not exist !');
         }
     } catch (InvalidArgumentException $e) {
         print $e->getMessage();
         exit;
     } catch (Exception $e) {
         print $e->getMessage();
         exit;
     }
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:32,代码来源:MessageMapper.class.php


示例9: run

 public function run()
 {
     $mapper = new UserMapper($this->adapter);
     $user = new \Cactus\Entity(array('name' => 'Mr. Test', 'password' => "testingpassword", 'create_date' => date("Y-m-d H:i:s")));
     list($id, $num) = $mapper->save($user);
     // Dont do this for real, but I need to clean up for testing
     $mapper->delete($user);
     return $num === 1;
 }
开发者ID:davewid,项目名称:cactus,代码行数:9,代码来源:UserSeed.php


示例10: getInstance

 /**
  * Returns an singleton instance of this class
  * @return
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new UserMapper();
     }
     return self::$instance;
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:11,代码来源:UserMapper.class.php


示例11: saveUser

 private function saveUser()
 {
     $email = $this->email;
     $login = $this->login;
     $password = md5($this->password);
     //hash
     $cookie = new Cookie();
     $cookieGet = $cookie->getCookie($this->app);
     $user = new User();
     $user->login = $login;
     $user->password = $password;
     $user->email = $email;
     $user->cookie = $cookieGet;
     $Usermapper = new UserMapper($this->db);
     $Usermapper->save($user);
     $this->app->redirect('/TwigBlog');
 }
开发者ID:toppestkek,项目名称:TwigBlog,代码行数:17,代码来源:Validator.php


示例12: authenticateUser

 /**
  * Authenticates the current request. If the request does not contain
  * auth credentials, it will generate a 401 response code and end PHP processing
  * If the request contain credentials, it will be checked against the database.
  * If the credentials are ok, it will return the User object just logged. If the
  * credentials are invalid, it will generate a 401 code as well and end PHP
  * processing.
  *
  * @return User the user just authenticated.
  */
 public function authenticateUser()
 {
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized');
         header('WWW-Authenticate: Basic realm="Rest API of MVCBLOG"');
         die('This operation requires authentication');
     } else {
         $userMapper = new UserMapper();
         if ($userMapper->isValidUser($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) {
             return new User($_SERVER['PHP_AUTH_USER']);
         } else {
             header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized');
             header('WWW-Authenticate: Basic realm="Rest API of MVCBLOG"');
             die('The username/password is not valid');
         }
     }
 }
开发者ID:xrlopez,项目名称:TSW,代码行数:27,代码来源:BaseRest.php


示例13: getLogin

 public function getLogin($user_id, $db)
 {
     $user = new User();
     $user->id = $user_id;
     $usermapper = new UserMapper($db);
     $result = $usermapper->selectById($user);
     if (empty($result)) {
         $login = "Anonymous";
     } else {
         foreach ($result as $value) {
             if ($value['login'] != NULL) {
                 $login = $value['login'];
             } else {
                 $login = "Anonymous";
             }
         }
     }
     return $login;
 }
开发者ID:toppestkek,项目名称:TwigBlog,代码行数:19,代码来源:Login.php


示例14: find

 public function find($type = null)
 {
     $result = array();
     foreach ($this->query($this->getFindSql($type)) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getUserId()] = $user;
     }
     return result;
 }
开发者ID:raledon,项目名称:runningOwl,代码行数:10,代码来源:UserDao.php


示例15: insertIncoming

 /**
  * 
  * @param Incoming $incoming_
  * @param array $arrayFilter
  * @throws InvalidArgumentException
  */
 public function insertIncoming(Incoming $incoming_, array $arrayFilter = array())
 {
     try {
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         $userMapper = new UserMapper();
         $userMapper->setId($incoming_->getIdUser());
         $user = $userMapper->selectUser();
         if (!is_null($user->getId())) {
             return parent::insert($this->table, $incoming_, $arrayFilter);
         } elseif (isset($user) && is_null($user->getId())) {
             throw new Exception('User does not exist !');
         }
     } catch (Exception $e) {
         print $e->getMessage();
         exit;
     }
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:25,代码来源:IncomingMapper.class.php


示例16: drawWidget

	/**
	 * Draws this datatype as a HTML widget directly into the output stream
	 */
	function drawWidget()
	{	
		$userMapper = new UserMapper();
		$userArray = $userMapper->getAll();
		
		?>
		<select name="<?php echo $this->getName()?>" id="<?php echo $this->getName()?>">
			<option value=""></option>
			<?php foreach($userArray as $user) 
			{ 
				/* @var $user User */
				$selected = "";
				if ($user->getId() == $this->getValue()) $selected = "selected=\"selected\"";
			?>			
			<option <?php echo $selected?> value="<?php echo $user->getId()?>"><?php echo $user->getName()?></option>
			<?php }?>
		</select>
		<?
	}
开发者ID:BackupTheBerlios,项目名称:icf-svn,代码行数:22,代码来源:userFrontAttribute.php


示例17: findById

 public function findById($id)
 {
     $row = $this->query('SELECT * FROM users_tb WHERE id = ' . (int) $id)->fetch();
     if (!$row) {
         return null;
     }
     $user = new User();
     UserMapper::map($user, $row);
     return $user;
 }
开发者ID:beshad,项目名称:dropoff_1_DEC_MAC_2204_ORDER_ORDER_TABLE_WORKS,代码行数:10,代码来源:UserDao.php


示例18: __construct

 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($config, $args)
 {
     $this->mapper = UserMapper::getInstance();
     $this->companyMapper = CompanyMapper::getInstance();
     $this->serviceCompanyMapper = ServiceCompanyMapper::getInstance();
     $this->serviceCompanyManager = ServiceCompanyManager::getInstance($config, $args);
     $this->adminMapper = AdminMapper::getInstance();
     $this->config = $config;
     $this->args = $args;
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:17,代码来源:UserManager.class.php


示例19: read

 public function read()
 {
     $result = array();
     $sql = 'SELECT * FROM user_tb';
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getId()] = $user;
     }
     return $result;
 }
开发者ID:beshad,项目名称:dropoff_practice_26NOV_0011,代码行数:11,代码来源:UserDao.php


示例20: find

 public function find($status = null)
 {
     $result = array();
     $sql = 'SELECT id, first_name, user_password , status FROM user_tb WHERE ' . 'status = "' . $status . '";';
     foreach ($this->query($sql) as $row) {
         $user = new User();
         UserMapper::map($user, $row);
         $result[$user->getId()] = $user;
     }
     return $result;
 }
开发者ID:beshad,项目名称:dropoff_test_26NOV_0003,代码行数:11,代码来源:UserDao.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserModel类代码示例发布时间:2022-05-23
下一篇:
PHP UserManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap