Location: PHPKode > projects > Phpress > phpress/ana_mode_art_search.php
<?
/*
    Copyright (C)2004-2007  Matthieu Perez - hide@address.com

    This file is part of PhPress.

    PhPress is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    PhPress is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PhPress.  If not, see <http://www.gnu.org/licenses/>.
*/
///////////////////////
// ana_mode_art_search.php
session_start();
require 'program/common/constantes.php' ;
require LANG_PATH . $lang ."/msg.php";
require PROG_COM_PATH . 'functions_common.php';
//require 'program/html/default.css';
require 'program/html/lightblue.css';

//print '<div align="center"><strong>'.TXT_ANA_ARTICLES.'</strong></div><hr>';
print 'ana_mode_art_search.php <hr>';

////////////////////////////////////////////////
// recherche rapide par idbloc ou article

print '<blue>'.MSG_QUICK_ART_SEARCH.'</blue><br><br>';

print '
<FORM method="POST" name="quick_form" action="ana_mode_art_result.php" target="ana_mode_art_result">
N° &nbsp;
<INPUT type="text" name="quick_id" size="20" '.$black_box.'>
<SELECT name="quick_search_type" '.$black_box.'>
<option value="article">'.TXT_ART_ID.'</option>
<option value="block">'.TXT_BLOCK.'</option>
</SELECT>   
<INPUT type="hidden" name="continent" value="'.$continent.'">
<INPUT type="hidden" name="country" value="'.$country.'">
<INPUT type="hidden" name="depart" value="'.$depart.'">
<INPUT type="hidden" name="insee" value="'.$insee.'">
<INPUT type="submit" name="quick_post" value="'.TXT_VALID.'" '.$black_box.'></FORM>
<hr>
';

////////////////////////////////////////////////
// recherche rapide par mot du titre

print '<blue>'.MSG_KW_ART_SEARCH.'</blue><br><br>';

print '
<FORM method="POST" name="kw_form" action="ana_mode_art_result.php" target="ana_mode_art_result">
<SELECT name="kw_search_type" '.$black_box.'>
<option value="headline">'.TXT_KW_HD.'</option>
<option value="txt" DISABLED>'.TXT_KW_TXT.'</option>
<option value="sum" DISABLED>'.TXT_KW_SUM.'</option>
</SELECT>
<INPUT type="text" name="kw" size="20" '.$black_box.'>

<INPUT type="submit" name="kw_post" value="'.TXT_VALID.'" '.$black_box.'></FORM>
<hr>
';

////////////////////////////////////////////////
// conservation des données géographiques
$geo_hidden_input =
   '
   <INPUT type="hidden" name="continent" value="'.$continent.'">
   <INPUT type="hidden" name="country" value="'.$country.'">
   <INPUT type="hidden" name="depart" value="'.$depart.'">
   <INPUT type="hidden" name="insee" value="'.$insee.'">
   ';
////////////////////////////////////////////////
// recherche par élément de la table articles
print '<blue>'.MSG_ART_SEARCH.'</blue><br><br>';

////////////////////
// select dates
print '<table>
<tr align="left">
<td nowrap> &nbsp;'.TXT_DATE_BETWEEN.'&nbsp; </td>

<FORM method="POST" name="date_form"  target="_self">
'.$geo_hidden_input.'
<INPUT type="hidden" name="select_source" value="'.$select_source.'">
<INPUT type="hidden" name="select_type" value="'.$select_type.'">
<INPUT type="hidden" name="art_subcat" value="'.$art_subcat.'">
<td nowrap>';

