====== Birthdays: Separate page ====== Here we create a separate page with upcoming birthdays of site users. **Objective** * Add "Birthdays" list to "Members" page {{:dev-tuts:birthdays_page.png|}} **Implementation - Server Side (PHP)** birthdays/init.php // class that contains all data and functionality to add new type of members listing class BIRTHDAYS_UsersPageData implements BASE_CLASS_IusersPageData { //set menu item for "Birthdays" page public function getMenuItem() { //$language - helps our site to be multilingual $language = OW::getLanguage(); //initializing menu item $item = new BASE_MenuItem(); $item->setLabel($language->text('base', 'user_list_menu_item_birthdays')) ->setKey('birthdays') ->setUrl(OW::getRouter() ->urlForRoute('birthdays_users')) ->setOrder(5) ->setIconClass('ow_ic_calendar'); if ( $this->isCase() ) { $item->setActive(true); // activate menu if "Birthdays" selected } return $item; } // check if URL is belong to "Birthdays" page public function isCase() { return false !== strstr(OW::getRequest()->getRequestUri(), OW::getRouter()->uriForRoute('birthdays_users')); } // "Birthdays" page's unique key public function getCase() { return 'birthdays'; } // get data for "Birthdays" user listing public function getData( $first, $count ) { $service = BOL_UserService::getInstance(); //set date bounds for birthdays $period = array( 'start' => date('Y-m-d'), 'end' => date('Y-m-d', strtotime('+7 day')) ); return array( $service->findListByBirthdayPeriod($period['start'], $period['end'], $first, $count), // get users $service->countByBirthdayPeriod($start, $end) // count users ); } } // register data for "Birthdays" page. OW::getRegistry()->addToArray('users_page_data', new BIRTHDAYS_UsersPageData());