Example #1
1
            $paramsString = $paramsString . " " . $key . ' = "' . $value . '"';
        }
    }
    if ($class == '') {
        $class = 'panel panel-default';
    }
    if ($id == null) {
        $id = "";
    }
    return '<div class="' . $class . '" ' . $paramsString . ' data-toggle="modal" data-target="#modal-liste-update">
                <div class="panel-heading">
                    <h3 class="panel-title">' . $title . '</h3>
                </div>';
});
HtmlFacade::macro('panelClose', function () {
    return '</div>';
});
FormFacade::macro('checkboxInsert', function ($name, $id, $text) {
    if ($name == null) {
        $name = '';
    }
    if ($id == null) {
        $id = '';
    }
    if ($text == null) {
        $text = '';
    }
    return '<div class="checkbox">
                <label>
                    <input id="' . $id . '" name="' . $name . '" type="checkbox"> ' . $text . '</label>
            </div>';
Example #2
0
 /**
  * Get the evaluated contents of the object.
  *
  * @return string
  */
 public function render()
 {
     $output = '';
     foreach ($this->entries as $entry) {
         $entryAttributes = [];
         if ($entry instanceof DropdownDivider) {
             $entryAttributes['role'] = 'seperator';
             $entryAttributes['class'] = 'divider';
         } else {
             if ($entry instanceof DropdownHeader) {
                 $entryAttributes['class'] = 'dropdown-header';
             } else {
                 if (MenuHelper::isCurrentRoute($entry->getName())) {
                     $entryAttributes['class'] = 'active';
                 } else {
                     foreach ($entry->getAdditionalRouteNames() as $additionalRouteName) {
                         if (MenuHelper::isCurrentRoute($additionalRouteName)) {
                             $entryAttributes['class'] = ' active';
                         }
                     }
                 }
             }
         }
         $output .= '<li ' . Html::attributes($entryAttributes) . '>' . $entry->render() . '</li>';
     }
     if (empty($this->name)) {
         $link = Html::link('#', $this->title . '<span class="caret"></span>', ['class' => 'dropdown-toggle', 'data-toggle' => 'dropdown']);
     } else {
         $link = Html::linkRoute($this->name, $this->title . '<span class="caret"></span>', $this->parameters, ['class' => 'dropdown-toggle', 'data-toggle' => 'dropdown']);
     }
     return $link . '<ul class="dropdown-menu">' . $output . '</ul>';
 }
Example #3
0
 /**
  * Get the evaluated contents of the object.
  *
  * @return string
  */
 public function render()
 {
     if (empty($this->name)) {
         $content = Html::link('#', $this->title, $this->attributes);
     } else {
         $content = Html::linkRoute($this->name, $this->title, $this->parameters, $this->attributes);
     }
     return $content;
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/assets' => public_path('assets')], 'larassets');
     $this->publishes([__DIR__ . '/custom' => public_path('custom')], 'custom-larassets');
     $this->loadViewsFrom(__DIR__ . '/views', 'larassets');
     Html::component('googleFont', 'larassets::assets.google-font', ['font' => 'Roboto', 'sizes' => '100,300,400,700']);
     Html::component('bootstrapAsset', 'larassets::assets.bootstrap', ['type' => 'css', 'version' => '3.3.6', 'theme' => null]);
     Html::component('jqueryAsset', 'larassets::assets.jquery', ['version' => '2.2.0']);
     Html::component('fontAwesomeAsset', 'larassets::assets.font-awesome', ['version' => '4.5.0']);
     Html::component('customAsset', 'larassets::custom.custom', ['type' => 'css']);
 }
Example #5
0
 /**
  * @param string $url
  * @param string $name
  * @param string $position
  * @param array  $attributes
  *
  * @return $this
  */
 public function link($url, $name, $position = "BL", $attributes = array())
 {
     $base = str_replace(Request::path(), '', strtok(Request::fullUrl(), '?'));
     $match_url = str_replace($base, '/', strtok($url, '?'));
     if (Request::path() != $match_url) {
         $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY));
     }
     $attributes = array_merge(array("class" => "btn btn-default"), $attributes);
     $this->button_container[$position][] = HTML::link($url, $name, $attributes);
     $this->links[] = $url;
     return $this;
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     $this->loadViewsFrom(__DIR__ . '/views', 'larastrap');
     Form::component('fhOpen', 'larastrap::form-horizontal.open', ['attributes' => []]);
     Form::component('fhClose', 'larastrap::form-horizontal.close', []);
     Form::component('fhText', 'larastrap::form-horizontal.text', ['name', 'label', 'value' => null, 'attributes' => [], 'size' => [4, 6]]);
     Form::component('fhPassword', 'larastrap::form-horizontal.password', ['name', 'label', 'attributes' => [], 'size' => [4, 6]]);
     Form::component('fhSelect', 'larastrap::form-horizontal.select', ['name', 'label', 'value' => [], 'selected' => null, 'attributes' => [], 'size' => [4, 6]]);
     Form::component('fhSubmit', 'larastrap::form-horizontal.submit', ['text' => 'Submit', 'class' => 'default', 'icon' => 'check', 'size' => [4, 6]]);
     Form::component('fhDateTime', 'larastrap::form-horizontal.datetime', ['name', 'label', 'id' => null, 'value' => null, 'attributes' => [], 'size' => [4, 6]]);
     /*
      * Custom components...
      */
     Html::component('customPageTitle', 'larastrap::custom.page-title', ['title' => 'Page title']);
 }
 /**
  * Get the evaluated contents of the object.
  *
  * @return string
  */
 public function render()
 {
     $output = '';
     foreach ($this->entries as $entry) {
         $entryAttributes = [];
         if ($entry instanceof Dropdown) {
             $entryAttributes['class'] = 'dropdown';
             foreach ($entry->getEntries() as $dropdownEntry) {
                 if ($dropdownEntry instanceof Link) {
                     foreach ($dropdownEntry->getAdditionalRouteNames() as $additionalRouteName) {
                         if (MenuHelper::isCurrentRoute($additionalRouteName)) {
                             $entryAttributes['class'] .= ' active';
                         }
                     }
                     if (MenuHelper::isCurrentRoute($dropdownEntry->getName())) {
                         $entryAttributes['class'] .= ' active';
                     }
                 }
             }
         } elseif ($entry instanceof Content) {
             $entryAttributes['class'] = 'navbar-text';
         } else {
             foreach ($entry->getAdditionalRouteNames() as $additionalRouteName) {
                 if (MenuHelper::isCurrentRoute($additionalRouteName)) {
                     $entryAttributes['class'] = ' active';
                 }
             }
             if (MenuHelper::isCurrentRoute($entry->getName())) {
                 $entryAttributes['class'] = 'active';
             }
         }
         if ($entry->isVisible()) {
             $output .= '<li ' . Html::attributes($entryAttributes) . '>' . $entry->render() . '</li>';
         }
     }
     return '<ul ' . Html::attributes($this->attributes) . '>' . $output . '</ul>';
 }
