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


PHP UserDao类代码示例

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


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

示例1: getBookList

 /**
  * 获取书籍 
  * 初始化方式的
  */
 public function getBookList($page, $language, $word)
 {
     require_once '../../conndb/mysql/ConnMysqlClass.php';
     require_once '../../user/dao/UserDao.php';
     //定义每页10本
     $pageSize = 30;
     //如果是0页或者没有赋值那么默认给第一页
     if ("" == $page || 0 == $page) {
         $page = 1;
     }
     $page_start = ($page - 1) * $pageSize;
     $userDao = new UserDao();
     $conn = ConnMysqlClass::getConnMysql();
     mysql_select_db(ConnMysqlClass::getDBName(), $conn);
     $str_sql = "";
     //如果language不等于空,那么就加上这个条件
     if ("" != $language) {
         $str_sql = "select * from stack_resource_book where resource_book_language = '{$language}' order by resource_book_id desc limit {$page_start},{$pageSize} ";
     } else {
         if ("" != $word) {
             $str_sql = "select * from stack_resource_book where resource_book_name like '%{$word}%' order by resource_book_id desc limit {$page_start},{$pageSize} ";
         } else {
             $str_sql = "select * from stack_resource_book order by resource_book_id desc limit {$page_start},{$pageSize} ";
             //0 1,3 4
         }
     }
     $result = mysql_query($str_sql);
     $arrBooks = array();
     $var = 0;
     while ($row = mysql_fetch_array($result)) {
         $arrBooks[$var++] = array('page' => $page, 'resource_book_name' => $row['resource_book_name'], 'resource_book_size' => $row['resource_book_size'], 'resource_book_level' => $row['resource_book_level'], 'resource_book_review' => $row['resource_book_review'], 'resource_book_word' => $row['resource_book_word'], 'resource_book_date' => $row['resource_book_date'], 'user_name' => $userDao->getUserById($row['fk_user_id']), 'resource_book_url' => $row['resource_book_url']);
     }
     mysql_close($conn);
     return $arrBooks;
 }
开发者ID:fuzhengwei,项目名称:php,代码行数:39,代码来源:BookDao.php

示例2: DBAccessAction

 public function DBAccessAction()
 {
     $userDao = new UserDao();
     $result = $userDao->getUserByLogin('root');
     $this->setViewVar('result', $result);
     $this->render();
 }
开发者ID:atalatlae,项目名称:TestApi,代码行数:7,代码来源:ExampleController.php

