Example #1
0
function efJIRARender($input, $args, $parser)
{
    global $JIRAs, $JIRAdefault;
    try {
        if (isset($args['jira'])) {
            $which = $args['jira'];
        } else {
            $which = $JIRAdefault;
        }
        $jira = new SoapClient($JIRAs[$which]['url']);
        $auth = $jira->login($JIRAs[$which]['user'], $JIRAs[$which]['password']);
        $info = $jira->getServerInfo($auth);
        $url = $info->baseUrl;
        if (isset($args['projects'])) {
            $projs = array_map('trim', explode(',', $args['projects']));
            $issues = $jira->getIssuesFromTextSearchWithProject($auth, $projs, $input, 100);
        } else {
            $issues = $jira->getIssuesFromTextSearch($auth, $input);
        }
        $statuses = $jira->getStatuses($auth);
        $priorities = $jira->getPriorities($auth);
        $resolutions = $jira->getResolutions($auth);
        $fields = array('status' => $statuses, 'priority' => $priorities, 'resolution' => $resolutions, 'url' => $url);
        $s = "<table border='1' cellspacing='0'><tr><th>Key</th><th>Summary</th><th>Status</th><th>Pri</th><th>Res</th><th>Assignee</th></tr>";
        foreach ($issues as $issue) {
            $s .= JIRAformatOneIssue($jira, $auth, $fields, $issue);
        }
        $s .= "</table>";
        return $s;
    } catch (Exception $e) {
        return htmlspecialchars($e->getMessage());
    }
}