Example #8
0
 /**
  * This adds the necessary classes to chunk HTML for them to be picked up by the JS editor.
  * i.e. it makes chunks editable.
  *
  * @param string $html HTML to add classes to.
  *
  * @return string
  */
 public function addAttributesToHtml($html)
 {
     $html = trim((string) $html);
     $attributes = array_merge($this->getRequiredAttributes(), $this->attributes());
     $attributesString = Html::attributes($attributes);
     return preg_replace('|<(.*?)>|', "<\$1{$attributesString}>", $html, 1);
 }
Example #9
0
 public static function styles($demo = false)
 {
     $buffer = "\n";
     //css links
     foreach (self::$css as $item) {
         $buffer .= HTML::style($item);
     }
     if ($demo) {
         $buffer .= HTML::style('packages/zofe/rapyd/assets/demo/style.css');
     }
     //inline styles
     if (count(self::$styles)) {
         $buffer .= sprintf("<style type=\"text/css\">\n%s\n</style>", implode("\n", self::$styles));
     }
     $buffer .= HTML::style('packages/zofe/rapyd/assets/rapyd.css');
     return $buffer;
 }
 /**
  * @param DocumentInterface $document
  * @param mixed             $value
  *
  * @return mixed
  */
 public function onGetHeadlineValue(DocumentInterface $document, $value)
 {
     return empty($value) ? null : HtmlFacade::mailto($value);
 }
