Пример #1
0
$fh = fopen("http://api.uptimerobot.com/getMonitors?apiKey={$GLOBALS['CONFIG']['UPTIME_TOKEN']}&format=json&customUptimeRatio=7-30-365&logs=1", 'r');
$response = stream_get_contents($fh);
fclose($fh);
$response = json_decode(str_replace(array('jsonUptimeRobotApi(', ')'), array('', ''), $response), true);
foreach ($response['monitors']['monitor'] as $m) {
    if ($m['id'] == '776561059') {
        $expl = explode('-', $m['customuptimeratio']);
        $up7 = $expl[0];
        $up30 = $expl[1];
        $up365 = $expl[2];
        $status = $m['status'];
        $logs = $m['log'];
    }
}
require_once 'as/status/vendor/autoload.php';
$client = new Redmine\Client('https://projets.anotherservice.com', 'admin', $GLOBALS['CONFIG']['REDMINE_TOKEN']);
$issues = $client->api('issue')->all(array('project_id' => 'maintenances'));
$issues = $issues['issues'];
$content = "\n\t\t<div class=\"head\" style=\"background-color: " . ($status != 2 ? "#ca0101" : "#7bbb51") . "; background-image: url('/{$GLOBALS['CONFIG']['SITE']}/images/dotgrid-black.png'); margin-bottom: 0;\">\n\t\t\t<br />\n\t\t\t<h1>" . ($status != 2 ? "{$lang['offline']}" : "{$lang['online']}") . "</h1>\n\t\t\t<h2 style=\"margin: 15px 0 15px 0; color: #ffffff;\">" . date('M d Y H:i') . "</h2>\n\t\t\t<div style=\"width: 800px; margin: 0 auto; color: #ffffff; text-align: center; font-size: 14px; line-height: 20px;\">\n\t\t\t\t{$lang['monitor']}\n\t\t\t</div>\n\t\t\t<div style=\"margin: 0 auto; margin-top: 20px; width: 1100px; text-align: center;\">\n\t\t\t</div>\n\t\t\t<div class=\"clear\"></div>\n\t\t\t<br /><br />\n\t\t\t<div style=\"margin: 0 auto; width: 1100px;\">\n\t\t\t\t<div style=\"float: left;\">\n\t\t\t\t\t<div class=\"filluptimeout\">\n\t\t\t\t\t\t<div class=\"filluptime\" style=\"width: {$up30}%;\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<span style=\"color: #ffffff; text-align: center; display: block; margin: 0 auto; margin-top: 5px; font-size: 14px;\">{$lang['30days']} <span style=\"font-weight: bold;\">{$up30}%</span></span>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"float: right;\">\n\t\t\t\t\t<div class=\"filluptimeout\">\n\t\t\t\t\t\t<div class=\"filluptime\" style=\"width: {$up365}%;\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<span style=\"color: #ffffff; text-align: center; display: block; margin: 0 auto; margin-top: 5px; font-size: 14px;\">{$lang['365days']} <span style=\"font-weight: bold;\">{$up365}%</span></span>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"clear\"></div>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"clear\"></div>\t\t\n\t\t<div class=\"content\">\n\t\t\t<h3 style=\"color: #a4a4a4;\">{$lang['issues']}</h3>\n\t\t\t<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th style=\"color: #a4a4a4; text-align: center; width: 40px;\">#</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['type']}</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['title']}</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['priority']}</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['date']}</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['status']}</th>\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['updated']}</th>\n\t\t\t\t</tr>\n";
if (count($issues) > 0) {
    foreach ($issues as $i) {
        $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td style=\"text-align: center; width: 40px;\"><a href=\"https://projets.anotherservice.com/issues/{$i['id']}\"><img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/issue.png\" /></a></td>\n\t\t\t\t\t<td>" . $lang['tracker_' . $i['tracker']['id']] . "</td>\n\t\t\t\t\t<td><a href=\"https://support.anotherservice.com/issues/{$i['id']}\">{$i['subject']}</a></td>\n\t\t\t\t\t<td>" . $lang['priority_' . $i['priority']['id']] . "</td>\n\t\t\t\t\t<td>" . date($lang['dateformatsimple'], strtotime($i['start_date'])) . "</td>\n\t\t\t\t\t<td>" . $lang['status2_' . $i['status']['id']] . "</td>\n\t\t\t\t\t<td>" . date($lang['dateformat'], strtotime($i['updated_on'])) . "</td>\n\t\t\t\t</tr>\n\t\t";
    }
}
$content .= "\n\t\t\t</table>\n\t\t\t<br /><br />\n\t\t\t<div style=\"float: left; width: 500px;\">\n\t\t\t\t<h4>{$lang['last7days']}</h4>\n\t\t\t\t<br />\n";
for ($i = 0; $i < 7; $i++) {
    $current = strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00');
    $currentend = strtotime(date('Y-m-d', strtotime('-' . ($i - 1) . ' days')) . ' 00:00:00');
    $dated = date('d', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
    $datem = date('M', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
    $datey = date('Y', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
Пример #2
0
<?php

/*
Mohammad Jafarzadeh Rezvan
Metrics Monitoring Tool
Project Work 2014/2015
Updated: 5.1.2015
-------------------------------
Counting all the needed data from redmine using Redmine Api
from = (redmine.sis.uta.fi/projects/metrics)
API accsses code = 0561bd402d6d292e14179b0131d8f0f59070e0a4;
*/
require_once 'vendor/autoload.php';
include "../Login/db_connection.php";
// Create a new instance of object from The API
$client = new Redmine\Client('https://redmine.sis.uta.fi', '0561bd402d6d292e14179b0131d8f0f59070e0a4');
// Count how many are in the database
// Create connection
$con = mysqli_connect($hostname, $usrname, $password, $db_name);
// Check for connection
if (mysqli_connect_errno($con)) {
    die("Connection failed: " . $conn->connect_error);
}
// Working hours
mysqli_select_db($con, $db_name);
$query = "SELECT COUNT('work_id') FROM `individual_work`";
$result = $con->query($query);
$row = $result->fetch_assoc();
$count_workh_localdb = $row["COUNT('work_id')"];
// Issue
$query = "SELECT COUNT('requirement_id') FROM `requirement`";
Пример #3
0
$categoryId = 2;
$groupId = 5;
$issueId = 5;
$issueRelationId = 5;
$membershipId = 123;
$projectId = 1;
$timeEntryId = 14;
$trackerId = 2;
$userId = 3;
$versionId = 2;
// ----------------------------
// Instanciate a redmine client
// --> with ApiKey
$client = new Redmine\Client('http://redmine.example.com', '1234567890abcdfgh');
// --> with Username/Password
$client = new Redmine\Client('http://redmine.example.com', 'username', 'password');
// ----------------------------
// [OPTIONAL] if you want to check
// the servers' SSL certificate on Curl call
$client->setCheckSslCertificate(true);
// ----------------------------
// [OPTIONAL] set the port
// (it will try to guess it from the url)
$client->setPort(8080);
// ----------------------------
// Trackers
$client->api('tracker')->all();
$client->api('tracker')->listing();
// ----------------------------
// Issue statuses
$client->api('issue_status')->all();
Пример #4
0
$fh = fopen("http://api.uptimerobot.com/getMonitors?apiKey={$GLOBALS['CONFIG']['UPTIME_TOKEN']}&format=json&customUptimeRatio=7-30-365&logs=1", 'r');
$response = stream_get_contents($fh);
fclose($fh);
$response = json_decode(str_replace(array('jsonUptimeRobotApi(', ')'), array('', ''), $response), true);
foreach ($response['monitors']['monitor'] as $m) {
    if ($m['id'] == '776120035') {
        $expl = explode('-', $m['customuptimeratio']);
        $up7 = $expl[0];
        $up30 = $expl[1];
        $up365 = $expl[2];
        $status = $m['status'];
        $logs = $m['log'];
    }
}
require_once 'on/status/vendor/autoload.php';
$client = new Redmine\Client('https://projets.olympe.in', 'admin', $GLOBALS['CONFIG']['REDMINE_TOKEN']);
$issues = $client->api('issue')->all(array('project_id' => 'infrastructure'));
$issues = $issues['issues'];
$content = "\r\n\t\t<div class=\"head\" style=\"background-color: " . ($status != 2 ? "#ca0101" : "#7bbb51") . "; background-image: url('/{$GLOBALS['CONFIG']['SITE']}/images/dotgrid-black.png'); margin-bottom: 0;\">\r\n\t\t\t<br />\r\n\t\t\t<h1>" . ($status != 2 ? "{$lang['offline']}" : "{$lang['online']}") . "</h1>\r\n\t\t\t<h2 style=\"margin: 15px 0 15px 0; color: #ffffff;\">" . date('M d Y H:i') . "</h2>\r\n\t\t\t<div style=\"width: 800px; margin: 0 auto; color: #ffffff; text-align: center; font-size: 14px; line-height: 20px;\">\r\n\t\t\t\t{$lang['monitor']}\r\n\t\t\t</div>\r\n\t\t\t<div class=\"clear\"></div>\r\n\t\t\t<br /><br /><br />\r\n\t\t\t<div style=\"margin: 0 auto; width: 1100px;\">\r\n\t\t\t\t<div style=\"float: left;\">\r\n\t\t\t\t\t<div class=\"filluptimeout\">\r\n\t\t\t\t\t\t<div class=\"filluptime\" style=\"width: {$up30}%;\"></div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<span style=\"color: #ffffff; text-align: center; display: block; margin: 0 auto; margin-top: 5px; font-size: 14px;\">{$lang['30days']} <span style=\"font-weight: bold;\">{$up30}%</span></span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"float: right;\">\r\n\t\t\t\t\t<div class=\"filluptimeout\">\r\n\t\t\t\t\t\t<div class=\"filluptime\" style=\"width: {$up365}%;\"></div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<span style=\"color: #ffffff; text-align: center; display: block; margin: 0 auto; margin-top: 5px; font-size: 14px;\">{$lang['365days']} <span style=\"font-weight: bold;\">{$up365}%</span></span>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"clear\"></div>\t\t\r\n\t\t<div class=\"content\">\r\n\t\t\t<h3 style=\"color: #a4a4a4;\">{$lang['issues']}</h3>\r\n\t\t\t<table>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4; text-align: center; width: 40px;\">#</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['type']}</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['title']}</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['priority']}</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['date']}</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['status']}</th>\r\n\t\t\t\t\t<th style=\"color: #a4a4a4;\">{$lang['updated']}</th>\r\n\t\t\t\t</tr>\r\n";
if (count($issues) > 0) {
    foreach ($issues as $i) {
        $content .= "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td style=\"text-align: center; width: 40px;\"><a href=\"https://projets.olympe.in/issues/{$i['id']}\"><img src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/issue.png\" /></a></td>\r\n\t\t\t\t\t<td>" . $lang['tracker_' . $i['tracker']['id']] . "</td>\r\n\t\t\t\t\t<td><a href=\"https://projets.olympe.in/issues/{$i['id']}\">{$i['subject']}</a></td>\r\n\t\t\t\t\t<td>" . $lang['priority_' . $i['priority']['id']] . "</td>\r\n\t\t\t\t\t<td>" . date($lang['dateformatsimple'], strtotime($i['start_date'])) . "</td>\r\n\t\t\t\t\t<td>" . $lang['status2_' . $i['status']['id']] . "</td>\r\n\t\t\t\t\t<td>" . date($lang['dateformat'], strtotime($i['updated_on'])) . "</td>\r\n\t\t\t\t</tr>\r\n\t\t";
    }
}
$content .= "\r\n\t\t\t</table>\r\n\t\t\t<br /><br />\r\n\t\t\t<div style=\"float: left; width: 500px;\">\r\n\t\t\t\t<h3 style=\"color: #a4a4a4;\">{$lang['last7days']}</h3>\r\n";
for ($i = 0; $i < 7; $i++) {
    $current = strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00');
    $currentend = strtotime(date('Y-m-d', strtotime('-' . ($i - 1) . ' days')) . ' 00:00:00');
    $dated = date('d', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
    $datem = date('M', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
    $datey = date('Y', strtotime(date('Y-m-d', strtotime('-' . $i . ' days')) . ' 00:00:00'));
Пример #5
0
<?php

if (!defined('PROPER_START')) {
    header("HTTP/1.0 403 Forbidden");
    exit;
}
$users = api::send('user/list', array('limit' => 10, 'order' => 'user_date', 'order_type' => 'DESC'));
$overquotas = api::send('quota/nearlimit', array('quota' => 'DISK'));
require_once 'as/status/vendor/autoload.php';
$client = new Redmine\Client('https://projets.anotherservice.com', $GLOBALS['CONFIG']['REDMINE_TOKEN']);
$issues = $client->api('issue')->all(array('project_id' => 'support', 'limit' => 5, 'sort' => 'updated_on:desc'));
$issues = $issues['issues'];
$content = "\r\n\t<div class=\"admin\">\r\n\t\t<div class=\"top\">\r\n\t\t\t<div class=\"left\" style=\"padding-top: 5px;\">\r\n\t\t\t\t<h1 class=\"dark\">{$lang['title']}</h1>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"right\">\r\n\t\t\t\t<a class=\"button classic\" href=\"#\" onclick=\"\$('#new').dialog('open');\" style=\"width: 180px; height: 22px; float: right;\">\r\n\t\t\t\t\t<img style=\"float: left;\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/plus-white.png\" />\r\n\t\t\t\t\t<span style=\"display: block; padding-top: 3px;\">{$lang['add']}</span>\r\n\t\t\t\t</a>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"clear\"></div><br />\r\n\t\t<div class=\"container\">\r\n\t\t\t<div style=\"width: 350px; float: left;\">\r\n\t\t\t\t<h3 class=\"colored\">{$lang['search']}</h3>\r\n\t\t\t\t<form action=\"/admin/search_action\" method=\"post\">\r\n\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t<input class=\"auto\" style=\"width: 300px;\" type=\"text\" name=\"name\" value=\"{$lang['name']}\" onfocus=\"this.value = this.value=='{$lang['name']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['name']}' : this.value; this.value=='{$lang['name']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\r\n\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t<input class=\"auto\" style=\"width: 300px;\" type=\"text\" name=\"email\" value=\"{$lang['email']}\" onfocus=\"this.value = this.value=='{$lang['email']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['email']}' : this.value; this.value=='{$lang['email']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\r\n\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t<input class=\"auto\" style=\"width: 300px;\" type=\"text\" name=\"domain\" value=\"{$lang['domain']}\" onfocus=\"this.value = this.value=='{$lang['domain']}' ? '' : this.value; this.style.color='#4c4c4c';\" onfocusout=\"this.value = this.value == '' ? this.value = '{$lang['domain']}' : this.value; this.value=='{$lang['domain']}' ? this.style.color='#cccccc' : this.style.color='#4c4c4c'\" />\r\n\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t<fieldset>\r\n\t\t\t\t\t\t<input type=\"submit\" value=\"{$lang['go']}\" />\r\n\t\t\t\t\t</fieldset>\t\t\t\t\t\r\n\t\t\t\t</form>\r\n\t\t\t</div>\r\n\t\t\t<div style=\"width: 700px; float: right;\">\r\n\t\t\t\t<h3 class=\"colored\">{$lang['support']}</h3>\r\n\t\t\t\t<table>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th style=\"width: 40px; text-align: center;\">#</th>\r\n\t\t\t\t\t\t<th style=\"width: 200px;\">{$lang['client']}</th>\r\n\t\t\t\t\t\t<th>{$lang['subject']}</th>\r\n\t\t\t\t\t\t<th style=\"width: 90px;\">{$lang['date']}</th>\t\t\t\t\t\t\r\n\t\t\t\t\t</tr>\r\n";
foreach ($issues as $i) {
    $content .= "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td style=\"text-align: center;\"><a href=\"https://support.anotherservice.com/issues/{$i['id']}\"><img style=\"width: 25px;\" src=\"/{$GLOBALS['CONFIG']['SITE']}/images/icons/issue.png\" /></a></td>\r\n\t\t\t\t\t\t<td>{$i['project']['name']}</td>\r\n\t\t\t\t\t\t<td>{$i['subject']}</td>\r\n\t\t\t\t\t\t<td>" . date('Y-m-d', strtotime($i['updated_on'])) . "</td>\r\n\t\t\t\t\t</tr>\r\n\t";
}
$content .= "\r\n\t\t\t\t</table>\r\n\t\t\t\t<br />\r\n\t\t\t</div>\r\n\t\t\t<div class=\"clear\"></div>\r\n\t\t\t<br />\r\n\t\t\t<div style=\"width: 350px; float: left;\">\r\n\t\t\t\t<h3 class=\"colored\">{$lang['overquota']}</h3>\r\n\t\t\t\t<table>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th style=\"width: 40px; text-align: center;\">#</th>\r\n\t\t\t\t\t\t<th>{$lang['username']}</th>\r\n\t\t\t\t\t\t<th>{$lang['disk']}</th>\r\n\t\t\t\t\t\t<th>{$lang['max']}</th>\r\n\t\t\t\t\t</tr>\r\n";
$i = 0;
foreach ($overquotas as $o) {
    $content .= "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td style=\"width: 40px; text-align: center;\"><a href=\"/admin/users/detail?id={$o['id']}\"><img style=\"width: 30px; height: 30px;\" src=\"" . (file_exists("{$GLOBALS['CONFIG']['SITE']}/images/users/{$o['id']}.png") ? "/{$GLOBALS['CONFIG']['SITE']}/images/users/{$o['id']}.png" : "/{$GLOBALS['CONFIG']['SITE']}/images/users/user.png") . "\" /></a></td>\r\n\t\t\t\t\t\t<td><a href=\"/admin/users/detail?id={$o['id']}\">{$o['name']}</a></td>\r\n\t\t\t\t\t\t<td>{$o['quotas']['used']}</td>\r\n\t\t\t\t\t\t<td>{$o['quotas']['max']}</td>\r\n\t\t\t\t\t</tr>\r\n\t";
    $i++;
    if ($i > 9) {
        break;
    }
}
$content .= "\r\n\t\t\t\t</table>\r\n\t\t\t</div>\r\n\t\t\t<div style=\"width: 700px; float: right;\">\r\n\t\t\t\t<h3 class=\"colored\">{$lang['last']}</h3>\r\n\t\t\t\t<table>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th style=\"width: 40px; text-align: center;\">#</th>\r\n\t\t\t\t\t\t<th>{$lang['username']}</th>\r\n\t\t\t\t\t\t<th>{$lang['email']}</th>\r\n\t\t\t\t\t\t<th>{$lang['date']}</th>\r\n\t\t\t\t\t</tr>\r\n";
foreach ($users as $u) {
    $content .= "\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td style=\"width: 40px; text-align: center;\"><a href=\"/admin/users/detail?id={$u['id']}\"><img style=\"width: 30px; height: 30px;\" src=\"" . (file_exists("{$GLOBALS['CONFIG']['SITE']}/images/users/{$u['id']}.png") ? "/{$GLOBALS['CONFIG']['SITE']}/images/users/{$u['id']}.png" : "/{$GLOBALS['CONFIG']['SITE']}/images/users/user.png") . "\" /></a></td>\r\n\t\t\t\t\t\t<td><a href=\"/admin/users/detail?id={$u['id']}\">{$u['name']}</a></td>\r\n\t\t\t\t\t\t<td>{$u['email']}</td>\r\n\t\t\t\t\t\t<td>" . date('Y-m-d H:i', $u['date']) . "</td>\r\n\t\t\t\t\t</tr>\r\n\t";
}
$content .= "\r\n\t\t\t\t</table>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class=\"clear\"></div>\r\n\t\t</div>\r\n\t</div>\r\n";
/* ========================== OUTPUT PAGE ========================== */
Пример #6
0
<?php

require_once 'lib/autoload.php';
require_once 'db_connection.php';
$projectId = 1450;
$issueId = 50620;
// --> with Username/Password
$client = new Redmine\Client("https://portal.optimusinfo.com/redmine/", 'vikas.singhal', 'vzi950');
//echo "<pre>";print_r($client);die;
// Projects
//show all Projects in your account with description
$allProject = $client->api('project')->all();
//echo "<pre>";print_r($allProject);die;
//------------projectsTable-----------------------------
// foreach ($allProject['projects'] as $key=>$project)
//  {
// $query = "INSERT INTO projects
// VALUES ('$project[id]','$project[identifier]',
//     '$project[name]','$project[created_on]',
//     '$project[updated_on]','$project[description]')";
// $resultset=mysqli_query($connection,$query);
// }
//show a particluar project details by the project id
$projectInfo = $client->api('project')->show($projectId);
//echo "<pre>";print_r($projectInfo);die;
//-----trackersTable---------------------
// foreach ($projectInfo['project']['trackers'] as $key=>$track)
//  {
//  $projectId = $projectInfo['project']['id'];
// $query = "INSERT INTO trackersTable (tracker_id,tracker_name,projectId)
// VALUES ('$track[id]','$track[name]','$projectId')";
Пример #7
0
<?php

require_once 'vendor/autoload.php';
$client = new Redmine\Client('http://redmine.example.com', '1234567890abcdfgh');
// ----------------------------
// [OPTIONAL] if you want to check
// the servers' SSL certificate on Curl call
$client->setCheckSslCertificate(true);
// ----------------------------
// [OPTIONAL] set the port
// (it will try to guess it from the url)
$client->setPort(8080);
// ----------------------------
// Trackers
$client->api('tracker')->all();
$client->api('tracker')->listing();
// ----------------------------
// Issue statuses
$client->api('issue_status')->all();
$client->api('issue_status')->listing();
$client->api('issue_status')->getIdByName('New');
// ----------------------------
// Project
$client->api('project')->all();
$client->api('project')->all(array('limit' => 10));
$client->api('project')->listing();
$client->api('project')->listing();
$client->api('project')->show(1);
$client->api('project')->getIdByName('Elvis');
$client->api('project')->create(array('name' => 'some name', 'identifier' => 'the_identifier'));
$client->api('project')->update(4, array('name' => 'different name'));
Пример #8
0
 function _render_link($renderer, $data)
 {
     $bootstrap = False;
     if ($this->getConf('redissue.theme') == 8) {
         $bootstrap = True;
     }
     $apiKey = $this->getConf('redissue.API');
     if (empty($apiKey)) {
         $this->_render_default_link($renderer, $data);
     } else {
         $url = $this->getConf('redissue.url');
         $client = new Redmine\Client($url, $apiKey);
         // Get Id user of the Wiki if Impersonate
         $view = $this->getConf('redissue.view');
         if ($view == self::RI_IMPERSONATE) {
             $redUser = $_SERVER['REMOTE_USER'];
             // Attempt to collect information with this user
             $client->setImpersonateUser($redUser);
         }
         $issue = $client->api('issue')->show($data['id']);
         if ($issue) {
             // ALL_INFO --- Get Info from the Issue
             $project = $issue['issue']['project'];
             $project_identifier = $this->_project_identifier($client, $project['name']);
             $tracker = $issue['issue']['tracker'];
             $status = $issue['issue']['status']['name'];
             $author = $issue['issue']['author'];
             $assigned = $issue['issue']['assigned_to'];
             $subject = $issue['issue']['subject'];
             $description = $issue['issue']['description'];
             $done_ratio = $issue['issue']['done_ratio'];
             // RENDERER_MAIN_LINK ---- Get the Id Status
             $myStatusId = $issue['issue']['status']['id'];
             $statuses = $client->api('issue_status')->all();
             // Browse existing statuses
             for ($i = 0; $i < count($statuses['issue_statuses']); $i++) {
                 $foundStatus = $statuses['issue_statuses'][$i];
                 if ($foundStatus['id'] == $myStatusId) {
                     // Get is_closed value
                     $isClosed = $foundStatus['is_closed'];
                 }
             }
             // If isClosed not empty, change css
             $this->_render_custom_link($renderer, $data, "[#" . $data['id'] . "] " . $subject, $bootstrap);
             // PRIORITIES --- Get priority and define color
             $priority = $issue['issue']['priority'];
             $id_priority = $priority['id'];
             $color_prio = $this->_color_prio($client, $id_priority);
             if (!$isClosed) {
                 if ($bootstrap) {
                     $renderer->doc .= ' <span class="label label-success">' . $status . '</span>';
                 } else {
                     $renderer->doc .= ' <span class="badge-prio color-' . $color_prio . '">' . $priority['name'] . '</span>';
                     $renderer->doc .= ' <span class="badge-prio tracker">' . $tracker['name'] . '</span>';
                     $renderer->doc .= ' <span class="badge-prio open">' . $status . '</span>';
                 }
             } else {
                 if ($bootstrap) {
                     $renderer->doc .= ' <span class="label label-default">' . $status . '</span>';
                 } else {
                     $renderer->doc .= ' <span class="badge-prio closed">' . $status . '</span>';
                 }
             }
             // GENERAL_RENDERER --- If all is ok
             if ($bootstrap) {
                 $renderer->doc .= ' <span class="label label-' . $color_prio . '">' . $priority['name'] . '</span>';
                 $renderer->doc .= ' <span class="label label-primary">' . $tracker['name'] . '</span>';
                 $renderer->doc .= '<div class="well">';
                 $renderer->doc .= '<div class="issue-info"><dl class="dl-horizontal">';
                 $renderer->doc .= '<dt><icon class="glyphicon glyphicon-info-sign">&nbsp;</icon>Projet :</dt>';
                 $renderer->doc .= '<dd><a href="' . $url . '/projects/' . $project_identifier . '">' . $project['name'] . '</a></dd>';
                 $renderer->doc .= '<dt>Auteur :</dt>';
                 $renderer->doc .= '<dd>' . $author['name'] . ' </dd>';
                 $renderer->doc .= '<dt>Assigné à :</dt>';
                 $renderer->doc .= '<dd>' . $assigned['name'] . ' </dd>';
                 $renderer->doc .= '</dl></div>';
                 // ./ Issue-info
                 $renderer->doc .= '<h4>Description</h4><p>' . $description . '</p>';
                 $renderer->doc .= '<div class="progress">';
                 $renderer->doc .= '<span class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:' . $done_ratio . '%">';
                 $renderer->doc .= '<span class="doku">' . $done_ratio . '% Complete</span>';
                 $renderer->doc .= '</span></div>';
                 // ./progress
                 $renderer->doc .= '</div>';
                 // ./ well
                 if ($data['state'] != DOKU_LEXER_SPECIAL) {
                     $renderer->doc .= '<div class ="issue-doku">';
                 }
             } else {
                 //Not Bootstrap
                 $renderer->doc .= '<div ';
                 if ($data['short'] > 0) {
                     $renderer->doc .= 'style="display:none;"';
                 }
                 $renderer->doc .= 'class="issue-doku border-' . $color_prio . '">';
                 $renderer->doc .= '<div>';
                 $renderer->doc .= '<span><b>' . $this->getLang('redissue.project') . ' : </b></span>';
                 $renderer->doc .= '<a href="' . $url . '/projects/' . $project_identifier . '"> ' . $project['name'] . '</a>';
                 $renderer->doc .= '<span><b> ' . $this->getLang('redissue.author') . ' : </b></span>';
                 $renderer->doc .= '' . $author['name'] . '';
                 $renderer->doc .= '<br>';
                 $renderer->doc .= '<span><b> ' . $this->getLang('redissue.assigned') . ' :</b></span>';
                 $renderer->doc .= '<a> ' . $assigned['name'] . ' </a>';
                 $renderer->doc .= '</span></div>';
                 // ./ Issue-info
                 $renderer->doc .= '<div class="issue-description">';
                 $renderer->doc .= '<h4>' . $this->getLang('redissue.desc') . ' :</h4>';
                 $renderer->doc .= '<p>' . $description . '</p>';
                 $renderer->doc .= '</div>';
                 $renderer->doc .= '<div class="progress">';
                 $renderer->doc .= '<span class="doku">' . $done_ratio . '% Complete</span>';
                 $renderer->doc .= '</div>';
                 // ./progress
                 if ($data['state'] != DOKU_LEXER_SPECIAL) {
                     $renderer->doc .= '<div class="description">';
                 }
             }
         } else {
             // If the user has no Rights
             $this->_render_default_link($renderer, $data);
             if ($data['state'] == DOKU_LEXER_SPECIAL or $data['state'] == DOKU_LEXER_ENTER) {
                 $renderer->doc .= '<div><div class="norights">';
             }
         }
     }
 }
Пример #9
0
<?php

require_once 'vendor/autoload.php';
$api_key = $_REQUEST["api_key"];
$redmine_uri = $_REQUEST["redmine_uri"];
$action = $_REQUEST["action"];
$client = new Redmine\Client($redmine_uri, $api_key);
if ($action == "loadProjects") {
    echo json_encode($client->api('project')->all(array('limit' => 999)));
} else {
    if ($action == "loadTasksByProjectId") {
        echo json_encode($client->api('issue')->all(array('project_id' => $_REQUEST["id"], 'limit' => '9999', 'offset' => $_REQUEST["offset"])));
    } else {
        if ($action == "changeStatusTask") {
            $client->api('issue')->update($_REQUEST["id"], array('status' => $_REQUEST["status"], 'fixed_version_id' => $_REQUEST["story"]));
        } else {
            if ($action == "updateTask") {
                $client->api('issue')->update($_REQUEST["id"], array('subject' => $_REQUEST["subject"], 'estimated_hours' => $_REQUEST["estimated_hours"], 'assigned_to_id' => $_REQUEST["assigned_to_id"]));
            } else {
                if ($action == "loadSpentTimesByProjectId") {
                    echo json_encode($client->api('time_entry')->all(array('project_id' => $_REQUEST["project_id"], 'limit' => '999')));
                } else {
                    if ($action == "loadUsersByProjectId") {
                        echo json_encode($client->api('membership')->all($_REQUEST["project_id"]));
                    } else {
                        if ($action == "loadStories") {
                            echo json_encode($client->api('version')->all($_REQUEST["project_id"]));
                        } else {
                            if ($action == "loadActivities") {
                                echo json_encode($client->api('tracker')->all());
                            } else {
Пример #10
0
   function _render_project($renderer, $data)
   {
       $apiKey = $this->getConf('redproject.API');
       $url = $this->getConf('redproject.url');
       $client = new Redmine\Client($url, $apiKey);
       // Get Id user of the Wiki if Impersonate
       $view = $this->getConf('redproject.view');
       if ($view == self::RI_IMPERSONATE) {
           $redUser = $_SERVER['REMOTE_USER'];
           // Attempt to collect information with this user
           $client->setImpersonateUser($redUser);
       }
       // Get Project Info
       $proj = $client->api('project')->show($data['proj']);
       if ($proj) {
           $projId = $proj['project']['id'];
           $projIdent = $proj['project']['identifier'];
           $projName = $proj['project']['name'];
           $projParent = $proj['project']['parent'];
           $nameParent = $projParent['name'];
           $parentId = $client->api('project')->getIdByName($nameParent);
           $parent = $client->api('project')->show($parentId);
           $parentIdent = $parent['project']['identifier'];
           $projHome = $proj['project']['homepage'];
           $projDesc = $proj['project']['description'];
           // RENDERER PROJECT INFO
           // Title
           $renderer->doc .= '<h2 class="title">Projet Redmine</h2>';
           if ($projHome) {
               $renderer->doc .= '<div class="title">';
               $renderer->doc .= '<a href="' . $projHome . '"><div class="circle">HOME</div></a>';
               $renderer->doc .= '<div class="title-droite">';
               $renderer->doc .= '<span class="info-title">' . $projName . '</span>';
               $renderer->doc .= '<div class="see-it">';
               $renderer->doc .= '<a href="' . $url . '/projects/' . $projIdent . '">See it in redmine</a>';
               $renderer->doc .= '</div>';
               // /.see-it
               $renderer->doc .= '</div>';
               // /.title-droite
               $renderer->doc .= '</div>';
               // /.title
           } else {
               $renderer->doc .= '<div class="title">';
               $renderer->doc .= '<a href="' . $projHome . '" title="Add Homepage"><div class="circle">+</div></a>';
               $renderer->doc .= '<div class="title-droite">';
               $renderer->doc .= '<span class="info-title">' . $projName . '</span>';
               $renderer->doc .= '<div class="see-it">';
               $renderer->doc .= '<a href="' . $url . '/projects/' . $projIdent . '">See it in redmine</a>';
               $renderer->doc .= '</div>';
               // /.see-it
               $renderer->doc .= '</div>';
               // /.title-droite
               $renderer->doc .= '</div>';
               // /.title
           }
           // DESCRIPTION
           if ($projDesc == '') {
               $renderer->doc .= '<div class="desc"><h4>Description</h4> <p>' . $this->getLang('description') . '</p></div>';
           } else {
               $renderer->doc .= '<div class="desc"><h4>Description</h4> <p class="desc"> ' . $projDesc . '</p></div>';
           }
           // VERSIONS
           $versions = $client->api('version')->all($data['proj']);
           // Parsing Version
           if ($versions) {
               $renderer->doc .= '<div class="version"><h3>Versions</h3>';
               $renderer->doc .= '<div class="panel-group" id="version-accordion-nb" role="tablist">';
               for ($i = 0; $i < count($versions['versions']); $i++) {
                   // Begin Accordion
                   $renderer->doc .= '<div class="panel panel-primary descver">';
                   $foundVersion = $versions['versions'][$i];
                   $versionId = $foundVersion['id'];
                   $renderer->doc .= '<div class="version panel-heading">';
                   $renderer->doc .= '<h4 class="panel-title">';
                   $renderer->doc .= '<a class="version" data-toggle="collapse" data-parent="#version-accordion-nb" href="#collapse-version-nb-' . $versionId . '">';
                   $renderer->doc .= '<span class="version">Version ' . $foundVersion['name'] . '</span> ';
                   $renderer->doc .= '</a>';
                   $statusClass = $foundVersion['status'] == 'open' ? 'statusop' : 'statuscl';
                   $renderer->doc .= '<span class="' . $statusClass . '"> ' . $foundVersion['status'] . ' </span>';
                   $renderer->doc .= '</h4>';
                   // /.panel-title
                   $renderer->doc .= '</div>';
                   // /.panel-heading
                   $renderer->doc .= '<div id="collapse-version-nb-' . $versionId . '" class="panel-collapse collapse">';
                   // PANEL BODY
                   $renderer->doc .= '<div class="panel-body">';
                   // Time Entries
                   $createdOn = DateTime::createFromFormat(DateTime::ISO8601, $foundVersion['created_on']);
                   $updatedOn = DateTime::createFromFormat(DateTime::ISO8601, $foundVersion['updated_on']);
                   $renderer->doc .= '<p><b>Description :</b> ' . $foundVersion['description'] . '</p>';
                   $renderer->doc .= '<p><a href="' . $url . '/versions/' . $versionId . '">See this version in redmine</a></p>';
                   $renderer->doc .= '<p><b>' . $this->getLang('createdon') . '</b>' . $createdOn->format(DateTime::RFC850) . '</p>';
                   $renderer->doc .= '<p><b>' . $this->getLang('updatedon') . '</b>' . $updatedOn->format(DateTime::RFC850) . '</p>';
                   // Issues of Versions
                   $issueTotal = $client->api('issue')->all(array('project_id' => $projId, 'status_id' => '*', 'fixed_version_id' => $foundVersion['id'], 'limit' => 1));
                   // Total issues & open
                   $issueOpen = $client->api('issue')->all(array('project_id' => $projId, 'status_id' => 'open', 'fixed_version_id' => $foundVersion['id'], 'limit' => 1));
                   // Get percent version
                   $diffIssue = $issueTotal['total_count'] - $issueOpen['total_count'];
                   $progress = $this->getPercent($diffIssue, $issueTotal['total_count']);
                   // renderer Progressbar
                   $renderer->doc .= '<span class="col-md-3">';
                   $renderer->doc .= '<a href="' . $url . '/projects/' . $projIdent . '/issues">' . $issueTotal['total_count'] . ' issues (' . $diffIssue . ' closed - ' . $issueOpen['total_count'] . ' open)</a>';
                   $renderer->doc .= '</span>';
                   // /.col-md-3
                   $renderer->doc .= '<span class="col-md-6">';
                   $renderer->doc .= '<div class="progress">';
                   $renderer->doc .= '<span class="progress-bar" role="progressbar" aria-valuenow="70"
 aria-valuemin="0" aria-valuemax="100" style="width:' . $progress . '%">';
                   $renderer->doc .= '<span class="doku">' . $progress . '% Complete</span>';
                   $renderer->doc .= '</span></div>';
                   // ./progress
                   $renderer->doc .= '</span>';
                   // ./col-md-6
                   $renderer->doc .= '</div>';
                   // /.panel-body
                   $renderer->doc .= '</div>';
                   // /#collapse-version-nb-'.$versionId.' .panel-collapse
                   $renderer->doc .= '</div>';
                   // /.panel .panel-default
                   $renderer->doc .= '<br>';
               }
               $renderer->doc .= '</div>';
               // /.panel-group
           } else {
               $renderer->doc .= '<div class="version"><h3>Versions</h3>';
               $renderer->doc .= $nbVersion . ' versions';
               $renderer->doc .= 'div class="descver"><p>' . $this->getLang('noversion') . '</p></div>';
           }
           $renderer->doc .= '</div>';
           // DETAILS
           // Get Number of Version
           for ($v = 0; $v < count($versions['versions']); $v++) {
               $nbVersion = $v + 1;
           }
           // Get number of Issues
           $issueTotal = $client->api('issue')->all(array('project_id' => $projId, 'status_id' => '*', 'limit' => 1));
           $issueOpen = $client->api('issue')->all(array('project_id' => $projId, 'status_id' => 'open', 'limit' => 1));
           // Initialize Array
           $usersByRole = array();
           $members = $client->api('membership')->all($projId);
           // Found each Members
           for ($m = 0; $m < count($members['memberships']); $m++) {
               // $z++;
               $memberFound = $members['memberships'][$m];
               $currentUser = $memberFound['user'];
               for ($r = 0; $r < count($memberFound['roles']); $r++) {
                   $currentRole = $memberFound['roles'][$r];
                   $roleId = $currentRole['id'];
                   // If doesn't exist in usersByRole, create it
                   if (!$usersByRole[$roleId]) {
                       $currentRole['members'] = array($currentUser);
                       $usersByRole[$roleId] = $currentRole;
                   } else {
                       array_push($usersByRole[$roleId]['members'], $currentUser);
                   }
               }
           }
           // Renderer Details
           $renderer->doc .= '<div class="details">';
           $renderer->doc .= '<h3>' . $this->getlang('hdetail') . '</h3>';
           // Stats
           $renderer->doc .= '<div class="stats">';
           if ($projParent == '') {
               $renderer->doc .= '<p>' . $this->getLang('mainproj') . '</p>';
           } else {
               $renderer->doc .= '<p>' . $this->getLang('subproject') . ' <a href="' . $url . '/projects/' . $parentIdent . '">' . $nameParent . '</a></p>';
           }
           $renderer->doc .= '<p>' . $this->getLang('tversion') . '<span class="label label-info">' . $nbVersion . '</span>' . $this->getLang('vversion') . '</p>';
           $renderer->doc .= '<p><span class="label label-success">' . $issueTotal['total_count'] . '</span>' . $this->getLang('issues') . '<span class="label label-warning">' . $issueOpen['total_count'] . '</span>' . $this->getLang('open') . '</p>';
           $renderer->doc .= '<p><span class="label label-info">' . $m . '</span>' . $this->getLang('membdetail') . '</p>';
           $renderer->doc .= '</div>';
           // /.stats
           $renderer->doc .= '</div>';
           // /.details
           // MEMBERSHIPS & ROLES
           $langMembers = $this->getLang('membres');
           $renderer->doc .= '<h3 class="member">' . $langMembers . '</h3>';
           // Display new array usersByRole
           $renderer->doc .= '<div class="member">';
           foreach ($usersByRole as $role => $currentRole) {
               $renderer->doc .= '<p class="member">' . $currentRole['name'] . ' : ';
               foreach ($currentRole['members'] as $who => $currentUser) {
                   $userId = $currentUser['id'];
                   $mailCurrentUser = $client->api('user')->show($userId);
                   $mailUser = $mailCurrentUser['user']['mail'];
                   $renderer->doc .= '<a href="mailto:' . $mailUser . '?Subject=Project ' . $projName . '"target="_top"><span> ' . $currentUser['name'] . '</span></a>';
               }
               $renderer->doc .= '</p>';
           }
           $renderer->doc .= '</div>';
       } else {
           $renderer->doc .= '<div class="title"><img class="title" src="lib/plugins/redproject/images/home.png">Projet Privé</div><br>';
           $renderer->doc .= '<div class="desc"><h3>Information</h3>' . $this->getLang('norights') . ' </p></div>';
       }
   }