Esempio n. 1
0
function smarty_block_form($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        // Set the current form to the context
        Clips\clips_context('indent_level', 1, true);
        $name = Clips\get_default($params, 'name', Clips\default_form_name());
        $data = Clips\context('form_' . $name);
        if ($data) {
            Clips\context('current_form_data', $data);
        }
        Clips\clips_context('current_form', $name);
        return;
    }
    $content .= "\t" . Clips\create_tag('input', array('type' => 'hidden', 'name' => Clips\Form::FORM_FIELD, 'value' => Clips\get_default($params, 'name', 'form')));
    $action = Clips\get_default($params, 'action');
    if ($action) {
        if (strpos($action, 'http') !== 0) {
            $params['action'] = Clips\site_url($action);
        }
    }
    if (Clips\get_default($params, 'upload')) {
        unset($params['upload']);
        $params['enctype'] = 'multipart/form-data';
    }
    Clips\context_pop('current_form');
    Clips\context_pop('current_form_data');
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('form', $content, $params, array('action' => '#', 'method' => 'post', 'class' => ['clips-form', 'default-form']));
}
Esempio n. 2
0
function smarty_block_dl($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\clips_context('indent_level', 1, true);
        return;
    }
    $items = Clips\get_default($params, 'items', array());
    if ($items) {
        unset($params['items']);
        $level = Clips\context('indent_level');
        if ($level === null) {
            $level = 0;
        } else {
            $level = count($level);
        }
        $indent = '';
        for ($i = 0; $i < $level; $i++) {
            $indent .= "\t";
        }
        if (!trim($content)) {
            $content = '{dt}{$key}{/dt}' . "\n{$indent}" . '{dd}{$value}{/dd}';
        }
        $output = array();
        $t = 'string:' . $content;
        foreach ($items as $key => $value) {
            $output[] = trim($template->fetch($t, array('key' => $key, 'value' => $value)));
        }
        $content = implode("\n{$indent}", $output);
    }
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('dl', $content, $params);
}
    /**
     * @Clips\Model({"product","user","cart"})
     * @Clips\Widgets\DataTable("cart_index")
     * @Clips\Scss("cart/index_moblie")
     */
    public function index()
    {
        //* @Clips\Scss("cart/index")
        // Add the init js, add this to a js file is fine too.
        \Clips\context('jquery_init', <<<TEXT

\t//====================================
\t// Initializing Sliders
\t//====================================

\t//====================================
\t// Other Events
\t//====================================
TEXT
, true);
        $this->title('My Cart Page', true);
        $args = array('products' => array());
        //	    return $this->render('cart/test');
        //return $this->render('cart/index', $args);
        if ($this->request->isMobile()) {
            return $this->render('cart/index_moblie');
        } else {
            return $this->render('cart/index', $args);
        }
    }
