Пример #1
0
    if (!isset($attr['class'])) {
        $attr['class'] = array();
    }
    $attr['class'] = array_merge(array('text-' . $kind), (array) $attr['class']);
    return Cell::unit('a', $text, $attr, $indent);
});
// File uploader
Jot::add('uploader', function ($action, $accept = null, $fields = array()) {
    $speak = Config::speak();
    $html = Cell::begin('form', array('class' => array('form-ignite', 'form-upload'), 'action' => Converter::url($action), 'method' => 'post', 'enctype' => 'multipart/form-data')) . NL;
    $html .= Form::hidden('token', Guardian::token(), array(), 1) . NL;
    foreach ($fields as $name => $value) {
        $html .= Form::hidden($name, $value, array(), 1) . NL;
    }
    $html .= Cell::begin('span', array('class' => array('input-outer', 'btn', 'btn-default')), 1) . NL;
    $html .= Cell::unit('span', Jot::icon('folder-open') . ' ' . $speak->manager->placeholder_file, array(), 2) . NL;
    $html .= Form::file('file', array('title' => $speak->manager->placeholder_file, 'data' => array('icon-ready' => 'fa fa-check', 'icon-error' => 'fa fa-times', 'accepted-extensions' => $accept)), 2) . NL;
    $html .= Cell::end() . ' ' . Jot::button('action:cloud-upload', $speak->upload) . NL;
    $html .= Cell::end();
    return $html;
});
// File finder
Jot::add('finder', function ($action, $name = 'q', $fields = array()) {
    $html = Cell::begin('form', array('class' => 'form-ignite form-find', 'action' => Converter::url($action), 'method' => 'get')) . NL;
    foreach ($fields as $key => $value) {
        $html .= Form::hidden($key, $value) . NL;
    }
    $html .= Form::text($name, Request::get($name, null), null, array(), 1) . ' ' . Jot::button('action:search', Config::speak('find')) . NL;
    $html .= Cell::end();
    return $html;
});