Allow to edit gas station in place
[infodrom.org/service.infodrom.org] / class / spritlog.class.php
index 451edc4..275a427 100644 (file)
@@ -22,11 +22,11 @@ class SpritLog extends DatabaseTable {
     $total_liter = 0;
     $total_price = 0;
     foreach ($this->db->fetchObjectList($sql) as $row) {
-      $out .= sprintf('<tr id="%d"><td>%s</td><td>%s</td><td>%s</td>' .
+      $out .= sprintf('<tr id="%d"><td>%s</td><td>%s</td><td><span route="SpritLog/EditTankstelle" item_id="%d">%s</span></td>' .
                      '<td class="right">%.2f</td><td class="right">%.2f</td><td class="right">%.2f</td>' .
                      '<td class="right">%d</td><td class="right">%d</td></tr>',
                      $row->id, assert_german_date($row->date),
-                     $row->city, $row->tankstelle,
+                     $row->city, $row->id, $row->tankstelle,
                      $row->price_liter, $row->liter,$row->price,
                      $row->km, $row->km_total);
       $total_km += $row->km;
@@ -107,4 +107,10 @@ class SpritLog extends DatabaseTable {
     return array('suggestions' => $list);
   }
 
+  public function ajaxEditTankstelle(Array $data)
+  {
+    if (!strlen($data['content'])) return false;
+    return $this->modify('tankstelle', $data['content']);
+  }
+
 }