<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<div class="user_dashboard_links ">
	<div class="dashboard_explore_links_v">
  	<ul>
    	<li class="_profile">
        <a class="profile_link" href="<?php echo $this->viewer->getHref(); ?>">
          <?php if($this->viewer->photo_id) { ?>
            <img src="<?php echo $this->viewer->getPhotoUrl('thumb.icon'); ?>" />
          <?php } else { ?>
            <img src="application/modules/User/externals/images/nophoto_user_thumb_icon.png" />
          <?php } ?>
          <span><?php echo $this->viewer->getTitle(); ?></span>
        </a>
        <span class="user_dashboard_dropdown_toggle"><a onclick="showHideInformation('fbclone_information');" href="javascript:void(0);" class="fa fa-ellipsis-h" title='<?php echo $this->translate("Edit Profile")?>'></a></span>
        <ul class="edit_profile_dropdown" style="display:none;" id="fbclone_information">
          <?php foreach( $this->homelinksnavigation as $link ): ?>
            <li>
              <a href="<?php echo $link->getHref(); ?>"><?php echo $this->translate($link->getLabel()); ?></a>
            </li>
          <?php endforeach; ?>
        </ul>
    	</li>
    </ul>
  </div>
  <?php foreach( $this->dashboardlinks as $item ): ?>
    <div class="<?php if(!empty($item->type) && $item->type == 'horizontal') { ?> dashboard_explore_links_h <?php } else { ?> dashboard_explore_links_v <?php } ?>">
      <?php $footersubresults = Engine_Api::_()->getDbTable('dashboardlinks', 'fbclone')->getInfo(array('sublink' => $item->dashboardlink_id, 'enabled' => 1)); ?>
      <?php if(engine_count($footersubresults) > 0) { ?>
        <p class="links_tittle"><?php echo $this->translate($item->name); ?></p>
        <ul>
          <?php foreach($footersubresults as $footersubresult) { ?>
            <li><a href="<?php echo $footersubresult->url; ?>">
            <?php if(empty($footersubresult->icon_type) && !empty($footersubresult->photo)): ?>
              <?php $icon = Engine_Api::_()->core()->getFileUrl($footersubresult->photo, true); ?>
              <img src="<?php echo $icon['image']; ?>" alt="<?php echo $icon['alt_text'] ? $icon['alt_text'] : ''; ?>" />
            <?php elseif(empty($footersubresult->photo) && !empty($footersubresult->icon_type) && !empty($footersubresult->font_icon)): ?>
              <i <?php if($footersubresult->fonticoncolor) { ?> style="color:<?php echo $footersubresult->fonticoncolor; ?>" <?php } ?> class="<?php echo $footersubresult->font_icon; ?>"></i>
            <?php endif;?>
            <span><?php echo $this->translate($footersubresult->name); ?></span></a></li>
          <?php } ?>
        </ul>
      <?php } ?>
    </div>
  <?php endforeach; ?>
</div>
<script>
   // Main Menu Toggle
   en4.core.runonce.add(function() {
      scriptJquery(".user_dashboard_dropdown_toggle").click(function () {
        if(scriptJquery(".edit_profile_dropdown").hasClass('toggle_open')){
          scriptJquery(".edit_profile_dropdown").removeClass('toggle_open')
        }
        else{
          scriptJquery(".edit_profile_dropdown").addClass('toggle_open');
        }
      });
    });

    scriptJquery(document).click(function(event) {
      if (!scriptJquery(event.target).closest(".edit_profile_dropdown,.user_dashboard_dropdown_toggle").length) {
        scriptJquery("html").find(".edit_profile_dropdown").removeClass("toggle_open");
     }
    });
</script>
