Example #1
0
 public static function Anchor($uri, $title = NULL, $attributes = NULL, $protocol = NULL, $escape_title = FALSE)
 {
     /**
      * Create HTML link anchors.
      *
      * @param   string  URL or URI string
      * @param   string  link text
      * @param   array   HTML anchor attributes
      * @param   string  non-default protocol, eg: https
      * @param   boolean option to escape the title that is output
      * @return  string
      */
     if ($protocol === NULL) {
         $protocol = getenv('HTTPS') == 'on' ? 'https' : 'http';
     }
     if (strpos($uri, '#') === 0) {
         // This is an id target link, not a URL
         $site_url = $uri;
     } elseif (strpos($uri, '://') === FALSE) {
         $site_url = Uri::baseUrl() . $uri;
     } else {
         //$attributes['target'] = '_blank';
         $site_url = $uri;
     }
     return '<a href="' . $site_url . '"' . (is_array($attributes) ? htmlAttributes($attributes) : '') . '>' . ($escape_title ? htmlspecialchars($title === NULL ? $site_url : $title, ENT_QUOTES, 'UTF-8', FALSE) : ($title === NULL ? $site_url : $title)) . '</a>';
 }
 function display($Active = 0)
 {
     $nav = '';
     $html = '';
     foreach ($this->Contents as $i => $v) {
         $id = @$v['id'] ? $v['id'] : uniqid('tab_');
         $classActive = $i == $Active ? 'active' : null;
         # Navegador
         $nav .= '<li role="presentation" class="' . $classActive . '" >' . '<a href="#' . $id . '" aria-controls="' . $id . '" role="tab" data-toggle="tab" >' . $v['linkTitle'] . '</a>' . '</li>';
         # Conteúdo
         $html .= '<div role="tabpanel" class="tab-pane ' . $classActive . '" id="' . $id . '" >' . '<div ' . htmlAttributes($v['attrs']) . ' >' . $v['content'] . '</div>' . '</div>';
     }
     return '<div class="tab-dashboard" ><ul class="nav nav-tabs" role="tablist" >' . $nav . '</ul><div class="tab-content" >' . $html . '</div></div>';
 }
Example #3
0
/**
 * Cria um box
 * @param string $title
 * @param string $content
 * @param array $attibutes
 * @return string
 */
function formBox($title, $content, array $attibutes = null)
{
    $class = 'boxRadio';
    if ($attibutes) {
        if (isset($attibutes['class'])) {
            $class .= ' ' . $attibutes['class'];
            unset($attibutes['class']);
        }
    }
    $html = '<div class="' . $class . '" ' . htmlAttributes($attibutes) . ' >';
    $html .= '<label class="' . $class . '-title" >' . $title . '</label>';
    $html .= '<div class="' . $class . '-content">';
    if (is_array($content)) {
        foreach ($content as $item) {
            $html .= $item;
        }
    } else {
        $html .= $content;
    }
    $html .= '<span class="clearfix"></span></div></div>';
    return $html;
}
 /**
  * HTML
  * @return string
  */
 function display()
 {
     $html = '';
     foreach ([$this->Header, $this->Body, $this->Footer] as $i => $arr) {
         switch ($i) {
             case 0:
                 $Class = 'panel-heading';
                 break;
             case 1:
                 $Class = 'panel-body';
                 break;
             case 2:
                 $Class = 'panel-footer';
                 break;
         }
         if (!empty($arr['attrs']) or !empty($arr['content'])) {
             $Attributes = (array) @$arr['attrs'];
             $Attributes['class'] = trim(@$Attributes['class'] . ' ' . $Class);
             if (strpos($arr['content'], '<table') !== false) {
                 $Attributes['class'] = $Attributes['class'] . ' panel-table';
             }
             $html .= '<div ' . htmlAttributes($Attributes) . ' >';
             $html .= @$arr['content'];
             $html .= '</div>';
         }
     }
     $Attributes = $this->Attrs;
     $Attributes['class'] = trim(@$this->Attrs['class'] . ' panel panel-' . $this->Class);
     return '<div ' . htmlAttributes($Attributes) . ' >' . $html . '</div>';
 }
 /**
  * Retorna o HTML da paginação
  * @param string $Link
  * @param array $Attributes
  * @return string
  */
 function display($Link = null, array $Attributes = null)
 {
     if ($this->Count) {
         $html = '<nav ' . htmlAttributes($Attributes) . ' >';
         if ($this->TotalPaginas > 1) {
             $html .= '<ul class="pagination" >';
             # Min e Max
             $min = (int) max(1, $this->CurrentPage - ($this->VisiblePages - 1) * 0.5);
             $max = (int) min($this->TotalPaginas, $this->CurrentPage >= ($this->VisiblePages - 1) * 0.5 + 1 ? $this->CurrentPage + ($this->VisiblePages - 1) * 0.5 : $this->CurrentPage + 11 - $this->CurrentPage);
             if ($this->TotalPaginas == $max) {
                 $min = max(1, $max - $this->VisiblePages + 1);
             }
             # Ir para a primeira página
             if ($min > 1) {
                 $html .= '<li><a data-page="1" href="' . str_replace('#page#', 1, $Link ? $Link : '#') . '" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>';
             }
             # Páginas
             for ($i = $min; $i <= $max; $i++) {
                 $html .= '<li class="' . ($this->CurrentPage == $i ? 'active' : null) . '" ><a data-page="' . $i . '" href="' . str_replace('#page#', $i, $Link ? $Link : '#') . '" >' . $i . '</a></li>';
             }
             # Ir para a última página
             if ($max < $this->TotalPaginas) {
                 $html .= '<li><a href="' . str_replace('#page#', $this->TotalPaginas, $Link ? $Link : '#') . '" data-page="' . $this->TotalPaginas . '" aria-label="Next" ><span aria-hidden="true">&raquo;</span></a></li>';
             }
             $html .= '</ul>';
             return $html . '</nav> <!-- ' . calc_execution_time() . 'ms -->';
         }
     }
     return '';
 }
 /**
  * 
  * @param array $Attrs
  * @param array $hideAttrs
  * @return string
  */
 private static function _attrs(array $Attrs, array $hideAttrs = null)
 {
     foreach ($hideAttrs as $key) {
         if (isset($Attrs[$key])) {
             unset($Attrs[$key]);
         }
     }
     return htmlAttributes($Attrs);
 }