Пример #1
0
		<tr><th>Requestor</th></tr>
		<tr><td><input type=='text' name='requestor' id='requestor' /></td></tr>
		<tr><td><input type='submit' class='button' name='queryTicket' value='Submit Query' /></td></tr>
	</table>

	<table>
		<tr><th>Username</th></tr>
		<tr><td><input type='text' name='username' /></td></tr>
		<tr><td><input type='submit' class='button' name='queryUser' id='queryUser' value='Query User' /></td></tr>
	</table>
	<?php 
if (isset($_POST['queryTicket'])) {
    filterTickets();
} else {
    if (isset($_POST['queryUser'])) {
        filterUsers();
    }
}
// If user is not an admin, restrict search to tickets created by the user only
if (!isAdmin()) {
    $requestor = getUser();
    echo '<script>
			$("#requestor").val("' . $requestor . '");
			$("#requestor").attr("readonly", true);
			</script>';
}
?>


</form>
Пример #2
0
    echo file_get_contents("query.json");
    return;
}
$questions = getFormQuestions($db);
$questions = arrayIndexBy($questions, "id");
//debugVar("questions", true);
$portraitType = arrayExtract($params, "portrait");
//convert age to year_born
ageToYearBorn($db, $params);
$order = arrayExtract($params, "order");
$groupBy = arrayExtract($params, "group");
$interval = arrayExtract($params, "interval");
if (!$groupBy) {
    $results = demographicPortrait($db, $params, $portraitType);
    //$users = arrayDistinct($results, "username");
    $users = filterUsers($db, $params);
    arrayDistinct($results, "username");
    setExists($results);
    $results = array("all" => $results);
} else {
    //if groupBy is a profile question, translate group=gender => group=Q_0
    $questionsByField = arrayIndexBy($questions, "field_name");
    if (array_key_exists($groupBy, $questionsByField)) {
        $qid = $questionsByField[$groupBy]["id"];
        $groupBy = "Q_{$qid}";
    }
    $groups = getDistinctGroups($db, $params, $groupBy, $interval);
    $questionId = getQuestionId($groupBy);
    $form_answers = null;
    if ($questionId !== "") {
        $qtype = getQuestionType($questionId);