public function findEvents($past, $kw, $userId, $limit = null) { $eventDao = EVENT_BOL_EventDao::getInstance(); $eventUserDao = EVENT_BOL_EventUserDao::getInstance(); $params = array('startTime' => time(), 'endTime' => time(), 'u' => $userId, 's' => EVENT_BOL_EventUserDao::VALUE_STATUS_YES); if (!empty($kw)) { $params["kw"] = "%" . $kw . "%"; } $limitStr = $limit === null ? '' : 'LIMIT 0, ' . intval($limit); $kwWhere = empty($kw) ? "1" : "e.title LIKE :kw"; $order = "e.`startTimeStamp` " . ($past ? "DESC" : ""); $query = "SELECT e.* FROM `" . $eventDao->getTableName() . "` e \n INNER JOIN " . $eventUserDao->getTableName() . " u ON u.eventId=e.id AND u.status=:s\n WHERE u.userId!=:u AND e.userId=:u AND " . $this->getTimeClause($past, "e") . " AND " . $kwWhere . "\n ORDER BY {$order} {$limitStr}"; return OW::getDbo()->queryForObjectList($query, $eventDao->getDtoClassName(), $params); }
/** * Constructor. */ private function __construct() { $this->eventDao = EVENT_BOL_EventDao::getInstance(); $this->eventUserDao = EVENT_BOL_EventUserDao::getInstance(); $this->eventInviteDao = EVENT_BOL_EventInviteDao::getInstance(); $this->configs[self::CONF_EVENT_USERS_COUNT] = 10; $this->configs[self::CONF_EVENTS_COUNT_ON_PAGE] = 15; $this->configs[self::CONF_DASH_WIDGET_EVENTS_COUNT] = 3; $this->configs[self::CONF_WIDGET_EVENTS_COUNT] = 3; $this->configs[self::CONF_EVENT_USERS_COUNT_ON_PAGE] = 30; $this->configs[self::CONF_WIDGET_EVENTS_COUNT_OPTION_LIST] = array(3 => 3, 5 => 5, 10 => 10, 15 => 15, 20 => 20); }
/** * @param integer $eventId */ public function findUserListForInvite($eventId, $first, $count, $friendList = null) { $userDao = BOL_UserDao::getInstance(); $eventDao = EVENT_BOL_EventDao::getInstance(); $eventUserDao = EVENT_BOL_EventUserDao::getInstance(); $where = ""; if (isset($friendList) && empty($friendList)) { return array(); } else { if (!empty($friendList)) { $where = " AND `u`.id IN ( " . $this->dbo->mergeInClause($friendList) . " ) "; } } $queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("u", "id", array("method" => "EVENT_BOL_EventUserDao::findUserListForInvite")); $query = "SELECT `u`.`id`\r\n \t\tFROM `{$userDao->getTableName()}` as `u`\r\n " . $queryParts['join'] . "\r\n \r\n LEFT JOIN `" . $eventDao->getTableName() . "` as `e`\r\n \t\t\tON( `u`.`id` = `e`.`userId` AND e.id = :event )\r\n \r\n LEFT JOIN `" . $this->getTableName() . "` as `ei`\r\n \t\t\tON( `u`.`id` = `ei`.`userId` AND `ei`.eventId = :event )\r\n\r\n LEFT JOIN `" . $eventUserDao->getTableName() . "` as `eu`\r\n \t\t\tON( `u`.`id` = `eu`.`userId` AND `eu`.eventId = :event )\r\n\r\n \t\tWHERE " . $queryParts['where'] . " AND `e`.`id` IS NULL AND `ei`.`id` IS NULL AND `eu`.`id` IS NULL " . $where . "\r\n \t\tORDER BY `u`.`activityStamp` DESC\r\n \t\tLIMIT :first, :count "; return $this->dbo->queryForColumnList($query, array('event' => $eventId, 'first' => $first, 'count' => $count)); }
/** * @param integer $userId * @param integer $status * @return integer */ public function findPublicUserEventsCountWithStatus($userId, $status) { $query = "SELECT COUNT(*) AS `count` FROM `" . $this->getTableName() . "` AS `e`\n LEFT JOIN `" . EVENT_BOL_EventUserDao::getInstance()->getTableName() . "` AS `eu` ON (`e`.`id` = `eu`.`eventId`)\n WHERE `eu`.`userId` = :userId AND `eu`.`" . EVENT_BOL_EventUserDao::STATUS . "` = :status AND " . $this->getTimeClause(false, 'e') . " AND `e`.`" . self::WHO_CAN_VIEW . "` = " . self::VALUE_WHO_CAN_VIEW_ANYBODY . ""; return (int) $this->dbo->queryForColumn($query, array('userId' => $userId, 'status' => $status, 'startTime' => time(), 'endTime' => time())); }