PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 8ms RepoModel.GetById 32ms app.codeStats 0ms

/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
 25<h1 class="headingleft">Page Templates</h1>
 26
 27<div class="headingright">
 28	<label for="filter">
 29		Filter
 30	</label> 
 31
 32	<?php
 33		$options = array(
 34			'' => 'View All',
 35			'page' => 'Page Templates',
 36			'module' => 'Module Templates'
 37		);
 38		
 39		echo form_dropdown('filter', $options, $type, 'id="filter"');
 40	?>
 41	<a href="/admin/pages/includes" class="button blue">Includes</a>
 42	<a href="#" class="button blue toggle-zip">Import Theme</a>
 43	<a href="/admin/pages/add_template" class="button">Add Template</a>
 44</div>
 45
 46<div class="hidden">
 47	<p class="hide"><a href="#">x</a></p>
 48	<div class="inner"></div>
 49</div>
 50
 51<div class="clear"></div>
 52
 53<?php if ($errors = validation_errors()): ?>
 54	<div class="error clear">
 55		<?php echo $errors; ?>
 56	</div>
 57<?php endif; ?>
 58
 59<div id="upload-zip" class="hidden clear">
 60	<form method="post" action="<?php echo $this->uri->uri_string(); ?>" enctype="multipart/form-data" class="default">
 61	
 62		<label for="image">ZIP File:</label>
 63		<div class="uploadfile">
 64			<?php echo @form_upload('zip', '', 'size="16" id="image"'); ?>
 65		</div>
 66		<br class="clear" /><br />	
 67
 68		<input type="submit" value="Import Theme" name="upload_zip" class="button nolabel" id="submit" />
 69		<a href="/admin/images" class="button cancel grey">Cancel</a>
 70			
 71	</form>
 72</div>
 73
 74<?php if ($templates): ?>
 75
 76<?php echo $this->pagination->create_links(); ?>
 77
 78<table class="default clear">
 79	<tr>
 80		<th>Templates</th>
 81		<th>Date Modified</th>		
 82		<th>Usage</th>	
 83		<th class="tiny">&nbsp;</th>
 84		<th class="tiny">&nbsp;</th>		
 85	</tr>
 86<?php
 87	$i = 0;
 88	foreach ($templates as $template): 
 89	$class = ($i % 2) ? ' class="alt"' : ''; $i++;
 90?>
 91	<tr<?php echo $class;?>>
 92		<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>
 93		<td><?php echo dateFmt($template['dateCreated']); ?></td>		
 94		<td><?php if ($this->pages->get_template_count($template['templateID']) > 0): ?>
 95				<?php echo $this->pages->get_template_count($template['templateID']); ?> <small>page(s)</small>
 96			<?php endif; ?></td>
 97		<td>
 98			<?php echo anchor('/admin/pages/edit_template/'.$template['templateID'], 'Edit'); ?>
 99		</td>
100		<td>
101			<?php echo anchor('/admin/pages/delete_template/'.$template['templateID'], 'Delete', 'onclick="return confirm(\'Are you sure you want to delete this?\')"'); ?>
102		</td>
103	</tr>
104<?php endforeach; ?>
105</table>
106
107<?php echo $this->pagination->create_links(); ?>
108
109<p class="clear" style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
110
111<?php else: ?>
112
113<p>There are no templates here yet.</p>
114
115
116<?php endif; ?>
117