コード例 #1
0
 public function __construct($view, $orgConfig, $orgObj)
 {
     //print_r($orgObj);exit;
     $this->_view = $view;
     $this->orgConfig = $orgConfig;
     $this->orgObj = $orgObj;
     $testimonialTable = new FM_Models_FM_Testimonials();
     $this->testimonials = $testimonialTable->getTestimonialsByKeys(array('orgId' => $this->orgConfig->getOrgId()));
     //print_r($this->testimonials);exit;
     $this->couponTemplates = FM_Components_Util_CouponTemplate::getActive();
     $this->coupons = FM_Components_Coupon::getAllOrgCoupons($this->orgConfig->getOrgId());
     $this->bannerTemplates = FM_Components_Util_BannerTemplate::getActive();
     $this->banners = FM_Components_Banner::getOrgBanners($this->orgConfig->getOrgId());
     $this->sportsusers = FM_Components_SportsUser::getAll($this->orgConfig->getOrgId());
     $this->sportsemails = FM_Components_Util_Email::getAll($this->orgConfig->getOrgId());
     $sm = new FM_Models_FM_Services();
     $this->services = $sm->getServiceByKeys(array('orgId' => $this->orgConfig->getOrgId()));
     $mm = new FM_Models_FM_Menu();
     $this->menu = $mm->getMenuByKeys(array('orgId' => $this->orgConfig->getOrgId()));
     $ss = new FM_Models_FM_SportsSchedule();
     $this->schedule = $ss->getScheduleByKeys(array('orgId' => $this->orgConfig->getOrgId()));
     $this->textAds = FM_Components_Util_TextAd::getOrgAds($this->orgConfig->getOrgId());
     $this->icon = FM_Components_Util_Icon::getOrgActive($this->orgConfig->getOrgId());
     $view->headScript()->appendFile('/js/widgets/coupon.js', 'text/javascript');
     //$view->headScript()->appendFile(
     //'/js/widgets/admin.js',
     //'text/javascript'
     //);
     $view->headScript()->appendFile('/js/widgets/banner.js', 'text/javascript');
     //$view->headScript()->appendFile(
     //'/js/swfupload/swfupload.js',
     //'text/javascript'
     //);
     $this->_view->headScript()->appendFile('/js/tiny_mce/tiny_mce.js', 'text/javascript');
     //$view->headScript()->appendFile(
     //'/js/widgets/photogallery.js',
     //'text/javascript'
     //);
 }
コード例 #2
0
 public function ajaxuploadtopbannerAction()
 {
     //print_r($_FILES);exit;
     $name = $_FILES['Filedata']['name'] = '1' . '_' . time() . str_ireplace(array(' ', '_', '-', ','), '', strtolower($_FILES['Filedata']['name']));
     $_FILES['Filedata']['type'] = 'image';
     $fileHandler = new FM_Components_Util_UploadHandler($_FILES['Filedata']);
     $mediaFolder = $_POST['type'] == 'icon' ? 'icons' : 'logos';
     $folder = $fileHandler->setFolder($mediaFolder);
     if ($fileHandler->move()) {
         list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'] . $folder . '/' . $name);
         //if($width > $_POST['width'] || $height > $_POST['height']) {
         //	print '0';
         //	exit;
         //}
         $insertData['fileName'] = $name;
         $insertData['width'] = $width;
         $insertData['height'] = $height;
         $insertData['type'] = 'LG';
         $insertData['active'] = '1';
         //$insertData['orgId'] = $id;
         $returns = array('src' => $folder . '/' . $name, 'height' => $height, 'width' => $width);
         print Zend_Json::encode($returns);
         if ($_POST['type'] == 'left') {
             $banner = new FM_Components_Util_Logo(array('orgId' => $_POST['orgId']));
             if (trim($banner->getId()) != '') {
                 FM_Components_Util_Logo::updateBanner(array('orgId' => $_POST['orgId']), $insertData);
             } else {
                 $insertData['orgId'] = $_POST['orgId'];
                 FM_Components_Util_Logo::insert($insertData);
             }
         }
         if ($_POST['type'] == 'right') {
             $banner = new FM_Components_Util_MiniwebBanner(array('orgId' => $_POST['orgId']));
             if (trim($banner->getId()) != '') {
                 FM_Components_Util_MiniwebBanner::updateBanner(array('orgId' => $_POST['orgId']), $insertData);
             } else {
                 $insertData['orgId'] = $_POST['orgId'];
                 FM_Components_Util_MiniwebBanner::insert($insertData);
             }
         }
         if ($_POST['type'] == 'icon') {
             $icon = new FM_Components_Util_Icon(array('orgId' => $_POST['orgId']));
             //print_r($icon);
             if (trim($icon->getId()) != '') {
                 FM_Components_Util_Icon::updateIcon(array('orgId' => $_POST['orgId']), $insertData);
             } else {
                 $insertData['orgId'] = $_POST['orgId'];
                 FM_Components_Util_Icon::insert($insertData);
             }
         }
         //($_POST['type'] == 'left') ? FM_Components_Util_Logo::insert(array($insertData)) : FM_Components_Util_MiniwebBanner::insert(array($insertData));
         exit;
     }
 }
