public function managecategoriesorgAction() { $this->view->sidenav = $this->view->partial('root/parts/sidenavs/cats.phtml', array('selected' => 'np')); $this->view->roots = FM_Components_Util_Category::getRootCategories(true); $this->view->sorted = FM_Components_Util_Category::getSortedSearchCategories(true); $this->view->cat = true; if ($this->_request->isPost()) { $this->view->success = false; if (array_key_exists('delete', $_POST) && $_POST['delete'] == 1) { if (FM_Components_Util_Category::deleteCategory(array('id' => $_POST['deleteCat']), true)) { $this->view->success = true; } } else { if (array_key_exists('edit', $_POST) && $_POST['edit'] == 1 && $_POST['name'] != '') { if (FM_Components_Util_Category::editCategory(array('id' => $_POST['editCat']), array('name' => $_POST['name']), true)) { $this->view->success = true; } } else { $formData = $this->_request->getPost(); if (FM_Components_Util_Category::insertCategory($formData, true)) { $this->view->success = true; } } } $this->_redirect('/root/managecategoriesorg'); } }
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; }