<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<div class="dashboard_links_wrap">
	<?php foreach ($this->dashboardlinks as $item): ?>
		<div class="dashboard_links <?php if (!empty($item->type) && $item->type == 'horizontal') { ?> dashboard_links_horizontal <?php } else { ?> dashboard_links_vertical <?php } ?>">
			<?php $results = Engine_Api::_()->getDbTable('dashboardlinks', 'core')->getInfo(array('sublink' => $item->dashboardlink_id, 'enabled' => 1)); ?>
			<?php if (engine_count($results) > 0) { ?>
				<div class="dashboard_links_head">
					<span><?php echo $item->name; ?></span>
				</div>
				<ul class="d-flex <?php if (!empty($item->type) && $item->type == 'horizontal') { ?>gap-4 align-items-center flex-wrap<?php } else { ?> gap-1 align-items-start flex-column <?php } ?>">
					<?php foreach ($results as $result) { ?>
						<li class="dashboard_link_item">
							<a href="<?php echo $result->url; ?>" class="ajaxPrevent">
								<?php if (empty($result->icon_type) && !empty($result->file_id)): ?>
									<?php $photo = Engine_Api::_()->storage()->get($result->file_id, '');
									if ($photo) {
										$photo = $photo->map(); ?>
										<div class="dashboard_link_item_icon center_item">
											<i class="_icon center_item"><img src="<?php echo $photo; ?>" /></i>
										</div>
									<?php } ?>
								<?php elseif (empty($result->file_id) && !empty($result->icon_type)): ?>
									<div class="dashboard_link_item_icon center_item">
										<i class="center_item <?php echo $result->font_icon; ?>"></i>
									</div>
								<?php endif; ?>
								<div class="dashboard_link_item_text">
									<span class="_title"><?php echo $result->name; ?></span>
									<?php if ($item->type == 'vertical' && $result->description) { ?>
										<span class="_text"><?php echo $result->description; ?></span>
									<?php } ?>
								</div>
							</a>
						</li>
					<?php } ?>
				</ul>
			<?php } ?>
		</div>
	<?php endforeach; ?>
</div>