browse.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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"
  10. href="<?php echo $this->url(array('controller' => 'custom-fields', 'action' => 'add', 'type' => $this->type)); ?>">
  11. <?php echo $this->_('Create Custom Field'); ?>
  12. </a>
  13. </div>
  14. <form class="navbar-form navbar-right"
  15. action="<?php echo $this->url(null, null, true, array('label', 'page', 'submit')); ?>" method="get">
  16. <div class="form-group">
  17. <?php echo $this->formElement('text', 'label', $this->label)
  18. ->setAttributes(array('placeholder' => $this->_('Label'), 'class' => 'form-control input-medium'))
  19. ->render();
  20. ?>
  21. </div>
  22. <?php echo $this->formElement('submit', 'submit', 'Search')
  23. ->setAttributes(array('class' => 'btn btn-default'))
  24. ->render();
  25. ?>
  26. </form>
  27. </nav>
  28. <form method="post" action="" class="form-horizontal">
  29. <div class="table-responsive">
  30. <table class="table table-striped table-hover">
  31. <caption>
  32. <strong><?php echo $this->paginator->getPages()->totalItemCount; ?></strong> <?php echo $this->_('custom fields found.'); ?>
  33. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  34. <?php echo $this->_('Showing results'); ?>
  35. <strong><?php echo $this->paginator->getPages()->firstItemNumber; ?></strong>
  36. <?php echo $this->_('to'); ?>
  37. <strong><?php echo $this->paginator->getPages()->lastItemNumber; ?></strong>
  38. <?php } ?>
  39. </caption>
  40. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  41. <thead>
  42. <tr>
  43. <th><?php echo $this->_('Custom Field Preview'); ?></th>
  44. <th class="size-mini"><?php echo $this->_('Order ID'); ?></th>
  45. <th class="size-tiny"><?php echo $this->_('Active'); ?></th>
  46. <th class="size-mini"><?php echo $this->_('Options'); ?></th>
  47. </tr>
  48. </thead>
  49. <?php } ?>
  50. <tbody>
  51. <?php
  52. $checkboxCounter = 0;
  53. foreach ($this->paginator as $item) { ?>
  54. <tr>
  55. <td>
  56. <?php echo $this->partial('partials/form-element.phtml', array(
  57. 'element' => $this->formElement($item, 'custom_field_' . $item['id']),
  58. )); ?>
  59. <div class="row">
  60. <div class="col-sm-9 col-sm-offset-3">
  61. <div>
  62. <?php if ($item['product_attribute']) { ?>
  63. <span class="label label-success">
  64. <?php echo $this->_('Product Attribute'); ?>
  65. </span>
  66. <?php }
  67. else if ($item['required']) { ?>
  68. <span class="label label-primary">
  69. <?php echo $this->_('Required'); ?>
  70. </span>
  71. <?php } ?>
  72. <?php if ($item['searchable']) { ?>
  73. <span class="label label-info">
  74. <?php echo $this->_('Searchable'); ?>
  75. </span>
  76. <?php } ?>
  77. </div>
  78. <div>
  79. <small>
  80. <strong><?php echo $this->_('Categories:'); ?></strong>
  81. <?php
  82. if ($item['category_ids']) {
  83. $select = $categoriesService->getTable()->select()
  84. ->where('id IN (?)', \Ppb\Utility::unserialize($item['category_ids']));
  85. $multiOptions = $categoriesService->getMultiOptions($select);
  86. echo implode('; ', $multiOptions);
  87. }
  88. else {
  89. echo $this->_('All Categories');
  90. } ?>
  91. </small>
  92. </div>
  93. </div>
  94. </div>
  95. </td>
  96. <td>
  97. <?php echo $this->formElement('text', 'order_id')
  98. ->setAttributes(array('class' => 'form-control'))
  99. ->setMultiple()
  100. ->setValue($item['order_id'])
  101. ->render();
  102. ?>
  103. </td>
  104. <td>
  105. <?php echo $this->formElement('hidden', 'id')
  106. ->setMultiple()
  107. ->setValue($item['id'])
  108. ->render();
  109. ?>
  110. <?php echo $this->formElement('checkbox', 'active')
  111. ->setValue($item['active'])
  112. ->setMultiOptions(array(1 => null))
  113. ->setBrackets('[' . $checkboxCounter . ']')
  114. ->setMultiple()
  115. ->render();
  116. ?>
  117. </td>
  118. <td>
  119. <div class="btn-group">
  120. <a class="btn btn-default btn-sm"
  121. href="<?php echo $this->url(array('controller' => 'custom-fields', 'action' => 'edit', 'id' => $item['id'])); ?>"
  122. title="<?php echo $this->_('Edit Custom Field'); ?>">
  123. <i class="fa fa-folder-open"></i>
  124. </a>
  125. <a class="btn btn-danger btn-sm confirm-box"
  126. href="<?php echo $this->url(array('controller' => 'custom-fields', 'action' => 'delete', 'id' => $item['id']), null, true); ?>"
  127. title="<?php echo $this->_('Delete Custom Field'); ?>"
  128. data-message="<?php echo $this->_('Are you sure that you want to delete this custom field?'); ?>">
  129. <i class="fa fa-times"></i>
  130. </a>
  131. </div>
  132. </td>
  133. </tr>
  134. <?php $checkboxCounter++; ?>
  135. <?php } ?>
  136. <tr>
  137. <td colspan="4">
  138. <?php echo $this->formElement('submit', 'submit', $this->_('Update'))
  139. ->setAttributes(array('class' => 'btn btn-primary btn-lg'))
  140. ->render();
  141. ?></td>
  142. </tr>
  143. </tbody>
  144. </table>
  145. </div>
  146. </form>
  147. <?php echo $this->pagination($this->paginator, 'sliding', 'partials/pagination.phtml'); ?>