<?php
/*
* KB Search - metadata Interface
*
* Copyright (c) 2003-4 St. Christopher House
*
* Developed by The Working Group Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @version $Id: kbSearch-core.php,v 1.7 2005/01/25 21:15:00 derekbrooks Exp $
*
*/
require_once "HTML/Form.php";
$form = new HTML_Form('');
//*******************************************************
// prepare variables for basic search
$searchTitle = (!isset($_REQUEST['searchTitle'])) ? '' : $_REQUEST['searchTitle'];
$searchModtypes = (!isset($_REQUEST['searchModtypes'])) ? array() : $_REQUEST['searchModtypes'];
$searchRoles = (!isset($_REQUEST['searchRoles'])) ? array() : $_REQUEST['searchRoles'];
$searchLang = (!isset($_REQUEST['searchLang'])) ? '' : $_REQUEST['searchLang'];
?>
<style type="text/css">
.grFormContext {
display: none;
}
</style>
<fieldset class="kbSearchFieldset" id="kbSearchBasic" style="display: none;">
<legend accesskey="b">Basic KB Search</legend>
<div class="grRow">
<span class="grFormLabel"><label for="searchTitle">Title:</label> </span>
<input type="text" class="grFormElement" id="searchTitle" name="searchTitle" size="30" maxlength="128" value="<?php echo $searchTitle; ?>" />
</div>
<br/>
<div class="grDoubleRow">
<div class="grHalfRow">
<span class="grFormLabel"><label for="searchModtype"><i>Content type</i></label></span>
</div>
<?php
$db = &Cln_Db::singleton(MAIN_CLN_DSN);
if(count($this->excludedModules) > 0) {
$additionOptions = sprintf('AND modId NOT IN (%s)', join(',',$this->excludedModules));
}
$sql = sprintf("SELECT modId, modName FROM `%s`"
." WHERE visible = 1 %s"
." ORDER BY modName",
MODULE_TABLE, $additionOptions);
$result = $db->query($sql);
if(PEAR::isError($result)) {
PEAR::raiseError("Couldn't get modules info", E_WARNING);
return FALSE;
} else {
while ($module = $result->fetchRow(DB_FETCHMODE_OBJECT)) {
$modTypes[($module->modId)] = $module->modName;
}
}
foreach($modTypes as $modId => $modType) {
if(in_array($modId,$searchModtypes)) {
$checked = TRUE;
} else {
$checked = FALSE;
}
?>
<div class="grHalfRow">
<span class="grFormLabel"><label for="searchModtypes[]"><?php echo $modType; ?></label></span>
<?php $form->displayCheckbox("searchModtypes[]", $checked, 'value="'.$modId.'"'); ?>
</div>
<?php
}
?>
</div>
<div class="grDoubleRow">
<div class="grHalfRow">
<span class="grFormLabel"><label for="searchRole"><i>My Role</i></label></span></span>
</div>
<?php
$roles = array(
'creator' => 'creator',
'owner' => 'owner',
'publisher' => 'publisher',
'collaborator' => 'collaborator',
'viewer' => 'viewer'
);
foreach($roles as $roleId => $role) {
if(in_array($roleId,$searchRoles)) {
$checked = TRUE;
} else {
$checked = FALSE;
}
?>
<div class="grHalfRow"><span class="grFormLabel"><label for="searchRoles"><?php echo $role; ?></label></span>
<?php $form->displayCheckbox("searchRoles[]", $checked, 'value="'.$roleId.'" class="grFormElement" id="searchRoles['.$modId.']"'); ?>
</div>
<?php
}
?>
</div>
</fieldset>
<?php
//*******************************************************
// prepare variables
$searchCreatedBy = (!isset($_REQUEST['searchCreatedBy'])) ? '' : $_REQUEST['searchCreatedBy'];
$searchCreationStartDate = (!isset($_REQUEST['searchCreationStartDate'])) ? '' : $_REQUEST['searchCreationStartDate'];
$searchCreationFinishDate = (!isset($_REQUEST['searchCreationFinishDate'])) ? '' : $_REQUEST['searchCreationFinishDate'];
?>
<fieldset class="kbSearchFieldset" id="kbSearchCreated" style="display: none;">
<legend accesskey="c">Created by Who, and When</legend>
<div class="grRow">
<span class="grFormLabel"><label for="searchCreatedBy">Created by:</label></span>
<input type="text" class="grFormElement" id="searchCreatedBy" name="searchCreatedBy" size="30" maxlength="40" value="<?php echo $searchCreatedBy; ?>" />
</div>
<p class="grFormContext">.</p>
<style type="text/css">@import url(<?php echo CLN_CLEAN_URL_BASE . 'modules/EventCalendar/interfaces/jscalendar/'; ?>calendar-green.css);</style>
<script type="text/javascript" src="<?php echo CLN_CLEAN_URL_BASE . 'modules/EventCalendar/interfaces/jscalendar/'; ?>calendar.js"></script>
<script type="text/javascript" src="<?php echo CLN_CLEAN_URL_BASE . 'modules/EventCalendar/interfaces/jscalendar/'; ?>lang/calendar-en.js"></script>
<script type="text/javascript" src="<?php echo CLN_CLEAN_URL_BASE . 'modules/EventCalendar/interfaces/jscalendar/'; ?>calendar-setup.js"></script>
<div class="grRow">
<span class="grFormLabel"><label>Created After: (yyyy/mm/dd)</label></span>
<input class="grFormElement" type="text" id="searchCreationStartDate" name="searchCreationStartDate" size="10" maxlength="10" value="<?php echo $searchCreationStartDate; ?>" /><button id="chooseCreationStartDate">Choose...</button>
</div>
<script type="text/javascript">
Calendar.setup(
{
inputField : "searchCreationStartDate", // ID of the input field
ifFormat : "%Y/%m/%d", // the date format
button : "chooseCreationStartDate", // ID of the button
weekNumbers : false
}
);
</script>
<div class="grRow">
<span class="grFormLabel"><label for="searchCreationFinishDate">Created Before: (yyyy/mm/dd)</label></span>
<input class="grFormElement" type="text" id="searchCreationFinishDate" name="searchCreationFinishDate" size="10" maxlength="10" value="<?php echo $searchCreationFinishDate; ?>" /><button id="chooseCreationFinishDate">Choose...</button>
</div>
<script type="text/javascript">
Calendar.setup(
{
inputField : "searchCreationFinishDate", // ID of the input field
ifFormat : "%Y/%m/%d", // the date format
button : "chooseCreationFinishDate", // ID of the button
weekNumbers : false
}
);
</script>
</fieldset>
<?php
//*******************************************************
// prepare variables
$searchModifiedBy = (!isset($_REQUEST['searchModifiedBy'])) ? '' : $_REQUEST['searchModifiedBy'];
$searchModificationStartDate = (!isset($_REQUEST['searchModificationStartDate'])) ? '' : $_REQUEST['searchModificationStartDate'];
$searchModificationFinishDate = (!isset($_REQUEST['searchModificationFinishDate'])) ? '' : $_REQUEST['searchModificationFinishDate'];
?>
<fieldset class="kbSearchFieldset" id="kbSearchModified" style="display: none;">
<legend accesskey="m">Last Changed by Who, and When</legend>
<div class="grRow">
<span class="grFormLabel"><label for="searchModifiedBy">Modified by:</label></span>
<input type="text" class="grFormElement" id="searchModifiedBy" name="searchModifiedBy" size="30" maxlength="40" value="<?php echo $searchModifiedBy; ?>" />
</div>
<div class="grRow">
<span class="grFormLabel"><label for="searchModificationStartDate">Lasy Modified After (yyyy/mm/dd)</label></span>
<input type="text" class="grFormElement" id="searchModificationStartDate" name="searchModificationStartDate" size="10" maxlength="10" value="<?php echo $searchModificationStartDate; ?>" /><button id="chooseModificationStartDate">Choose...</button>
</div>
<script type="text/javascript">
Calendar.setup(
{
inputField : "searchModificationStartDate", // ID of the input field
ifFormat : "%Y/%m/%d", // the date format
button : "chooseModificationStartDate", // ID of the button
weekNumbers : false
}
);
</script>
<div class="grRow">
<span class="grFormLabel"><label>Last Modified Before (yyyy/mm/dd)</label></span>
<input type="text" class="grFormElement" id="searchModificationFinishDate" name="searchModificationFinishDate" size="10" maxlength="10" value="<?php echo $searchModificationFinishDate; ?>" /><button id="chooseModificationFinishDate">Choose...</button>
</div>
<script type="text/javascript">
Calendar.setup(
{
inputField : "searchModificationFinishDate", // ID of the input field
ifFormat : "%Y/%m/%d", // the date format
button : "chooseModificationFinishDate", // ID of the button
weekNumbers : false
}
);
</script>
</fieldset>