Changeset 629 for trunk/search.php


Ignore:
Timestamp:
Dec 2, 2004, 1:45:57 PM (19 years ago)
Author:
gweltas
Message:

Search form update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/search.php

    r621 r629  
    3636if (isset($_POST['submit']))
    3737{
    38   if ($_POST['search_keywords'] &&
    39    !preg_match('/^\s*$/', $_POST['search_keywords']))
     38  if ($_POST['search_allwords'] &&
     39   !preg_match('/^\s*$/', $_POST['search_allwords']))
    4040  {
    4141    $local_search = array();
    42         $search_keywords = $_POST['search_keywords'];
     42        $search_keywords = $_POST['search_allwords'];
    4343        $drop_char_match =   array('-', '^', '$', ';', '#', '&', '(', ')', '<', '>',
    4444          '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '.', '[', ']', '{', '}',
     
    5252        $words = preg_split('#\s+#', $search_keywords);
    5353    $words = array_unique($words);
    54         $search['fields']['keywords'] = array();
    55         $search['fields']['keywords']['words'] =$words;
    56         $search['fields']['keywords']['mode']= $_POST['mode'];
     54        $search['fields']['allwords'] = array();
     55        $search['fields']['allwords']['words'] =$words;
     56        $search['fields']['allwords']['mode']= $_POST['mode'];
    5757  }
    5858 
     
    8383  // duration
    8484  $search_duration = 0;
    85   if ( !empty($date) && !empty( $_POST['duration_day']) )
    86   {
    87         $search['fields'][$type_date]['mode'] =  $_POST['duration_day'];
     85  if ( !empty($date) && !empty( $_POST['end_year']) )
     86  {
     87        $end_date = $_POST['end_year'].'.'.$_POST['end_month'].'.'.$_POST['end_day'];
     88        $search['fields'][$type_date]['mode'] =  $end_date;
    8889  }
    8990 }
     
    140141$start_month .= '</select>';
    141142
    142 // year list
    143 $start_year = '<select name="start_year">';
    144 $start_year .= '<option value="0"> ---- </option>';
    145 $begin_year = date('Y', time())-10;
    146 for ($i = $begin_year; $i <= date('Y', time()); $i++)
    147 {
    148         $start_year .= '<option value="' . $i . '">' . $i . '</option>';
    149 }
    150 $start_year .= '</select>';
    151 
     143// day list
     144$end_day = '<select name="end_day">';
     145for ($i=0; $i <= 31; $i++)
     146{
     147        $end_day .= '<option value="' . $i . '" >' . ( ($i == 0) ? ' -- ' : str_pad($i, 2, '0', STR_PAD_LEFT) ) . '</option>';
     148}
     149$end_day .= '</select>';
     150
     151// month list
     152$end_month = '<select name="end_month">';
     153$end_month .= '<option value="0"> ------------ </option>';
     154for ($i=1; $i <= 12; $i++)
     155{
     156        $end_month .= '<option value="' . $i . '">' . $lang['month'][$i] . '</option>';
     157}
     158$end_month .= '</select>';
    152159
    153160//
     
    179186  'L_TODAY' => $lang['today'],
    180187  'L_SEARCH_DATE_FROM'=>$lang['search_date_from'],
    181   'L_SEARCH_DURATION'=>$lang['search_duration'],
     188  'L_SEARCH_DATE_TO'=>$lang['search_date_to'],
    182189  'L_DAYS'=>$lang['days'],
    183190  'L_MONTH'=>$lang['w_month'],
     
    192199  'TODAY_MONTH' => date('m', time()),
    193200  'TODAY_YEAR' => date('Y', time()),
    194   'S_CALENDAR_YEAR' => $start_year,
     201  'E_CALENDAR_MONTH' => $end_month,
     202        'E_CALENDAR_DAY' => $end_day,
    195203  'S_CALENDAR_MONTH' => $start_month,
    196204  'S_CALENDAR_DAY' => $start_day,
Note: See TracChangeset for help on using the changeset viewer.