public function indexAction()
 {
     $this->_helper->layout->setLayout('layout2col');
     $this->view->layout()->cols = 2;
     if ($this->_request->getParam('id') == 0 || !($this->_business = new FM_Components_Business(array('id' => $this->_request->getParam('id'))))) {
         $this->_redirect('/');
     }
     if (!$this->_business->getId()) {
         $this->_redirect('/');
     }
     if ($this->_business->getType() == 4) {
         $this->_redirect('/sports/' . $this->_request->getParam('id'));
     }
     if ($this->_business->getType() == 3) {
         $this->_redirect('/org/' . $this->_request->getParam('id'));
     }
     if (!$this->_business->getCategory()) {
         //$this->_redirect ( '/' );
     }
     //print_r($this->_business);exit;
     $this->view->orgId = $this->_request->getParam('id');
     $orgConfig = $this->_business->getOrgConfig();
     $common = $orgConfig->getTabs();
     $siteAdmin = false;
     //print_r($this->_user->getOrgId());exit;
     if ($this->_user && ($this->_user->inOrg($this->_request->getParam('id')) || $this->_user->isRoot() || $this->_user->frontEndAdmin() && !stristr($_SERVER['REQUEST_URI'], 'root'))) {
         //user is admin for this group, show edit
         $siteAdmin = true;
     }
     if (!$this->_user && !$this->_business->getActive()) {
         $this->_redirect('/');
     }
     if (!$this->_business->getActive() && !($this->_user->isRoot() || $this->_user->frontEndAdmin())) {
         $this->_redirect('/');
     }
     //print_r($this->_business->getCategories()); exit;
     $banners = FM_Components_Banner::getSortedRandomBanners($this->_business->getCategories());
     //exit;
     $this->view->layout()->banners = $this->view->partial('banner/bannerleftindex.phtml', array('banners' => $banners));
     $gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam('id'), 'photogallery', $siteAdmin);
     $this->view->layout()->leftcol = $this->view->partial('b2b/leftcol.phtml', array('orgdata' => $this->view->partial('widgets/profile/synop.phtml', array('org' => $this->_business)), 'banners' => $banners));
     $tg = new FM_Components_Tabs_TabGroup();
     $tab = new FM_Components_Tabs_Profile();
     $tab->setProfile($this->_business->get('description'));
     $tg->addTab($tab, 'profile', 'profile', true);
     if ($common['menu']) {
         $menu = new FM_Components_Tabs_Menu($this->_request->getParam('id'), $siteAdmin);
         $tg->addTab($menu, 'menu', 'mmenu', false);
     }
     if ($common['services']) {
         $services = new FM_Components_Tabs_Services($this->_request->getParam('id'));
         $tg->addTab($services, 'services', 'mservices', false);
     }
     if ($common['products']) {
         $pl = new FM_Components_Tabs_ProductList($this->_request->getParam('id'), $siteAdmin);
         $tg->addTab($pl, 'products', 'products', false);
     }
     if ($common['realestate']) {
         $rel = new FM_Components_Tabs_RealEstateList($this->_request->getParam('id'), $siteAdmin);
         $tg->addTab($rel, 'r/e listings', 'realestate', false);
     }
     if ($common['coupons']) {
         $coupons = new FM_Components_Tabs_Coupons($this->_request->getParam('id'));
         $tg->addTab($coupons, 'coupons', 'coupons', false);
         if ($this->_user) {
             $b2bcoupons = new FM_Components_Tabs_B2BCoupons($this->_request->getParam('id'));
             $tg->addTab($b2bcoupons, 'b2bcoupons', 'b2bcoupons', false);
         }
     }
     if ($common['media']) {
         $media = new FM_Components_Tabs_Media($this->_request->getParam('id'));
         $media->setProfile('This is the profile tab');
         $tg->addTab($media, 'media', 'media', false);
     }
     if ($common['events']) {
         // CALENDAR TAB!!!!
         $calendarTab = new FM_Components_Tabs_Calendar($this->_request->getParam('id'));
         $tg->addTab($calendarTab, 'events', 'calendar', false);
     }
     if ($common['reviews']) {
         $dir = new FM_Components_Tabs_Testimonials($this->_request->getParam('id'));
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'reviews', 'testimonials', false);
     }
     /**
     		if($common['forum']) {
     			$forum = new FM_Components_Tabs_Forum($this->_request->getParam ( 'id' ), $siteAdmin);
     			$tg->addTab($forum, 'forum', 'forum', false);
     		}
     		**/
     if ($common['directions']) {
         $dir = new FM_Components_Tabs_Directions($this->_business);
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'directions', 'directions', false);
     }
     if ($common['contact']) {
         $dir = new FM_Components_Tabs_Contact($this->_request->getParam('id'));
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'contact us', 'contact', false);
     }
     $this->view->video = false;
     $this->view->photo = false;
     if ($common['media']) {
         $this->view->layout()->photo = true;
         $gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam('id'), 'photogallery', $siteAdmin);
     }
     if ($common['video']) {
         $this->view->layout()->video = true;
         $videoGallery = new FM_Components_Widgets_VideoGallery($this->view, $this->_request->getParam('id'), 'videogallery', $siteAdmin);
     }
     if ($siteAdmin) {
         $adminTab = new FM_Components_Tabs_Admin();
         $admin = new FM_Components_Widgets_Admin($this->view, $this->_business->getOrgConfig(), $this->_business);
         $adminTab->setProfile($admin->toHTML());
         $tg->addTab($adminTab, 'admin', 'admin');
     }
     $this->view->layout()->profiletab = $tg->toHTML();
     $this->view->layout()->logo = $this->_business->getLogoObj()->getFileName();
     $this->view->layout()->miniwebBanner = $mw = $this->_business->getMiniWebBannerObj()->getFileName();
     $this->view->crumb = 'home >> business >> ' . $this->_business->getName();
     $this->view->content = new FM_Forms_Login();
     $this->view->coupons = $coupons = FM_Components_Coupon::getOrgCoupons($this->_request->getParam('id'));
     $this->view->pageId = 'b2b';
 }
 function indexAction()
 {
     $this->_helper->layout->setLayout('layout2col');
     $this->view->layout()->cols = 2;
     if ($this->_request->getParam('id') == 0 || !($this->_business = new FM_Components_Sports(array('id' => $this->_request->getParam('id'))))) {
         $this->_redirect('/');
     }
     //print_r($this->_business);exit;
     if (!$this->_business->getId()) {
         $this->_redirect('/');
     }
     if ($this->_business->getType() == 2) {
         $this->_redirect('/merchant/' . $this->_request->getParam('id'));
     }
     if ($this->_business->getType() == 3) {
         $this->_redirect('/org/' . $this->_request->getParam('id'));
     }
     if (!$this->_user && !$this->_business->getActive()) {
         $this->_redirect('/');
     }
     if (!$this->_business->getActive() && !($this->_user->isRoot() || $this->_user->frontEndAdmin())) {
         $this->_redirect('/');
     }
     $this->view->orgId = $this->_request->getParam('id');
     $myNamespace = new Zend_Session_Namespace('sportsuser');
     $sportsuser = false;
     if (isset($myNamespace->auth) && $myNamespace->auth == true) {
         //print_r(unserialize($myNamespace->auth));exit;
         $sportsuser = unserialize($myNamespace->auth);
         $this->view->sportsuser = unserialize($myNamespace->auth);
     }
     $orgConfig = $this->_business->getOrgConfig();
     $common = $orgConfig->getTabs();
     $siteAdmin = false;
     if ($this->_user && ($this->_user->inOrg($this->_request->getParam('id')) || $this->_user->isRoot())) {
         //user is admin for this group, show edit
         $siteAdmin = $this->_user;
     }
     $banners = FM_Components_Banner::getSortedRandomBanners();
     $this->view->layout()->banners = $this->view->partial('banner/bannerleftindex.phtml', array('banners' => $banners));
     $this->view->layout()->leftcol = $this->view->partial('b2b/leftcol.phtml', array('orgdata' => $this->view->partial('widgets/profile/synop.phtml', array('org' => $this->_business)), 'banners' => $banners));
     $tg = new FM_Components_Tabs_TabGroup();
     if ($sportsuser || !$this->_business->isProtected() || $siteAdmin) {
         $tab = new FM_Components_Tabs_Profile();
         $tab->setProfile($this->_business->get('description'));
         $tg->addTab($tab, 'profile', 'profile', true);
         $gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam('id'), 'photogallery', $siteAdmin);
         $media = new FM_Components_Tabs_Media($this->_request->getParam('id'), true);
         $media->setProfile('This is the profile tab');
         $tg->addTab($media, 'media', 'media', false);
         $calendarTab = new FM_Components_Tabs_Calendar($this->_request->getParam('id'));
         $tg->addTab($calendarTab, 'events', 'calendar', false);
         if ($common['forum']) {
             $forum = new FM_Components_Tabs_Forum($this->_request->getParam('id'), $siteAdmin, $sportsuser);
             $tg->addTab($forum, 'forum', 'forum', false);
         }
         if ($common['directions']) {
             $dir = new FM_Components_Tabs_Directions($this->_business);
             $dir->setProfile('these are directions');
             $tg->addTab($dir, 'directions', 'directions', false);
         }
         $spsch = new FM_Components_Tabs_SportsSchedule($this->_business);
         $tg->addTab($spsch, 'schedule', 'schedule', false);
         if ($common['contact']) {
             $dir = new FM_Components_Tabs_Contact($this->_request->getParam('id'));
             $dir->setProfile('these are directions');
             $tg->addTab($dir, 'contact us', 'contact', false);
         }
         $this->view->video = false;
         $this->view->photo = false;
         if ($common['media']) {
             $this->view->layout()->photo = true;
             $gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam('id'), 'photogallery', $siteAdmin);
         }
         if ($common['video']) {
             $this->view->layout()->video = true;
             $videoGallery = new FM_Components_Widgets_VideoGallery($this->view, $this->_request->getParam('id'), 'videogallery', $siteAdmin);
         }
     }
     if (!$sportsuser) {
         $signIn = new FM_Components_Tabs_SportsSignIn($this->_request->getParam('id'), $this->_business->isProtected() && !$this->_user);
         $tg->addTab($signIn, 'signin', 'signin', $this->_business->isProtected() && !$this->_user);
     }
     if ($siteAdmin) {
         $adminTab = new FM_Components_Tabs_Admin();
         $admin = new FM_Components_Widgets_Admin($this->view, $this->_business->getOrgConfig(), $this->_business);
         $adminTab->setProfile($admin->toHTML());
         $tg->addTab($adminTab, 'admin', 'admin');
     }
     $this->view->layout()->profiletab = $tg->toHTML();
     $this->view->crumb = 'home >> sports >> ' . $this->_business->getName();
     $this->view->content = new FM_Forms_Login();
     $this->view->layout()->logo = $this->_business->getLogoObj()->getFileName();
     $this->view->layout()->miniwebBanner = $mw = $this->_business->getMiniWebBannerObj()->getFileName();
     $this->view->coupons = $coupons = FM_Components_Coupon::getOrgCoupons($this->_request->getParam('id'));
     $this->view->pageId = 'sports';
 }
 function indexAction()
 {
     $this->_helper->layout->setLayout('layout2col');
     $this->view->layout()->cols = 2;
     if ($this->_request->getParam('id') == 0 || !($org = new FM_Components_Organization(array('id' => $this->_request->getParam('id'))))) {
         $this->_redirect('/');
     }
     if ($org->getType() == 2) {
         $this->_redirect('/merchant/' . $this->_request->getParam('id'));
     }
     if ($org->getType() == 4) {
         $this->_redirect('/sports/' . $this->_request->getParam('id'));
     }
     if (!$this->_user && !$org->getActive()) {
         $this->_redirect('/');
     }
     if (!$org->getActive() && !($this->_user->isRoot() || $this->_user->frontEndAdmin())) {
         $this->_redirect('/');
     }
     $this->view->orgId = $this->_request->getParam('id');
     $orgConfig = $org->getOrgConfig();
     $siteAdmin = false;
     if ($this->_user && ($this->_user->inOrg($this->_request->getParam('id')) || $this->_user->isRoot())) {
         //user is admin for this group, show edit
         $siteAdmin = $this->_user;
     }
     //$gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam ( 'id' ), 'photogallery', $siteAdmin);
     $banners = FM_Components_Banner::getSortedRandomBanners(array(), 3);
     $this->view->layout()->banners = $this->view->partial('banner/bannerleftindex.phtml', array('banners' => $banners));
     $this->view->layout()->leftcol = $this->view->partial('orgs/leftcol.phtml', array('orgdata' => $this->view->partial('widgets/profile/synop.phtml', array('org' => $org)), 'banners' => $banners));
     $tg = new FM_Components_Tabs_TabGroup();
     $org = new FM_Components_Organization(array('id' => $this->_request->getParam('id')));
     $tab = new FM_Components_Tabs_Profile();
     $tab->setProfile($org->get('description'));
     $tg->addTab($tab, 'profile', 'profile', true);
     $common = $orgConfig->getTabs();
     //print_r($common);exit;
     if ($common['services']) {
         $services = new FM_Components_Tabs_Services($this->_request->getParam('id'));
         $tg->addTab($services, 'services', 'mservices', false);
     }
     if ($common['products']) {
         $pl = new FM_Components_Tabs_ProductList($this->_request->getParam('id'), $siteAdmin);
         $tg->addTab($pl, 'products', 'products', false);
     }
     if ($common['media'] || $common['video']) {
         $media = new FM_Components_Tabs_Media($this->_request->getParam('id'));
         $media->setProfile('This is the profile tab');
         $tg->addTab($media, 'media', 'media', false);
     }
     /**
     		if($common['video']) {
     			$media = new FM_Components_Tabs_Media($this->_request->getParam ( 'id' ));
     			$media->setProfile('This is the profile tab');
     			$tg->addTab($media, 'media', 'media', false);
     		}
     		**/
     if ($common['events']) {
         // CALENDAR TAB!!!!
         $calendarTab = new FM_Components_Tabs_Calendar($this->_request->getParam('id'));
         $tg->addTab($calendarTab, 'events', 'calendar', false);
     }
     if ($common['reviews']) {
         $dir = new FM_Components_Tabs_Testimonials($this->_request->getParam('id'));
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'reviews', 'testimonials', false);
     }
     if ($common['forum']) {
         $forum = new FM_Components_Tabs_Forum($this->_request->getParam('id'), $siteAdmin);
         $tg->addTab($forum, 'forum', 'forum', false);
     }
     if ($common['directions']) {
         $dir = new FM_Components_Tabs_Directions($org);
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'directions', 'directions', false);
     }
     if ($common['contact']) {
         $dir = new FM_Components_Tabs_Contact($this->_request->getParam('id'));
         $dir->setProfile('these are directions');
         $tg->addTab($dir, 'contact us', 'contact', false);
     }
     $this->view->video = false;
     $this->view->photo = false;
     if ($common['media']) {
         $this->view->layout()->photo = true;
         $gallery = new FM_Components_Widgets_PhotoGallery($this->view, $this->_request->getParam('id'), 'photogallery', $siteAdmin);
     }
     if ($common['video']) {
         $this->view->layout()->video = true;
         $videoGallery = new FM_Components_Widgets_VideoGallery($this->view, $this->_request->getParam('id'), 'videogallery', $siteAdmin);
     }
     //$tg->addTab($videoGallery , 'videogallery', 'videogallery', false);
     //print_r($videoGallery);exit;
     /**
     		if($common['testimonials']) {
     			$dir = new FM_Components_Tabs_Testimonials($this->_request->getParam ( 'id' ));
     			$dir->setProfile('these are directions');
     			$tg->addTab($dir, 'testimonials', 'testimonials', false);
     		}
     		**/
     if ($siteAdmin) {
         $adminTab = new FM_Components_Tabs_Admin();
         $admin = new FM_Components_Widgets_Admin($this->view, $orgConfig, $org);
         $adminTab->setProfile($admin->toHTML());
         $tg->addTab($adminTab, 'admin', 'admin');
     }
     $this->view->layout()->logo = $org->getLogoObj()->getFileName();
     $this->view->layout()->miniwebBanner = $mw = $org->getMiniWebBannerObj()->getFileName();
     $this->view->layout()->profiletab = $tg->toHTML();
     $this->view->layout()->comments = $this->view->partial('widgets/askus/contact.phtml');
     $this->view->pageId = 'orgs';
 }