Beispiel #1
0
 public function deleteByGroupId($groupId, $status = GHEADER_BOL_Cover::STATUS_ACTIVE)
 {
     $example = new OW_Example();
     $example->andFieldEqual('groupId', $groupId);
     $example->andFieldEqual('status', $status);
     return $this->deleteByExample($example);
 }
 public function findByGenderAndAccountType($accountType, $gender)
 {
     $example = new OW_Example();
     $example->andFieldEqual(self::ACCOUNT_TYPE, $accountType);
     $example->andFieldEqual(self::GENDER_VALUE, $gender);
     return $this->findObjectByExample($example);
 }
 /**
  *
  * @param int $placeId
  * @param int $entityId
  * @return BOL_PlaceScheme
  */
 public function findPlaceScheme($placeId, $entityId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('placeId', $placeId);
     $example->andFieldEqual('entityId', $entityId);
     return $this->findObjectByExample($example);
 }
Beispiel #4
0
 public function deleteActivity($questionId, $activityType, $activityId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('questionId', $questionId);
     $example->andFieldEqual('activityType', $activityType);
     $example->andFieldEqual('activityId', $activityId);
     return $this->deleteByExample($example);
 }
Beispiel #5
0
 public function findUsersetting($userId, $key)
 {
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     if (!empty($key)) {
         $example->andFieldEqual('key', $key);
     }
     return $this->findObjectByExample($example);
 }
Beispiel #6
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 #7
0
 /**
  * find User Token
  *
  * @param array $params
  * @return YNSOCIALBRIDGE_BOL_Token
  */
 public function findUserToken($params = array())
 {
     if (!$params) {
         return null;
     }
     $example = new OW_Example();
     $example->andFieldEqual('service', $params['service']);
     $example->andFieldEqual('userId', $params['userId']);
     return $this->findObjectByExample($example);
 }
Beispiel #8
0
 public function deleteDataItem($entityTypeId, $entityId)
 {
     if (empty($entityTypeId) || empty($entityId)) {
         return FALSE;
     }
     $example = new OW_Example();
     $example->andFieldEqual(self::ENTITY_TYPE_ID, $entityTypeId);
     $example->andFieldEqual(self::ENTITY_ID, $entityId);
     return $this->deleteByExample($example);
 }
Beispiel #9
0
 public function unmark($userId, $markUserId)
 {
     if (empty($userId) || empty($markUserId)) {
         return NULL;
     }
     $example = new OW_Example();
     $example->andFieldEqual(self::USER_ID, $userId);
     $example->andFieldEqual(self::MARK_USER_ID, $markUserId);
     return $this->deleteByExample($example);
 }
Beispiel #10
0
 /**
  * find User Statistic
  *
  * @param array $params
  * @return YNSOCIALBRIDGE_BOL_Statistic
  */
 public function getTotalInviteOfDay($params = array())
 {
     if (!$params) {
         return null;
     }
     $example = new OW_Example();
     $example->andFieldEqual('uid', $params['uid']);
     $example->andFieldEqual('date', $params['date']);
     $example->andFieldEqual('service', $params['service']);
     return $this->findObjectByExample($example);
 }
Beispiel #11
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 #12
0
 public function findListByCategoryId($id)
 {
     $example = new OW_Example();
     $example->andFieldEqual('categoryId', $id);
     $example->setOrder('`order` ASC');
     return $this->findListByExample($example);
 }
Beispiel #13
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);
 }
Beispiel #14
0
 public function sendExpiryEmail()
 {
     $config = OW::getConfig();
     $subject = OW::getLanguage()->text('sponsors', 'reminder_subject');
     $content = OW::getLanguage()->text('sponsors', 'reminder_content');
     $sitemail = $config->getValue('base', 'site_email');
     $sitename = $config->getValue('base', 'site_name');
     $mails = array();
     $example = new OW_Example();
     $example->andFieldEqual('status', 1);
     $example->andFieldGreaterThan('price', 0);
     $sponsors = $this->dao->findListByExample($example);
     foreach ($sponsors as $sponsor) {
         $cutoffDay = $sponsor->validity - (int) OW::getConfig()->getValue('sponsors', 'cutoffDay');
         if ((time() - $sponsor->timestamp) / 86400 > $cutoffDay && $cutoffDay > 0) {
             $mail = OW::getMailer()->createMail();
             $mail->addRecipientEmail($sponsor->email);
             $mail->setSender($sitemail, $sitename);
             $mail->setSubject($subject);
             $mail->setHtmlContent($content);
             $textContent = strip_tags(preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $content));
             $mail->setTextContent($textContent);
             $mails[] = $mail;
         }
     }
     if (count($mails) > 0) {
         OW::getMailer()->addListToQueue($mails);
     }
 }
Beispiel #15
0
 public function findByGroup($groupId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('groupId', $groupId);
     $example->setOrder('timestamp DESC');
     return $this->findListByExample($example);
 }
Beispiel #16
0
 public function findBySectionName($sectionName)
 {
     if ($sectionName === null || mb_strlen($sectionName) === 0) {
         return null;
     }
     $example = new OW_Example();
     $example->andFieldEqual('name', $sectionName);
     return $this->findObjectByExample($example);
 }
Beispiel #17
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 #18
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 #19
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 #20
0
 /**
  * get Config
  *
  * @param string $name
  * @return YNSOCIALBRIDGE_BOL_Apisetting
  */
 public function getConfig($name)
 {
     if (!$name) {
         return null;
     }
     $example = new OW_Example();
     $example->andFieldEqual('apiName', $name);
     return $this->findObjectByExample($example);
 }
Beispiel #21
0
 public function markUnfeatured($videoId)
 {
     if (!$videoId) {
         return false;
     }
     $example = new OW_Example();
     $example->andFieldEqual('videoId', $videoId);
     $this->deleteByExample($example);
     return true;
 }
Beispiel #22
0
 public function isDuplicate($category)
 {
     $example = new OW_Example();
     $example->andFieldEqual('name', $category);
     if (count($this->findObjectByExample($example)) > 0) {
         return true;
     } else {
         return false;
     }
 }
 public function deleteByUserId($userId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('userId', $userId);
     $this->deleteByExample($example);
     $example = new OW_Example();
     $example->andFieldEqual('oppUserId', $userId);
     $this->deleteByExample($example);
     return true;
 }
Beispiel #24
0
 /**
  * Finds user avatar by userId
  *
  * @param int $userId
  * @return BOL_Avatar
  */
 public function findByUserId($userId)
 {
     $userId = intval($userId);
     if (empty($this->cachedItems[$userId])) {
         $example = new OW_Example();
         $example->andFieldEqual('userId', $userId);
         $example->setLimitClause(0, 1);
         $this->cachedItems[$userId] = $this->findObjectByExample($example);
     }
     return $this->cachedItems[$userId];
 }
Beispiel #25
0
 public function getItemCategoryId($eventId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('eventId', $eventId);
     $categories = $this->findListByExample($example);
     if (count($categories) > 0) {
         return $categories;
     } else {
         return false;
     }
 }
Beispiel #26
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);
 }
Beispiel #27
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 #28
0
 public function getVideoCategories($videoId)
 {
     $example = new OW_Example();
     $example->andFieldEqual('videoId', $videoId);
     $categories = $this->findListByExample($example);
     $list = array();
     foreach ($categories as $category) {
         $list[] = IVIDEO_BOL_CategoryService::getInstance()->getCategoryName($category->categoryId);
     }
     if (count($list) > 0) {
         return $list;
     } else {
         return false;
     }
 }
Beispiel #29
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;
 }
Beispiel #30
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;
 }