<?php
function smarty_function_draw_address_table($params,&$smarty){
	switch($params['source']){
		case 'company':
			$template = 'address_table_company.tpl';
			require_once(DIR_FS_ADMIN.DIR_WS_CLASSES.'companies.php');
			$class = new companies;
			break;
		case 'address_book':
			$template = 'address_table_company.tpl';
			require_once(DIR_FS_ADMIN.DIR_WS_CLASSES.'address_books.php');
			$class = new address_books;
			break;
		case 'customer':
			require_once(DIR_FS_ADMIN.DIR_WS_CLASSES.'customers.php');
			$class = new customers;
			$template = 'address_table_customer.tpl';
			break;
	}
	$snippet_smarty = new yesSmarty;
	$href_data = $class->get_href_data($params['values']['id'],'overview');
	$snippet_smarty->assign('heading_title',yes_draw_href_text($params['title'],$href_data['href'],$href_data['access'],$style='',$class='main_heading_link' ));
	$snippet_smarty->assign('address',$params['values']);
	if($params['edit_link']){
		$snippet_smarty->assign('edit_link',$params['edit_link']);
	}
	$html = $snippet_smarty->fetch(DIR_FS_ADMIN.'templates/'.$template);
	return $html;
}
