Commit a91f2bb1 authored by amette's avatar amette

Allow searching in name and description of found tagged objects

parent b6f8a896
......@@ -113,7 +113,7 @@ class FreetagLib extends ObjectLib {
*
* @return An array of Object ID numbers that reference your original objects.
*/
function get_objects_with_tag($tag, $type='', $user='', $offset = 0, $maxRecords = -1) {
function get_objects_with_tag($tag, $type='', $user='', $offset = 0, $maxRecords = -1, $find) {
if(!isset($tag)) {
return false;
}
......@@ -131,6 +131,12 @@ class FreetagLib extends ObjectLib {
$mid .= " AND `type` = ?";
$bindvals[] = $type;
}
if (isset($find) && !empty($find)) {
$findesc = '%' . $find . '%';
$mid .= " AND (o.`name` like ? OR o.`description` like ?)";
$bindvals = array_merge($bindvals, array($findesc, $findesc));
}
$query = "SELECT DISTINCT o.* ";
$query_cant = "SELECT COUNT(*) ";
......
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-browse_freetags.tpl,v 1.11 2006-01-27 16:22:34 amette Exp $ *}
{* $Header: /cvsroot/tikiwiki/tiki/templates/tiki-browse_freetags.tpl,v 1.12 2006-01-27 17:14:55 amette Exp $ *}
{if $feature_ajax eq 'y'}
<script src="lib/cpaint/cpaint2.inc.compressed.js" type="text/javascript"></script>
......@@ -138,7 +138,12 @@
<h3>{$cantobjects} {tr}results found{/tr}</h3>
{if $cantobjects > 0}
<table class="normal">
<form action="tiki-browse_freetags.php" method="get">
<input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
<input type="hidden" name="tag" value="{$tag|escape}" />
{tr}Find:{/tr} <input type="text" name="find" /> <input type="submit" />
</form>
<table class="normal">
{cycle values="odd,even" print=false}
{section name=ix loop=$objects}
<tr class="{cycle}" >
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.5 2005-12-15 23:46:12 amette Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.6 2006-01-27 17:14:53 amette Exp $
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
//
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.5 2005-12-15 23:46:12 amette Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-browse_freetags.php,v 1.6 2006-01-27 17:14:53 amette Exp $
//
// Initialization
......@@ -45,6 +45,12 @@ if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = $_REQUEST["sort_mode"];
}
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
if (!isset($_REQUEST["offset"])) {
......@@ -73,7 +79,7 @@ if (isset($_REQUEST["user_only"]) && $_REQUEST["user_only"] == 'on') {
$smarty->assign('tag', $_REQUEST['tag']);
$objects = $freetaglib->get_objects_with_tag($_REQUEST['tag'], $type, $view_user, $offset, $maxRecords); //, $sort_mode, $find);
$objects = $freetaglib->get_objects_with_tag($_REQUEST['tag'], $type, $view_user, $offset, $maxRecords, $find); //, $sort_mode);
$smarty->assign_by_ref('objects', $objects["data"]);
$smarty->assign_by_ref('cantobjects', $objects["cant"]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment