<commit_before><?php
$CategoryHelper = $this->Helpers->load('Categories.Category');
$data = $CategoryHelper->loadData();
$list = $CategoryHelper->displayList();

foreach ($list as $catId => $catName) {
	$catArray[] = $CategoryHelper->displayItems($catId);
}
?>

<div class="card-builder-con c-builder">
	<section id="tabs">
		
		<div class="bs-docs-example">
			<div class="carousel slide" id="myCarousel">
				<div class="carousel-cat">
					<ul class="nav nav-tabs" id="myTabContent">
						<?php $i = 0; foreach ($catArray as $cat) : $i++; ?>
						<li>
							<a data-toggle="tab" href="#tab<?php echo $i ?>"><?php echo $cat['Category']['name'] ?></a>
						</li>
						<?php endforeach; ?>
					</ul>
				</div>
			</div>
		</div>

		<div class="tab-content" id="myTabContent1">

<?php
$i = 0;
foreach ($catArray as $cat) :
	$i++;
	$sets = $slides = array();
	$iSlide = 0;
?>	

			<div class="tab-pane fade" id="tab<?php echo $i ?>">
				
				<?php if (isset($cat['Associated'])) : ?>
				<?php
				foreach ($cat['Associated']['MediaGallery'] as $slide) {
					$slides[] = $slide;
					$iSlide++;
					if ($iSlide === 4 || $iSlide === count($cat['Associated']['MediaGallery'])) {
						$sets[] = $slides;
						$slides = array();
						$iSlide = 0;
					}
				}
				?>
				
				<div class="carousel slide" id="myCarousel<?php echo $i ?>">
					<div class="carousel-inner">
						<?php $iSet = 0; foreach ($sets as $set) : ?>
						<div class="item <?php if ($iSet === 0) echo 'active' ?>">
							<ul>
								<?php foreach ($set as $slide) : ?>
								<li>
									<img src="/theme/Default/media/images/<?php echo $slide['Media'][0]['filename'].'.'.$slide['Media'][0]['extension'] ?>"  style="max-width: 285px;" />
									<a href="/media/mediaGalleries/duplicateGallery/<?php echo $slide['MediaGallery']['id']?>" class="btn btn-warning btn-personalize">Personalize</a>
								</li>
								<?php endforeach; ?>
							</ul>
						</div>
						<?php $iSet++; endforeach; ?>
					</div>
					<?php if (count($sets) > 1) : ?>
					<a class="left carousel-control" data-slide="prev" href="#myCarousel<?php echo $i ?>">&nbsp;</a><a class="right carousel-control" data-slide="next" href="#myCarousel<?php echo $i ?>">&nbsp;</a>
					<?php endif; ?>
				</div>
				
				<?php else : ?>
					<p style="text-align: center;">no items in this category yet</p>
				<?php endif; ?>
				
			</div>

<?php endforeach; ?>

		</div>
	</section>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		$('.carousel').carousel('pause');
	}); 
</script><commit_msg>updates to tabbed display<commit_after><?php
$CategoryHelper = $this->Helpers->load('Categories.Category');
$data = $CategoryHelper->loadData();
$list = $CategoryHelper->displayList();

foreach ($list as $catId => $catName) {
	$catArray[] = $CategoryHelper->displayItems($catId);
}
?>

<div class="card-builder-con c-builder">
	<section id="tabs">

		<div class="bs-docs-example">
			<div class="carousel slide" id="myCarousel">
				<div class="carousel-cat">
					<ul class="nav nav-tabs" id="myTabContent">
						<?php $i = 0; foreach ($catArray as $cat) : $i++; ?>
						<li>
							<a data-toggle="tab" href="#tab<?php echo $i ?>"><?php echo $cat['Category']['name'] ?></a>
						</li>
						<?php endforeach; ?>
					</ul>
				</div>
			</div>
		</div>

		<div class="tab-content" id="myTabContent1">

<?php
$i = 0;
foreach ($catArray as $cat) :
	$i++;
	$sets = $slides = array();
	$iSlide = 0;
?>

			<div class="tab-pane fade" id="tab<?php echo $i ?>">

				<?php if (isset($cat['Associated'])) : ?>
				<?php
				$lastIndex = count($cat['Associated']['MediaGallery']) - 1;
				foreach ($cat['Associated']['MediaGallery'] as $slide) {
					$slides[] = $slide;
					$iSlide++;
					if (
						$iSlide === 4 // close set on the 4th slide..
						|| $cat['Associated']['MediaGallery'][$lastIndex] === $slide // ..or if on the last slide
					) {
						$sets[] = $slides;
						$slides = array();
						$iSlide = 0;
					}
				}
				?>

				<div class="carousel slide" id="myCarousel<?php echo $i ?>">
					<div class="carousel-inner">
						<?php $iSet = 0; foreach ($sets as $set) : ?>
						<div class="item <?php if ($iSet === 0) echo 'active' ?>">
							<ul>
								<?php foreach ($set as $slide) : ?>
								<li>
									<img src="/theme/Default/media/images/<?php echo $slide['Media'][0]['filename'].'.'.$slide['Media'][0]['extension'] ?>"  style="max-width: 285px;" />
									<a href="/media/mediaGalleries/duplicateGallery/<?php echo $slide['MediaGallery']['id']?>" class="btn btn-warning btn-personalize">Personalize</a>
								</li>
								<?php endforeach; ?>
							</ul>
						</div>
						<?php $iSet++; endforeach; ?>
					</div>
					<?php if (count($sets) > 1) : ?>
					<a class="left carousel-control btn btn-warning" data-slide="prev" href="#myCarousel<?php echo $i ?>"><i class="icon icon-chevron-left"></i></a>
					<a class="right carousel-control btn btn-warning" data-slide="next" href="#myCarousel<?php echo $i ?>"><i class="icon icon-chevron-right"></i></a>
					<?php endif; ?>
				</div>

				<?php else : ?>
					<p style="text-align: center;">no items in this category yet</p>
				<?php endif; ?>

			</div>

<?php endforeach; ?>

		</div>
	</section>
</div>

<script type="text/javascript">
	$(document).ready(function() {
		$('.carousel').carousel('pause');
	});
</script>
{'fraction_non_alphanumeric': 0.2303839732888147, 'fraction_numerical': 0.005564830272676683, 'mean_word_length': 3.1701469450889403, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 151, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '951252', 'n_tokens_mistral': 2369, 'n_tokens_neox': 1869, 'n_words': 420}