<?php
/**
 * export_target_collie class
 *
 */
class export_target_collie
{
	var $data;
	
	/**
	 * initiated the export_target_collie class
	 *
	 * @param object $export_target_collie_object
	 */
	function export_target_collie( $export_target_collie_object ){
		$this->data = $export_target_collie_object;
		$this->data->exports_id = $this->get_exports_id();
	}

	/**
	 * return array with table data
	 *
	 * @return array
	 */
	function get_smarty_data_array(){
		$array = (array) $this->data;
		$array['edit_link'] = yes_draw_href_image('images/icons/icon_edit.gif',IMAGE_EDIT,xtc_href_link(FILENAME_EXPORTS_TARGET_COLLIES_EDIT,'id='.$array['export_target_collies_id']),'export_target_collies_edit','' );
		$array['unit'] = yes_get_units_name($array['units_id']); 
		$array['delete_link'] = yes_draw_href_image_confirm(TEXT_REMOVE_ENTRY,'images/icons/delete.gif',IMAGE_DELETE,xtc_href_link(FILENAME_EXPORTS,'id='.$array['exports_id'].'&etID='.$array['export_targets_id'].'&etcID='.$array['export_target_collies_id'].'&subaction=delete_collie'),'func_export_target_collies_delete','' );
				return $array;
	}
	
	function get_exports_id(){
		$query = xtc_db_query(sprintf("SELECT exports_id FROM %s WHERE export_targets_id='%s'",TABLE_EXPORT_TARGETS,$this->data->export_targets_id));
		if($query){
			$record = xtc_db_fetch_array($query);
			return $record['exports_id'];
		}
	}
}
