<!--/span-->				<div class="span12"><div class="page-header">
	<h1>Classified Ads</h1>
	<div id="err_msg"></div>
			<a class="btn pull-right" href="<?php echo base_url()?>listing/moderation">Moderation list</a>
	 
			<!-- <a class="btn pull-right" href="listing.php?show=spam">Spam</a>-->
	 		 <a class="btn btn-primary pull-right" onclick="newCategory();return false;">
		<i class="icon-pencil icon-white"></i>
		New Listing	</a>				
</div>



<table class="table table-bordered">
	<thead>
		<tr>
			<th>Title</th>
			<th>Category</th>
	        			<th>Hits</th>
	        			<th>Date</th>
			<th>&nbsp;</th>
		</tr>
	</thead>
	<tbody>
<?php foreach($listings as $listing){ 
		$images=$this->postings_model->getPostingImages($listing->id);
		$category=$this->categories_model->getCategory($listing->category_id);
		
		if(count($images)>0){
			$item_image=$images->image_url;
		}else{
			$item_image='default.png';
		}
		?>
		<tr>
		<td><a title="<?php echo $listing->title;?>" href="<?php echo base_url();?>details/<?php echo formatText($listing->title);?>/<?php echo $listing->id;?>" target="_blank" title="View Ad Details"><?php echo substr($listing->title,0,15).'...';?></a></td>
        <td><a href="<?php echo base_url()?>listing/category/<?php echo $category->id;?>" title="<?php echo $category->name;?>"><?php echo $category->name;?></a></td>
                <td><?php echo $listing->views;?></td>
                <td><?php echo formatDate($listing->dt_created);?></td>
        <td class="action">
        	<a class="btn btn-primary" href="<?php echo base_url();?>account/editad/<?php echo $listing->id;?>" target="_blank" title="Edit Ad">
            	<i class="icon-edit icon-white"></i>
            </a>
		<?php if($listing->published==1){?>
                        <a class="btn btn-warning" onclick="deactivate(<?php echo $listing->id;?>);" href="#disable">
            	<i class="icon-remove icon-white"></i>
		<?php }else{ ?>
			<a class="btn btn-success" onclick="activate(<?php echo $listing->id;?>);" href="#activate">
            	<i class="icon-ok icon-white"></i>
		<?php } ?>
            </a> 
           <!-- <a class="btn btn-warning" onclick="return confirm('Spam?');" href="http://192.168.1.2/classified/manage/?post=1&amp;pwd=tchniy4g&amp;action=spam">
            	<i class="icon-fire icon-white"></i>
            </a>-->
                        <a class="btn btn-danger" onclick="return deleteItem(<?php echo $listing->id;?>);"
            	href="#delete">
            	<i class="icon-trash icon-white"></i>
            </a>
        </td>
        	
	</tr>
 <?php } ?>
	    </tbody>
</table>

<div class="pagination"><?php echo $links; ?></div>

</div><!--/span-->