//get max and min dates
if(!$beguin_year)
{
 if($select_source)
 {
 $date_beguin_request="SELECT JDay from Articles WHERE NPTitle='$select_source' ORDER BY JDay";
 }
 else
 {
 $date_beguin_request="SELECT JDay from Articles ORDER BY JDay";
 }
 $date_beguin_query_result=sql_request($db, $date_beguin_request) ;
 $date_beguin_result=mysql_fetch_array($date_beguin_query_result);
 $date_beguin=$date_beguin_result[0];
 $g_date_beguin=cal_from_jd($date_beguin, CAL_GREGORIAN);
 
 $beguin_month=$g_date_beguin[month];
 $beguin_year=$g_date_beguin[year];
 $beguin_day=$g_date_beguin[day];
}
if(!$end_year)
{
 if($select_source)
 {
 $date_end_request="SELECT JDay from Articles WHERE NPTitle='$select_source' ORDER BY JDay DESC";
 }
 else
 {
 $date_end_request="SELECT JDay from Articles ORDER BY JDay DESC";
 }
 $date_end_query_result=sql_request($db, $date_end_request) ;
 $date_end_result=mysql_fetch_array($date_end_query_result);
 $date_end=$date_end_result[0];
 $g_date_end=cal_from_jd($date_end, CAL_GREGORIAN);
 
 $end_month=$g_date_end[month];
 $end_year=$g_date_end[year];
 $end_day=$g_date_end[day];
}

// print date formsize="4"
if($lang=='FR')
{
print '
<input type="text" maxlength="2" size="2" name="beguin_day" value="' . $beguin_day . '" '.$black_box.'>
<input type="text" maxlength="2" size="2" name="beguin_month" value="'.$beguin_month.'" '.$black_box.'>
<input type="text" maxlength="4" size="4" name="beguin_year" value="'.$beguin_year.'" '.$black_box.'>';
}
else
{
print '
<input type="text" maxlength="2"  size="2" name="beguin_month" value="'.$beguin_month.' " '.$black_box.'>
<input type="text" maxlength="2" size="2" name="beguin_day" value="' . $beguin_day . '" '.$black_box.'>
<input type="text" maxlength="4" size="4" name="beguin_year" value="'.$beguin_year.'" '.$black_box.'>';
}

print ' </td><td nowrap> &nbsp;'.TXT_DATE_AND.'&nbsp; </td>
<td nowrap>';
if($lang=='FR')
{
print '
<input type="text" maxlength="2" size="2" name="end_day" value="' . $end_day . '" '.$black_box.'>
<input type="text" maxlength="2" size="2" name="end_month" value="' . $end_month . '" '.$black_box.'>
<input type="text" maxlength="4" size="4" name="end_year" value="' . $end_year . '" '.$black_box.'>';
}
else
{
print '
<input type="text" maxlength="2"  size="2" name="end_month" value="' . $end_month . '" '.$black_box.'>
<input type="text" maxlength="2" size="2" name="end_day" value="' . $end_day . '" '.$black_box.'>
<input type="text" maxlength="4" size="4" name="end_year" value="' . $end_year . '" '.$black_box.'>';
}


print '
</td>
<td valign="bottom">
<INPUT type="submit" name="date_post" value="'.TXT_VALID.'" '.$black_box.'>
</td></FORM>
</tr></table>';

////////////////////////////////////////////////////////////////////////////////////////
// sélection des éléments de contenu
print '<table width="100%">
<tr><td> </td></tr>
<tr><td>'.TXT_NEWSPAPER_TITLE.' :</td><td></td></tr>
<tr>
<FORM method="POST" name="source_form"  target="_self">
<INPUT type="hidden" name="select_type" value="'.$select_type.'">
<INPUT type="hidden" name="art_subcat" value="'.$art_subcat.'">
'.$geo_hidden_input.'
<INPUT type="hidden" name="beguin_day" value="'.$beguin_day.'">
<INPUT type="hidden" name="beguin_month" value="'.$beguin_month.'">
<INPUT type="hidden" name="beguin_year" value="'.$beguin_year.'">
<INPUT type="hidden" name="end_day" value="'.$end_day.'">
<INPUT type="hidden" name="end_month" value="'.$end_month.'">
<INPUT type="hidden" name="end_year" value="'.$end_year.'">
<td>
<SELECT name="select_source" '.$l_black_box.' onchange="document.source_form.submit();">';
$get_sources_request="SELECT * from Sources";
$get_sources_query_result=sql_request($db, $get_sources_request) ;
print '
<option value="">'.TXT_ALL.'</option>';

   while ($get_sources_result=mysql_fetch_array($get_sources_query_result) )
   {
   print '
   <option value="'.$get_sources_result[5].'"';
   select_previous($select_source, $get_sources_result[5]);
   print '>'.$get_sources_result[0].'</option>';
   } 