示例3: userHomeSanityCheck

 private function userHomeSanityCheck(BackendSystem $backend_system)
 {
     $dao = new UserDao();
     $users = $dao->searchByStatus(array(PFUser::STATUS_ACTIVE, PFUser::STATUS_RESTRICTED))->instanciateWith(array(UserManager::instance(), 'getUserInstanceFromRow'));
     foreach ($users as $user) {
         $backend_system->userHomeSanityCheck($user);
     }
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:8,代码来源:SystemEvent_ROOT_DAILY.class.php

示例4: validate

 public static function validate(User $user)
 {
     $errors = array();
     $dao = new UserDao();
     if (!$dao->emailPasswordCheck($user)) {
         $errors[] = new Error('Error', 'either your email  or password is not valid.');
     }
     return $errors;
 }
开发者ID:beshad,项目名称:DROP_OFF_PROJECT_FRI1039,代码行数:9,代码来源:Validator.php

示例5: getPolicy

 /**
  * Get policy.
  *
  * @param UserDao $user
  * @param ItemDao $item
  * @return false|ItempolicyuserDao
  * @throws Zend_Exception
  */
 public function getPolicy($user, $item)
 {
     if (!$user instanceof UserDao) {
         throw new Zend_Exception('Should be a user.');
     }
     if (!$item instanceof ItemDao) {
         throw new Zend_Exception('Should be an item.');
     }
     return $this->initDao('Itempolicyuser', $this->database->fetchRow($this->database->select()->where('item_id = ?', $item->getKey())->where('user_id = ?', $user->getKey())));
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:18,代码来源:ItempolicyuserModel.php

示例6: testSuspendAccountDao

 function testSuspendAccountDao()
 {
     $dar = new MockDataAccessResult($this);
     $dar->setReturnValue('isError', false);
     $da = new MockDataAccess($this);
     $da->expectOnce('query', array('UPDATE user SET status = "S", unix_status = "S" WHERE toto', '*'));
     $da->setReturnValue('query', $dar);
     $dao = new UserDao($da);
     $d2 = $dao->suspendAccount('toto');
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:UserAccountValidityTest.php

示例7: getPolicy

 /**
  * Get policy.
  *
  * @param UserDao $user
  * @param FolderDao $folder
  * @return false|FolderpolicyuserDao
  * @throws Zend_Exception
  */
 public function getPolicy($user, $folder)
 {
     if (!$user instanceof UserDao) {
         throw new Zend_Exception('Should be a user.');
     }
     if (!$folder instanceof FolderDao) {
         throw new Zend_Exception('Should be a folder.');
     }
     return $this->initDao('Folderpolicyuser', $this->database->fetchRow($this->database->select()->where('folder_id = ?', $folder->getKey())->where('user_id = ?', $user->getKey())));
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:18,代码来源:FolderpolicyuserModel.php

示例8: getByUser

 /**
  * Return all client records owned by the given user.
  *
  * @param UserDao $userDao
  * @return array
  */
 public function getByUser($userDao)
 {
     $sql = $this->database->select()->setIntegrityCheck(false)->where('owner_id = ?', $userDao->getKey());
     $rows = $this->database->fetchAll($sql);
     $daos = array();
     foreach ($rows as $row) {
         $daos[] = $this->initDao('Client', $row, $this->moduleName);
     }
     return $daos;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:16,代码来源:ClientModel.php

示例9: createTempToken

 /**
  * Create a temporary token that will be used to fetch the user's real API token later.
  *
  * @param UserDao $user user to create the token for
  * @param TokenDao $tokenDao token DAO
  * @return Mfa_ApitokenDao
  * @throws Zend_Exception
  */
 public function createTempToken($user, $tokenDao)
 {
     /** @var Mfa_ApitokenDao $newToken */
     $newToken = MidasLoader::newDao('ApitokenDao', 'mfa');
     $newToken->setUserId($user->getKey());
     $newToken->setTokenId($tokenDao->getKey());
     $newToken->setCreationDate(date('Y-m-d H:i:s'));
     $this->save($newToken);
     return $newToken;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:18,代码来源:ApitokenModelBase.php

示例10: checkphone

 public function checkphone()
 {
     $phone = $_POST['phone'];
     $UserDao = new UserDao();
     $user = $UserDao->getByPhone($phone);
     if ($user) {
         echo "{\"msg\":\"no\"}";
     } else {
         echo "{\"msg\":\"ok\"}";
     }
 }
开发者ID:dreamingodd,项目名称:casarover,代码行数:11,代码来源:UserController.php

示例11: getByUser

 /**
  * Returns the LDAP user corresponding to the core user, or false if the
  * user is not an LDAP user.
  *
  * @param UserDao $userDao core user
  * @return false|Ldap_UserDao
  * @throws Zend_Exception
  */
 public function getByUser($userDao)
 {
     $sql = $this->database->select()->where('user_id = ?', $userDao->getKey());
     $row = $this->database->fetchRow($sql);
     $dao = $this->initDao('User', $row, 'ldap');
     if ($dao) {
         return $dao;
     } else {
         return false;
     }
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:19,代码来源:UserModel.php

示例12: exportUserList

 /**
  * Export user list in csv format
  *
  * @param String $user_name_search
  * @param String $current_sort_header
  * @param String $sort_order
  *
  */
 public function exportUserList($user_name_search, $current_sort_header, $sort_order, $status_values)
 {
     global $Language;
     header('Content-Type: text/csv');
     header('Content-Disposition:attachment; filename=users_list.csv');
     $eol = "\n";
     $documents_title = array('user_id' => $Language->getText('admin_userlist', 'id_user'), 'login_name' => $Language->getText('include_user_home', 'login_name'), 'real_name' => $Language->getText('include_user_home', 'real_name'), 'member_of' => $Language->getText('admin_userlist', 'member_of'), 'admin_of' => $Language->getText('admin_userlist', 'admin_of'), 'status' => $Language->getText('admin_userlist', 'status'));
     echo build_csv_header($this->col_list, $documents_title) . $eol;
     $dao = new UserDao(CodendiDataAccess::instance());
     $result = $dao->listAllUsers($user_name_search, 0, 0, $current_sort_header, $sort_order, $status_values);
     $users = $result['users'];
     echo $this->buildCsvBody($users);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:Admin_UserListExporter.class.php

示例13: getLinkList

 /**
  * 根据信息查询链接
  *
  * @param 分页页数 $page
  * @param 资源类别 $category
  * @param 语言类别 $language
  * @param 检索关键字 $word
  */
 public function getLinkList($page, $category, $language, $word)
 {
     require_once '../../conndb/mysql/ConnMysqlClass.php';
     require_once '../../user/dao/UserDao.php';
     //定义每页的条数
     $pageCount = 30;
     //如果是0页或者没有赋值那么默认给第一页
     if ("" == $page || 0 == $page) {
         $page = 1;
     }
     //分页数据
     $page_start = ($page - 1) * $pageCount;
     //根据用户id查询用户名
     $userDao = new UserDao();
     $conn = ConnMysqlClass::getConnMysql();
     mysql_select_db(ConnMysqlClass::getDBName(), $conn);
     $str_sql = "select fk_user_id,fk_category_sort_name,fk_language_sort_name,resource_link_name,resource_link_url,resource_link_content,resource_link_data,resource_link_statue from stack_resource_link where fk_category_sort_name = '{$category}' ";
     $str_sql_count = "select count(resource_link_id) from stack_resource_link where fk_category_sort_name = '{$category}' ";
     //组合sql语句
     if ("" != $language && "" == $word) {
         $str_sql .= "and fk_language_sort_name = '{$language}' ";
         $str_sql_count .= "and fk_language_sort_name = '{$language}' ";
     } else {
         if ("" == $language && "" != $word) {
             $str_sql .= "and resource_link_name like '%{$word}%' or resource_link_content like '%{$word}%' ";
             $str_sql_count = "and resource_link_name like '%{$word}%' or resource_link_content like '%{$word}%' ";
         } else {
             if ("" != $language && "" != $word) {
                 $str_sql .= "and fk_language_sort_name = '{$language}' and resource_link_name like '%{$word}%' or resource_link_content like '%{$word}%' ";
                 $str_sql_count = "and fk_language_sort_name = '{$language}' and resource_link_name like '%{$word}%' or resource_link_content like '%{$word}%' ";
             }
         }
     }
     $str_sql .= "order by resource_link_id desc limit {$page_start},{$pageCount}";
     $result = mysql_query($str_sql);
     $arrLinks = array();
     $var = 0;
     while ($row = mysql_fetch_array($result)) {
         $arrLinks[$var++] = array("fk_user_id" => $row['fk_user_id'], "user_name" => $userDao->getUserById($row['fk_user_id']), "fk_category_sort_name" => $row['fk_category_sort_name'], "fk_language_sort_name" => $row['fk_language_sort_name'], "resource_link_name" => $row['resource_link_name'], "resource_link_url" => $row['resource_link_url'], "resource_link_content" => $row['resource_link_content'], "resource_link_data" => $row['resource_link_data']);
     }
     //查询数量能分出来多少页
     $result = mysql_query($str_sql_count);
     $row = mysql_fetch_array($result);
     //获得分页
     $pageNum = ceil($row[0] / $pageCount);
     $arrLinks['pageSum'] = strval($pageNum);
     //关闭数据库
     mysql_close($conn);
     return $arrLinks;
 }
开发者ID:fuzhengwei,项目名称:php,代码行数:58,代码来源:LinkDao.php

示例14: postAction

 public function postAction()
 {
     $password = $this->getRequest()->getPost('password');
     $username = $this->getRequest()->getPost('username');
     if (!empty($password) && !empty($username)) {
         $user_dao = new UserDao();
         if ($user_dao->login($username, $password)) {
             Yaf\Session::getInstance()->start();
             Yaf\Session::getInstance()->set('is_admin', $user_dao->getIsAdmin());
             $this->redirect('/');
         } else {
             $this->redirect('/login');
         }
     }
 }
开发者ID:Aimsam,项目名称:BTCAutoTrade,代码行数:15,代码来源:Login.php

示例15: supprimer_admin

 function supprimer_admin($params)
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $deleteProjects = $_POST['check'];
         $userDao = new UserDao(new User());
         $list = $userDao->read($deleteProjects);
         $list->setIs_admin(0);
         $userDao = new UserDao($list);
         $userDao->update($deleteProjects);
         $this->redirect('admin/administrateur');
     }
     $userDao = new UserDao(new User());
     $list = $userDao->read($params);
     $this->set(array("user" => $list));
     $this->render('supprimer_admin');
 }
开发者ID:BinarySoltions,项目名称:projet_rpm,代码行数:16,代码来源:Administrateur.php


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