Location: PHPKode > projects > Netautor Professional > netautor/napro4/admin/docu/docu_show.php
<?php 
/* +----------------------------------------------------------------------+
   | Netautor Professional Application Server                             |
   +----------------------------------------------------------------------+
   | Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net>      |
   +----------------------------------------------------------------------+
   | This file is subject to license, that is bundled with this package   |
   | in the file LICENSE.TXT, and is available at through the             |
   | world-wide-web at http://www.netautor.com/license/                   |
   |                                                                      |
   | If you did not receive a copy of the license and are unable to       |
   | obtain it through the world-wide-web, please send a note to          |
   | hide@address.com so we can mail you a copy.                      |
   +----------------------------------------------------------------------+
   | Authors: Stefan Rottensteiner <hide@address.com>    |
   |          Marek  Kadziela      <hide@address.com>	      |
   |          Gregor Wollner                                              |
   |          Christian Unger                                             |
   |          Helli  Kleinhans  									      |
   +----------------------------------------------------------------------+
   | @version	$Revision: 1.32 $										  |
   +----------------------------------------------------------------------+*/

	require_once('../../include/init.inc');

	if (empty($language)) $language='en';	/*HotFix : Is not allways be set by browser*/

	$function_name = strtolower($function_name);
	session_register('show_language');
	session_register('show_deprecated');

	if(isset($new_show_language))		  $show_language = ($new_show_language=='--' ? '' : $new_show_language);
	if (isset($new_show_deprecated[0]) )  $show_deprecated = ($new_show_deprecated[0]=='set' ? 'set' : '' );

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
   +----------------------------------------------------------------------+
   | Netautor Professional Application Server                             |
   +----------------------------------------------------------------------+
   | Copyright (C) 1998-2002 digiconcept GmbH. <www.digiconcept.net>      |
   +----------------------------------------------------------------------+
   | This file is subject to license, that is bundled with this package   |
   | in the file LICENSE.TXT, and is available at through the             |
   | world-wide-web at http://www.netautor.com/license/                   |
   |                                                                      |
   | If you did not receive a copy of the license and are unable to       |
   | obtain it through the world-wide-web, please send a note to          |
   | hide@address.com so we can mail you a copy.                      |
   +----------------------------------------------------------------------+
   | Authors: Stefan Rottensteiner <hide@address.com>    |
   |          Marek  Kadziela      <hide@address.com>	      |
   |          Gregor Wollner                                              |
   |          Christian Unger                                             |
   |          Helli  Kleinhans  									      |
   +----------------------------------------------------------------------+*/
 */
-->
<html>
<head>
	<title>/digiconcept/netautor/documentation show <?php echo($function_name); ?></title>
