本文整理汇总了PHP中UserDao类的典型用法代码示例。如果您正苦于以下问题:PHP UserDao类的具体用法?PHP UserDao怎么用?PHP UserDao使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserDao类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: login
public function login(&$testParam)
{
// //新建两个观察者
// $ob1 = new identityObserver;
// $ob2 = new logObserver;
//
// //为当前方法添加观察者
// $this -> addObserver(__METHOD__, $ob1);
// $this -> addObserver(__METHOD__, $ob2);
//
// //通知观察者,并且传递参数
// $this -> notifyObserver('login', 'UserModule\'s login function work!');
// $dao = getDatabase();
$dao = new UserDao();
return $dao->login($testParam);
}
开发者ID:rolealiu,项目名称:RTP,代码行数:16,代码来源:UserModule.class.php
示例17: handleForm
public function handleForm(Context $context, $action)
{
if ($action == "createReservation") {
if (isset($_POST['equip_id']) && $_POST['equip_id'] != "" && (isset($_POST['start_date']) && $_POST['start_date'] != "") && (isset($_POST['length']) && $_POST['length'] != "")) {
$equipId = $_POST['equip_id'];
$equip = EquipmentDao::getEquipmentByID($equipId);
if ($equip != null) {
if (SessionUtil::getUserlevel() >= $equip->minUserLevel) {
$startDate = $_POST['start_date'];
$endDate = DateUtil::incrementDate($startDate, $_POST['length']);
$reservations = ReservationDao::getReservationsForEquipmentByDate($equipId, $startDate, $endDate);
if (count($reservations) == 0) {
$user = UserDao::getUserByUsername(SessionUtil::getUsername());
$reservation = ReservationDao::createReservation($user->id, $equipId, $_POST['length'], $startDate, $endDate, $_POST['user_comment']);
EmailUtil::sendNewReservationNotices($user, $reservation);
} else {
$context->addError("Reservations already exist during selected dates ({$startDate} and {$endDate}).");
}
} else {
$context->addError("Cannot reserve equipment (User Level).");
}
} else {
$context->addError("No such equipment.");
}
} else {
$context->addError("Required Field Left Blank.");
}
} else {
$context->addError("Incorrect Action.");
}
}
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:31,代码来源:PlaceReservationHandler.php
示例18: handleForm
public function handleForm(Context $context, $action)
{
//TODO: Check user level >= ADMIN
if ($action == "savePassword") {
if (isset($_POST['newpass']) && $_POST['newpass'] != "" && (isset($_POST['confpass']) && $_POST['confpass'] != "")) {
$newPassword = $_POST['newpass'];
$confirmPassword = $_POST['confpass'];
if ($newPassword = $confirmPassword) {
UserDao::updateUserPassword($_POST['userid'], $newPassword);
$context->addMessage("Password Successfully Changed.");
} else {
$context->addError("Passwords Don't Match.");
}
} else {
$context->addError("Required Field Left Blank.");
}
} else {
if ($action == "saveEmail") {
if (isset($_POST['email']) && $_POST['email'] != "") {
$email = $_POST['email'];
UserDao::updateUserEmail($_POST['userid'], $email);
$context->addMessage("Email Successfully Changed.");
} else {
$context->addError("Required Field Left Blank.");
}
} else {
if ($action == "saveUserLevel") {
if (isset($_POST['level']) && $_POST['level'] != "") {
$userlevel = $_POST['level'];
UserDao::updateUserLevel($_POST['userid'], $userlevel);
$context->addMessage("User Level Successfully Changed.");
} else {
$context->addError("Required Field Left Blank.");
}
} else {
if ($action == "saveNotes") {
if (isset($_POST['notes']) && $_POST['notes'] != "") {
$notes = $_POST['notes'];
UserDao::updateUserNotes($_POST['userid'], $notes);
$context->addMessage("Notes Successfully Changed.");
} else {
$context->addError("Required Field Left Blank.");
}
} else {
if ($action == "saveName") {
if (isset($_POST['name']) && $_POST['name'] != "") {
$name = $_POST['name'];
UserDao::updateName($_POST['userid'], $name);
$context->addMessage("Name Successfully Changed.");
} else {
$context->addError("Required Field Left Blank.");
}
} else {
$context->addError("Incorrect Action.");
}
}
}
}
}
}
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:60,代码来源:EditUserHandler.php
示例19: updateReservationStatus
public static function updateReservationStatus($resId, $status, $sendEmail)
{
Database::doQuery("UPDATE " . Database::addPrefix(ReservationDao::table_name) . " SET mod_status = '" . Database::makeStringSafe($status) . "'" . " WHERE res_id = '" . Database::makeStringSafe($resId) . "'");
if ($sendEmail) {
$reservation = ReservationDao::getReservation($resId);
$user = UserDao::getUserByID($reservation->userId);
EmailUtil::sendUpdateReservationNotice($user, $reservation);
}
}
开发者ID:ramielrowe,项目名称:Reservation-System-V2,代码行数:9,代码来源:ReservationDao.php
示例20: createTask
/**
* Create a task.
*
* @param UserDao $userDao
* @param string $tmpWorkDirRoot
* @return Batchmake_TaskDao
* @throws Zend_Exception
*/
public function createTask($userDao, $tmpWorkDirRoot)
{
if (!$userDao instanceof UserDao) {
throw new Zend_Exception('Error parameters.');
}
/** @var Batchmake_TaskDao $task */
$task = MidasLoader::newDao('TaskDao', 'batchmake');
$task->setUserId($userDao->getKey());
$this->save($task);
$userId = $task->getUserId();
$taskId = $task->getKey();
$subdirs = array(MIDAS_BATCHMAKE_SSP_DIR, $userId, $taskId);
// create a workDir based on the task and user
$workDir = KWUtils::createSubDirectories($tmpWorkDirRoot . '/', $subdirs);
$task->setWorkDir($workDir);
$this->save($task);
return $task;
}
开发者ID:josephsnyder,项目名称:Midas,代码行数:26,代码来源:TaskModelBase.php
注:本文中的UserDao类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论