Esempio n. 4
0
function smarty_function_cancel($params, $template)
{
    Clips\require_widget_smarty_plugin('html', 'a');
    $bundle_name = Clips\context('current_bundle');
    $bundle = Clips\get_default($params, 'bundle', $bundle_name);
    $cancel = Clips\get_default($params, 'label', 'Cancel');
    if ($bundle !== null) {
        $bundle = Clips\bundle($bundle);
        $cancel = $bundle->message($cancel);
    }
    $request = Clips\context('request');
    $bs = $request->breadscrumb();
    if (count($bs) > 1) {
        array_pop($bs);
        // Pop current
        $params['href'] = Clips\site_url(array_pop($bs));
        $params['title'] = $cancel;
        $f = true;
        // Open the link
        smarty_block_a($params, '', $template, $f);
        $f = false;
        return smarty_block_a($params, $cancel, $template, $f);
    }
    return '';
}
Esempio n. 5
0
function smarty_block_navigation($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        // Start the navigation ul
        Clips\clips_context('indent_level', 1, true);
        return;
    }
    $default = array('class' => array('nav'));
    $f = true;
    $actions = Clips\get_default($params, 'actions');
    if ($actions) {
        unset($params['actions']);
        $content = '';
        $level = Clips\context('indent_level');
        if ($level === null) {
            $level = 0;
        } else {
            $level = count($level);
        }
        $indent = '';
        for ($i = 0; $i < $level; $i++) {
            $indent .= "\t";
        }
        foreach ($actions as $action) {
            // Only if the object is the valid action
            if (Clips\valid_obj($action, 'Clips\\Interfaces\\Action')) {
                $content .= _smarty_block_navigation_tree_node($action, $indent, $template, $repeat, Clips\get_default($params, 'item-class', array()));
            }
        }
    }
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('ul', $content, $params, $default);
}
Esempio n. 6
0
 public function getNav()
 {
     $request = \Clips\context('request');
     if ($request) {
         $all_movies = $request->session('all_movies');
     }
     $arr = array();
     foreach ($all_movies as $k => $v) {
         $arr[$k]['name'] = $all_movies[$k]->title;
         $arr[$k]['label'] = $all_movies[$k]->title;
         $arr[$k]['content'] = '/movie/play/' . $all_movies[$k]->id;
     }
     $args = array();
     $serial_movies = $request->session('serial_movies');
     foreach ($serial_movies as $k => $v) {
         $args[$k]['name'] = $serial_movies[$k]->title;
         $args[$k]['label'] = $serial_movies[$k]->title;
         $args[$k]['content'] = '/movie/play/' . $serial_movies[$k]->id;
     }
     $ser = array($arr, $args);
     $actions = array();
     foreach ($this->getAllColumns() as $k => $item) {
         $item->type = 'server';
         $item->content = '/column/show/' . $item->name;
         $item->children = $ser[$k];
         $action = new \Pinet\EPG\Core\ColumnAction($item);
         $actions[] = $action;
     }
     return $actions;
 }
Esempio n. 7
0
 public function filter_before($chain, $controller, $method, $args, $request)
 {
     // Get the form name from the form field
     $form = \Clips\context('form');
     if ($form) {
         // Try to get form name from the request parameter
         $form_name = $request->param(\Clips\Form::FORM_FIELD);
         // If not found, try to find the form configuration as the first one
         if (!$form_name) {
             $form_name = $form->defaultFormName();
         }
         // Get the current form config
         $config = $form->config($form_name);
         $params = $request->param();
         if (!$params) {
             $params = array();
         }
         if ($config) {
             $ret = $this->validator->validate($params, $config);
             if ($ret) {
                 $chain->succeed = false;
                 \Clips\clips_error('form_validation', array_map(function ($item) {
                     return $item[0];
                 }, $ret));
                 return false;
             }
         }
     }
 }
Esempio n. 8
0
function smarty_block_column($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\context('indent_level', 1, true);
        return;
    }
    $keys = array();
    $class = array('column');
    foreach ($params as $k => $v) {
        if (strpos($k, 'span') === 0) {
            // The key begin with layout
            if ($k == 'span') {
                $class[] = 'col-xs-' . $v;
            } else {
                $data = explode('-', $k);
                $class[] = 'col-' . $data[1] . '-' . $v;
            }
            $keys[] = $k;
        }
    }
    foreach ($keys as $k) {
        unset($params[$k]);
    }
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('div', $content, $params, array('class' => $class));
}
 public function setMerchantID($mid)
 {
     $request = \Clips\context('request');
     if ($request) {
         $request->session('merchant_id', $mid);
     }
 }
