public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
private function __construct() { $this->eventDao = EVENTX_BOL_EventDao::getInstance(); $this->eventUserDao = EVENTX_BOL_EventUserDao::getInstance(); $this->eventInviteDao = EVENTX_BOL_EventInviteDao::getInstance(); $this->categoryDao = EVENTX_BOL_CategoryDao::getInstance(); $this->eventCategoryDao = EVENTX_BOL_EventCategoryDao::getInstance(); $this->configs[self::CONF_EVENTX_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_EVENTX_USERS_COUNT_ON_PAGE] = OW::getConfig()->getValue('eventx', 'resultsPerPage'); $this->configs[self::CONF_WIDGET_EVENTS_COUNT_OPTION_LIST] = array(3 => 3, 5 => 5, 10 => 10, 15 => 15, 20 => 20); }
public function findUserListForInvite($eventId, $first, $count, $friendList = null) { $userDao = BOL_UserDao::getInstance(); $eventDao = EVENTX_BOL_EventDao::getInstance(); $eventUserDao = EVENTX_BOL_EventUserDao::getInstance(); $where = ""; if (isset($friendList) && empty($friendList)) { return array(); } else { if (!empty($friendList)) { $where = " AND `u`.id IN ( " . $this->dbo->mergeInClause($friendList) . " ) "; } } $query = "SELECT `u`.`id`\n \t\tFROM `{$userDao->getTableName()}` as `u`\n LEFT JOIN `" . $eventDao->getTableName() . "` as `e`\n \t\t\tON( `u`.`id` = `e`.`userId` AND e.id = :event )\n LEFT JOIN `" . $this->getTableName() . "` as `ei`\n \t\t\tON( `u`.`id` = `ei`.`userId` AND `ei`.eventId = :event )\n\n LEFT JOIN `" . $eventUserDao->getTableName() . "` as `eu`\n \t\t\tON( `u`.`id` = `eu`.`userId` AND `eu`.eventId = :event )\n\n \t\tLEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n \t\t\tON( `u`.`id` = `s`.`userId` )\n\n \t\tLEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n \t\t\tON( `u`.`id` = `d`.`userId` )\n\n \t\tWHERE `e`.`id` IS NULL AND `ei`.`id` IS NULL AND `s`.`id` IS NULL AND `d`.`id` IS NULL AND `eu`.`id` IS NULL " . $where . "\n \t\tORDER BY `u`.`activityStamp` DESC\n \t\tLIMIT :first, :count "; return $this->dbo->queryForColumnList($query, array('event' => $eventId, 'first' => $first, 'count' => $count)); }
public function findPublicUserEventsCountWithStatus($userId, $status) { $query = "SELECT COUNT(*) AS `count` FROM `" . $this->getTableName() . "` AS `e`\n LEFT JOIN `" . EVENTX_BOL_EventUserDao::getInstance()->getTableName() . "` AS `eu` ON (`e`.`id` = `eu`.`eventId`)\n WHERE `eu`.`userId` = :userId AND e.status='approved' AND `eu`.`" . EVENTX_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())); }