/** * show the printable ticket list based on jql query */ public function tickets() { /** * get and check jql query */ $jql = trim($this->requestVars["post"]["jql"]); if (strlen($jql) == 0) { throw new Exception("Empty jql found."); } /** * create jira object and establish connection */ require_once dirname(__FILE__) . "/../Lib/Jira.php"; $jira = new Jira($this->requestVars["post"]["path"]); $jira->auth($this->requestVars["post"]["username"], $this->requestVars["post"]["password"]); /** * get tickets from jira */ $rawTickets = $jira->getIssuesByJql($jql); $tickets = array(); foreach ($rawTickets->issues as $ticket) { $tickets[] = $this->convertJiraIssueToArray($ticket); } /** * add epic names to tickets, if wanted */ if ($this->requestVars["post"]["epic"] == "1") { $tickets = $this->addEpicNames($tickets, $jira); } /** * return view vars */ return array("tickets" => $tickets); }
<?php $jira = new Jira('username', 'password'); $jira->getAvailableMethods(); // Get all available soap methods // list ALL ISSUES foreach ($projects as $project) { var_dump($jira->getIssuesForProject($project->key)); }
<!-- Remediation --> <?php $ticket_ids = Jira::get_jira_tickets_for_event($id); if ($ticket_ids['status'] == Jira::OK) { $ticket_ids = $ticket_ids['values']; } else { $ticket_ids = array(); } $jira_client = new JiraClient($curl_client); $jira_tickets = Jira::merge_jira_tickets($ticket_ids); $jira_keys = array_keys($jira_tickets); ?> <div class="row-fluid"> <legend>Remediation</legend> <div class="editable_hidden" style="display:none;"> <div id="jira-link"><a href="<?php echo $jira_client->getJiraBaseUrl(); ?> /secure/CreateIssue!default.jspa" target="_new">Create New Issue</a></div> <input type="text" placeholder="Enter JIRA key(s), separated by commas (i.e. CORE-2024, OPS-1453)" id="jira_key_input" name="jira_key_input" class="input-xxlarge" onblur="addTicket()"> </div> <table class="table table-striped"> <thead> <tr> <th>Key</th> <th>Summary</th> <th>Assignee</th> <?php foreach ($jira_client->getAdditionalIssueFields() as $k => $v) {
$app->response->status(201); $tickets = Jira::get_jira_tickets_for_event($id); if ($tickets["status"] == Jira::ERROR) { $app->response->status(404); return; } else { $tickets = Jira::merge_jira_tickets($tickets["values"]); echo json_encode($tickets); } } }); $app->get('/events/:id/tickets/:ticket', function ($id, $ticket) use($app) { header("Content-Type: application/json"); $tick = Jira::get_ticket($ticket); if ($tick["status"] == Jira::ERROR) { $app->response->status(404); return; } else { echo json_encode($tick["value"]); } }); $app->delete('/events/:id/tickets/:ticket', function ($id, $ticket) use($app) { header("Content-Type: application/json"); $res = Jira::delete_ticket($ticket); if ($res["status"] == Jira::ERROR) { $app->response->status(500); echo json_encode($res["error"]); } else { $app->response->status(204); } });
/** * @dataProvider xmlToTextProvider */ public function testXmlToText($xml, $expected) { $translator = new Jira(); $this->assertEquals($expected, $translator->xmlToText(decorateWithRootNode($xml))); }