Commit a2846eae by aagusti

1st commit

0 parents
<?php
// $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]/";
$key = 'a9960d785e22df5c053541adeb2aabc3';
$groupnm = '';
$groupid = '';
$userid = '';
$token = '';
if(isset($_GET['userid']) && $_GET['userid'] != '' && isset($_GET['groupid']) && $_GET['groupid'] != '' && isset($_GET['token']) && $_GET['token'] != '') {
$groupnm = $_GET['groupnm'];
$groupid = $_GET['groupid'];
$userid = $_GET['userid'];
$token = $_GET['token'];
$url_orgs = "https://api.trello.com/1/members/{$userid}?fields=username,fullName,url&boards=all&board_fields=name&organizations=all&organization_fields=displayName&&key=$key&token=$token";
$response = @file_get_contents($url_orgs, false, null);
if($response === FALSE) {
header("Location: $url");
die();
} else {
// header('Content-type: application/json');
// echo $response;
// die();
}
$response = json_decode($response);
} else {
header("Location: $url");
die();
}
// die();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Show only my trello cards">
<meta name="author" content="irul@20170411">
<link rel="icon" href="favicon.ico">
<title><?=ucwords($response->fullName);?>'s Task</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
body {
padding-bottom: 50px;
}
.affix {
top: 20px;
}
@media (min-width: 992px) {
.affix {
position: fixed;
width: inherit;
}
}
@media (max-width: 991px) {
.affix {
position: static;
}
}
small code {
padding: 0px !important;
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1><a href="/"><?=ucwords($response->fullName);?>'s Task</a>
<small>Do an easy and affordable task first.</small>
</h1>
</div>
<h3><?=$groupnm;?> Cards: </h3>
<div class="row">
<div class="col-md-8">
<?php
$url_orgs = "https://api.trello.com/1/organizations/{$groupid}/members/{$userid}/cards?actions=createCard,commentCard&fields=id,name,desc,dateLastActivity,shortUrl&board=true&board_fields=id,name&list=true&list_fields=id,name&key=$key&token=$token";
$response = file_get_contents($url_orgs, false, null);
$cinfo = array();
$cards = json_decode($response);
echo '<ol>';
foreach ($cards as $card) {
echo '<li data-list="', $card->list->id, '" data-board="', $card->board->id,
'" list-name="', strtoupper(str_replace(' ', '', $card->list->name)), '">';
echo '<h4><a href="', $card->shortUrl, '" target="_blank">', $card->name, '</a><br>',
//(trim($card->desc) != '' ? '<small>' . nl2br($card->desc) . '</small>' : ''), '</h4>';
(trim($card->desc) != '' ? '<small><code>' . nl2br(str_replace('`', '', $card->desc)) . '</code></small>' : ''), '</h4>';
echo '<span class="label label-default">',
'<a name="boards" id="', $card->board->id ,'"href="#" style="color: #fff;">', strtoupper($card->board->name), '</a></span> ';
echo '<span class="label ' .
(strtoupper(str_replace(' ', '', $card->list->name)) == 'TODO' ? 'label-danger' :
(strtoupper(str_replace(' ', '', $card->list->name)) == 'DOING' ? 'label-warning' :
(strtoupper(str_replace(' ', '', $card->list->name)) == 'STAGING' ? 'label-primary' :
(strtoupper(str_replace(' ', '', $card->list->name)) == 'CHECKING' ? 'label-info' : 'label-success')))) . '">',
'<a name="lists" id="', strtoupper(str_replace(' ', '', $card->list->name)) ,'"href="#" style="color: #fff;">',
strtoupper(str_replace(' ', '', $card->list->name)), '</a></span> ';
//echo '<span class="label label-default">', date('Y-m-d', strtotime($card->dateLastActivity)), '</span> ';
$comments = array();
$comments = $card->actions;
if (count($comments)) {
echo '<br>';
foreach ($comments as $comment) {
echo '<small><strong><span class="text-danger"># <span class="text-muted">'.date('Y-m-d H:i:s', strtotime($comment->date)).
'</span> <span class="text-uppercase">'. $comment->memberCreator->fullName.'</span> : </span>'.
'</strong> '. ($comment->data->text ? $comment->data->text : 'Create task.') .'</small><br>';
}
}
echo '</li>';
$info = array(
'list' => $card->list,
'board' => $card->board,
);
$cinfo[] = $info;
}
echo '</ol>';
?>
</div>
<div class="col-md-4">
<blockquote class="blockquote" data-spy="affix" data-offset-top="200">
<!--a href="/" class="btn btn-sm btn-default" style="margin-bottom: 2px;">HOME</a-->
<button class="btn btn-sm btn-default" style="margin-bottom: 2px;" id="btn_reset">
ALL CARDS <span class="badge">RESET</span>
</button>
<!--br><br-->
<div data-toggle="buttons">
<?php
$cinfo = array_map("unserialize", array_unique(array_map("serialize", $cinfo)));
// $cinfo = array_unique($cinfo);
// sorting
array_multisort(array_map(function($elements) {
return $elements['board']->name;
}, $cinfo), SORT_ASC, $cinfo);
foreach ($cinfo as $info) {
$list = $info['list'];
$board = $info['board'];
echo '<label class="btn btn-sm ',
(strtoupper(str_replace(' ', '', $list->name)) == 'TODO' ? 'btn-danger' :
(strtoupper(str_replace(' ', '', $list->name)) == 'DOING' ? 'btn-warning' :
(strtoupper(str_replace(' ', '', $list->name)) == 'STAGING' ? 'btn-primary' :
(strtoupper(str_replace(' ', '', $list->name)) == 'CHECKING' ? 'btn-info' : 'btn-success')))),
'" style="margin-bottom: 2px;">';
echo '<input type="radio" name="options" id="', $list->id, '">',strtoupper($board->name),
' <span class="badge">', strtoupper(str_replace(' ', '', $list->name)), '</span> ',
'</input>';
echo '</label><br>';
}
?>
</div>
</blockquote>
</div>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
function uncheck_radio() {
$("input:radio").closest("label").removeClass("active");
$("input:radio").prop('checked', false);
}
$("#btn_reset").click(function() {
uncheck_radio();
$("li").each(function(i, obj) {
$(this).removeClass('hide');
});
});
$("input[name='options']").on('change', function () {
$("li").each(function(i, obj) {
$(this).addClass('hide');
});
var list_id = $(this).attr('id');
$("li[data-list='"+list_id+"'").each(function(i, obj) {
$(this).removeClass('hide');
});
});
$("a[name='boards']").on('click', function (event) {
uncheck_radio();
event.preventDefault();
$("li").each(function(i, obj) {
$(this).addClass('hide');
});
var board_id = $(this).attr('id');
$("li[data-board='"+board_id+"'").each(function(i, obj) {
$(this).removeClass('hide');
});
});
$("a[name='lists']").on('click', function (event) {
uncheck_radio();
event.preventDefault();
$("li").each(function(i, obj) {
$(this).addClass('hide');
});
var list_name = $(this).attr('id');
$("li[list-name='"+list_name+"'").each(function(i, obj) {
$(this).removeClass('hide');
});
});
</script>
</body>
</html>
No preview for this file type
<?php
// $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]/";
$key = 'a9960d785e22df5c053541adeb2aabc3';
$token = '';
if(isset($_GET['token']) && $_GET['token'] != '') {
$token = $_GET['token'];
$url_orgs = "https://api.trello.com/1/members/me?fields=username,fullName,url&boards=all&board_fields=name&organizations=all&organization_fields=displayName&key=$key&token=$token";
$response = @file_get_contents($url_orgs, false, null);
if($response === FALSE) {
header("Location: $url");
die();
} else {
// header('Content-type: application/json');
// echo $response;
// die();
}
$response = json_decode($response);
} else {
header("Location: $url");
die();
}
// die();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Show only my trello cards">
<meta name="author" content="irul@20170411">
<link rel="icon" href="favicon.ico">
<title><?=ucwords($response->fullName);?>'s Task</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
body {
padding-bottom: 50px;
}
.affix {
top: 20px;
}
@media (min-width: 992px) {
.affix {
position: fixed;
width: inherit;
}
}
@media (max-width: 991px) {
.affix {
position: static;
}
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1><a href="/"><?=ucwords($response->fullName);?>'s Task</a>
<small>Responsible and focus on the task given.</small>
</h1>
</div>
<h3>Groups:</h3>
<?php
$url_members = "https://api.trello.com/1/members/me?fields=username&organizations=all&organization_fields=displayName,desc,idBoards,memberships,url&key=$key&token=$token";
$response = file_get_contents($url_members, false, null);
$members = json_decode($response);
$groups = $members->organizations;
echo '<ol>';
foreach ($groups as $group) {
$cntBoards = count($group->idBoards);
$cntMembers = count($group->memberships);
echo '<li data-list="', $group->id, '">',
'<h4><a href="/cards.php?groupnm=' . $group->displayName . '&groupid='. $group->id . '&userid=' . $members->id . '&token=' . $token . '">', $group->displayName, '</a><br>',
(trim($group->desc) != '' ? '<small>' . nl2br($group->desc) . '</small>' : ''),
'</h4>',
'<span class="label label-info">Boards: ', $cntBoards, '</span> ',
'<span class="label label-warning">Members: ', $cntMembers, '</span> ',
'<span class="label label-danger"><a href="', $group->url, '" target="_blank" style="color: #fff;">Group Info</a></span> ';
echo '</li>';
}
echo '</ol>';
?>
</div><!-- /.container -->
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Show only my trello cards">
<meta name="author" content="irul@20170411">
<link rel="icon" href="favicon.ico">
<title>iRUL's Task</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style>
body {
padding-bottom: 50px;
}
.affix {
top: 20px;
}
@media (min-width: 992px) {
.affix {
position: fixed;
width: inherit;
}
}
@media (max-width: 991px) {
.affix {
position: static;
}
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>iRUL's Task
<small>Responsible and focus on the task given.</small>
</h1>
</div>
</div><!-- /.container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://api.trello.com/1/client.js?key=a9960d785e22df5c053541adeb2aabc3"></script>
<script type="text/javascript">
var authenticationSuccess = function() {
console.log('Successful authentication');
var token = Trello.token();
window.location.replace("/groups.php?token=" + token);
};
var authenticationFailure = function() { console.log('Failed authentication'); };
Trello.authorize({
type: 'redirect',
name: 'iRUL\'s Task',
// persist: 'false',
// interactive: 'true',
scope: {
read: 'true',
write: 'true' },
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});
</script>
</body>
</html>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!