Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AdminLTE renderer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
AdminLTE renderer
Commits
961bfff1
Commit
961bfff1
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add infobox component
parent
baa413db
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
public_html/classes/render-adminlte.class.php
+86
-2
86 additions, 2 deletions
public_html/classes/render-adminlte.class.php
public_html/pages/components/infobox.php
+25
-0
25 additions, 0 deletions
public_html/pages/components/infobox.php
with
111 additions
and
2 deletions
public_html/classes/render-adminlte.class.php
+
86
−
2
View file @
961bfff1
...
...
@@ -124,7 +124,10 @@ class renderadminlte {
* @param string $sTag name of html tag
* @param array $aAttributes array of its attributes
*/
protected
function
_tag
(
$sTag
,
$aAttributes
){
protected
function
_tag
(
$sTag
,
$aAttributes
,
$sContent
=
false
){
if
(
$sContent
){
$aAttributes
[
'label'
]
=
(
isset
(
$aAttributes
[
'label'
])
?
$aAttributes
[
'label'
]
:
''
)
.
$sContent
;
}
return
$this
->
_oHtml
->
getTag
(
$sTag
,
$aAttributes
);
}
// ----------------------------------------------------------------------
...
...
@@ -562,6 +565,87 @@ class renderadminlte {
}
/**
* return an info-box:
* A colored box with large icon, text and a value.
* https://adminlte.io/docs/3.2/components/boxes.html
*
* @param type $aOptions hash with keys for all options
* - type - color of the box; one of [none]|danger|dark|info|primary|secondary|success|warning
* - bgcolor - background color of icon; use type OR bgcolor
* - icon - icon class
* - text - information text
* - number - value (comes in bold text)
* - progressvalue - integer: progress bar; range: 0..100
* - progresstext - text below progress bar
* @return string
*/
public
function
getInfobox
(
$aOptions
){
$aOptions
=
$this
->
_ensureOptions
(
$aOptions
,
[
'type'
,
'bgcolor'
,
'icon'
,
'text'
,
'number'
,
'progressvalue'
,
'progresstext'
]);
// print_r($aOptions);
$sClass
=
'info-box'
.
(
$aOptions
[
'class'
]
?
' '
.
$aOptions
[
'class'
]
:
''
)
.
(
$aOptions
[
'type'
]
?
' bg-'
.
$aOptions
[
'type'
]
:
''
)
;
// build parts
$sIcon
=
$aOptions
[
'icon'
]
?
$this
->
addWrapper
(
"span"
,
[
'class'
=>
'info-box-icon'
.
(
$aOptions
[
'bgcolor'
]
?
' bg-'
.
$aOptions
[
'bgcolor'
]
:
''
)
],
$this
->
_tag
(
'i'
,[
'class'
=>
$aOptions
[
'icon'
]]))
:
''
;
$sContent
=
$this
->
addWrapper
(
"div"
,
[
'class'
=>
'info-box-content'
],
''
.
(
$aOptions
[
'text'
]
?
$this
->
_tag
(
'span'
,
[
'class'
=>
'info-box-text'
,
'label'
=>
$aOptions
[
'text'
]])
:
''
)
.
(
$aOptions
[
'number'
]
?
$this
->
_tag
(
'span'
,
[
'class'
=>
'info-box-number'
,
'label'
=>
$aOptions
[
'number'
]])
:
''
)
.
(
$aOptions
[
'progressvalue'
]
!==
false
?
$this
->
addWrapper
(
'div'
,
[
'class'
=>
'progress'
],
$this
->
_tag
(
'div'
,
[
'class'
=>
'progress-bar'
,
'style'
=>
'width: '
.
(
int
)
$aOptions
[
'progressvalue'
]
.
'%'
])
)
:
''
)
.
(
$aOptions
[
'progresstext'
]
?
$this
->
_tag
(
'span'
,
[
'class'
=>
'progress-description'
,
'label'
=>
$aOptions
[
'progresstext'
]])
:
''
)
);
// merge all
return
$this
->
_tag
(
'div'
,
[
'class'
=>
$sClass
],
$sIcon
.
$sContent
);
}
/*
<div class="info-box">
<span class="info-box-icon bg-info"><i class="far fa-bookmark"></i></span>
<div class="info-box-content">
<span class="info-box-text">Bookmarks</span>
<span class="info-box-number">41,410</span>
<div class="progress">
<div class="progress-bar bg-info" style="width: 70%"></div>
</div>
<span class="progress-description">
70% Increase in 30 Days
</span>
</div>
</div>
<div class="info-box bg-success">
<span class="info-box-icon"><i class="far fa-thumbs-up"></i></span>
<div class="info-box-content">
<span class="info-box-text">Likes</span>
<span class="info-box-number">41,410</span>
<div class="progress">
<div class="progress-bar" style="width: 70%"></div>
</div>
<span class="progress-description">
70% Increase in 30 Days
</span>
</div>
</div>
*/
...
...
This diff is collapsed.
Click to expand it.
public_html/pages/components/infobox.php
0 → 100644
+
25
−
0
View file @
961bfff1
<?php
$aOptions
=
[
'type'
=>
'success'
,
'bgcolor'
=>
''
,
'icon'
=>
'far fa-thumbs-up'
,
'text'
=>
'Likes'
,
'number'
=>
"41,410"
,
'progressvalue'
=>
70
,
'progresstext'
=>
'70% Increase in 30 Days'
];
echo
$renderAdminLTE
->
addRow
(
'<h2>Infobox</h2>'
)
.
$renderAdminLTE
->
addRow
(
'<h3>Syntax</h3>
<pre>
echo $renderAdminLTE->getInfobox($aOptions)
</pre>
'
)
.
showExample
(
'$renderAdminLTE->getInfobox('
.
var_export
(
$aOptions
,
1
)
.
')'
)
;
\ No newline at end of file
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