本文整理汇总了PHP中BOL_UserDao类的典型用法代码示例。如果您正苦于以下问题:PHP BOL_UserDao类的具体用法?PHP BOL_UserDao怎么用?PHP BOL_UserDao使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BOL_UserDao类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Returns an instance of class (singleton pattern implementation).
*
* @return BOL_UserDao
*/
public static function getInstance()
{
if (self::$classInstance === null) {
self::$classInstance = new self();
}
return self::$classInstance;
}
示例2: findUsers
public function findUsers($groupId, $count, $withPhoto = true)
{
$userTable = BOL_UserDao::getInstance()->getTableName();
$avatarJoin = !$withPhoto ? '' : "INNER JOIN `" . BOL_AvatarDao::getInstance()->getTableName() . "` as `a`\n \t\t\tON( `u`.`id` = `a`.`userId` )";
$query = "\n SELECT `u`.* FROM `{$userTable}` AS `u`\n\n INNER JOIN `" . GROUPS_BOL_GroupUserDao::getInstance()->getTableName() . "` AS `g`\n ON( `u`.`id` = `g`.`userId` )\n\n LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n ON( `u`.`id` = `s`.`userId` )\n\n LEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n ON( `u`.`id` = `d`.`userId` )\n\n {$avatarJoin}\n\n WHERE g.groupId=:g AND `s`.`id` IS NULL AND `d`.`id` IS NULL\n ORDER BY `u`.`activityStamp` DESC\n LIMIT :ls, :le";
return OW::getDbo()->queryForObjectList($query, BOL_UserDao::getInstance()->getDtoClassName(), array('ls' => 0, 'le' => $count, 'g' => $groupId));
}
示例3: fillData
public function fillData($period, $defaultSchedules)
{
$usersDao = BOL_UserDao::getInstance();
$scheduleDao = NOTIFICATIONS_BOL_ScheduleDao::getInstance();
$query = "REPLACE INTO " . $this->getTableName() . " (`userId`, `timeStamp`) SELECT DISTINCT u.id, UNIX_TIMESTAMP() FROM " . $usersDao->getTableName() . " u\n LEFT JOIN " . $scheduleDao->getTableName() . " s ON u.id = s.userId\n WHERE (IF( s.schedule IS NULL, :ds, s.schedule )=:as AND u.activityStamp < :as ) OR IF( s.schedule IS NULL, :ds, s.schedule )=:is ORDER BY u.activityStamp DESC";
return $this->dbo->query($query, array('as' => time() - $period, 'ds' => $defaultSchedules, 'is' => NOTIFICATIONS_BOL_Service::SCHEDULE_IMMEDIATELY, 'as' => NOTIFICATIONS_BOL_Service::SCHEDULE_AUTO));
}
示例4: findByTypeId
/**
* Finds users by membership type
*
* @param int $typeId
* @param int $page
* @param int $onPage
*/
public function findByTypeId($typeId, $page, $onPage)
{
$limit = (int) $onPage;
$first = ($page - 1) * $limit;
$sql = "SELECT `m`.*\n FROM `" . $this->getTableName() . "` AS `m`\n LEFT JOIN `" . BOL_UserDao::getInstance()->getTableName() . "` AS `u` ON (`u`.`id` = `m`.`userId`)\n WHERE `m`.`typeId` = :typeId\n ORDER BY `u`.`activityStamp` DESC\n LIMIT :first, :limit";
return $this->dbo->queryForList($sql, array('typeId' => $typeId, 'first' => $first, 'limit' => $limit));
}
示例5: __construct
/**
* Class constructor
*/
private function __construct()
{
$this->sectionDao = FORUM_BOL_SectionDao::getInstance();
$this->groupDao = FORUM_BOL_GroupDao::getInstance();
$this->topicDao = FORUM_BOL_TopicDao::getInstance();
$this->postDao = FORUM_BOL_PostDao::getInstance();
$this->userDao = BOL_UserDao::getInstance();
}
示例6: login
public function login(array $params)
{
$required_data = array("username", "password");
foreach ($required_data as $rdata) {
if (!array_key_exists($rdata, $post) || empty($post[$rdata])) {
$return = array("response_message" => "Please enter " . $rdata, "response_status" => "0");
echo json_encode($return);
exit;
}
}
if (empty($post["username"]) || empty($post["password"])) {
throw new ErrorException();
}
$deviceId = $post["token"];
$deviceType = $post["type"];
$email_check = BOL_UserDao::getInstance()->findUserByUsernameOrEmail($post["username"]);
$email_exits = count($email_check);
if ($email_exits != '1') {
$messages = "Sorry!!! Your Username or Email is not registered";
$return_data = array("response_status" => '0', "response_message" => $messages);
echo json_encode($return_data);
exit;
} else {
$result = OW::getUser()->authenticate(new BASE_CLASS_StandardAuth($post["username"], $post["password"]));
if (!$result->isValid()) {
$messages = $result->getMessages();
$messages = "Sorry!!! Your password doesn’t match. Please try again";
$return_data = array("response_status" => '0', "response_message" => $messages);
echo json_encode($return_data);
exit;
} else {
$token = OW_Auth::getInstance()->getAuthenticator()->getId();
$tokenauth = new OW_TokenAuthenticator($token);
$service = PHOTO_BOL_PhotoService::getInstance();
$this->user = BOL_UserService::getInstance()->findUserById($result->getUserId());
$email = $this->user->getEmail();
$account_type = $this->user->getAccountType();
if ($account_type == "8cc28eaddb382d7c6a94aeea9ec029fb") {
$sex = "lady";
} else {
$sex = "gentleman";
}
$username = $this->user->getUsername();
$user_id = $result->getUserId();
$avatars = BOL_AvatarService::getInstance()->getAvatarsUrlList(array($user_id));
$check_exist_value = SKAPI_BOL_Service::getInstance()->findValueExistOrNot($user_id);
$user_skapi_id = $check_exist_value[0]->id;
$user_details = SKAPI_BOL_Service::getInstance()->createUserDetails($user_id, $deviceId, $deviceType, $user_skapi_id);
$messages = "Login Successfully";
$return_data = array("response_status" => '1', "response_message" => $messages, "data" => array("user_id" => $user_id, "user_name" => $username, "email" => $email, "profile_picture" => $avatars[$user_id], "user_type" => $sex));
echo json_encode($return_data);
//return true;
}
}
exit;
}
示例7: findSearchResultListOrderedByRecentlyJoined
public function findSearchResultListOrderedByRecentlyJoined($userIdList, $first, $count)
{
if (empty($userIdList)) {
return array();
}
$queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("user", "id", array("method" => "USEARCH_BOL_SearchDao::findSearchResultListOrderedByRecentlyJoined"));
$where = '';
$sql = "SELECT `user`.* FROM `" . BOL_UserDao::getInstance()->getTableName() . "` `user`\n {$queryParts["join"]}\n \n WHERE `user`.`id` IN (" . $this->dbo->mergeInClause($userIdList) . ") {$where}\n ORDER BY user.joinStamp DESC, `user`.`activityStamp` DESC LIMIT :from, :count ";
return $this->dbo->queryForObjectList($sql, $this->getDtoClassName(), array('from' => (int) $first, 'count' => (int) $count));
}
示例8: findUserIdListForNotify
public function findUserIdListForNotify($timeStamp, $first, $count = BOOKMARKS_BOL_Service::COUNT_CRON_USER)
{
if (empty($timeStamp)) {
return array();
}
$sql = 'SELECT `id`
FROM `' . BOL_UserDao::getInstance()->getTableName() . '`
WHERE `activityStamp` <= :stamp AND `id` NOT IN (
SELECT `userId`
FROM `' . $this->getTableName() . '`)
LIMIT :first, :count';
return $this->dbo->queryForColumnList($sql, array('stamp' => $timeStamp, 'first' => (int) $first, 'count' => (int) $count));
}
示例9: findUserListForInvite
public function findUserListForInvite($eventId, $first, $count, $friendList = null)
{
$userDao = BOL_UserDao::getInstance();
$eventDao = EVENTX_BOL_EventDao::getInstance();
$eventUserDao = EVENTX_BOL_EventUserDao::getInstance();
$where = "";
if (isset($friendList) && empty($friendList)) {
return array();
} else {
if (!empty($friendList)) {
$where = " AND `u`.id IN ( " . $this->dbo->mergeInClause($friendList) . " ) ";
}
}
$query = "SELECT `u`.`id`\n \t\tFROM `{$userDao->getTableName()}` as `u`\n LEFT JOIN `" . $eventDao->getTableName() . "` as `e`\n \t\t\tON( `u`.`id` = `e`.`userId` AND e.id = :event )\n LEFT JOIN `" . $this->getTableName() . "` as `ei`\n \t\t\tON( `u`.`id` = `ei`.`userId` AND `ei`.eventId = :event )\n\n LEFT JOIN `" . $eventUserDao->getTableName() . "` as `eu`\n \t\t\tON( `u`.`id` = `eu`.`userId` AND `eu`.eventId = :event )\n\n \t\tLEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n \t\t\tON( `u`.`id` = `s`.`userId` )\n\n \t\tLEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n \t\t\tON( `u`.`id` = `d`.`userId` )\n\n \t\tWHERE `e`.`id` IS NULL AND `ei`.`id` IS NULL AND `s`.`id` IS NULL AND `d`.`id` IS NULL AND `eu`.`id` IS NULL " . $where . "\n \t\tORDER BY `u`.`activityStamp` DESC\n \t\tLIMIT :first, :count ";
return $this->dbo->queryForColumnList($query, array('event' => $eventId, 'first' => $first, 'count' => $count));
}
示例10: getNewUsersThisMonth
public function getNewUsersThisMonth($first, $count)
{
$query = "SELECT `u`.* FROM `" . BOL_UserDao::getInstance()->getTableName() . "` as `u`\n\t \tLEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n\t \t\tON( `u`.`id` = `s`.`userId` )\n LEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n ON( `u`.`id` = `d`.`userId` )\n\t \tWHERE `s`.`id` IS NULL AND `d`.`id` IS NULL\n\t \tAND `u`.`joinStamp` >= :ts\n\t \tORDER BY `u`.`joinStamp` DESC\n\t \tLIMIT :first, :count";
return OW::getDbo()->queryForObjectList($query, BOL_UserDao::getInstance()->getDtoClassName(), array('ts' => time() - 30 * 24 * 3600, 'first' => $first, 'count' => $count));
}
示例11: findPhotoListByUserIdList
public function findPhotoListByUserIdList(array $userIdList, $first, $limit, $checkPrivacy = NULL)
{
if (count($userIdList) === 0) {
return array();
}
$sql = 'SELECT `p`.*, `a`.`userId`
FROM `' . $this->getTableName() . '` AS `p`
INNER JOIN `' . PHOTO_BOL_PhotoAlbumDao::getInstance()->getTableName() . '` AS `a` ON (`p`.`albumId` = `a`.`id`)
INNER JOIN `' . BOL_UserDao::getInstance()->getTableName() . '` AS `u` ON (`u`.`id` = `a`.`userId`)
WHERE `a`.`userId` IN(' . implode(',', array_map('intval', array_unique($userIdList))) . ') AND `p`.`status` = :status' . ($checkPrivacy !== NULL ? $checkPrivacy ? ' AND (`p`.`' . self::PRIVACY . '` = :everybody OR `p`.`' . self::PRIVACY . '` = :friends)' : ' AND `p`.`' . self::PRIVACY . '` = :everybody' : '') . '
ORDER BY `u`.`username`
LIMIT :first, :limit';
$params = array('first' => (int) $first, 'limit' => (int) $limit, 'status' => 'approved');
if ($checkPrivacy !== NULL) {
switch ($checkPrivacy) {
case TRUE:
$params['friends'] = self::PRIVACY_FRIENDS_ONLY;
case FALSE:
$params['everybody'] = self::PRIVACY_EVERYBODY;
}
}
return $this->dbo->queryForList($sql, $params);
}
示例12: countRateUsers
public function countRateUsers($userId)
{
$rateDao = BOL_RateDao::getInstance();
$userDao = BOL_UserDao::getInstance();
$sql = "SELECT COUNT(*)\n FROM `" . $rateDao->getTableName() . "` AS `r`\n INNER JOIN `" . $userDao->getTableName() . "` AS `u` ON (`u`.`id` = `r`.`userId`) \n WHERE `entityId` = :entityId AND `entityType` = 'user_rates'";
return (int) OW::getDbo()->queryForColumn($sql, array('entityId' => $userId));
}
示例13: getUserIdList
private function getUserIdList($userId)
{
return $this->getUserIdListAlt($userId);
$friendsEnabled = (bool) OW::getEventManager()->call('plugin.friends');
if ($friendsEnabled) {
$friendIdList = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => $userId));
} else {
$friendIdList = array();
}
$userIdList = array();
$userWithCorrespondenceIdList = $this->getUserListWithCorrespondence();
foreach ($userWithCorrespondenceIdList as $id) {
$userIdList[] = $id;
}
$queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("u", "id", array("method" => "BOL_UserDao::findList"));
$correspondenceCondition = "";
if (!empty($userWithCorrespondenceIdList)) {
$correspondenceCondition = " AND `u`.`id` NOT IN ( " . OW::getDbo()->mergeInClause($userWithCorrespondenceIdList) . " ) ";
}
$query = "SELECT `u`.`id`\r\n FROM `" . BOL_UserDao::getInstance()->getTableName() . "` as `u`\r\n {$queryParts["join"]}\r\n\r\n WHERE {$queryParts["where"]} " . $correspondenceCondition;
$tmpUserIdList = OW::getDbo()->queryForColumnList($query);
foreach ($tmpUserIdList as $id) {
if ($id == $userId) {
continue;
}
if (!in_array($id, $userIdList)) {
$userIdList[] = $id;
}
}
return array('userIdList' => $userIdList, 'userWithCorrespondenceIdList' => $userWithCorrespondenceIdList, 'friendIdList' => $friendIdList);
}
示例14: askUsers
private function askUsers($query, $data)
{
if (!OW::getUser()->isAuthenticated()) {
return array('warning' => OW::getLanguage()->text('equestions', 'not_authed_ask_warning'));
}
$userIds = $query['ids'];
$questionId = $data['questionId'];
$question = $this->service->findQuestion($questionId);
$params = array('userId' => OW::getUser()->getId(), 'questionId' => $questionId);
if ($query['all']) {
$params['special'] = true;
$users = BOL_UserDao::getInstance()->findAll();
foreach ($users as $user) {
if ($user->id != $params['userId']) {
$userIds[] = $user->id;
}
}
}
foreach ($userIds as $uid) {
$params['recipientId'] = $uid;
$event = new OW_Event(EQUESTIONS_BOL_Service::EVENT_QUESTION_BEFORE_ASK, $params, $data);
OW::getEventManager()->trigger($event);
}
$permissions = EQUESTIONS_CLASS_CreditsBridge::getInstance()->getAllPermissions(EQUESTIONS_CLASS_Credits::ACTION_ASK);
return array('message' => OW::getLanguage()->text('equestions', 'question_ask_complete_msg', array('count' => count($userIds))), 'permissions' => $permissions);
}
示例15: findGuestUsers
/**
* @param $userId
* @param $page
* @param $limit
* @return array|mixed
*/
public function findGuestUsers($userId, $page, $limit)
{
$first = ($page - 1) * $limit;
$query = "SELECT `u`.*\n FROM `" . $this->getTableName() . "` AS `g`\n INNER JOIN `" . BOL_UserDao::getInstance()->getTableName() . "` as `u`\n ON (`g`.`guestId` = `u`.`id`)\n LEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n ON( `u`.`id` = `s`.`userId` )\n LEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n ON( `u`.`id` = `d`.`userId` )\n WHERE `s`.`id` IS NULL AND `d`.`id` IS NULL\n AND `g`.`userId` = ?\n ORDER BY `g`.`visitTimestamp` DESC\n LIMIT ?, ?";
return $this->dbo->queryForObjectList($query, BOL_UserDao::getInstance()->getDtoClassName(), array($userId, $first, $limit));
}