Location: PHPKode > projects > BugIn and Ticketing System > bugin-0.65/inc/search.inc.php
<?php
	if (isset($_REQUEST['submitSearch'])) {
		$_SESSION['listCol'] = "search";
		$_SESSION['sg'] = "search";
		$_SESSION['search'] = array();
		$_SESSION['view'] = "custom";
		$listArray[] = "category";
		$listArray[] = "owner";
		$listArray[] = "creator";
		$listArray[] = "project";
		$listArray[] = "priority";
		$listArray[] = "status";
		if (isset($_REQUEST['useDate']) && ($_REQUEST['useDate'])) {
			$begin = $_REQUEST['begin'];
			$end = $_REQUEST['end'];
			$mod['begin'] = "{$begin['year']}{$begin['month']}{$begin['day']}000000";
			$mod['end'] = "{$end['year']}{$end['month']}{$end['day']}235959";
		}
		$includeNum = 0;
		$likeNum = 0;
		reset($mod);

		while (list($key, $value) = each($mod)) {
			if ($value) {
				if (($key == "short_desc") || ($key == "long_desc")) {
					$ticketList['search']['search'][$key]["like"][$likeNum]["name"] = $key;
					$ticketList['search']['search'][$key]["like"][$likeNum]["value"] = $value;
					$likeNum ++;
				}
				elseif ($key == "begin") {
					$ticketList["search"]["search"][$key]["greaterthen"][$likeNum]["name"] = "date_added";
					$ticketList["search"]["search"][$key]["greaterthen"][$likeNum]["value"] = $value;
					$likeNum ++;
				}
				elseif ($key == "end") {
					$ticketList["search"]["search"][$key]["lessthen"][$likeNum]["name"] = "date_added";
					$ticketList["search"]["search"][$key]["lessthen"][$likeNum]["value"] = $value;
					$likeNum ++;
				}
				elseif (in_array($key, $listArray)) {
					if (is_array($value)) {
						while (list($junk, $data) = each($value)) { // Multiple values to search on...
							$ticketList["search"]["search"][$key]["include"][$likeNum]["name"] = $key;
							$ticketList["search"]["search"][$key]["include"][$likeNum]["value"] = $data;
							$likeNum ++;
						}
					}
					else { // Single value to search on...
						echo $value;
						$ticketList["search"]["search"][$key]["include"][$likeNum]["name"] = $key;
						$ticketList["search"]["search"][$key]["include"][$likeNum]["value"] = $value;
						$likeNum ++;
					}
				}
				else {
					echo $key;
				}
			}
		}

		if (isset($ticketList['search']))
			$_SESSION['lastSearch'] = $ticketList['search']['search'];
		include($options['buginIncBase']."/pre/list.pre.inc.php");
		include($options['buginIncBase']."/list.inc.php");
	}
	else {
		// Assemble the category list
		buginError("Generating category list", 1);
		$categories = generateOptionList($bugDatabase->lists['category']);

		// Assemble the project list
		buginError("Generating project list", 1);
		while (list($key, $value) = each($bugDatabase->lists['project'])) {
			if (($value['acl'][0] & ACL_READ) || ($value['acl'][$userinfo['uid']] & ACL_READ))
				$projs[$key] = $value;
		}
		$projects = generateOptionList($projs, "id", -1, "optionName");
		unset($projs);
		unset($key);
		unset($value);

		// Assemble the priority list
		buginError("Generating priority list", 1);
		$priority = generateOptionList($bugDatabase->lists['priority']);

		// Assemble the status list.
		buginError("Generating status list", 1);
		$status = generateOptionList($bugDatabase->lists['status']);

		// Assemble the owner (assigned to)
		buginError("Generating Owner list", 1);
		$users = "<option value=0>Unowned</option>\n";
		$users .= generateOptionList($bugDatabase->lists['user'], "uid");

		echo <<<EOT
		<form method="{$options['formMethod']}" action="{$options['baseURL']}{$options['formSubmitTo']}">
		<input type="hidden" name="area" value="search">
		<input type="hidden" name="submitSearch" value="1">
		<center>
		<table border=2>
			<tr bgcolor="{$options['colorTableHeaderBg']}" valign=top>
				<td colspan=4>
					<center><font color="{$options['colorTableHeaderText']}">{$verbage['search_in']}<b>
				</td>
			</tr>

			<tr bgcolor="{$options['colorTableBgAlt2']}" valign=top>
				<td colspan=2><b>{$verbage['short_description']}</b></td>
				<td><b>{$verbage['category']}</b></td>
				<td><b>{$verbage['status']}</b></td>
			</tr>
			<tr valign=top>
				<td colspan=2 >
					<input type="text" name="mod[short_desc]" size="60"></textarea>
				</td>
				<td rowspan=3>
					<select name=mod[category][] SIZE="10" MULTIPLE>
						$categories
					</select>
				</td>
				<td rowspan=3>
					<select name=mod[status][] SIZE="10" MULTIPLE>
						$status
					</select>
				</td>
			</tr>
			<tr bgcolor="{$options['colorTableBgAlt2']}" valign=top>
				<td colspan=2><b>{$verbage['long_description']}</b></td>
			</tr>
			<tr>
				<td colspan=2 align=left><input type="text" name="mod[long_desc]" size="60"></td>
			</tr>

			<tr bgcolor="{$options['colorTableBgAlt2']}" valign=top>
				<td><b>{$verbage['project']}</b></td>
				<td><b>{$verbage['priority']}</b></td>
				<td><b>{$verbage['assigned']}</b></td>
				<td><b>{$verbage['creator']}</b></td>
			</tr>
			<tr valign=top>
				<td>
					<select name=mod[project][] SIZE="10" MULTIPLE>
						$projects
					</select>
				</td>
				<td>
					<select name=mod[priority][] SIZE="10" MULTIPLE>
						$priority
					</select>
				</td>
				<td>
					<select name=mod[owner][] SIZE="10" MULTIPLE>
						$users
					</select>
				</td>
				<td align=right>
					<select name=mod[creator][] SIZE="10" MULTIPLE>
						$users
					</select>
				</td>
			</tr>

			</tr>
			<tr valign=top>
			</tr>

			<tr bgcolor="{$options['colorTableBgAlt2']}" valign=top>
				<td colspan="4"><b>{$verbage['search_date_select']}</b></td>
			</tr>
			<tr valign=top>
				<td colspan="6">
					<input type="checkbox" name="useDate" />{$verbage['search_date']}<br>
				</td>
			</tr>
				<td>
					{$verbage['search_date_begin']}
				</td>
				<td colspan="5">
EOT;
DateSelector("begin", time());

echo <<<EOT
				</td>
			</tr>
			<tr>
				<td>
					{$verbage['search_date_end']}
				</td>
				<td colspan="5">
EOT;

DateSelector("end", time());

echo <<<EOT
				</td>
			</tr>
			<tr>
				<td colspan="6">
					<input type="submit" value="{$verbage['search_in']}">
				</td>
			</tr>

		</table>
		</center>


		</form>

EOT;
	}

?>
Return current item: BugIn and Ticketing System