Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
include './lib/pve2_api.class.php';
//* Check permissions for module
$app->auth->check_module_permissions('proxmox');
// Loading classes
$app->uses('tpl');
$pve2 = new PVE2_API($conf["pve_link"], $conf["pve_username"], $conf["pve_realm"], $conf["pve_password"]);
if ($pve2) {
if ($pve2->login()) {
$template = 'templates/proxmox_vm_logs.htm';
// Loading the template
$app->uses('tpl');
$app->tpl->newTemplate("form.tpl.htm");
$app->tpl->setInclude('content_tpl', $template);
$title = $app->lng("task_title_txt");
$start_time = $app->lng("start_time_txt");
$end_time = $app->lng("end_time_txt");
$username = $app->lng("username_txt");
$description = $app->lng("description_txt");
$status = $app->lng("status_txt");
$app->tpl->setVar("task_title_txt", $title);
$app->tpl->setVar("start_time_txt", $start_time);
$app->tpl->setVar("end_time_txt", $end_time);
$app->tpl->setVar("username_txt", $username);
$app->tpl->setVar("description_txt", $description);
$app->tpl->setVar("status_txt", $status);
$tasks_history = $pve2->get("/cluster/tasks");
$tasks_logs = array();
foreach($tasks_history as $key => $task){
$tasks_logs[] = array(
'starttime' => date('d-m-Y H-i-s', $task['starttime']),
'endtime' => date('d-m-Y H-i-s', $task['endtime']),
'vmid' => $task['id'],
'username' => $task['user'],
'description' => $app->lng($task['type']),
'status' => $task['status'],
);
}
$app->tpl->setloop('task_logs', $tasks_logs);
$app->tpl_defaults();
$app->tpl->pparse();
}
}
?>