PageRenderTime 447ms CodeModel.GetById 231ms app.highlight 18ms RepoModel.GetById 193ms app.codeStats 1ms

/halogy/application/modules/files/views/admin/viewall.php

https://bitbucket.org/haloweb/halogy-1.0/
PHP | 205 lines | 156 code | 49 blank | 0 comment | 19 complexity | 06a3997a6bc32abee66eed336a58d608 MD5 | raw file
  1<style type="text/css">
  2.ac_results { padding: 0px; border: 1px solid black; background-color: white; overflow: hidden; z-index: 99999; }
  3.ac_results ul { width: 100%; list-style-position: outside; list-style: none; padding: 0; margin: 0; }
  4.ac_results li { margin: 0px; padding: 2px 5px; cursor: default; display: block; font: menu; font-size: 12px; line-height: 16px; overflow: hidden; }
  5.ac_results li span.email { font-size: 10px; } 
  6.ac_loading { background: white url('<?php echo $this->config->item('staticPath'); ?>/images/loader.gif') right center no-repeat; }
  7.ac_odd { background-color: #eee; }
  8.ac_over { background-color: #0A246A; color: white; }
  9</style>
 10
 11<script language="javascript" type="text/javascript" src="<?php echo $this->config->item('staticPath'); ?>/js/jquery.fieldreplace.js"></script>
 12<script type="text/javascript">
 13$(function(){
 14	$('.toggle').click(function(event){ 
 15		event.preventDefault();		
 16		$('div#upload-file').slideToggle('400');
 17		$('div#upload-zip:visible, div#loader:visible').slideToggle('400');
 18	});
 19
 20	$('.toggle-zip').click(function(event){ 
 21		event.preventDefault();		
 22		$('div#upload-zip').toggle('400');
 23		$('div#upload-file:visible, div#loader:visible').slideToggle('400');
 24	});
 25
 26	$('.edit').click(function(event){
 27		event.preventDefault();
 28		$.scrollTo(0, '200');
 29		$('div#loader').load(this.href, function(){
 30			$('div#loader:hidden').toggle('400');
 31			$('div#upload-zip:visible, div#upload-file:visible').slideToggle('400');
 32		});
 33	});
 34	
 35    $('#searchbox').fieldreplace();
 36	function formatItem(row) {
 37		if (row[0].length) return row[1]+'<br /><span class="email">(#'+row[0]+')</span>';
 38		else return 'No results';
 39	}
 40	$('#searchbox').autocomplete("/admin/files/ac_files", { delay: "0", selectFirst: false, matchContains: true, formatItem: formatItem, minChars: 2 });
 41	$('#searchbox').result(function(event, data, formatted){
 42		$(this).parent('form').submit();
 43	});
 44	
 45	$('select#folderID').change(function(){
 46		var folderID = ($(this).val());
 47		window.location.href = '/admin/files/viewall/'+folderID;
 48	});
 49});
 50</script>
 51
 52<h1 class="headingleft">Files</h1>
 53
 54<div class="headingright">
 55
 56	<form method="post" action="/admin/files/viewall" class="default" id="search">
 57		<input type="text" name="searchbox" id="searchbox" class="formelement inactive" title="Search Files..." />
 58		<input type="image" src="<?php echo $this->config->item('staticPath'); ?>/images/btn_search.gif" id="searchbutton" />
 59	</form>
 60
 61	<label for="folderID">
 62		Folder
 63	</label> 
 64
 65	<?php
 66		$options = '';
 67		$options['me'] = 'My Files';
 68		if (@in_array('files_all', $this->permission->permissions)):
 69			$options['all'] = 'View All Files';
 70
 71			if ($folders):
 72				foreach ($folders as $folder):
 73					$options[$folder['folderID']] = $folder['folderName'];
 74				endforeach;
 75			endif;
 76		endif;
 77		echo form_dropdown('folderID', $options, $folderID, 'id="folderID"');
 78	?>
 79
 80	<?php if ($this->site->config['plan'] = 0 || $this->site->config['plan'] = 6 || (($this->site->config['plan'] > 0 && $this->site->config['plan'] < 6) && $quota < $this->site->plans['storage'])): ?>
 81
 82		<a href="#" class="button toggle blue">Upload File</a>
 83
 84	<?php endif; ?>
 85	
 86</div>
 87
 88<?php if ($errors = validation_errors()): ?>
 89	<div class="error clear">
 90		<?php echo $errors; ?>
 91	</div>
 92<?php endif; ?>
 93
 94<div id="upload-file"class="hidden clear">
 95	<form method="post" action="<?php echo $this->uri->uri_string(); ?>" enctype="multipart/form-data" class="default">
 96	
 97		<label for="file">File:</label>
 98		<div class="uploadfile">
 99			<?php echo @form_upload('file',$this->validation->file, 'size="16" id="file"'); ?>
100		</div>
101		<br class="clear" />
102
103		<label for="fileFolderID">Folder: <small>[<a href="/admin/files/folders" onclick="return confirm('You will lose any unsaved changes.\n\nContinue anyway?')">update</a>]</small></label>
104		<?php
105			$options = '';		
106			$options[0] = 'No Folder';
107			if ($folders):
108				foreach ($folders as $folderID):
109					$options[$folderID['folderID']] = $folderID['folderName'];
110				endforeach;
111			endif;
112				
113			echo @form_dropdown('folderID',$options,set_value('folderID', $data['folderID']),'id="fileFolderID" class="formelement"');
114		?>	
115		<br class="clear" /><br />
116			
117		<input type="submit" value="Upload File" class="button nolabel" id="submit" />
118		<a href="/admin/files" class="button cancel grey">Cancel</a>
119		
120	</form>
121</div>
122
123<div id="loader" class="hidden clear"></div>
124
125<?php if ($this->site->config['plan'] > 0 && $this->site->config['plan'] < 6): ?>
126
127	<?php if ($quota > $this->site->plans['storage']): ?>
128	
129	<div class="error clear">
130		<p>You have gone over your storage capacity, we will be contacting you soon.</p>
131	</div>
132	
133	<div class="quota">
134		<div class="over"><?php echo floor($quota / $this->site->plans['storage'] * 100); ?>%</div>
135	</div>
136	
137	<?php else: ?>
138	
139	<div class="quota">
140		<div class="used" style="width: <?php echo ($quota > 0) ? (floor($quota / $this->site->plans['storage'] * 100)) : 0; ?>%"><?php echo floor($quota / $this->site->plans['storage'] * 100); ?>%</div>
141	</div>
142	
143	<?php endif; ?>
144
145	<p><small>You have used <strong><?php echo number_format($quota); ?>kb</strong> out of your <strong><?php echo number_format($this->site->plans['storage']); ?> KB</strong> quota.</small></p>
146
147<?php endif; ?>
148
149<?php if ($files): ?>
150
151	<?php echo $this->pagination->create_links(); ?>
152	
153	<table class="images files clear">	
154		<tr>
155		<?php
156			$numItems = sizeof($files);
157			$itemsPerRow = 6;
158			$i = 0;
159						
160			foreach ($files as $file)
161			{
162				if (($i % $itemsPerRow) == 0 && $i > 1)
163				{
164					echo '</tr><tr>'."\n";
165					$i = 0;
166				}
167				echo '<td align="center" valign="top" width="'.floor(( 1 / $itemsPerRow) * 100).'%">';
168
169				$extension = substr($file['filename'], strpos($file['filename'], '.')+1);
170				$filePath = '/files/'.$file['fileRef'].'.'.$extension;				
171
172		?>
173
174				<div class="buttons">
175					<?php echo anchor('/admin/files/edit/'.$file['fileID'].'/', '<img src="'.$this->config->item('staticPath').'/images/btn_edit.png" alt="Edit" />', 'class="edit"'); ?>
176					<?php echo anchor('/admin/files/delete/'.$file['fileID'], '<img src="'.$this->config->item('staticPath').'/images/btn_delete.png" alt="Delete" />', 'onclick="return confirm(\'Are you sure you want to delete this file?\')"'); ?>
177				</div>
178
179				<a href="<?php echo $filePath; ?>" title="<?php echo $file['fileRef']; ?>"><img src="<?php echo $this->config->item('staticPath'); ?>/fileicons/<?php echo $extension; ?>.png" alt="<?php echo $file['fileRef']; ?>" class="file" /></a>
180
181				<p><strong><?php echo $file['fileRef']; ?></strong></p>
182			
183		<?php
184				echo '</td>'."\n";
185				$i++;
186			}
187		
188			for($x = 0; $x < ($itemsPerRow - $i); $x++)
189			{
190				echo '<td width="'.floor((1 / $itemsPerRow) * 100).'%">&nbsp;</td>';
191			}
192		?>
193		</tr>
194	</table>
195	
196	<?php echo $this->pagination->create_links(); ?>
197
198	<p style="text-align: right;"><a href="#" class="button grey" id="totop">Back to top</a></p>
199
200<?php else: ?>
201
202<p class="clear">You have not yet uploaded any files.</p>
203
204<?php endif; ?>
205