當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。