<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>

<div class="landingpage_main">
  <div class="landing_page_sign_up_main">
    <?php if(Engine_Api::_()->getApi('settings', 'core')->getSetting('core.general.recent.login', 1) && isset($_COOKIE['user_login_users']) && !empty ($_COOKIE['user_login_users'])) { ?>
      <?php $recent_login = Zend_Json::decode($_COOKIE['user_login_users']); ?>
      <div class="recent_login_section">
        <div class="recent_login_head">
          <?php if ($this->leftsideimage) { ?>
            <?php $leftsideimage = Engine_Api::_()->core()->getFileUrl($this->leftsideimage, true); ?>
            <a href=""><img src="<?php echo $leftsideimage['image'] ?>" alt="<?php echo $leftsideimage['alt_text'] ? $leftsideimage['alt_text'] : 'image'; ?>" ></a>
          <?php } else { ?>
            <a href="">
              <?php echo $this->translate($this->siteTitle); ?>
            </a>
          <?php } ?>
          <h2>
            <?php echo $this->translate("Recent logins"); ?>
          </h2>
          <p>
            <?php echo $this->translate("Click your picture or add an account."); ?>
          </p>
        </div>
        <?php if (engine_count($recent_login) > 0) { ?>
          <div class="recent_members_data">
            <?php foreach ($recent_login as $users) {
              $userArray = explode("_", $users);
              $user = Engine_Api::_()->getItem('user', $userArray[0]);
              ?>
              <div id="recent_login_<?php echo $user->getIdentity(); ?>" class="member_item">
                <a class="ajaxsmoothbox" id="triggerid<?php echo $user->user_id; ?>" href="<?php echo $this->baseUrl() . "/user/auth/poplogin?user_id=" . $user->user_id; ?>">
                  <div class="members_tab_item">
                    <div class="_img">
                      <?php echo $this->itemPhoto($user, 'thumb.profile'); ?>
                    </div>
                    <div class="_cont">
                      <span class="_name">
                        <?php echo $user->getTitle(); ?>
                      </span>
                    </div>
                  </div>
                </a>
                <a href="javascript:void(0);" onclick="removeRecentUser('<?php echo $user->getIdentity(); ?>', 'recent_login_remove');" class="close-btn _close"  data-bs-toggle="modal" data-bs-target="#recent_login_remove"><i class="fa fa-times"></i></a>
              </div>
              <!-- Remove Account -->
              <?php include APPLICATION_PATH .  '/application/modules/User/views/scripts/_removeRecentLoginPopup.tpl';?>
            <?php } ?>
            <div class="member_item">
              <a href="login" id="triggeridnewuseradd" class="">
                <div class="members_tab_item">
                  <div class="_img">
                    <i class="fa fa-plus"></i>
                  </div>
                  <div class="_cont">
                    <span class="_name add_user">
                      <?php echo $this->translate("Add Account"); ?>
                    </span>
                  </div>
                </div>
              </a>
            </div>
          </div>
        <?php } ?>
      </div>
    <?php } else { ?>
      <div class="login_left_section">
        <?php if ($this->leftsideimage) { ?>
          <?php $leftsideimage = Engine_Api::_()->core()->getFileUrl($this->leftsideimage, true); ?>
          <a href=""><img src="<?php echo $leftsideimage['image'] ?>" alt="<?php echo $leftsideimage['alt_text'] ? $leftsideimage['alt_text'] : '' ?>"></a>
        <?php } else { ?>
          <a href="">
            <?php echo $this->translate($this->siteTitle); ?>
          </a>
        <?php } ?>
        <div class="login_left_content">
          <?php if ($this->heading) { ?>
            <div class="left_heading">
              <p>
                <?php echo $this->translate($this->heading); ?>
              </p>
            </div>
          <?php } ?>
        </div>
      </div>
    <?php } ?>
    <div class="login_right_section">
      <div class="login_form">
        <?php echo $this->content()->renderWidget("user.login-or-signup") ?>
        <div class="lp_signup">
          <a href="signup">
            <?php echo $this->translate("Create new account"); ?>
          </a>
        </div>
      </div>
      <?php if ($this->description) { ?>
        <div class="_paragraph">
          <p>
            <?php echo $this->translate($this->description); ?>
          </p>
        </div>
      <?php } ?>
    </div>
  </div>
</div>
<style type="text/css">
  html {
    overflow-y: auto !important;
  }
</style>