Esempio n. 10
0
function smarty_block_row($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\context('indent_level', 1, true);
        $level = Clips\context('indent_level');
        $arr = array('level' => count($level), 'index' => 0);
        $keys = array();
        foreach ($params as $k => $v) {
            if (strpos($k, 'layout') === 0) {
                // The key begin with layout
                $keys[] = $k;
                $arr[$k] = $v;
            }
        }
        foreach ($keys as $k) {
            unset($params[$k]);
        }
        // Push row's information into context stack
        Clips\context('row', (object) $arr, true);
        return;
    }
    $keys = array();
    foreach ($params as $k => $v) {
        if (strpos($k, 'layout') === 0) {
            // The key begin with layout
            $keys[] = $k;
        }
    }
    foreach ($keys as $k) {
        unset($params[$k]);
    }
    Clips\context_pop('row');
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('div', $content, $params, array('class' => 'row'));
}
Esempio n. 11
0
function smarty_block_button($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\clips_context('indent_level', 1, true);
        return;
    }
    $value = Clips\get_default($params, 'caption');
    if ($value) {
        // We did have value, so the content is the JavaScript
        $id = Clips\get_default($params, 'id', 'clips_button_' . Clips\sequence('button'));
        $js = "\$(\"#{$id}\").click(function(){\n\t\t" . trim($content) . "\n\t});";
        $content = $value;
        unset($params['caption']);
        $params['id'] = $id;
        Clips\context('jquery_init', $js, true);
    }
    // For i18n
    $bundle_name = Clips\context('current_bundle');
    $bundle = Clips\get_default($params, 'bundle', $bundle_name);
    if ($bundle !== null) {
        $bundle = Clips\bundle($bundle);
        $content = $bundle->message($content);
    }
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('button', $content, $params);
}
Esempio n. 12
0
 public function filter_after($chain, $controller, $method, $args, $request, $controller_ret)
 {
     $scsses = \Clips\context('scss');
     if ($scsses) {
         $cache = $this->filecache->cacheDir();
         $forward_method = \Clips\context('forward_method');
         if ($forward_method) {
             $method = $forward_method;
         }
         $full_name = \Clips\to_flat(get_class($controller)) . '_' . $method;
         $uri = \Clips\path_join(\Clips\path_join($cache, 'css'), $full_name);
         $cache_filename = \Clips\path_join($cache, 'css', \Clips\to_flat(get_class($controller) . '_' . $method) . '.css');
         if (file_exists($cache_filename) && !\Clips\config('debug_sass')) {
             \Clips\add_css(\Clips\static_url($uri));
             return;
         }
         if (\Clips\config('debug_sass')) {
             $this->sass->source_map_file = $cache_filename . '.map';
             $this->sass->source_comments = true;
             $this->sass->source_map_embed = true;
             $this->sass->source_map_contents = true;
         }
         // Add the sass_dir into include pathes
         $result = $this->sass->compile($scsses);
         if ($result) {
             $this->filecache->save(\Clips\to_flat(get_class($controller) . '_' . $method) . '.css', $result, \Clips\path_join($cache, 'css'), true);
             \Clips\add_css(\Clips\static_url($uri));
         }
     }
 }
Esempio n. 13
0
 protected function doInit()
 {
     // Added the clips object to JavaScript
     $router = \Clips\context('router');
     if ($router) {
         \Clips\add_init_js(\Clips\clips_out('clips_js', array('base' => $router->staticUrl('/'), 'site' => $router->baseUrl('/')), false));
     }
 }
Esempio n. 14
0
 public function init()
 {
     $this->engine = \Clips\context('smarty');
     $this->engine->template_dir = \Clips\clips_config('template_dir');
     $this->engine->compile_dir = \Clips\clips_config('smarty_compile_dir')[0];
     $this->engine->config_dir = \Clips\clips_config('smarty_config_dir');
     $this->engine->cache_dir = \Clips\clips_config('smarty_cache_dir')[0];
     $this->engine->addPluginsDir(\Clips\clips_config('smarty_plugin_dir', array()));
 }
