Skip to content
Snippets Groups Projects
Commit 2e5c5521 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update components

parent 8e360a9b
No related branches found
No related tags found
No related merge requests found
...@@ -355,7 +355,7 @@ class renderadminlte { ...@@ -355,7 +355,7 @@ class renderadminlte {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
/** /**
* helper function for get[COMPONENTNAME] functions: * helper function for get[COMPONENTNAME] methods:
* ensure that all wanted keys exist in an array. Non existing keys will be added with value false * ensure that all wanted keys exist in an array. Non existing keys will be added with value false
* @param array $aOptions options array of the method * @param array $aOptions options array of the method
* @param array $aKeys required keys * @param array $aKeys required keys
...@@ -447,31 +447,34 @@ class renderadminlte { ...@@ -447,31 +447,34 @@ class renderadminlte {
} }
/** /**
* get a button * Get a button.
* You can use any other key that are not named here. Those keys will be rendered
* as additional html attributes without modification.
*
* <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
* - type - one of [none]|danger|dark|info|primary|secondary|success|warning * - type - one of [none]|danger|dark|info|primary|secondary|success|warning
* - size - one of [none]|lg|sm|xs|flat * - size - one of [none]|lg|sm|xs|flat
* - class - any css class for customizing, eg. "disabled" * - class - any css class for customizing, eg. "disabled"
* - icon * - icon - not supported yet
* - text * - text - text on button
* @return string * @return string
*/ */
public function getButton($aOptions){ public function getButton($aOptions){
$aOptions=$this->_ensureOptions($aOptions, ['type', 'size', 'class', 'text', 'icon']); $aOptions=$this->_ensureOptions($aOptions, ['type', 'size', 'class', 'text', 'icon']);
$aElement=[ $aElement=$aOptions;
'class'=>'btn ' $aElement['class']='btn '
.(isset($aOptions['class']) ? ' '.$aOptions['class'] : '') .($aOptions['class'] ? ' '.$aOptions['class'] : '')
.(isset($aOptions['type']) ? ' btn-'.$aOptions['type'] : '') .($aOptions['type'] ? ' btn-'.$aOptions['type'] : '')
.(isset($aOptions['size']) ? ' btn-'.$aOptions['size'] : '') .($aOptions['size'] ? ' btn-'.$aOptions['size'] : '')
, ;
'label'=>isset($aOptions['text']) ? $aOptions['text'] : '' $aElement['label']=$aOptions['text'] ? $aOptions['text'] : '&nbsp;';
]; unset($aElement['_infos']);
return $this->_oHtml->getTag('button', $aElement); return $this->_oHtml->getTag('button', $aElement);
} }
/** /**
* get a calout (box with coloered left border; has type, title + text) * get a callout (box with coloered left border; has type, title + text)
* *
* @param type $aOptions hash with keys for all options * @param type $aOptions hash with keys for all options
* >> styling * >> styling
...@@ -503,7 +506,7 @@ class renderadminlte { ...@@ -503,7 +506,7 @@ class renderadminlte {
* @param type $aOptions hash with keys for all options * @param type $aOptions hash with keys for all options
* >> styling * >> styling
* - variant: "default" - titlebar is colored * - variant: "default" - titlebar is colored
* "outline" - small stripe on top border is colored * "outline" - a small stripe on top border is colored
* "solid" - whole card is colored * "solid" - whole card is colored
* "gradient" - whole card is colored with a gradient * "gradient" - whole card is colored with a gradient
* - type - one of [none]|danger|dark|info|primary|secondary|success|warning * - type - one of [none]|danger|dark|info|primary|secondary|success|warning
...@@ -822,7 +825,7 @@ class renderadminlte { ...@@ -822,7 +825,7 @@ class renderadminlte {
* return a widget * return a widget
* @param type $aOptions hash with keys for all options * @param type $aOptions hash with keys for all options
* - bgcolor - icon color one of aqua|green|yellow|red * - bgcolor - icon color one of aqua|green|yellow|red
* - color - icon color one of aqua|black|gray|green|orange|maroon|navy|purple|red|teal|yellow * - color - color one of aqua|black|gray|green|orange|maroon|navy|purple|red|teal|yellow
* - onclick * - onclick
* - icon * - icon
* - text * - text
......
...@@ -15,7 +15,7 @@ function showExample($sPhpcode){ ...@@ -15,7 +15,7 @@ function showExample($sPhpcode){
<br> <br>
'.$sOut.' '.$sOut.'
<br> <br>
generated html code (line breaks were added here): generated html code:
<pre>'.htmlentities(str_replace([">", "</"], [">\n", "\n</"], $sOut)).'</pre> <pre>'.htmlentities(str_replace([">", "</"], [">\n", "\n</"], $sOut)).'</pre>
'; ';
......
<?php <?php
$aOptions=[
'type'=>'danger',
'title'=>'Errors: 5',
'text'=>'5',
];
echo $renderAdminLTE->addRow( echo $renderAdminLTE->addRow(
'<h2>Badges</h2>' '<h2>Badges</h2>'
...@@ -14,67 +19,7 @@ echo $renderAdminLTE->addRow( ...@@ -14,67 +19,7 @@ echo $renderAdminLTE->addRow(
</pre> </pre>
' '
) )
.$renderAdminLTE->addRow( .showExample('$renderAdminLTE->getBadge('.var_export($aOptions, 1).')')
'<h3>Keys</h3>
<table class="table">
<tr>
<th>Key</th>
<th>Description</th>
</tr>
<tr>
<td>bgcolor</td>
<td>background color (without prefix "bg")</td>
</tr>
<tr>
<td>class</td>
<td>any css class for customizing, eg. "disabled"</td>
</tr>
<tr>
<td>id</td>
<td>optional: id attribute</td>
</tr>
<tr>
<td>text</td>
<td>button label text</td>
</tr>
<tr>
<td>title</td>
<td>optional: title attribute</td>
</tr>
<tr>
<td>type</td>
<td>one of [none]|danger|info|primary|success|warning</td>
</tr>
</table>
'
)
.$renderAdminLTE->addRow(
'<h3>Example</h3><pre>
$renderAdminLTE->getBadge([
\'type\'=>\'danger\',
\'title\'=>\'Errors: 5\',
\'text\'=>\'5\',
])
</pre>
'
)
.$renderAdminLTE->addRow(
'<h3>Test</h3>
<p>
Text and badge in a span tag:
<span>
Errors
'
. $renderAdminLTE->getBadge([
'type'=>'danger',
'title'=>'Errors: 5',
'text'=>'5',
])
.'
</span>.
</p>
'
)
; ;
\ No newline at end of file
<?php <?php
$aOptions=[
'type'=>'primary',
'text'=>'Click me',
];
// ----- buttons // ----- buttons
$sButtontest=''; $sButtontest='';
...@@ -27,41 +33,8 @@ echo $renderAdminLTE->addRow( ...@@ -27,41 +33,8 @@ echo $renderAdminLTE->addRow(
</pre> </pre>
' '
) )
.$renderAdminLTE->addRow( .showExample('$renderAdminLTE->getButton('.var_export($aOptions, 1).')')
'<h3>Keys</h3>
<table class="table">
<tr>
<th>Key</th>
<th>Description</th>
</tr>
<tr>
<td>class</td>
<td>any css class for customizing, eg. "disabled"</td>
</tr>
<tr>
<td>size</td>
<td>one of [none]|lg|sm|xs|flat</td>
</tr>
<tr>
<td>type</td>
<td>one of [none]|danger|info|primary|success|warning</td>
</tr>
<tr>
<td>text</td>
<td>button label text</td>
</tr>
</table>
'
)
.$renderAdminLTE->addRow(
'<h3>Example</h3><pre>
$renderAdminLTE->getButton([
\'text\'=>\'Click me\',
\'class\'=>\'primary\',
])
</pre>
'
)
.$renderAdminLTE->addRow( .$renderAdminLTE->addRow(
'<h3>Test</h3>' '<h3>Test</h3>'
.$sButtontest .$sButtontest
......
<?php <?php
$aCard=[ $aOptions=[
'type'=>'success', 'type'=>'success',
'title'=>'I am a success callout', 'title'=>'I am a success callout',
'text'=>'This is a gren callout.', 'text'=>'This is a gren callout.',
...@@ -8,7 +8,7 @@ $aCard=[ ...@@ -8,7 +8,7 @@ $aCard=[
echo $renderAdminLTE->addRow( echo $renderAdminLTE->addRow(
'<h2>Callouts</h2>' '<h2>Callout</h2>'
) )
.$renderAdminLTE->addRow( .$renderAdminLTE->addRow(
'<h3>Syntax</h3> '<h3>Syntax</h3>
...@@ -18,66 +18,6 @@ echo $renderAdminLTE->addRow( ...@@ -18,66 +18,6 @@ echo $renderAdminLTE->addRow(
' '
) )
.showExample('$renderAdminLTE->getCallout('.var_export($aCard, 1).')') .showExample('$renderAdminLTE->getCallout('.var_export($aOptions, 1).')')
/*
.$renderAdminLTE->addRow(
'<h3>Keys</h3>
<table class="table">
<tr>
<th>Key</th>
<th>Description</th>
</tr>
<tr>
<td>bgcolor</td>
<td>background color (without prefix "bg")</td>
</tr>
<tr>
<td>class</td>
<td>any css class for customizing, eg. "disabled"</td>
</tr>
<tr>
<td>id</td>
<td>optional: id attribute</td>
</tr>
<tr>
<td>text</td>
<td>button label text</td>
</tr>
<tr>
<td>title</td>
<td>optional: title attribute</td>
</tr>
<tr>
<td>type</td>
<td>one of [none]|danger|info|primary|success|warning</td>
</tr>
</table>
'
)
.$renderAdminLTE->addRow(
'<h3>Example</h3><pre>
$renderAdminLTE->getBadge([
\'type\'=>\'danger\',
\'title\'=>\'Errors: 5\',
\'text\'=>\'5\',
])
</pre>
'
)
.$renderAdminLTE->addRow(
'<h3>Test</h3>
'
. $renderAdminLTE->getCard($aCard)
.'
<pre>'
. htmlentities($renderAdminLTE->getCard($aCard))
.'
</pre>
</p>
'
)
*/
; ;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment