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



<?php include APPLICATION_PATH .  '/application/modules/Browserpush/views/scripts/dismiss_message.tpl';?>

<script type="text/javascript">

function multiDelete()

{

  return confirm("<?php echo $this->translate("Are you sure you want to delete the selected slides ?") ?>");

}

function selectAll()
{
  var i;
  var multidelete_form = document.getElementById('multidelete_form');
  var inputs = multidelete_form.elements;
  for (i = 1; i < inputs.length - 1; i++) {
    inputs[i].checked = inputs[0].checked;
  }
}

</script>



      <h3><?php echo $this->translate("Sent Notifications") ?></h3>

      <p><?php echo $this->translate("This page lists all the notifications sent by you. Below, you can also choose to re-send the notifications") ?></p>


      <div class='admin_search browsepush_admin_search'>

        <?php echo $this->formFilter->render($this) ?>

      </div>


      <?php if(is_countable($this->paginator) &&  engine_count($this->paginator)): ?>

        <p>

          <?php echo $this->translate(array('%s sent notification found.', '%s sent notifications found.', engine_count($this->paginator)), $this->locale()->toNumber(engine_count($this->paginator))) ?>

      </p>

        <div class="browsepush_admin_table">

          <form id='multidelete_form' method="post" action="<?php echo $this->url();?>" onSubmit="return multiDelete()">

          <table class='admin_table'>

            <thead>

              <tr>

                <th class='admin_table_short'><input onclick='selectAll();' type='checkbox' class='checkbox' /></th>

                <th class='admin_table_short'><?php echo $this->translate("ID"); ?></th>

                <th class='admin_table_short'><?php echo $this->translate("Icon"); ?></th>

                <th><?php echo $this->translate("Title") ?></th>

                <th><?php echo $this->translate("Description") ?></th>

                <th><?php echo $this->translate("Scheduled Time") ?></th>

                <th><?php echo $this->translate("Redirect URL") ?></th>

                <th><?php echo $this->translate("Options") ?></th>

              </tr>

            </thead>

            <tbody>

              <?php foreach ($this->paginator as $item): ?>

                <tr>

                  <td><input type='checkbox' class='checkbox' name='delete_<?php echo $item->getIdentity();?>' value='<?php echo $item->getIdentity() ?>' /></td>

                  <td><?php echo $item->getIdentity() ?></td>

                  <td>
                    <?php if($item->file_id) {
                      $file = Engine_Api::_()->getItemTable('storage_file')->getFile($item->file_id);
                      if( $file ) {
                        $image =  $file->map(); ?>
                        <img src="<?php echo $image; ?>" style="height:50px; width:50px">
                        <?php
                      }else
                        echo "-";
                     } else echo "-"; ?>
                  </td>

                  <td><?php echo $item->getTitle(); ?></td>

                  <td><?php echo $item->getDescription(); ?></td>

                   <td><?php echo $item->scheduled_time; ?></td>

                  <td class="admin_table_url"><?php echo $item->link; ?></td>

                  <td>

                    <?php echo $this->htmlLink(array('route' => 'admin_default', 'module' => 'browserpush', 'controller' => 'scheduled', 'action' => 'resend', 'id' => $item->getIdentity(), 'param' => '1'), $this->translate("Edit & Resend"), array('class' => 'smoothbox')); ?>
                    <?php if(!empty($item->sent)) { ?>
                    |
                    <?php echo $this->htmlLink(array('route' => 'admin_default', 'module' => 'browserpush', 'controller' => 'scheduled', 'action' => 'report', 'scheduled_id' => $item->getIdentity()), $this->translate("Report"), array('class' => 'ajaxsmoothbox')); ?>
                    <?php } ?>

                  </td>

                </tr>

              <?php endforeach; ?>

            </tbody>

          </table>


          <div class='buttons'>

            <button type='submit'><?php echo $this->translate("Delete Selected") ?></button>

          </div>

          </form>

        </div>

      <?php else: ?>

        <div class="tip">

          <span>

            <?php echo $this->translate("There are no scheduled notification created by you yet.") ?>

          </span>

        </div>

      <?php endif; ?>



