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
baa413db
Commit
baa413db
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add shortcut for getTag
parent
b9e8f005
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/classes/render-adminlte.class.php
+28
-18
28 additions, 18 deletions
public_html/classes/render-adminlte.class.php
with
28 additions
and
18 deletions
public_html/classes/render-adminlte.class.php
+
28
−
18
View file @
baa413db
...
@@ -119,6 +119,14 @@ class renderadminlte {
...
@@ -119,6 +119,14 @@ class renderadminlte {
return
true
;
return
true
;
}
}
/**
* helper function: a shortcut for $this->_oHtml->getTag
* @param string $sTag name of html tag
* @param array $aAttributes array of its attributes
*/
protected
function
_tag
(
$sTag
,
$aAttributes
){
return
$this
->
_oHtml
->
getTag
(
$sTag
,
$aAttributes
);
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
//
//
// PUBLIC FUNCTIONS AdminLTE 3.2
// PUBLIC FUNCTIONS AdminLTE 3.2
...
@@ -147,7 +155,7 @@ class renderadminlte {
...
@@ -147,7 +155,7 @@ class renderadminlte {
*/
*/
public
function
addWrapper
(
$sTag
,
$aOptions
,
$sContent
){
public
function
addWrapper
(
$sTag
,
$aOptions
,
$sContent
){
$aOptions
[
'label'
]
=
$sContent
;
$aOptions
[
'label'
]
=
$sContent
;
return
$this
->
_
oHtml
->
getT
ag
(
$sTag
,
$aOptions
)
.
"
\n
"
;
return
$this
->
_
t
ag
(
$sTag
,
$aOptions
)
.
"
\n
"
;
}
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
...
@@ -189,7 +197,7 @@ class renderadminlte {
...
@@ -189,7 +197,7 @@ class renderadminlte {
]);
]);
unset
(
$aLink
[
'children'
]);
// remove from html attributes to draw
unset
(
$aLink
[
'children'
]);
// remove from html attributes to draw
}
}
$sReturn
=
$this
->
_
oHtml
->
getT
ag
(
'a'
,
$aLink
)
.
"
\n
"
;
$sReturn
=
$this
->
_
t
ag
(
'a'
,
$aLink
)
.
"
\n
"
;
if
(
$aChildren
){
if
(
$aChildren
){
$iLevel
++
;
$iLevel
++
;
$sReturn
.
=
$this
->
addWrapper
(
$sReturn
.
=
$this
->
addWrapper
(
...
@@ -284,7 +292,7 @@ class renderadminlte {
...
@@ -284,7 +292,7 @@ class renderadminlte {
$aLink
[
'label'
]
=
$this
->
addWrapper
(
'p'
,
[],
$aLink
[
'label'
]);
$aLink
[
'label'
]
=
$this
->
addWrapper
(
'p'
,
[],
$aLink
[
'label'
]);
$sReturn
.
=
$this
->
addWrapper
(
$sReturn
.
=
$this
->
addWrapper
(
'li'
,
[
'class'
=>
$aLiClass
],
'li'
,
[
'class'
=>
$aLiClass
],
$this
->
_
oHtml
->
getT
ag
(
'a'
,
$aLink
)
.
$sSubmenu
$this
->
_
t
ag
(
'a'
,
$aLink
)
.
$sSubmenu
)
.
"
\n
"
;
)
.
"
\n
"
;
}
}
return
$sReturn
;
return
$sReturn
;
...
@@ -378,6 +386,7 @@ class renderadminlte {
...
@@ -378,6 +386,7 @@ class renderadminlte {
/**
/**
* return a alert box
* return a alert box
* https://adminlte.io/themes/v3/pages/UI/general.html
* https://adminlte.io/themes/v3/pages/UI/general.html
*
* @param type $aOptions hash with keys for all options
* @param type $aOptions hash with keys for all options
* - type - one of [none]|danger|info|primary|success|warning
* - type - one of [none]|danger|info|primary|success|warning
* - dismissible - if dismissible - one of true|false; default: false
* - dismissible - if dismissible - one of true|false; default: false
...
@@ -401,7 +410,7 @@ class renderadminlte {
...
@@ -401,7 +410,7 @@ class renderadminlte {
,
,
'label'
=>
''
'label'
=>
''
.
(
$aOptions
[
'dismissible'
]
?
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'
:
''
)
.
(
$aOptions
[
'dismissible'
]
?
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'
:
''
)
.
$this
->
_
oHtml
->
getT
ag
(
'h5'
,
[
.
$this
->
_
t
ag
(
'h5'
,
[
'label'
=>
''
'label'
=>
''
.
(
isset
(
$aAlertIcons
[
$aOptions
[
'type'
]])
?
'<i class="'
.
$aAlertIcons
[
$aOptions
[
'type'
]]
.
'"></i> '
:
''
)
.
(
isset
(
$aAlertIcons
[
$aOptions
[
'type'
]])
?
'<i class="'
.
$aAlertIcons
[
$aOptions
[
'type'
]]
.
'"></i> '
:
''
)
.
$aOptions
[
'title'
]
.
$aOptions
[
'title'
]
...
@@ -409,7 +418,7 @@ class renderadminlte {
...
@@ -409,7 +418,7 @@ class renderadminlte {
.
$aOptions
[
'text'
]
.
$aOptions
[
'text'
]
];
];
return
$this
->
_
oHtml
->
getT
ag
(
'div'
,
$aElement
);
return
$this
->
_
t
ag
(
'div'
,
$aElement
);
}
}
/**
/**
...
@@ -443,13 +452,14 @@ class renderadminlte {
...
@@ -443,13 +452,14 @@ class renderadminlte {
$aElement
[
'title'
]
=
$aOptions
[
'title'
];
$aElement
[
'title'
]
=
$aOptions
[
'title'
];
$aElement
[
'label'
]
=
$aOptions
[
'text'
];
$aElement
[
'label'
]
=
$aOptions
[
'text'
];
return
$this
->
_
oHtml
->
getT
ag
(
'span'
,
$aElement
);
return
$this
->
_
t
ag
(
'span'
,
$aElement
);
}
}
/**
/**
* Get a button.
* Get a button.
* You can use any other key that are not named here. Those keys will be rendered
* You can use any other key that are not named here. Those keys will be rendered
* as additional html attributes without modification.
* as additional html attributes without modification.
* https://adminlte.io/themes/v3/pages/UI/buttons.html
*
*
* <button type="button" class="btn btn-block btn-default">Default</button>
* <button type="button" class="btn btn-block btn-default">Default</button>
* @param type $aOptions hash with keys for all options
* @param type $aOptions hash with keys for all options
...
@@ -470,11 +480,12 @@ class renderadminlte {
...
@@ -470,11 +480,12 @@ class renderadminlte {
;
;
$aElement
[
'label'
]
=
$aOptions
[
'text'
]
?
$aOptions
[
'text'
]
:
' '
;
$aElement
[
'label'
]
=
$aOptions
[
'text'
]
?
$aOptions
[
'text'
]
:
' '
;
unset
(
$aElement
[
'_infos'
]);
unset
(
$aElement
[
'_infos'
]);
return
$this
->
_
oHtml
->
getT
ag
(
'button'
,
$aElement
);
return
$this
->
_
t
ag
(
'button'
,
$aElement
);
}
}
/**
/**
* get a callout (box with coloered left border; has type, title + text)
* get a callout (box with coloered left border; has type, title + text)
* https://adminlte.io/themes/v3/pages/UI/general.html
*
*
* @param type $aOptions hash with keys for all options
* @param type $aOptions hash with keys for all options
* >> styling
* >> styling
...
@@ -495,13 +506,14 @@ class renderadminlte {
...
@@ -495,13 +506,14 @@ class renderadminlte {
return
$this
->
addWrapper
(
return
$this
->
addWrapper
(
'div'
,
[
'class'
=>
$sClass
],
'div'
,
[
'class'
=>
$sClass
],
(
$aOptions
[
'title'
]
?
$this
->
_
oHtml
->
getT
ag
(
'h5'
,
[
'label'
=>
$aOptions
[
'title'
]])
:
''
)
(
$aOptions
[
'title'
]
?
$this
->
_
t
ag
(
'h5'
,
[
'label'
=>
$aOptions
[
'title'
]])
:
''
)
.
(
$aOptions
[
'text'
]
?
$this
->
_
oHtml
->
getT
ag
(
'p'
,
[
'label'
=>
$aOptions
[
'text'
]])
:
''
)
.
(
$aOptions
[
'text'
]
?
$this
->
_
t
ag
(
'p'
,
[
'label'
=>
$aOptions
[
'text'
]])
:
''
)
);
);
}
}
/**
/**
* get a card
* get a card
* https://adminlte.io/docs/3.2/components/cards.html
*
*
* @param type $aOptions hash with keys for all options
* @param type $aOptions hash with keys for all options
* >> styling
* >> styling
...
@@ -538,12 +550,12 @@ class renderadminlte {
...
@@ -538,12 +550,12 @@ class renderadminlte {
// build parts of the card
// build parts of the card
$sCardHeader
=
$this
->
addWrapper
(
'div'
,
[
'class'
=>
'card-header'
],
$sCardHeader
=
$this
->
addWrapper
(
'div'
,
[
'class'
=>
'card-header'
],
$this
->
_
oHtml
->
getT
ag
(
'h3'
,
[
'class'
=>
'card-title'
,
'label'
=>
$aOptions
[
'title'
]])
$this
->
_
t
ag
(
'h3'
,
[
'class'
=>
'card-title'
,
'label'
=>
$aOptions
[
'title'
]])
.
(
$aOptions
[
'tools'
]
?
$this
->
_
oHtml
->
getT
ag
(
'div'
,
[
'class'
=>
'card-tools'
,
'label'
=>
$aOptions
[
'tools'
]])
:
''
)
.
(
$aOptions
[
'tools'
]
?
$this
->
_
t
ag
(
'div'
,
[
'class'
=>
'card-tools'
,
'label'
=>
$aOptions
[
'tools'
]])
:
''
)
);
);
$sCardBody
=
$this
->
_
oHtml
->
getT
ag
(
'div'
,
[
'class'
=>
'card-body'
,
'label'
=>
$aOptions
[
'text'
]]);
$sCardBody
=
$this
->
_
t
ag
(
'div'
,
[
'class'
=>
'card-body'
,
'label'
=>
$aOptions
[
'text'
]]);
$sCardFooter
=
$aOptions
[
'footer'
]
?
$this
->
_
oHtml
->
getT
ag
(
'div'
,
[
'class'
=>
'card-footer'
,
'label'
=>
$aOptions
[
'footer'
]])
:
''
;
$sCardFooter
=
$aOptions
[
'footer'
]
?
$this
->
_
t
ag
(
'div'
,
[
'class'
=>
'card-footer'
,
'label'
=>
$aOptions
[
'footer'
]])
:
''
;
// merge all
// merge all
return
$this
->
addWrapper
(
'div'
,
[
'class'
=>
$sClass
],
$sCardHeader
.
$sCardBody
.
$sCardFooter
);
return
$this
->
addWrapper
(
'div'
,
[
'class'
=>
$sClass
],
$sCardHeader
.
$sCardBody
.
$sCardFooter
);
...
@@ -568,8 +580,6 @@ class renderadminlte {
...
@@ -568,8 +580,6 @@ class renderadminlte {
...
@@ -752,12 +762,12 @@ class renderadminlte {
...
@@ -752,12 +762,12 @@ class renderadminlte {
public
function
getMenuItem
(
$aOptions
,
$aLinkOptions
){
public
function
getMenuItem
(
$aOptions
,
$aLinkOptions
){
$sLabel
=
$this
->
_
oHtml
->
getT
ag
(
'a'
,
$aLinkOptions
);
$sLabel
=
$this
->
_
t
ag
(
'a'
,
$aLinkOptions
);
// TODO
// TODO
// if subelements then add them to $sLabel with recursion
// if subelements then add them to $sLabel with recursion
return
$this
->
_
oHtml
->
getT
ag
(
'li'
,
array
(
return
$this
->
_
t
ag
(
'li'
,
array
(
'class'
=>
'treeview'
,
'class'
=>
'treeview'
,
'label'
=>
$sLabel
,
'label'
=>
$sLabel
,
));
));
...
...
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