print '</td></FORM></tr>

<tr><td> </td></tr>
<tr><td>'.MSG_ART_TOC.'</td><td>'.MSG_ART_SUBCAT.'</td></tr>
<tr>

<FORM method="POST" name="type_form"  target="_self" action="ana_mode_art_search.php">
<td style="width:170;">
<INPUT type="hidden" name="select_source" value="'.$select_source.'">

<INPUT type="hidden" name="beguin_day" value="'.$beguin_day.'">
<INPUT type="hidden" name="beguin_month" value="'.$beguin_month.'">
<INPUT type="hidden" name="beguin_year" value="'.$beguin_year.'">
<INPUT type="hidden" name="end_day" value="'.$end_day.'">
<INPUT type="hidden" name="end_month" value="'.$end_month.'">
<INPUT type="hidden" name="end_year" value="'.$end_year.'">
'.$geo_hidden_input.'
<SELECT name="select_type" '.$l_black_box.' onchange="document.type_form.submit();">';
// get the article type choices
$get_art_choices_request="SELECT * from ArtCat ORDER BY OCC DESC";
$get_art_choices_query_result=sql_request($db, $get_art_choices_request) ;
print '
<option value="">'.TXT_ALL.'</option>';

   while ($get_art_choices_result=mysql_fetch_array($get_art_choices_query_result) )
   {
      if($lang=='FR')
      {
      $option=$get_art_choices_result[1];
      }
      else 
      {
      $option=$get_art_choices_result[2];      
      }
      
   print '
   <option value="'.$get_art_choices_result[0].'"';
   select_previous($select_type, $get_art_choices_result[0]);
   print '>'.$option.'</option>';
   } 
print '</SELECT>
</FORM></td>';
/////////////////////////////////////////////////////////////////////
// subcategories
print '
<FORM name="subcat_form" method="POST"  target="_self">
<INPUT type="hidden" name="select_source" value="'.$select_source.'">
<INPUT type="hidden" name="select_type" value="'.$select_type.'">

<INPUT type="hidden" name="beguin_day" value="'.$beguin_day.'">
<INPUT type="hidden" name="beguin_month" value="'.$beguin_month.'">
<INPUT type="hidden" name="beguin_year" value="'.$beguin_year.'">
<INPUT type="hidden" name="end_day" value="'.$end_day.'">
<INPUT type="hidden" name="end_month" value="'.$end_month.'">
<INPUT type="hidden" name="end_year" value="'.$end_year.'">
'.$geo_hidden_input.'
<td width="50%">
<SELECT name="art_subcat" '.$l_black_box.' onchange="document.subcat_form.submit();">
<option value="">'.TXT_ALL.'</option>'; 
  
   // get the subcategory list of choices
   if($select_type)
   {
   $get_subcat_choices_request="SELECT * from ArtSubcat WHERE IdCat  = '$select_type'  ORDER BY OCC DESC";
   }
   else
   {
   $get_subcat_choices_request="SELECT * from ArtSubcat ORDER BY OCC DESC";
   }
   $get_subcat_choices_query_result=sql_request($db, $get_subcat_choices_request) ;
   
      while ($get_subcat_choices_result=mysql_fetch_array($get_subcat_choices_query_result) )
      {
         if($lang=='FR')
         {
         $subcatoption=$get_subcat_choices_result[2];
         }
         else
         {
         $subcatoption=$get_subcat_choices_result[3];      
         }
      
         print '
       <option value="'.$get_subcat_choices_result[0].'"';
           select_previous($art_subcat, $get_subcat_choices_result[0]);
           //print 'selected';
           print '>'.$subcatoption.'</option>';
      }
   
   print '</SELECT></FORM></td>
          </tr><tr>
          </tr></table>';
