예제 #1
0
 public function findList($count)
 {
     $example = new OW_Example();
     $example->setLimitClause(0, $count);
     $example->setOrder('timeStamp DESC');
     return $this->findListByExample($example);
 }
예제 #2
0
 /**
  * get top inviters
  * @param array $params
  * @return array YNCONTACTIMPORTER_BOL_Statistic
  */
 public function getTopInviters($params = array())
 {
     $example = new OW_Example();
     $example->setLimitClause(0, 10);
     $example->setOrder("`totalSent` DESC");
     return $this->findListByExample($example);
 }
 /**
  * Finds user trial plan usage by user Id
  * 
  * @param int $userId
  * @return MEMBERSHIP_BOL_MembershipUserTrial
  */
 public function findByUserId($userId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }
예제 #4
0
파일: flag_dao.php 프로젝트: vazahat/dudex
 public function find($type, $entityId, $userId)
 {
     $ex = new OW_Example();
     $ex->andFieldEqual('type', $type)->andFieldEqual('entityId', $entityId)->andFieldEqual('userId', $userId);
     $ex->setLimitClause(0, 1);
     return $this->findObjectByExample($ex);
 }
예제 #5
0
 public function findByUserId($userId, $first, $count)
 {
     $example = new OW_Example();
     $example->andFieldEqual(self::USER_ID, (int) $userId);
     $example->setLimitClause($first, $count);
     return $this->findListByExample($example);
 }
 public function getId($moderatorId, $groupId)
 {
     $ex = new OW_Example();
     $ex->andFieldEqual('moderatorId', $moderatorId);
     $ex->andFieldEqual('groupId', $groupId);
     $ex->setLimitClause(1, 1);
     return $this->findIdByExample($ex);
 }
예제 #7
0
 public function getGoalLatestDonations($goalId, $limit)
 {
     $example = new OW_Example();
     $example->andFieldEqual('goalId', $goalId);
     $example->setOrder('`donationStamp` DESC');
     $example->setLimitClause(0, $limit);
     return $this->findListByExample($example);
 }
예제 #8
0
 /**
  * @param $userId
  * @param $page
  * @param $limit
  * @return array|mixed
  */
 public function findUserGuests($userId, $page, $limit)
 {
     $first = ($page - 1) * $limit;
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     $example->setLimitClause($first, $limit);
     $example->setOrder('`visitTimestamp` DESC');
     return $this->findListByExample($example);
 }
예제 #9
0
 public function getUpdatedActions()
 {
     $ex = new OW_Example();
     $ex->andFieldEqual(PRIVACY_BOL_CronDao::IN_PROCESS, 0);
     $ex->setOrder(PRIVACY_BOL_CronDao::TIMESTAMP);
     $ex->setLimitClause(0, 500);
     $objectList = $this->findListByExample($ex);
     return $objectList;
 }
예제 #10
0
파일: log_dao.php 프로젝트: vazahat/dudex
 /**
  * Finds user last action log
  * 
  * @param int $userId
  * @param int $actionId
  */
 public function findLast($userId, $actionId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     $example->andFieldEqual('actionId', $actionId);
     $example->setOrder('`logTimestamp` DESC');
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }
예제 #11
0
 public function findHotList($start = 0, $count = null)
 {
     $example = new OW_Example();
     $example->setOrder("`timestamp` DESC");
     if ($count !== null) {
         $example->setLimitClause($start, $count);
     }
     return $this->findListByExample($example);
 }
예제 #12
0
 public function findList($optionId, $limit = null)
 {
     $example = new OW_Example();
     $example->andFieldEqual('optionId', $optionId);
     if (!empty($limit)) {
         $example->setLimitClause(0, $limit);
     }
     $example->setOrder('timeStamp DESC');
     return $this->findListByExample($example);
 }
예제 #13
0
 public function findImages($plugin, $userId = null, $first, $count)
 {
     $ex = new OW_Example();
     $ex->andFieldEqual('plugin', $plugin);
     if ($userId !== null && intval($userId) > 0) {
         $ex->andFieldEqual('userId', $userId);
     }
     $ex->setLimitClause($first, $count)->setOrder('stamp DESC');
     return $this->findListByExample($ex);
 }
예제 #14
0
 /**
  * 
  * @param array $entityTypes
  * @return array
  */
 public function findByEntityTypeList($entityTypes, array $limit = null)
 {
     $example = new OW_Example();
     $example->andFieldInArray("entityType", $entityTypes);
     if (!empty($limit)) {
         $example->setLimitClause($limit[0], $limit[1]);
     }
     $example->setOrder("timeStamp DESC");
     return $this->findListByExample($example);
 }
예제 #15
0
 /**
  * find All Provider
  *
  * @param array $params
  * @return array YNCONTACTIMPORTER_BOL_Provider
  */
 public function getAllProviders($params = array())
 {
     $example = new OW_Example();
     if (isset($params['limit'])) {
         $example->setLimitClause(0, $params['limit']);
     }
     if (isset($params['enable'])) {
         $example->andFieldEqual('enable', $params['enable']);
     }
     $example->setOrder("`order`");
     return $this->providerDao->getAllProviders($example);
 }
