本文整理汇总了PHP中BOL_UserDao::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP BOL_UserDao::getInstance方法的具体用法?PHP BOL_UserDao::getInstance怎么用?PHP BOL_UserDao::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOL_UserDao
的用法示例。
在下文中一共展示了BOL_UserDao::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例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: 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));
}
示例4: __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();
}
示例5: 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;
}
示例6: 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));
}
示例7: 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));
}
示例8: 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));
}
示例9: findSiteFeedCount
public function findSiteFeedCount($startTime = null, $formats = null)
{
$activityDao = NEWSFEED_BOL_ActivityDao::getInstance();
$queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("activity", "userId", array("method" => "NEWSFEED_BOL_ActionDao::findSiteFeedCount"));
if ($formats !== null) {
$queryParts["where"] .= " AND action.format IN ( '" . implode("','", $formats) . "' )";
}
$query = 'SELECT COUNT(DISTINCT action.id) FROM ' . $this->getTableName() . ' action
INNER JOIN ' . $activityDao->getTableName() . ' activity ON action.id = activity.actionId
LEFT JOIN ' . $activityDao->getTableName() . ' pactivity ON activity.actionId = pactivity.actionId
AND (pactivity.status=:s AND pactivity.activityType=:ac AND pactivity.privacy!=:peb AND pactivity.visibility & :v)
' . $queryParts["join"] . '
WHERE ' . $queryParts["where"] . ' AND pactivity.id IS NULL AND activity.status=:s AND activity.activityType=:ac AND activity.privacy=:peb AND activity.visibility & :v';
return $this->dbo->queryForColumn($query, array('v' => NEWSFEED_BOL_Service::VISIBILITY_SITE, 's' => NEWSFEED_BOL_Service::ACTION_STATUS_ACTIVE, 'peb' => NEWSFEED_BOL_Service::PRIVACY_EVERYBODY, 'ac' => NEWSFEED_BOL_Service::SYSTEM_ACTIVITY_CREATE), self::CACHE_LIFETIME, array(self::CACHE_TAG_ALL, self::CACHE_TAG_INDEX));
}
示例10: 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);
}
示例11: prepareQuerySelectForUserIdList
/**
* @param $params
* @return string
*/
private function prepareQuerySelectForUserIdList($params)
{
$queryParts = BOL_UserDao::getInstance()->getUserQueryFilter('user', "id", array("method" => "MATCHMAKING_BOL_QuestionMatchDao::prepareQuerySelect"));
$sql = "SELECT `matches`.`id` as userId, `matches`.`compatibility` FROM (SELECT DISTINCT `user`.*, " . $params['compatibility'] . " as `compatibility` FROM `" . BOL_UserDao::getInstance()->getTableName() . "` `user`\n " . $queryParts['join'] . $params['join'] . "\n\n WHERE " . $queryParts['where'] . " AND `user`.`id`<>" . $params['userId'] . " " . $params['where'] . ") as `matches`\n ORDER BY " . $params['order'] . " `matches`.`activityStamp` DESC\n LIMIT :first, :count ";
return $sql;
}
示例12: addRoleByAccountType
public function addRoleByAccountType(BOL_QuestionAccountType $accountType)
{
if (empty($accountType)) {
return;
}
$sql = " REPLACE INTO `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` ( `userId`, `roleId` ) " . "SELECT u.id, :role FROM " . BOL_UserDao::getInstance()->getTableName() . " u " . " INNER JOIN " . BOL_QuestionAccountTypeDao::getInstance()->getTableName() . " `accountType` ON ( accountType.name = u.accountType ) " . " WHERE u.accountType = :account ";
$this->dbo->query($sql, array('account' => $accountType->name, 'role' => $accountType->roleId));
}
示例13: findBookmarksUserIdList
public function findBookmarksUserIdList($userId, $first = 0, $count = NULL, $list = BOOKMARKS_BOL_Service::LIST_LATEST)
{
if (empty($userId)) {
return array();
}
empty($count) ? $count = (int) OW::getConfig()->getValue('bookmarks', 'widget_user_count') : NULL;
switch ($list) {
case BOOKMARKS_BOL_Service::LIST_LATEST:
$sql = 'SELECT `' . self::MARK_USER_ID . '`
FROM `' . $this->getTableName() . '`
WHERE `' . self::USER_ID . '` = :userId
ORDER BY `id` DESC
LIMIT :first, :count';
break;
case BOOKMARKS_BOL_Service::LIST_ONLINE:
$sql = 'SELECT `b`.`' . self::MARK_USER_ID . '`
FROM `' . $this->getTableName() . '` AS `b`
INNER JOIN `' . BOL_UserOnlineDao::getInstance()->getTableName() . '` AS `o`
ON `b`.`' . self::MARK_USER_ID . '` = `o`.`' . BOL_UserOnlineDao::USER_ID . '`
WHERE `b`.`' . self::USER_ID . '` = :userId
ORDER BY `o`.`activityStamp` DESC
LIMIT :first, :count';
break;
case BOOKMARKS_BOL_Service::LIST_NOTIFY:
default:
$sql = 'SELECT `b`.`' . self::MARK_USER_ID . '`
FROM `' . $this->getTableName() . '` AS `b`
INNER JOIN `' . BOL_UserDao::getInstance()->getTableName() . '` AS `u`
ON `b`.`' . self::MARK_USER_ID . '` = `u`.`id`
WHERE `b`.`' . self::USER_ID . '` = :userId
ORDER BY `u`.`activityStamp` DESC
LIMIT :first, :count';
break;
}
return $this->dbo->queryForColumnList($sql, array('userId' => $userId, 'first' => $first, 'count' => $count));
}
示例14: 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));
}
示例15: findUserListWithCorrespondenceAlt
public function findUserListWithCorrespondenceAlt($userId, $friendIdList)
{
$sql = "SELECT `t`.`userId` FROM ( SELECT IF (`m`.`senderId` = :userId, `m`.`recipientId`, `m`.`senderId`) AS `userId`, `m`.`timeStamp` FROM `" . $this->getTableName() . "` as `m`\r\n WHERE (`m`.`senderId`=:userId OR `m`.`recipientId`=:userId)\r\n GROUP BY `userId`\r\n ORDER BY `m`.`timeStamp` DESC) AS `t`\r\n INNER JOIN `" . BOL_UserDao::getInstance()->getTableName() . "` AS `u` ON ( `u`.`id` = `t`.`userId` )\r\n ORDER BY `t`.`timeStamp` DESC";
return $this->dbo->queryForColumnList($sql, array('userId' => $userId));
}