</head>
<link rel="stylesheet" type="TEXT/CSS" media="screen" href="../../include/docu.css">
<body>
<?php 
	includeNaPro('array,na_functions,cache,xml,file');

	$docu_cache_path = (empty($GLOBALS['DC_ENV']->docucache) ? $GLOBALS['DC_ENV']->cachepath : $GLOBALS['DC_ENV']->docucache);
	$html_file_name = $docu_cache_path.$function_name.'_'.(empty($show_language)?'':$show_language).'_'.(empty($show_deprecated)?'0':'1').'.html';
	if (file_exists($html_file_name))
	{
		readfile($html_file_name);
		die();
	}

	$file = $GLOBALS['DC_ENV']->cachepath.'npf_functions.dat';
	if (!file_exists($GLOBALS['DC_ENV']->cachepath.'npf_functions.dat'))
	{
		naf_generate_def_file($DC_ENV);
	}
	/* Helper function to sort parameters by name*/
	function obj_sort_attribute_name($obj_a,$obj_b)
	{
		if ($obj_a['attributes']['name'] == $obj_b['attributes']['name']) return 0;
		return ( ( $obj_a['attributes']['name'] < $obj_b['attributes']['name']) ? -1 : 1);
	}

	$functions 		= cache_read($file);

	$function_def	= $functions[$function_name];

	if ($function_def['location']=='internal')
	{
		/* Bei internen Funktion nicht auf den gespeicherten Pfad verlassen, sondern immer der aktuellen Installation anpassen */
		$file   = substr($GLOBALS['DC_ENV']->includepath.'npf_lib/'.basename($function_def['include']),0,-3).'xml';
	}
	else
	{
		$file   = substr($function_def['include'],0,-3).'xml';
	}

	$function_def	= array	();
	$description 	= array	();
	$params 		= array	('unique'=>0,'keep_info'=>1);
	$ok				= XML_FileToArray($file,$function_def,$params);
	$temp 			= $function_def['NA_FUNCTION_DESCRIPT'][0]['value']['FUNCTION'];

	foreach ($temp as $function_def)
	{
		if ($function_def['attributes']['name'] == $function_name) break;
	}

	$text	=	array	('de'	=> array	(	'german'			=> 'Deutsch',
												'english'			=> 'Englisch',
												'any_lang'			=> 'Jede Sprache',
												'show_deprecated' 	=> 'Zeige alte Parameter',
												'show_example'		=> 'Beispiel'
											),
						 'en'	=> array	(	'german'			=> 'German',
						 						'english'			=> 'English',
												'any_lang'			=> 'Any language',
												'show_deprecated' 	=> 'Show old parameter',
												'show_example'		=> 'Example'
											),
						 ''	=> array(			'german'			=> 'German',
						 						'english'			=> 'English',
												'any_lang'			=> 'Any language',
												'show_deprecated' 	=> 'Show old parameter',
												'show_example'		=> 'Examples'
											 )
						);
	$function_def['attributes']['include'] = (substr($file,0,-3)).'fnc';
	if (!isset($show_language)) $show_language = $language;
	if (empty($show_language)) $show_language='en';

	$params_list='';

	usort($function_def['value']['PARAM'],'obj_sort_attribute_name');

	foreach ($function_def['value']['PARAM'] as $i => $descript)
	{
		if (!empty($descript['attributes']['depricated'])){
			if (empty($show_deprecated)) continue;
			$class= 'linkold';
		}
		else {
			$class= 'link'; //(empty($descript['attributes']['explizit']) ? 'link' : 'link');
		}
		$params_list.='	<tr>
							<td class="text">
							<br>
							</td>
							<td align="left" valign="top" class="text">
								<a class="'.$class.'" href="#'.$descript['attributes']['name'].'">'.$descript['attributes']['name'].'</a><br>
							</td>
							<td align="left" valign="top" class="text">
								= "<br>
							</td>
							<td align="left" valign="top" class="text">';
		$pos_list = array();

		if(!empty($descript['value']['VALUE']) && is_array($descript['value']['VALUE']))
		{
			sort($descript['value']['VALUE']);
			foreach($descript['value']['VALUE'] as $idx=>$wert)
			{
				$pos_list[]=$wert['value'];
			}

			$params_list.=implode(', ',$pos_list);
		}
		$params_list.='"		<br>
								<img src="../../grafik/pixel.gif" width="1" height="4"><br>
							</td>
						</tr>';
	}
//	if (!empty($show_language)) $language=$show_language;
?>
<a name="docu_top"></a>
<form>
<script language="JavaScript">
<!--
	function show_example(name)
	{
		url = '../../appl/na_professional/parse.php?mlay_id=1000001&xmlval_FUNCTION[0]='+name;
		<?php if (!empty($show_language)) echo("url+='&lang[0]=".$show_language."';\n");?>
		mywin = window.open(url,'EXAMPLE','width=700,height=500,scrollbars,resizable');
	}
//-->
</script>
<input type="hidden" name="function_name" 			value="<?php echo ($function_name); ?>">

