<?php
defined('ABSPATH') || exit;

use Yalogica\NinjaDraw\Models\SettingsModel;
use Yalogica\NinjaDraw\Models\AccessModel;
?>

<div class="ninjadraw-app-wrap">
  <div class="ninjadraw-app">
    <div class="ninjadraw-header">
      <div class="ninjadraw-title">
        <span><?php SettingsModel::echoIcon(); ?></span>
        <span>NinjaDraw<sup><?php echo sanitize_key(SettingsModel::getSup()); ?></sup> - </span>
        <span><?php esc_html_e("All Diagrams", "ninjadraw"); ?></span>
      </div>
      <div class="ninjadraw-toolbar">
        <?php if (AccessModel::currentUserCan(AccessModel::ACCESS_RIGHT_CREATE)) { ?>
          <a id="ninjadraw-button-create" class="ninjadraw-button ninjadraw-button-create" href="?page=ninjadraw&action=new" title="<?php esc_html_e("Create a new diagram", "ninjadraw"); ?>"><?php esc_html_e("Add New Diagram", "ninjadraw"); ?></a>
        <?php } ?>
      </div>
    </div>
    <div class="ninjadraw-data">
      <?php $table->views(); ?>
      <form method="post">
        <?php $table->search_box(esc_html__("Search", "ninjadraw"), 'item'); ?>
        <input type="hidden" name="page" value="<?php echo sanitize_key((filter_input(INPUT_GET, "page", FILTER_DEFAULT))); ?>">
        <?php $table->display(); ?>
      </form>
    </div>
  </div>
</div>