Пример #1
0
 public function indexAction()
 {
     //		$this->_helper->layout->disableLayout();
     $this->view->topMenuFlag = true;
     /*$fields = array ('optimize'=> true, 'commit'=> true, 'clean'=> true);
             
     //        $curl_request = curl_init('http://pbodev.info:8983/solr/mbartists/dataimport?command=fullimport');
     //        $curl_request = curl_init('http://pbodev.info:8983/solr/dataimport?command=fullimport');
             $curl_request = curl_init('http://pbodev.info:8983/solr/select?qt=/dataimport&command=fullimpor&clean=true&commit=true&optimize=true');
             curl_setopt($curl_request, CURLOPT_HEADER, 0);
             curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
     //        curl_setopt($curl_request, CURLOPT_POSTFIELDS, $fields);
             $curl_response = curl_exec($curl_request);
             curl_close($curl_request);
     
             prexit($curl_response);*/
     $catid = $this->_getParam('category');
     $insuranceid = $this->_getParam('insurance', '');
     $planid = $this->_getParam('plan', '');
     $reasonid = $this->_getParam('reason');
     $sobi2SearchText = addslashes(trim($this->_getParam('searchText')));
     $search1 = trim($this->_getParam('search1'));
     $state = trim($this->_getParam('st'));
     $start_date = $this->_getParam('start_date');
     $isAjax = $this->_getParam('isAjax', 0);
     $reasons = array();
     $linkArray = array();
     $this->view->catid = $catid;
     $this->view->insuranceid = $insuranceid;
     $this->view->planid = $planid;
     $this->view->reasonid = $reasonid;
     $this->view->searchText = stripslashes(stripslashes($sobi2SearchText));
     $this->view->search1 = stripslashes(stripslashes($search1));
     $this->view->start_date = $start_date;
     $this->view->isReasontoVisit = 1;
     // fetch category
     $Category = new Application_Model_Category();
     $categories = $Category->fetchAll("status=1", "name ASC");
     $this->view->categories = $categories;
     // fetch insurance companies
     if ($catid == 7) {
         $plan_type = 'd';
     } else {
         $plan_type = 'g';
     }
     $Plan = new Application_Model_InsurancePlan();
     $plans = $Plan->fetchAll("plan_type='{$plan_type}' AND status=1");
     $planArray = array();
     foreach ($plans as $p) {
         $planArray[] = $p->getInsuranceCompanyId();
     }
     $planArray = array_unique($planArray);
     $planStr = implode(',', $planArray);
     $Insurance = new Application_Model_InsuranceCompany();
     if ($insuranceid) {
         $planStr = $planStr . "," . $insuranceid;
         // when some come from insurance company-plan sitemap directly
         $this->view->insuranceCompany = $Insurance->fetchRow("status=1 AND id ='{$insuranceid}'");
     }
     $insurances = $Insurance->fetchAll("status=1 AND id IN ({$planStr})", "company ASC");
     $this->view->insurances = $insurances;
     // fetch insurance plans
     $insuranceplans = array();
     if ($insuranceid > 0) {
         $insuranceplans = $Plan->fetchAll("insurance_company_id='{$insuranceid}' AND status=1");
         $linkArray['insurance'] = $insuranceid;
     }
     $this->view->insuranceplans = $insuranceplans;
     //$this->view->insuranceCompany = $insuranceCompany;
     if ($planid > 0) {
         $linkArray['plan'] = $planid;
     }
     if ($reasonid > 0) {
         $linkArray['reason'] = $reasonid;
     }
     if ($search1 != '') {
         $linkArray['search1'] = $search1;
     }
     if ($state != '') {
         $linkArray['st'] = $state;
     }
     if ($sobi2SearchText != '') {
         $linkArray['searchText'] = $sobi2SearchText;
     }
     $isBronze = 0;
     // 0 - paid doctor, 1 - bronze doctors
     // fetch reason for visits
     if ($catid > 0) {
         $linkArray['category'] = $catid;
         $Reason = new Application_Model_ReasonForVisit();
         $reasons = $Reason->fetchAll("category_id='{$catid}' AND status=1", "reason ASC");
     }
     $this->view->reasons = $reasons;
     // ############################################### Search Results ######################################
     $this->view->page = $page = $this->_getParam('page', 1);
     //        $Search = new Base_SearchLucene();
     $settings = new Admin_Model_GlobalSettings();
     $limit = $settings->settingValue('pagination_size');
     $searchResults = $this->searchDIH('paid', $limit);
     if (isset($searchResults['other']) && count($searchResults['other']) > 0) {
         $this->view->otherStates = $searchResults['other'];
     }
     //        prexit($searchResults);
     if (isset($searchResults['total']) && $searchResults['total'] < 1) {
         // search for bronze doctors
         $isBronze = 1;
         $searchResults = $this->searchDIH('free', $limit);
     }
     $this->view->total = $searchResults['total'];
     $this->view->allResultArray = $searchResults['allResultArray'];
     $Paginator = new Base_Paginator();
     $this->view->paginator = $paginator = $Paginator->solrPaginator($searchResults['allResultArray'], $searchResults['total'], $page, $limit);
     $this->view->isBronze = $isBronze;
     //        prexit($paginator);
     //        $this->view->sortPosition = $this->_sortPosition;
     // ############################################ Search Results ##########################################
     $ip = $_SERVER['REMOTE_ADDR'];
     $this->view->linkArray = $linkArray;
     #-----------------------------------Start set title and description as per search result--------------------------- #
     $title = "";
     $desc = "";
     $sobi2Search = "";
     if ($catid != '') {
         $catObj = $Category->find($catid);
         if (!empty($catObj)) {
             $sobi2Search = $catObj->getName();
         }
     }
     $search1 = trim(str_replace(",", " ", $this->_getParam('search1')));
     $insurance_name = "";
     $dentistCategory = array('Dentist', 'Endodontist', 'Periodontist', 'Prosthodontist', 'Oral and Maxillofacial Surgeon', 'Orthodontist');
     if ($insuranceid > 0) {
         $insuranceObj = $Insurance->fetchRow("id='{$insuranceid}'");
         $insurance_name = $insuranceObj->getCompany();
     }
     if ($insuranceid > 0 && (isset($sobi2Search) && in_array($sobi2Search, $dentistCategory))) {
         $title = "{$insurance_name}, {$insurance_name} Dentist, {$insurance_name} Dental , {$insurance_name} Dental Insurance Plan";
         $desc = "{$insurance_name} Dental Insurance Plan: For {$insurance_name}, {$insurance_name} Dentist, {$insurance_name} Dental & Dentist's that Accept {$insurance_name} Visit Doctors Improving Healthcare";
     } else {
         //if (isset ( $sobi2Search ) && $sobi2Search != "all") { // Speciality serach
         if (isset($sobi2Search) && $sobi2Search != "") {
             // Speciality serach
             if ($search1 != "") {
                 $title = "{$sobi2Search} {$search1}, {$sobi2Search} {$search1}";
                 $desc = "{$sobi2Search} {$search1}: Find the best Dentist in {$search1} with patients reviews. Choose a top rated {$sobi2Search} {$search1} for your needs. Schedule an appointment now!";
             } else {
                 $title = "{$sobi2Search} San Francisco, New York, Los Angeles(LA), San Diego, CA";
                 $desc = "Find the best {$sobi2Search} in San Francisco, Los Angeles(LA), San Diego with patients reviews, Make an instant appointment Now!";
             }
         } else {
             // City, zipcode address serch
             $title = "{$search1} Dentist, Doctor, Dermatologist, Plastic/Cosmetic Surgeon";
             if (is_numeric($search1)) {
                 //############# Is zipcode
                 $desc = "Choose from hundreds of local {$search1} Top Doctors & Dentists, Dermatologists, Plastic Surgeons, Cosmetic Surgeons & Cosmetic Dentist at Doctors Improving Healthcare.";
             } else {
                 $desc = "{$search1} Dentist: Choose from hundreds of Top {$search1} Doctors & {$search1} Dentists, Dermatologists, Plastic Surgeons, Cosmetic Surgeons & Cosmetic Dentist at Doctors Improving Healthcare.";
             }
         }
     }
     $returnArray = array();
     if ($isAjax) {
         $this->_helper->layout->disableLayout();
         //            $returnArray['middel_content'] = $this->view->render('search/middle_content.phtml');
         echo $this->view->render('search/middle_content.phtml');
         //            echo Zend_Json::encode($returnArray);
         exit;
     }
     /* -----------------------------------End set title and description as per search result--------------------------- */
 }