<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td align="left" valign="top">
			<img src="../../grafik/pixel.gif" width="1" height="1"><br>
			<font class="select">
			<select name="new_show_language" onChange="this.form.submit();" class="select">
			<option <?php if ($show_language=='en') echo('selected');?>  value="en"	><?php echo (htmlentities($text[$show_language]['english'])); ?></option>
			<option <?php if ($show_language=='de') echo('selected');?>  value="de"	><?php echo (htmlentities($text[$show_language]['german'])); ?></option>
			</select>
			</font>
		</td>
		<td width="24">
			<img src="../../grafik/pixel.gif" width="24" height="1"><br>
		</td>
		<td align="left" >
			<input type="checkbox" name="new_show_deprecated[]" onClick="this.form.submit();" value="set" <?php if (!empty($show_deprecated) && $show_deprecated=='set') echo('checked'); ?>>
		</td>
		<td align="left" >
			<font class="text">
			<?php echo(htmlentities($text[$show_language]['show_deprecated'])); ?>
			</font>
			&nbsp; &nbsp; &nbsp;
			<input type="hidden" name="new_show_deprecated[]" 	value="0">
		</td>
		<td align="left" >
			<!--
			<img src="../../grafik/point.gif"><font class="text"><a title="example" href="javascript:show_example('<?php echo($function_def['attributes']['name']); ?>')" class="menu"><?php echo($text[$show_language]['show_example']);?></a></font>
			-->
		</td>
	</tr>
</table>
</form>

<br>

<font class="menu"><b><?php echo($function_def['attributes']['context']);?></b>&nbsp;&nbsp;/&nbsp;&nbsp;</font>
<font class="function">
		<?php 	if( empty($function_def['attributes']['tail']) )
			{
				echo('<a title="example" href="javascript:show_example(\''.$function_def['attributes']['name'].'\')" class="function"><#'.$function_def['attributes']['name'].'#></a>');
			}
			else
			{
				echo('<a title="example" href="javascript:show_example(\''.$function_def['attributes']['name'].'\')" class="function"><#'.$function_def['attributes']['name'].'#> <#/'.$function_def['attributes']['name'].'#></a>');
			}
		?>
		</b>
		<?php
			if(!empty($function_def['attributes']['depricated']))
			{
				echo('<font color=Red>Deprecated !!</font>');
			}
		?>
		<br>
</font>

<br>

