예제 #1
0
 function inner($posts, $td_column_number = '')
 {
     //global $post;
     $buffy = '';
     $td_block_layout = new td_block_layout();
     if (empty($td_column_number)) {
         $td_column_number = $td_block_layout->get_column_number();
         // get the column width of the block
     }
     $td_post_count = 0;
     // the number of posts rendered
     $td_current_column = 1;
     //the current column
     if (!empty($posts)) {
         foreach ($posts as $post) {
             $td_module_3 = new td_module_3($post);
             switch ($td_column_number) {
                 case '1':
                     //one column layout
                     $buffy .= $td_module_3->render($post);
                     break;
                 case '2':
                     //two column layout
                     $buffy .= $td_block_layout->open_row();
                     $buffy .= $td_block_layout->open6();
                     $buffy .= $td_module_3->render($post);
                     $buffy .= $td_block_layout->close6();
                     if ($td_current_column == 2) {
                         $buffy .= $td_block_layout->close_row();
                     }
                     break;
                 case '3':
                     //three column layout
                     $buffy .= $td_block_layout->open_row();
                     $buffy .= $td_block_layout->open4();
                     $buffy .= $td_module_3->render($post);
                     $buffy .= $td_block_layout->close4();
                     if ($td_current_column == 3) {
                         $buffy .= $td_block_layout->close_row();
                     }
                     break;
             }
             //current column
             if ($td_current_column == $td_column_number) {
                 $td_current_column = 1;
             } else {
                 $td_current_column++;
             }
             $td_post_count++;
         }
     }
     $buffy .= $td_block_layout->close_all_tags();
     return $buffy;
 }
예제 #2
0
 function inner($posts, $td_column_number = '')
 {
     $buffy = '';
     $td_block_layout = new td_block_layout();
     if (empty($td_column_number)) {
         $td_column_number = $td_block_layout->get_column_number();
         // get the column width of the block
     }
     if (!empty($posts)) {
         foreach ($posts as $post) {
             $td_module_8 = new td_module_8($post);
             $buffy .= $td_module_8->render($post);
         }
     }
     $buffy .= $td_block_layout->close_all_tags();
     return $buffy;
 }
예제 #3
0
 function inner($posts, $td_column_number = '')
 {
     //global $post;
     $buffy = '';
     $td_block_layout = new td_block_layout();
     if (empty($td_column_number)) {
         $td_column_number = $td_block_layout->get_column_number();
         // get the column width of the block
     }
     //echo $td_column_number;
     if ($td_column_number == 3 and !empty($posts)) {
         //$td_module_big_grid = new td_module_big_grid();
         $td_module_big_grid = new td_module_slide_big();
         $buffy .= $td_module_big_grid->render(array($posts, $this->td_create_slider, 'iosSlider_' . $this->block_uid));
     }
     $buffy .= $td_block_layout->close_all_tags();
     return $buffy;
 }
예제 #4
0
파일: td_slide.php 프로젝트: Vatia13/tofido
    /**
     * @param $posts
     * @param string $td_column_number - get the column number
     * @param string $autoplay - not use via ajax
     * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class
     * @return string
     */
    function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false)
    {
        //global $post;
        $buffy = '';
        $td_block_layout = new td_block_layout();
        if (empty($td_column_number)) {
            $td_column_number = $td_block_layout->get_column_number();
            // get the column width of the block
        }
        $td_post_count = 0;
        // the number of posts rendered
        $td_current_column = 1;
        //the current column
        $td_unique_id_slide = td_global::td_generate_unique_id();
        $buffy .= '<div id="' . $td_unique_id_slide . '" class="iosSlider iosSlider-col-' . $td_column_number . ' td_mod_wrap">';
        $buffy .= '<div class="slider ">';
        if (!empty($posts)) {
            foreach ($posts as $post) {
                //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count);
                $td_module_slide = new td_module_slide($post);
                $buffy .= $td_module_slide->render($td_column_number, $td_post_count);
                //current column
                if ($td_current_column == $td_column_number) {
                    $td_current_column = 1;
                } else {
                    $td_current_column++;
                }
                $td_post_count++;
            }
        }
        $buffy .= $td_block_layout->close_all_tags();
        $buffy .= '</div>';
        //close slider
        $buffy .= '<div class = "prevButton"></div>';
        $buffy .= '<div class = "nextButton"></div>';
        $buffy .= '</div>';
        //clos ios
        if (!empty($autoplay)) {
            $autoplay_string = '
            autoSlide: true,
            autoSlideTimer: ' . $autoplay * 1000 . ',
            ';
        } else {
            $autoplay_string = '';
        }
        $slide_js = '
jQuery(document).ready(function() {
    jQuery("#' . $td_unique_id_slide . '").iosSlider({
        snapToChildren: true,
        desktopClickDrag: true,
        keyboardControls: false,
        ' . $autoplay_string . '

        infiniteSlider: true,
        navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"),
        navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton"),
        onSlideComplete: slideContentComplete,
        onSlideStart: slideStartedMoving
    });
});
    ';
        if ($is_ajax) {
            $buffy .= '<script>' . $slide_js . '</script>';
        } else {
            td_js_buffer::add_to_footer($slide_js);
        }
        return $buffy;
    }
