advertising.phtml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. /**
  3. * @version 7.7
  4. */
  5. /* @var \Ppb\Service\Table\Relational\Categories $categoriesService */
  6. ?>
  7. <nav class="navbar navbar-filter">
  8. <div class="navbar-left">
  9. <a class="btn btn-default pull-left spacing-right"
  10. href="<?php echo $this->url(array('action' => 'create-advert')); ?>">
  11. <?php echo $this->_('Create Advert'); ?>
  12. </a>
  13. </div>
  14. </nav>
  15. <form method="post" action="" class="form-horizontal">
  16. <div class="table-responsive">
  17. <table class="table table-striped table-hover">
  18. <caption>
  19. <strong><?php echo $this->paginator->getPages()->totalItemCount; ?></strong> <?php echo $this->_('adverts found.'); ?>
  20. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  21. <?php echo $this->_('Showing results'); ?>
  22. <strong><?php echo $this->paginator->getPages()->firstItemNumber; ?></strong>
  23. <?php echo $this->_('to'); ?>
  24. <strong><?php echo $this->paginator->getPages()->lastItemNumber; ?></strong>
  25. <?php } ?>
  26. </caption>
  27. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  28. <thead>
  29. <tr>
  30. <th class="size-tiny"></th>
  31. <th><?php echo $this->_('Advert Details'); ?></th>
  32. <th class="size-small"><?php echo $this->_('Section'); ?></th>
  33. <th class="size-small"><?php echo $this->_('Stats'); ?></th>
  34. <th class="size-tiny"><?php echo $this->_('Active'); ?></th>
  35. <th class="size-tiny"></th>
  36. </tr>
  37. </thead>
  38. <?php } ?>
  39. <tbody>
  40. <?php
  41. $checkboxCounter = 0;
  42. /** @var \Cube\Db\Table\Row $advert */
  43. foreach ($this->paginator as $advert) {
  44. ?>
  45. <tr>
  46. <td>
  47. <a class="btn btn-sm btn-default ajax-popup"
  48. href="<?php echo $this->url(array('action' => 'preview-advert', 'id' => $advert['id'])); ?>"
  49. title="<?php echo $this->_('Preview Advert'); ?>">
  50. <i class="fa fa-picture-o"></i>
  51. </a>
  52. </td>
  53. <td>
  54. <p>
  55. <?php echo $advert['name']; ?>
  56. <span class="label label-default pull-right"><?php echo $advert['type']; ?></span>
  57. </p>
  58. <div>
  59. <small><strong><?php echo $this->_('Language:'); ?></strong> <?php echo $this->fieldDisplay($advert['language'], null, $this->_('All')); ?></small>
  60. </div>
  61. <div>
  62. <small>
  63. <strong><?php echo $this->_('Categories:'); ?></strong>
  64. <?php
  65. if ($advert['category_ids']) {
  66. $select = $categoriesService->getTable()->select()
  67. ->where('id IN (?)', \Ppb\Utility::unserialize($advert['category_ids']));
  68. $multiOptions = $categoriesService->getMultiOptions($select);
  69. echo implode('; ', $multiOptions);
  70. }
  71. else {
  72. echo $this->_('All Categories');
  73. } ?>
  74. </small>
  75. </div>
  76. </td>
  77. <td>
  78. <?php echo $this->sections[$advert['section']]; ?>
  79. </td>
  80. <td>
  81. <div>
  82. <small>
  83. <?php echo $this->_('Added:'); ?> <?php echo $this->date(max(array($advert['created_at'], $advert['updated_at'])),
  84. true); ?>
  85. </small>
  86. </div>
  87. <div>
  88. <small>
  89. <?php echo $this->_('Views:'); ?> <?php echo $advert['nb_views']; ?>
  90. </small>
  91. </div>
  92. <?php if ($advert['type'] == 'image') { ?>
  93. <div>
  94. <small>
  95. <?php echo $this->_('Clicks:'); ?> <?php echo $advert['nb_clicks']; ?>
  96. </small>
  97. </div>
  98. <?php } ?>
  99. </td>
  100. <td>
  101. <?php echo $this->formElement('hidden', 'id')
  102. ->setMultiple()
  103. ->setValue($advert['id'])
  104. ->render();
  105. ?>
  106. <?php echo $this->formElement('checkbox', 'active')
  107. ->setValue($advert['active'])
  108. ->setMultiOptions(array(1 => null))
  109. ->setBrackets('[' . $checkboxCounter . ']')
  110. ->setMultiple()
  111. ->render();
  112. ?>
  113. </td>
  114. <td>
  115. <div class="btn-group-vertical">
  116. <a class="btn btn-default btn-sm"
  117. href="<?php echo $this->url(array('action' => 'edit-advert', 'id' => $advert['id'])); ?>"
  118. title="<?php echo $this->_('Edit Advert'); ?>">
  119. <i class="fa fa-folder-open"></i>
  120. </a>
  121. <a class="btn btn-danger btn-sm confirm-box"
  122. href="<?php echo $this->url(array('action' => 'delete-advert', 'id' => $advert['id']),
  123. null, true); ?>"
  124. title="<?php echo $this->_('Delete Advert'); ?>"
  125. data-message="<?php echo $this->_('Are you sure you want to delete this advert?'); ?>">
  126. <i class="fa fa-times"></i>
  127. </a>
  128. </div>
  129. </td>
  130. </tr>
  131. <?php $checkboxCounter ++; ?>
  132. <?php } ?>
  133. <tr>
  134. <td colspan="8">
  135. <?php echo $this->formElement('submit', 'submit', $this->_('Update'))
  136. ->setAttributes(array('class' => 'btn btn-primary btn-lg'))
  137. ->render();
  138. ?></td>
  139. </tr>
  140. </tbody>
  141. </table>
  142. </div>
  143. </form>
  144. <?php echo $this->pagination($this->paginator, 'sliding', 'partials/pagination.phtml'); ?>