/halogy/application/modules/pages/views/admin/templates.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 117 lines · 96 code · 21 blank · 0 comment · 4 complexity · 75a1407fded3990fc4886e0c01d5e368 MD5 · raw file

  1. <script type="text/javascript">
  2. $(function(){
  3. $('div.hidden').hide();
  4. $('a.showform').click(function(event){
  5. event.preventDefault();
  6. $('div.hidden div.inner').load('/templates/add/');
  7. $('div.hidden').fadeIn();
  8. });
  9. $('p.hide a').click(function(event){
  10. event.preventDefault();
  11. $(this).parent().parent().fadeOut();
  12. });
  13. $('.toggle-zip').click(function(event){
  14. event.preventDefault();
  15. $('div#upload-zip').toggle('400');
  16. $('div#upload-image:visible, div#loader:visible').toggle('400');
  17. });
  18. $('select#filter').change(function(){
  19. var status = ($(this).val());
  20. window.location.href = '/admin/pages/templates/'+status;
  21. });
  22. });
  23. </script>
  24. <h1 class="headingleft">Page Templates</h1>
  25. <div class="headingright">
  26. <label for="filter">
  27. Filter
  28. </label>
  29. <?php
  30. $options = array(
  31. '' => 'View All',
  32. 'page' => 'Page Templates',
  33. 'module' => 'Module Templates'
  34. );
  35. echo form_dropdown('filter', $options, $type, 'id="filter"');
  36. ?>
  37. <a href="/admin/pages/includes" class="button blue">Includes</a>
  38. <a href="#" class="button blue toggle-zip">Import Theme</a>
  39. <a href="/admin/pages/add_template" class="button">Add Template</a>
  40. </div>
  41. <div class="hidden">
  42. <p class="hide"><a href="#">x</a></p>
  43. <div class="inner"></div>
  44. </div>
  45. <div class="clear"></div>
  46. <?php if ($errors = validation_errors()): ?>
  47. <div class="error clear">
  48. <?php echo $errors; ?>
  49. </div>
  50. <?php endif; ?>
  51. <div id="upload-zip" class="hidden clear">
  52. <form method="post" action="<?php echo $this->uri->uri_string(); ?>" enctype="multipart/form-data" class="default">
  53. <label for="image">ZIP File:</label>
  54. <div class="uploadfile">
  55. <?php echo @form_upload('zip', '', 'size="16" id="image"'); ?>
  56. </div>
  57. <br class="clear" /><br />
  58. <input type="submit" value="Import Theme" name="upload_zip" class="button nolabel" id="submit" />
  59. <a href="/admin/images" class="button cancel grey">Cancel</a>
  60. </form>
  61. </div>
  62. <?php if ($templates): ?>
  63. <?php echo $this->pagination->create_links(); ?>
  64. <table class="default clear">
  65. <tr>
  66. <th>Templates</th>
  67. <th>Date Modified</th>
  68. <th>Usage</th>
  69. <th class="tiny">&nbsp;</th>
  70. <th class="tiny">&nbsp;</th>
  71. </tr>
  72. <?php
  73. $i = 0;
  74. foreach ($templates as $template):
  75. $class = ($i % 2) ? ' class="alt"' : ''; $i++;
  76. ?>
  77. <tr<?php echo $class;?>>
  78. <td><?php echo anchor('/admin/pages/edit_template/'.$template['templateID'], ($template['modulePath'] != '') ? '<small>Module</small>: '.$template['modulePath'].' <em>('.ucfirst(preg_replace('/^(.+)_/i', '', $template['modulePath'])).')</em>' : $template['templateName']); ?></td>
  79. <td><?php echo dateFmt($template['dateCreated']); ?></td>
  80. <td><?php if ($this->pages->get_template_count($template['templateID']) > 0): ?>
  81. <?php echo $this->pages->get_template_count($template['templateID']); ?> <small>page(s)</small>
  82. <?php endif; ?></td>
  83. <td>
  84. <?php echo anchor('/admin/pages/edit_template/'.$template['templateID'], 'Edit'); ?>
  85. </td>
  86. <td>
  87. <?php echo anchor('/admin/pages/delete_template/'.$template['templateID'], 'Delete', 'onclick="return confirm(\'Are you sure you want to delete this?\')"'); ?>
  88. </td>
  89. </tr>
  90. <?php endforeach; ?>
  91. </table>
  92. <?php echo $this->pagination->create_links(); ?>
  93. <p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
  94. <?php else: ?>
  95. <p>There are no templates here yet.</p>
  96. <?php endif; ?>