<?php
/**
 * File handling the adding new business
 *
 *
 * PHP version 5.0
 *
 * @category	Anova
 * @package		latestNews
 * @author 		senthil_52ag05
 * @copyright	Copyright (c) 2009 {@link http://www.agriya.com Agriya Infoway}
 * @license		http://www.agriya.com Agriya Infoway Licence
 * @version		SVN: $Id: $
 * @since 		2009-01-05
 */
/**
 * File having common configuration variables required for the entire project
 */
require_once('../common/configs/config.inc.php'); //configurations
$CFG['lang']['include_files'][] = 'languages/%s/admin/latestNews.php';
$CFG['mods']['include_files'][] = 'common/classes/class_XmlParser.lib.php';
$CFG['html']['header'] = 'admin/html_header.php';
$CFG['html']['footer'] = 'admin/html_footer.php';
//compulsory
$CFG['mods']['is_include_only']['html_header'] = false;
$CFG['html']['is_use_header'] = false;
/**
 * To include application top file
 */
require($CFG['site']['project_path'].'common/application_top.inc.php');
//-------------- Class passwordUpdaterFormHandler begins --------------->>>>>//

class latestNews extends FormHandler
	{
		public function populateNews()
			{
				$getContents_ar = array();
				if($content = getContents($this->CFG['members']['productnews']))
					{
						$xmlObj = new XmlParser();
						$output_arr = $xmlObj->parse($content);
						if(isset($output_arr[0]['children']) and $output_arr[0]['children'])
							{
								$output_arr = $output_arr[0]['children'];
								$inc = 0;
								foreach($output_arr as $key=>$value)
									{
										if(!$value or !is_array($value))
											{
												continue;
											}
										foreach($value as $key1=>$value1)
											{
												if(!$value1 or !is_array($value1))
													{
														continue;
													}
												$myval = 0;
												foreach($value1 as $key2=>$value2)
													{
														$myval++;
														if($myval == 1)
															$value2['tagData'] = html_entity_decode($value2['tagData']);
														if($myval == 2)
															$value2['tagData'] = wordWrapManual($value2['tagData'], $this->CFG['admin']['blog']['line_length']);
														$getContents_ar[$inc][$value2['name']] = $value2['tagData'];

													}
											}
										$inc++;
									}
							}
					}
				return $getContents_ar;
			}
	}

//<<<<<-------------- Class passwordUpdater FormHandler begins ---------------//
//-------------------- Code begins -------------->>>>>//
$latestNews = new latestNews();
$latestNews->setPageBlockNames(array('block_main_ionformation'));
//default form fields and values...
$latestNews->setFormField('contact_name', '');

$latestNews->setAllPageBlocksHide();
$latestNews->setPageBlockShow('block_main_ionformation'); //default page block. show it. All others hidden
$latestNews->sanitizeFormInputs($_REQUEST);
//<<<<--------------------Code Ends----------------------//

//--------------------Page block templates begins-------------------->>>>>//
if($latestNews->isShowPageBlock('block_main_ionformation'))
	{
		$latestNews->block_main_ionformation['populateNews'] = $latestNews->populateNews();
	}
//include the header file
if(!isAjaxPage())
	{
		$latestNews->includeHeader();
	}
//include the content of the page
setTemplateFolder('admin/');
$smartyObj->display('latestNews.tpl');
//includ the footer of the page
//<<<<<<--------------------Page block templates Ends--------------------//
if(!isAjaxPage())
	{
		$latestNews->includeFooter();
	}
?>