Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
smradius
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shail
smradius
Commits
c5ff9032
Commit
c5ff9032
authored
14 years ago
by
Robert Anderson
Browse files
Options
Downloads
Patches
Plain Diff
Take into account usage from a summary topup when adding to total topup usage
parent
089fad0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webui/user/index.php
+43
-9
43 additions, 9 deletions
webui/user/index.php
with
43 additions
and
9 deletions
webui/user/index.php
+
43
−
9
View file @
c5ff9032
...
@@ -257,7 +257,7 @@ function displayDetails() {
...
@@ -257,7 +257,7 @@ function displayDetails() {
$i
++
;
$i
++
;
# Topup currently in use
# Topup currently in use
}
elseif
(
$excess
<
$topup
[
'Limit'
])
{
}
elseif
(
!
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'Limit'
])
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
...
@@ -278,6 +278,23 @@ function displayDetails() {
...
@@ -278,6 +278,23 @@ function displayDetails() {
$i
++
;
$i
++
;
}
elseif
(
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'CurrentLimit'
])
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
$trafficRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$trafficRows
[
$i
][
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
# Set total available topups
$totalTrafficTopupsAvail
+=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
# Topup has been used up
# Topup has been used up
}
else
{
}
else
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
]
=
array
();
...
@@ -290,7 +307,7 @@ function displayDetails() {
...
@@ -290,7 +307,7 @@ function displayDetails() {
# Subtract this topup from excess usage
# Subtract this topup from excess usage
$excess
-=
$topup
[
'Limit'
];
$excess
-=
$topup
[
'Limit'
];
$i
++
;
$i
++
;
}
}
}
}
}
}
...
@@ -331,7 +348,7 @@ function displayDetails() {
...
@@ -331,7 +348,7 @@ function displayDetails() {
$i
++
;
$i
++
;
# Topup currently in use
# Topup currently in use
}
elseif
(
$excess
<
$topup
[
'Limit'
])
{
}
elseif
(
!
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'Limit'
])
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
...
@@ -352,6 +369,23 @@ function displayDetails() {
...
@@ -352,6 +369,23 @@ function displayDetails() {
$i
++
;
$i
++
;
}
elseif
(
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'CurrentLimit'
])
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
$uptimeRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$uptimeRows
[
$i
][
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
# Set total available topups
$totalUptimeTopupsAvail
+=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
# Topup has been used up
# Topup has been used up
}
else
{
}
else
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
]
=
array
();
...
@@ -458,7 +492,7 @@ function displayDetails() {
...
@@ -458,7 +492,7 @@ function displayDetails() {
<p>
</p>
<p>
</p>
<?php
<?php
# Dont display if we unlimited
# Dont display if we unlimited
if
(
!
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
"0"
))
{
if
(
!
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
))
{
?>
?>
<table
class=
"blockcenter"
>
<table
class=
"blockcenter"
>
<tr>
<tr>
...
@@ -478,8 +512,8 @@ function displayDetails() {
...
@@ -478,8 +512,8 @@ function displayDetails() {
echo
sprintf
(
"%.2f"
,
$trafficRow
[
'Used'
])
.
"/"
.
sprintf
(
$trafficRow
[
'Cap'
])
.
" MB"
;
echo
sprintf
(
"%.2f"
,
$trafficRow
[
'Used'
])
.
"/"
.
sprintf
(
$trafficRow
[
'Cap'
])
.
" MB"
;
?>
?>
</td>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
$trafficRow
[
'ValidFrom'
];
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validFrom
=
strtotime
(
$trafficRow
[
'ValidFrom'
]
)
;
echo
date
(
"Y-m-d"
,
$validFrom
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$
thisDate
=
strtotime
(
$trafficRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$
thisDate
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$
validTo
=
strtotime
(
$trafficRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$
validTo
);
?>
</td>
</tr>
</tr>
<?php
<?php
}
}
...
@@ -489,7 +523,7 @@ function displayDetails() {
...
@@ -489,7 +523,7 @@ function displayDetails() {
}
}
# Dont display if we unlimited
# Dont display if we unlimited
if
(
!
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
"0"
))
{
if
(
!
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
))
{
?>
?>
<p>
</p>
<p>
</p>
<table
class=
"blockcenter"
>
<table
class=
"blockcenter"
>
...
@@ -510,8 +544,8 @@ function displayDetails() {
...
@@ -510,8 +544,8 @@ function displayDetails() {
echo
sprintf
(
"%.2f"
,
$uptimeRow
[
'Used'
])
.
"/"
.
sprintf
(
$uptimeRow
[
'Cap'
])
.
" MB"
;
echo
sprintf
(
"%.2f"
,
$uptimeRow
[
'Used'
])
.
"/"
.
sprintf
(
$uptimeRow
[
'Cap'
])
.
" MB"
;
?>
?>
</td>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
$uptimeRow
[
'ValidFrom'
];
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validFrom
=
strtotime
(
$uptimeRow
[
'ValidFrom'
]
)
;
echo
date
(
"Y-m-d"
,
$validFrom
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$
thisDate
=
strtotime
(
$uptimeRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$
thisDate
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$
validTo
=
strtotime
(
$uptimeRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$
validTo
);
?>
</td>
</tr>
</tr>
<?php
<?php
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment