function widget() { $args = func_get_args(); $id = intval(array_shift($args)); if ($id < 1) { return; } gobal_page_item('cid', v('cid')); gobal_page_item('pid', v('pid')); $instance = $this->ajax->load_widget_instance(intval($id)); $html = get_widget_html($instance, $args, $id); die($html); }
function format_widget_row($row, $widgets) { if (!is_array($widgets[$row]) || !$widgets[$row]) { return; } $ajax = true; if (is_login() && !c('login_ajax')) { $ajax = false; } elseif (!is_login() && !c('logout_ajax')) { $ajax = false; } if ($ajax) { $widget_html_path = APPPATH . 'views/layout/riki/widget.tpl.html'; $cid = _Page('cid'); $pid = _Page('pid'); foreach ($widgets[$row] as $widget) { require $widget_html_path; } $GLOBALS['auto_drag'] = false; } else { $instances = lazy_get_data("select * from `u2_widget_instance` where `id` IN(" . join(',', $widgets[$row]) . ") ", 'id'); foreach ($widgets[$row] as $v) { $instance = isset($instances[$v]) ? $instances[$v] : array(); $extra = array(); echo '<li><div id="widget-' . $v . '">'; echo get_widget_html($instance, $extra, $v); echo '</div></li>'; } $GLOBALS['auto_drag'] = is_admin() ? true : false; } }