<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# This script may not be distributed, sold, given away for free  #
# to third party, or used as a part of any internet services 	 #
# such as webdesign etc.                                         #
##################################################################
*/

require_once ("config.inc.php");
require_once ("includes/mysql.inc.php");
require_once ("includes/Pager/Pager.php");
require_once ("classes/misc.class.php");
require_once ("classes/userside.class.php");

$message	= "";
$pages		= "";
$count		= 0;
$page		= isset($_REQUEST['page'])	?	trim($_REQUEST['page'])	:	"1";
$data		= array();

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
}//end if
else 
{       
        $objM		= new misc($objDB);
	$query="SELECT h.*,hc.* FROM ".TABLEPREFIX."Help h left join ".TABLEPREFIX."HelpCategory hc on h.hcid=hc.hcid 
													where hc.htype='client' and h.active='1' GROUP BY h.hcid ORDER BY h.hposition";
	$res=mysql_query($query) or die(mysql_error());
	$cnt=mysql_num_rows($res);

	if (@mysql_num_rows($res) > 0) 
	{
		while($row = @mysql_fetch_array($res)) 
		{
			$array[]	= $row;
		}//end while loop
		@mysql_free_result($res);
	}//end if	
	else
	{
		$message	= "No help(s) found.<br>";		
	}//end else

	$params 	= array(
		'mode'      => 'Sliding',
		'perPage'   => PAGESIZE,
		'urlVar'    => 'page',
		'extraVars' => array(),
		'itemData'  => $array
	);
	$objP 		= & Pager::factory($params);
	$data  		= $objP->getPageData();
	if (empty($data))
		$message	.= "No record(s) exists.<br>";
}
include_once ("title.inc.php");
include_once ("tophtml.inc.php");
?>

<div class="row">
	<div class="eight columns">
		<div class="search-rslts">
			<div class="row"><div class="inenr-hd"><h2>Help</h2></div></div>
			<div class="row">
				<div class="newdesignforinput maintext1">
					<?php if(isset($message) && trim($message)!='')
					      {
					?>
					<div class="full_row">
						<div class="maintext1 warning"><?php echo $message;?></div>
					</div>
					<?php
						  }//end if 
					      if (!empty($data)) 
						  { 
					?>
					
                   <div class="full_row">
				   		<div class="row">
							<?php
								$cnt='1';
								foreach ($data as $key => $value) 
								{ 
									if($cnt==5)
									{
										echo '</tr><tr><td colspan="2" align="left">&nbsp;<td></tr><tr>';
									}//end if
			
									$contents=mysql_query("SELECT * FROM ".TABLEPREFIX."Help where active='1' and 
															hcid='".$value['hcid']."' ORDER BY hposition desc") or die(mysql_error());
									if(mysql_num_rows($contents)>0)
									{
							 ?>
							  <div class="three columns"><strong class="boldtext"><?php echo htmlspecialchars(stripslashes($value['hctitle']));?></strong>
							<?php
												echo '<div class="row helptext">';
												//for($j=0;$j<mysql_num_rows($contents);$j++)
												while ($row = mysql_fetch_array($contents))  
												{
													$hid    =   $row["hid"];
													$himage =  $row["himage"];
													$htitle = $row["htitle"];
													
													
													echo '<div class="row help_outer">
															<div class="two columns">
																<a href="help_details.php?id='.$hid.'&name='.$htitle.'"><img src="./help/'.$himage.'" width="22" height="20" alt="'.$htitle.'" border="0"></a>
															</div>
															<div class="ten columns">
																<a href="help_details.php?id='.$hid.'&name='.$htitle.'">'.$htitle.'</a>
															';
													//$helpText = mysql_result($contents,$j,'helptext');
															$helpText = $row["helptext"];
													if ($helpText!= '')
																echo "<span class=\"help\"><a title=\"\"><img src=\"images/question_mark.jpg\" title='".$helpText."' border='0' height='15'></a></span>";
																
																echo '</div>
															</div>';
												}//end for loop
												echo '</div></div>';
											}//end if
									
										$cnt++;
									}//end foreach?>
						</div>
							<?php 
								  }//end if
							?>
				   </div>
					
				</div>
			</div>
		</div>
	</div>
	<div class="four columns right search_result_R">
		<?php include_once ("left.inc.php");?>
	</div>
</div>

<?php include_once('bottomhtml.inc.php');?>
