示例#1
0
 /**
  * @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);
 }
示例#2
0
 public function findByUserIdList(array $userIdList)
 {
     if (empty($userIdList)) {
         return array();
     }
     $example = new OW_Example();
     $example->andFieldInArray(self::USER_ID, $userIdList);
     return $this->findListByExample($example);
 }
示例#3
0
 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);
 }
示例#4
0
 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);
 }
示例#6
0
 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));
 }
示例#7
0
 /**
  * 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);
 }
示例#8
0
 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);
 }
示例#9
0
 /**
  * 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);
 }
示例#10
0
 /**
  * @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);
 }
示例#11
0
 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);
 }
示例#13
0
文件: tag_dao.php 项目: vazahat/dudex
 /**
  * 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);
 }
示例#14
0
 public function findByActionIds($actionIds)
 {
     if (empty($actionIds)) {
         return array();
     }
     $example = new OW_Example();
     $example->andFieldInArray('actionId', $actionIds);
     return $this->findListByExample($example);
 }
示例#15
0
 public function findListByQuestionList($questionList)
 {
     $example = new OW_Example();
     $example->andFieldInArray('question', $questionList);
     return $this->findListByExample($example);
 }
示例#16
0
 /**
  * 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;
 }
示例#17
0
 /**
  *
  * @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);
 }
示例#18
0
 public function deleteByUniqNameList($uniqNameList)
 {
     if (empty($uniqNameList)) {
         return 0;
     }
     $example = new OW_Example();
     $example->andFieldInArray('componentPlaceUniqName', $uniqNameList);
     return $this->deleteByExample($example);
 }
示例#19
0
 /**
  * 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);
 }
示例#21
0
 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);
 }
示例#22
0
 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);
 }
示例#24
0
 /**
  *
  * @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);
 }
示例#25
0
 /**
  * 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);
 }
示例#26
0
 /**
  * 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);
 }
示例#27
0
 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;
 }
示例#28
0
 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);
 }
示例#29
0
 /**
  * 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);
 }
示例#30
0
 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();
 }