diff --git a/public_html/classes/render-adminlte.class.php b/public_html/classes/render-adminlte.class.php index a6a0431115e2ff16c32408fa7c23ec8acd7e5552..33b9876a8883a206acce0deb7beb17968b598bc9 100755 --- a/public_html/classes/render-adminlte.class.php +++ b/public_html/classes/render-adminlte.class.php @@ -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 * @param array $aOptions options array of the method * @param array $aKeys required keys @@ -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> * @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 * - class - any css class for customizing, eg. "disabled" - * - icon - * - text + * - icon - not supported yet + * - text - text on button * @return string */ public function getButton($aOptions){ $aOptions=$this->_ensureOptions($aOptions, ['type', 'size', 'class', 'text', 'icon']); - $aElement=[ - 'class'=>'btn ' - .(isset($aOptions['class']) ? ' '.$aOptions['class'] : '') - .(isset($aOptions['type']) ? ' btn-'.$aOptions['type'] : '') - .(isset($aOptions['size']) ? ' btn-'.$aOptions['size'] : '') - , - 'label'=>isset($aOptions['text']) ? $aOptions['text'] : '' - ]; + $aElement=$aOptions; + $aElement['class']='btn ' + .($aOptions['class'] ? ' '.$aOptions['class'] : '') + .($aOptions['type'] ? ' btn-'.$aOptions['type'] : '') + .($aOptions['size'] ? ' btn-'.$aOptions['size'] : '') + ; + $aElement['label']=$aOptions['text'] ? $aOptions['text'] : ' '; + unset($aElement['_infos']); 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 * >> styling @@ -503,7 +506,7 @@ class renderadminlte { * @param type $aOptions hash with keys for all options * >> styling * - 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 * "gradient" - whole card is colored with a gradient * - type - one of [none]|danger|dark|info|primary|secondary|success|warning @@ -822,7 +825,7 @@ class renderadminlte { * return a widget * @param type $aOptions hash with keys for all options * - 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 * - icon * - text diff --git a/public_html/inc_functions.php b/public_html/inc_functions.php index 552445613d1177eb1ecb27dea19f9f586eba21b4..f2a5a283995aa24c440de6bb38b3a0d322fdcb11 100644 --- a/public_html/inc_functions.php +++ b/public_html/inc_functions.php @@ -15,7 +15,7 @@ function showExample($sPhpcode){ <br> '.$sOut.' <br> - generated html code (line breaks were added here): + generated html code: <pre>'.htmlentities(str_replace([">", "</"], [">\n", "\n</"], $sOut)).'</pre> '; diff --git a/public_html/pages/components/badge.php b/public_html/pages/components/badge.php index 38f6ac40d551125a0b18b68febf1dc287a0aaab0..6ed392e9fb7c31faf832de274142deb7f9444615 100644 --- a/public_html/pages/components/badge.php +++ b/public_html/pages/components/badge.php @@ -1,5 +1,10 @@ <?php +$aOptions=[ + 'type'=>'danger', + 'title'=>'Errors: 5', + 'text'=>'5', +]; echo $renderAdminLTE->addRow( '<h2>Badges</h2>' @@ -14,67 +19,7 @@ echo $renderAdminLTE->addRow( </pre> ' ) -.$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> - - <p> - Text and badge in a span tag: - <span> - Errors - ' +.showExample('$renderAdminLTE->getBadge('.var_export($aOptions, 1).')') + - . $renderAdminLTE->getBadge([ - 'type'=>'danger', - 'title'=>'Errors: 5', - 'text'=>'5', - ]) - .' - </span>. - </p> - ' -) ; \ No newline at end of file diff --git a/public_html/pages/components/button.php b/public_html/pages/components/button.php index cd87a1f58faa8fed49b7d6e13d0ce6af46474194..1b74b26211d9b763676089bb29be383ddcfd7b95 100644 --- a/public_html/pages/components/button.php +++ b/public_html/pages/components/button.php @@ -1,5 +1,11 @@ <?php +$aOptions=[ + 'type'=>'primary', + 'text'=>'Click me', +]; + + // ----- buttons $sButtontest=''; @@ -27,41 +33,8 @@ echo $renderAdminLTE->addRow( </pre> ' ) -.$renderAdminLTE->addRow( - '<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> - ' -) +.showExample('$renderAdminLTE->getButton('.var_export($aOptions, 1).')') + .$renderAdminLTE->addRow( '<h3>Test</h3>' .$sButtontest diff --git a/public_html/pages/components/callout.php b/public_html/pages/components/callout.php index ce002314341c386980f4807b98e1d76b8945ff45..7a50832cfdcc6f0525d6da3d4d38b1cf1e825b70 100644 --- a/public_html/pages/components/callout.php +++ b/public_html/pages/components/callout.php @@ -1,6 +1,6 @@ <?php -$aCard=[ +$aOptions=[ 'type'=>'success', 'title'=>'I am a success callout', 'text'=>'This is a gren callout.', @@ -8,7 +8,7 @@ $aCard=[ echo $renderAdminLTE->addRow( - '<h2>Callouts</h2>' + '<h2>Callout</h2>' ) .$renderAdminLTE->addRow( '<h3>Syntax</h3> @@ -18,66 +18,6 @@ echo $renderAdminLTE->addRow( ' ) -.showExample('$renderAdminLTE->getCallout('.var_export($aCard, 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> - ' -) -*/ +.showExample('$renderAdminLTE->getCallout('.var_export($aOptions, 1).')') ; \ No newline at end of file