function orgsAction() { $this->view->results = null; if ($_POST || $_GET && array_key_exists('all', $_GET)) { //print_r($_POST);exit; $search = FM_Components_Search::getInstance(); $search->setType(3); if ($_POST) { foreach ($_POST as $key => $value) { if (stristr($key, 'region')) { $regionId = explode('_', $key); $search->addRegion($regionId[2]); continue; } if (stristr($key, 'all')) { $regionId = explode('_', $key); $all[] = $regionId[2]; continue; } if (stristr($key, 'town')) { $townId = explode('_', $key); if ($townId[2] != 0) { $search->addTown($townId[2]); } continue; } if (stristr($key, 'category')) { $categoryId = explode('_', $key); if ($categoryId[2] != 0) { $search->addCategory($categoryId[2]); } continue; } if ($key == 'keyword') { $search->setKeywords(explode(',', $value)); continue; } if ($key == 'zip') { $search->setZipcode($value); } } } $results = $search->doNpSearch(); $objs = array(); if ($resultsTotal = count($results)) { //print_r($results); foreach ($results as $index => $values) { switch ($values['type']) { case 3: $obj = $values; $icon = new FM_Components_Util_Icon(array('orgId' => $values['id'])); $obj['icon'] = $icon->getFileName(); $objs[] = $obj; break; case 4: $obj = $values; $icon = new FM_Components_Util_Icon(array('orgId' => $values['id'])); $obj['icon'] = $icon->getFileName(); $obj['type'] = 4; $objs[] = $obj; break; } } $banners = FM_Components_Banner::getSortedRandomBanners(); $banners = $this->view->partial('banner/bannerleftindex.phtml', array('banners' => $banners)); $this->view->results = $this->view->partial('search/results.phtml', array('clients' => $objs, 'total' => $resultsTotal, 'banners' => $banners, 'type' => 'org')); } else { $this->view->noResults = true; } } $this->_helper->layout->setLayout('singlecolumn'); $this->view->layout()->cols = 1; $this->view->cats = $this->view->partial('search/categories.phtml', array('cats' => FM_Components_Util_Category::getSortedSearchCategories(true))); $this->view->towns = $this->view->partial('search/towns.phtml', array('towns' => FM_Components_Util_Town::getAll())); $this->view->orgsearch = true; }
public function ajaxgetsubcatsAction() { if ($_POST['id']) { if ($cat = new FM_Components_Util_Category(array('id' => $_POST['id']))) { if ($_POST['orgId']) { print Zend_Json::encode(array('subs' => $cat->getSubcats(false, $_POST['orgId']))); } else { print Zend_Json::encode(array('subs' => $cat->getSubcats())); } exit; } else { print Zend_Json::encode(array('subs' => array())); exit; } } }
public function limecardAction() { $this->view->form = new FM_Forms_LimeCard(); $this->view->regionsForm = new FM_Forms_LimeCardRegion(); $this->view->results = false; if ($this->_getParam('var') === '0') { $this->view->searchTerm = 'ALL'; $orgs = FM_Components_Util_LimeCard::alphaSearch(''); //print_r($orgs); $this->view->selected = '0'; $this->view->results = $final = FM_Components_Util_LimeCard::sort($orgs, 'name'); } elseif ($this->_getParam('do') == 'alph') { $this->view->searchTerm = $this->_getParam('var'); $orgs = FM_Components_Util_LimeCard::alphaSearch($this->_getParam('var')); $this->view->selected = $this->_getParam('var'); $this->view->results = $final = FM_Components_Util_LimeCard::sort($orgs, 'name'); } elseif ($this->_getParam('do') == 'cat') { $orgs = FM_Components_Util_LimeCard::catSearch($this->_getParam('var')); $this->view->results = $final = FM_Components_Util_LimeCard::sort($orgs, 'name'); $this->view->searchTerm = ucwords(strtolower(FM_Components_Util_Category::getCategoryName($this->_getParam('var'), false))); } elseif ($this->_getParam('do') == 'region') { $orgs = FM_Components_Util_LimeCard::regionSearch($this->_getParam('var')); $this->view->results = $final = FM_Components_Util_LimeCard::sort($orgs, 'name'); $region = new FM_Components_Util_Region(array('id' => $this->_getParam('var'))); $this->view->searchTerm = ucwords(strtolower($region->getName())); if ($this->_getParam('var') == 25) { $this->view->searchTerm = 'Staten Island'; } if ($this->_getParam('var') == 26) { $this->view->searchTerm = 'Ocean County'; } } else { if ($_POST['limecardsearch']) { $this->view->searchTerm = $_POST['limecardsearch']; $bzOrgsModel = new FM_Models_FM_SearchPrimaryCategories(); $npOrgsModel = new FM_Models_FM_SearchPrimaryCategoriesOrgs(); $bzResults = $bzOrgsModel->searchByCat($_POST['limecardsearch']); $npResults = $npOrgsModel->searchByCat($_POST['limecardsearch']); $orgIds = array(); foreach (array_merge($bzResults, $npResults) as $key => $value) { $orgIds[] = $value['orgId']; } $orgDataModel = new FM_Models_FM_Orgdata(); $orgs = $orgDataModel->limecardSearch(array_values($orgIds), $_POST['limecardsearch']); $orgDataModel->alphabeticalSearch(); $nonOrgs = FM_Components_Util_LimeCard::search($_POST['limecardsearch']); $this->view->results = $final = FM_Components_Util_LimeCard::sort(array_merge($orgs, $nonOrgs), 'name'); } } }