First round of OO classes
authorJoey Schulze <joey@infodrom.org>
Fri, 4 Apr 2014 19:15:14 +0000 (19:15 +0000)
committerJoey Schulze <joey@infodrom.org>
Fri, 4 Apr 2014 19:15:14 +0000 (19:15 +0000)
class/accountname.class.php [new file with mode: 0644]
class/ajaxbackend.class.php
class/sales.class.php [new file with mode: 0644]

diff --git a/class/accountname.class.php b/class/accountname.class.php
new file mode 100644 (file)
index 0000000..9f95ec2
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+class AccountName extends DatabaseTable {
+
+  public function __construct($id)
+  {
+    if (is_numeric($id))
+      parent::__construct('account_names', $id);
+    else
+      parent::__construct('account_names', $id, 'blz_kto');
+  }
+
+}
+
+?>
index 304e20e..53c9d92 100644 (file)
@@ -8,6 +8,12 @@ class AJAXBackend {
     global $db;
     $this->db = $db;
   }
+
+  public function salesText()
+  {
+    $sales = new Sales($_POST['id']);
+    $sales->setDescription($_POST['text']);    
+  }
 }
 
 ?>
\ No newline at end of file
diff --git a/class/sales.class.php b/class/sales.class.php
new file mode 100644 (file)
index 0000000..68e9987
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+class Sales extends DatabaseTable {
+
+  public function __construct($id)
+  {
+    $this->idcolumn = 'nr';
+    parent::__construct('sales', $id);
+  }
+
+  public function setPaid()
+  {
+    return $this->modify('paid', 1);
+  }
+
+  public function unsetPaid()
+  {
+    return $this->modify('paid', 0);
+  }
+
+  public function setDescription($text)
+  {
+    return $this->modify('description', $text);
+  }
+
+}
+
+?>