Esempio n. 15
0
function smarty_block_figure($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\clips_context('indent_level', 1, true);
        return;
    }
    $src = Clips\get_default($params, 'src');
    $path = Clips\get_default($params, 'path', 'responsive/size');
    $resolutions = Clips\get_default($params, 'resolutions');
    $img_path = Clips\find_image($src);
    if (!$img_path) {
        Clips\error('figure', array('Can\'t find image ' . $src . '!'));
        return '';
    }
    $size = Clips\image_size($img_path);
    $size = $size['width'];
    if ($resolutions) {
        // If we are using auto resizing, skip the resolutions
        foreach ($resolutions as $res) {
            $attr['data-media' . $res] = Clips\site_url('responsive/size/' . (double) $res / 2880 * (double) $size . '/' . $src);
        }
    } else {
        $attr = array('path' => Clips\site_url($path));
    }
    foreach ($params as $key => $value) {
        if ($key == 'path') {
            continue;
        }
        if (strpos($key, 'media') !== false) {
            $attr['data-' . $key] = Clips\site_url('responsive/size/' . $value . '/' . $src);
        } else {
            $attr[$key] = $value;
        }
    }
    $caption = Clips\create_tag_with_content('figcaption', $content);
    $image_dir = Clips\config('image_dir');
    if ($image_dir) {
        $image_dir = $image_dir[0];
    } else {
        $image_dir = 'application/static/img/';
    }
    $img = Clips\create_tag('img', array('src' => Clips\static_url(Clips\path_join($image_dir, $src))));
    $noscript = Clips\create_tag_with_content('noscript', $img);
    $level = Clips\context('indent_level');
    if ($level === null) {
        $level = 0;
    } else {
        $level = count($level);
    }
    $indent = '';
    for ($i = 0; $i < $level; $i++) {
        $indent .= "\t";
    }
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('figure', $noscript . "\n{$indent}" . $caption, $attr);
}
Esempio n. 16
0
    protected function doInit()
    {
        $js = <<<TEXT
function strToObj(str){
\tvar json = (new Function("return " + str))();
\treturn json;
}

function dataToObj(str) {
\tvar jsonstr = str.trim().replace(/\\{/, '');
\tjsonstr = '{ ' + jsonstr.substr(0, jsonstr.length - 1) + ' }';
\treturn strToObj(jsonstr);
}

\$('[data-role*=date]').each(function(){
\tvar options = {};
\tif(\$(this).attr('data-date-options')) {
\t\toptions = dataToObj(\$(this).attr('data-date-options'));
\t}
\tvar opt = \$.extend({}, options);
\t\$(this).datetimepicker(opt);
});

\$('[data-role*=month]').each(function(){
\t\$(this).datetimepicker({
\t\t"viewMode": "months"
\t});
});

\$('[data-role*=year]').each(function(){
\t\$(this).datetimepicker({
\t\t"viewMode": "years"
\t});
});

\$('[data-role*=day]').each(function(){
\t\$(this).datetimepicker({
\t\t"viewMode": "days"
\t});
});

\$('[data-role*=dategroup]').each(function(){
\tif (\$(this).attr('data-for')) {
\t\tvar self = \$(this);
\t\tvar datetimepickerApplySelector = 'input[name=' + \$(this).attr('data-for') + ']';
\t\t\$(datetimepickerApplySelector).on("dp.change",function (e) {
\t\t\tself.data("DateTimePicker").minDate(e.date);
\t\t});
\t\tself.on("dp.change",function (e) {
\t\t\t\$(datetimepickerApplySelector).data("DateTimePicker").maxDate(e.date);
\t\t});
\t}
});
TEXT;
        \Clips\context('jquery_init', $js, true);
    }
Esempio n. 17
0
    protected function doInit()
    {
        $js = <<<TEXT

\t//====================================
\t// Initializing YiZhiFu
\t//====================================
\tfunction drawItem(context, list) {
\t\tvar listviewApi = context.data('api');
\t\tif(\$.isFunction(\$.fn.picture)) {
\t\t\t\$('.listview.clips-listview').find('figure,picture').picture({
\t\t\t\tpictureReady: function(mediapath){
\t\t\t\t\tlistviewApi.layout(list);
\t\t\t\t}
\t\t\t});
\t\t}
\t}
\t\$('.listview.clips-listview').on('list.loaded', function(e, list, opt){
\t\tvar self = \$(this);
//\t\tdrawItem(self, list);
\t});
\t\$('.listview.clips-listview').on('list.resize', function(e, list){
\t\tvar self = \$(this);
//\t\tdrawItem(self, list);
\t});
\t\$('.listview.clips-listview').on('list.init', function(){
\t\tvar listviewApi = \$(this).data('api');
\t\tlistviewApi.clear();
\t});
\tfunction checkTargetInElement(e) {
\t\tvar self = \$(e.target);
\t\tvar isInside = false;
\t\tvar element = \$(e.data.ele);
\t\telement.each(function(i, ele){
\t\t\tif(\$.contains(element[0], e.target)) {
\t\t\t\tisInside = true;
\t\t\t\treturn false;
\t\t\t}
\t\t});
\t\tif(!isInside) {
\t\t\telement.trigger('check.out');
\t\t}else {
\t\t\telement.trigger('check.in');
\t\t}
\t}
\t\$(document).on('click', {ele: '.listview.clips-listview'} ,checkTargetInElement);
\t\$('.listview.clips-listview').on('check.out', function(e){});
\t\$('.listview.clips-listview').on('check.in', function(e){
\t\tvar self = \$(this);
\t\tself.on('click', '.ui-selectee.listview_item', function(e){
\t\t\t\$(this).addClass('ui-selected').siblings().removeClass('ui-selected');
\t\t});
\t});
TEXT;
        \Clips\context('jquery_init', $js, true);
    }
Esempio n. 18
0
 public function active()
 {
     $controller = \Clips\context('controller');
     if ($controller) {
         $query = $controller->getMovieQuery();
         if (isset($this->name)) {
             return $query->column == $this->name;
         }
     }
     return false;
 }
Esempio n. 19
0
 public function active()
 {
     $controller = \Clips\context('controller');
     if ($controller) {
         $query = $controller->getMovieQuery();
         $values = $query->{$this->mode};
         \Clips\log('The values is ', array($values, $this->mode_value));
         return array_search(urlencode($this->mode_value), $values) !== false;
     }
     return false;
 }
 public function init()
 {
     // Add the UA Compatible
     \Clips\context('html_meta', array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge'), true);
     // Add the view port for phones
     \Clips\context('html_meta', array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'), true);
     // Add the iPhone support
     \Clips\context('html_meta', array('name' => 'renderer', 'content' => 'webkit'), true);
     // Add the cache control
     \Clips\context('html_meta', array('name' => 'Cache-Control', 'content' => 'no-siteapp'), true);
 }
Esempio n. 21
0
function smarty_block_jsx($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\context('indent_level', 1, true);
        return;
    }
    // The element tag name that holds the virtual dom
    $tag = Clips\get_default($params, 'tag', 'div');
    $id = Clips\render_jsx($content, Clips\get_default($params, 'id'));
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content($tag, '', array('id' => $id, 'class' => array('jsx', 'jsx_holder')));
}
Esempio n. 22
0
function smarty_block_head($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\clips_context('indent_level', 1, true);
        // Enstack indent level
        return;
    }
    $encoding = Clips\get_default($params, 'encoding', 'UTF-8');
    $version = Clips\context('html_version');
    $title = Clips\get_default($params, 'title', null);
    if (!$title) {
        // If didn't found title on the parameter, try find it in context
        $title = Clips\context('html_title');
    }
    // Adding metas
    if (!$version) {
        $version = 5;
    }
    $meta = Clips\context('html_meta');
    if (!$meta) {
        $meta = array();
    }
    switch ($version) {
        case '4':
        case '4t':
        case '4s':
        case '4f':
        case 'xhtml':
        case 'xhtmlt':
        case 'xhtmlf':
        case 'xhtml1.1':
            array_unshift($meta, array('http-equiv' => 'Content-Type', 'content' => 'text/html;charset=' . $encoding));
            break;
        case '5':
            array_unshift($meta, array('charset' => $encoding));
            break;
    }
    $pre = array();
    foreach ($meta as $m) {
        $pre[] = Clips\create_tag('meta', $m);
    }
    // Adding the title
    if ($title) {
        $pre[] = Clips\create_tag_with_content('title', $title);
    }
    $pre = "\t" . implode("\n\t\t", $pre);
    if (isset($params['title'])) {
        unset($params['title']);
    }
    Clips\context_pop('indent_level');
    // Pop the stack before output
    return Clips\create_tag_with_content('head', $pre . $content, $params);
}
Esempio n. 23
0
function smarty_block_state($params, $content = '', $template, &$repeat)
{
    $name = Clips\get_default($params, 'name');
    $state = Clips\context_peek('state');
    if ($repeat) {
        return;
    }
    if ($name && ($name == 'default' && !Clips\context('matched_state')) || $state && $name == $state) {
        Clips\context('matched_state', $name);
        return trim($content);
    }
    return '';
}
Esempio n. 24
0
function smarty_block_markup($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        Clips\context('indent_level', 1, true);
        return;
    }
    $tool =& Clips\get_clips_tool();
    $flavor = Clips\get_default($params, 'flavor', 'github');
    $markup = $tool->library('markup');
    $content = $markup->render($content, $flavor);
    Clips\context_pop('indent_level');
    return Clips\create_tag_with_content('div', $content, $params, array('class' => 'markup'));
}
Esempio n. 25
0
function smarty_function_submit($params, $template)
{
    $bundle_name = Clips\context('current_bundle');
    $bundle = Clips\get_default($params, 'bundle', $bundle_name);
    $submit = Clips\get_default($params, 'value', 'Submit');
    if ($bundle !== null) {
        $bundle = Clips\bundle($bundle);
        $submit = $bundle->message($submit);
    }
    if (isset($params['value'])) {
        $params['value'] = $submit;
    }
    return Clips\create_tag('input', $params, array('type' => 'submit', 'value' => $submit, 'class' => array('btn', 'btn-primary')));
}
Esempio n. 26
0
    public function doInit()
    {
        \Clips\context('jquery_init', <<<TEXT

\t//====================================
\t// Initializing Images
\t//====================================
\tsetTimeout(function(){
\t\t\$('figure,picture').picture();
\t\t\$('div.responsive > img').responsiveImage();
\t}, 450);
TEXT
, true);
    }
