Beispiel #1
0
if ($language == "") {
    $language = "tw";
}
if ($template == "") {
    $template = "default";
}
$marquee = $params->getValue('MARQUEE');
$com_img1 = $params->getValue('COM_IMG1');
/*
$com_img2  = $params->getValue('COM_IMG2');
$com_img3  = $params->getValue('COM_IMG3'); 
$com_img4  = $params->getValue('COM_IMG4');
$com_img5  = $params->getValue('COM_IMG5');
*/
#fetch sale data
$comb = new Comb();
$p1 = array();
$comb_lists = $comb->getListArray($p1);
$photo_path = "/V2/photo/comb/";
//print_r(count($comb_lists));
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>安信木屋設計</title>
    <!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
    <meta name="viewport" content="width=1024" />
    <link rel="stylesheet" href="css/bootstrap.min.css" media="screen" />
    <link rel="stylesheet" href="css/style.css" />
    <link rel="stylesheet" href="css/nivo-slider.css" />
 /**
  * Looks up a given $query with the given $config
  *
  * @param string  $query  String to look up in data
  * @param array  $config  Array of configuration options
  * @return array
  */
 public function lookUp($query, $config)
 {
     // require the class
     require_once 'comb.php';
     // create a hash for this search
     $hash = 'searches/' . $this->getSearchHash($config);
     // while we're here, clean up old unusable cached searches
     if ($config['query_cache_length'] == "on cache update") {
         $this->cache->purgeFromBefore(Cache::getLastCacheUpdate(), 'searches');
     } else {
         $this->cache->purgeOlderThan($config['query_cache_length'] * 60, 'searches');
     }
     // perform the search
     if ($this->cache->exists($hash)) {
         // use cached results, they're still relevant
         $output = unserialize($this->cache->get($hash));
         // record search
         if (isset($output['not_enough_characters'])) {
             // do nothing
         } elseif (isset($output['no_query']) || isset($output['no_results'])) {
             $this->logSearch($config['query'], 0);
         } elseif (isset($output['too_many_results'])) {
             $this->logSearch($config['query'], 'too many');
         } else {
             $this->logSearch($config['query'], count($output));
         }
     } else {
         // get data
         $data = $this->getData($config);
         try {
             $comb = Comb::create($data, $config);
             // look up query
             $results = $comb->lookUp($query);
             // fix results
             $output = array();
             $i = 1;
             foreach ($results['data'] as $result) {
                 $item = array('_score' => $result['score'], '_category' => $result['category'], '_query' => $results['info']['raw_query'], '_parsed_query' => $results['info']['parsed_query'], '_query_time' => $results['info']['query_time']);
                 array_push($output, array_merge($item, $result['data']));
                 $i++;
             }
             // save this
             $this->cache->put($hash, serialize($output));
             // record successful search
             $this->logSearch($config['query'], count($output));
         } catch (CombNoResultsFoundException $e) {
             $output = array(array('no_results' => true, '_query' => htmlentities($query)));
             $this->cache->put($hash, serialize($output));
             // record failed search
             $this->logSearch($config['query'], 0);
         } catch (CombNoQueryException $e) {
             $this->log->error($e->getMessage());
             $output = array(array('no_query' => true, '_query' => htmlentities($query)));
             $this->cache->put($hash, serialize($output));
             // record failed search
             $this->logSearch($config['query'], 0);
         } catch (CombTooManyResultsException $e) {
             $this->log->error($e->getMessage());
             $output = array(array('too_many_results' => true, '_query' => htmlentities($query)));
             $this->cache->put($hash, serialize($output));
             // record failed search
             $this->logSearch($config['query'], 'too many');
         } catch (CombNotEnoughCharactersException $e) {
             $output = array(array('not_enough_characters' => true, 'no_query' => true, 'no_results' => true, '_query' => htmlentities($query)));
             $this->cache->put($hash, serialize($output));
         } catch (CombException $e) {
             $this->log->error($e->getMessage());
             $output = array(array('no_results' => true, '_query' => htmlentities($query)));
             $this->cache->put($hash, serialize($output));
             // record failed search
             $this->logSearch($config['query'], 0);
         }
     }
     return $output;
 }
 function batchDelete($p, $ids)
 {
     $c = new Comb($this->db_conn);
     $i = 0;
     for ($i = 0; $i < count($ids); $i++) {
         $c->getData($ids[$i]);
         $c->delete();
     }
     $this->gotoURL("comb.php?action=list");
     //$this->browse($p);
 }