Is it possible to add a search function in piCal? when the event more and more, we should have a search function, then we can find data quickly.
hi flyaway.
Do you know "search" of XOOPS?
Since I implemented global search function into piCal, you can find events by using "search box".
Sorry... since i am a newbie of xoops, pardon for this stupid question.
Actually.. The thing I would like it to "search" for is the poster. "Search by Username". could you make this possible? thank you.
what im looking for is maybe a search in my album-p module for username, that allows u to search for pictures posted by the user.
replace include/search.inc.php
<?php
if( ! defined( 'XOOPS_ROOT_PATH' ) ) exit ;
$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
if( ! preg_match( '/^myalbum\d*$/' , $mydirname ) ) die ( "invalid dirname of myalbum: " . htmlspecialchars( $mydirname ) ) ;
eval( '
function '.$mydirname.'_search( $keywords , $andor , $limit , $offset , $userid )
{
global $xoopsDB ;
include( XOOPS_ROOT_PATH."/modules/'.$mydirname.'/include/read_configs.php" ) ;
$sql = "SELECT l.lid,l.cid,l.title,l.submitter,l.date,t.description FROM $table_photos l LEFT JOIN $table_text t ON t.lid=l.lid LEFT JOIN ".$xoopsDB->prefix("users")." u ON l.submitter=u.uid WHERE status>0" ;
if( $userid > 0 ) {
$sql .= " AND l.submitter=".$userid." ";
}
$whr = "" ;
if( is_array( $keywords ) && count( $keywords ) > 0 ) {
$whr = "AND (" ;
switch( strtolower( $andor ) ) {
case "and" :
foreach( $keywords as $keyword ) {
$whr .= "CONCAT(l.title,\' \',t.description,\' \',u.uname) LIKE \'%$keyword%\' AND " ;
}
$whr = substr( $whr , 0 , -5 ) ;
break ;
case "or" :
foreach( $keywords as $keyword ) {
$whr .= "CONCAT(l.title,\' \',t.description,\' \',u.uname) LIKE \'%$keyword%\' OR " ;
}
$whr = substr( $whr , 0 , -4 ) ;
break ;
default :
$whr .= "CONCAT(l.title,\' \',t.description,\' \',u.uname) LIKE \'%{$keywords[0]}%\'" ;
break ;
}
$whr .= ")" ;
}
$sql = "$sql $whr ORDER BY l.date DESC";
$result = $xoopsDB->query( $sql , $limit , $offset ) ;
$ret = array() ;
while( $myrow = $xoopsDB->fetchArray($result) ) {
$ret[] = array(
"image" => "images/pict.gif" ,
"link" => "photo.php?lid=".$myrow["lid"] ,
"title" => $myrow["title"] ,
"time" => $myrow["date"] ,
"uid" => $myrow["submitter"]
) ;
}
return $ret;
}
' ) ;
?>
This code is a part of next version.