Esempio n. 27
0
    protected function doInit()
    {
        $js = <<<TEXT
\t\$('[data-role=menu]').ztree_toc({
\t\tis_auto_number: true,
\t\tdocumment_selector: '.markup',
\t\tztreeStyle: {
\t\t},
\t\tcallback: {
\t\t}
\t});
TEXT;
        \Clips\context('jquery_init', $js, true);
    }
Esempio n. 28
0
function smarty_block_lang($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        return;
    }
    // Get the format from parameters, if no format parameter, use content instead
    $format = Clips\get_default($params, 'format', $content);
    $bundle_name = Clips\context('current_bundle');
    if (!$bundle_name) {
        $bundle_name = '';
    }
    $bundle = Clips\bundle(Clips\get_default($params, 'bundle', $bundle_name));
    return $bundle->message($format, $content);
}
Esempio n. 29
0
 public function init()
 {
     $this->tool->widget('ListView');
     if (isset($this->value)) {
         if (!is_array($this->value)) {
             $this->value = array($this->value);
         }
     } else {
         $this->value = array(\Clips\default_form_name());
     }
     // Initialize the ListView in javacript
     foreach ($this->getConfig() as $name => $config) {
         if ($config) {
             // Setting the default values for the datatable configuration
             if (!isset($config->ajax)) {
                 $controller_class = \Clips\context('controller_seg');
                 $method = \Clips\context('controller_method');
                 $uri = \Clips\context('uri');
                 if (strpos($uri, $method) !== false) {
                     $d = explode($method, $uri);
                     $config->ajax = \Clips\site_url(\Clips\path_join($d[0], $name));
                 } else {
                     if (strpos($uri, $controller_class) !== false) {
                         $config->ajax = \Clips\site_url(\Clips\path_join($uri, $name));
                     } else {
                         $config->ajax = \Clips\site_url(\Clips\path_join($uri, $controller_class, $name));
                     }
                 }
             }
             $config->processing = true;
             $config->serverSide = true;
             foreach ($config->columns as $col) {
                 if (isset($col->data)) {
                     // Must smooth the data
                     $col->data = \Clips\smooth($col->data);
                 }
                 if (isset($col->refer)) {
                     $col->refer = \Clips\smooth($col->refer);
                 }
                 if (isset($col->action)) {
                     // If has action, use action render
                     $col->render = 'datatable_action_column';
                 }
             }
             // Adding the initialize script to jquery init
             \Clips\context('jquery_init', '$("ul[name=' . \Clips\to_flat($name) . ']").listview(' . json_encode($config) . ')', true);
         }
     }
 }
Esempio n. 30
0
    protected function doInit()
    {
        $js = <<<TEXT
\$(".dropdown-menu").each(function(){
\tvar self = \$(this);
\tself.find("li").each(function(){
\t\tvar li = \$(this);
\t\tif(li.children('.sub-menu').length > 0) {
\t\t\tli.addClass('sub');
\t\t}
\t});
});
TEXT;
        \Clips\context('jquery_init', $js, true);
    }