예제 #16
0
파일: cron.php 프로젝트: vazahat/dudex
 public function processScheduler()
 {
     /**
      * following step to speed up & beat performance
      * 1. check album limit
      * 2. check quota limit
      * 3. get nodes of this schedulers
      * 4. get all items of current schedulers.
      * 5. process each node
      * 5.1 check required quota
      * 5.2 fetch data to pubic file
      * 5.3 store to file model
      * 6. check status of schedulers, if scheduler is completed == (remaining == 0)
      * 6.1 udpate feed and message.
      */
     /**
      * Unlimited time.
      */
     set_time_limit(0);
     /**
      * default 20
      * @var int
      */
     $configs = OW::getConfig()->getValues('ynmediaimporter');
     $limitUserPerCron = $configs['number_photo'] ? intval($configs['number_photo']) : 20;
     /**
      * default 20
      * @var int
      */
     $limitQueuePerCron = $configs['number_queue'] ? intval($configs['number_queue']) : 20;
     /**
      * process number queue.
      */
     /**
      * get scheduler from tables data.
      */
     $example = new OW_Example();
     $example->andFieldLessThan('status', '3');
     $example->setOrder('last_run');
     $example->setLimitClause($first, $count)->setLimitClause(0, $limitQueuePerCron);
     $schedulers = YNMEDIAIMPORTER_BOL_SchedulerDao::getInstance()->findListByExample($example);
     foreach ($schedulers as $scheduler) {
         Ynmediaimporter::processScheduler($scheduler, 0, $limitUserPerCron, 1, 1);
     }
     echo "success!";
     exit(0);
 }
예제 #17
0
 public function findUserVideos($userId, $start, $offset)
 {
     $clipDao = VIDEO_BOL_ClipDao::getInstance();
     $example = new OW_Example();
     $example->andFieldEqual('status', 'approved');
     $example->andFieldEqual('userId', $userId);
     $example->setOrder('`addDatetime` DESC');
     $example->setLimitClause($start, $offset);
     $list = $clipDao->findListByExample($example);
     $out = array();
     foreach ($list as $video) {
         $id = $video->id;
         $videoThumb = VIDEO_BOL_ClipService::getInstance()->getClipThumbUrl($id);
         $out[$id] = array('id' => $id, 'embed' => $video->code, 'title' => UTIL_String::truncate($video->title, 65, ' ...'), 'description' => UTIL_String::truncate($video->description, 130, ' ...'), 'thumb' => $videoThumb == 'undefined' ? null : $videoThumb, 'date' => UTIL_DateTime::formatDate($video->addDatetime), 'permalink' => OW::getRouter()->urlForRoute('view_clip', array('id' => $id)));
         $out[$id]['oembed'] = json_encode(array('type' => 'video', 'thumbnail_url' => $out[$id]['thumb'], 'html' => $out[$id]['embed'], 'title' => $out[$id]['title'], 'description' => $out[$id]['description']));
     }
     return $out;
 }
예제 #18
0
 /**
  * get All invitations with userId
  * 
  * @param OW_Example
  * 
  * @return array YNCONTACTIMPORTER_BOL_Invitation
  */
 public function getInvitationByUserId($params = array())
 {
     $example = new OW_Example();
     if (isset($params['count']) && $params['count']) {
         $example->setLimitClause($params['first'], $params['count']);
     }
     if (isset($params['userId'])) {
         $example->andFieldEqual('userId', $params['userId']);
     }
     if (isset($params['provider'])) {
         $example->andFieldEqual('provider', $params['provider']);
     } else {
         $example->andFieldEqual('isUsed', 0);
     }
     if (isset($params['userId']) && empty($params['provider'])) {
         // check queues
         $emails = YNCONTACTIMPORTER_BOL_PendingService::getInstance()->getAllPendingEmailsByUserId(array('userId' => $params['userId']));
         $socials = YNSOCIALBRIDGE_BOL_QueueService::getInstance()->getQueuesByUserId(array('userId' => $params['userId'], 'type' => 'sendInvite'));
         $friendIds = array();
         foreach ($emails as $email) {
             $friendIds[] = $email['recipientEmail'];
         }
         foreach ($socials as $social) {
             $arr_id = $arr = explode('/', $social['id']);
             $friendIds[] = $arr_id[0];
         }
         if ($friendIds) {
             $example->andFieldNotInArray('friendId', $friendIds);
         }
     }
     if (isset($params['search']) && $params['search']) {
         $example->andFieldLike('friendId', "%" . $params['search'] . "%");
     }
     $example->setOrder("`sentTime` DESC");
     return $this->findListByExample($example);
 }
예제 #19
0
 public function isDocumentUriUnique($uri)
 {
     $ex = new OW_Example();
     $ex->andFieldEqual('uri', $uri);
     $ex->setLimitClause(0, 1);
     return $this->findObjectByExample($ex) === null;
 }
