Beispiel #1
0
 /**
  * @param int $affiliateId
  * @return array
  */
 public function findListByAffiliateId($affiliateId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('affiliateId', $affiliateId);
     $example->setOrder('`paymentDate` DESC');
     return $this->findListByExample($example);
 }
Beispiel #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);
 }
Beispiel #3
0
 public function findList($count)
 {
     $example = new OW_Example();
     $example->setLimitClause(0, $count);
     $example->setOrder('timeStamp DESC');
     return $this->findListByExample($example);
 }
Beispiel #4
0
 public function findListByCategoryId($id)
 {
     $example = new OW_Example();
     $example->andFieldEqual('categoryId', $id);
     $example->setOrder('`order` ASC');
     return $this->findListByExample($example);
 }
Beispiel #5
0
 public function findByGroup($groupId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('groupId', $groupId);
     $example->setOrder('timestamp DESC');
     return $this->findListByExample($example);
 }
Beispiel #6
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);
 }
Beispiel #7
0
 /**
  * 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);
 }
Beispiel #8
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;
 }
Beispiel #9
0
 /**
  * Returns list of packs for account type
  *
  * @param $accountTypeId
  * @return array
  */
 public function getAllPacks($accountTypeId = null)
 {
     $example = new OW_Example();
     if ($accountTypeId) {
         $example->andFieldEqual('accountTypeId', $accountTypeId);
     }
     $example->setOrder('`price` ASC');
     return $this->findListByExample($example);
 }
Beispiel #10
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);
 }
Beispiel #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);
 }
Beispiel #12
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);
 }
Beispiel #13
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);
 }
Beispiel #14
0
 public function getAllSteps($page, $onlyActive = 1)
 {
     $example = new OW_Example();
     if ($page != 'all') {
         $example->andFieldEqual('page', $page);
     }
     if ($onlyActive == 1) {
         $example->andFieldEqual('active', 1);
     }
     $example->setOrder('`page` ASC,`order` ASC');
     return $this->findListByExample($example);
 }
Beispiel #15
0
 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);
 }
Beispiel #16
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;
 }
Beispiel #17
0
 public function getSponsors($count, $forAdmin = 1, $checkValidty = 1)
 {
     $example = new OW_Example();
     if ($forAdmin != 1) {
         $example->andFieldEqual('status', 1);
     }
     $example->setOrder('price DESC,timestamp DESC');
     $sponsors = $this->findListByExample($example);
     $userService = BOL_UserService::getInstance();
     $allSponsors = array();
     $imagePath = OW::getPluginManager()->getPlugin('sponsors')->getUserFilesUrl();
     foreach ($sponsors as $sponsor) {
         $id = $sponsor->id;
         if ($checkValidty) {
             if ((time() - $sponsor->timestamp) / 86400 > $sponsor->validity) {
                 $this->disapprove($id);
                 continue;
             }
         }
         $allSponsors[$id]['id'] = $id;
         $allSponsors[$id]['name'] = $sponsor->name;
         $allSponsors[$id]['email'] = $sponsor->email;
         $allSponsors[$id]['website'] = $sponsor->website;
         $allSponsors[$id]['image'] = $imagePath . $sponsor->image;
         $allSponsors[$id]['status'] = $sponsor->status;
         $allSponsors[$id]['price'] = $sponsor->price;
         $allSponsors[$id]['userId'] = $sponsor->userId;
         $allSponsors[$id]['userName'] = $userService->getDisplayName($sponsor->userId);
         $allSponsors[$id]['userUrl'] = $userService->getUserUrl($sponsor->userId);
         $allSponsors[$id]['timestamp'] = $sponsor->timestamp;
         $allSponsors[$id]['validity'] = $sponsor->validity;
         if ($sponsor->status == 1) {
             $allSponsors[$id]['activityUrl'] = OW::getRouter()->urlFor('SPONSORS_CTRL_Admin', 'disapprove', array('id' => $id));
         } else {
             $allSponsors[$id]['activityUrl'] = OW::getRouter()->urlFor('SPONSORS_CTRL_Admin', 'approve', array('id' => $id));
         }
         $allSponsors[$id]['editUrl'] = OW::getRouter()->urlFor('SPONSORS_CTRL_Admin', 'edit', array('id' => $id));
         $allSponsors[$id]['deleteUrl'] = OW::getRouter()->urlFor('SPONSORS_CTRL_Admin', 'delete', array('id' => $id));
     }
     if ($count > 0) {
         $allSponsors = array_slice($allSponsors, 0, $count);
     }
     return $allSponsors;
 }
Beispiel #18
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);
 }
Beispiel #19
0
 public function getList()
 {
     $example = new OW_Example();
     $example->setOrder('`order` ASC');
     return $this->findListByExample($example);
 }
Beispiel #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;
 }
Beispiel #21
0
 public function findList($first, $count, $admin = false)
 {
     if ($admin === true) {
         $ex = new OW_Example();
         $ex->setOrder('joinStamp DESC')->setLimitClause($first, $count);
         return $this->findListByExample($ex);
     }
     $queryParts = $this->getUserQueryFilter("u", "id", array("method" => "BOL_UserDao::findList"));
     $query = "SELECT `u`.*\n    \t\tFROM `{$this->getTableName()}` as `u`\n    \t\t{$queryParts["join"]}\n\n            WHERE {$queryParts["where"]}\n    \t\tORDER BY " . (!empty($queryParts["order"]) ? $queryParts["order"] . ", " : "") . " `u`.`joinStamp` DESC\n    \t\tLIMIT ?,? ";
     $cacheLifeTime = 0;
     $tag = array();
     // cached latest list query
     //TODO: create cache for other pages, now cached only first page.
     if ($first == 0) {
         //TODO: Enable cache
         $cacheLifeTime = 0;
         $tag = array(self::CACHE_TAG_LATEST_LIST, self::CACHE_TAG_ALL_USER_LIST);
     }
     return $this->dbo->queryForObjectList($query, $this->getDtoClassName(), array($first, $count), $cacheLifeTime, $tag);
 }
Beispiel #22
0
 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);
 }
 public function findSortedSectionList()
 {
     $example = new OW_Example();
     $example->setOrder('sortOrder');
     return $this->findListByExample($example);
 }
Beispiel #24
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;
 }
 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);
 }
Beispiel #26
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);
 }
Beispiel #27
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);
 }
Beispiel #28
0
 /**
  *
  * @param int $userId
  * @param string $entityId
  * @return array<MAILBOX_BOL_FileUpload>
  */
 public function findUploadFileList($entityId)
 {
     if (empty($entityId)) {
         return array();
     }
     $example = new OW_Example();
     $example->andFieldEqual('entityId', $entityId);
     $example->setOrder('id');
     return $this->findListByExample($example);
 }
 public function findAll($cacheLifeTime = 0, $tags = array())
 {
     $example = new OW_Example();
     $example->setOrder('id');
     return $this->findListByExample($example, 3600 * 24, array(BOL_AuthorizationActionDao::CACHE_TAG_AUTHORIZATION, OW_CacheManager::TAG_OPTION_INSTANT_LOAD));
 }
Beispiel #30
0
 public function findPhotoListByUploadKey($uploadKey, $exclude, $status = null)
 {
     $example = new OW_Example();
     $example->andFieldEqual('uploadKey', $uploadKey);
     if ($status !== null) {
         $example->andFieldEqual('status', $status);
     }
     if ($exclude && is_array($exclude)) {
         $example->andFieldNotInArray('id', $exclude);
     }
     $example->setOrder('`id` DESC');
     return $this->findListByExample($example);
 }