<div class="ulp-quiz-questions-select">

<?php if ($data['all_questions']):?>

		<select id="ulp_select_questions" multiple="multiple" name="questions_list[]" style="width: 95%;min-height: 200px; ">

				<?php if ($data['all_questions']):?>

						<?php foreach ($data['all_questions'] as $subarray):?>

								<?php

										if (in_array($subarray['ID'], $data['quiz_questions'])){

												//$labels [$subarray['ID']] = $subarray['post_content'];
												//v.1.3
												$labels [$subarray['ID']] = mb_substr( strip_tags($subarray['post_content']), 0 , 110);

												$post_types [$subarray['ID']] = $subarray['post_type'];

												continue;

										}

								 ?>

								<option value="<?php echo $subarray['ID'];?>" data-post_type="<?php echo $subarray['post_type'];?>"><?php echo mb_substr( strip_tags($subarray['post_content']), 0 , 110);?></option>

						<?php endforeach;?>

						<?php if (isset($data['quiz_questions'])):?>

									<?php foreach ($data['quiz_questions'] as $item_id):?>

											<option value="<?php echo $item_id;?>" data-post_type="<?php echo $post_types[$item_id];?>" selected><?php echo $labels[$item_id];?></option>

									<?php endforeach;?>

						<?php endif;?>

				<?php endif;?>

		</select>

<?php endif;?>

<script>

	jQuery(document).ready(function(){

		jQuery("#ulp_select_questions").multiselect({sortable: true, searchable: true, dividerLocation: 0.5,});

	});

</script>

</div>

<?php wp_enqueue_script('ulp_ui_multiselect_js');?>
