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

	/**
	 * return array with table data
	 *
	 * @return array
	 */
	function get_smarty_data_array(){
		$array = (array) $this->data;
		$array['duane_status_name'] = yes_get_duane_status_name($array['duane_status_id']);
		$array['edit_link'] = yes_draw_href_image('images/icons/icon_edit.gif',IMAGE_EDIT,xtc_href_link(FILENAME_IMPORT_SHIP_COLLIES_EDIT,'id='.$array['import_ship_collies_id']),'import_ship_collies_edit','' );
		$array['delete_link'] = yes_draw_href_image_confirm(TEXT_REMOVE_ENTRY,'images/icons/delete.gif',IMAGE_EDIT,xtc_href_link(FILENAME_IMPORTS,'id='.$this->get_imports_id().'&isID='.$array['import_ships_id'].'&iscID='.$array['import_ship_collies_id'].'&subaction=delete_ship_collie'),'func_import_ship_collies_delete','' );
		return $array;
	}
	
	function get_imports_id(){
		$query = xtc_db_query(sprintf("SELECT imports_id FROM %s WHERE import_ships_id='%s'",TABLE_IMPORT_SHIPS,$this->data->import_ships_id));
		$record = xtc_db_fetch_array($query);
		return $record['imports_id'];
	}

	function get_ships_id(){
		$query = xtc_db_query(sprintf("SELECT orderer_ships_id FROM %s WHERE import_ships_id='%s'",TABLE_IMPORT_SHIPS,$this->data->import_ships_id));
		$record = xtc_db_fetch_array($query);
		return $record['orderer_ships_id'];
	}
}
