<?php 
	$form =  $this->Form;
	$session =  $this->Session;
	$html = $this->Html;
?>
<?php echo $this->Html->script('jquery.js');?>
<?php echo $this->Html->script('hint.js'); ?> 
<script language="JavaScript" type="text/JavaScript">
function clickSearch()
{
	document.frmHelp.submit();
}
</script>


	<div align="left" id="item_details_admin">
                           <div class="admin_subheading">Help Content</div>
<!--search area start -->					
					<form action="<?php echo $sitebase.$sitefolder.'/'.$this->params["controller"];?>" method="get" name="frmHelp">
    				<div class="content_search_container">
						
  		 			 <select name="cmbSearchType" class="box2_admin" style="padding:6px; ">
					<option value="title"  <?php if($cmbSearchType == "title" || $cmbSearchType == ""){ echo("selected"); } ?>>Title</option>
					<option value="content"  <?php if($cmbSearchType == "content"){ echo("selected"); } ?>>Content</option>
					</select> &nbsp;
					<input type="text" name="txtSearch" maxlength="50" value="<?php echo(htmlentities($txtSearch)); ?>" class="box2_admin_new" >
				
					
					<a style="cursor:pointer" onClick="javascript:clickSearch();" class="button orange">Search</a>
					<div class="clear"></div>
					 </div>		
											
				   </form>						
<!--search area end -->	
	 <?php 
                         if(isset($passedarg["direction"])){
                               if($passedarg["direction"]=="asc")
                               {
                                   $keyasc = "asc";
                                   $sortfield = $passedarg["sort"];
                               }
                               if($passedarg["direction"]=="desc")
                               {
                                   $keydesc = "desc";
                                   $sortfield = $passedarg["sort"];
                               }
                         }                       
                         ?>
	<div class="btn-pnl">					
                                <label ><?php echo $this->html->link('Add New Help File','/helps/add',array('class' => 'button white right'))?></label>
				<div class="clear"></div>
	</div>

 <?php if($session->check('Message.flash')) { ?><div id="okbox"><font color="#FF0000"><?php echo $session->flash(); ?></font></div><?php } ?>
<div align="center" id="items_display_area_admin" class="inner_content_area_admin_new withpadding">
				<!--items display area start -->
				<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="admin-table-list">
					
					  <tr>
						<th width="9%">#</th>
						<th width="29%"><?php echo $this->paginator->sort('title','Title'); ?>
                                                <?php if($sortfield=="title") 
                                                                     {
                                                                        if(isset($keyasc))
                                                                        { echo $this->html->image('../img/up-arrow.png');}elseif(isset ($keydesc)){echo $this->html->image('../img/down-arrow.png');}
                                                                     }
                                                                        ?>
                                                </th>
						<th width="47%"><?php echo $this->paginator->sort('content','Content'); ?>
                                                <?php if($sortfield=="content") 
                                                                     {
                                                                        if(isset($keyasc))
                                                                        { echo $this->html->image('../img/up-arrow.png');}elseif(isset ($keydesc)){echo $this->html->image('../img/down-arrow.png');}
                                                                     }
                                                                        ?>
                                                </th>
						<th width="47%"><?php echo $this->paginator->sort('type','Type'); ?>
                                                <?php if($sortfield=="type") 
                                                                     {
                                                                        if(isset($keyasc))
                                                                        { echo $this->html->image('../img/up-arrow.png');}elseif(isset ($keydesc)){echo $this->html->image('../img/down-arrow.png');}
                                                                     }
                                                                        ?>
                                                </th>
                                                </th>
						<th width="15%">Options</th>
					  </tr>
					 <?php
						if(!empty($passedarg) && !isset($passedarg["page"]))								
									$cnt=1;
									else if(!empty($passedarg) && $passedarg["page"]==1)
									$cnt=1;
									else
									$cnt=((($passedarg["page"]-1)*($passedarg["limit"]))+1);
					   if(!empty($help))
					   {
					    foreach ($help as $cat){ ?> 
							  <tr align="left" valign="middle" id="list_admin">
								<td valign="top"><?php echo $cnt++;?></td>
								<td valign="top">
								<?php echo Sanitize::html($cat['Help']['title']); ?></td>
								<td>
								<?php echo $cat["Help"]["content"]; ?>															
								</td>
								<td valign="top">
								<?php 
								$utype=$cat["Help"]["type"]; 
								if(isset($utype)) {
								if($utype=='A')
								echo "Admin";
								else if($utype=='U')
								echo "User"; }
								?>
								</td>
								<td valign="top"><?php echo $this->html->link('Edit', "/helps/edit/".$cat['Help']['id']); ?> / <?php echo $this->html->link('Delete', "/helps/delete/".$cat['Help']['id'],null,'Are you sure you want to delete this help entry?'); ?></td>
							  </tr>  
					   <?php  }  ?>					  
										 
						  
						    <tr>
						       <td colspan="5" style="text-align:right ">
							   <?php 
									  if($cmbSearchType <> '' &&  $txtSearch <> ''){
									   $this->paginator->options(array('url'=>array_merge(array('cmbSearchType'=>$cmbSearchType,
									   'txtSearch'=>$txtSearch),$this->passedArgs))); }  ?>
														 <?php echo $this->paginator->numbers(); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $this->paginator->counter(); ?></td>
						    </tr>
					      
						  <?php }  else { ?>					     
							
						     <tr id="list_admin">
						       <td align="center" colspan="5" style="text-align: center;">No Records Found</td>
						     </tr>
					       		  
						  <?php } ?>
				
				</table>
				
 <div align="left" class="float_clear1"></div>
</div>
 <div align="left" class="float_clear1"><?php echo $this->html->image('/img/clear.gif');?></div></div> 