Example #11
0
 /**
  * Get html attribute data
  * 
  * @access public
  * @return string|null
  */
 public function getAttributes()
 {
     return $this->has('attributes') ? HTML::attributes($this->get('attributes')) : null;
 }
Example #12
0
 function __toString()
 {
     $this->attribute('id', $this->id);
     $attributes = array_map(function ($value) {
         return is_array($value) ? join(' ', $value) : $value;
     }, $this->attributes);
     /** @var \Illuminate\Support\HtmlString $html */
     $html = $this->url ? link_to($this->url, $this->text, $attributes) : HtmlFacade::tag('button', $this->text, $attributes);
     return $html->toHtml();
 }
Example #13
0
 /**
  * Get the evaluated contents of the specified menu container.
  *
  * @param string|null $menuName
  * @return string
  * @throws MenuNotFoundException
  */
 public function render($menuName = null)
 {
     if (empty($menuName)) {
         $menuName = self::DEFAULT_MENU_NAME;
     }
     $menu = $this->menus->filter(function (MenuContainer $menu) use($menuName) {
         return $menu->getName() == $menuName;
     })->first();
     if ($menu instanceof MenuContainer) {
         return MenuHelper::purifyHtml(Html::decode($menu->render()));
     } else {
         throw new MenuNotFoundException($menuName);
     }
 }
Example #14
0
 public static function styles()
 {
     return join("\n", array_map(function ($style) {
         return HtmlFacade::style($style);
     }, self::$styles));
 }
Example #15
0
});
/**
 * Generate menu element with localized label
 * 
 * @param   string  $elementName
 * @param   array   $parameters
 * @param   array   $attributes* 
 * @return  string
 */
Html::macro('link_menu_translated', function ($elementName, array $parameters = array(), array $attributes = array()) {
    $label = trans(spine_config('spine.link_menu.lang_filename', 'menu') . '.' . $elementName);
    return Html::link_menu($elementName, $label, $parameters, $attributes);
});
/**
 * Get yes|no localized string based on boolean representation of given value
 * 
 * @param   bool $value
 * @return  string
 */
Html::macro('print_bool', function ($value) {
    return (bool) $value ? transpine('helpers.yes') : transpine('helpers.no');
});
/**
 * Get html for iconic (visual) version of boolean value
 * 
 * @param   bool    $value
 * @return  string
 */
Html::macro('visual_bool', function ($value) {
    return '<i class="fa ' . ((bool) $value ? 'fa-check-square-o done' : 'fa-square-o') . '"></i>';
});
<?php

/*
 * Just a little helper to add the active class to the current route
 * in the administration side navbar
 */
use Illuminate\Support\Facades\Request;
use Collective\Html\HtmlFacade as Html;
Html::macro('activeState', function ($routes = array()) {
    foreach ($routes as $route) {
        if (strpos(Request::url(), route($route)) !== false) {
            return 'active';
        }
    }
    return '';
});
Example #17
-1
 /**
  * Get HTML attribute data.
  *
  * @return mixed
  */
 public function getAttributes()
 {
     $attributes = $this->attributes;
     array_forget($attributes, ['active', 'icon']);
     return HTML::attributes($attributes);
 }
Example #18
-1
 public function show()
 {
     $posts = $this->getAllBlogs();
     $email = HtmlFacade::mailto('*****@*****.**', 'here');
     return View::make('home', compact('posts', 'email'));
 }