Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
mylist.phtml 4.37 KiB
<!-- fid_bbi: myresearch - mylist -->
<?php
/**
 * This is mostly a copy of themes/finc/templates/myresearch/mylist.phtml
 * FID BBI specific changes:
 * - remove <ul> wrapper element from list items
 *
 * @author Tobias Schäfer <ts@aspectis.net>
 */
?>
<?php
// Grab list object from search results (if applicable)
$list = $this->results->getListObject();

// Set up page title:
$this->headTitle(isset($list) ? $list->title : $this->translate('Favorites'));

// Load Javascript dependencies into header
$this->headScript()->appendFile('check_item_statuses.js');

// Load Javascript only if list view parameter is NOT full
if ($this->params->getOptions()->getListViewOption() != 'full') {
  $this->headScript()->appendFile('record.js');
  $this->headScript()->appendFile('embedded_record.js');
}

$recordTotal = $this->results->getResultTotal();

// Convenience variable
$account = $this->auth()->getManager();
$user = $this->auth()->isLoggedIn();
?>

<h1><?=$list ? $this->escapeHtml($list->title) : $this->transEsc('Your Favorites')?></h1>

<?=$this->flashmessages()?>

<div class="results">
  <button class="results-sidebar-toggle" type="button" aria-controls="profile-menu">
    <?=$this->icon('person')?>
    <span><?=$this->transEsc('Profile Menu')?></span>
  </button>

  <div class="results-list -wide">
    <nav class="results-header -wide">
      <?php if ($recordTotal > 0): ?>
        <div class="results-count">
          <?=$this->translate('%%count%% results', ['%%count%%' => $this->localizedNumber($recordTotal)])?>
        </div>
      <?php endif; ?>

      <?php if (isset($list)): ?>
        <?php if ($list->editAllowed($account->isLoggedIn())): ?>
          <div class="results-list-actions">
            <div>
              <a href="<?=$this->url('editList', ['id' => $list->id])?>">
                <?=$this->transEsc('edit_list')?>
              </a>
            </div>
            <div>
              <a
                class="dropdown-toggle"
                data-toggle="dropdown"
                href="<?=$this->url('myresearch-deletelist')?>?listID=<?=urlencode($list->id)?>"
              >
                <?=$this->transEsc('delete_list')?>
              </a>
              <ul class="dropdown-menu">
                <li>
                  <a href="<?=$this->url('myresearch-deletelist')?>?listID=<?=urlencode($list->id)?>&amp;confirm=1">
                    <?=$this->transEsc('confirm_dialog_yes')?>
                  </a>
                </li>
                <li>
                  <a href="#">
                    <?=$this->transEsc('confirm_dialog_no')?>
                  </a>
                </li>
              </ul>
            </div>
          </div>
        <?php endif; ?>
      <?php endif; ?>
      <?php if ($recordTotal > 0): ?>
        <?=$this->render('search/controls/limit.phtml')?>
        <?=$this->render('search/controls/sort.phtml')?>
      <?php endif; ?>
    </nav>

    <?php if ($list && !empty($list->description)): ?>
      <p class="results-list-description"><?=$this->escapeHtml($list->description)?></p>
    <?php endif; ?>

    <?php if ($recordTotal > 0): ?>
      <form
        class="form-inline"
        method="post"
        name="bulkActionForm"
        action="<?=$this->url('cart-myresearchbulk')?>"
        data-lightbox
        data-lightbox-onsubmit="bulkFormHandler"
      >
        <?=$this->context($this)->renderInContext('myresearch/bulk-action-buttons.phtml', ['idPrefix' => '', 'list' => $list ?? null, 'account' => $this->account])?>
        <ul class="record-list">
          <?php foreach ($this->results->getResults() as $i => $current): ?>
            <?=$this->record($current)->getListEntry($list, $user)?>
          <?php endforeach; ?>
        </ul>
      </form>

      <?=$this->paginationControl($this->results->getPaginator(), 'Sliding', 'search/pagination.phtml', ['results' => $this->results])?>
    <?php else: ?>
      <div class="alert -info">
        <?=$this->icon('info')?>
        <p><?=$this->transEsc('You do not have any saved resources')?></p>
      </div>
    <?php endif; ?>
  </div>

  <?php if ($user): ?>
    <?=$this->context($this)->renderInContext('myresearch/menu.phtml', ['active' => isset($list) ? 'list' . $list['id'] : 'favorites'])?>
  <?php endif; ?>
</div>

<?php
// TODO: Would be nice to move the bulk actions into a sidebar, but they need to
// be wrapped inside the same form as the item list
?>
<!-- fid_bbi: myresearch - mylist - END -->