function button_tpl($params = array())
 {
     $button = "";
     $main = "";
     $btn = "";
     if (!empty($params)) {
         $text = array_key_exists('text', $params) ? $params['text'] : false;
         $type = array_key_exists('type', $params) ? $params['type'] : array();
         $id = array_key_exists('id', $params) ? $params['id'] : array();
         $iconsweets = array_key_exists('iconsweets', $params) ? $params['iconsweets'] : '';
         $event = array_key_exists('event', $params) ? $params['event'] : array();
         $href = array_key_exists('href', $params) ? $params['href'] : false;
     } else {
         return false;
     }
     if (is_array($text)) {
         $i = 0;
         foreach ($text as $key => $value) {
             $label = array_key_exists($i, $text) ? $text[$i] : '';
             $icon = array_key_exists($i, $iconsweets) ? $iconsweets[$i] : 'iconsweets-link';
             $link = array_key_exists($i, $href) ? $href[$i] == '' ? '' : "href='" . $href[$i] . "'" : '';
             $ident = array_key_exists($i, $id) ? $id[$i] == '' ? '' : "id='" . $id[$i] . "'" : '';
             if (array_key_exists($i, $type)) {
                 $evt = array_key_exists($i, $event) ? explode('=', data_event_tpl($event[$i])) : '';
                 $file = trim(str_replace(' ', '', $label));
                 $btn = "<a {$ident} onclick ='document.getElementById(" . '"' . $file . '"' . ").click();' class='btn btn-primary'> \r\n                                    <i class='{$icon}'></i> &nbsp; \r\n                                    {$label}\r\n                                </a>";
                 $data = array('id' => $file, 'type' => 'file', 'name' => "userfile", 'style' => '');
                 if (is_array($evt)) {
                     $data[$evt[0]] = str_replace("'", "", $evt[1]);
                 }
                 $btn .= form_input($data);
             } else {
                 $evt = array_key_exists($i, $event) ? data_event_tpl($event[$i]) : '';
                 $btn = "<a {$link} {$evt} {$ident} class='btn btn-primary'> \r\n                                    <i class='{$icon}'></i> &nbsp; \r\n                                    {$label}\r\n                                </a>";
             }
             $main .= '<li>' . $btn . '</li>';
             $i++;
         }
         $button .= '<ul class="list-nostyle list-inline">' . $main . '</ul>';
     } else {
         $label = $text;
         $icon = $iconsweets ? $iconsweets : 'iconsweets-link';
         $event = array_key_exists('event', $params) ? data_event_tpl($params['event']) : '';
         $link = $href ? "href='" . $href . "'" : '';
         $button = "<ul class='list-nostyle list-inline'><li><a {$link} {$event} class='btn btn-primary'> <i class='{$icon}'></i> &nbsp; {$label}</a> </li></ul>";
     }
     return $button;
 }
 function button_tpl($params = array())
 {
     $button = "";
     if (!empty($params)) {
         $text = array_key_exists('text', $params) ? $params['text'] : false;
         $iconsweets = array_key_exists('iconsweets', $params) ? $params['iconsweets'] : '';
         $event = array_key_exists('event', $params) ? data_event_tpl($params['event']) : false;
         $href = array_key_exists('href', $params) ? $params['href'] : false;
         //style="color:red;"
     } else {
         return false;
     }
     if (is_array($text)) {
         for ($i = 0; $i < count($text); $i++) {
             $label = $text[$i];
             $icon = $iconsweets[$i] ? $iconsweets[$i] : 'iconsweets-link';
             $jsOn = $onclick[$i] ? 'onclick="' . $onclick[$i] . '"' : '';
             $link = $href[$i] ? $href[$i] : '';
             $button .= "<li><a href='{$link}' class='btn btn-rounded'> <i class='{$icon}'></i> &nbsp; {$label}</a> </li>";
         }
         $button .= '<ul class="list-nostyle list-inline">' . $button . '</ul>';
     } else {
         $label = $text;
         $icon = $iconsweets ? $iconsweets : 'iconsweets-link';
         $event = $event ? $event : '';
         $link = $href ? "href='" . $href . "'" : '';
         $button = "<ul class='list-nostyle list-inline'><li><a {$link} {$event} class='btn btn-rounded'> <i class='{$icon}'></i> &nbsp; {$label}</a> </li></ul>";
     }
     return $button;
 }