<script type="text/javascript" src="<?php echo SITE_URL ?>libs/ckeditor/ckeditor.js"></script>

<div class="breadcrumb">
    <h1>Super admin configuration</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Super admin configuration</li>

    </ul>
</div>


<div class="separator-breadcrumb border-top"></div>

<div class="row">
    <div class="col-md-12">
        <div class="card mb-4">
            <div class="card-body">
                <form action="" method="post" enctype="multipart/form-data">

                <div class="row">


    <?php if($settingDetail && $settingDetail > 0 ){ foreach ($settingDetail as $setting){ ?>

        <div class="col-md-6 form-group mb-3">
            <label class="control-label"><?php echo $setting->setting_label ?></label>

            <?php if($setting->setting_type=='input'){ ?>

    		<input type="text"  class="form-control" id="settings[<?php echo $setting->setting_name ?>]" name="settings[<?php echo $setting->setting_name ?>]" value="<?php echo $setting->setting_value ?>" size="50" >

			<?php } else if($setting->setting_type=='textarea'){ ?>

   			 <textarea class="form-control" name="settings[<?php echo $setting->setting_name ?>]" id="settings[<?php echo $setting->setting_name ?>]" ><?php echo $setting->setting_value; ?></textarea>

			<?php }else if($setting->setting_type=='small-ckeditor'){ ?>

			<textarea class="form-control" name="settings[<?php echo $setting->setting_name ?>]" id="settings[<?php echo $setting->setting_name ?>]" cols="48"  ><?php echo $setting->setting_value; ?></textarea><br/>

       	 <script type="text/javascript"> 
            CKEDITOR.replace( "settings[<?php echo $setting->setting_name ?>]",{
            filebrowserBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html',
                        filebrowserUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/userfiles',
                        filebrowserImageBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html?Type=Images',
                        filebrowserFlashBrowseUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/ckfinder.html?Type=Flash',
                        filebrowserUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                        filebrowserImageUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                        filebrowserFlashUploadUrl : '<?php echo SITE_URL.'libs';?>'+'/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
                        } );
                    </script>

	<?php } else if($setting->setting_type=='ckeditor'){?>

        <textarea name="settings[<?php echo $setting->setting_name ?>]" id="settings[<?php echo $setting->setting_name ?>]" class="form-control" rows="10" cols="20"><?php echo $setting->setting_value; ?></textarea></br>
        <script type="text/javascript"> 
            CKEDITOR.replace( "settings[<?php echo $setting->setting_name ?>]",
                {
                   toolbar :
                    [
                        { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
                        { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
                        { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
                        { name: 'paragraph', items : [ 'NumberedList','BulletedList' ] },
                        { name: 'tools', items : [ 'Maximize','-','About' ] }
                    ]
                });
        </script>

		<?php } else if($setting->setting_type=='file'){?>

                <input type="file"  class="form-control" id="settings[<?php echo $setting->setting_name ?>]" name="settings[<?php echo $setting->setting_name ?>]" size="50" value="settings['<?php echo $setting->setting_value ?>']">
				
				<?php if($setting->setting_value!="" && file_exists(DIR_UPLOAD_SETTING.$setting->setting_value)){?>
					<a href="<?php echo DIR_UPLOAD_SETTING_SHOW.$setting->setting_value ?>" target="_blank">View</a>
				<?php } ?>
				<span><?php echo $setting->setting_value; ?></span>
				<input type="hidden" id="uploaded_file<?php echo $setting->setting_name ?>" name="uploaded_file<?php echo $setting->setting_name ?>" value="<?php echo $setting->setting_value; ?>" />	
					
			<?php } ?>			
		</div>
	<?php }} ?>



                        <div class="col-md-12">
                            <button class="btn btn-primary" id="submit" name="submit">Submit</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>