function getEvents($all = false) { if (!$all) { if (isset($this->params['select']) && $this->params['select'] == 'self') { // выбрали "только свои записи" на "моей стене" $wall = MongoDatabase::getUserWall((int) $this->user_id, 0, 10, 'self'); }else $wall = MongoDatabase::getUserWall((int) $this->user_id, 0, 10, $this->type); }else { // показываем просто последнюю активность $wall = MongoDatabase::getLastWall(); } $events = MongoDatabase::getWallEvents($wall); $this->data = $this->_list($events); }
function getEvents($all = false) { $cond = new Conditions(); $per_page = 0; if (isset($this->params['per_page'])) { $per_page = (int) $this->params['per_page']; } $per_page = $per_page > 0 ? $per_page : self::PER_PAGE; $pagingName = isset($this->params['paging_parameter_name']) ? $this->params['paging_parameter_name'] : 'p'; if (!$all) { $cond->setPaging(self::MAX_EVENTS_ON_USER_WALL, $per_page, $pagingName); $limit = $cond->getMongoLimit(); if (isset($this->params['select']) && $this->params['select'] == 'self') { // выбрали "только свои записи" на "моей стене" $wall = MongoDatabase::getUserWall((int) $this->user_id, $limit, $per_page, 'self'); } else { $wall = MongoDatabase::getUserWall((int) $this->user_id, $limit, $per_page, $this->type); } } else { $cond->setPaging(self::MAX_EVENTS_ON_WALL, $per_page, $pagingName); $limit = $cond->getMongoLimit(); // показываем просто последнюю активность $events = MongoDatabase::getWallLastEvents($per_page, $limit); $this->_list($events); return; } $events = MongoDatabase::getWallEvents($wall); $this->_list($events); }