예제 #20
0
 public function findUserAlbums($userId, $start, $offset)
 {
     if (!$this->isActive()) {
         return null;
     }
     $service = PHOTO_BOL_PhotoAlbumService::getInstance();
     $albumDao = PHOTO_BOL_PhotoAlbumDao::getInstance();
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     $example->setOrder('createDatetime DESC');
     $example->setLimitClause($start, $offset);
     $albumList = $albumDao->findListByExample($example);
     $albumListIds = array();
     foreach ($albumList as $album) {
         $albumListIds[] = $album->id;
     }
     $covers = $service->getAlbumCoverForList($albumIdList);
     $out = array();
     foreach ($albumList as $album) {
         $out[] = array('id' => $album->id, 'cover' => $covers[$album->id], 'name' => $album->name);
     }
     return $out;
 }
예제 #21
0
 public function findVisibleNotDeletableSection()
 {
     $example = new OW_Example();
     $example->andFieldEqual('isHidden', 0);
     $example->andFieldEqual('isDeletable', 0);
     $example->andFieldNotEqual('name', 'about_my_match');
     $example->setOrder(' sortOrder ASC ');
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }
예제 #22
0
파일: group_dao.php 프로젝트: vazahat/dudex
 public function findAllLimited($first = null, $count = null)
 {
     $example = new OW_Example();
     $example->setOrder(" id DESC ");
     if ($first != null && $count != null) {
         $example->setLimitClause($first, $count);
     }
     return $this->findListByExample($example);
 }
예제 #23
0
 public function findListAfterAvatarId($avatarId, $count, $includes = true)
 {
     $avatar = $this->findLastByAvatarId($avatarId);
     if ($avatar === null) {
         return array();
     }
     $example = new OW_Example();
     $example->andFieldEqual("userId", $avatar->userId);
     if ($includes) {
         $example->andFieldLessOrEqual("timeStamp", $avatar->timeStamp);
     } else {
         $example->andFieldLessThan("timeStamp", $avatar->timeStamp);
     }
     $example->setOrder("`timeStamp` DESC");
     $example->setLimitClause(0, $count);
     return $this->findListByExample($example);
 }
예제 #24
0
 /**
  *
  * @param int $avatarId
  * @return UAVATARS_BOL_Avatar
  */
 public function findLastByAvatarId($avatarId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('avatarId', $avatarId);
     $example->setOrder('timeStamp DESC');
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }
예제 #25
0
 /**
  * @param int $count
  * @return array
  */
 public function getNextUrlList($count)
 {
     $example = new OW_Example();
     $example->andFieldEqual(self::STATUS, 0);
     $example->setLimitClause(0, $count);
     return $this->findListByExample($example);
 }
예제 #26
0
파일: post_dao.php 프로젝트: vazahat/dudex
 public function findUserPostListByPeriod($id, $lb, $ub, $first, $count)
 {
     if ($first < 0) {
         $first = 0;
     }
     if ($count < 0) {
         $count = 1;
     }
     $ex = new OW_Example();
     $ex->andFieldEqual('authorId', $id);
     $ex->andFieldBetween('timestamp', $lb, $ub);
     $ex->andFieldEqual('isDraft', 0);
     $ex->setOrder('`timestamp` DESC');
     $ex->setLimitClause($first, $count);
     return $this->findListByExample($ex);
 }
예제 #27
0
 public function findIdByExample(OW_Example $example, $cacheLifeTime = 0, $tags = array())
 {
     if ($example === null) {
         throw new InvalidArgumentException('argument must not be null');
     }
     $example->setLimitClause(0, 1);
     $sql = 'SELECT `id` FROM ' . $this->getTableName() . $example;
     return $this->dbo->queryForColumn($sql, array(), $cacheLifeTime, $tags);
 }
예제 #28
0
 /**
  * Return search result item count
  *
  * @param int $listId
  * @param int $first
  * @param int $count
  * return array
  */
 public function getUserIdList($listId, $first, $count, $excludeList = array())
 {
     $example = new OW_Example();
     $example->andFieldEqual('searchId', (int) $listId);
     $example->setOrder(' sortOrder ');
     $example->setLimitClause($first, $count);
     if (!empty($excludeList)) {
         $example->andFieldNotInArray('userId', $excludeList);
     }
     $results = BOL_SearchResultDao::getInstance()->findListByExample($example);
     $userIdList = array();
     foreach ($results as $result) {
         $userIdList[] = $result->userId;
     }
     return $userIdList;
 }
예제 #29
0
 public function getNextPhoto($albumId, $id)
 {
     if (!$id) {
         return false;
     }
     $example = new OW_Example();
     $example->andFieldEqual('albumId', $albumId);
     $example->andFieldLessThan('id', $id);
     $example->andFieldEqual('status', 'approved');
     $example->setOrder('`id` DESC');
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }
예제 #30
0
 /**
  * @param $userId
  * @return MAILBOX_BOL_Message
  */
 public function findUserLastMessage($userId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('senderId', $userId);
     $example->setOrder('timeStamp DESC');
     $example->setLimitClause(0, 1);
     return $this->findObjectByExample($example);
 }