[Linpha-cvs] SF.net SVN: linpha: [4526] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-12 21:44:16
|
Revision: 4526 Author: fangehrn Date: 2006-04-12 14:44:03 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4526&view=rev Log Message: ----------- * startet implementing search feature Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/modules/module.search.php Added Paths: ----------- trunk/linpha2/templates/default/search.html.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-12 18:19:52 UTC (rev 4525) +++ trunk/linpha2/ChangeLog 2006-04-12 21:44:03 UTC (rev 4526) @@ -1,5 +1,6 @@ 2006-04-12 flo * replace some recordCount() with EOF + * startet implementing search feature 2006-04-12 bzrudi <linpha2_AT_tuxpower_DOT_de> * added ORACLE EXPRESS DB support, still some things open but at least Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-12 18:19:52 UTC (rev 4525) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-04-12 21:44:03 UTC (rev 4526) @@ -112,7 +112,7 @@ $this->mode = 'home'; $this->orderby = getSqlSortOrder($GLOBALS['linpha']->sql->config->value['sys_style_home_firstsortorder']); } - else // $modulename=='browse', others will come.. + else // $modulename=='browse' | 'search' , others will come.. { $this->mode = 'thumb'; Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2006-04-12 18:19:52 UTC (rev 4525) +++ trunk/linpha2/lib/modules/module.search.php 2006-04-12 21:44:03 UTC (rev 4526) @@ -22,5 +22,437 @@ * Albums view related methods and functions * @package Template */ - ?> - \ No newline at end of file + + + + + +/** +* call from exif href in img_view +*/ +if(isset($_REQUEST['sk'])) { + $_REQUEST['date_from']=$_REQUEST['sk']; + $_REQUEST['date_to']=$_REQUEST['sk']; + $_REQUEST['album_select'] = Array('all'=>'all'); + $_REQUEST['cmd'] = 'search'; +} + +if(isset($_REQUEST['cmd'])) +{ + switch($_REQUEST['cmd']) + { + case 'search': + + /** + * search string to short + */ + if( !empty($_REQUEST['search_text']) && strlen($_REQUEST['search_text']) < 2 ) + { + $error = 1; + } + /** + * check for valid input + * @todo + */ + elseif((!empty($_REQUEST['search_text']) && strlen($_REQUEST['search_text'])>=2) OR + isset($_REQUEST['category']) OR + (!empty($_REQUEST['date_from']) OR !empty($_REQUEST['date_to'])) OR true) + { + /** + * save search string in session + */ + $_SESSION['search'] = $_REQUEST; + } + else + { + $error = 2; + } + + break; + case 'new': + unset($_SESSION['search']); + $_REQUEST['b_all'] = true; + break; + case 'edit': + if(isset($_SESSION['search'])) + { + /** + * copy session to request + */ + foreach($_SESSION['search'] AS $key=>$value) + { + $_REQUEST[$key] = $value; + } + unset($_SESSION['search']); + } + break; + } +} +else +{ + $_REQUEST['b_all'] = 1; +} + +if(isset($_SESSION['search'])) +{ +/** + * init + */ + include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); + $linpha->imgview = new linImgview(); + $linpha->imgview->setCurrentView('search'); + $linpha->template->URL_base = LINPHA_DIR.'/?cat=search'; + $linpha->template->URL_full = LINPHA_DIR.'/?cat=search'; + $linpha->template->output['title'] = i18n("Search"); + + +/** +* create sql search query +*/ + /** + * copy session to request + */ + foreach($_SESSION['search'] AS $key=>$value) + { + $_REQUEST[$key] = $value; + } + + /** + * buttons + */ + + $sql_buttons = ''; + if(!empty($_REQUEST['search_text'])) + { + /** + * Split textfield into particular words + */ + + /** + * replace \" with {quotes} to be sure the \" isn't handled as delimiter + * later it will be replaced back + * + * * my cat ==> returns all results for my AND/OR cat + e.g. my house, my cat, cute cat... + * "my cat" ==> returns all results for my cat + e.g. this is my cat, but not a cute cat, this is my house..." + * \"my cat\" ==> returns all results for "my cat" + e.g. this is "my cat" smilla, but not this is my cat smilla... + * + */ + $_REQUEST['search_text'] = str_replace('\"','{quotes}',$_REQUEST['search_text']); + + /** + * extract strings with '"blal asdf"' into 'blal asdf' + */ + $array_strings = Array(); + while( ($pos1 = strpos($_REQUEST['search_text'],'"')) !== false) + { + /** + * no ending " found, take the whole string after $pos1 + */ + if( ($pos2 = strpos(substr($_REQUEST['search_text'],$pos1+1),'"')) === false) + { + $substr = substr($_REQUEST['search_text'],$pos1); + } + else + { + $substr = substr($_REQUEST['search_text'],$pos1,$pos2+2); + } + + /** + * delete this entry in the search string to be sure the next time we get the next entry + */ + $_REQUEST['search_text'] = str_replace($substr,'',$_REQUEST['search_text']); + + /** + * add the string to the array (without starting and ending '"') + */ + $array_strings[] = substr($substr,1,strlen($substr)-2); + } + + /** + * extract normal strings with 'blaab asd' into 'blals' and 'asd' + */ + $array_strings = array_merge($array_strings,explode(" ", $_REQUEST['search_text'])); + + /** + * remove empty strings and add slashes + */ + foreach($array_strings AS $key=>$value) + { + if(empty($value)) { + unset($array_strings[$key]); + } else { + $array_strings[$key] = LinSql::linAddslashes($value); + } + } + + + /** + * get text fields + */ + $sql_buttons = "(1=2"; + $and_or = get_and_or($_REQUEST['text_and_or']); + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); + while($data = $query->FetchRow(ADODB_FETCH_NUM)) + { + if(isset($_REQUEST['button']['meta'][$data[0]]) OR isset($_REQUEST['button']['meta']['all'])) + { + $sql_buttons .= " OR ("; + + $num = count($array_strings); + reset($array_strings); + for($i = 1; list($key,$value) = each($array_strings); $i++) + { + $sql_buttons .= " (".PREFIX."meta_data.field_id = '".$data[0]."' AND ".PREFIX."meta_data.meta_data LIKE '%".$value."%') "; + + /** + * append AND/OR, but not on last item + */ + if($i < $num) + { + $sql_buttons .= $and_or; + } + } + + $sql_buttons .= ")"; + + $need_metadata_table = true; + } + } + + /** + * build search string + */ + $search_string = "{colname} LIKE '%"; + $search_string .= implode("%' ".$and_or." {colname} LIKE '%",$array_strings); + $search_string .= "%'"; + + if(isset($_REQUEST['button']['meta']['cmt']) OR isset($_REQUEXT['button']['meta']['all'])) + { + $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_comments.meta_comment",$search_string); + $need_meta_comment_table = true; + } + if(isset($_REQUEST['button']['meta']['name']) OR isset($_REQUEXT['button']['meta']['all'])) + { + $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."photos.name",$search_string); + } + + + + /** + * exif/iptc + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + + /** + * exif + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) + { + $MetaData->setFields('exif'); + foreach($MetaData->defined_fields['exif'] AS $key=>$value) + { + if(isset($_REQUEST['button']['exif'][$key]) OR isset($_REQUEST['button']['exif']['all'])) + { + $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_exif.".$key,$search_string); + $need_exif_table = true; + } + } + } + + /** + * iptc + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) + { + $MetaData->setFields('iptc'); + foreach($MetaData->defined_fields['iptc'] AS $key=>$value) + { + if(isset($_REQUEST['button']['iptc'][$key]) OR isset($_REQUEST['button']['iptc']['all'])) + { + $sql_buttons .= " OR ".str_replace('{colname}',PREFIX."meta_iptc.".$key,$search_string); + $need_exif_table = true; + } + } + } + + $sql_buttons .= ") AND "; + } + //echo $sql_buttons.'<br />'; + + + /** + * categories + */ + $sql_categories = ''; + if(isset($_REQUEST['category'])) + { + /** + * add slashes ( and remove empty strings) + */ + $_REQUEST['category'] = addslashes_array($_REQUEST['category']); + + $and_or = get_and_or($_REQUEST['and_or']); + $sql_categories .= "(".C.".category LIKE '%;"; + $sql_categories .= implode(";%' ".$and_or." ".C.".category LIKE '%;",$_REQUEST['category']); + $sql_categories .= ";%'"; + $sql_categories .= ") AND "; + + $need_image_comment_table = true; + } + + //echo $sql_categories.'<br />'; + + + /** + * exif date + */ + $sql_exif_date = ''; + if( (isset($_REQUEST['date_from']['exif']) && $_REQUEST['date_from']['exif']!="") + OR (isset($_REQUEST['date_to']['exif']) && $_REQUEST['date_to']['exif']!="")) + { + if($_REQUEST['date_from']['exif']=="") { + $_REQUEST['date_from']['exif'] = "0000:00:00 00:00:00"; + } + if($_REQUEST['date_to']['exif']=="") { + $_REQUEST['date_to']['exif'] = "4000:00:00 00:00:00"; + } + + $sql_exif_date = "(".PREFIX.".meta_exif.datetimeoriginal between ". + "'".LinSql::linAddslashes($_REQUEST['date_from']['exif'])." 00:00:00' AND ". + "'".LinSql::linAddslashes($_REQUEST['date_to']['exif'])." 23:59:59') AND "; + + $need_exif_table = true; + } + + //echo $sql_exif_date.'<br />'; + + /** + * albums selected + */ + $sql_albums = ""; + if( isset($_REQUEST['album_select']) && !in_array('all',$_REQUEST['album_select']) ) + { + /** + * create an array which holds the addslashed ids + */ + foreach($_REQUEST['album_select'] AS $value) + { + $array_paths[] = LinSql::linAddslashes($value); + } + + $sql_albums .= "(".PREFIX."photos.parent_id = '"; + $sql_albums .= implode("' OR ".PREFIX."photos.parent_id = '",$array_paths); + $sql_albums .= "'"; + $sql_albums .= ") AND "; + } + + //echo $sql_albums.'<br />'; + + + /** + * set sql query string + *DISTINCT + */ + $sql_begin = "SELECT ".PREFIX."photos.id AS id, ".PREFIX."photos.name AS name, ". + PREFIX."photos.md5sum AS md5sum, " . + PREFIX."photos.img_type AS img_type, ". + PREFIX."photos.stats_numbers AS stats_numbers, ".PREFIX."photos.time_add AS time_add "; + + + $sql_where = " FROM ".PREFIX."photos ". + (isset($need_meta_comment_table) ? "LEFT OUTER JOIN ".PREFIX."meta_comments ON ".PREFIX."photos.md5sum = ".PREFIX."meta_comments.md5sum " : ''). + (isset($need_exif_table) ? "LEFT OUTER JOIN ".PREFIX."meta_exif ON ".PREFIX.".photos.md5sum = ".PREFIX."meta_exif.md5sum " : ''). + (isset($need_iptc_table) ? "LEFT OUTER JOIN ".PREFIX."meta_iptc ON ".PREFIX.".photos.md5sum = ".PREFIX."meta_iptc.md5sum " : ''). + "WHERE ".$sql_buttons.$sql_categories.$sql_exif_date.$sql_albums.'1=1'; + + $linpha->db->debug = true; + $linpha->imgview->photos = $GLOBALS['linpha']->db->GetAssoc($sql_begin.$sql_where); + $linpha->db->debug = false; + + //echo '<br /><br /><br />'.$sql_begin.$sql_where.'<br /><br /><br />'; + + if( count($linpha->imgview->photos) == 0 ) + { + $GLOBALS['linpha']->template->output['navigation'] = + '<b>'.i18n("Sorry, Your search did not match any content").'</b><br />'; + } + else + { + $GLOBALS['linpha']->template->output['navigation'] = ''; + } + $GLOBALS['linpha']->template->output['navigation'] .= + '<a class="button" href="'.LINPHA_DIR.'/?cat=search&cmd=new">'. + i18n("New Search").'</a>'. + '<a class="button" href="'.LINPHA_DIR.'/?cat=search&cmd=edit">'. + i18n("Edit Search").'</a>'; + + $linpha->imgview->buildImgView(); +} +else +{ + $linpha->template->setModuleName('search'); + $linpha->template->URL_full = LINPHA_DIR.'/?cat=search'; + $linpha->template->output['title'] = i18n("Search"); + include_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/global.html.php'); +} + + + +/** +* validate incoming data from $_GET +*/ +function get_and_or($and_or) +{ + if($and_or == 'AND') { + return 'AND'; + } else { + return 'OR'; + } +} + +function build_album_select($with_all_albs_entry) +{ + ?> + <select name="album_select[]" size="10" multiple="multiple"> + <?php + if($with_all_albs_entry) + { + if(!isset($_REQUEST['album_select']) OR $_REQUEST['album_select']=='all') { + $select = ' selected'; + $_REQUEST['album_select'] = Array('all'=>'all'); + } else { + $select = ''; + } + echo '<option value="all"'.$select.'>'.i18n("All Albums").'</option>'."\n"; + } + + build_album_select_sub_entry(0); + ?> + </select><br /> + <font size="-2">(<?php echo i18n("Multiple Select Use 'Ctrl'"); ?>)</font> + <?php +} + +function build_album_select_sub_entry($id) +{ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."photos WHERE parent_id = '".$id."' AND img_type = '0' ORDER by name"); + while($data = $query->FetchRow()) + { + if(!isset($_REQUEST['album_select'])) { + $_REQUEST['album_select'] = array(); + } + if(in_array($data['id'],$_REQUEST['album_select'])) { + $select = ' selected'; + } else { + $select = ''; + } + echo '<option value="'.$data['id'].'"'.$select.'>'.htmlspecialchars($data['name'],ENT_QUOTES).'</option>'."\n"; + + build_album_select_sub_entry($data['id']); + } +} +?> \ No newline at end of file Added: trunk/linpha2/templates/default/search.html.php =================================================================== --- trunk/linpha2/templates/default/search.html.php (rev 0) +++ trunk/linpha2/templates/default/search.html.php 2006-04-12 21:44:03 UTC (rev 4526) @@ -0,0 +1,258 @@ +<style> +.searchcolumn +{ + float: left; + border: 1px solid black; + margin: 10px; + padding: 5px; + width: 300px; +} +</style> +<br /><img src='<?php echo LINPHA_DIR; ?>/lib/graphics/xmag.jpg' alt="Searching Linpha"> + <font size='+1'><?php echo i18n("LinPHA Search Page"); ?></font> +<hr noshade> +<?php +if(isset($error)) +{ + echo "<div align='center'><b>"; + switch($error) + { + case 1: echo i18n("Search string to short, must be at least 2 characters long!"); break; + case 2: echo i18n("Error, please check input!"); break; + } + echo "</b><br /><br /></div>"; +} +?> + +<form name="searchform" method="POST" action="<?php echo LINPHA_DIR; ?>/?cat=search"> + <div class="searchcolumn"> + <!-- search text box //--> + <span class="leftmenulabel"><?php echo i18n("Search Keyword"); ?></span><br /> + <input type="text" name="search_text" style="width:180" value="<?php echo @$_REQUEST['search_text']; ?>"> + + <?php + // text and / or + if(isset($_REQUEST['text_and_or'])) + { + if($_REQUEST['text_and_or']=='AND') + { + $txt_checked_and = " checked"; + $txt_checked_or = ""; + } else { + $txt_checked_and = ""; + $txt_checked_or = " checked"; + } + } else { + $txt_checked_and = " checked"; + $txt_checked_or = ""; + } + ?> + <br /> + (<input type="radio" id="text_and_or_and" name="text_and_or" value="AND"<?php echo $txt_checked_and; ?>><label for="text_and_or_and"><?php echo i18n("AND"); ?></label> + <input type="radio" id="text_and_or_or" name="text_and_or" value="OR"<?php echo $txt_checked_or; ?>><label for="text_and_or_or"><?php echo i18n("OR"); ?></label>) + <br /><br /> + + <input type="checkbox" id="b_all" name="button[meta][all]" value="1"<?php echo isset($_REQUEST['button']['meta']['all']) ? ' checked' : ''; ?> onClick="check_all()"> + <label for="b_all"><b><?php echo i18n("All"); ?></b></label><br /> + + <input type="checkbox" id="b_name" name="button[meta][name]" value="1"<?php echo isset($_REQUEST['button']['meta']['name']) ? ' checked' : ''; ?>> + <label for="b_name"><?php echo i18n("Filename"); ?></label><br /> + + <input type="checkbox" id="b_cmt" name="button[meta][cmt]" value="1"<?php echo isset($_REQUEST['button']['meta']['cmt']) ? ' checked' : ''; ?>> + <label for="b_cmt"><?php echo i18n("Comments"); ?></label><br /> + + <?php + /** + * get text fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); + while($data = $query->FetchRow()) + { + echo '<input type="checkbox" id="b_'.$data['id'].'" name="button['.$data['id'].']" value="1"'.(isset($_REQUEST['button'][$data['id']]) ? ' checked' : '').'>'; + echo ' <label for="b_'.$data['id'].'">'.$data['name'].'</label><br />'; + } + + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + + /** + * Exif Informations + */ + if($GLOBALS['linpha']->sql->config->value['sys_image_exif']) + { + $MetaData->setFields('exif'); + $exif_count = $MetaData->defined_fields['exif']; + ?> + <br /><b><?php echo i18n("Search EXIF"); ?></b><br /> + <input type="checkbox" id="b_exif_all" name="button[exif][all]" value="1"<?php echo isset($_REQUEST['b_exif_all']) ? ' checked' : ''; ?> onClick="check_all()"> + <label for="b_exif_all"><b><?php echo i18n("All"); ?></b></label><br /> + <?php + for($i=1; list($key,$value) = each($MetaData->defined_fields['exif']); $i++) + { + echo '<input type="checkbox" id="b_exif_'.$i.'" name="button[exif]['.$key.']" value="1"'; + echo isset($_REQUEST['button_exif'][$key]) ? ' checked="checked">' : '>'; + echo '<label for="b_exif_'.$i.'">'.$value.'</label><br />'; + } + } + + /** + * Iptc Informations + + if($GLOBALS['linpha']->sql->config->value['sys_image_iptc']) + { + $MetaData->setFields('iptc'); + $iptc_count = $MetaData->defined_fields['iptc']; + ?> + <br /><b><?php echo i18n("Search IPTC"); ?></b><br /> + <input type="checkbox" id="b_iptc_all" name="b_iptc_all" value="1"<?php echo isset($_REQUEST['b_iptc_all']) ? ' checked' : ''; ?> onClick="check_all()"> + <?php + echo '<b>'.i18n("All").'</b><br />'; + + for($i=1; list($key,$value) = each($MetaData->defined_fields['iptc']); $i++) + { + echo '<input type="checkbox" id="b_iptc_'.$i.'" name="b_iptc_'.$value.'" value="1"'; + echo isset($_REQUEST['b_iptc_'.$value]) ? ' checked="checked">' : '>'; + echo translateIptcSearchTags($value, "single")."<br />"; + } + }*/ + ?> + <script language="JavaScript" type="text/javascript"> + function check_all(/*start,elem_name,elem_count*/) + { + /* for(var i = 1; i <= elem_count; i++) + { + elem = document.getElementById(elem_name+i); + elemall = document.getElementById(elem_name+'all'); + if(elemall.checked == true) { + elem.checked = true; + elem.disabled = true; + } else { + if(start != 'start') { + elem.checked = false; + elem.disabled = false; + } + } + }*/ + } + // run at startup to select all after startup + //check_all('start','b_',4); + <?php + if(isset($exif_count)) + { + // echo "check_all('start','b_exif_',".$exif_count.");"; + } + if(isset($iptc_count)) + { + //echo "check_all('start','b_iptc_',".$iptc_count.");"; + } + ?> + </script> + </div> + +<!-- select album //--> + <div class="searchcolumn"> + <span class='leftmenulabel'><?php echo i18n("Search In Album"); ?></span><br /> + <?php build_album_select($with_all_albs_entry=true); ?> + </div> + +<!-- date --> + <div class="searchcolumn"> + <!-- exif date --> + <span class='leftmenulabel'><?php echo i18n("Date"); ?> + <a class='FromTo' href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_from','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / + <a class='FromTo' href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_to','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> (Exif) + </span><br /> + + <input type='text' name='date_from[exif]' value='<?php echo @$_REQUEST['date_from']['exif']; ?>' style='width:80'> / + <input type='text' name='date_to[exif]' value='<?php echo @$_REQUEST['date_to']['exif']; ?>' style='width:80'><br /><br /> + + + + <?php + /** + * get date fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '3' AND (flags = '5' OR flags = '7')"); + while($data = $query->FetchRow()) + { + ?> + <span><?php echo $data['name']; ?> + <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_from','Calender','height=250,width=300,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("From"); ?></a> / + <a href="javascript:void(0);" onclick="var loginWin = window.open('<?php echo LINPHA_DIR; ?>/actions/calender.php?form=searchform.date_to','Calender','height=250,width=250,scrollbars=no,menubar=no,status=no');" target="_top"><?php echo i18n("To"); ?></a> + </span><br /> + <input type='text' name='date_from[<?php echo $data['id']; ?>]' value='<?php echo @$_REQUEST['date_from'][$data['id']]; ?>' style='width:80'> / + <input type='text' name='date_to[<?php echo $data['id']; ?>]' value='<?php echo @$_REQUEST['date_to'][$data['id']]; ?>' style='width:80'><br /><br /> + <?php + } + ?> + +<!-- Category --> + <?php + /** + * get select fields + */ + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE field_type = '2' AND (flags = '5' OR flags = '7')"); + while($data = $query->FetchRow()) + { + if($GLOBALS['linpha']->sql->isAdmin()) + { + $str_isprivate = ''; + } + else + { + $str_isprivate = " AND isprivate = '0'"; + } + + $sub_query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_category WHERE field_id = '".$data['id']."'".$str_isprivate." ORDER by name"); + + /** + * only show categories if they are at least one + */ + if( ! $sub_query->EOF ) + { + // category select + echo '<span>'.$data['name'].'</span><br />'."\n"; + + // and / or + if(isset($_REQUEST['select_and_or'][$data['id']])) + { + if($_REQUEST['select_and_or'][$data['id']]=='AND') + { + $checked_and = " checked"; + $checked_or = ""; + } else { + $checked_and = ""; + $checked_or = " checked"; + } + } else { + $checked_and = " checked"; + $checked_or = ""; + } + ?> + + <input type="radio" name="select_and_or[<?php echo $data['id']; ?>]" value="AND"<?php echo $checked_and; ?>><?php echo i18n("AND"); ?> + <input type="radio" name="select_and_or[<?php echo $data['id']; ?>]" value="OR"<?php echo $checked_or; ?>><?php echo i18n("OR"); ?><br /> + <select name="select[<?php echo $data['id']; ?>][]" size="5" style="width: 180px;" multiple="multiple"> + <?php + while($sub_data = $sub_query->FetchRow()) + { + echo '<option value="'.$sub_data['id'].'">'.$sub_data['name'].'</option>'; + } + ?> + </select><br /> + <font size="-2">(<?php echo i18n("Multiple Select Use 'Ctrl'"); ?>)</font><br /><br /> + <?php + } + } + ?> + </div> + <div style="clear: both;"></div> + +<!-- submit //--> + <div> + <input type="hidden" name="cmd" value="search"> + <input type="submit" class="button" name="sub" value=" <?php echo i18n("Search"); ?> "> + <a class="button" href="<?php echo LINPHA_DIR; ?>/?cat=search&cmd=new"><?php echo i18n("Reset"); ?></a> + </div> + + </form> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |