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

<?php if( $this->trAlign == '1'): ?>
  <div class="container no-padding travels_listing">
    <ul class="grid_listing">
      <?php foreach( $this->paginator as $item ): ?>
        <li class="grid_listing_item">
          <article>
            <div class="grid_listing_item_thumb">
              <?php echo $this->htmlLink($item->getHref(), $this->itemBackgroundPhoto($item, 'thumb.normal')) ?>
            </div>
            <div class="grid_listing_item_info">
              <div class="grid_listing_item_title">
                <?php echo $this->htmlLink($item->getHref(), $item->getTitle()) ?>
              </div>
              <div class="grid_listing_item_owner">
                <span>
                  <?php
                  $owner = $item->getOwner();
                  echo $this->translate('By: %1$s', $this->htmlLink($owner->getHref(), $owner->getTitle())); ?>
                </span>  
            </div>
              <?php
                $desc = trim($this->string()->truncate($this->string()->stripTags($item->body), $this->trDesLength));
              if( !empty($desc) ): ?>
              <div class="grid_listing_item_desc">
                <?php echo $desc ?>
              </div>
              <?php endif; ?>
            </div>
          </article>
        </li>
      <?php endforeach; ?>
    </ul>
    <?php if( $this->paginator->getPages()->pageCount > 1 ): ?>
      <div class="d-flex justify-content-center">
        <?php echo $this->partial('_widgetLinks.tpl', 'core', array('url' => $this->url(array('action' => 'index'), 'travel_general', true),'param' => array('orderby' => 'view_count'))); ?>
      </div>
    <?php endif; ?>
  </div>
<?php elseif( $this->trAlign == '0'): ?>
  <ul class="sidebar_list travels_sidebar_list">
    <?php foreach( $this->paginator as $item ): ?>
    <li class="sidebar_list_item">
      <div class="sidebar_list_item_thumb">
        <?php echo $this->htmlLink($item->getHref(), $this->itemBackgroundPhoto($item, 'thumb.icon')) ?>
      </div>
      <div class="sidebar_list_item_info">
        <div class="sidebar_list_item_title">
          <?php echo $this->htmlLink($item->getHref(), $item->getTitle()) ?>
        </div>
        <div class="sidebar_list_item_owner">
          <span>
            <?php
            $owner = $item->getOwner();
            echo $this->translate('By: %1$s', $this->htmlLink($owner->getHref(), $owner->getTitle()));
            ?>
          </span>
        </div>
        <?php
           $desc = trim($this->string()->truncate($this->string()->stripTags($item->body), $this->trDesLength));
        if( !empty($desc) ): ?>
          <div class="sidebar_list_item_desc">
            <?php echo $desc ?>
          </div>
        <?php endif; ?>
      </div>
    </li>
    <?php endforeach; ?>
    <?php if( $this->paginator->getPages()->pageCount > 1 ): ?>
      <li class="sidebar_list_item_more">
        <?php echo $this->partial('_widgetLinks.tpl', 'core', array('url' => $this->url(array('action' => 'index'), 'travel_general', true), 'param' => array('orderby' => 'view_count'))); ?>
      </li>
    <?php endif; ?>
  </ul>
<?php endif; ?>
