Commits

Anonymous committed 7493d6f

Show trade messages in trade report (butt ugly but works)

  • Participants
  • Parent commits ab04bbb

Comments (0)

Files changed (2)

php/base/MerchantReport.inc.php

 <?php
 class MerchantReport extends Report
 {
-	private $message;
-	private $ressources = array();
+    private $message;
+    private $ressources = array();
     private $to_picture = "";
     private $from_picture = "";
 
 
-	function setTypeString ()
-	{
-		$this->typestring = "Transport";
-	}
+    function setTypeString ()
+    {
+        $this->typestring = "Transport";
+    }
 
-	function setSymbol ()
-	{
-		$this->symbol = "gfx/bullet_green.png";
-	}
+    function setSymbol ()
+    {
+        $this->symbol = "gfx/bullet_green.png";
+    }
 
     function setToPicture ($imgsrc)
     {
     }
 
 
-	function __construct ($id)
-	{
-		parent::__construct($id);
-	}
+    function __construct ($id)
+    {
+        parent::__construct($id);
+    }
 
     function displayPicture ($imgsrc)
     {
     }
 
 
-	function addSpecialDataFromDatabase ($row, $me)
-	{
-		$this->ressources[$row['coin']] = $row['param'];
+    function addSpecialDataFromDatabase ($row, $me)
+    {
+        $this->ressources[$row['coin']] = $row['param'];
 
-	}
+    }
 
-	function addRessourceValues ($row)
-	{
-		$this->addSpecialDataFromDatabase($row, null);
-	}
+    function addRessourceValues ($row)
+    {
+        $this->addSpecialDataFromDatabase($row, null);
+    }
 
-	function displayBody ()
-	{
-		global $ressourceMap;
-		$output = '<table class="none">
-
-					<tr>
-						<td>
-							'.$this->displayPicture($this->from_picture).'
-						</td>
-						<td>
-							<table class="none">
-								<tr>';
-		foreach ($ressourceMap as $index => $name)
-		{
-			$output .= '<td>'.displayRessourceIcon ($name).' '.$this->ressources[$index].'
-					</td>';
-		}
-
-		$output .= '
-
-								</tr>
-							</table>
-						</td>
-						<td>
-							'.$this->displayPicture($this->to_picture).'
-						</td>
-					</tr>
-				</table>';
-		return $output;
-	}
+    function displayBody ()
+    {
+        global $ressourceMap;
+        $output = '<table class="none">
+            <tr>
+            <td>
+            '.$this->displayPicture($this->from_picture).'
+            </td>
+            <td>
+            <table class="none">
+            <tr>';
+        foreach ($ressourceMap as $index => $name)
+        {
+            $output .= '<td>'.displayRessourceIcon ($name).' '.$this->ressources[$index].'
+                </td>';
+        }
+        $output .= '
+            </tr>
+            </table>
+            </td>
+            <td>
+            '.$this->displayPicture($this->to_picture).'
+            </td>';
+        if (!empty($this->msg)){
+            $output .= '
+                <td>
+                ' . $this->msg . '
+                </td> ';
+        }
+        $output .= '			</tr>
+            </table>';
+        return $output;
+    }
 }
 
 ?>

php/base/Report.inc.php

 	/**the uid this report is addressed to*/
 	protected $touid;
 	/**the aid this report is adressed to*/
-	protected $toaid;
+    protected $toaid;
+    /**the message sent with the report*/
+    protected $msg;
 
 	/**
 	display the report's body - e.g, in a battle report this would be a list of all participating units
 		$this->activeUser = new UserLink ($row['uid1'], $row['from_who']);
 		$this->passiveUser = new UserLink ($row['uid2'], $row['to_who']);
 		$this->activeVillage = new VillageLink ($row['village1'], $row['from_where'], $row['from_x'], $row['from_y']);
-		$this->passiveVillage = new VillageLink ($row['village2'], $row['to_where'],  $row['to_x'], $row['to_y']);
+        $this->passiveVillage = new VillageLink ($row['village2'], $row['to_where'],  $row['to_x'], $row['to_y']);
+        $this->msg = $row['trade_msg'];
 
 		if (in_array($row['village2'], $me->allvillageids))
 			$this->own_village = true;
 	}
 
 }
-?>
+?>