-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.admin.inc
71 lines (57 loc) · 1.71 KB
/
storage.admin.inc
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
65
66
67
68
69
70
<?php
function storage_admin_classes() {
$header = array(t("Class"), t("Files"), t("Size"));
$rows = array();
$class_ids = db_select('storage_class')
->fields('storage_class')
->orderBy('storage_class.name')
->orderBy('storage_class.class_id')
->execute()
->fetchCol();
foreach ($class_ids as $class_id) {
$class = storage_class_load($class_id);
$rows[] = array(
$class->link(),
$class->count(),
$class->size(TRUE),
);
}
if (empty($rows)) {
$rows[] = array(array('data' => t("No classes configured."), 'colspan' => 3, 'class' => 'message'));
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array('style' => 'width: auto;'),
));
}
function storage_admin_containers() {
$header = array(t("Container"), t("Access control"), t("Status"), t("Files"), t("Size"));
$rows = array();
$result = db_select('storage_container', NULL, array('fetch' => PDO::FETCH_ASSOC))
->fields('storage_container')
->orderBy('name')
->orderBy('container_id')
->execute();
foreach ($result as $container) {
$container = storage_container_new($container);
$rows[] = array(
$container->link(),
$container->access_control ? t("Yes") : t("No"),
$container->status(),
$container->count(),
$container->size(TRUE),
);
}
if (empty($rows)) {
$rows[] = array(array('data' => t("No containers exist."), 'colspan' => 6, 'class' => 'message'));
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array('style' => 'width: auto;'),
));
}
function storage_admin() {
return storage_admin_classes() . storage_admin_containers();
}