示例#1
0
function smarty_block_p($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        return;
    }
    return build_tag('p', $params, $content);
}
function smarty_block_toolbar($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        // This is the start part
        add_container($params, $template, 'toolbar');
        return;
    }
    $params['id'] = get_default($params, 'id', 'toolbar');
    $classes = get_default($params, 'class', array());
    if (is_string($classes)) {
        $classes = explode(' ', $classes);
    }
    $classes[] = 'toolbar';
    $classes[] = 'pinet-toolbar';
    $params['class'] = implode(' ', $classes);
    return build_tag('div', $params, $content);
}
function smarty_function_action($params, $template)
{
    $action = get_default($params, 'obj', null);
    $alt = get_default($params, 'alt', '');
    if ($action == null) {
        trigger_error('The obj parameter is required for action!');
        return '';
    }
    if (gettype($action) != 'object' || get_class($action) != 'Action') {
        trigger_error('The obj parameter must be of Class Action!');
        return '';
    }
    $fields = json_decode($action->fields);
    ci_log('The action to show is', $action);
    $data = array();
    $uri = $action->uri();
    if ($uri) {
        $data['href'] = $uri;
    }
    $content = lang($action->label);
    if (isset($action->logo) && $action->logo != '') {
        $data = array('src' => $action->logo, 'path' => '/responsive/size', 'data-placement' => isset($fields->placement) ? $fields->placement : 'right', 'data-original-title' => $action->label);
        $auto = get_default($params, 'auto', true);
        if ($auto) {
            $data["data-toggle"] = "tooltip";
        }
        $CI =& get_instance();
        $CI->load->helper('image');
        $file = find_img($data['src']);
        // Try to find the image in static/img
        if ($file == null) {
            // We can't read the file
            $data['src'] = 'default.png';
        }
        $picturedata = $data;
        unset($picturedata['data-toggle']);
        $content = smarty_function_picture($picturedata, $template);
        if (isset($action->controller) && isset($action->method) && $uri) {
            $data['href'] = $uri;
        }
    }
    return build_tag('a', $data, $content);
}
 public function tags($id = "tags", $title = "Tags")
 {
     $options = '';
     $tags = get_tags();
     foreach ($tags as $tag) {
         $options .= $this->option($tag->slug, $tag->name, $this->form_instance[$id]);
     }
     $attributes = $this->field_meta($id, $style = 'max-width: 98%;') . ' multiple';
     $dropdown = build_tag($options, $attributes, 'select');
     echo build_tag($this->label($id, $title) . '<br>' . $dropdown);
 }