<?php
if (!empty($function_def['value']['DESCRIPT']))
{
	foreach ($function_def['value']['DESCRIPT'] as $i => $descript)
	{
		if (!empty($show_language) && $show_language != $descript['attributes']['lang']) continue;
		echo('
				<font class="text">'.strtr($descript['value'],array_flip(get_html_translation_table())).'<br>
				</font>
			');
	}
}
?>

<br>

<?php
	echo('
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td colspan="4" align="left" valign="top">
						<font class="function">
						<a title="example" href="javascript:show_example(\''.$function_def['attributes']['name'].'\')" class="function"><#'.$function_def['attributes']['name'].'</a><br>
						</font>
						<img src="../../grafik/pixel.gif" width="1" height="4"><br>
					</td>
				</tr>
				'.$params_list.'
				<tr>
				<td colspan="4" align="left" valign="top">
					<font class="function">
					#>'.( empty($function_def['attributes']['tail']) ? '' : '<#/'.$function_def['attributes']['name'].'#>' ).'<br>
					</font>
				</td>
			</tr>
			<tr>
				<td width="47"><img src="../../grafik/pixel.gif" width="47" height="1"><br></td>
				<td width="130"><img src="../../grafik/pixel.gif" width="130" height="1"><br></td>
				<td width="20"><img src="../../grafik/pixel.gif" width="20" height="1"><br></td>
				<td width="200"><img src="../../grafik/pixel.gif" width="200" height="1"><br></td>
			</tr>
			</table>'
			);

if(!empty($function_def['value']['PARAM']))
{
	echo('
			<br><br>

			<font class="menu">
			<b>Parameter</b><br>
			</font>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td colspan="5" align="left" valign="top">
						<img src="../../grafik/trennung.gif" width="397" height="17"><br>
					</td>
				</tr>
		');

		usort($function_def['value']['PARAM'],'obj_sort_attribute_name');

			foreach ($function_def['value']['PARAM'] as $i => $descript)
			{
				if (!empty($descript['attributes']['depricated']) && empty($show_deprecated)) continue;
				if (empty($descript['attributes']['quote']))$quote = 'none';
				if ('1'==$descript['attributes']['quote']) 	$quote = 'simple';
				if ('2'==$descript['attributes']['quote']) 	$quote = 'extended';
				if ('3'==$descript['attributes']['quote']) 	$quote = 'ext. list';
				if (empty($descript['attributes']['magic']))$magic = 'full';
				if ('1'==$descript['attributes']['magic']) 	$magic = 'save';
				if ('2'==$descript['attributes']['magic']) 	$magic = 'none';
				$default = $descript['value']['DEFAULT'][0]['value'];


				if (!empty($descript['attributes']['depricated']))
				{
					echo('
						<tr>
							<td colspan="5" valign="top">
								<a name="'.$descript['attributes']['name'].'"></a>
								<font class="functionold">'.$descript['attributes']['name'].'</font>
								<font class="depricated"><b>&gt;&gt;&gt;Deprecated!&lt;&lt;&lt;</b></font>');
				}
				else
				{
					echo('
						<tr>
							<td colspan="5" valign="top">
								<a name="'.$descript['attributes']['name'].'"></a>
								<font class="function">'.$descript['attributes']['name'].'</font>');
				}

				if (!empty($descript['attributes']['new_name']))
					echo('		<font class="text"> See </font>
								<a href="#'.$descript['attributes']['new_name'].'" class="link" target="_self">'.$descript['attributes']['new_name'].'</a>
						');

					echo('
								<br><img src="../../grafik/pixel.gif" width="1" height="6"><br>
						');


				echo('
								<font class="text">');
				if (!empty($descript['value']['DESCRIPT']))
				{
					foreach($descript['value']['DESCRIPT'] as $j => $help)
					{
						if (!empty($help['attributes']['lang']) && (!empty($show_language) && $show_language != $help['attributes']['lang'])) continue;
						echo (strtr($help['value'],array_flip(get_html_translation_table())));
						echo('<br>');
					}
				}
				echo('			</font>
							</td>
						</tr>
						<tr>
							<td class="textgrey" valign="top">
								Use:<br>
								'.(empty($descript['attributes']['explizit']) ? '<font class="typeopt">optional</font>' : '<font class="typeexp">explizit</font>').'
							</td>
							<td class="textgrey" valign="top">
								Type:<br>
								'.(empty($descript['attributes']['flag'])?'<font class="typeopt">value param</font>':'<font class="typeexp">flag param</font>').'&nbsp;
							</td>
							<td class="textgrey" valign="top" >
								Quote:<br>
								<font class="type">'.$quote.'
							</td>
							<td class="textgrey" valign="top">
								Replacement:<br>
								<font class="type">'.$magic.'
							</td>
							<td class="textgrey" valign="top">
								Default Value:<br>
								<font class="type">'.$default.'<br></font>
							</td>
						</tr>
						<tr>
							<td colspan="5" height="28" align="right" valign="bottom" style="background-image:url(../../grafik/trennung.gif); background-repeat:repeat-x;">
								<a href="#docu_top"><img src="../../grafik/button_top.gif" border="0"></a><br>
							</td>
						</tr>

					');

			}
		}

		if (!empty($function_def['value']['EXAMPLE']))
		{
			echo('	<tr>
						<td colspan="6" class="kopfzeile1">Examples</td>
					</tr>');

			echo('	<tr>
						<td colspan="6"  align="center">');

				foreach ($function_def['value']['EXAMPLE'] as $i => $example)
				{
					if (!empty($show_language) && $show_language != $example['attributes']['lang']) continue;

					echo ('	<table border="1">
							<tr>
								<td><font class="fontfix">
									<pre>'.htmlspecialchars(strtr($example['value'],array_flip(get_html_translation_table()))).'</pre>
									</font>
								</td>
							</tr>
							</table>	');
				}

			echo('		</td>
					</tr>		');
		}

		?>
		</table>

<br><br><br>

</body>

</html><?php
if (!headers_sent())
{
	if (File_MkDirs(dirname($html_file_name).'/') && ($file_handle=fopen($html_file_name,'wb')))
	{
		$file_content = ob_get_contents();
		fwrite($file_handle,$file_content,strlen($file_content));
		fclose($file_handle);
	}
}
?>
Return current item: Netautor Professional