예제 #5
0
 function get_block_js($atts, &$td_query)
 {
     extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'sub_cat_ajax' => '', 'ajax_pagination' => '', 'header_color' => ''), $atts));
     if (!empty($atts['custom_title'])) {
         $atts['custom_title'] = htmlspecialchars($atts['custom_title'], ENT_QUOTES);
     }
     if (!empty($atts['custom_url'])) {
         $atts['custom_url'] = htmlspecialchars($atts['custom_url'], ENT_QUOTES);
     }
     $td_block_layout = new td_block_layout();
     $td_column_number = $td_block_layout->get_column_number();
     // get the column width of the block
     $block_item = 'block_' . $this->block_uid;
     $buffy = '';
     $buffy .= '<script>';
     $buffy .= 'var ' . $block_item . ' = new td_block();' . "\n";
     $buffy .= $block_item . '.id = "' . $this->block_uid . '";' . "\n";
     $buffy .= $block_item . ".atts = '" . json_encode($atts) . "';" . "\n";
     $buffy .= $block_item . '.td_cur_cat = "' . $category_id . '";' . "\n";
     $buffy .= $block_item . '.td_column_number = "' . $td_column_number . '";' . "\n";
     $buffy .= $block_item . '.block_type = "' . $this->block_id . '";' . "\n";
     //wordpress wp query parms
     $buffy .= $block_item . '.post_count = "' . $td_query->post_count . '";' . "\n";
     $buffy .= $block_item . '.found_posts = "' . $td_query->found_posts . '";' . "\n";
     $buffy .= $block_item . '.max_num_pages = "' . $td_query->max_num_pages . '";' . "\n";
     $buffy .= $block_item . '.header_color = "' . $header_color . '";' . "\n";
     $buffy .= 'td_blocks.push(' . $block_item . ');' . "\n";
     $buffy .= '</script>';
     return $buffy;
 }
예제 #6
0
 function inner($posts, $td_column_number = '')
 {
     //global $post;
     $buffy = '';
     $td_block_layout = new td_block_layout();
     if (empty($td_column_number)) {
         $td_column_number = $td_block_layout->get_column_number();
         // get the column width of the block
     }
     $td_post_count = 0;
     // the number of posts rendered
     if (!empty($posts)) {
         foreach ($posts as $post) {
             $td_module_2 = new td_module_2($post);
             $td_module_3 = new td_module_3($post);
             switch ($td_column_number) {
                 case '1':
                     //one column layout
                     if ($td_post_count == 0) {
                         //first post
                         $buffy .= $td_module_2->render();
                     } else {
                         $buffy .= $td_module_3->render();
                     }
                     break;
                 case '2':
                     //two column layout
                     $buffy .= $td_block_layout->open_row();
                     if ($td_post_count == 0) {
                         //first post
                         $buffy .= $td_block_layout->open6();
                         $buffy .= $td_module_2->render();
                         $buffy .= $td_block_layout->close6();
                     } else {
                         //the rest
                         $buffy .= $td_block_layout->open6();
                         $buffy .= $td_module_3->render();
                     }
                     break;
                 case '3':
                     //three column layout
                     $buffy .= $td_block_layout->open_row();
                     if ($td_post_count == 0) {
                         //first post
                         $buffy .= $td_block_layout->open4();
                         $buffy .= $td_module_2->render();
                         $buffy .= $td_block_layout->close4();
                     } else {
                         //2-3 cols
                         $buffy .= $td_block_layout->open4();
                         $buffy .= $td_module_3->render();
                         if ($td_post_count == 4) {
                             //make new column
                             $buffy .= $td_block_layout->close4();
                         }
                     }
                     break;
             }
             $td_post_count++;
         }
     }
     $buffy .= $td_block_layout->close_all_tags();
     return $buffy;
 }