コード例 #1
0
/**
 * @ingroup jquery_tab_helper
 * Function to setup the tab helper system. This is called automatcially by the other functions.
 * 
 */
function jquery_tab_setup()
{
    // make sure we have jquery
    jquery_setup();
    jquery_ui_setup('flick');
    $CI =& get_instance();
    if ($CI->input->post('_jquery_last_tab_index')) {
        jquery_tab_set_tab_index(intval($CI->input->post('_jquery_last_tab_index')));
    }
    $active_tab = intval($CI->session->flashdata('jquery_tabs_last_used_index'));
    if ($CI->add_css_file('jquery_tab/jquery_tab.css')) {
        $javascript = <<<_EOM
<script type="text/javascript">
    \$("document").ready(function() {
\t\t\$("#jquery_tabs").tabs( {
\t\t\tactive: {$active_tab}, 
\t\t\tactivate: function(event, ui) {
\t\t\t\t\$(":input[name='_jquery_last_tab_index']").val(\$("#jquery_tabs").tabs("option", "active"));
\t\t\t}
\t\t});
\t});
</script>
_EOM;
        $CI->add_java_script($javascript);
    }
}
コード例 #2
0
/**
 * @ingroup datepicker_helper
 * Setup and load in the datepicker javascript library.
 * 
 * This function will be automatically called by the form_datepicker_input function.
 */
function form_datepicker_setup()
{
    // setup using the jquery_helper
    jquery_setup();
    if (jquery_ui_setup('lightness')) {
        $script = <<<_EOM
\t\t
<script type="text/javascript">
\t\$(function() {
\t\t\$( "#datepicker" ).datepicker( { dateFormat: "yy-mm-dd",
\t\t\t\t\t\t\t\t\t\tshowButtonPanel: true });
\t});
</script>

_EOM;
        $CI =& get_instance();
        $CI->add_java_script($script);
    }
}