<?php
  // Set up page title:
  $pageTitle = empty($this->list->id) ? 'Create a List' : "edit_list";
  $this->headTitle($this->translate($pageTitle));

  // Set up breadcrumbs:
  $this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li>'
    . '<li>' . $this->transEsc($pageTitle) . '</li>';
?>

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

<h2><?=$this->transEsc($pageTitle); ?></h2>

<form class="form-edit-list" method="post" name="<?=empty($this->list->id) ? 'newList' : 'editListForm'?>">
  <input type="hidden" name="id" value="<?=empty($this->list->id) ? 'NEW' : $this->list->id ?>"/>
  <div class="form-group">
    <label class="control-label" for="list_title"><?=$this->transEsc('List'); ?>:</label>
    <input id="list_title" class="form-control" type="text" name="title" value="<?=isset($this->list['title']) ? $this->escapeHtml($this->list['title']) : ''?>"/>
  </div>
  <div class="form-group">
    <label class="control-label" for="list_desc"><?=$this->transEsc('Description') ?></label>
    <textarea id="list_desc" class="form-control" name="desc" rows="3"><?=isset($this->list['description']) ? $this->escapeHtml($this->list['description']) : ''?></textarea>
  </div>
  <?php if ($this->userlist()->getMode() === 'public_only'): ?>
    <input type="hidden" name="public" value="1" />
  <?php elseif ($this->userlist()->getMode() === 'private_only'): ?>
    <input type="hidden" name="public" value="0" />
  <?php else: ?>
    <!-- <div class="form-group">
      <label class="control-label">?=$this->transEsc('Access') ?></label>
      <div class="radio inline">
        <label>
          <input id="list_public_1" type="radio" name="public" value="1"? if ($this->list->isPublic()): ?> checked="checked"? endif; ?>/> ?=$this->transEsc('Public') ?>
        </label>
      </div>
      <div class="radio inline">
        <label>
          <input id="list_public_0" type="radio" name="public" value="0"? if (!$this->list->isPublic()): ?> checked="checked"? endif; ?>/> ?=$this->transEsc('Private') ?>
        </label>
      </div>
    </div> -->
    <input type="hidden" id="list_public_0" name="public" value="0">
  <?php endif; ?>
  <div class="form-group">
    <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Save') ?>"/>
  </div>
</form>
