/** * @param $actionId * @param $accTypeIdList * @return array */ public function findActionPriceForAccountTypeList($actionId, $accTypeIdList) { $example = new OW_Example(); $example->andFieldEqual('actionId', $actionId); $example->andFieldInArray('accountTypeId', $accTypeIdList); return $this->findListByExample($example); }
public function findByUserIdList(array $userIdList) { if (empty($userIdList)) { return array(); } $example = new OW_Example(); $example->andFieldInArray(self::USER_ID, $userIdList); return $this->findListByExample($example); }
public function getBalanceForUserList($ids) { if (!count($ids)) { return array(); } $ids = array_unique($ids); $example = new OW_Example(); $example->andFieldInArray('userId', $ids); return $this->findListByExample($example); }
public function getCompletedFeaturesCount($userId, array $features) { if (empty($userId) || count($features) === 0) { return NULL; } $perDay = OW::getConfig()->getValue('profileprogressbar', 'per_day'); $example = new OW_Example(); $example->andFieldEqual(self::USER_ID, $userId); $example->andFieldInArray(self::ENTITY_TYPE, $features); $example->andFieldBetween(self::TIME_STAMP, strtotime("-{$perDay} day"), time()); return $this->countByExample($example); }
public function findAccountTypeByNameList(array $accountTypeNameList) { if ($accountTypeNameList === null || !is_array($accountTypeNameList) || count($accountTypeNameList) === 0) { return array(); } $example = new OW_Example(); $example->andFieldInArray('name', $accountTypeNameList); $example->setOrder('sortOrder'); return $this->findListByExample($example); }
public function findBlockedList($userId, $userIdList) { $example = new OW_Example(); $example->andFieldEqual(self::USER_ID, (int) $userId); $example->andFieldInArray(self::BLOCKED_USER_ID, $userIdList); return $this->findListByExample($example, BOL_UserBlockDao::CACHE_LIFE_TIME, array(BOL_UserBlockDao::CACHE_TAG_BLOCKED_USER)); }
/** * Returns topic id list * * @param array $groupIds * @return array */ public function findIdListByGroupIds($groupIds) { $example = new OW_Example(); $example->andFieldInArray('groupId', $groupIds); $query = "\n \tSELECT `id` FROM `" . $this->getTableName() . "`\n \t" . $example; return $this->dbo->queryForColumnList($query); }
public function findGuestsByGuestIds($userId, $guestIds) { if (empty($guestIds)) { return array(); } $example = new OW_Example(); $example->andFieldEqual("userId", $userId); $example->andFieldInArray("guestId", $guestIds); $example->setOrder("visitTimestamp DESC"); return $this->findListByExample($example); }
/** * Cancel friendship * * @param integer $requesterId * @param integer $userId */ public function cancel($requesterId, $userId) { $ex = new OW_Example(); $ex->andFieldInArray('userId', array($userId, $requesterId))->andFieldInArray('friendId', array($userId, $requesterId)); $this->deleteByExample($ex); }
/** * @param array $urlList * @return array */ public function findByUrlList(array $urlList) { if (empty($urlList)) { return array(); } $urlList = array_unique($urlList); $example = new OW_Example(); $example->andFieldInArray(self::URL, $urlList); return $this->findListByExample($example); }
public function findHiddenSections() { $example = new OW_Example(); $example->andFieldInArray('isHidden', 1); return $this->findListByExample($example); }
/** * @param $actionId * @param $roles * @throws InvalidArgumentException * @return * */ public function findFirstIdForRoles($actionId, $roles) { if ($actionId === null || (int) $actionId < 1) { throw new InvalidArgumentException('actionId must not be null'); } if ($roles === null || count($roles) < 1) { return null; } $ex = new OW_Example(); $ex->andFieldEqual('actionId', $actionId); $ex->andFieldInArray('roleId', $roles); $ex->setLimitClause(1, 1); return $this->findIdByExample($ex); }
/** * Returns dto list for provided tag labels. * * @param array<string>$labels * @return array */ public function findTagsByLabel($labels) { $example = new OW_Example(); $example->andFieldInArray(self::LABEL, $labels); return $this->findListByExample($example); }
public function findByActionIds($actionIds) { if (empty($actionIds)) { return array(); } $example = new OW_Example(); $example->andFieldInArray('actionId', $actionIds); return $this->findListByExample($example); }
public function findListByQuestionList($questionList) { $example = new OW_Example(); $example->andFieldInArray('question', $questionList); return $this->findListByExample($example); }
/** * Get list of avatars * * @param $idList * @return array of BOL_Avatar */ public function getAvatarsList($idList) { if (empty($idList)) { return array(); } $idList = array_unique(array_map('intval', $idList)); $idsToRequire = array(); $result = array(); foreach ($idList as $id) { if (empty($this->cachedItems[$id])) { $idsToRequire[] = $id; } else { $result[] = $this->cachedItems[$id]; } } $items = array(); if (!empty($idsToRequire)) { $example = new OW_Example(); $example->andFieldInArray('userId', $idsToRequire); $items = $this->findListByExample($example); } foreach ($items as $item) { $result[] = $item; $this->cachedItems[(int) $item->userId] = $item; } return $result; }
/** * * @param array $messageIdList * @return array<MAILBOX_BOL_Attachment> */ public function findAttachmentsByMessageIdList(array $messageIdList) { if (empty($messageIdList)) { return array(); } $example = new OW_Example(); $example->andFieldInArray('messageId', $messageIdList); $example->setOrder('id'); return $this->findListByExample($example); }
public function deleteByUniqNameList($uniqNameList) { if (empty($uniqNameList)) { return 0; } $example = new OW_Example(); $example->andFieldInArray('componentPlaceUniqName', $uniqNameList); return $this->deleteByExample($example); }
/** * Return search result item count * * @param array $listId */ public function deleteSearchResultItems(array $listId) { if (empty($listId)) { return; } $example = new OW_Example(); $example->andFieldInArray('searchId', $listId); $this->deleteByExample($example); }
public function deleteByUniqNameList($entityId, $uniqNameList = array()) { $entityId = (int) $entityId; if (!$entityId) { throw new InvalidArgumentException('Invalid argument $entityId'); } if (empty($uniqNameList)) { return false; } $example = new OW_Example(); $example->andFieldEqual('entityId', $entityId); $example->andFieldInArray('componentPlaceUniqName', $uniqNameList); return $this->deleteByExample($example); }
public function countWinksForPartner($userId, $status = NULL, $viewed = NULL) { if (empty($userId)) { return 0; } $example = new OW_Example(); $example->andFieldEqual(self::USER_ID, $userId); if (!empty($status)) { $example->andFieldEqual(self::STATUS, $status); } if ($viewed === NULL) { $example->andFieldInArray(self::VIEWED, array(0, 1)); } else { $example->andFieldEqual(self::VIEWED, $viewed); } return (int) $this->countByExample($example); }
public function findListByIdList($list) { $ex = new OW_Example(); $ex->andFieldInArray('id', $list); $ex->andFieldEqual('privacy', 'everybody'); $ex->setOrder('timestamp DESC'); return $this->findListByExample($ex); }
public function deleteByQuestionNameAndAccountTypeList($questionName, array $accountTypeList) { if (empty($questionName) || empty($accountTypeList) || !is_array($accountTypeList)) { return; } $example = new OW_Example(); $example->andFieldEqual('questionName', $questionName); $example->andFieldInArray('accountType', $accountTypeList); $this->deleteByExample($example); }
/** * * @param string $key * @return array <BOL_Preference> */ public function findPreferenceList($keyList) { if (empty($keyList) || !is_array($keyList)) { return array(); } $example = new OW_Example(); $example->andFieldInArray(self::KEY, $keyList); return $this->findListByExample($example); }
/** * Returns vote item for user and items list. * * @param array $entityIdList * @param string $entityType * @param integer $userId * @return array */ public function findUserVoteForList($entityIdList, $entityType, $userId) { if (empty($entityIdList)) { return array(); } $example = new OW_Example(); $example->andFieldInArray(self::ENTITY_ID, $entityIdList); $example->andFieldEqual(self::ENTITY_TYPE, $entityType); $example->andFieldEqual(self::USER_ID, $userId); return $this->findListByExample($example); }
/** * Returns post edit info list * * @param array $postIds * @return array of FORUM_BOL_EditPost */ public function findByPostIdList($postIds) { $example = new OW_Example(); $example->andFieldInArray('postId', $postIds); return $this->findListByExample($example); }
public function findIdListByIdList(array $idList, $cacheLifeTime = 0, $tags = array()) { $idList = array_map('intval', $idList); $idsToRequire = array(); $result = array(); foreach ($idList as $id) { if (empty($this->cachedIds[$id])) { $idsToRequire[] = $id; } else { $result[] = $this->cachedIds[$id]; } } $items = array(); if (!empty($idsToRequire)) { $example = new OW_Example(); $example->andFieldInArray('id', $idsToRequire); $items = parent::findIdListByExample($example); } foreach ($items as $item) { $result[] = $item; $this->cachedIds[(int) $item] = (int) $item; } return $result; }
public function findQuestionsBySectionNameList(array $sectionNameList) { if ($sectionNameList === null || !is_array($sectionNameList) || count($sectionNameList) === 0) { return array(); } $example = new OW_Example(); $example->andFieldInArray('sectionName', $sectionNameList); return $this->findListByExample($example); }
/** * Cancel invites * * @param integer $requesterId * @param integer $userId */ public function cancel($inviterId, $inviteeId) { $ex = new OW_Example(); $ex->andFieldInArray('inviterId', array($inviteeId, $inviterId))->andFieldInArray('inviteeId', array($inviteeId, $inviterId)); $this->deleteByExample($ex); }
public function findQuestionsValuesByQuestionNameList(array $questionNameList) { if (isset($questionNameList) && count($questionNameList) > 0) { $list = array(); $questionList = BOL_QuestionDao::getInstance()->findQuestionByNameList($questionNameList); $parentList = array(); foreach ($questionList as $question) { $parentList[$question->parent] = $question->parent; $list[$question->name] = $question->name; } $parentQuestionList = BOL_QuestionDao::getInstance()->findQuestionByNameList($parentList); $parentQuestions = array(); foreach ($parentQuestionList as $question) { $parentQuestions[$question->name] = $question->name; } foreach ($parentList as $key => $value) { if (!empty($parentQuestions[$value])) { $list[$value] = $value; } } $example = new OW_Example(); $example->andFieldInArray('questionName', $list); $example->setOrder('questionName, sortOrder'); $values = $this->findListByExample($example); $result = array(); $questionName = ''; $count = 0; foreach ($values as $key => $value) { if ($questionName !== $value->questionName) { if (!empty($questionName)) { $result[$questionName]['count'] = $count; $count = 0; } $questionName = $value->questionName; } $result[$value->questionName]['values'][] = $value; $count++; } foreach ($questionList as $question) { if (!empty($question->parent) && !empty($parentQuestions[$question->parent])) { $result[$question->name]['values'] = empty($result[$question->parent]['values']) ? array() : $result[$question->parent]['values']; } } if (!empty($questionName)) { $result[$questionName]['count'] = $count; } return $result; } return array(); }