コード例 #3
0
 public function addbusinessAction()
 {
     $this->view->org = 'b2b';
     $this->view->search = new FM_Forms_Register_Search();
     $this->view->catJumper = new FM_Forms_Register_CatJumper();
     $this->subcat = 'business';
     $this->view->tiny = true;
     if ($_GET['delete']) {
         FM_Components_Business::delete(array('id' => $_GET['delete']));
         $this->_redirect('/root/addbusiness');
     } else {
         $this->view->sidenav = $this->view->partial('root/parts/sidenavs/organizations.phtml', array('org' => 'b2b'));
         $pc = new FM_Models_FM_SearchPrimaryCategories();
         $this->view->catSelect = $category = new Zend_Form_Element_Multiselect(array('label' => 'category :', 'name' => 'category', 'required' => 1));
         foreach ($pc->getPrimaryCategories() as $index => $values) {
             $category->addMultiOption($values['id'], $values['name']);
         }
         if ($_POST['search']) {
             $businesses = FM_Components_Organization::getOrgsLike($_POST['search'], 2);
         } elseif ($this->_getParam('category') > 0 && $this->_getParam('category') != '117') {
             $catname = FM_Components_Util_Category::getCategoryName($this->_getParam('category'), false);
             $businesses = FM_Components_Business::getByCategoryForRoot($this->_getParam('category'));
         } elseif ($this->_getParam('category') == '117') {
             $businesses = FM_Components_Business::getActiveForRoot();
             $catname = 'all';
         } else {
             $businesses = array();
         }
         $this->view->clients = $this->view->partial('root/business/clientindex.phtml', array('clients' => $businesses, 'catname' => $catname));
         $this->view->form = $businessForm = new FM_Forms_Register_Business(array(), FM_Components_Member::getAll());
         //print __LINE__;exit;
         if ($this->_request->isPost() && !array_key_exists('search', $_POST)) {
             $insert = false;
             $update = false;
             $id;
             //	print_r($this->_request->getPost());exit;
             if ($_POST['orgId'] != 0) {
                 $id = $_POST['orgId'];
                 $update = true;
             }
             $formData = $this->_request->getPost();
             if ($businessForm->isValid($formData)) {
                 $uploadedData = $businessForm->getValues();
                 //print_r($uploadedData);exit;
                 foreach ($_POST as $value => $t) {
                     if (stristr($value, 'region')) {
                         $uploadedData[$value] = 1;
                     }
                     if (stristr($value, 'subcat_')) {
                         $uploadedData['category'][] = $t;
                     }
                 }
                 $update ? FM_Components_Business::updateBusiness($uploadedData) : ($id = FM_Components_Business::insertBusiness($uploadedData));
                 if ($uploadedData['file']['name'] != '') {
                     $name = $uploadedData['file']['name'] = '1' . '_' . time() . str_ireplace(array(' ', '_', '-', ','), '', strtolower($uploadedData['file']['name']));
                     $uploadedData['file']['type'] = 'image';
                     $fileHandler = new FM_Components_Util_UploadHandler($uploadedData['file']);
                     $folder = $fileHandler->setFolder('logos');
                     if ($fileHandler->move()) {
                         //exit;
                         list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'] . $folder . '/' . $name);
                         //if($width > $_POST['width'] || $height > $_POST['height']) {
                         //	print '0';
                         //	exit;
                         //}
                         $insertData['fileName'] = $name;
                         $insertData['width'] = $width;
                         $insertData['height'] = $height;
                         $insertData['type'] = 'LG';
                         $insertData['active'] = '1';
                         //print (FM_Components_Util_Logo::hasRow($id)) ? 'yes' : 'no';
                         if (!FM_Components_Util_Logo::hasRow($id)) {
                             $insertData['orgId'] = $id;
                         }
                         FM_Components_Util_Logo::hasRow($id) ? FM_Components_Util_Logo::updateBanner(array('orgId' => $id), $insertData) : FM_Components_Util_Logo::insert($insertData);
                     }
                 }
                 if ($uploadedData['banner']['name'] != '') {
                     $name = $uploadedData['banner']['name'] = '1' . '_' . time() . str_ireplace(array(' ', '_', '-', ','), '', strtolower($uploadedData['banner']['name']));
                     $uploadedData['file']['type'] = 'image';
                     $fileHandler = new FM_Components_Util_UploadHandler($uploadedData['banner']);
                     $folder = $fileHandler->setFolder('logos');
                     if ($fileHandler->move()) {
                         list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'] . $folder . '/' . $name);
                         $insertData['fileName'] = $name;
                         $insertData['width'] = $width;
                         $insertData['height'] = $height;
                         $insertData['type'] = 'LG';
                         $insertData['active'] = '1';
                         if (!FM_Components_Util_MiniwebBanner::hasRow($id)) {
                             $insertData['orgId'] = $id;
                         }
                         FM_Components_Util_MiniwebBanner::hasRow($id) ? FM_Components_Util_MiniwebBanner::updateBanner(array('orgId' => $id), $insertData) : FM_Components_Util_MiniwebBanner::insert($insertData);
                     }
                 }
                 if ($uploadedData['icon']['name'] != '') {
                     $name = $uploadedData['icon']['name'] = '1' . '_' . time() . str_ireplace(array(' ', '_', '-', ','), '', strtolower($uploadedData['icon']['name']));
                     $uploadedData['file']['type'] = 'image';
                     $fileHandler = new FM_Components_Util_UploadHandler($uploadedData['icon']);
                     $folder = $fileHandler->setFolder('icons');
                     if ($fileHandler->move()) {
                         list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'] . $folder . '/' . $name);
                         $insertData['fileName'] = $name;
                         $insertData['width'] = $width;
                         $insertData['height'] = $height;
                         $insertData['type'] = 'LG';
                         $insertData['active'] = '1';
                         if (!FM_Components_Util_Icon::hasRow($id)) {
                             $insertData['orgId'] = $id;
                         }
                         FM_Components_Util_Icon::hasRow($id) ? FM_Components_Util_Icon::updateIcon(array('orgId' => $id), $insertData) : FM_Components_Util_Icon::insert($insertData);
                     }
                 }
                 $this->_redirect('/root/addbusiness/' . $this->_getParam('category'));
             } else {
                 $this->view->error = true;
             }
         }
     }
 }
コード例 #4
0
 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;
 }