コード例 #1
0
ファイル: search.php プロジェクト: realityking/rsgallery2
function showResults()
{
    $database = JFactory::getDBO();
    //Retrieve search string
    $searchtext = rsgInstance::getVar('searchtext', '');
    //Check searchtext against database
    $sql = "SELECT *, a.name as itemname, a.id as item_id FROM #__rsgallery2_files as a, #__rsgallery2_galleries as b " . "WHERE a.gallery_id = b.id " . "AND (" . "a.title LIKE '%{$searchtext}%' OR " . "a.descr LIKE '%{$searchtext}%'" . ") " . "AND a.published = 1 " . "AND b.published = 1 " . "GROUP BY a.id " . "ORDER BY a.id DESC";
    $database->setQuery($sql);
    $result = $database->loadObjectList();
    //show results
    html_rsg2_search::showResults($result, $searchtext);
}
コード例 #2
0
    function showResults($result, $searchtext)
    {
        global $rsgConfig;
        html_rsg2_search::showSearchBox();
        //Format number of hits
        $count = count($result);
        $count = "<span style=\"font-weight:bold;\">" . $count . "</span>";
        ?>
		<table width="100%" style="border-bottom: thin solid #CCCCCC;">
		<tr>
			<td><div align="right"><a href="index.php?option=com_rsgallery2"><?php 
        echo JText::_('Main gallery page');
        ?>
</a></div></td>
		</tr>
		<tr>
			<td><h3><?php 
        echo JText::_('RSGallery2 Search Results');
        ?>
</h3></td>
		</tr>
		<tr>
			<td>
				<span style="font-style:italic;">
				<?php 
        echo JText::_('There are ') . $count . JText::_(' results for ');
        ?>
					<span style="font-weight:bold;";><?php 
        echo $searchtext;
        ?>
</span>
				<span>
			</td>
		</tr>
		</table>
		<br />
		<?php 
        if ($result) {
            foreach ($result as $match) {
                ?>
				<table width="100%" border="0" style="border-bottom: thin solid #CCCCCC;">
				<tr>
					<td width="<?php 
                echo $rsgConfig->get('thumb_width');
                ?>
">
					<div class="img-shadow">
						<a href="index.php?option=com_rsgallery2&page=inline&id=<?php 
                echo $match->item_id;
                ?>
">
						<img border="0" src="<?php 
                echo JURI_SITE . $rsgConfig->get('imgPath_thumb') . "/" . imgUtils::getImgNameThumb($match->itemname);
                ?>
" alt="image" />
						</a>
					</div>
					</td>
					<td valign="top">
						<a href="index.php?option=com_rsgallery2&page=inline&id=<?php 
                echo $match->item_id;
                ?>
">
							<span style="font-weight:bold;"><?php 
                echo galleryUtils::highlight_keywords($match->title, $searchtext);
                ?>
</span>
						</a>
						<p><?php 
                echo galleryUtils::highlight_keywords($match->descr, $searchtext);
                ?>
</p>
						<p style="color: #999999;font-size:10px;">
				[<?php 
                echo JText::_('Gallery name');
                ?>
:<a href="<?php 
                echo JRoute::_("index.php?option=com_rsgallery2&gid=" . $match->gallery_id);
                ?>
"><?php 
                echo $match->name;
                ?>
</a>]
							<?php 
                if ($match->userid > 0) {
                    echo "[" . JText::_('Owner') . ":&nbsp;" . galleryUtils::genericGetUsername($match->userid) . "]";
                }
                ?>
						</p>
					</td>
				</tr>
				</table>
				<br />
				<?php 
            }
        }
    }
コード例 #3
0
 function showSearchBox()
 {
     global $rsgConfig;
     if ($rsgConfig->get('displaySearch') != 0) {
         require_once JPATH_ROOT . "/components/com_rsgallery2/lib/rsgsearch/search.html.php";
         html_rsg2_search::showSearchBox();
     }
 }