public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function getAllItemCategories($page, $limit) { $first = ($page - 1) * $limit; $categoryDao = EVENTX_BOL_CategoryDao::getInstance(); $fileDao = EVENTX_BOL_EventDao::getInstance(); $query = "\n SELECT a.categoryId, b.name, b.description, count( * ) count\n FROM " . $this->getTableName() . " AS a," . $categoryDao->getTableName() . " AS b," . $fileDao->getTableName() . " AS c " . "WHERE a.categoryId = b.id\n AND c.id = a.eventId\n AND c.status = 'approved' \n GROUP BY a.categoryId\n ORDER BY count DESC\n LIMIT ?, ?\n "; return $this->dbo->queryForList($query, array($first, $limit)); }
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); }