//
/////////////////////////////////////////////////////////////////////
// geo
$hidden_input = '
<INPUT type="hidden" name="select_source" value="'.$select_source.'">
<INPUT type="hidden" name="select_type" value="'.$select_type.'">
<INPUT type="hidden" name="art_subcat" value="'.$art_subcat.'">
<INPUT type="hidden" name="beguin_day" value="'.$beguin_day.'">
<INPUT type="hidden" name="beguin_month" value="'.$beguin_month.'">
<INPUT type="hidden" name="beguin_year" value="'.$beguin_year.'">
<INPUT type="hidden" name="end_day" value="'.$end_day.'">
<INPUT type="hidden" name="end_month" value="'.$end_month.'">
<INPUT type="hidden" name="end_year" value="'.$end_year.'">
';

include PROG_COM_PATH . 'find_place.php';




// final form
print '
<br>
<FORM name="search_form" method="POST"  target="ana_mode_art_result" action="ana_mode_art_result.php">
<INPUT type="hidden" name="search_exec" value="exec">';

// order
print '<blue>'.TXT_ORDER_BY.' :</blue><br>
<INPUT type="radio" name="order" value="date">'.TXT_ORDER_DATE.'
<INPUT type="radio" name="order" value="indice">'.TXT_ORDER_INDICE.'
<INPUT type="radio" name="order" value="surface">'.TXT_ORDER_SURF.'&nbsp;&nbsp;
<INPUT type="checkbox" name="desc" value="DESC" checked>'.TXT_ORDER_DESC.'
<br>';

// status
print '<br><blue>'.TXT_STATUS.' :</blue><br>
<INPUT type="radio" name="status" value="A" checked>'.TXT_STAT_ALL.'
<INPUT type="radio" name="status" value="N" >'.TXT_STAT_NULL.'
<INPUT type="radio" name="status" value="B">'.TXT_STAT_B.'
<INPUT type="radio" name="status" value="C">'.TXT_STAT_C.'&nbsp;&nbsp;
<br>';

// fin du formulaire et bouton envoi
print '<br><div align="center">
'.$geo_hidden_input.'
<INPUT type="hidden" name="select_source" value="'.$select_source.'">
<INPUT type="hidden" name="select_type" value="'.$select_type.'">
<INPUT type="hidden" name="art_subcat" value="'.$art_subcat.'">
<INPUT type="hidden" name="beguin_day" value="'.$beguin_day.'">
<INPUT type="hidden" name="beguin_month" value="'.$beguin_month.'">
<INPUT type="hidden" name="beguin_year" value="'.$beguin_year.'">
<INPUT type="hidden" name="end_day" value="'.$end_day.'">
<INPUT type="hidden" name="end_month" value="'.$end_month.'">
<INPUT type="hidden" name="end_year" value="'.$end_year.'">
 
<INPUT type="hidden" name="limit_beguin" value="0">
<INPUT type="hidden" name="limit_end" value="10">
<INPUT type="submit" name="search_post" value="'.TXT_VALID.'" '.$black_button.'>
</div></FORM>
<hr>';
//tmp
/*
print "select_type = $select_type <br>
art_subcat = $art_subcat<br>
select_source = $select_source<br>
date_beguin = $date_beguin <br>
date_end = $date_end <br>
beguin_day = $beguin_day<br>
beguin_month = $beguin_month<br>
beguin_year = $beguin_year <br>
end_day = $end_day<br>
end_month= $end_month <br>
end_year = $end_year <br>

";
*/

?>
Return current item: Phpress