break; case 'resolution': callback(['', 'Fixed', 'WorksForMe', 'WontFix', 'Duplicate']); break; case 'requesttype': callback(['Image', 'ReplaceImage', 'ReproductiveState']); break; } } ) } // end callbacks }); // end VS.init }); </script> <div id='results'> <?php $actionArr = $aManager->queryActionRequestsObjArr(null, null, 'New', null, null, null); echo $aManager->getErrorMessage(); foreach ($actionArr as $action) { echo "<a href='index.php?actionrequestid={$action->actionrequestid}'>Request for {$action->requesttype}</a> on " . $action->getLinkToRow() . " by {$action->requestor} on {$action->requestdate} {$action->requestremarks}, Priority: P{$action->priority}, State:{$action->state} {$action->resolution} {$action->statesetdate} {$action->resolutionremarks} {$action->fullfillor} </br>\n"; } ?> </div> <div style="clear:both;"> </div> </div> <?php // end if list action requests } else { // begin if edit action request ?> <form action='index.php' method='POST'> <ul><li>Edit Action Request</li></ul>
//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 if ($query == null) { $text = $_POST['query']; } // run query $actionArr = $aManager->queryActionRequestsObjArr($requesttype, $priority, $state, $resolution, $collid, $text); // Report what the query was interpreted as: if (strlen($priority) > 0) { $priority = "Priority:P{$priority}"; } if (strlen($state) > 0) { $state = "State:{$state}"; } if (strlen($resolution) > 0) { $resolution = "Resolution:{$resolution}"; } if (strlen($requesttype) > 0) { $requesttype = "RequestFor:{$requesttype}"; } if (strlen($text) > 0) { $text = "Text:{$text}";