Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I made an offsite calendar view of open issues

Karl Heinz Frankeser Jr.
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 20, 2018

If anyone is interested, I made a simple php script that returns a json array, and using fullcalendar.io i rendered it. this works in conjunction with a custom due date field I set up in my Jira instance.

getDates.php Code

<?php
header('Content-Type: application/json');
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://YOUR_COMPANY.atlassian.net/rest/api/2/search?jql=filter=(CUSTOM FILTER ID OF ALL OPEN ISSUES)",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Basic ENTER_YOUR_BASE64_ENCODED_API_TOKEN",
"Cache-Control: no-cache"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
exit();
} else {
$obj = json_decode($response);
}

class Event {}

$events = array();


foreach($obj->issues as $issue) {
if($issue->fields->customfield_10306 !== null) {
$e = new Event();
$e->id = $issue->id;
$e->title = "[" . $issue->key . "] " . $issue->fields->summary;
$e->url = "https://ticinocom.atlassian.net/browse/" . $issue->key;
$e->start = $issue->fields->(THIS IS THE DUE DATE CUSTOM FIELD);
$e->end = $issue->fields->(THIS IS THE DUE DATE CUSTOM FIELDcustomfield_10306;
$events[] = $e;
}
}



echo json_encode($events);



?>

Calendar.html Code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script
src="https://code.jquery.com/jquery-1.9.1.min.js"
integrity="sha256-wS9gmOZBqsqWxgIVgA8Y9WcQOa7PgSIX+rPA0VL2rbQ="
crossorigin="anonymous"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css" />
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.print.css" media="print"/>

<script src="https://momentjs.com/downloads/moment.min.js" type="text/javascript"></script>
<!-- daypilot libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js" type="text/javascript"></script>



<style>
#calendar {
max-width: 1500px;
margin: 40px auto;
}
</style>

<title>Jira Due Date Calendar</title>
</head>
<body>
<div id="calendar"></div>

<script type="text/javascript">
$(document).ready(function() {

// page is now ready, initialize the calendar...
$('#calendar').fullCalendar({
eventClick: function(eventObj) {

window.open(eventObj.url);

return false;
},

defaultView: 'month',
themeSystem: 'bootstrap4',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
events: 'getDates.php'
})

});

</script>
</body>
</html>

And there you have it a simple offsite calendar for open issues.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events