/** * Returns an instance of class (singleton pattern implementation). * * @return EQUESTIONS_CLASS_PhotoBridge */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
private function getMyPhotos($query) { $userId = OW::getUser()->getId(); $bridge = EQUESTIONS_CLASS_PhotoBridge::getInstance(); if (!$bridge->isActive()) { return false; } $count = $query['offset'] == 0 ? 25 : 10; $photos = $bridge->findUserPhotos($userId, $query['offset'], $count + 6); $viewMore = count($photos) - $count > 5; if ($viewMore) { $photos = array_slice($photos, 0, $count); } $cmp = new EQUESTIONS_CMP_MyPhotos($photos); return array('myPanel' => array('html' => $cmp->render(), 'viewMore' => $viewMore, 'offset' => $query['offset'] + count($photos), 'itemsCount' => count($photos))); }