<?php
// START COURSES SECTION 
$section = 'gurukul_courses';
$wp_customize->add_section(
	$section,
	array(
		'title'   => __( 'Courses Section', 'gurukul' ),
		'panel'   => 'lz_fitness_premium_home_panel',
	)
);
    //ENABLE/DISABLE Appointment SECTION
$wp_customize->add_setting(
	$section.'_disable',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default' => 'off'
	)
);
$wp_customize->add_control(
	new lz_fitness_Switch_Control(
		$wp_customize,
		$section.'_disable',
		array(
			'settings'      => $section.'_disable',
			'section'       => $section,
			'label'         => __( 'Disable Section', 'gurukul' ),
			'on_off_label'  => array(
				'on' => __( 'Yes', 'gurukul' ),
				'off' => __( 'No', 'gurukul' )
			)   
		)
	)
);

backgroundManager($wp_customize, 'courses', $section, $color='#fff');

// Adding the Label
lzCustomLable($wp_customize, $section.'_title_subtitle_heading', $section, 'Section Title & Sub Title');

//add textarea
lzAddElement($wp_customize, $section.'_title', $section, 'text', $label="Title", 'lz_fitness_sanitize_text', 'OUR COURSES');

//add textarea
lzAddElement($wp_customize, $section.'_sub_title', $section, 'textarea', $label="Sub Title", 'lz_fitness_sanitize_text', 'CHOOSE YOUR DESIRED COURSE');

// Heading color
addColorPalatOption($wp_customize, $section.'_HeadingColor', $section, 'Heading color', '#2a2a2a');
// Text color
addColorPalatOption($wp_customize, $section.'_TextColor', $section, 'Text color', '#4f4f4f');

// $limit = array(1,2,3,4,5,6,7,8,9,10,11,12);
// //add textarea
// lzAddElement($wp_customize, $section.'_pages_npp_count', $section, 'select', $label="Number of pages to show", 'lz_fitness_sanitize_text', 12, $limit);


// // Adding the Label
// lzCustomLable($wp_customize, $section.'_npp_heading', $section, 'Select the page');

// $wp_customize->add_setting($section.'_npp_heading',array('sanitize_callback' => 'lz_fitness_sanitize_text'));
// $wp_customize->add_control(
//     new lz_fitness_Customize_Heading(
//         $wp_customize,
//         $section.'_npp_heading',
//         array(
//             'settings'      => $section.'_npp_heading',
//             'section'       => $section,
//             'label'         => __( 'Number Of courses to show', 'gurukul' ),
//         )
//     )
// );    
// $wp_customize->add_setting($section.'_npp_count',array('sanitize_callback' => 'lz_fitness_sanitize_text','default' => 12));
// $wp_customize->add_control(
//     $section.'_npp_count',
//     array(
//         'settings'      => $section.'_npp_count',
//         'section'       => $section,
//         'type'          => 'select',
//         'label'         => __( 'Number of courses members to show', 'gurukul' ),
//         'choices'=>array(1,2,3,4,5,6,7,8,9,10,11,12)
//     )
// );


//courses post
for( $i = 1; $i <= 12; $i++ ){
    $wp_customize->add_setting(
        $section.'_courses_heading'.$i,
        array(
            'sanitize_callback' => 'lz_fitness_sanitize_text'
        )
    );
    $wp_customize->add_control(
        new lz_fitness_Customize_Heading(
            $wp_customize,
            $section.'_courses_heading'.$i,
            array(
                'settings'      => $section.'_courses_heading'.$i,
                'section'       => $section,
                'label'         => __( 'Our Courses ', 'gurukul' ).$i,
            )
        )
    );

    if(is_array($lzFitnessCoursesSingleChoice)){
        $wp_customize->add_setting(
            $section.'_page_'.$i,
            array(
                'sanitize_callback' => 'absint'
            )
        );
        $wp_customize->add_control(
            $section.'_page_'.$i,
            array(
                'settings'      => $section.'_page_'.$i,
                'section'       => $section,
                'type'=> 'select',
                'label'         => __( 'Select a Course', 'gurukul' ),
                'choices' => $lzFitnessCoursesSingleChoice,
            )
        );
        $wp_customize->add_setting(
            $section.'_page_icon_'.$i,
            array(
                'default'           => 'fa fa-bell',
                'sanitize_callback' => 'lz_fitness_sanitize_text'
            )
        );
        $wp_customize->add_control(
            new lz_fitness_Fontawesome_Icon_Chooser(
                $wp_customize,
                $section.'_page_icon_'.$i,
                array(
                    'settings'      => $section.'_page_icon_'.$i,
                    'section'       => $section,
                    'type'          => 'icon',
                    'label'         => __( 'FontAwesome Icon', 'gurukul' ),
                )
            )
        );
        lzAddElementSeparator($wp_customize, $section.'_separator_'.$i, $section);

    }else{
        $wp_customize->add_setting($section.'_courses_section_lbl'.$i, array('sanitize_callback'=>'lz_fitness_sanitize_text'));
        $wp_customize->add_control(
            new lz_fitness_Info_Text( 
                $wp_customize,
                $section.'_courses_section_lbl'.$i,
                array(
                    'settings'      => $section.'_courses_section_lbl'.$i,
                    'section'       => $section,
                    'label'         => __( 'Note:', 'gurukul' ),    
                    'description'   => __( '<strong>Changes will not reflect unless you select the our courses.</strong> <br/>Please add the corsess from "Our Courses" and then select course to show information.', 'gurukul' ),
                )
            )
        );
    }

    // Title color
    addColorPalatOption($wp_customize, $section.'_TitleColor', $section, 'Title color', '#2a2a2a');
    // Icon color
    addColorPalatOption($wp_customize, $section.'_IconColor', $section, 'Icon color', '#2e2e2e');
    // TEAM SECTION END HERE 
}
