Exemple #1
0
<?php

include_once '../config/symbini.php';
include_once $serverRoot . '/classes/ActionManager.php';
include_once $serverRoot . '/classes/OccurrenceActionManager.php';
header("Content-Type: text/html; charset=" . $charset);
$aManager = new ActionManager();
$actionrequestid = null;
if (isset($_REQUEST['actionrequestid'])) {
    $actionrequestid = preg_replace('/[^0-9]/', '', $_REQUEST['actionrequestid']);
}
if (isset($_POST['formsubmit'])) {
    if ($aManager->saveChanges($_POST)) {
        $message = "Saved Changes";
    } else {
        $message = $aManager->getErrorMessage();
    }
    $actionrequestid = null;
    // go back to list
}
?>
<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $charset;
?>
">
		<title><?php 
echo $defaultTitle;
?>
 Action Requests</title>
Exemple #2
0
<?php

// Ajax responder to query for action requests
include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/ActionManager.php';
$requesttype = null;
$priority = null;
$state = null;
$collid = null;
$text = null;
$aManager = new ActionManager(null, 'readonly');
$raw = $_POST['query'];
// Convert to parsable json
$raw = "{ {$raw} }";
$raw = str_replace('\\"', '"', $raw);
$raw = str_replace("requesttype", '"requesttype"', $raw);
$raw = str_replace("state", '"state"', $raw);
$raw = str_replace("resolution", '"resolution"', $raw);
$raw = str_replace("priority", '"priority"', $raw);
$raw = str_replace("collid", '"collid"', $raw);
//TODO: text is coming in without a key, thus invalid json.
//$raw = str_replace("text",'"text"',$raw);
// TODO: Currently only handling the last instance of a particular key, allow multiple (connect with OR).
$query = json_decode($raw);
$requesttype = preg_replace("/[^a-zA-Z]/", "", $query->{'requesttype'});
$priority = preg_replace("/[^0-9]/", "", $query->{'priority'});
$state = preg_replace("/[^a-zA-Z]/", "", $query->{'state'});
$resolution = preg_replace("/[^a-zA-Z]/", "", $query->{'resolution'});
$collid = preg_replace("/[^0-9]/", "", $query->{'collid'});
$text = $query->{'text'};
// workaround for text as invalid json